Ejemplo n.º 1
0
        public bool set_encrypted_file(encryptClass encrypt)
        {
            string folder = _os.Contains("Windows") ? "\\" : "/";

            try
            {
                string Json_string = Newtonsoft.Json.JsonConvert.SerializeObject(encrypt);
                string encrypted   = _cipherService.Encrypt(Json_string);
                string path        = _settings.CxDataFilePath + folder + _settings.CxDataFileName;
                File.WriteAllText(path, encrypted);
                return(true);
            }
            catch (Exception ex)
            {
                Console.Error.Write(ex.ToString());
                return(false);
            }
        }
Ejemplo n.º 2
0
        public bool set_encrypted_file(encryptClass encrypt)
        {
            string folder = _os.Contains("Windows") ? "\\" : "/";

            try
            {
                settingClass settings    = get_settings();
                string       Json_string = Newtonsoft.Json.JsonConvert.SerializeObject(encrypt);
                string       encrypted   = _cipherService.Encrypt(Json_string);
                if (_debug)
                {
                    Console.WriteLine("Setting file: {0} : {1}", settings.CxDataFilePath, settings.CxDataFileName);
                }
                string path = Path.Combine(settings.CxDataFilePath, settings.CxDataFileName);
                File.WriteAllText(path, encrypted);
                return(true);
            }
            catch (Exception ex)
            {
                Console.Error.Write(ex.ToString());
                return(false);
            }
        }