From 81b122eff186f73d2f2699eba329c4f001de0a9a Mon Sep 17 00:00:00 2001 From: Anthony BOSCO Date: Mon, 6 Jun 2016 17:20:54 +0200 Subject: [PATCH] Windows 0.3.3.1 Fix url encoding Branch only for Windows --- .gitignore | 13 + Dynmap.sln | 22 ++ Dynmap.cs => Dynmap/Dynmap.cs | 24 +- Dynmap/Dynmap.csproj | 78 ++++ Dynmap/Properties/AssemblyInfo.cs | 36 ++ Dynmap/References/RocketMod/README.md | 9 + Dynmap/References/Unturned/README.md | 9 + README.md | 12 + dynmap-config.php | 8 - dynmap-core.php | 102 ------ index.php | 502 -------------------------- 11 files changed, 195 insertions(+), 620 deletions(-) create mode 100644 Dynmap.sln rename Dynmap.cs => Dynmap/Dynmap.cs (91%) create mode 100644 Dynmap/Dynmap.csproj create mode 100644 Dynmap/Properties/AssemblyInfo.cs create mode 100644 Dynmap/References/RocketMod/README.md create mode 100644 Dynmap/References/Unturned/README.md create mode 100644 README.md delete mode 100644 dynmap-config.php delete mode 100644 dynmap-core.php delete mode 100644 index.php diff --git a/.gitignore b/.gitignore index 96374c4..0b4658a 100644 --- a/.gitignore +++ b/.gitignore @@ -17,6 +17,19 @@ $RECYCLE.BIN/ # Windows shortcuts *.lnk +# Build results +[Dd]ebug/ +[Dd]ebugPublic/ +[Rr]elease/ +[Rr]eleases/ +x64/ +x86/ +bld/ +[Bb]in/ +[Oo]bj/ +[Ll]og/ +*.dll + # ========================= # Operating System Files # ========================= diff --git a/Dynmap.sln b/Dynmap.sln new file mode 100644 index 0000000..8b30c1a --- /dev/null +++ b/Dynmap.sln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 14 +VisualStudioVersion = 14.0.24720.0 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Dynmap", "Dynmap\Dynmap.csproj", "{3A5AF8BC-41A6-46A3-8677-A6B54B278B68}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {3A5AF8BC-41A6-46A3-8677-A6B54B278B68}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {3A5AF8BC-41A6-46A3-8677-A6B54B278B68}.Debug|Any CPU.Build.0 = Debug|Any CPU + {3A5AF8BC-41A6-46A3-8677-A6B54B278B68}.Release|Any CPU.ActiveCfg = Release|Any CPU + {3A5AF8BC-41A6-46A3-8677-A6B54B278B68}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/Dynmap.cs b/Dynmap/Dynmap.cs similarity index 91% rename from Dynmap.cs rename to Dynmap/Dynmap.cs index 2c2a929..752f5e5 100644 --- a/Dynmap.cs +++ b/Dynmap/Dynmap.cs @@ -24,12 +24,14 @@ public class DynmapConfiguration : IRocketPluginConfiguration public string PrivateKey; public int syncInterval; public string WebCoreAddress; + public bool displayInChat; public void LoadDefaults() { PrivateKey = "MySecretPrivateKey"; syncInterval = 5000; WebCoreAddress = "http://localhost"; + displayInChat = true; } } @@ -39,7 +41,7 @@ public class Dynmap : RocketPlugin public static Dynmap Instance; public List Nicks = new List(); public Timer myTimer; - public string directory = Directory.GetCurrentDirectory(); + public string directory = System.IO.Directory.GetCurrentDirectory(); public string[] maps; public string sendMaps; public string data = string.Empty; @@ -58,11 +60,16 @@ public class Dynmap : RocketPlugin protected override void Load() - { + { + Logger.Log("Loading ..."); + //Načtení privátního klíče a složky Maps PrivateKey = Configuration.Instance.PrivateKey; - maps = Directory.GetDirectories(directory + @"/../../../Maps"); - + maps = System.IO.Directory.GetDirectories(System.IO.Path.GetFullPath(directory + @"/../../../Maps")); + foreach(string map in maps) + { + Logger.Log("Finding map : " + map); + } //Vypsání map na serveru foreach (string splitMap in maps) @@ -111,6 +118,7 @@ protected override void Load() if (sentMessage == false) { Logger.LogWarning("Uploading map files to the server! This may take some time!"); sentMessage = true; }; if (uploadMaps[o] != string.Empty) { + Logger.Log("Uploading map : " + uploadMaps[o]); //Generování TransferID RNGCryptoServiceProvider rng = new RNGCryptoServiceProvider(); @@ -149,7 +157,7 @@ protected override void Load() //Nahrání souborů map na server System.Net.WebClient Client = new System.Net.WebClient (); Client.Headers.Add("Content-Type", "binary/octet-stream"); - byte[] result = Client.UploadFile(Configuration.Instance.WebCoreAddress + "/dynmap-core.php?user=server&do=uploadfile&TransferID=" + Uri.EscapeDataString(TransferID) + "&mapname=" + uploadMaps[o], "POST", directory + @"/../../../Maps/" + uploadMaps[o] + @"/Map.png"); + byte[] result = Client.UploadFile(Configuration.Instance.WebCoreAddress + "/dynmap-core.php?user=server&do=uploadfile&TransferID=" + Uri.EscapeDataString(TransferID) + "&mapname=" + Uri.EscapeDataString(uploadMaps[o].Split('\\')[uploadMaps[0].Split('\\').Length - 1]), "POST", @"../../../Maps/" + uploadMaps[o] + @"/Map.png"); String s = System.Text.Encoding.UTF8.GetString (result,0,result.Length); if (s == "Error.UploadDone") @@ -222,7 +230,7 @@ private void ShowCords() characterName = player.CharacterName.Replace(";", ";").Replace("[", "[").Replace("]", "]").Replace("=", "="); rotation = Convert.ToInt32(player.Rotation); if (player.IsAdmin == true) { playerStatus = "admin"; } else if (player.IsPro == true) { playerStatus = "pro"; } else { playerStatus = "player"; } - UnturnedChat.Say(player, player.Position + "=Position"); + if (Configuration.Instance.displayInChat == true) { UnturnedChat.Say(player, player.Position + "=Position"); } if (player.Features.VanishMode == false) { data = data + "[Charactername=" + characterName + ";CSteamID=" + player.CSteamID + ";Position=" + player.Position + ";Rotation=" + rotation + ";PlayerStatus=" + playerStatus + "]"; }; } @@ -230,8 +238,8 @@ private void ShowCords() if (data != string.Empty || firstrun == true) { url = Configuration.Instance.WebCoreAddress + "/dynmap-core.php?user=server"; - postData = "map=" + SDG.Unturned.Provider.map + "&data=" + Uri.EscapeDataString(data) + "&privatekey=" + PrivateKey; - if (shutdown == true) { postData = "map=" + SDG.Unturned.Provider.map + "&privatekey=" + PrivateKey; }; + postData = "map=" + Uri.EscapeDataString(SDG.Unturned.Provider.map) + "&data=" + Uri.EscapeDataString(data) + "&privatekey=" + PrivateKey; + if (shutdown == true) { postData = "map=" + Uri.EscapeDataString(SDG.Unturned.Provider.map) + "&privatekey=" + PrivateKey; }; var post = Encoding.ASCII.GetBytes(postData); HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url); diff --git a/Dynmap/Dynmap.csproj b/Dynmap/Dynmap.csproj new file mode 100644 index 0000000..12d9e29 --- /dev/null +++ b/Dynmap/Dynmap.csproj @@ -0,0 +1,78 @@ + + + + + Debug + AnyCPU + {3A5AF8BC-41A6-46A3-8677-A6B54B278B68} + Library + Properties + Dynmap + Dynmap + v4.5.2 + 512 + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + References\RocketMod\Assembly-CSharp.dll + False + + + References\Unturned\Assembly-CSharp-firstpass.dll + False + + + References\RocketMod\Rocket.API.dll + False + + + References\RocketMod\Rocket.Core.dll + False + + + References\RocketMod\Rocket.Unturned.dll + False + + + + + + + + + + + References\Unturned\UnityEngine.dll + False + + + + + + + + + \ No newline at end of file diff --git a/Dynmap/Properties/AssemblyInfo.cs b/Dynmap/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..c3e6d51 --- /dev/null +++ b/Dynmap/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// Les informations générales relatives à un assembly dépendent de +// l'ensemble d'attributs suivant. Changez les valeurs de ces attributs pour modifier les informations +// associées à un assembly. +[assembly: AssemblyTitle("Dynmap")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("Dynmap")] +[assembly: AssemblyCopyright("Copyright © 2016")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// L'affectation de la valeur false à ComVisible rend les types invisibles dans cet assembly +// aux composants COM. Si vous devez accéder à un type dans cet assembly à partir de +// COM, affectez la valeur true à l'attribut ComVisible sur ce type. +[assembly: ComVisible(false)] + +// Le GUID suivant est pour l'ID de la typelib si ce projet est exposé à COM +[assembly: Guid("3a5af8bc-41a6-46a3-8677-a6b54b278b68")] + +// Les informations de version pour un assembly se composent des quatre valeurs suivantes : +// +// Version principale +// Version secondaire +// Numéro de build +// Révision +// +// Vous pouvez spécifier toutes les valeurs ou indiquer les numéros de build et de révision par défaut +// en utilisant '*', comme indiqué ci-dessous : +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Dynmap/References/RocketMod/README.md b/Dynmap/References/RocketMod/README.md new file mode 100644 index 0000000..0e98380 --- /dev/null +++ b/Dynmap/References/RocketMod/README.md @@ -0,0 +1,9 @@ +## RocketMod + +Download RocketMod from https://rocketmod.net/get-rocket + +Copy/Paste file from RocketMod to this folder : +* Assembly-CSharp.dll +* Rocket.API.dll +* Rocket.Core.dll +* Rocket.Unturned.dll diff --git a/Dynmap/References/Unturned/README.md b/Dynmap/References/Unturned/README.md new file mode 100644 index 0000000..fc45d6c --- /dev/null +++ b/Dynmap/References/Unturned/README.md @@ -0,0 +1,9 @@ +## Unturned + +Copy/Paste file from your Unturned game. +Files are located : +> Unturned\Unturned_Data\Managed + +Copy/Paste file from RocketMod to this folder : +* Assembly-CSharp-firstpass.dll +* UnityEngine.dll diff --git a/README.md b/README.md new file mode 100644 index 0000000..2e79a10 --- /dev/null +++ b/README.md @@ -0,0 +1,12 @@ +# Unturned Dynmap + +_**Only for Windows**_ +If you want use Linux version, checkout [Linux branch](https://github.com/AnthoDingo/DynmapSource/tree/Linux) + +## 1 Required files + +Read the README in folders Dynmap/References/RocketMod and Dynmap/References/RocketMod + +## 2 Build + +After copyign required files, you can start the solution and build the project. \ No newline at end of file diff --git a/dynmap-config.php b/dynmap-config.php deleted file mode 100644 index 256f10a..0000000 --- a/dynmap-config.php +++ /dev/null @@ -1,8 +0,0 @@ - color of bars on the sides - $serverIP = ""; //IP address of server without port - $serverPort = ""; //Port of the server -?> \ No newline at end of file diff --git a/dynmap-core.php b/dynmap-core.php deleted file mode 100644 index 0b98d88..0000000 --- a/dynmap-core.php +++ /dev/null @@ -1,102 +0,0 @@ - \ No newline at end of file diff --git a/index.php b/index.php deleted file mode 100644 index 429b660..0000000 --- a/index.php +++ /dev/null @@ -1,502 +0,0 @@ - - - - - - <?php echo $DynmapTitle;?> - - - - - - -
-
- -
-
-
-
-
Version: Beta 0.3.6, Developed by LinhyCZ, http://linhy.cz
- ">
 Connect to server!
- - - - - - \ No newline at end of file