Ejemplo n.º 1
0
        public static void Save(string portfolio, List <CoinConfig> coinConfigs)
        {
            portfolio += FILEEXTENSION;

            if (UserConfigService.Encrypted)
            {
                File.WriteAllText(portfolio, EncryptionService.AesEncryptString(JsonConvert.SerializeObject(coinConfigs)));
            }
            else
            {
                File.WriteAllText(portfolio, JsonConvert.SerializeObject(coinConfigs));
            }
        }
Ejemplo n.º 2
0
 public static void ToggleEncryption()
 {
     foreach (var portfolio in GetPortfolios())
     {
         if (UserConfigService.Encrypted)
         {
             File.WriteAllText(portfolio.FileName, JsonConvert.SerializeObject(LoadEncrypted(portfolio.FileName)));
         }
         else
         {
             File.WriteAllText(portfolio.FileName, EncryptionService.AesEncryptString(JsonConvert.SerializeObject(LoadUnencrypted(portfolio.FileName))));
         }
     }
 }
Ejemplo n.º 3
0
        public static void Load()
        {
            if (File.Exists(FILENAME))
            {
                AlertConfig = UserConfigService.Encrypted
                    ? JsonConvert.DeserializeObject <AlertConfig>(EncryptionService.AesDecryptString(File.ReadAllText(FILENAME)))
                    : JsonConvert.DeserializeObject <AlertConfig>(File.ReadAllText(FILENAME));
            }
            else
            {
                Create();
            }

            AlertConfig.Alerts.ForEach(x => x.LastOperator = null);
        }
Ejemplo n.º 4
0
 public static void Save()
 {
     if (UserConfigService.Encrypted)
     {
         File.WriteAllText(FILENAME, EncryptionService.AesEncryptString(JsonConvert.SerializeObject(AlertConfig)));
     }
     else
     {
         SendAddress    = string.Empty;
         SendPassword   = string.Empty;
         ReceiveAddress = string.Empty;
         ReceiveType    = string.Empty;
         File.WriteAllText(FILENAME, JsonConvert.SerializeObject(AlertConfig));
     }
 }
Ejemplo n.º 5
0
        public static void Startup()
        {
            CultureInfo.DefaultThreadCurrentCulture   = new CultureInfo("en-US");
            CultureInfo.DefaultThreadCurrentUICulture = new CultureInfo("en-US");

            UserConfigService.Load();

            if (UserConfigService.Encrypted)
            {
                EncryptionService.Unlock();
            }

            AlertService.Load();

            if (!UserConfigService.TutorialCompleted)
            {
                using (Tutorial form = new Tutorial())
                    form.ShowDialog();
            }
        }
Ejemplo n.º 6
0
 private static List <CoinConfig> LoadEncrypted(string portfolio)
 {
     return(JsonConvert.DeserializeObject <List <CoinConfig> >(EncryptionService.AesDecryptString(File.ReadAllText(portfolio))) ?? new List <CoinConfig>());
 }