コード例 #1
0
 public encryptClass get_decrypted_file()
 {
     try
     {
         if (_debug)
         {
             Console.WriteLine("Debug settings: {0} : {1}", _settings.CxDataFilePath, _settings.CxDataFileName);
         }
         string       path      = Path.Combine(_settings.CxDataFilePath, _settings.CxDataFileName);
         string       encrypted = File.ReadAllText(path);
         encryptClass encrypt   = Newtonsoft.Json.JsonConvert.DeserializeObject <encryptClass>(_cipherService.Decrypt(encrypted));
         return(encrypt);
     }
     catch (Exception ex)
     {
         if (_token.api_action != api_action.storeCredentials)
         {
             Console.Error.Write(ex.ToString());
         }
         return(new encryptClass());
     }
 }
コード例 #2
0
        public encryptClass get_decrypted_file()
        {
            string folder = _os.Contains("Windows") ? "\\" : "/";

            try
            {
                string       path      = _settings.CxDataFilePath + folder + _settings.CxDataFileName;
                string       encrypted = File.ReadAllText(path);
                encryptClass encrypt   = Newtonsoft.Json.JsonConvert.DeserializeObject <encryptClass>(_cipherService.Decrypt(encrypted));
                return(encrypt);
            }
            catch (Exception ex)
            {
                if (_token.api_action != api_action.storeCredentials)
                {
                    Console.Error.Write(ex.ToString());
                }
                return(new encryptClass());
            }
        }