forked from siteserver/cms
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.cs
More file actions
85 lines (79 loc) · 2.61 KB
/
Program.cs
File metadata and controls
85 lines (79 loc) · 2.61 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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
using System;
using BaiRong.Core;
using CommandLine;
using siteserver.commands;
namespace siteserver
{
public class Program
{
public static void Main(string[] args)
{
Console.OutputEncoding = System.Text.Encoding.UTF8;
WebConfigUtils.Load(Environment.CurrentDirectory);
if (!ServiceUtils.IsSiteServerDir)
{
Console.WriteLine("当前文件夹不是正确的SiteServer系统根目录");
Console.ReadLine();
return;
}
if (!ServiceUtils.IsInitialized)
{
Console.WriteLine("SiteServer系统未安装或数据库无法正确连接");
Console.ReadLine();
return;
}
var invokedVerb = string.Empty;
object invokedVerbInstance = null;
if (args.Length == 0)
{
invokedVerb = Run.CommandName;
}
else
{
var options = new Options();
if (!Parser.Default.ParseArguments(args, options,
(verb, subOptions) =>
{
invokedVerb = verb;
invokedVerbInstance = subOptions;
}))
{
Console.WriteLine(options.GetUsage());
return;
}
}
if (invokedVerb == Build.CommandName)
{
var commitSubOptions = (BuildSubOptions)invokedVerbInstance;
var isAll = commitSubOptions != null && commitSubOptions.All;
Build.Start(isAll);
}
else if (invokedVerb == Test.CommandName)
{
var subOptions = (TestSubOptions)invokedVerbInstance;
var isAll = subOptions != null && subOptions.All;
Test.Start(isAll);
}
else if (invokedVerb == Encode.CommandName)
{
var subOptions = (EncodeSubOptions)invokedVerbInstance;
if (subOptions != null)
{
Encode.Start(subOptions.String);
}
}
else if (invokedVerb == Decode.CommandName)
{
var subOptions = (DecodeSubOptions)invokedVerbInstance;
if (subOptions != null)
{
Decode.Start(subOptions.String);
}
}
else if (invokedVerb == Run.CommandName)
{
Run.Start();
}
}
}
}