finished updater, now for TShock code's part in this
This commit is contained in:
parent
d1438b11ca
commit
e61d0a74fe
1 changed files with 18 additions and 1 deletions
|
|
@ -12,16 +12,31 @@ namespace Update
|
||||||
static void Main(string[] args)
|
static void Main(string[] args)
|
||||||
{
|
{
|
||||||
string data;
|
string data;
|
||||||
string procname;
|
string procname = "cmd.exe";
|
||||||
|
string procargs = "/c echo finalizing update&&ping 127.0.0.1 -n 2&&del UpdateTShock.exe";
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
StreamReader sr = new StreamReader("pn");
|
StreamReader sr = new StreamReader("pn");
|
||||||
procname = sr.ReadToEnd();
|
procname = sr.ReadToEnd();
|
||||||
sr.Close();
|
sr.Close();
|
||||||
|
|
||||||
|
string[] datat = procname.Split(' ');
|
||||||
|
procname = datat[0];
|
||||||
|
procargs = "";
|
||||||
|
for (int i = 0; i < datat.Count(); i++)
|
||||||
|
{
|
||||||
|
procargs += datat[i] + " ";
|
||||||
|
}
|
||||||
|
|
||||||
|
File.Delete("pn");
|
||||||
|
|
||||||
sr.Dispose();
|
sr.Dispose();
|
||||||
|
|
||||||
sr = new StreamReader("pid");
|
sr = new StreamReader("pid");
|
||||||
data = sr.ReadToEnd();
|
data = sr.ReadToEnd();
|
||||||
sr.Close();
|
sr.Close();
|
||||||
|
|
||||||
|
File.Delete("pid");
|
||||||
}
|
}
|
||||||
catch (FileNotFoundException)
|
catch (FileNotFoundException)
|
||||||
{
|
{
|
||||||
|
|
@ -50,6 +65,8 @@ namespace Update
|
||||||
BinaryWriter bw = new BinaryWriter(new FileStream("TShockAPI.dll", FileMode.Create));
|
BinaryWriter bw = new BinaryWriter(new FileStream("TShockAPI.dll", FileMode.Create));
|
||||||
bw.Write(Resources.TShockAPI);
|
bw.Write(Resources.TShockAPI);
|
||||||
bw.Close();
|
bw.Close();
|
||||||
|
|
||||||
|
Process.Start(new ProcessStartInfo(procname, procargs));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue