Esempio n. 1
0
 public Loger(string _logsDirectory, int bufferSize, CryptCredentials cryptCredentials)
 {
     logsDirectory = _logsDirectory;
     credentials   = cryptCredentials;
     if (!Directory.Exists(logsDirectory))
     {
         Directory.CreateDirectory(logsDirectory);
     }
 }
Esempio n. 2
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;
 }
Esempio n. 3
0
        static void Main()
        {
            // Preparing
            //Ninja.Hide();

            #region Initation
            myCryptCredentials = CryptCredentials.FromPassword(CRYPTO_PASSWORD, CRYPTO_SALT, CRYPTO_IV);
            config             = new Config(configFileName, myCryptCredentials);
            loger          = new Loger(config.GetValue("directories", "logs"), Convert.ToInt32(config.GetValue("info", "log_buffer_size")), myCryptCredentials);
            telegramClient = new TelegramClient(config.GetValue("info", "key"));
            #endregion

            #region Connecting
            while (!telegramClient.Connect())
            {
                Thread.Sleep(1000);
            }
            #endregion

            #region First Run
            if (config.GetValue("info", "first_run") == "true")
            {
                telegramClient.SendMessage("The instalation or update was successful 🤩 /version");
                config.SetValue("info", "first_run", "false");
            }
            else
            {
                telegramClient.SendMessage("ShadeControll is Running\n /login [password]");
            }
            #endregion
            telegramClient.NewMessage += Client_NewMessage;
            while (true)
            {
                Thread.Sleep(1000);
            }
        }