export-table-pulgin-csharp 1.0.3 → 1.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -1,6 +1,9 @@
1
- import { ExportParams, IPlugin } from "windy-quicktable";
2
- export declare function export_stuff(paras: ExportParams): string | null;
3
- export declare class ExportPlugin implements IPlugin {
4
- cs(paras: ExportParams): string | null;
1
+ import { HandleSheetParams, PluginBase } from "windy-quicktable";
2
+ export declare function export_stuff(paras: HandleSheetParams): string | null;
3
+ export declare class ExportPlugin extends PluginBase {
4
+ name: string;
5
+ tags: string[];
6
+ handleSheet(paras: HandleSheetParams): string | null;
5
7
  }
8
+ export declare const ExportPlugins: ExportPlugin[];
6
9
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAO,YAAY,EAAkB,OAAO,EAAM,MAAM,kBAAkB,CAAA;AAEjF,wBAAgB,YAAY,CAAC,KAAK,EAAE,YAAY,GAAG,MAAM,GAAG,IAAI,CA+J/D;AAED,qBAAa,YAAa,YAAW,OAAO;IAC3C,EAAE,CAAC,KAAK,EAAE,YAAY,GAAG,MAAM,GAAG,IAAI;CAGtC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAO,iBAAiB,EAA+B,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAGlG,wBAAgB,YAAY,CAAC,KAAK,EAAE,iBAAiB,GAAG,MAAM,GAAG,IAAI,CA+JpE;AAED,qBAAa,YAAa,SAAQ,UAAU;IAC3C,IAAI,SAAW;IACf,IAAI,EAAE,MAAM,EAAE,CAAS;IAEvB,WAAW,CAAC,KAAK,EAAE,iBAAiB;CAOpC;AAED,eAAO,MAAM,aAAa,gBAEzB,CAAA"}
package/dist/index.js CHANGED
@@ -1,7 +1,27 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
+ }) : (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ o[k2] = m[k];
8
+ }));
9
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
10
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
11
+ }) : function(o, v) {
12
+ o["default"] = v;
13
+ });
14
+ var __importStar = (this && this.__importStar) || function (mod) {
15
+ if (mod && mod.__esModule) return mod;
16
+ var result = {};
17
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
18
+ __setModuleDefault(result, mod);
19
+ return result;
20
+ };
2
21
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ExportPlugin = exports.export_stuff = void 0;
22
+ exports.ExportPlugins = exports.ExportPlugin = exports.export_stuff = void 0;
4
23
  const windy_quicktable_1 = require("windy-quicktable");
24
+ const fs = __importStar(require("fs"));
5
25
  function export_stuff(paras) {
6
26
  let { datas, fields, inject, name, objects, packagename, tables, xxtea, } = paras;
7
27
  let firstLetterUpper = function (str) {
@@ -158,9 +178,21 @@ ${(0, windy_quicktable_1.foreach)(fields, f => ` public ${getFieldType(f.type)}
158
178
  return temp;
159
179
  }
160
180
  exports.export_stuff = export_stuff;
161
- class ExportPlugin {
162
- cs(paras) {
163
- return export_stuff(paras);
181
+ class ExportPlugin extends windy_quicktable_1.PluginBase {
182
+ constructor() {
183
+ super(...arguments);
184
+ this.name = "csharp";
185
+ this.tags = ["cs"];
186
+ }
187
+ handleSheet(paras) {
188
+ let content = export_stuff(paras);
189
+ if (content != null) {
190
+ fs.writeFileSync(paras.outFilePath, content, "utf-8");
191
+ }
192
+ return content;
164
193
  }
165
194
  }
166
195
  exports.ExportPlugin = ExportPlugin;
196
+ exports.ExportPlugins = [
197
+ new ExportPlugin(),
198
+ ];
package/package.json CHANGED
@@ -1,18 +1,20 @@
1
1
  {
2
2
  "name": "export-table-pulgin-csharp",
3
- "version": "1.0.3",
3
+ "version": "1.0.7",
4
4
  "description": "",
5
5
  "main": "./dist/index.js",
6
6
  "scripts": {
7
7
  "test": "echo \"Error: no test specified\" && exit 1"
8
8
  },
9
9
  "repository": {
10
- "type": "git",
11
- "url": "https://github.com/windyuuy/export-table-pulgin-csharp.git"
10
+ "type": "git",
11
+ "url": "https://github.com/windyuuy/export-table-pulgin-csharp.git"
12
12
  },
13
13
  "author": "windyuuy",
14
14
  "license": "ISC",
15
15
  "dependencies": {
16
+ "@types/node": "^17.0.18",
17
+ "fs": "^0.0.1-security",
16
18
  "windy-quicktable": "^1.3.34"
17
19
  }
18
20
  }
package/src/index.ts CHANGED
@@ -1,7 +1,8 @@
1
1
 
2
- import { cmm, ExportParams, Field, foreach, IPlugin, st } from "windy-quicktable"
2
+ import { cmm, HandleSheetParams, Field, foreach, IPlugin, st, PluginBase } from "windy-quicktable"
3
+ import * as fs from "fs"
3
4
 
4
- export function export_stuff(paras: ExportParams): string | null {
5
+ export function export_stuff(paras: HandleSheetParams): string | null {
5
6
  let {
6
7
  datas,
7
8
  fields,
@@ -162,8 +163,19 @@ ${foreach(fields, f =>
162
163
 
163
164
  }
164
165
 
165
- export class ExportPlugin implements IPlugin {
166
- cs(paras: ExportParams): string | null {
167
- return export_stuff(paras)
166
+ export class ExportPlugin extends PluginBase {
167
+ name = "csharp"
168
+ tags: string[] = ["cs"]
169
+
170
+ handleSheet(paras: HandleSheetParams) {
171
+ let content = export_stuff(paras)
172
+ if (content != null) {
173
+ fs.writeFileSync(paras.outFilePath, content, "utf-8")
174
+ }
175
+ return content
168
176
  }
169
177
  }
178
+
179
+ export const ExportPlugins = [
180
+ new ExportPlugin(),
181
+ ]
@@ -0,0 +1,55 @@
1
+
2
+ using System.Collections.Generic;
3
+
4
+ public class SceneConfig {
5
+
6
+ public static List<SceneConfig> Configs = new List<SceneConfig>()
7
+ {
8
+ new SceneConfig(1, "第1章 格莫拉城", 1000),
9
+ new SceneConfig(2, "第2章 纳皮尔乐园", 1200),
10
+ };
11
+
12
+ public SceneConfig() { }
13
+ public SceneConfig(int uid, string sceneId, double outingBaseGold)
14
+ {
15
+ this.Uid = uid;
16
+ this.SceneId = sceneId;
17
+ this.OutingBaseGold = outingBaseGold;
18
+ }
19
+
20
+ public virtual SceneConfig MergeFrom(SceneConfig source)
21
+ {
22
+ this.Uid = source.Uid;
23
+ this.SceneId = source.SceneId;
24
+ this.OutingBaseGold = source.OutingBaseGold;
25
+ return this;
26
+ }
27
+
28
+ public virtual SceneConfig Clone()
29
+ {
30
+ var config = new SceneConfig();
31
+ config.MergeFrom(this);
32
+ return config;
33
+ }
34
+
35
+ /// <summary>
36
+ /// uid
37
+ /// </summary>
38
+ public int Uid;
39
+
40
+ /// <summary>
41
+ /// 场景名
42
+ /// </summary>
43
+ public string SceneId;
44
+
45
+ /// <summary>
46
+ /// 出行基础金币收益
47
+ /// </summary>
48
+ public double OutingBaseGold;
49
+
50
+ #region get字段
51
+ public int uid => Uid;
52
+ public string 场景名 => SceneId;
53
+ public double 出行基础金币收益 => OutingBaseGold;
54
+ #endregion
55
+ }
File without changes
@@ -0,0 +1,55 @@
1
+
2
+ using System.Collections.Generic;
3
+
4
+ public class SceneConfig {
5
+
6
+ public static List<SceneConfig> Configs = new List<SceneConfig>()
7
+ {
8
+ new SceneConfig(1, "第1章 格莫拉城", 1000),
9
+ new SceneConfig(2, "第2章 纳皮尔乐园", 1200),
10
+ };
11
+
12
+ public SceneConfig() { }
13
+ public SceneConfig(int uid, string sceneId, double outingBaseGold)
14
+ {
15
+ this.Uid = uid;
16
+ this.SceneId = sceneId;
17
+ this.OutingBaseGold = outingBaseGold;
18
+ }
19
+
20
+ public virtual SceneConfig MergeFrom(SceneConfig source)
21
+ {
22
+ this.Uid = source.Uid;
23
+ this.SceneId = source.SceneId;
24
+ this.OutingBaseGold = source.OutingBaseGold;
25
+ return this;
26
+ }
27
+
28
+ public virtual SceneConfig Clone()
29
+ {
30
+ var config = new SceneConfig();
31
+ config.MergeFrom(this);
32
+ return config;
33
+ }
34
+
35
+ /// <summary>
36
+ /// uid
37
+ /// </summary>
38
+ public int Uid;
39
+
40
+ /// <summary>
41
+ /// 场景名
42
+ /// </summary>
43
+ public string SceneId;
44
+
45
+ /// <summary>
46
+ /// 出行基础金币收益
47
+ /// </summary>
48
+ public double OutingBaseGold;
49
+
50
+ #region get字段
51
+ public int uid => Uid;
52
+ public string 场景名 => SceneId;
53
+ public double 出行基础金币收益 => OutingBaseGold;
54
+ #endregion
55
+ }
Binary file
package/test/test.bat ADDED
@@ -0,0 +1 @@
1
+ call quicktable export src --one csharp:cs dist