Changeset 93
- Timestamp:
- Jul 20, 2014, 8:50:13 PM (10 years ago)
- Location:
- binary-improvements
- Files:
-
- 2 added
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
binary-improvements/7dtd-server-fixes/7dtd-server-fixes.csproj
r84 r93 48 48 <Compile Include="src\TelnetCommands\SetTimeReal.cs" /> 49 49 <Compile Include="src\AdminToolsStuff.cs" /> 50 <Compile Include="src\TelnetCommands\ShowInventory.cs" /> 51 <Compile Include="src\PlayerDataStuff.cs" /> 50 52 </ItemGroup> 51 53 <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> -
binary-improvements/7dtd-server-fixes/7dtd-server-fixes.userprefs
r91 r93 4 4 <Files> 5 5 <File FileName="src/AssemblyInfo.cs" Line="20" Column="40" /> 6 <File FileName="src/AllocsNetTelnetServer.cs" Line=" 33" Column="1" />6 <File FileName="src/AllocsNetTelnetServer.cs" Line="93" Column="50" /> 7 7 <File FileName="src/AllocsTelnetConnection.cs" Line="44" Column="42" /> 8 8 <File FileName="src/AllocsLogFunctions.cs" Line="27" Column="42" /> 9 <File FileName="src/TelnetCommands/GetGamePrefs.cs" Line="7 1" Column="3" />10 <File FileName="src/TelnetCommands/ListPlayersExtended.cs" Line=" 49" Column="17" />9 <File FileName="src/TelnetCommands/GetGamePrefs.cs" Line="77" Column="1" /> 10 <File FileName="src/TelnetCommands/ListPlayersExtended.cs" Line="64" Column="31" /> 11 11 <File FileName="src/TelnetCommands/SayToPlayer.cs" Line="75" Column="33" /> 12 12 <File FileName="src/AdminToolsStuff.cs" Line="30" Column="54" /> -
binary-improvements/7dtd-server-fixes/src/AllocsNetTelnetServer.cs
r91 r93 14 14 private static bool closed = false; 15 15 private static bool authEnabled = false; 16 private static List<AllocsTelnetConnection> conn s = new List<AllocsTelnetConnection> ();16 private static List<AllocsTelnetConnection> connections = new List<AllocsTelnetConnection> (); 17 17 18 18 public static void init (int port) … … 38 38 if (listener.Pending ()) { 39 39 AllocsTelnetConnection c = new AllocsTelnetConnection (listener.AcceptTcpClient (), authEnabled); 40 conn s.Add (c);40 connections.Add (c); 41 41 Log.Out ("Telnet connection from: " + c.GetEndPoint ()); 42 42 if (authEnabled) { … … 47 47 } 48 48 49 foreach (AllocsTelnetConnection c in conn s) {49 foreach (AllocsTelnetConnection c in connections) { 50 50 if (c.IsClosed ()) { 51 51 c.Close (); 52 conn s.Remove (c);52 connections.Remove (c); 53 53 break; 54 54 } … … 70 70 Log.Out ("Telnet connection closed by client: " + c.GetEndPoint ()); 71 71 c.Close (); 72 conn s.Remove (c);72 connections.Remove (c); 73 73 break; 74 74 } … … 124 124 listener.Stop (); 125 125 } 126 foreach (AllocsTelnetConnection c in conn s) {126 foreach (AllocsTelnetConnection c in connections) { 127 127 c.Close (); 128 128 } … … 139 139 console.AddCommand(new SayToPlayer(console)); 140 140 console.AddCommand(new SetTimeReal(console)); 141 console.AddCommand(new ShowInventory(console)); 141 142 } 142 143 143 144 private static void RemoveClosedConnections () 144 145 { 145 foreach (AllocsTelnetConnection c in conn s) {146 foreach (AllocsTelnetConnection c in connections) { 146 147 if (c.IsClosed ()) { 147 148 c.Close (); … … 156 157 } 157 158 RemoveClosedConnections (); 158 foreach (AllocsTelnetConnection c in conn s) {159 foreach (AllocsTelnetConnection c in connections) { 159 160 if (c.IsAuthenticated ()) 160 161 c.WriteLine (line); -
binary-improvements/NamePatcher/NamePatcher.cs
r86 r93 58 58 static void applyManualPatches (ModuleDefinition mainModule) 59 59 { 60 NameNormalizer.setName (mainModule.GetType ("ItemBlock").BaseType.Resolve (), "ItemBase"); 61 62 foreach (FieldDefinition fd in mainModule.GetType("PlayerDataFile").Fields) { 63 TypeReference fdType = fd.FieldType; 64 if (fd.Name.Equals ("inventory") && fdType.IsArray) { 65 foreach (FieldDefinition fd2 in fdType.Resolve().Fields) { 66 TypeReference fd2Type = fd2.FieldType; 67 if (fd2Type.FullName.Equals ("System.Int32")) { 68 Console.WriteLine ("Renaming inventory field field -> count"); 69 NameNormalizer.setName (fd2, "count"); 70 } 71 if (fd2Type.FullName.Equals ("ItemValue")) { 72 Console.WriteLine ("Renaming inventory field field -> itemValue"); 73 NameNormalizer.setName (fd2, "itemValue"); 74 } 75 } 76 Console.WriteLine ("Renaming inventory field class -> InventoryField"); 77 NameNormalizer.setName (fdType.Resolve (), "InventoryField"); 78 } 79 } 80 60 81 foreach (FieldDefinition fd in mainModule.GetType ("AdminTools").Fields) { 61 82 TypeReference fdType = fd.FieldType; -
binary-improvements/assembly-patcher/Assembly-Patcher.userprefs
r86 r93 3 3 <MonoDevelop.Ide.Workbench ActiveDocument="Main.cs"> 4 4 <Files> 5 <File FileName="Main.cs" Line=" 28" Column="4" />5 <File FileName="Main.cs" Line="53" Column="57" /> 6 6 <File FileName="AssemblyInfo.cs" Line="21" Column="1" /> 7 7 </Files> -
binary-improvements/assembly-patcher/Main.cs
r84 r93 11 11 { 12 12 ModuleDefinition module = ModuleDefinition.ReadModule ("Assembly-CSharp.dll"); 13 14 TypeDefinition type = module.GetType ("GameManager"); 15 if (isPatched (type)) { 16 Console.WriteLine("Assembly already patched"); 17 return; 18 } 19 markTypePatched (module, type); 20 13 21 telnetPatch (module); 14 22 connectLogPatch (module); 15 executionLogPatch (module);23 executionLogPatch (module); 16 24 publicCommandPermissionsPatch (module); 25 playerDataPatch (module); 17 26 module.Write ("Assembly-CSharp.dll"); 18 27 Console.WriteLine ("Done"); 28 } 29 30 private static void playerDataPatch (ModuleDefinition module) 31 { 32 TypeDefinition type = module.GetType ("GameManager"); 33 34 addHook (type, "SavePlayerData", true, 2, true, typeof(PlayerDataStuff).GetMethod ("GM_SavePlayerData")); 19 35 } 20 36 … … 23 39 TypeDefinition type = module.GetType ("AdminTools"); 24 40 25 if (isPatched (type)) {26 return;27 }28 29 markTypePatched (module, type);30 41 replaceMethod (type, "GetAllowedCommandsList", true, 1, typeof(AdminToolsStuff).GetMethod ("GetAllowedCommandsList")); 31 42 } … … 35 46 TypeDefinition type = module.GetType ("GameManager"); 36 47 37 if (isPatched (type)) {38 return;39 }40 41 markTypePatched (module, type);42 48 addHook (type, "RequestToSpawnPlayer", true, 5, true, typeof(AllocsLogFunctions).GetMethod ("RequestToSpawnPlayer")); 43 49 } … … 47 53 TypeDefinition type = module.GetType ("ConsoleSdtd"); 48 54 49 if (isPatched (type)) {50 return;51 }52 53 markTypePatched (module, type);54 55 addHook (type, "ExecuteCmdFromClient", true, 3, false, typeof(AllocsLogFunctions).GetMethod ("ExecuteCmdFromClient")); 55 56 } … … 59 60 TypeDefinition type = module.GetType ("NetTelnetServer"); 60 61 61 if (isPatched (type)) {62 return;63 }64 65 markTypePatched (module, type);66 62 replaceMethod (type, ".ctor", false, 1, typeof(AllocsNetTelnetServer).GetMethod ("init")); 67 63 replaceMethod (type, "Disconnect", false, 0, typeof(AllocsNetTelnetServer).GetMethod ("Disconnect"));
Note:
See TracChangeset
for help on using the changeset viewer.