Пример #1
0
 //获取CSGO目录
 private void InitCSGOPath()
 {
     try
     {
         StringBuilder Stream = new StringBuilder(1024);
         WIN32API.GetPrivateProfileString("Steam", "CSGOPath", null, Stream, 1024, Application.StartupPath + "\\Config.ini");
         if (File.Exists(Stream.ToString() + @"\csgo.exe"))
         {
             GCSGOPath = Stream.ToString();
             return;
         }
         WIN32API._GetCSGOPath(Stream, 1024);
         GCSGOPath = Stream.ToString();
         if (File.Exists(GCSGOPath.ToString() + @"\csgo.exe"))
         {
             label_DebugOutPut.Text = "获取CSGO目录失败!!";
             return;
         }
         WIN32API.WritePrivateProfileString("Steam", "CSGOPath", GCSGOPath, Application.StartupPath + "\\Config.ini");
     }
     catch (Exception e)
     {
         label_DebugOutPut.Text = e.Message.ToString();
     }
 }
Пример #2
0
 //获取Steam目录
 private void InitSteamPath()
 {
     try
     {
         StringBuilder SteamPath = new StringBuilder(1024);
         WIN32API.GetPrivateProfileString("Steam", "Path", null, SteamPath, 1024, Application.StartupPath + "\\Config.ini");
         if (SteamPath.Length > 5)
         {
             GSteamPath = SteamPath.ToString();
             return;
         }
         string      registData;
         RegistryKey hkml     = Registry.LocalMachine;
         RegistryKey software = hkml.OpenSubKey("SOFTWARE", false);
         RegistryKey aimdir   = software.OpenSubKey("Classes\\steam\\Shell\\Open\\Command", false);
         registData = aimdir.GetValue(null).ToString();
         string[] sArray = Regex.Split(registData, "\"", RegexOptions.IgnoreCase);
         GSteamPath = sArray[1].ToString();
         WIN32API.WritePrivateProfileString("Steam", "Path", GSteamPath, Application.StartupPath + "\\Config.ini");
     }
     catch (Exception e)
     {
         label_DebugOutPut.Text = e.Message.ToString();
     }
 }
Пример #3
0
 //国服/国际服模式
 private void checkBox_CN_CheckedChanged(object sender, EventArgs e)
 {
     if (checkBox_CN.Checked == false)
     {
         WIN32API.WritePrivateProfileString("Steam", "IsChina", "False", Application.StartupPath + "\\Config.ini");
     }
     else
     {
         WIN32API.WritePrivateProfileString("Steam", "IsChina", "True", Application.StartupPath + "\\Config.ini");
     }
 }
Пример #4
0
 private void checkBox_BindKey_CheckedChanged(object sender, EventArgs e)
 {
     if (checkBox_BindKey.Checked)
     {
         WIN32API.WritePrivateProfileString("Key", "bind", "true", Application.StartupPath + "\\Config.ini");
         if (isor)
         {
             MessageBox.Show("已开启按键绑定,如果没有效果,请打开控制台输入[\"exec bind\"]手动激活按键!");
         }
         isor = true;
     }
     else
     {
         isor = true;
         WIN32API.WritePrivateProfileString("Key", "bind", "false", Application.StartupPath + "\\Config.ini");
     }
 }
Пример #5
0
        private void button2_Click(object sender, EventArgs e)
        {
            //CSGO目录浏览
            OpenFileDialog dialog = new OpenFileDialog();

            dialog.Multiselect = false;
            dialog.Title       = "请选择CSGO文件";
            dialog.Filter      = "可执行文件(*.exe)|*.exe|所有文件(*.*)|*.*";
            if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                StringBuilder sr = new StringBuilder(1024);
                sr.Append(dialog.FileName);
                WIN32API._DeleteSuffix(sr, '\\');
                if (File.Exists(sr.ToString() + "\\csgo.exe"))
                {
                    textBox_CSGOPath.Text = sr.ToString();
                    _form1.SetCSGOPath(textBox_CSGOPath.Text);
                    WIN32API.WritePrivateProfileString("Steam", "CSGOPath", textBox_CSGOPath.Text, Application.StartupPath + "\\Config.ini");
                }
            }
        }
Пример #6
0
 //CSGO目录获取定时器线程
 private void time_csgo_event(object sender, EventArgs e)
 {
     label_DebugOutPut.Text = "CSGO线程检测运行中,正在等待CSGO进程运行....";
     try
     {
         StringBuilder Csgo = new StringBuilder(1024);
         if (WIN32API._GetProcessCSGOPath(Csgo, 1024))
         {
             if (File.Exists(Csgo.ToString() + @"\csgo.exe"))
             {
                 GCSGOPath = Csgo.ToString();
                 time_csgo.Stop();
                 WIN32API.WritePrivateProfileString("Steam", "CSGOPath", GCSGOPath, Application.StartupPath + "\\Config.ini");
                 label_DebugOutPut.Text = "成功获取到CSGO目录路径!";
             }
         }
     }
     catch (System.Exception ex)
     {
         label_DebugOutPut.Text = ex.Message.ToString();
     }
 }
Пример #7
0
 private void SaveServerMode()
 {
     WIN32API.WritePrivateProfileString("Config", "ServerMode", ServerMode, Application.StartupPath + "\\Config.ini");
 }