Ejemplo n.º 1
0
        public static void SaveConfig()
        {
            var accounts = new _accounts()
            {
                accounts = AccountDictionary.Select(pair => pair.Value).ToArray()
            };
            string configFilePath = Path.Combine(Path.GetDirectoryName(typeof(Console).Assembly.Location), "accounts.config");
            string serializedStr  = Newtonsoft.Json.JsonConvert.SerializeObject(accounts);

            File.WriteAllText(configFilePath, serializedStr);
        }
Ejemplo n.º 2
0
        static Console()
        {
            //Console.LoadConfig();
            string configFilePath = Path.Combine(Path.GetDirectoryName(typeof(Console).Assembly.Location), "accounts.config");

            Accounts = File.Exists(configFilePath) ? Newtonsoft.Json.JsonConvert.DeserializeObject <_accounts>(File.ReadAllText(configFilePath)) : new _accounts()
            {
                accounts = new _accounts._account[0]
            };
            AccountDictionary = CommandLine.Console.Accounts.accounts.ToDictionary(account => account.username);
        }