2
2
using System . IO ;
3
3
using System . IO . Compression ;
4
4
using System . Linq ;
5
+ using System . Text ;
5
6
using Newtonsoft . Json ;
6
7
7
8
namespace ProjectGenesis
@@ -10,16 +11,22 @@ internal static class Packer
10
11
{
11
12
private const string SolutionPath = @"D:\Git\ProjectGenesis" ;
12
13
14
+ private static readonly bool IsDebugBuild = true ;
15
+
16
+ public const string ManifestDebugVersion = "0.3.11101" ;
17
+
13
18
internal static void Main ( )
14
19
{
15
20
string releasePath = Path . Combine ( SolutionPath , "release" ) ;
16
21
17
22
foreach ( string path in Directory . GetFiles ( releasePath , "*.zip" ) . Where ( File . Exists ) ) File . Delete ( path ) ;
18
23
19
- File . WriteAllText ( Path . Combine ( releasePath , "manifest.json" ) ,
20
- JsonConvert . SerializeObject ( new ManifestObject ( ) , Formatting . Indented ) ) ;
24
+ var manifestObject = IsDebugBuild ? ManifestObject . DebugObject ( ) : ManifestObject . ReleaseObject ( ) ;
25
+
26
+ File . WriteAllText ( Path . Combine ( releasePath , "manifest.json" ) , JsonConvert . SerializeObject ( manifestObject , Formatting . Indented ) ) ;
21
27
22
- var zipName = $ "GenesisBook-v{ ProjectGenesis . VERSION } { ProjectGenesis . DEBUGVERSION } .zip";
28
+ var zipName = new StringBuilder ( 80 ) . Append ( manifestObject . Name ) . Append ( "-v" ) . Append ( ProjectGenesis . VERSION )
29
+ . Append ( IsDebugBuild ? ProjectGenesis . DEBUGVERSION : "" ) . Append ( ".zip" ) . ToString ( ) ;
23
30
24
31
string archive = Path . Combine ( SolutionPath , zipName ) ;
25
32
@@ -35,16 +42,33 @@ internal static void Main()
35
42
36
43
public class ManifestObject
37
44
{
38
- [ JsonProperty ( "name" ) ] public string Name { get ; set ; } = "GenesisBook" ;
45
+ [ JsonProperty ( "name" ) ] public string Name { get ; set ; }
39
46
40
- [ JsonProperty ( "version_number" ) ] public string VersionNumber { get ; set ; } = ProjectGenesis . VERSION ;
47
+ [ JsonProperty ( "version_number" ) ] public string VersionNumber { get ; set ; }
41
48
42
49
[ JsonProperty ( "website_url" ) ] public string WebsiteURL { get ; set ; } = "https://github.com/Awbugl/ProjectGenesis" ;
43
50
44
51
[ JsonProperty ( "description" ) ]
45
- public string Description { get ; set ; } = "构建真实宇宙,撰写创世之书。新矿物,新材料,新配方,新科技,新机制。Construct Real Universe. Then leave a GenesisBook. New vein, new material, new recipe, new technology, new structure." ;
52
+ public string Description { get ; set ; } =
53
+ "构建真实宇宙,撰写创世之书。新矿物,新材料,新配方,新科技,新机制。Construct Real Universe. Then leave a GenesisBook. New vein, new material, new recipe, new technology, new structure." ;
46
54
47
55
[ JsonProperty ( "dependencies" ) ]
48
56
public string [ ] Dependencies { get ; set ; } = { "CommonAPI-CommonAPI-1.6.5" , "nebula-NebulaMultiplayerModApi-2.0.0" , } ;
57
+
58
+ internal static ManifestObject DebugObject ( )
59
+ {
60
+ return new ManifestObject
61
+ {
62
+ Name = "GenesisBook_Experimental" , VersionNumber = Packer . ManifestDebugVersion ,
63
+ } ;
64
+ }
65
+
66
+ internal static ManifestObject ReleaseObject ( )
67
+ {
68
+ return new ManifestObject
69
+ {
70
+ Name = "GenesisBook" , VersionNumber = ProjectGenesis . VERSION ,
71
+ } ;
72
+ }
49
73
}
50
74
}
0 commit comments