markus / keyFileToCode / Program.cs @ master
이력 | 보기 | 이력해설 | 다운로드 (1.56 KB)
1 | 1305c420 | taeseongkim | using System; |
---|---|---|---|
2 | using System.Collections.Generic; |
||
3 | using System.Linq; |
||
4 | using System.Text; |
||
5 | using System.Threading.Tasks; |
||
6 | |||
7 | namespace keyFileToCode |
||
8 | { |
||
9 | class Program |
||
10 | { |
||
11 | static string code = @"namespace License { public static class Key { public static string Data = ""{Key}""; }}"; |
||
12 | static string code2 = @"namespace License { public static class Key2 { public static string Data = ""{Key}""; }}"; |
||
13 | static void Main(string[] args) |
||
14 | { |
||
15 | if (args.Length == 1) |
||
16 | { |
||
17 | string keystring = System.IO.File.ReadAllText(System.IO.Path.Combine(args[0],"key.xml")); |
||
18 | string key2string = System.IO.File.ReadAllText(System.IO.Path.Combine(args[0], "public.xml")); |
||
19 | string keyFile = System.IO.Path.Combine(args[0], "key.cs"); |
||
20 | string key2File = System.IO.Path.Combine(args[0], "key2.cs"); |
||
21 | |||
22 | code = code.Replace("{Key}", keystring.Replace(System.Environment.NewLine," ").Replace("\"", "\\\"")); |
||
23 | code2 = code2.Replace("{Key}", key2string.Replace(System.Environment.NewLine, " ").Replace("\"", "\\\"")); |
||
24 | |||
25 | if (System.IO.File.Exists(keyFile)) |
||
26 | { |
||
27 | System.IO.File.Delete(keyFile); |
||
28 | } |
||
29 | |||
30 | if (System.IO.File.Exists(key2File)) |
||
31 | { |
||
32 | System.IO.File.Delete(key2File); |
||
33 | } |
||
34 | |||
35 | System.IO.File.WriteAllText(keyFile, code, Encoding.UTF8); |
||
36 | System.IO.File.WriteAllText(key2File, code2, Encoding.UTF8); |
||
37 | } |
||
38 | } |
||
39 | |||
40 | } |
||
41 | } |