This repository has been archived by the owner on Feb 12, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
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
12 changed files
with
3,150 additions
and
20 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,226 @@ | ||
// <auto-generated /> | ||
// | ||
// To parse this JSON data, add NuGet 'Newtonsoft.Json' then do: | ||
// | ||
// using BTDToolbox.Classes; | ||
// | ||
// var card = Card.FromJson(jsonString); | ||
|
||
namespace BTDToolbox.Classes | ||
{ | ||
using System; | ||
using System.Collections.Generic; | ||
|
||
using System.Globalization; | ||
using Newtonsoft.Json; | ||
using Newtonsoft.Json.Converters; | ||
|
||
public partial class Card | ||
{ | ||
[JsonProperty("Bloon")] | ||
public Card_Bloon Bloon { get; set; } | ||
|
||
[JsonProperty("CardSet")] | ||
public string CardSet { get; set; } | ||
|
||
[JsonProperty("CardSprite")] | ||
public string CardSprite { get; set; } | ||
|
||
[JsonProperty("DiscardCost")] | ||
public long DiscardCost { get; set; } | ||
|
||
[JsonProperty("Name")] | ||
public string Name { get; set; } | ||
|
||
[JsonProperty("NameOld")] | ||
public string NameOld { get; set; } | ||
|
||
[JsonProperty("StartingCard")] | ||
public bool StartingCard { get; set; } | ||
|
||
[JsonProperty("Tower")] | ||
public Tower Tower { get; set; } | ||
|
||
[JsonProperty("UnlockMethod")] | ||
public string UnlockMethod { get; set; } | ||
[JsonProperty("UnlockWin")] | ||
public UnlockWin UnlockWin { get; set; } | ||
|
||
[JsonProperty("Visible")] | ||
public bool Visible { get; set; } | ||
|
||
[JsonProperty("Description")] | ||
public string Description { get; set; } | ||
|
||
[JsonProperty("PlatformProductID")] | ||
public string PlatformProductId { get; set; } | ||
|
||
[JsonProperty("Power")] | ||
public Power Power { get; set; } | ||
|
||
[JsonProperty("ProductID")] | ||
public string ProductId { get; set; } | ||
} | ||
|
||
public partial class Card_Bloon | ||
{ | ||
[JsonProperty("BackgroundSprite")] | ||
public string BackgroundSprite { get; set; } | ||
|
||
[JsonProperty("Cost")] | ||
public long Cost { get; set; } | ||
|
||
[JsonProperty("Features")] | ||
public string[] Features { get; set; } | ||
|
||
[JsonProperty("IncomeChange")] | ||
public long IncomeChange { get; set; } | ||
|
||
[JsonProperty("Interval")] | ||
public double Interval { get; set; } | ||
|
||
[JsonProperty("NumBloons")] | ||
public long NumBloons { get; set; } | ||
|
||
[JsonProperty("Type")] | ||
public string BloonType { get; set; } | ||
|
||
[JsonProperty("UnlockRound")] | ||
public long UnlockRound { get; set; } | ||
} | ||
|
||
public partial class Tower | ||
{ | ||
[JsonProperty("BackgroundSprite")] | ||
public string BackgroundSprite { get; set; } | ||
|
||
[JsonProperty("Cost")] | ||
public long Cost { get; set; } | ||
|
||
[JsonProperty("Features")] | ||
public string[] Features { get; set; } | ||
|
||
[JsonProperty("Type")] | ||
public string TowerType { get; set; } | ||
|
||
[JsonProperty("Upgrades")] | ||
public long[] Upgrades { get; set; } | ||
} | ||
|
||
public partial class Card | ||
{ | ||
public static Card FromJson(string json) => JsonConvert.DeserializeObject<Card>(json, BTDToolbox.Classes.Converter.Settings); | ||
} | ||
|
||
public static class SerializeCard | ||
{ | ||
public static string ToJson(this Card self) => JsonConvert.SerializeObject(self, BTDToolbox.Classes.Converter.Settings); | ||
} | ||
public partial class PowerCard | ||
{ | ||
[JsonProperty("CardSet")] | ||
public string CardSet { get; set; } | ||
|
||
[JsonProperty("CardSprite")] | ||
public string CardSprite { get; set; } | ||
|
||
[JsonProperty("Description")] | ||
public string Description { get; set; } | ||
|
||
[JsonProperty("DiscardCost")] | ||
public long DiscardCost { get; set; } | ||
|
||
[JsonProperty("Name")] | ||
public string Name { get; set; } | ||
|
||
[JsonProperty("NameOld")] | ||
public string NameOld { get; set; } | ||
|
||
[JsonProperty("PlatformProductID")] | ||
public string PlatformProductId { get; set; } | ||
|
||
[JsonProperty("Power")] | ||
public Power Power { get; set; } | ||
|
||
[JsonProperty("ProductID")] | ||
public string ProductId { get; set; } | ||
|
||
[JsonProperty("StartingCard")] | ||
public bool StartingCard { get; set; } | ||
|
||
[JsonProperty("UnlockMethod")] | ||
public string UnlockMethod { get; set; } | ||
|
||
[JsonProperty("UnlockWin")] | ||
public UnlockWin UnlockWin { get; set; } | ||
|
||
[JsonProperty("Visible")] | ||
public bool Visible { get; set; } | ||
} | ||
|
||
public partial class Power | ||
{ | ||
[JsonProperty("BackgroundSprite")] | ||
public string BackgroundSprite { get; set; } | ||
|
||
[JsonProperty("Cost")] | ||
public long Cost { get; set; } | ||
|
||
[JsonProperty("Features")] | ||
public string[] Features { get; set; } | ||
|
||
[JsonProperty("Type")] | ||
public string Type { get; set; } | ||
} | ||
|
||
public partial class UnlockWin | ||
{ | ||
[JsonProperty("Count")] | ||
public long Count { get; set; } | ||
|
||
[JsonProperty("SpotlightCount")] | ||
public long SpotlightCount { get; set; } | ||
|
||
[JsonProperty("Type")] | ||
public string Type { get; set; } | ||
} | ||
|
||
public partial class PowerCard | ||
{ | ||
public static PowerCard FromJson(string json) => JsonConvert.DeserializeObject<PowerCard>(json, BTDToolbox.Classes.Converter.Settings); | ||
} | ||
public static class SerializePower | ||
{ | ||
public static string ToJson(this PowerCard self) => JsonConvert.SerializeObject(self, BTDToolbox.Classes.Converter.Settings); | ||
} | ||
internal class ParseStringConverter : JsonConverter | ||
{ | ||
public override bool CanConvert(Type t) => t == typeof(long) || t == typeof(long?); | ||
|
||
public override object ReadJson(JsonReader reader, Type t, object existingValue, JsonSerializer serializer) | ||
{ | ||
if (reader.TokenType == JsonToken.Null) return null; | ||
var value = serializer.Deserialize<string>(reader); | ||
long l; | ||
if (Int64.TryParse(value, out l)) | ||
{ | ||
return l; | ||
} | ||
throw new Exception("Cannot unmarshal type long"); | ||
} | ||
|
||
public override void WriteJson(JsonWriter writer, object untypedValue, JsonSerializer serializer) | ||
{ | ||
if (untypedValue == null) | ||
{ | ||
serializer.Serialize(writer, null); | ||
return; | ||
} | ||
var value = (long)untypedValue; | ||
serializer.Serialize(writer, value.ToString()); | ||
return; | ||
} | ||
|
||
public static readonly ParseStringConverter Singleton = new ParseStringConverter(); | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.