-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMainWindow.xaml.cs
151 lines (138 loc) · 5.47 KB
/
MainWindow.xaml.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Media;
using System.Diagnostics;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using System.Runtime.InteropServices;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Threading.Tasks;
using System.Diagnostics.CodeAnalysis;
using Microsoft.Windows.Themes;
using System.Windows.Forms;
using static System.Windows.Forms.VisualStyles.VisualStyleElement;
using System.Net.NetworkInformation;
namespace 原神__启动_
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
/// bool huiwen(int n, int d)
public partial class MainWindow : System.Windows.Window
{
public MainWindow()
{
InitializeComponent();
}
private void CBox_Checked(object sender, RoutedEventArgs e)
{
FilesINI files = new FilesINI();
files.INIWrite("General", "Music", "false", ".//ini//config.ini");
}
private void CBox_Unchecked(object sender, RoutedEventArgs e)
{
FilesINI files = new FilesINI();
files.INIWrite("General", "Music", "true", ".//ini//config.ini");
}
private void Button_Click_1(object sender, RoutedEventArgs e) //保存游戏 和 配置文件 目录
{
FilesINI files = new FilesINI();
files.INIWrite("General", "Game", Game_Path.Text, ".//ini//config.ini");//原神.路径
//files.INIWrite("General", "INI_P", INIPath.Text, ".//ini//config.ini"); //配置文件.路径
}
private async void Button_Click(object sender, RoutedEventArgs e)
{
string Game_Path,mu;
FilesINI files = new FilesINI();
Game_Path = files.INIRead("General", "Game" , ".//ini//config.ini");
mu = files.INIRead("General", "Music", ".//ini//config.ini");
string path = ".//Re//Robin Schulz,David Guetta,Cheat Codes - Shed a Light.wav";
string ding = ".//Re//ding.wav"; System.Media.SoundPlayer player = new System.Media.SoundPlayer(path);
if (string.IsNullOrEmpty(Game_Path))
{
player.Stop();
System.Media.SoundPlayer player1 = new System.Media.SoundPlayer(ding);
System.Windows.MessageBox.Show("不是,原神呢!?", "System");
player1.Play();
System.Windows.MessageBox.Show("已取消启动!", "System");
}
else
{
if (mu == "false")
{
await Task.Delay(20000);
player.Stop();
Process process = Process.Start(Game_Path + "//YuanShen.exe");
process.WaitForExit();
}
else
{
player.Play();
await Task.Delay(68150);
Process process = Process.Start(Game_Path + "//YuanShen.exe");
}
}
}
private void tkd(object sender, RoutedEventArgs e)
{
{
string Game_Path;
string ding = ".//Re//ding.wav";
FilesINI files = new FilesINI();
Game_Path = files.INIRead("General", "Game", ".//ini//config.ini");
if (string.IsNullOrEmpty(Game_Path))
{
System.Media.SoundPlayer player1 = new System.Media.SoundPlayer(ding);
player1.Play();
System.Windows.MessageBox.Show("切换服务器时\n.ini路径不能为空,切换失败!", "Error");
}
else
{
int textBox1 = 1;//官服 channel
string s1 = textBox1.ToString();
string s2 = Convert.ToString(s1);
FilesINI ConfigINI = new FilesINI();
ConfigINI.INIWrite("General", "channel", s2, Game_Path+ "//config.ini");
}
}
}
private void B(object sender, RoutedEventArgs e)
{
string Game_Path;
FilesINI files = new FilesINI();
string ding = ".//Re//ding.wav";
Game_Path = files.INIRead("General", "Game", ".//ini//config.ini");
if (string.IsNullOrEmpty(Game_Path))
{
System.Media.SoundPlayer player1 = new System.Media.SoundPlayer(ding);
player1.Play();
System.Windows.MessageBox.Show("不懂就问,ini文件在哪里", "Error");
}
else
{
int textBox1 = 14;
string s1 = textBox1.ToString();
string s2 = Convert.ToString(s1);
FilesINI ConfigINI = new FilesINI();
ConfigINI.INIWrite("General", "channel", s2, Game_Path+ "//config.ini");
System.Windows.MessageBox.Show("切换成功!\n当前服务器:B服", "切换");
}
}
}
}