Skip to content

Commit

Permalink
Windows 0.3.3.1
Browse files Browse the repository at this point in the history
Fix url encoding
Branch only for Windows
  • Loading branch information
AnthoDingo committed Jun 6, 2016
1 parent e9c0708 commit 81b122e
Show file tree
Hide file tree
Showing 11 changed files with 195 additions and 620 deletions.
13 changes: 13 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -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
# =========================
Expand Down
22 changes: 22 additions & 0 deletions Dynmap.sln
Original file line number Diff line number Diff line change
@@ -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
24 changes: 16 additions & 8 deletions Dynmap.cs → Dynmap/Dynmap.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}

Expand All @@ -39,7 +41,7 @@ public class Dynmap : RocketPlugin<DynmapConfiguration>
public static Dynmap Instance;
public List<CSteamID> Nicks = new List<CSteamID>();
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;
Expand All @@ -58,11 +60,16 @@ public class Dynmap : RocketPlugin<DynmapConfiguration>


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)
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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")
Expand Down Expand Up @@ -222,16 +230,16 @@ private void ShowCords()
characterName = player.CharacterName.Replace(";", "&#59").Replace("[", "&#91").Replace("]", "&#93").Replace("=", "&#61");
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 + "]"; };
}

//Odešle data na server
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);
Expand Down
78 changes: 78 additions & 0 deletions Dynmap/Dynmap.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{3A5AF8BC-41A6-46A3-8677-A6B54B278B68}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Dynmap</RootNamespace>
<AssemblyName>Dynmap</AssemblyName>
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="Assembly-CSharp">
<HintPath>References\RocketMod\Assembly-CSharp.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="Assembly-CSharp-firstpass">
<HintPath>References\Unturned\Assembly-CSharp-firstpass.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="Rocket.API">
<HintPath>References\RocketMod\Rocket.API.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="Rocket.Core">
<HintPath>References\RocketMod\Rocket.Core.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="Rocket.Unturned">
<HintPath>References\RocketMod\Rocket.Unturned.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
<Reference Include="UnityEngine">
<HintPath>References\Unturned\UnityEngine.dll</HintPath>
<Private>False</Private>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="Dynmap.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>
36 changes: 36 additions & 0 deletions Dynmap/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -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")]
9 changes: 9 additions & 0 deletions Dynmap/References/RocketMod/README.md
Original file line number Diff line number Diff line change
@@ -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
9 changes: 9 additions & 0 deletions Dynmap/References/Unturned/README.md
Original file line number Diff line number Diff line change
@@ -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
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -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.
8 changes: 0 additions & 8 deletions dynmap-config.php

This file was deleted.

102 changes: 0 additions & 102 deletions dynmap-core.php

This file was deleted.

Loading

0 comments on commit 81b122e

Please sign in to comment.