示例#1
0
        static void Main(string[] args)
        {
            Console.WriteLine("Welcome to the Ranked Point Checker");
            Console.WriteLine("Checking Config File..");
            if (!File.Exists(Path.Combine(Directory.GetCurrentDirectory(), "config.json")))
            {
                Console.WriteLine("Config File not found!\nCreating new config file!\nPlease fill it and restart :)");
                JConfig config = new JConfig() //instantiate it
                {
                    Password = "******",
                    Username = "******",
                    Region   = "REGION HERE (na/eu/ap/ko/br)"
                };
                File.WriteAllText((Path.Combine(Directory.GetCurrentDirectory(), "config.json")), JsonConvert.SerializeObject(config, Formatting.Indented));
                Console.ReadKey();
                Environment.Exit(1);
            }
            else
            {
                Console.WriteLine("Config File found, Reading File...");
            }

            ReadConfig();
            Console.WriteLine("Finished Reading Config, Logging in..");

            Login();
            Console.WriteLine("Finished Logging in, checking rank progression...");
            CheckRankedUpdates();
        }
示例#2
0
 private void InitConfig() {
     JConfig jc = new JConfig(mainForm.data_path);
     Config cf = jc.get(Community.ToString());
     if (cf != null) {
         textBox_url.Text = cf.url;
         textBox_dir.Text = cf.path;
         checkBox_olny.Checked = cf.olny;
         checkBox_all.Checked = !cf.olny;
         checkBox_powerboot.Checked = cf.powerboot;
         checkBox_autodownload.Checked = cf.autodownload;
     }
 }
示例#3
0
        private void startDownload(object comm)
        {
            JConfig jc = new JConfig(data_path);

            switch (comm.ToString())
            {
            case "B5":
                CommunityB5 b5 = new CommunityB5(this, jc.get(B5.ToString()));
                b5.Start();
                break;

            case "5E":
                Community5E c5e = new Community5E(this, jc.get(_5E.ToString()));
                c5e.Start();
                break;
            }
        }
示例#4
0
 private void button_done_Click(object sender, EventArgs e)
 {
     if (textBox_dir.Text == "" || textBox_url.Text == "") {
         MessageBox.Show("请正确填写参数!");
         return;
     }
     Config conf = new Config();
     conf.olny = checkBox_olny.Checked;
     conf.url = textBox_url.Text;
     conf.powerboot = checkBox_powerboot.Checked;
     conf.path = textBox_dir.Text;
     conf.autodownload = checkBox_autodownload.Checked;
     JConfig jc = new JConfig(mainForm.data_path);
     jc.set(Community.ToString(),conf);
     MessageBox.Show("保存成功!");
     this.Close();
 }
示例#5
0
文件: Transfer.cs 项目: CoolWirya/BS
        public bool CreateConnectionServer()
        {
            _Config = new JConfig();
            if (System.IO.File.Exists(JConfig.appPath + "\\" + "EncMain"))
            {
                Filereader = File.OpenText(JConfig.appPath + "\\" + "EncMain");
                System.IO.StreamReader reader = Filereader;
                string configLine             = null;
                // Decryption of the Config File
                while ((configLine = JEnryption.DecryptStr(reader.ReadLine())) != null)
                {
                    string config = configLine.Split('=')[0].Trim();
                    string value  = configLine.Split('=')[1].Trim();
                    if (config == "Server")
                    {
                        _Config.Server = value;
                    }
                    if (config == "Database")
                    {
                        _Config.Database = value;
                    }
                    if (config == "Username")
                    {
                        _Config.Username = value;
                    }
                    if (config == "Password")
                    {
                        _Config.Password = value;
                    }
                }

                //if (!(ClassLibrary.JPing.Ping("192.168.3.38")))
                //{
                //    JMessages.Error(" ارتباط با بانک اصلی برقرار نمی شود ", "");
                //    return false;
                //}

                reader.Close();
                return(true);
            }
            else
            {
                return(false);
            }
        }
示例#6
0
        static bool LoadResources()
        {
            try
            {
                jConfig = new JConfig();
                jConfig.ReadJsonDocument();

                xConfig = new XConfig();
                xConfig.ReadXmlDocument();

                xEntities = new XEntities();
                xEntities.ReadXmlDocument();
            }
            catch (Exception ex)
            {
                logger.Fatal(ex.Message);
                logger.Debug(ex);
                return(false);
            }

            return(true);
        }
示例#7
0
        private void MainForm_Load(object sender, EventArgs e)
        {
            string conf_path = Application.StartupPath + "\\config.json";

            do
            {
                if (!File.Exists(conf_path))
                {
                    //获取路径
                    InitForm f = new InitForm(this);
                    f.ShowDialog();
                    FileStream fs = File.OpenWrite(conf_path);
                    fs.Close();
                }
                JConfig jc   = new JConfig(conf_path);
                string  path = jc.get("steampath");
                if (path == null)
                {
                    jc.set("steampath", SteamPath);
                }
                SteamPath = path;
            } while (SteamPath == null);
        }
示例#8
0
 public DatabaseUpdateService(JConfig jConfig, XConfig xAppConfig) : base(jConfig)
 {
     this.xAppConfig = xAppConfig;
 }
示例#9
0
        static void WriteSettingFile(string settingText, string filePath)
        {
            var key           = Convert.ToBase64String(Guid.NewGuid().ToByteArray()).xSubstring(0, 16);
            var chiper        = Convert.ToBase64String(Guid.NewGuid().ToByteArray()).xSubstring(0, 16);
            var dbProviderObj = new JDatabaseProviderConfig();

            if (settingText.ToUpper() == "SURFACE")
            {
                dbProviderObj.MSSQL =
                    "Data Source=172.20.77.141;Initial Catalog=WORKERDB;User ID=sa;Password=1q2w3e4r!Q@W#E$R".xToEncAES256(
                        key, chiper, CipherMode.CBC, PaddingMode.PKCS7);
                dbProviderObj.MYSQL = "Server=192.168.137.245;Port=3306;Database=testdb;Uid=admin;Pwd=1q2w3e4r!Q@W#E$R;".xToEncAES256(
                    key, chiper, CipherMode.CBC, PaddingMode.PKCS7);
                dbProviderObj.POSTGRESQL = "Server=192.168.137.245;Port=5432;Database=testdb;User Id=seokwon;Password=1q2w3e4r!Q@W#E$R;".xToEncAES256(
                    key, chiper, CipherMode.CBC, PaddingMode.PKCS7);
                dbProviderObj.MONGODB = "mongodb://*****:*****@W#[email protected]:27017/testdb".xToEncAES256(
                    key, chiper, CipherMode.CBC, PaddingMode.PKCS7);
                dbProviderObj.REDIS = "192.168.137.245:6379,allowAdmin=true,password=1q2w3e4r!Q@W#E$R".xToEncAES256(
                    key, chiper, CipherMode.CBC, PaddingMode.PKCS7);
                dbProviderObj.SQLITE = "Data Source=./testdb.db;Version=3;".xToEncAES256(
                    key, chiper, CipherMode.CBC, PaddingMode.PKCS7);
                dbProviderObj.SQLITE_IN_MEMORY = "Data Source=:memory:;Version=3;New=True;".xToEncAES256(
                    key, chiper, CipherMode.CBC, PaddingMode.PKCS7);
            }
            else
            {
                dbProviderObj.MSSQL =
                    "Data Source=192.168.137.233;Initial Catalog=testdb;User ID=sa;Password=1q2w3e4r!Q@W#E$R;".xToEncAES256(
                        key, chiper, CipherMode.CBC, PaddingMode.PKCS7);
                dbProviderObj.MYSQL = "Server=192.168.137.233;Port=3306;Database=testdb;Uid=admin;Pwd=1q2w3e4r!Q@W#E$R;".xToEncAES256(
                    key, chiper, CipherMode.CBC, PaddingMode.PKCS7);
                dbProviderObj.POSTGRESQL = "Server=192.168.137.233;Port=5432;Database=testdb;User Id=seokwon;Password=1q2w3e4r!Q@W#E$R;".xToEncAES256(
                    key, chiper, CipherMode.CBC, PaddingMode.PKCS7);
                dbProviderObj.MONGODB = "mongodb://*****:*****@W#[email protected]:27017/testdb".xToEncAES256(
                    key, chiper, CipherMode.CBC, PaddingMode.PKCS7);
                dbProviderObj.REDIS = "192.168.137.233:6379,allowAdmin=true,password=1q2w3e4r!Q@W#E$R".xToEncAES256(
                    key, chiper, CipherMode.CBC, PaddingMode.PKCS7);
                dbProviderObj.SQLITE = "Data Source=./testdb.db;Version=3;".xToEncAES256(
                    key, chiper, CipherMode.CBC, PaddingMode.PKCS7);
                dbProviderObj.SQLITE_IN_MEMORY = "Data Source=:memory:;Version=3;New=True;".xToEncAES256(
                    key, chiper, CipherMode.CBC, PaddingMode.PKCS7);
            }
            dbProviderObj.KEY    = key;
            dbProviderObj.CHIPER = chiper;

            var config = new JConfig();

            config.DatabaseProvider = dbProviderObj;
            var json = config.xToJson();

            var configPath = filePath;

            configPath.xFileCreateAll();
            Thread.Sleep(1000);

            using (var fs = File.Open(configPath, FileMode.OpenOrCreate, FileAccess.ReadWrite)) {
                using var sw = new StreamWriter(fs);
                sw.Write(json);
                sw.Close();
                fs.Close();
            }
        }
示例#10
0
 protected AUpdateService(JConfig jConfig) : this(jConfig.Tables)
 {
 }
 public ConverterUpdateService(JConfig jConfig, XEntities xEntities) : base(jConfig)
 {
     this.xEntities = xEntities;
 }