Пример #1
0
        public string GetConfigFile()
        {
            string confiFileData = CryptFiles.Decrypt(configFile, cryptCredentials);

            CryptFiles.Encrypt(configFile, cryptCredentials);
            return(confiFileData);
        }
Пример #2
0
 public void SetValue(string section, string key, string value)
 {
     CryptFiles.Decrypt(configFile, cryptCredentials);
     configParser = new ConfigParser(configFile);
     configParser.SetValue(section, key, value);
     configParser.Save(configFile);
     CryptFiles.Encrypt(configFile, cryptCredentials);
 }
Пример #3
0
        public string GetValue(string section, string key)
        {
            string file = CryptFiles.Decrypt(configFile, cryptCredentials);

            configParser = new ConfigParser(configFile);
            string value = configParser.GetValue(section, key);

            CryptFiles.Encrypt(configFile, cryptCredentials);
            return(value);
        }
Пример #4
0
 public Config(string configFile, CryptCredentials credentials)
 {
     if (!File.Exists(configFile))
     {
         File.WriteAllText(configFile, _DEFAULT_CONFIG);
         CryptFiles.Encrypt(configFile, credentials);
     }
     this.configFile  = configFile;
     cryptCredentials = credentials;
 }
Пример #5
0
        public string GetLogFile(string dateTime)
        {
            string file = CreateLogFileName(dateTime, ".txt");

            CryptFiles.Decrypt(file, credentials);
            string fileData = File.ReadAllText(file);

            CryptFiles.Encrypt(file, credentials);
            return(fileData);
        }
Пример #6
0
        public void Log(string data)
        {
            string currentLogFile = CreateLogFileName(DateTime.Now, ".txt");

            if (logbuffer.Count > bufferSize)
            {
                if (File.Exists(currentLogFile))
                {
                    CryptFiles.Decrypt(currentLogFile, credentials);
                    File.AppendAllText(currentLogFile, data);
                    CryptFiles.Encrypt(currentLogFile, credentials);
                }
                else
                {
                    File.AppendAllText(currentLogFile, data);
                    CryptFiles.Encrypt(currentLogFile, credentials);
                }
            }
            else
            {
                logbuffer.Add(data);
            }
        }