-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
improve dat loading / startup speed, + add options menu to automatica…
…lly load dats on startup (#50) * improve dat loading / startup speed, + add options menu to automatically load dats on startup * .
- Loading branch information
Showing
19 changed files
with
224 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
namespace ACViewer.Config | ||
{ | ||
public class Config | ||
{ | ||
public string ACFolder { get; set; } | ||
public bool AutomaticallyLoadDATsOnStartup { get; set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
using System; | ||
using System.IO; | ||
|
||
using Newtonsoft.Json; | ||
|
||
namespace ACViewer.Config | ||
{ | ||
public static class ConfigManager | ||
{ | ||
private static string Filename = "ACViewer.json"; | ||
|
||
private static Config config; | ||
|
||
public static Config Config | ||
{ | ||
get | ||
{ | ||
if (config == null) | ||
config = new Config(); | ||
|
||
return config; | ||
} | ||
} | ||
|
||
public static void SaveConfig() | ||
{ | ||
var settings = new JsonSerializerSettings(); | ||
settings.Formatting = Formatting.Indented; | ||
|
||
var json = JsonConvert.SerializeObject(config, settings); | ||
|
||
File.WriteAllText(Filename, json); | ||
} | ||
|
||
public static void LoadConfig() | ||
{ | ||
if (!File.Exists(Filename)) return; | ||
|
||
var json = File.ReadAllText(Filename); | ||
|
||
var _config = JsonConvert.DeserializeObject<Config>(json); | ||
|
||
if (_config == null) | ||
{ | ||
Console.WriteLine($"ConfigManager.LoadConfig() - failed to parse {Filename}"); | ||
return; | ||
} | ||
config = _config; | ||
} | ||
} | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.