Esempio n. 1
0
        private void SetGameMode(GameMode mode)
        {
            IniFileName ini = new IniFileName(Environment.CurrentDirectory + @"\ini\GameSetUp.ini");

            int lowTimes  = 0;
            int highTimes = 0;

            try
            {
                lowTimes  = int.Parse(ini.GetEntryValue("GameMode", "LowTimes").ToString());
                highTimes = int.Parse(ini.GetEntryValue("GameMode", "HighTimes").ToString());
            }
            catch
            {
            }

            switch (mode)
            {
            case GameMode.HighDefinition:
                highTimes++;
                break;

            case GameMode.LowDefinition:
                lowTimes++;
                break;
            }

            ini.SetValue("GameMode", "LowTimes", lowTimes);
            ini.SetValue("GameMode", "GameModeRecord", (int)mode);
            ini.SetValue("GameMode", "HighTimes", highTimes);
        }
Esempio n. 2
0
        public static ScreenInfo GetClientConfiguration()
        {
            IniFileName ini = new IniFileName(Environment.CurrentDirectory + @"\Config.ini");

            if (!int.TryParse(ini.GetEntryValue("GameResolution", "Width").ToString(), out var width))
            {
                return(default);
Esempio n. 3
0
        private void FrmMain_Load(object sender, EventArgs e)
        {
            string dir = Environment.CurrentDirectory + @"\" + _KEYS_FILENAME;

            if (!File.Exists(dir))
            {
                btnGenerateKeys_Click(sender, e);
            }

            IniFileName ini = new IniFileName(dir);

            m_public = new RSAParameters
            {
                Modulus  = Convert.FromBase64String(ini.GetEntryValue("Public", "Modulus").ToString()),
                Exponent = Convert.FromBase64String(ini.GetEntryValue("Public", "Exponent").ToString())
            };

            m_private = new RSAParameters
            {
                Modulus  = Convert.FromBase64String(ini.GetEntryValue("Private", "Modulus").ToString()),
                Exponent = Convert.FromBase64String(ini.GetEntryValue("Private", "Exponent").ToString()),
                P        = Convert.FromBase64String(ini.GetEntryValue("Private", "P").ToString()),
                Q        = Convert.FromBase64String(ini.GetEntryValue("Private", "Q").ToString()),
                DP       = Convert.FromBase64String(ini.GetEntryValue("Private", "DP").ToString()),
                DQ       = Convert.FromBase64String(ini.GetEntryValue("Private", "DQ").ToString()),
                InverseQ = Convert.FromBase64String(ini.GetEntryValue("Private", "Inverse").ToString()),
                D        = Convert.FromBase64String(ini.GetEntryValue("Private", "D").ToString())
            };
        }
Esempio n. 4
0
        private void PrepareIniFileName()
        {
            IniFileName = Path.GetFileName(Application.ExecutablePath);

            FileInfo fi = new FileInfo(IniFileName);

            fi          = new FileInfo(fi.FullName);
            IniFileName = fi.Name;

            IniFileName = IniFileName.Substring(0, IniFileName.Length - ".exe".Length) + ".ini";
            iniFile     = new IniFile(Application.StartupPath + @"\" + IniFileName);
        }
Esempio n. 5
0
        public SessionFactory(string szGame, string szEvent)
        {
            var iniFile = new IniFileName(Environment.CurrentDirectory + @"\" + szGame);

            _hostname    = iniFile.GetEntryValue("MySQL", "Hostname").ToString();
            _username    = iniFile.GetEntryValue("MySQL", "Username").ToString();
            _password    = iniFile.GetEntryValue("MySQL", "Password").ToString();
            _database    = iniFile.GetEntryValue("MySQL", "Database").ToString();
            GameDatabase = CreateSessionFactory();

            iniFile       = new IniFileName(Environment.CurrentDirectory + @"\" + szEvent);
            _hostname     = iniFile.GetEntryValue("MySQL", "Hostname").ToString();
            _username     = iniFile.GetEntryValue("MySQL", "Username").ToString();
            _password     = iniFile.GetEntryValue("MySQL", "Password").ToString();
            _database     = iniFile.GetEntryValue("MySQL", "Database").ToString();
            EventDatabase = CreateSessionFactory();
        }
Esempio n. 6
0
        public SessionFactory(string szGame, string szLogin, bool bConfirm)
        {
            var iniFile = new IniFileName(Environment.CurrentDirectory + @"\" + szGame);

            _hostname    = iniFile.GetEntryValue("MySQL", "Hostname").ToString();
            _username    = iniFile.GetEntryValue("MySQL", "Username").ToString();
            _password    = iniFile.GetEntryValue("MySQL", "Password").ToString();
            _database    = iniFile.GetEntryValue("MySQL", "Database").ToString();
            GameDatabase = CreateSessionFactory();

            iniFile       = new IniFileName(Environment.CurrentDirectory + @"\" + szLogin);
            _hostname     = iniFile.GetEntryValue("MySQL", "Hostname").ToString();
            _username     = iniFile.GetEntryValue("MySQL", "Username").ToString();
            _password     = iniFile.GetEntryValue("MySQL", "Password").ToString();
            _database     = iniFile.GetEntryValue("MySQL", "Database").ToString();
            _port         = int.Parse(iniFile.GetEntryValue("MySQL", "Port").ToString());
            LoginDatabase = CreateLoginFactory();
        }
Esempio n. 7
0
        public SessionFactory(string szGame, string szLogin)
        {
            if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
            {
                var iniFile = new IniFileName(Environment.CurrentDirectory + @"\" + szGame);
                _hostname    = iniFile.GetEntryValue("MySQL", "Hostname").ToString();
                _username    = iniFile.GetEntryValue("MySQL", "Username").ToString();
                _password    = iniFile.GetEntryValue("MySQL", "Password").ToString();
                _database    = iniFile.GetEntryValue("MySQL", "Database").ToString();
                GameDatabase = CreateSessionFactory();

                iniFile       = new IniFileName(Environment.CurrentDirectory + @"\" + szLogin);
                _hostname     = iniFile.GetEntryValue("MySQL", "Hostname").ToString();
                _username     = iniFile.GetEntryValue("MySQL", "Username").ToString();
                _password     = iniFile.GetEntryValue("MySQL", "Password").ToString();
                _database     = iniFile.GetEntryValue("MySQL", "Database").ToString();
                _port         = int.Parse(iniFile.GetEntryValue("MySQL", "Port").ToString());
                LoginDatabase = CreateLoginFactory();
            }
            else
            {
                var     loginIniFile = new FileIniDataParser();
                var     gameIniFile  = new FileIniDataParser();
                string  szGamePath   = Path.Combine(Environment.CurrentDirectory, szGame);
                string  szLoginPath  = Path.Combine(Environment.CurrentDirectory, szLogin);
                IniData LoginData    = loginIniFile.ReadFile(szLoginPath);
                IniData GameData     = gameIniFile.ReadFile(szGamePath);
                _hostname     = GameData["MySQL"]["Hostname"];
                _username     = GameData["MySQL"]["Username"];
                _password     = GameData["MySQL"]["Password"];
                _database     = GameData["MySQL"]["Database"];
                GameDatabase  = CreateSessionFactory();
                _hostname     = LoginData["MySQL"]["Hostname"];
                _username     = LoginData["MySQL"]["Username"];
                _password     = LoginData["MySQL"]["Password"];
                _database     = LoginData["MySQL"]["Database"];
                _port         = int.Parse(LoginData["MySQL"]["Port"]);
                LoginDatabase = CreateLoginFactory();
            }
        }
Esempio n. 8
0
        public FrmMain()
        {
            InitializeComponent();

            // since we need transparent BG to images, we set it at startup
            AllowTransparency = true;
            TransparencyKey   = Color.FromArgb(0xff00d8);
            SetStyle(ControlStyles.SupportsTransparentBackColor, true);
            BackColor = Color.FromArgb(0x00FFFFFF);

            btnPlayHigh.FlatAppearance.MouseOverBackColor = Color.Transparent;
            btnPlayHigh.FlatAppearance.MouseDownBackColor = Color.Transparent;
            btnPlayLow.FlatAppearance.MouseDownBackColor  = Color.Transparent;
            btnPlayLow.FlatAppearance.MouseOverBackColor  = Color.Transparent;

            /*
             * Load culture info for multi-language application.
             */
            new LanguageManager().SetLanguage(CultureInfo.CurrentUICulture.Name);

            if (!File.Exists("Config.ini"))
            {
                File.Create("Config.ini").Close();
                var writer = new StreamWriter("Config.ini");
                writer.Write("[GameResolution]");
                writer.Write("Width=1024");
                writer.Write("Height=768");
                writer.Write("NoWindowInjection=0");
                writer.Write("[GameSetup]");
                writer.Write("FpsMode=1");
                writer.Close();
            }

            m_ifConfig = new IniFileName(Environment.CurrentDirectory + "\\AutoPatch.ini");
            LoadStringUrlTable();
            // we will download everything again if needed. But we wont be keeping the folder with content after a succesfull (or failed) update.
            DeleteTempFolder();
        }
        private void Init(UnrealTargetPlatform Platform, string BaseIniName, DirectoryReference ProjectDirectory, DirectoryReference EngineDirectory, bool EngineOnly = false, ConfigCacheIni BaseCache = null)
        {
            InitCommon();
            bIsMergingConfigs = true;
            if (EngineDirectory == null)
            {
                EngineDirectory = UnrealBuildTool.EngineDirectory;
            }

            if (BaseCache != null)
            {
                foreach (KeyValuePair <string, IniSection> Pair in BaseCache.Sections)
                {
                    Sections.Add(Pair.Key, new IniSection(Pair.Value));
                }
            }
            if (EngineOnly)
            {
                foreach (FileReference IniFileName in EnumerateEngineIniFileNames(EngineDirectory, BaseIniName, Platform))
                {
                    if (IniFileName.Exists())
                    {
                        ParseIniFile(IniFileName);
                    }
                }
            }
            else
            {
                foreach (FileReference IniFileName in EnumerateCrossPlatformIniFileNames(ProjectDirectory, EngineDirectory, Platform, BaseIniName, BaseCache != null))
                {
                    if (IniFileName.Exists())
                    {
                        ParseIniFile(IniFileName);
                    }
                }
            }
        }
Esempio n. 10
0
        private void FrmSettings_Load(object sender, EventArgs e)
        {
            var scope = new ManagementScope();
            var query = new ObjectQuery("SELECT * FROM CIM_VideoControllerResolution");

            using var searcher = new ManagementObjectSearcher(scope, query);
            var results = searcher.Get();

            foreach (var result in results)
            {
                string resolution = $"{result["HorizontalResolution"]}x{result["VerticalResolution"]}";

                if (int.Parse(result["HorizontalResolution"].ToString()) < 1024)
                {
                    continue;
                }

                if (!cmbScreenResolution.Items.Contains(resolution))
                {
                    cmbScreenResolution.Items.Add(resolution);
                }
            }

            if (cmbScreenResolution.Items.Count > 0)
            {
                cmbScreenResolution.SelectedIndex = cmbScreenResolution.Items.Count - 1;
            }

            IniFileName ini       = new IniFileName(Environment.CurrentDirectory + @"\Config.ini");
            string      szWidth   = ini.GetEntryValue("GameResolution", "Width")?.ToString() ?? "1004";
            string      szHeight  = ini.GetEntryValue("GameResolution", "Height")?.ToString() ?? "708";
            string      szFpsMode = ini.GetEntryValue("GameSetup", "FpsMode")?.ToString() ?? "2";

            if (string.IsNullOrEmpty(szWidth) || !int.TryParse(szWidth, out _))
            {
                szWidth = "1004";
            }

            if (string.IsNullOrEmpty(szHeight) || !int.TryParse(szHeight, out _))
            {
                szHeight = "708";
            }

            if (string.IsNullOrEmpty(szFpsMode) || !int.TryParse(szFpsMode, out _))
            {
                szFpsMode = "1";
            }

            int width  = int.Parse(szWidth);
            int height = int.Parse(szHeight);

            for (int i = 0; i < cmbScreenResolution.Items.Count; i++)
            {
                if (cmbScreenResolution.Items[i].ToString().Equals($"{width}x{height}"))
                {
                    cmbScreenResolution.SelectedIndex = i;
                }
            }

            int fpsMode = int.Parse(szFpsMode);

            switch (fpsMode)
            {
            case 0:
                radioNormalFps.Checked = true;
                numCustomFps.Enabled   = false;
                break;

            case 1:
                radio60Fps.Checked   = true;
                numCustomFps.Enabled = false;
                break;

            case 2:
                radioUnlockedFps.Checked = true;
                numCustomFps.Enabled     = false;
                break;

            default:
                radioFpsCustom.Checked = true;
                numCustomFps.Enabled   = true;
                break;
            }
        }
Esempio n. 11
0
        public static void SetClientConfiguration(int width, int height, bool fullScreen, int fpsMode)
        {
            IniFileName ini = new IniFileName(Environment.CurrentDirectory + @"\ini\GameSetUp.ini");

            ini.SetValue("ScreenMode", "ScreenModeRecord", 2);

            ini = new IniFileName(Environment.CurrentDirectory + @"\Config.ini");
            ini.SetValue("GameResolution", "Width", width);
            ini.SetValue("GameResolution", "Height", height);

            ini.SetValue("GameSetup", "FpsMode", fpsMode);

            ini = new IniFileName(Environment.CurrentDirectory + @"\ini\GUI.ini");
            // Main interface
            ini.SetValue("0-130", "x", (width - 1024) / 2);
            ini.SetValue("0-130", "y", height - 141);

            // Chat panel
            ini.SetValue("0-145", "x", ((width - 1024) / 2) + 82);
            ini.SetValue("0-145", "y", height - 71);

            // Chat Player Names
            ini.SetValue("0-148", "x", ((width - 1024) / 2) + 82 + 35);
            ini.SetValue("0-148", "y", height - 65 - 300);

            // Chat Channel
            ini.SetValue("0-174", "x", ((width - 1024) / 2) + 82 + 172);
            ini.SetValue("0-174", "y", height - 65 - 260);

            // Path Finding Button
            ini.SetValue("0-304", "x", width - 110);

            // Path Finding GUI
            ini.SetValue("0-303", "x", width - 530);

            // Exit Game
            ini.SetValue("0-158", "x", (width - 288) / 2);
            ini.SetValue("0-158", "y", (height - 120) / 2);

            // Options
            ini.SetValue("0-138", "x", (width - 370) / 2);
            ini.SetValue("0-138", "y", (height - 350) / 2);

            // Team
            ini.SetValue("0-141", "x", (width - 290) / 2);
            ini.SetValue("0-268", "x", (width - 58) / 2);

            //VIP Button
            ini.SetValue("0-339", "x", ((width - 1024) / 2) + 82 + 202);
            ini.SetValue("0-339", "y", height - 115);

            // My Talisman UI
            //ini.SetValue("0-345", "x", 9999);
            // Target Talisman UI
            //ini.SetValue("0-346", "x", 9999);

            // Shopping Mall
            ini.SetValue("0-289", "x", ((width - 1024) / 2) + 82 + 50);
            ini.SetValue("0-289", "y", height - 115);

            // Mentor
            ini.SetValue("0-325", "x", ((width - 1024) / 2) + 82 + 85);
            ini.SetValue("0-325", "y", height - 130);

            // Item Lock
            ini.SetValue("0-328", "x", ((width - 1024) / 2) + 82 + 145);
            ini.SetValue("0-328", "y", height - 110);

            // Whisper Player Avatars
            ini.SetValue("0-3", "x", ((width - 1024) / 2) + 82 + 530);
            ini.SetValue("0-3", "y", height - 115);

            // PKModes
            ini.SetValue("0-191", "x", ((width - 1024) / 2) + 82 + 500);
            ini.SetValue("0-191", "y", height - 100);

            // Map Mini
            ini.SetValue("0-1199", "x", width - 40);

            // Map Full
            ini.SetValue("0-1200", "x", width - 20);

            // Arena
            ini.SetValue("0-403", "x", ((width - 1024) / 2) + 82 + 250);
            ini.SetValue("0-403", "y", height - 115);
            // Action Express Interact Combobox
            ini.SetValue("0-367", "x", ((width - 1024) / 2) + 82 + 350);
            ini.SetValue("0-367", "y", height - 245);
            // Action
            ini.SetValue("0-140", "x", ((width - 1024) / 2) + 82 + 350);
            ini.SetValue("0-140", "y", height - 225);
            // Express
            ini.SetValue("0-274", "x", ((width - 1024) / 2) + 82 + 350);
            ini.SetValue("0-274", "y", height - 215);
            // Interact
            ini.SetValue("0-360", "x", ((width - 1024) / 2) + 82 + 350);
            ini.SetValue("0-360", "y", height - 215);

            // Group UI
            ini.SetValue("0-371", "x", ((width - 1024) / 2) + 82 + 600);
            ini.SetValue("0-371", "y", height - 140);

            // Message Channel
            ini.SetValue("0-357", "y", height - 452);

            // Message Scrollbar
            ini.SetValue("0-1198", "y", height - 477);

            // Mount Vigor
            ini.SetValue("0-383", "x", width - 200);
            ini.SetValue("0-383", "y", height - 200);

            // Target Talisman UI
            ini.SetValue("0-346", "x", width - 345);

            // Arena qualifier main ui
            ini.SetValue("0-402", "x", (width - 665) / 2);
            ini.SetValue("0-402", "y", (height - 560) / 2);
            // Arena qualifier opponent info
            ini.SetValue("0-409", "x", (width - 290) / 2);
            ini.SetValue("0-409", "y", (height - 120) / 2);
            // Arena qualifier fighting points info
            ini.SetValue("0-411", "x", (width - 310) / 2);
            // Arena qualifier quit button
            ini.SetValue("0-412", "x", ((width - 1024) / 2) + 82 + 320);
            ini.SetValue("0-412", "y", height - 130);
            // Arena qualifier count down box
            ini.SetValue("0-407", "x", (width - 290) / 2);
            ini.SetValue("0-407", "y", (height - 110) / 2);
            // Arena qualifier result box
            ini.SetValue("0-408", "x", (width - 300) / 2);
            ini.SetValue("0-408", "y", (height - 150) / 2);

            ini = new IniFileName(Environment.CurrentDirectory + @"\ini\info.ini");
            // Exp
            ini.SetValue("ExpShowPos", "Exp_XPos", (width / 2) - 100);
            ini.SetValue("ExpShowPos", "Exp_YPos", height - 90);

            // AddExp
            ini.SetValue("ExpShowPos", "AddExp_XPos", (width / 2) - 100 + 90);
            ini.SetValue("ExpShowPos", "AddExp_YPos", height - 90);
        }
Esempio n. 12
0
        private void btnGenerateKeys_Click(object sender, EventArgs e)
        {
            string path = Environment.CurrentDirectory + @"\" + _KEYS_FILENAME;

            if (!File.Exists(path))
            {
                File.Create(path).Close();
                StreamWriter file = new StreamWriter(path, false);
                file.WriteLine("; the asymmetric encryption will be used to store the key and iv of the");
                file.WriteLine("; symmetric protocol.");
                file.WriteLine("");
                file.WriteLine("; used for encryption");
                file.WriteLine("[Public]");
                file.WriteLine("Modulus=");
                file.WriteLine("Exponent=");
                file.WriteLine("");
                file.WriteLine("; used for decryption");
                file.WriteLine("[Private]");
                file.WriteLine("Modulus=");
                file.WriteLine("Exponent=");
                file.WriteLine("P=");
                file.WriteLine("Q=");
                file.WriteLine("DP=");
                file.WriteLine("DQ=");
                file.WriteLine("Inverse=");
                file.WriteLine("D=");
                file.WriteLine("");
                file.WriteLine("[Symmetric]");
                file.WriteLine("Key=");
                file.WriteLine("IV=");
                file.Close();
                file.Dispose();
                file = null;
            }

            IniFileName iniFile = new IniFileName(path);

            //Generate a public/private key pair.
            RSACryptoServiceProvider rsa = new RSACryptoServiceProvider();
            //Save the public key information to an RSAParameters structure.
            RSAParameters publicInfo = rsa.ExportParameters(false);

            TripleDESCryptoServiceProvider tdes = new TripleDESCryptoServiceProvider();

            tdes.GenerateIV();
            tdes.GenerateKey();

            AsymmetricCryptoHandler crypto = new AsymmetricCryptoHandler(publicInfo, true);

            byte[] key = crypto.Encrypt(tdes.Key);
            byte[] iv  = crypto.Encrypt(tdes.IV);

            iniFile.SetValue("Public", "Modulus", Convert.ToBase64String(publicInfo.Modulus));
            iniFile.SetValue("Public", "Exponent", Convert.ToBase64String(publicInfo.Exponent));

            RSAParameters keyInfo = rsa.ExportParameters(true);

            iniFile.SetValue("Private", "Modulus", Convert.ToBase64String(keyInfo.Modulus));
            iniFile.SetValue("Private", "Exponent", Convert.ToBase64String(keyInfo.Exponent));
            iniFile.SetValue("Private", "P", Convert.ToBase64String(keyInfo.P));
            iniFile.SetValue("Private", "Q", Convert.ToBase64String(keyInfo.Q));
            iniFile.SetValue("Private", "DP", Convert.ToBase64String(keyInfo.DP));
            iniFile.SetValue("Private", "DQ", Convert.ToBase64String(keyInfo.DQ));
            iniFile.SetValue("Private", "Inverse", Convert.ToBase64String(keyInfo.InverseQ));
            iniFile.SetValue("Private", "D", Convert.ToBase64String(keyInfo.D));
            iniFile.SetValue("Symmetric", "Key", Convert.ToBase64String(key));
            iniFile.SetValue("Symmetric", "IV", Convert.ToBase64String(iv));

            StreamWriter csFile = new StreamWriter(Environment.CurrentDirectory + @"\csharp.cs", false);

            csFile.WriteLine($"private byte[] _MODULUS = {GenerateArrayString(keyInfo.Modulus)};");
            csFile.WriteLine($"private byte[] _EXPONENT = {GenerateArrayString(keyInfo.Exponent)};");
            csFile.WriteLine($"private byte[] _P = {GenerateArrayString(keyInfo.P)};");
            csFile.WriteLine($"private byte[] _Q = {GenerateArrayString(keyInfo.Q)};");
            csFile.WriteLine($"private byte[] _DP = {GenerateArrayString(keyInfo.DP)};");
            csFile.WriteLine($"private byte[] _DQ = {GenerateArrayString(keyInfo.DQ)};");
            csFile.WriteLine($"private byte[] _INVERSE = {GenerateArrayString(keyInfo.InverseQ)};");
            csFile.WriteLine($"private byte[] _D = {GenerateArrayString(keyInfo.D)};");

            csFile.WriteLine($"");
            csFile.WriteLine($"private byte[] _SYM_KEY = {GenerateArrayString(key)};");
            csFile.WriteLine($"private byte[] _SYM_IV = {GenerateArrayString(iv)};");
            csFile.Close();
            csFile.Dispose();
        }
Esempio n. 13
0
        private void btnAccept_Click(object sender, EventArgs e)
        {
            IniFileName ini = new IniFileName(Environment.CurrentDirectory + @"\ini\GameSetUp.ini");

            ini.SetValue("ScreenMode", "ScreenModeRecord", 2);

            string selectedResolution = cmbScreenResolution.Items[cmbScreenResolution.SelectedIndex].ToString();
            int    width           = Math.Max(1024, int.Parse(selectedResolution.Split('x')[0]) - 20);
            int    height          = Math.Max(768, int.Parse(selectedResolution.Split('x')[1]) - 60);
            int    windowInjection = chkNoInjection.Checked ? 1 : 0;

            ini = new IniFileName(Environment.CurrentDirectory + @"\Config.ini");
            ini.SetValue("GameResolution", "Width", width);
            ini.SetValue("GameResolution", "Height", height);
            ini.SetValue("GameResolution", "NoWindowInjection", windowInjection.ToString());

            int fpsMode = 0;

            if (radioNormalFps.Checked)
            {
                fpsMode = 0;
            }
            else if (radio60Fps.Checked)
            {
                fpsMode = 1;
            }
            else if (radioUnlockedFps.Checked)
            {
                fpsMode = 2;
            }

            ini.SetValue("GameSetup", "FpsMode", fpsMode);

            ini = new IniFileName(Environment.CurrentDirectory + @"\ini\GUI.ini");
            // Main interface
            ini.SetValue("0-130", "x", (width - 1024) / 2);
            ini.SetValue("0-130", "y", height - 141);

            // Chat panel
            ini.SetValue("0-145", "x", ((width - 1024) / 2) + 82);
            ini.SetValue("0-145", "y", height - 71);

            // Chat Player Names
            ini.SetValue("0-148", "x", ((width - 1024) / 2) + 82 + 35);
            ini.SetValue("0-148", "y", height - 65 - 300);

            // Chat Channel
            ini.SetValue("0-174", "x", ((width - 1024) / 2) + 82 + 172);
            ini.SetValue("0-174", "y", height - 65 - 205);

            // Path Finding Button
            ini.SetValue("0-304", "x", width - 110);

            // Path Finding GUI
            ini.SetValue("0-303", "x", width - 530);

            // Exit Game
            ini.SetValue("0-158", "x", (width - 288) / 2);
            ini.SetValue("0-158", "y", (height - 120) / 2);

            // Options
            ini.SetValue("0-138", "x", (width - 370) / 2);
            ini.SetValue("0-138", "y", (height - 350) / 2);

            // Team
            ini.SetValue("0-141", "x", (width - 290) / 2);
            ini.SetValue("0-268", "x", (width - 58) / 2);

            //VIP Button
            ini.SetValue("0-339", "x", ((width - 1024) / 2) + 82 + 205);
            ini.SetValue("0-339", "y", height - 115);

            // My Talisman UI
            ini.SetValue("0-345", "x", 9999);
            // Target Talisman UI
            ini.SetValue("0-346", "x", 9999);

            // Shopping Mall
            ini.SetValue("0-289", "x", ((width - 1024) / 2) + 82 + 50);
            ini.SetValue("0-289", "y", height - 115);

            // Mentor
            ini.SetValue("0-325", "x", ((width - 1024) / 2) + 82 + 85);
            ini.SetValue("0-325", "y", height - 130);

            // Item Lock
            ini.SetValue("0-328", "x", ((width - 1024) / 2) + 82 + 145);
            ini.SetValue("0-328", "y", height - 110);

            // Whisper Player Avatars
            ini.SetValue("0-3", "x", ((width - 1024) / 2) + 82 + 400);
            ini.SetValue("0-3", "y", height - 115);

            // PKModes
            ini.SetValue("0-191", "x", ((width - 1024) / 2) + 82 + 500);
            ini.SetValue("0-191", "y", height - 100);

            // Map Mini
            ini.SetValue("0-1199", "x", width - 40);

            // Map Full
            ini.SetValue("0-1200", "x", width - 20);

            // Actions
            ini.SetValue("0-140", "x", ((width - 1024) / 2) + 250);
            ini.SetValue("0-140", "y", height - 180);

            ini = new IniFileName(Environment.CurrentDirectory + @"\ini\info.ini");
            // Exp
            ini.SetValue("ExpShowPos", "Exp_XPos", (width / 2) - 150);
            ini.SetValue("ExpShowPos", "Exp_YPos", height - 90);

            // AddExp
            ini.SetValue("ExpShowPos", "AddExp_XPos", (width / 2) - 150 + 90);
            ini.SetValue("ExpShowPos", "AddExp_YPos", height - 90);

            Close();
        }
Esempio n. 14
0
 private void PrepareIniFileName()
 {
     IniFileName = Path.GetFileName(System.Windows.Forms.Application.ExecutablePath);
     IniFileName = IniFileName.Substring(0, IniFileName.Length - ".exe".Length) + ".ini";
     iniFile     = new IniFile(System.Windows.Forms.Application.StartupPath + @"\" + IniFileName);
 }
Esempio n. 15
0
        private async Task PlayAsync()
        {
            const string fileName         = "Conquer.exe";
            const string noInjectFileName = "AltConquer.exe";
            const string injectDll        = "UpdaterCore.dll";

            string[] filesToCheck =
            {
                fileName,
                noInjectFileName,
#if !NO_INJECTION
                injectDll,
#endif
            };

            foreach (var file in filesToCheck)
            {
                string verifyPath = $"{Environment.CurrentDirectory}\\{file}";
                if (!File.Exists(verifyPath))
                {
                    MessageBox.Show(this, LanguageManager.GetString("StrFileMissing", file),
                                    LanguageManager.GetString("StrFileMissingTitle"),
                                    MessageBoxButtons.OK);
                    return;
                }
            }

            IniFileName ini = new IniFileName(Environment.CurrentDirectory + @"\Config.ini");
            string      szInjectionDisable = ini.GetEntryValue("GameResolution", "NoWindowInjection")?.ToString() ?? "0";

            if (string.IsNullOrEmpty(szInjectionDisable))
            {
                szInjectionDisable = "0";
            }

            bool    inject = int.Parse(szInjectionDisable) == 0;
            Process game   = null;

            if (!inject)
            {
                string path = $"{Environment.CurrentDirectory}\\{noInjectFileName}";
                game = new Process
                {
                    StartInfo =
                    {
                        WorkingDirectory = Environment.CurrentDirectory,
                        FileName         = path,
                        Arguments        = "blacknull"
                    }
                };
            }
            else
            {
                string path = $"{Environment.CurrentDirectory}\\{fileName}";
                game = new Process
                {
                    StartInfo =
                    {
                        WorkingDirectory = Environment.CurrentDirectory,
                        FileName         = path,
                        Arguments        = "blacknull"
                    }
                };
            }

            game.Start();

            if (inject)
            {
                Injector.StartInjection(injectDll, (uint)game.Id);
            }

            m_lOpenClients.Add(game);
        }