export-table-pulgin-csharp 1.0.3 → 1.0.4
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 +5 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +31 -4
- package/package.json +6 -4
- package/src/index.ts +14 -6
- package/test/dist/SceneConfig.cs +55 -0
- package/test/dist/SceneConfig.csharp +0 -0
- package/test/dist/SceneConfig.csx +55 -0
- package/test/src/SceneConfig.xlsx +0 -0
- package/test/test.bat +1 -0
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare function export_stuff(paras:
|
|
3
|
-
export declare class ExportPlugin
|
|
4
|
-
|
|
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
|
+
handleSheet(paras: HandleSheetParams): string | null;
|
|
5
5
|
}
|
|
6
|
+
export declare const ExportPlugins: ExportPlugin[];
|
|
6
7
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoC,iBAAiB,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAGnG,wBAAgB,YAAY,CAAC,KAAK,EAAE,iBAAiB,GAAG,MAAM,GAAG,IAAI,CA+JpE;AAED,qBAAa,YAAa,SAAQ,UAAU;IAC3C,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,16 @@ ${(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
|
-
|
|
163
|
-
|
|
181
|
+
class ExportPlugin extends windy_quicktable_1.PluginBase {
|
|
182
|
+
handleSheet(paras) {
|
|
183
|
+
let content = export_stuff(paras);
|
|
184
|
+
if (content != null) {
|
|
185
|
+
fs.writeFileSync(paras.outFilePath, content, "utf-8");
|
|
186
|
+
}
|
|
187
|
+
return content;
|
|
164
188
|
}
|
|
165
189
|
}
|
|
166
190
|
exports.ExportPlugin = ExportPlugin;
|
|
191
|
+
exports.ExportPlugins = [
|
|
192
|
+
new ExportPlugin(),
|
|
193
|
+
];
|
package/package.json
CHANGED
|
@@ -1,18 +1,20 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "export-table-pulgin-csharp",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.4",
|
|
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
|
-
|
|
11
|
-
|
|
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
|
-
"
|
|
16
|
+
"@types/node": "^17.0.18",
|
|
17
|
+
"fs": "^0.0.1-security",
|
|
18
|
+
"windy-quicktable": "^1.3.27"
|
|
17
19
|
}
|
|
18
20
|
}
|
package/src/index.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import { Field, foreach, st, cmm, IPlugin, HandleSheetParams, PluginBase } from "windy-quicktable";
|
|
2
|
+
import * as fs from "fs"
|
|
1
3
|
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
export function export_stuff(paras: ExportParams): string | null {
|
|
4
|
+
export function export_stuff(paras: HandleSheetParams): string | null {
|
|
5
5
|
let {
|
|
6
6
|
datas,
|
|
7
7
|
fields,
|
|
@@ -162,8 +162,16 @@ ${foreach(fields, f =>
|
|
|
162
162
|
|
|
163
163
|
}
|
|
164
164
|
|
|
165
|
-
export class ExportPlugin
|
|
166
|
-
|
|
167
|
-
|
|
165
|
+
export class ExportPlugin extends PluginBase {
|
|
166
|
+
handleSheet(paras: HandleSheetParams) {
|
|
167
|
+
let content = export_stuff(paras)
|
|
168
|
+
if (content != null) {
|
|
169
|
+
fs.writeFileSync(paras.outFilePath, content, "utf-8")
|
|
170
|
+
}
|
|
171
|
+
return content
|
|
168
172
|
}
|
|
169
173
|
}
|
|
174
|
+
|
|
175
|
+
export const ExportPlugins = [
|
|
176
|
+
new ExportPlugin(),
|
|
177
|
+
]
|
|
@@ -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
|