Description:
Add missed file.
Commit status:
[Not Reviewed]
References:
Diff options:
Comments:
0 Commit comments
0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
@@ -0,0 +1,49 | |||
|
1 | ||
|
2 | using System.IO; | |
|
3 | using Newtonsoft.Json; | |
|
4 | ||
|
5 | namespace isometricparkfna | |
|
6 | { | |
|
7 | public class Options | |
|
8 | { | |
|
9 | ||
|
10 | public string fontName; | |
|
11 | public int fontSize; | |
|
12 | ||
|
13 | public Options(string fontName, int fontSize) | |
|
14 | { | |
|
15 | this.fontName = fontName; | |
|
16 | this.fontSize = fontSize; | |
|
17 | } | |
|
18 | ||
|
19 | public static void writeOptions(string fontName, int fontSize) | |
|
20 | { | |
|
21 | ||
|
22 | var options = new Options(fontName, fontSize); | |
|
23 | ||
|
24 | string json = JsonConvert.SerializeObject(options, | |
|
25 | Formatting.Indented); | |
|
26 | ||
|
27 | File.WriteAllText(@"options.json", json); | |
|
28 | Logging.Success("Writing options to file."); | |
|
29 | ||
|
30 | } | |
|
31 | ||
|
32 | public static Options readOptions() | |
|
33 | { | |
|
34 | var json = File.ReadAllText(@"options.json"); | |
|
35 | Logging.Spy(new {json=json}); | |
|
36 | ||
|
37 | Options options = JsonConvert.DeserializeObject<Options>(json); | |
|
38 | ||
|
39 | Logging.Spy(new {name=options.fontName, | |
|
40 | size=options.fontSize}); | |
|
41 | Logging.Success("Read options."); | |
|
42 | ||
|
43 | return options; | |
|
44 | } | |
|
45 | ||
|
46 | ||
|
47 | ||
|
48 | } | |
|
49 | } |
You need to be logged in to leave comments.
Login now