From d1438b11ca665c85110441428d3132adfc7f9f74 Mon Sep 17 00:00:00 2001 From: Maverick Motherfucker Date: Tue, 7 Jun 2011 18:28:17 -0700 Subject: [PATCH] started work on Updater --- Terraria.sln | 12 +++ Update/Program.cs | 55 +++++++++++++ Update/Properties/AssemblyInfo.cs | 36 +++++++++ Update/Resources.Designer.cs | 70 +++++++++++++++++ Update/Resources.resx | 124 ++++++++++++++++++++++++++++++ Update/Update.csproj | 72 +++++++++++++++++ 6 files changed, 369 insertions(+) create mode 100644 Update/Program.cs create mode 100644 Update/Properties/AssemblyInfo.cs create mode 100644 Update/Resources.Designer.cs create mode 100644 Update/Resources.resx create mode 100644 Update/Update.csproj diff --git a/Terraria.sln b/Terraria.sln index 3c46c488..9efdbb5b 100644 --- a/Terraria.sln +++ b/Terraria.sln @@ -3,6 +3,8 @@ Microsoft Visual Studio Solution File, Format Version 11.00 # Visual Studio 2010 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TShockAPI", "TShockAPI\TShockAPI.csproj", "{49606449-072B-4CF5-8088-AA49DA586694}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Update", "Update\Update.csproj", "{AF322FAB-9A32-43AA-A01A-76B2A039F711}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -23,6 +25,16 @@ Global {49606449-072B-4CF5-8088-AA49DA586694}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU {49606449-072B-4CF5-8088-AA49DA586694}.Release|Mixed Platforms.Build.0 = Release|Any CPU {49606449-072B-4CF5-8088-AA49DA586694}.Release|x86.ActiveCfg = Release|Any CPU + {AF322FAB-9A32-43AA-A01A-76B2A039F711}.Debug|Any CPU.ActiveCfg = Debug|x86 + {AF322FAB-9A32-43AA-A01A-76B2A039F711}.Debug|Mixed Platforms.ActiveCfg = Debug|x86 + {AF322FAB-9A32-43AA-A01A-76B2A039F711}.Debug|Mixed Platforms.Build.0 = Debug|x86 + {AF322FAB-9A32-43AA-A01A-76B2A039F711}.Debug|x86.ActiveCfg = Debug|x86 + {AF322FAB-9A32-43AA-A01A-76B2A039F711}.Debug|x86.Build.0 = Debug|x86 + {AF322FAB-9A32-43AA-A01A-76B2A039F711}.Release|Any CPU.ActiveCfg = Release|x86 + {AF322FAB-9A32-43AA-A01A-76B2A039F711}.Release|Mixed Platforms.ActiveCfg = Release|x86 + {AF322FAB-9A32-43AA-A01A-76B2A039F711}.Release|Mixed Platforms.Build.0 = Release|x86 + {AF322FAB-9A32-43AA-A01A-76B2A039F711}.Release|x86.ActiveCfg = Release|x86 + {AF322FAB-9A32-43AA-A01A-76B2A039F711}.Release|x86.Build.0 = Release|x86 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/Update/Program.cs b/Update/Program.cs new file mode 100644 index 00000000..530833cd --- /dev/null +++ b/Update/Program.cs @@ -0,0 +1,55 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Diagnostics; +using System.IO; + +namespace Update +{ + class Program + { + static void Main(string[] args) + { + string data; + string procname; + try + { + StreamReader sr = new StreamReader("pn"); + procname = sr.ReadToEnd(); + sr.Close(); + sr.Dispose(); + sr = new StreamReader("pid"); + data = sr.ReadToEnd(); + sr.Close(); + } + catch (FileNotFoundException) + { + data = ""; + } + + try + { + Process TServer = Process.GetProcessById(Convert.ToInt32(data)); + while (!TServer.HasExited) + { + } + } + catch (Exception) + { + } + + try + { + File.Delete("TShockAPI.dll"); + } + catch (FileNotFoundException) + { + } + + BinaryWriter bw = new BinaryWriter(new FileStream("TShockAPI.dll", FileMode.Create)); + bw.Write(Resources.TShockAPI); + bw.Close(); + } + } +} diff --git a/Update/Properties/AssemblyInfo.cs b/Update/Properties/AssemblyInfo.cs new file mode 100644 index 00000000..c8f98b3a --- /dev/null +++ b/Update/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Update")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("Microsoft")] +[assembly: AssemblyProduct("Update")] +[assembly: AssemblyCopyright("Copyright © Microsoft 2011")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("c809c4c8-97b2-46f1-bbc0-b4a3ae955ac1")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Update/Resources.Designer.cs b/Update/Resources.Designer.cs new file mode 100644 index 00000000..027612f0 --- /dev/null +++ b/Update/Resources.Designer.cs @@ -0,0 +1,70 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.1 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace Update { + using System; + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resources { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Update.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + + internal static byte[] TShockAPI { + get { + object obj = ResourceManager.GetObject("TShockAPI", resourceCulture); + return ((byte[])(obj)); + } + } + } +} diff --git a/Update/Resources.resx b/Update/Resources.resx new file mode 100644 index 00000000..b1ad6d77 --- /dev/null +++ b/Update/Resources.resx @@ -0,0 +1,124 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + + Resources\TShockAPI.dll;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/Update/Update.csproj b/Update/Update.csproj new file mode 100644 index 00000000..e4721f72 --- /dev/null +++ b/Update/Update.csproj @@ -0,0 +1,72 @@ + + + + Debug + x86 + 8.0.30703 + 2.0 + {AF322FAB-9A32-43AA-A01A-76B2A039F711} + Exe + Properties + Update + UpdateTShock + v4.0 + Client + 512 + + + x86 + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + x86 + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + + + + True + True + Resources.resx + + + + + ResXFileCodeGenerator + Resources.Designer.cs + + + + + + + + \ No newline at end of file