Changeset 391 for binary-improvements2/7dtd-server-fixes/src/PersistentData
- Timestamp:
- Aug 7, 2022, 3:02:24 PM (2 years ago)
- Location:
- binary-improvements2/7dtd-server-fixes/src/PersistentData
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
binary-improvements2/7dtd-server-fixes/src/PersistentData/Attributes.cs
r326 r391 8 8 9 9 public bool HideChatCommands { 10 get { return hideChatCommands; }11 set { hideChatCommands = value; }10 get => hideChatCommands; 11 set => hideChatCommands = value; 12 12 } 13 13 14 14 public string HideChatCommandPrefix { 15 get { 16 if (hideChatCommandPrefix == null) { 17 hideChatCommandPrefix = ""; 18 } 19 20 return hideChatCommandPrefix; 21 } 22 set { hideChatCommandPrefix = value; } 15 get => hideChatCommandPrefix ?? (hideChatCommandPrefix = ""); 16 set => hideChatCommandPrefix = value; 23 17 } 24 18 } -
binary-improvements2/7dtd-server-fixes/src/PersistentData/PersistentContainer.cs
r369 r391 10 10 [OptionalField] private Attributes attributes; 11 11 12 public Players Players { 13 get { 14 if (players == null) { 15 players = new Players (); 16 } 12 public Players Players => players ?? (players = new Players ()); 17 13 18 return players; 19 } 20 } 21 22 public Attributes Attributes { 23 get { 24 if (attributes == null) { 25 attributes = new Attributes (); 26 } 27 28 return attributes; 29 } 30 } 14 public Attributes Attributes => attributes ?? (attributes = new Attributes ()); 31 15 32 16 private static PersistentContainer instance; 33 17 34 public static PersistentContainer Instance { 35 get { 36 if (instance == null) { 37 instance = new PersistentContainer (); 38 } 39 40 return instance; 41 } 42 } 18 public static PersistentContainer Instance => instance ?? (instance = new PersistentContainer ()); 43 19 44 20 private PersistentContainer () { … … 58 34 59 35 try { 60 PersistentContainer obj;61 36 Stream stream = File.Open (GameIO.GetSaveGameDir () + "/AllocsPeristentData.bin", FileMode.Open); 62 37 BinaryFormatter bFormatter = new BinaryFormatter (); 63 obj = (PersistentContainer) bFormatter.Deserialize (stream);38 PersistentContainer obj = (PersistentContainer) bFormatter.Deserialize (stream); 64 39 stream.Close (); 65 40 instance = obj; -
binary-improvements2/7dtd-server-fixes/src/PersistentData/Players.cs
r383 r391 41 41 42 42 if (int.TryParse (_nameOrId, out int entityId)) { 43 foreach ( KeyValuePair<PlatformUserIdentifierAbs, Player> kvpin Dict) {44 if ( kvp.Value.IsOnline && kvp.Value.EntityID == entityId) {45 return kvp.Key;43 foreach ((PlatformUserIdentifierAbs iUserId, Player player) in Dict) { 44 if (player.IsOnline && player.EntityID == entityId) { 45 return iUserId; 46 46 } 47 47 } 48 48 } 49 49 50 foreach ( KeyValuePair<PlatformUserIdentifierAbs, Player> kvpin Dict) {51 string name = kvp.Value.Name;50 foreach ((PlatformUserIdentifierAbs iUserId, Player player) in Dict) { 51 string name = player.Name; 52 52 if (_ignoreColorCodes) { 53 53 name = Regex.Replace (name, "\\[[0-9a-fA-F]{6}\\]", ""); 54 54 } 55 55 56 if ( kvp.Value.IsOnline && name.EqualsCaseInsensitive (_nameOrId)) {57 return kvp.Key;56 if (player.IsOnline && name.EqualsCaseInsensitive (_nameOrId)) { 57 return iUserId; 58 58 } 59 59 }
Note:
See TracChangeset
for help on using the changeset viewer.