-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathProgram.cs
More file actions
56 lines (53 loc) · 1.65 KB
/
Copy pathProgram.cs
File metadata and controls
56 lines (53 loc) · 1.65 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
using System;
using System.Collections.Generic;
using System.IO;
using Excel;
using System.Reflection;
class Program
{
//proto文件输出目录 选项
private const string OPTION_PROTO_PATH = "--proto_path";
//excel文件目录 选项
private const string OPTION_EXCEL_PATH = "--excel_path";
//数据二进制文件目录 选项
private const string OPTION_BINARY_PATH = "--binary_path";
//包名
private const string OPTION_PACHAGE = "--package";
static void Main(string[] args)
{
string excelPath = null;
string protoPath = null;
string outputPath = null;
string binaryPath = null;
string package = null;
for (int i = 0; i < args.Length; ++i)
{
string[] option = args[i].Split('=');
if (option.Length == 2)
{
switch (option[0])
{
case OPTION_PROTO_PATH: protoPath = option[1]; break;
case OPTION_EXCEL_PATH: excelPath = option[1]; break;
case OPTION_BINARY_PATH: binaryPath = option[1]; break;
case OPTION_PACHAGE: package = option[1]; break;
default:
outputPath = args[i];
break;
}
}
}
try
{
ExcelData data = ExcelReader.ReadAll(excelPath);
ProtobufGen.inst.Gen(data, protoPath, outputPath, binaryPath, package);
}
catch (Exception e)
{
Console.Write(e);
Console.Read();
}
Console.WriteLine("ok");
Console.Read();
}
}