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
37 changed files
with
4,381 additions
and
502 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,57 @@ | ||
// <auto-generated /> | ||
// | ||
// To parse this JSON data, add NuGet 'Newtonsoft.Json' then do: | ||
// | ||
// using BTDToolbox.Classes; | ||
// | ||
// var battlesPassClass = BattlesPassClass.FromJson(jsonString); | ||
|
||
namespace BTDToolbox.Classes | ||
{ | ||
using System; | ||
using System.Collections.Generic; | ||
|
||
using System.Globalization; | ||
using Newtonsoft.Json; | ||
using Newtonsoft.Json.Converters; | ||
|
||
public partial class BattlesPassClass | ||
{ | ||
[JsonProperty("Versions")] | ||
public VersionElement[] Versions { get; set; } | ||
} | ||
|
||
public partial class VersionElement | ||
{ | ||
[JsonProperty("Version")] | ||
public VersionVersion Version { get; set; } | ||
} | ||
|
||
public partial class VersionVersion | ||
{ | ||
[JsonProperty("version number")] | ||
public string VersionNumber { get; set; } | ||
|
||
[JsonProperty("Windows")] | ||
public string Windows { get; set; } | ||
|
||
[JsonProperty("Mac")] | ||
public string Mac { get; set; } | ||
|
||
[JsonProperty("Android")] | ||
public string Android { get; set; } | ||
|
||
[JsonProperty("IOS")] | ||
public string Ios { get; set; } | ||
} | ||
|
||
public partial class BattlesPassClass | ||
{ | ||
public static BattlesPassClass FromJson(string json) => JsonConvert.DeserializeObject<BattlesPassClass>(json, BTDToolbox.Classes.Converter.Settings); | ||
} | ||
|
||
public static class Serialize | ||
{ | ||
public static string ToJson(this BattlesPassClass self) => JsonConvert.SerializeObject(self, BTDToolbox.Classes.Converter.Settings); | ||
} | ||
} |
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,91 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.IO; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading; | ||
using System.Threading.Tasks; | ||
using System.Windows.Forms; | ||
|
||
namespace BTDToolbox.Classes | ||
{ | ||
class JsonEditorHandler | ||
{ | ||
public static New_JsonEditor jeditor; | ||
|
||
public static void ValidateEditor() | ||
{ | ||
if (jeditor == null) | ||
{ | ||
jeditor = new New_JsonEditor(); | ||
jeditor.tabPages = new List<TabPage>(); | ||
jeditor.tabFilePaths = new List<string>(); | ||
jeditor.userControls = new List<JsonEditor_Instance>(); | ||
jeditor.Show(); | ||
} | ||
else if (jeditor.Visible == false) | ||
{ | ||
jeditor.Show(); | ||
} | ||
} | ||
public static void OpenFile(string path) | ||
{ | ||
if (Serializer.Deserialize_Config().useExternalEditor == false) | ||
{ | ||
ValidateEditor(); | ||
if(jeditor.tabFilePaths.Contains(path)) | ||
{ | ||
jeditor.tabControl1.SelectedIndex = jeditor.tabFilePaths.IndexOf(path); | ||
} | ||
else | ||
{ | ||
jeditor.NewTab(path); | ||
} | ||
} | ||
} | ||
public static void OpenOriginalFile(string path) | ||
{ | ||
string[] split = path.Split('\\'); | ||
string filename = split[split.Length - 1]; | ||
string backupProj = ""; | ||
if (!path.Contains("\\Backups\\" + Main.gameName + "_BackupProject\\")) | ||
backupProj = Environment.CurrentDirectory + "\\Backups\\" + Main.gameName + "_BackupProject\\" + path.Replace(Environment.CurrentDirectory, "").Replace(Serializer.Deserialize_Config().LastProject + "\\", ""); | ||
else | ||
{ | ||
backupProj = path; | ||
if(jeditor.tabControl1.SelectedTab.Text == filename + New_JsonEditor.readOnlyName) | ||
ConsoleHandler.appendNotice("You are already looking at the original " + filename.Replace(New_JsonEditor.readOnlyName, "")); | ||
} | ||
|
||
if (File.Exists(backupProj)) | ||
OpenFile(backupProj); | ||
else | ||
ConsoleHandler.appendLog_CanRepeat("Could not find file in backup project... Unable to view original file"); | ||
} | ||
public static void CloseFile(string path) | ||
{ | ||
jeditor.CloseTab(path); | ||
} | ||
public static bool AreJsonErrors() | ||
{ | ||
if(jeditor != null) | ||
{ | ||
int i = 0; | ||
bool isError = false; | ||
foreach (var u in jeditor.userControls) | ||
{ | ||
if (u.jsonError) | ||
{ | ||
isError = true; | ||
jeditor.tabControl1.SelectedIndex = i; | ||
break; | ||
} | ||
i++; | ||
} | ||
if (isError) | ||
return true; | ||
} | ||
return false; | ||
} | ||
} | ||
} |
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.