Example #1
0
        public static void Load()
        {
            var rawContent = ConfigFileSerializer.Deserialize();

            defaultWalletFileName = rawContent.DefaultWalletFileName;
            network             = rawContent.Network == Network.Main.ToString() ? Network.Main : Network.TestNet;
            connectionType      = rawContent.ConnectionType == ConnectionType.FullNode.ToString() ? ConnectionType.FullNode : ConnectionType.Http;
            canSpendUnconfirmed = rawContent.CanSpendUnconfirmed == "True" ? true : false;
        }
Example #2
0
        internal static ConfigFileSerializer Deserialize()
        {
            // 反序列化时,如果配置文件不存在,则创建默认配置的配置文件
            if (!File.Exists(ConfigFilePath))
            {
                Config.Save();
                Console.WriteLine($"{ConfigFilePath} was missing. It has been created created with default settings.");
            }

            string contentString = File.ReadAllText(ConfigFilePath);
            ConfigFileSerializer configFileSerializer = JsonConvert.DeserializeObject <ConfigFileSerializer>(contentString);

            return(configFileSerializer);
        }
Example #3
0
 public static void Save()
 {
     ConfigFileSerializer.Serialize(defaultWalletFileName, network.ToString(), connectionType.ToString(), canSpendUnconfirmed.ToString());
     Load();
 }