forked from bover87/HMB-FFRK-JP-LabMem
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Soulbreak Parser and Soulbreak Tracker API Link
Added extra handler to proxy when accessing party screen to retrieve list of Soulbreaks and upload them to https://ffrk.gigaforge.com Soulbreak Tracker if the user has entered an API key.
- Loading branch information
Showing
10 changed files
with
157 additions
and
37 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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
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
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,71 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Net; | ||
using System.Net.Http; | ||
using System.Net.Http.Headers; | ||
using System.Reflection; | ||
using System.Runtime.CompilerServices; | ||
using System.Text.RegularExpressions; | ||
using System.Threading.Tasks; | ||
using FFRK_Machines; | ||
using FFRK_Machines.Services.Adb; | ||
using Newtonsoft.Json.Linq; | ||
using Semver; | ||
using Syroot.Windows.IO; | ||
|
||
namespace FFRK_LabMem.Services | ||
{ | ||
class SoulbreakSync | ||
{ | ||
|
||
private String Endpoint { get; set; } | ||
private Boolean IncludePreRelease { get; set; } | ||
private HttpClient httpClient; | ||
private const String WEB_URL = "https://ffrk.gigaforge.com/ffrk_sync.php"; | ||
public static string APIKEY = ""; | ||
private const string GITHUB_USER = "gigaforge"; | ||
private const string GITHUB_REPO = "FFRK-LabMem-SBTracker"; | ||
|
||
public SoulbreakSync() | ||
{ | ||
|
||
this.Endpoint = WEB_URL; | ||
ServicePointManager.SecurityProtocol |= SecurityProtocolType.Tls12; | ||
httpClient = new HttpClient(); | ||
httpClient.DefaultRequestHeaders.Add("User-Agent", String.Format("{0} {1}", GetName(), GetVersionCode(""))); | ||
} | ||
|
||
public static String GetVersionCode(String preRelease = "jp") | ||
{ | ||
var version = Assembly.GetExecutingAssembly().GetName().Version; | ||
var suffix = (String.IsNullOrEmpty(preRelease)) ? "" : "-" + preRelease; | ||
return string.Format("v{0}.{1}.{2}{3}", version.Major, version.Minor, version.Build, suffix); | ||
} | ||
|
||
public static String GetName() | ||
{ | ||
return Assembly.GetExecutingAssembly().GetName().Name; | ||
} | ||
|
||
public static async Task<bool> Sync(string soulbreaks) | ||
{ | ||
if (APIKEY.Length > 1) | ||
{ | ||
ColorConsole.WriteLine(ConsoleColor.DarkYellow, "Sending Soulbreaks to http://ffrk.gigaforge.com/ tracker (may appear multiple times)..."); | ||
var checker = new SoulbreakSync(); | ||
var values = new Dictionary<string, string> | ||
{ | ||
{ "sb_list", soulbreaks }, | ||
{ "api_key", APIKEY } | ||
}; | ||
var content = new FormUrlEncodedContent(values); | ||
var response = await checker.httpClient.PostAsync(WEB_URL, content); | ||
} | ||
|
||
return true; | ||
} | ||
|
||
|
||
} | ||
} |
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