From b92bffffb134cff6311ec7091cdda92075e132a8 Mon Sep 17 00:00:00 2001 From: Sanchime Date: Mon, 2 May 2022 17:10:35 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .vscode/solution-explorer/class.cs-template | 5 ++ .vscode/solution-explorer/class.ts-template | 3 ++ .vscode/solution-explorer/class.vb-template | 9 ++++ .vscode/solution-explorer/default.ts-template | 3 ++ .vscode/solution-explorer/enum.cs-template | 5 ++ .../solution-explorer/interface.cs-template | 5 ++ .../solution-explorer/interface.ts-template | 3 ++ .vscode/solution-explorer/template-list.json | 46 +++++++++++++++++++ .../solution-explorer/template-parameters.js | 17 +++++++ Sanchime.Functional/Core/Extensions/Option.cs | 8 ---- Sanchime.Test/Program.cs | 3 +- 11 files changed, 97 insertions(+), 10 deletions(-) create mode 100644 .vscode/solution-explorer/class.cs-template create mode 100644 .vscode/solution-explorer/class.ts-template create mode 100644 .vscode/solution-explorer/class.vb-template create mode 100644 .vscode/solution-explorer/default.ts-template create mode 100644 .vscode/solution-explorer/enum.cs-template create mode 100644 .vscode/solution-explorer/interface.cs-template create mode 100644 .vscode/solution-explorer/interface.ts-template create mode 100644 .vscode/solution-explorer/template-list.json create mode 100644 .vscode/solution-explorer/template-parameters.js diff --git a/.vscode/solution-explorer/class.cs-template b/.vscode/solution-explorer/class.cs-template new file mode 100644 index 0000000..20c7109 --- /dev/null +++ b/.vscode/solution-explorer/class.cs-template @@ -0,0 +1,5 @@ +namespace {{namespace}}; + +public class {{name}} +{ +} diff --git a/.vscode/solution-explorer/class.ts-template b/.vscode/solution-explorer/class.ts-template new file mode 100644 index 0000000..ff2edef --- /dev/null +++ b/.vscode/solution-explorer/class.ts-template @@ -0,0 +1,3 @@ +export class {{name}} { + +} \ No newline at end of file diff --git a/.vscode/solution-explorer/class.vb-template b/.vscode/solution-explorer/class.vb-template new file mode 100644 index 0000000..38ef67f --- /dev/null +++ b/.vscode/solution-explorer/class.vb-template @@ -0,0 +1,9 @@ +Imports System + +Namespace {{namespace}} + + Public Class {{name}} + + End Class + +End Namespace diff --git a/.vscode/solution-explorer/default.ts-template b/.vscode/solution-explorer/default.ts-template new file mode 100644 index 0000000..04af870 --- /dev/null +++ b/.vscode/solution-explorer/default.ts-template @@ -0,0 +1,3 @@ +export default {{name}} { + +} \ No newline at end of file diff --git a/.vscode/solution-explorer/enum.cs-template b/.vscode/solution-explorer/enum.cs-template new file mode 100644 index 0000000..1ded8c0 --- /dev/null +++ b/.vscode/solution-explorer/enum.cs-template @@ -0,0 +1,5 @@ +namespace {{namespace}}; + +public enum {{name}} +{ +} diff --git a/.vscode/solution-explorer/interface.cs-template b/.vscode/solution-explorer/interface.cs-template new file mode 100644 index 0000000..bf25cbb --- /dev/null +++ b/.vscode/solution-explorer/interface.cs-template @@ -0,0 +1,5 @@ +namespace {{namespace}}; + +public interface {{name}} +{ +} diff --git a/.vscode/solution-explorer/interface.ts-template b/.vscode/solution-explorer/interface.ts-template new file mode 100644 index 0000000..3ea404b --- /dev/null +++ b/.vscode/solution-explorer/interface.ts-template @@ -0,0 +1,3 @@ +export interface {{name}} { + +} \ No newline at end of file diff --git a/.vscode/solution-explorer/template-list.json b/.vscode/solution-explorer/template-list.json new file mode 100644 index 0000000..2849622 --- /dev/null +++ b/.vscode/solution-explorer/template-list.json @@ -0,0 +1,46 @@ +{ + "templates": [ + { + "name": "Class", + "extension": "cs", + "file": "./class.cs-template", + "parameters": "./template-parameters.js" + }, + { + "name": "Interface", + "extension": "cs", + "file": "./interface.cs-template", + "parameters": "./template-parameters.js" + }, + { + "name": "Enum", + "extension": "cs", + "file": "./enum.cs-template", + "parameters": "./template-parameters.js" + }, + { + "name": "Class", + "extension": "ts", + "file": "./class.ts-template", + "parameters": "./template-parameters.js" + }, + { + "name": "Interface", + "extension": "ts", + "file": "./interface.ts-template", + "parameters": "./template-parameters.js" + }, + { + "name": "Default", + "extension": "ts", + "file": "./default.ts-template", + "parameters": "./template-parameters.js" + }, + { + "name": "Class", + "extension": "vb", + "file": "./class.vb-template", + "parameters": "./template-parameters.js" + } + ] +} \ No newline at end of file diff --git a/.vscode/solution-explorer/template-parameters.js b/.vscode/solution-explorer/template-parameters.js new file mode 100644 index 0000000..daba8b2 --- /dev/null +++ b/.vscode/solution-explorer/template-parameters.js @@ -0,0 +1,17 @@ +var path = require("path"); + +module.exports = function(filename, projectPath, folderPath) { + var namespace = "Unknown"; + if (projectPath) { + namespace = path.basename(projectPath, path.extname(projectPath)); + if (folderPath) { + namespace += "." + folderPath.replace(path.dirname(projectPath), "").substring(1).replace(/[\\\/]/g, "."); + } + namespace = namespace.replace(/[\\\-]/g, "_"); + } + + return { + namespace: namespace, + name: path.basename(filename, path.extname(filename)) + } +}; \ No newline at end of file diff --git a/Sanchime.Functional/Core/Extensions/Option.cs b/Sanchime.Functional/Core/Extensions/Option.cs index fdaddfc..009a16d 100644 --- a/Sanchime.Functional/Core/Extensions/Option.cs +++ b/Sanchime.Functional/Core/Extensions/Option.cs @@ -49,14 +49,6 @@ public static class OptionExtension #region 应用函子 - /// - /// 幺 - /// - /// - /// - /// - public static Option Identity(this Option option) => option; - public static Option Apply(this Option option, Func, R> apply, Option value) => option.Match( None: () => Option.None, diff --git a/Sanchime.Test/Program.cs b/Sanchime.Test/Program.cs index e77be9a..5f28270 100644 --- a/Sanchime.Test/Program.cs +++ b/Sanchime.Test/Program.cs @@ -1,2 +1 @@ -// See https://aka.ms/new-console-template for more information -Console.WriteLine("Hello, World of csharp!"); + \ No newline at end of file