Beispiel #1
0
    public void LoadOrCreateConfig()
    {
        if (!(File.Exists(defaultConfigPath)))
        {
            config = new AISConfig();

            // Default config.
            config.enableAnsiEsc = true;
            string basePath = System.AppDomain.CurrentDomain.BaseDirectory;
            config.pathDb = basePath + @"db.json";

            File.WriteAllText(defaultConfigPath, AISJsonUtility.Serialize(config),
                              Encoding.GetEncoding(932));
        }
        else
        {
            config = AISJsonUtility.Deserialize <AISConfig>(
                File.ReadAllText(defaultConfigPath, Encoding.GetEncoding(932)));
        }
    }
Beispiel #2
0
 public void RestoreDB()
 {
     db = AISJsonUtility.Deserialize <AISDB>(
         File.ReadAllText(config.pathDb, Encoding.GetEncoding(932)));
 }