Changeset 309 for binary-improvements
- Timestamp:
- Aug 9, 2017, 7:43:07 PM (7 years ago)
- Location:
- binary-improvements
- Files:
-
- 20 edited
Legend:
- Unmodified
- Added
- Removed
-
binary-improvements/7dtd-server-fixes/ModInfo.xml
r306 r309 5 5 <Description value="Common functions" /> 6 6 <Author value="Christian 'Alloc' Illy" /> 7 <Version value="1 5" />7 <Version value="16" /> 8 8 <Website value="http://7dtd.illy.bz" /> 9 9 </ModInfo> -
binary-improvements/7dtd-server-fixes/src/JSON/JSONArray.cs
r187 r309 23 23 } 24 24 25 public override string ToString (bool prettyPrint = false, int currentLevel = 0)25 public override void ToString (StringBuilder stringBuilder, bool prettyPrint = false, int currentLevel = 0) 26 26 { 27 StringBuilder sb = new StringBuilder("[");27 stringBuilder.Append ("["); 28 28 if (prettyPrint) 29 s b.Append ('\n');29 stringBuilder.Append ('\n'); 30 30 foreach (JSONNode n in nodes) { 31 31 if (prettyPrint) 32 s b.Append (new String ('\t', currentLevel + 1));33 sb.Append (n.ToString (prettyPrint, currentLevel + 1));34 s b.Append (",");32 stringBuilder.Append (new String ('\t', currentLevel + 1)); 33 n.ToString (stringBuilder, prettyPrint, currentLevel + 1); 34 stringBuilder.Append (","); 35 35 if (prettyPrint) 36 s b.Append ('\n');36 stringBuilder.Append ('\n'); 37 37 } 38 if (s b.Length > 1)39 s b.Remove (sb.Length - (prettyPrint ? 2 : 1), 1);38 if (stringBuilder.Length > 1) 39 stringBuilder.Remove (stringBuilder.Length - (prettyPrint ? 2 : 1), 1); 40 40 if (prettyPrint) 41 sb.Append (new String ('\t', currentLevel)); 42 sb.Append ("]"); 43 return sb.ToString (); 41 stringBuilder.Append (new String ('\t', currentLevel)); 42 stringBuilder.Append ("]"); 44 43 } 45 44 -
binary-improvements/7dtd-server-fixes/src/JSON/JSONBoolean.cs
r279 r309 1 1 using System; 2 using System.Text; 2 3 3 4 namespace AllocsFixes.JSON … … 17 18 } 18 19 19 public override string ToString (bool prettyPrint = false, int currentLevel = 0)20 public override void ToString (StringBuilder stringBuilder, bool prettyPrint = false, int currentLevel = 0) 20 21 { 21 return value.ToString (System.Globalization.CultureInfo.InvariantCulture).ToLower ();22 stringBuilder.Append (value ? "true" : "false"); 22 23 } 23 24 -
binary-improvements/7dtd-server-fixes/src/JSON/JSONNode.cs
r187 r309 1 1 using System; 2 using System.Text; 2 3 3 4 namespace AllocsFixes.JSON … … 5 6 public abstract class JSONNode 6 7 { 7 public abstract string ToString(bool prettyPrint = false, int currentLevel = 0); 8 public abstract void ToString(StringBuilder stringBuilder, bool prettyPrint = false, int currentLevel = 0); 9 10 public override string ToString () { 11 StringBuilder sb = new StringBuilder (); 12 ToString (sb); 13 return sb.ToString (); 14 } 8 15 } 9 16 } 10 -
binary-improvements/7dtd-server-fixes/src/JSON/JSONNull.cs
r279 r309 1 1 using System; 2 using System.Text; 2 3 3 4 namespace AllocsFixes.JSON … … 9 10 } 10 11 11 public override string ToString (bool prettyPrint = false, int currentLevel = 0)12 public override void ToString (StringBuilder stringBuilder, bool prettyPrint = false, int currentLevel = 0) 12 13 { 13 return "null";14 stringBuilder.Append ("null"); 14 15 } 15 16 -
binary-improvements/7dtd-server-fixes/src/JSON/JSONNumber.cs
r279 r309 23 23 } 24 24 25 public override string ToString (bool prettyPrint = false, int currentLevel = 0)25 public override void ToString (StringBuilder stringBuilder, bool prettyPrint = false, int currentLevel = 0) 26 26 { 27 return value.ToString (System.Globalization.CultureInfo.InvariantCulture);27 stringBuilder.Append (value.ToCultureInvariantString ()); 28 28 } 29 29 … … 86 86 } else { 87 87 double number; 88 if (! double.TryParse(sbNum.ToString (), out number)) {88 if (!Utils.TryParseDouble(sbNum.ToString (), out number)) { 89 89 throw new MalformedJSONException ("Mantissa is not a valid decimal (\"" + sbNum.ToString () + "\")"); 90 90 } -
binary-improvements/7dtd-server-fixes/src/JSON/JSONObject.cs
r187 r309 32 32 } 33 33 34 public override string ToString (bool prettyPrint = false, int currentLevel = 0)34 public override void ToString (StringBuilder stringBuilder, bool prettyPrint = false, int currentLevel = 0) 35 35 { 36 StringBuilder sb = new StringBuilder("{");36 stringBuilder.Append ("{"); 37 37 if (prettyPrint) 38 s b.Append ('\n');38 stringBuilder.Append ('\n'); 39 39 foreach (KeyValuePair<string, JSONNode> kvp in nodes) { 40 40 if (prettyPrint) 41 s b.Append (new String ('\t', currentLevel + 1));42 s b.Append (String.Format ("\"{0}\":", kvp.Key));41 stringBuilder.Append (new String ('\t', currentLevel + 1)); 42 stringBuilder.Append (String.Format ("\"{0}\":", kvp.Key)); 43 43 if (prettyPrint) 44 s b.Append (" ");45 sb.Append (kvp.Value.ToString (prettyPrint, currentLevel + 1));46 s b.Append (",");44 stringBuilder.Append (" "); 45 kvp.Value.ToString (stringBuilder, prettyPrint, currentLevel + 1); 46 stringBuilder.Append (","); 47 47 if (prettyPrint) 48 s b.Append ('\n');48 stringBuilder.Append ('\n'); 49 49 } 50 if (s b.Length > 1)51 s b.Remove (sb.Length - (prettyPrint ? 2 : 1), 1);50 if (stringBuilder.Length > 1) 51 stringBuilder.Remove (stringBuilder.Length - (prettyPrint ? 2 : 1), 1); 52 52 if (prettyPrint) 53 sb.Append (new String ('\t', currentLevel)); 54 sb.Append ("}"); 55 return sb.ToString (); 53 stringBuilder.Append (new String ('\t', currentLevel)); 54 stringBuilder.Append ("}"); 56 55 } 57 56 -
binary-improvements/7dtd-server-fixes/src/JSON/JSONString.cs
r306 r309 18 18 } 19 19 20 public override string ToString (bool prettyPrint = false, int currentLevel = 0)20 public override void ToString (StringBuilder stringBuilder, bool prettyPrint = false, int currentLevel = 0) 21 21 { 22 22 if (value == null || value.Length == 0) { 23 return "\"\""; 23 stringBuilder.Append ("\"\""); 24 return; 24 25 } 25 26 26 27 int len = value.Length; 27 28 28 StringBuilder sb = new StringBuilder (len + 4);29 stringBuilder.EnsureCapacity (stringBuilder.Length + 2*len); 29 30 String t; 31 32 stringBuilder.Append ('"'); 30 33 31 34 foreach (char c in value) { … … 34 37 case '"': 35 38 // case '/': 36 s b.Append ('\\');37 s b.Append (c);39 stringBuilder.Append ('\\'); 40 stringBuilder.Append (c); 38 41 break; 39 42 case '\b': 40 s b.Append ("\\b");43 stringBuilder.Append ("\\b"); 41 44 break; 42 45 case '\t': 43 s b.Append ("\\t");46 stringBuilder.Append ("\\t"); 44 47 break; 45 48 case '\n': 46 s b.Append ("\\n");49 stringBuilder.Append ("\\n"); 47 50 break; 48 51 case '\f': 49 s b.Append ("\\f");52 stringBuilder.Append ("\\f"); 50 53 break; 51 54 case '\r': 52 s b.Append ("\\r");55 stringBuilder.Append ("\\r"); 53 56 break; 54 57 default: 55 58 if (c < ' ') { 56 t = "000" + String.Format ("X", c);57 s b.Append ("\\u" + t.Substring (t.Length - 4));59 stringBuilder.Append ("\\u"); 60 stringBuilder.Append (((int)c).ToString ("X4")); 58 61 } else { 59 s b.Append (c);62 stringBuilder.Append (c); 60 63 } 61 64 break; … … 63 66 } 64 67 65 return string.Format ("\"{0}\"", sb.ToString ());68 stringBuilder.Append ('"'); 66 69 } 67 70 -
binary-improvements/AllocsCommands/AllocsCommands.csproj
r290 r309 39 39 <Private>False</Private> 40 40 </Reference> 41 <Reference Include="Assembly-CSharp-firstpass"> 42 <HintPath>..\..\..\RPGMod\7dtd-binaries\Assembly-CSharp-firstpass.dll</HintPath> 43 <Private>False</Private> 44 </Reference> 41 45 </ItemGroup> 42 46 <ItemGroup> -
binary-improvements/AllocsCommands/Commands/Reply.cs
r251 r309 35 35 Chat.SendMessage (receiver, _sender, message); 36 36 } else { 37 if (receiver != null) { 38 SdtdConsole.Instance.Output ("The sender of the PM you last received is currently not online."); 39 } else { 40 SdtdConsole.Instance.Output ("You have not received a PM so far."); 41 } 37 SdtdConsole.Instance.Output ("You have not received a PM so far or sender of last received PM is no longer online."); 42 38 } 43 39 } -
binary-improvements/AllocsCommands/ModInfo.xml
r306 r309 5 5 <Description value="Additional commands for server operation" /> 6 6 <Author value="Christian 'Alloc' Illy" /> 7 <Version value="1 3" />7 <Version value="14" /> 8 8 <Website value="http://7dtd.illy.bz" /> 9 9 </ModInfo> -
binary-improvements/AllocsCommands/PrivateMessageConnections.cs
r251 r309 1 1 using System; 2 2 using System.Collections.Generic; 3 using Steamworks; 3 4 4 5 namespace AllocsFixes.CustomCommands … … 6 7 public class PrivateMessageConnections 7 8 { 8 private static Dictionary<C lientInfo, ClientInfo> senderOfLastPM = new Dictionary<ClientInfo, ClientInfo> ();9 private static Dictionary<CSteamID, CSteamID> senderOfLastPM = new Dictionary<CSteamID, CSteamID> (); 9 10 10 11 public static void SetLastPMSender (ClientInfo _sender, ClientInfo _receiver) 11 12 { 12 if (senderOfLastPM.ContainsKey (_receiver)) 13 senderOfLastPM [_receiver] = _sender; 14 else 15 senderOfLastPM.Add (_receiver, _sender); 13 senderOfLastPM [_receiver.steamId] = _sender.steamId; 16 14 } 17 15 18 16 public static ClientInfo GetLastPMSenderForPlayer (ClientInfo _player) 19 17 { 20 if (senderOfLastPM.ContainsKey (_player)) 21 return senderOfLastPM [_player]; 18 if (senderOfLastPM.ContainsKey (_player.steamId)) { 19 CSteamID recSteamId = senderOfLastPM [_player.steamId]; 20 ClientInfo recInfo = ConnectionManager.Instance.GetClientInfoForSteamId (recSteamId); 21 return recInfo; 22 } 22 23 return null; 23 24 } -
binary-improvements/MapRendering/ModInfo.xml
r306 r309 5 5 <Description value="Render the game map to image map tiles as it is uncovered" /> 6 6 <Author value="Christian 'Alloc' Illy" /> 7 <Version value="2 0" />7 <Version value="21" /> 8 8 <Website value="http://7dtd.illy.bz" /> 9 9 </ModInfo> -
binary-improvements/MapRendering/Web/API/GetPlayerList.cs
r279 r309 67 67 68 68 pJson.Add ("totalplaytime", new JSONNumber (p.TotalPlayTime)); 69 pJson.Add ("lastonline", new JSONString (p.LastOnline.ToUniversalTime ().ToString (" s")));69 pJson.Add ("lastonline", new JSONString (p.LastOnline.ToUniversalTime ().ToString ("yyyy-MM-ddTHH:mm:ssZ"))); 70 70 pJson.Add ("ping", new JSONNumber (p.IsOnline ? p.ClientInfo.ping : -1)); 71 71 -
binary-improvements/MapRendering/Web/API/GetPlayersOnline.cs
r277 r309 26 26 p.Add ("steamid", new JSONString (ci.playerId)); 27 27 p.Add ("entityid", new JSONNumber (ci.entityId)); 28 p.Add ("ip", new JSONString (ci != null ? ci.ip : string.Empty));28 p.Add ("ip", new JSONString (ci.ip)); 29 29 p.Add ("name", new JSONString (current.Value.EntityName)); 30 30 p.Add ("online", new JSONBoolean (true)); -
binary-improvements/MapRendering/Web/API/WebAPI.cs
r306 r309 9 9 public static void WriteJSON (HttpListenerResponse resp, JSON.JSONNode root) 10 10 { 11 byte[] buf = Encoding.UTF8.GetBytes (root.ToString()); 11 StringBuilder sb = new StringBuilder (); 12 root.ToString (sb); 13 byte[] buf = Encoding.UTF8.GetBytes (sb.ToString ()); 12 14 resp.ContentLength64 = buf.Length; 13 15 resp.ContentType = "application/json"; -
binary-improvements/MapRendering/Web/Handlers/UserStatusHandler.cs
r244 r309 28 28 result.Add ("permissions", perms); 29 29 30 WriteJSON (resp, result); 31 } 32 33 public void WriteJSON (HttpListenerResponse resp, JSONNode root) { 34 byte[] buf = Encoding.UTF8.GetBytes (root.ToString ()); 35 resp.ContentLength64 = buf.Length; 36 resp.ContentType = "application/json"; 37 resp.ContentEncoding = Encoding.UTF8; 38 resp.OutputStream.Write (buf, 0, buf.Length); 30 AllocsFixes.NetConnections.Servers.Web.API.WebAPI.WriteJSON (resp, result); 39 31 } 40 32 -
binary-improvements/MapRendering/Web/Web.cs
r286 r309 78 78 dataFolder, 79 79 new AllocsFixes.FileCache.SimpleCache (), 80 true)80 false) 81 81 ); 82 82 } else { … … 87 87 dataFolder, 88 88 new AllocsFixes.FileCache.DirectAccess (), 89 true)89 false) 90 90 ); 91 91 } … … 185 185 } 186 186 187 Log.Out ("Error in Web.HandleRequest(): No handler found for path \"" + request.Url.AbsolutePath + "\""); 187 // Not really relevant for non-debugging purposes: 188 //Log.Out ("Error in Web.HandleRequest(): No handler found for path \"" + request.Url.AbsolutePath + "\""); 188 189 response.StatusCode = (int)HttpStatusCode.NotFound; 189 190 } catch (IOException e) { -
binary-improvements/MapRendering/Web/WebCommandResult.cs
r306 r309 47 47 } 48 48 49 response.SendChunked = false; 49 try { 50 response.SendChunked = false; 50 51 51 try {52 52 if (responseType == ResultType.Raw) { 53 53 WebAPI.WriteText (response, sb.ToString ()); -
binary-improvements/bundle_creation/makefile
r246 r309 1 HOST=1 78.63.97.2031 HOST=136.243.11.25 2 2 PORT=51010 3 3 SERVERPATH=/srv/www/illy.bz/http/fi/7dtd/
Note:
See TracChangeset
for help on using the changeset viewer.