-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
230 additions
and
229 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
namespace CS2Interface { | ||
public abstract class GameObject { | ||
protected static bool ShouldSerializeAdditionalProperties { get; private set; } = true; | ||
protected static bool ShouldSerializeDefs { get; private set; } = true ; | ||
|
||
internal static void SetSerializationProperties(bool should_serialize_additional_properties, bool should_serialize_defs) { | ||
ShouldSerializeAdditionalProperties = should_serialize_additional_properties; | ||
ShouldSerializeDefs = should_serialize_defs; | ||
} | ||
|
||
protected abstract bool SetDefs(); | ||
protected abstract bool SetAdditionalProperties(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
using System.Linq; | ||
using SteamKit2; | ||
|
||
namespace CS2Interface { | ||
public static class KeyValueExtensions { | ||
public static void Merge(this KeyValue into, KeyValue from) { | ||
foreach (KeyValue child in from.Children) { | ||
if (child.Name == null) { | ||
continue; | ||
} | ||
|
||
KeyValue? matchingChild = into.Children.FirstOrDefault(c => c.Name == child.Name); | ||
if (matchingChild == null) { | ||
into[child.Name] = child.Clone(); | ||
} else { | ||
matchingChild.Merge(child); | ||
} | ||
} | ||
} | ||
|
||
public static KeyValue Clone(this KeyValue original) { | ||
KeyValue copy = new KeyValue(original.Name, original.Value); | ||
copy.Merge(original); | ||
|
||
return copy; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.