mirror of
https://github.com/4sval/FModel.git
synced 2026-03-22 01:34:37 -05:00
No more epic auth just in case...
This commit is contained in:
parent
2cf5358c91
commit
214824031e
|
|
@ -124,12 +124,6 @@
|
|||
<setting name="createIconForSTWCardPacks" serializeAs="String">
|
||||
<value>True</value>
|
||||
</setting>
|
||||
<setting name="eEmail" serializeAs="String">
|
||||
<value />
|
||||
</setting>
|
||||
<setting name="ePassword" serializeAs="String">
|
||||
<value />
|
||||
</setting>
|
||||
<setting name="IconLanguage" serializeAs="String">
|
||||
<value>English</value>
|
||||
</setting>
|
||||
|
|
@ -151,12 +145,6 @@
|
|||
<setting name="UMCTGalleries" serializeAs="String">
|
||||
<value>False</value>
|
||||
</setting>
|
||||
<setting name="ExchangeToken" serializeAs="String">
|
||||
<value />
|
||||
</setting>
|
||||
<setting name="TokenExpiration" serializeAs="String">
|
||||
<value>0</value>
|
||||
</setting>
|
||||
<setting name="tConsKey" serializeAs="String">
|
||||
<value />
|
||||
</setting>
|
||||
|
|
|
|||
|
|
@ -144,9 +144,6 @@
|
|||
<Compile Include="Methods\AESManager\DynamicKeysManager.cs" />
|
||||
<Compile Include="Methods\DynamicKeys\AddToUI.cs" />
|
||||
<Compile Include="Methods\DynamicKeys\Keychain.cs" />
|
||||
<Compile Include="Methods\DynamicKeys\Parser\AccessCodeParser.cs" />
|
||||
<Compile Include="Methods\DynamicKeys\Parser\AESKeyParser.cs" />
|
||||
<Compile Include="Methods\DynamicKeys\Parser\TokenParser.cs" />
|
||||
<Compile Include="Methods\ChallengeGenerator\BundleDesign.cs" />
|
||||
<Compile Include="Methods\ChallengeGenerator\BundleInfos.cs" />
|
||||
<Compile Include="Methods\ChallengeGenerator\DrawingRewards.cs" />
|
||||
|
|
|
|||
104
FModel/Forms/Settings.Designer.cs
generated
104
FModel/Forms/Settings.Designer.cs
generated
|
|
@ -56,13 +56,6 @@ namespace FModel.Forms
|
|||
this.label5 = new System.Windows.Forms.Label();
|
||||
this.textBox3 = new System.Windows.Forms.TextBox();
|
||||
this.label4 = new System.Windows.Forms.Label();
|
||||
this.groupBox5 = new System.Windows.Forms.GroupBox();
|
||||
this.checkBox1 = new System.Windows.Forms.CheckBox();
|
||||
this.label7 = new System.Windows.Forms.Label();
|
||||
this.textBox5 = new System.Windows.Forms.TextBox();
|
||||
this.label6 = new System.Windows.Forms.Label();
|
||||
this.textBox4 = new System.Windows.Forms.TextBox();
|
||||
this.label2 = new System.Windows.Forms.Label();
|
||||
this.groupBox6 = new System.Windows.Forms.GroupBox();
|
||||
this.checkBox2 = new System.Windows.Forms.CheckBox();
|
||||
this.textBox6 = new System.Windows.Forms.TextBox();
|
||||
|
|
@ -75,7 +68,6 @@ namespace FModel.Forms
|
|||
((System.ComponentModel.ISupportInitialize)(this.wPictureBox)).BeginInit();
|
||||
this.groupBox1.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.imgsPerRow)).BeginInit();
|
||||
this.groupBox5.SuspendLayout();
|
||||
this.groupBox6.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
|
|
@ -148,9 +140,9 @@ namespace FModel.Forms
|
|||
//
|
||||
// OKButton
|
||||
//
|
||||
this.OKButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.OKButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.OKButton.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.OKButton.Location = new System.Drawing.Point(475, 532);
|
||||
this.OKButton.Location = new System.Drawing.Point(475, 434);
|
||||
this.OKButton.Name = "OKButton";
|
||||
this.OKButton.Size = new System.Drawing.Size(97, 21);
|
||||
this.OKButton.TabIndex = 15;
|
||||
|
|
@ -172,7 +164,7 @@ namespace FModel.Forms
|
|||
this.groupBox4.Controls.Add(this.label8);
|
||||
this.groupBox4.Controls.Add(this.button1);
|
||||
this.groupBox4.Controls.Add(this.wPictureBox);
|
||||
this.groupBox4.Location = new System.Drawing.Point(12, 220);
|
||||
this.groupBox4.Location = new System.Drawing.Point(12, 122);
|
||||
this.groupBox4.Name = "groupBox4";
|
||||
this.groupBox4.Size = new System.Drawing.Size(560, 195);
|
||||
this.groupBox4.TabIndex = 16;
|
||||
|
|
@ -323,12 +315,13 @@ namespace FModel.Forms
|
|||
this.groupBox1.Controls.Add(this.label5);
|
||||
this.groupBox1.Controls.Add(this.textBox3);
|
||||
this.groupBox1.Controls.Add(this.label4);
|
||||
this.groupBox1.Location = new System.Drawing.Point(12, 473);
|
||||
this.groupBox1.Location = new System.Drawing.Point(12, 375);
|
||||
this.groupBox1.Name = "groupBox1";
|
||||
this.groupBox1.Size = new System.Drawing.Size(560, 49);
|
||||
this.groupBox1.TabIndex = 17;
|
||||
this.groupBox1.TabStop = false;
|
||||
this.groupBox1.Text = "Merger";
|
||||
this.groupBox1.Enter += new System.EventHandler(this.GroupBox1_Enter);
|
||||
//
|
||||
// checkBoxSaveAsMergeImages
|
||||
//
|
||||
|
|
@ -382,89 +375,18 @@ namespace FModel.Forms
|
|||
this.label4.TabIndex = 9;
|
||||
this.label4.Text = "File Name:";
|
||||
//
|
||||
// groupBox5
|
||||
//
|
||||
this.groupBox5.Anchor = System.Windows.Forms.AnchorStyles.Top;
|
||||
this.groupBox5.Controls.Add(this.checkBox1);
|
||||
this.groupBox5.Controls.Add(this.label7);
|
||||
this.groupBox5.Controls.Add(this.textBox5);
|
||||
this.groupBox5.Controls.Add(this.label6);
|
||||
this.groupBox5.Controls.Add(this.textBox4);
|
||||
this.groupBox5.Controls.Add(this.label2);
|
||||
this.groupBox5.Location = new System.Drawing.Point(12, 122);
|
||||
this.groupBox5.Name = "groupBox5";
|
||||
this.groupBox5.Size = new System.Drawing.Size(560, 92);
|
||||
this.groupBox5.TabIndex = 18;
|
||||
this.groupBox5.TabStop = false;
|
||||
this.groupBox5.Text = "Optional - Automatic Key Detection for Dynamic PAKs";
|
||||
//
|
||||
// checkBox1
|
||||
//
|
||||
this.checkBox1.AutoSize = true;
|
||||
this.checkBox1.Location = new System.Drawing.Point(499, 71);
|
||||
this.checkBox1.Name = "checkBox1";
|
||||
this.checkBox1.Size = new System.Drawing.Size(60, 17);
|
||||
this.checkBox1.TabIndex = 7;
|
||||
this.checkBox1.Text = "Reveal";
|
||||
this.checkBox1.UseVisualStyleBackColor = true;
|
||||
this.checkBox1.CheckedChanged += new System.EventHandler(this.CheckBox1_CheckedChanged);
|
||||
//
|
||||
// label7
|
||||
//
|
||||
this.label7.AutoSize = true;
|
||||
this.label7.ForeColor = System.Drawing.Color.Red;
|
||||
this.label7.Location = new System.Drawing.Point(137, 72);
|
||||
this.label7.Name = "label7";
|
||||
this.label7.Size = new System.Drawing.Size(355, 13);
|
||||
this.label7.TabIndex = 6;
|
||||
this.label7.Text = "2FA must be disabled to make it work or use another account without 2FA";
|
||||
this.label7.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
|
||||
//
|
||||
// textBox5
|
||||
//
|
||||
this.textBox5.Location = new System.Drawing.Point(95, 45);
|
||||
this.textBox5.Name = "textBox5";
|
||||
this.textBox5.Size = new System.Drawing.Size(459, 20);
|
||||
this.textBox5.TabIndex = 4;
|
||||
this.textBox5.UseSystemPasswordChar = true;
|
||||
//
|
||||
// label6
|
||||
//
|
||||
this.label6.AutoSize = true;
|
||||
this.label6.Location = new System.Drawing.Point(6, 48);
|
||||
this.label6.Name = "label6";
|
||||
this.label6.Size = new System.Drawing.Size(83, 13);
|
||||
this.label6.TabIndex = 5;
|
||||
this.label6.Text = "EPIC Password:";
|
||||
//
|
||||
// textBox4
|
||||
//
|
||||
this.textBox4.Location = new System.Drawing.Point(74, 19);
|
||||
this.textBox4.Name = "textBox4";
|
||||
this.textBox4.Size = new System.Drawing.Size(480, 20);
|
||||
this.textBox4.TabIndex = 2;
|
||||
this.textBox4.UseSystemPasswordChar = true;
|
||||
//
|
||||
// label2
|
||||
//
|
||||
this.label2.AutoSize = true;
|
||||
this.label2.Location = new System.Drawing.Point(6, 22);
|
||||
this.label2.Name = "label2";
|
||||
this.label2.Size = new System.Drawing.Size(62, 13);
|
||||
this.label2.TabIndex = 3;
|
||||
this.label2.Text = "EPIC Email:";
|
||||
//
|
||||
// groupBox6
|
||||
//
|
||||
this.groupBox6.Controls.Add(this.checkBox2);
|
||||
this.groupBox6.Controls.Add(this.textBox6);
|
||||
this.groupBox6.Controls.Add(this.label12);
|
||||
this.groupBox6.Location = new System.Drawing.Point(12, 421);
|
||||
this.groupBox6.Location = new System.Drawing.Point(12, 323);
|
||||
this.groupBox6.Name = "groupBox6";
|
||||
this.groupBox6.Size = new System.Drawing.Size(560, 46);
|
||||
this.groupBox6.TabIndex = 19;
|
||||
this.groupBox6.TabStop = false;
|
||||
this.groupBox6.Text = "Challenges";
|
||||
this.groupBox6.Enter += new System.EventHandler(this.GroupBox6_Enter);
|
||||
//
|
||||
// checkBox2
|
||||
//
|
||||
|
|
@ -496,9 +418,8 @@ namespace FModel.Forms
|
|||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(584, 565);
|
||||
this.ClientSize = new System.Drawing.Size(584, 467);
|
||||
this.Controls.Add(this.groupBox6);
|
||||
this.Controls.Add(this.groupBox5);
|
||||
this.Controls.Add(this.groupBox1);
|
||||
this.Controls.Add(this.groupBox4);
|
||||
this.Controls.Add(this.OKButton);
|
||||
|
|
@ -523,8 +444,6 @@ namespace FModel.Forms
|
|||
this.groupBox1.ResumeLayout(false);
|
||||
this.groupBox1.PerformLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.imgsPerRow)).EndInit();
|
||||
this.groupBox5.ResumeLayout(false);
|
||||
this.groupBox5.PerformLayout();
|
||||
this.groupBox6.ResumeLayout(false);
|
||||
this.groupBox6.PerformLayout();
|
||||
this.ResumeLayout(false);
|
||||
|
|
@ -556,13 +475,6 @@ namespace FModel.Forms
|
|||
private System.Windows.Forms.TextBox textBox3;
|
||||
private System.Windows.Forms.Label label4;
|
||||
private System.Windows.Forms.Button button2;
|
||||
private System.Windows.Forms.GroupBox groupBox5;
|
||||
private System.Windows.Forms.TextBox textBox5;
|
||||
private System.Windows.Forms.Label label6;
|
||||
private System.Windows.Forms.TextBox textBox4;
|
||||
private System.Windows.Forms.Label label2;
|
||||
private System.Windows.Forms.Label label7;
|
||||
private System.Windows.Forms.CheckBox checkBox1;
|
||||
private System.Windows.Forms.ComboBox comboBox1;
|
||||
private System.Windows.Forms.Label label10;
|
||||
private System.Windows.Forms.GroupBox groupBox6;
|
||||
|
|
|
|||
|
|
@ -19,9 +19,6 @@ namespace FModel.Forms
|
|||
textBox2.Text = Properties.Settings.Default.PAKsPath;
|
||||
textBox1.Text = Properties.Settings.Default.ExtractOutput;
|
||||
|
||||
textBox4.Text = Properties.Settings.Default.eEmail;
|
||||
textBox5.Text = Properties.Settings.Default.ePassword;
|
||||
|
||||
textBox6.Text = Properties.Settings.Default.challengesWatermark;
|
||||
checkBox2.Checked = Properties.Settings.Default.challengesDebug;
|
||||
if (string.IsNullOrWhiteSpace(textBox6.Text))
|
||||
|
|
@ -88,9 +85,6 @@ namespace FModel.Forms
|
|||
MessageBox.Show(@"Please, restart FModel to apply your new output path", @"FModel Output Path Changed", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
}
|
||||
|
||||
Properties.Settings.Default.eEmail = textBox4.Text;
|
||||
Properties.Settings.Default.ePassword = textBox5.Text;
|
||||
|
||||
Properties.Settings.Default.challengesDebug = checkBox2.Checked;
|
||||
Properties.Settings.Default.challengesWatermark = textBox6.Text;
|
||||
|
||||
|
|
@ -230,10 +224,14 @@ namespace FModel.Forms
|
|||
}
|
||||
}
|
||||
|
||||
private void CheckBox1_CheckedChanged(object sender, EventArgs e)
|
||||
private void GroupBox6_Enter(object sender, EventArgs e)
|
||||
{
|
||||
textBox4.UseSystemPasswordChar = !checkBox1.Checked;
|
||||
textBox5.UseSystemPasswordChar = !checkBox1.Checked;
|
||||
|
||||
}
|
||||
|
||||
private void GroupBox1_Enter(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
using FModel.Methods.BackupPAKs.Parser.AESKeyParser;
|
||||
using FModel.Properties;
|
||||
using FModel.Properties;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
|
|
@ -11,7 +11,6 @@ namespace FModel
|
|||
static class AddToUI
|
||||
{
|
||||
private static List<AESEntry> _oldKeysList = null;
|
||||
private static string[] _KeysFromTheApi = null;
|
||||
|
||||
/// <summary>
|
||||
/// ask the keychain api for all dynamic keys and their guids
|
||||
|
|
@ -30,28 +29,24 @@ namespace FModel
|
|||
_oldKeysList = DynamicKeysManager.AESEntries;
|
||||
}
|
||||
|
||||
_KeysFromTheApi = GetKeysFromKeychain();
|
||||
if (_KeysFromTheApi != null)
|
||||
JObject myObject = JObject.Parse(GetKeysFromKeychain());
|
||||
if (myObject != null)
|
||||
{
|
||||
DynamicKeysManager.AESEntries = new List<AESEntry>();
|
||||
foreach (string myString in _KeysFromTheApi)
|
||||
foreach (PaksEntry item in ThePak.dynamicPaksList)
|
||||
{
|
||||
string[] parts = myString.Split(':');
|
||||
string apiGuid = Keychain.getPakGuidFromKeychain(parts);
|
||||
|
||||
string actualPakGuid = ThePak.dynamicPaksList.Where(i => i.thePakGuid == apiGuid).Select(i => i.thePakGuid).FirstOrDefault();
|
||||
string actualPakName = ThePak.dynamicPaksList.Where(i => i.thePakGuid == apiGuid).Select(i => i.thePak).FirstOrDefault();
|
||||
|
||||
bool pakAlreadyExist = DynamicKeysManager.AESEntries.Where(i => i.thePak == actualPakName).Any();
|
||||
|
||||
if (!string.IsNullOrEmpty(actualPakGuid) && !pakAlreadyExist)
|
||||
if (myObject.ToString().Contains(item.thePak))
|
||||
{
|
||||
byte[] bytes = Convert.FromBase64String(parts[1]);
|
||||
string aeskey = BitConverter.ToString(bytes).Replace("-", "");
|
||||
JToken token = myObject.FindTokens(item.thePak).FirstOrDefault();
|
||||
|
||||
DynamicKeysManager.serialize(aeskey.ToUpper(), actualPakName);
|
||||
bool pakAlreadyExist = DynamicKeysManager.AESEntries.Where(i => i.thePak == item.thePak).Any();
|
||||
|
||||
displayNewPaks(actualPakName);
|
||||
if (!pakAlreadyExist)
|
||||
{
|
||||
DynamicKeysManager.serialize(token.ToString().ToUpper().Substring(2), item.thePak);
|
||||
|
||||
displayNewPaks(item.thePak);
|
||||
}
|
||||
}
|
||||
}
|
||||
new UpdateMyConsole("", Color.Green, true).AppendToConsole();
|
||||
|
|
@ -64,22 +59,12 @@ namespace FModel
|
|||
/// just set the array to be the keys from the api
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
private static string[] GetKeysFromKeychain()
|
||||
private static string GetKeysFromKeychain()
|
||||
{
|
||||
if (DLLImport.IsInternetAvailable() && (!string.IsNullOrWhiteSpace(Settings.Default.eEmail) && !string.IsNullOrWhiteSpace(Settings.Default.ePassword)))
|
||||
if (DLLImport.IsInternetAvailable())
|
||||
{
|
||||
string myContent = Keychain.GetEndpoint("https://fortnite-public-service-prod11.ol.epicgames.com/fortnite/api/storefront/v2/keychain", true);
|
||||
|
||||
if (myContent.Contains("\"errorCode\": \"errors.com.epicgames.common.authentication.authentication_failed\""))
|
||||
{
|
||||
new UpdateMyConsole("[EPIC] Authentication Failed.", Color.Red, true).AppendToConsole();
|
||||
return null;
|
||||
}
|
||||
else
|
||||
{
|
||||
new UpdateMyConsole("[EPIC] Authentication Success.", Color.CornflowerBlue, true).AppendToConsole();
|
||||
return AesKeyParser.FromJson(myContent);
|
||||
}
|
||||
JToken dynamicPaks = JObject.Parse(Keychain.GetEndpoint("http://benbotfn.tk:8080/api/aes")).FindTokens("additionalKeys").FirstOrDefault();
|
||||
return JToken.Parse(dynamicPaks.ToString()).ToString().TrimStart('[').TrimEnd(']');
|
||||
}
|
||||
else { return null; }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,145 +1,25 @@
|
|||
using FModel.Methods.BackupPAKs.Parser.AccessCodeParser;
|
||||
using FModel.Methods.BackupPAKs.Parser.TokenParser;
|
||||
using RestSharp;
|
||||
using RestSharp;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using System.Globalization;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System;
|
||||
using System.Drawing;
|
||||
|
||||
namespace FModel
|
||||
{
|
||||
static class Keychain
|
||||
{
|
||||
private static string AccessToken { get; set; }
|
||||
private static string AccessCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// get url content as string with authentication
|
||||
/// </summary>
|
||||
/// <param name="url"></param>
|
||||
/// <param name="auth"></param>
|
||||
/// <returns> url content </returns>
|
||||
public static string GetEndpoint(string url, bool auth)
|
||||
public static string GetEndpoint(string url)
|
||||
{
|
||||
if (string.IsNullOrEmpty(Properties.Settings.Default.ExchangeToken) || isTokenExpired())
|
||||
{
|
||||
refreshToken();
|
||||
}
|
||||
|
||||
RestClient EndpointClient = new RestClient(url);
|
||||
RestRequest EndpointRequest = new RestRequest(Method.GET);
|
||||
if (auth)
|
||||
{
|
||||
EndpointRequest.AddHeader("Authorization", "bearer " + Properties.Settings.Default.ExchangeToken);
|
||||
}
|
||||
|
||||
var response = EndpointClient.Execute(EndpointRequest);
|
||||
string content = JToken.Parse(response.Content).ToString(Newtonsoft.Json.Formatting.Indented);
|
||||
|
||||
return content;
|
||||
}
|
||||
|
||||
|
||||
private static void getAccessToken(string email, string password)
|
||||
{
|
||||
RestClient getAccessTokenClient = new RestClient("https://account-public-service-prod03.ol.epicgames.com/account/api/oauth/token");
|
||||
RestRequest getAccessTokenRequest = new RestRequest(Method.POST);
|
||||
|
||||
getAccessTokenRequest.AddParameter("grant_type", "password");
|
||||
getAccessTokenRequest.AddParameter("username", email);
|
||||
getAccessTokenRequest.AddParameter("password", password);
|
||||
getAccessTokenRequest.AddParameter("includePerms", "true");
|
||||
|
||||
getAccessTokenRequest.AddHeader("Authorization", "basic MzQ0NmNkNzI2OTRjNGE0NDg1ZDgxYjc3YWRiYjIxNDE6OTIwOWQ0YTVlMjVhNDU3ZmI5YjA3NDg5ZDMxM2I0MWE=");
|
||||
getAccessTokenRequest.AddHeader("Content-Type", "application/x-www-form-urlencoded");
|
||||
|
||||
AccessToken = TokenParser.FromJson(getAccessTokenClient.Execute(getAccessTokenRequest).Content).AccessToken;
|
||||
}
|
||||
private static void getAccessCode(string accessToken)
|
||||
{
|
||||
RestClient getAccessCodeClient = new RestClient("https://account-public-service-prod03.ol.epicgames.com/account/api/oauth/exchange");
|
||||
RestRequest getAccessCodeRequest = new RestRequest(Method.GET);
|
||||
|
||||
getAccessCodeRequest.AddHeader("Authorization", "bearer " + accessToken);
|
||||
|
||||
AccessCode = AccessCodeParser.FromJson(getAccessCodeClient.Execute(getAccessCodeRequest).Content).Code;
|
||||
}
|
||||
private static void getExchangeToken(string accessCode)
|
||||
{
|
||||
RestClient getExchangeTokenClient = new RestClient("https://account-public-service-prod03.ol.epicgames.com/account/api/oauth/token");
|
||||
RestRequest getExchangeTokenRequest = new RestRequest(Method.POST);
|
||||
|
||||
getExchangeTokenRequest.AddHeader("Authorization", "basic ZWM2ODRiOGM2ODdmNDc5ZmFkZWEzY2IyYWQ4M2Y1YzY6ZTFmMzFjMjExZjI4NDEzMTg2MjYyZDM3YTEzZmM4NGQ=");
|
||||
getExchangeTokenRequest.AddHeader("Content-Type", "application/x-www-form-urlencoded");
|
||||
getExchangeTokenRequest.AddParameter("grant_type", "exchange_code");
|
||||
getExchangeTokenRequest.AddParameter("exchange_code", accessCode);
|
||||
getExchangeTokenRequest.AddParameter("includePerms", "true");
|
||||
getExchangeTokenRequest.AddParameter("token_type", "eg1");
|
||||
|
||||
string content = getExchangeTokenClient.Execute(getExchangeTokenRequest).Content;
|
||||
|
||||
Properties.Settings.Default.ExchangeToken = TokenParser.FromJson(content).AccessToken;
|
||||
Properties.Settings.Default.TokenExpiration = DateTimeOffset.Parse(TokenParser.FromJson(content).ExpiresAt).ToUnixTimeMilliseconds();
|
||||
Properties.Settings.Default.Save();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// check the current time and the expiration date of our token
|
||||
/// 60 seconds before it expires, it's considered expired and should be refreshed
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
private static bool isTokenExpired()
|
||||
{
|
||||
long currentTime = DateTimeOffset.Now.ToUnixTimeMilliseconds();
|
||||
if ((currentTime - 60000) >= Properties.Settings.Default.TokenExpiration)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else { return false; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// steps to get our token or refresh
|
||||
/// </summary>
|
||||
public static void refreshToken()
|
||||
{
|
||||
new UpdateMyConsole("[EPIC] Token Refresh", Color.CornflowerBlue, true).AppendToConsole();
|
||||
|
||||
getAccessToken(Properties.Settings.Default.eEmail, Properties.Settings.Default.ePassword);
|
||||
getAccessCode(AccessToken);
|
||||
getExchangeToken(AccessCode);
|
||||
}
|
||||
|
||||
private static IEnumerable<string> SplitGuid(string str, int chunkSize)
|
||||
{
|
||||
return Enumerable.Range(0, str.Length / chunkSize)
|
||||
.Select(i => str.Substring(i * chunkSize, chunkSize));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// split KeychainPart each 8 letter
|
||||
/// for each of these letters, convert to hexadecimal as string
|
||||
/// </summary>
|
||||
/// <param name="KeychainPart"></param>
|
||||
/// <returns> the guid (ie 17722063-2246354315-4143272431-3887619937) </returns>
|
||||
public static string getPakGuidFromKeychain(string[] KeychainPart)
|
||||
{
|
||||
StringBuilder sB = new StringBuilder();
|
||||
IEnumerable<string> guid = SplitGuid(KeychainPart[0], 8);
|
||||
int count = 0;
|
||||
|
||||
foreach (string p in guid)
|
||||
{
|
||||
count += 1;
|
||||
|
||||
if (count != guid.Count()) { sB.Append((uint)int.Parse(p, NumberStyles.HexNumber) + "-"); }
|
||||
else { sB.Append((uint)int.Parse(p, NumberStyles.HexNumber)); }
|
||||
}
|
||||
|
||||
return sB.ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,37 +0,0 @@
|
|||
// <auto-generated />
|
||||
//
|
||||
// To parse this JSON data, add NuGet 'Newtonsoft.Json' then do:
|
||||
//
|
||||
// using FModel.Methods.BackupPAKs.Parser.AESKeyParser;
|
||||
//
|
||||
// var aesKeyParser = AesKeyParser.FromJson(jsonString);
|
||||
|
||||
namespace FModel.Methods.BackupPAKs.Parser.AESKeyParser
|
||||
{
|
||||
using System.Globalization;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Converters;
|
||||
|
||||
public class AesKeyParser
|
||||
{
|
||||
public static string[] FromJson(string json) => JsonConvert.DeserializeObject<string[]>(json, FModel.Methods.BackupPAKs.Parser.AESKeyParser.Converter.Settings);
|
||||
}
|
||||
|
||||
public static class Serialize
|
||||
{
|
||||
public static string ToJson(this string[] self) => JsonConvert.SerializeObject(self, FModel.Methods.BackupPAKs.Parser.AESKeyParser.Converter.Settings);
|
||||
}
|
||||
|
||||
internal static class Converter
|
||||
{
|
||||
public static readonly JsonSerializerSettings Settings = new JsonSerializerSettings
|
||||
{
|
||||
MetadataPropertyHandling = MetadataPropertyHandling.Ignore,
|
||||
DateParseHandling = DateParseHandling.None,
|
||||
Converters =
|
||||
{
|
||||
new IsoDateTimeConverter { DateTimeStyles = DateTimeStyles.AssumeUniversal }
|
||||
},
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
@ -1,49 +0,0 @@
|
|||
// <auto-generated />
|
||||
//
|
||||
// To parse this JSON data, add NuGet 'Newtonsoft.Json' then do:
|
||||
//
|
||||
// using FModel.Methods.BackupPAKs.Parser.AccessCodeParser;
|
||||
//
|
||||
// var accessCodeParser = AccessCodeParser.FromJson(jsonString);
|
||||
|
||||
namespace FModel.Methods.BackupPAKs.Parser.AccessCodeParser
|
||||
{
|
||||
using System.Globalization;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Converters;
|
||||
|
||||
public partial class AccessCodeParser
|
||||
{
|
||||
[JsonProperty("expiresInSeconds")]
|
||||
public long ExpiresInSeconds { get; set; }
|
||||
|
||||
[JsonProperty("code")]
|
||||
public string Code { get; set; }
|
||||
|
||||
[JsonProperty("creatingClientId")]
|
||||
public string CreatingClientId { get; set; }
|
||||
}
|
||||
|
||||
public partial class AccessCodeParser
|
||||
{
|
||||
public static AccessCodeParser FromJson(string json) => JsonConvert.DeserializeObject<AccessCodeParser>(json, FModel.Methods.BackupPAKs.Parser.AccessCodeParser.Converter.Settings);
|
||||
}
|
||||
|
||||
public static class Serialize
|
||||
{
|
||||
public static string ToJson(this AccessCodeParser self) => JsonConvert.SerializeObject(self, FModel.Methods.BackupPAKs.Parser.AccessCodeParser.Converter.Settings);
|
||||
}
|
||||
|
||||
internal static class Converter
|
||||
{
|
||||
public static readonly JsonSerializerSettings Settings = new JsonSerializerSettings
|
||||
{
|
||||
MetadataPropertyHandling = MetadataPropertyHandling.Ignore,
|
||||
DateParseHandling = DateParseHandling.None,
|
||||
Converters =
|
||||
{
|
||||
new IsoDateTimeConverter { DateTimeStyles = DateTimeStyles.AssumeUniversal }
|
||||
},
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
@ -1,93 +0,0 @@
|
|||
// <auto-generated />
|
||||
//
|
||||
// To parse this JSON data, add NuGet 'Newtonsoft.Json' then do:
|
||||
//
|
||||
// using FModel.Methods.BackupPAKs.Parser.ExchangeTokenParser;
|
||||
//
|
||||
// var TokenParser = ExchangeTokenParser.FromJson(jsonString);
|
||||
|
||||
namespace FModel.Methods.BackupPAKs.Parser.TokenParser
|
||||
{
|
||||
using System;
|
||||
|
||||
using System.Globalization;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Converters;
|
||||
|
||||
public partial class TokenParser
|
||||
{
|
||||
[JsonProperty("access_token")]
|
||||
public string AccessToken { get; set; }
|
||||
|
||||
[JsonProperty("expires_in")]
|
||||
public long ExpiresIn { get; set; }
|
||||
|
||||
[JsonProperty("expires_at")]
|
||||
public string ExpiresAt { get; set; }
|
||||
|
||||
[JsonProperty("token_type")]
|
||||
public string TokenType { get; set; }
|
||||
|
||||
[JsonProperty("refresh_token")]
|
||||
public string RefreshToken { get; set; }
|
||||
|
||||
[JsonProperty("refresh_expires")]
|
||||
public long RefreshExpires { get; set; }
|
||||
|
||||
[JsonProperty("refresh_expires_at")]
|
||||
public DateTimeOffset RefreshExpiresAt { get; set; }
|
||||
|
||||
[JsonProperty("account_id")]
|
||||
public string AccountId { get; set; }
|
||||
|
||||
[JsonProperty("client_id")]
|
||||
public string ClientId { get; set; }
|
||||
|
||||
[JsonProperty("internal_client")]
|
||||
public bool InternalClient { get; set; }
|
||||
|
||||
[JsonProperty("client_service")]
|
||||
public string ClientService { get; set; }
|
||||
|
||||
[JsonProperty("perms")]
|
||||
public Perm[] Perms { get; set; }
|
||||
|
||||
[JsonProperty("app")]
|
||||
public string App { get; set; }
|
||||
|
||||
[JsonProperty("in_app_id")]
|
||||
public string InAppId { get; set; }
|
||||
}
|
||||
|
||||
public partial class Perm
|
||||
{
|
||||
[JsonProperty("resource")]
|
||||
public string Resource { get; set; }
|
||||
|
||||
[JsonProperty("action")]
|
||||
public long Action { get; set; }
|
||||
}
|
||||
|
||||
public partial class TokenParser
|
||||
{
|
||||
public static TokenParser FromJson(string json) => JsonConvert.DeserializeObject<TokenParser>(json, FModel.Methods.BackupPAKs.Parser.TokenParser.Converter.Settings);
|
||||
}
|
||||
|
||||
public static class Serialize
|
||||
{
|
||||
public static string ToJson(this TokenParser self) => JsonConvert.SerializeObject(self, FModel.Methods.BackupPAKs.Parser.TokenParser.Converter.Settings);
|
||||
}
|
||||
|
||||
internal static class Converter
|
||||
{
|
||||
public static readonly JsonSerializerSettings Settings = new JsonSerializerSettings
|
||||
{
|
||||
MetadataPropertyHandling = MetadataPropertyHandling.Ignore,
|
||||
DateParseHandling = DateParseHandling.None,
|
||||
Converters =
|
||||
{
|
||||
new IsoDateTimeConverter { DateTimeStyles = DateTimeStyles.AssumeUniversal }
|
||||
},
|
||||
};
|
||||
}
|
||||
}
|
||||
48
FModel/Properties/Settings.Designer.cs
generated
48
FModel/Properties/Settings.Designer.cs
generated
|
|
@ -479,30 +479,6 @@ namespace FModel.Properties {
|
|||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("")]
|
||||
public string eEmail {
|
||||
get {
|
||||
return ((string)(this["eEmail"]));
|
||||
}
|
||||
set {
|
||||
this["eEmail"] = value;
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("")]
|
||||
public string ePassword {
|
||||
get {
|
||||
return ((string)(this["ePassword"]));
|
||||
}
|
||||
set {
|
||||
this["ePassword"] = value;
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("English")]
|
||||
|
|
@ -587,30 +563,6 @@ namespace FModel.Properties {
|
|||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("")]
|
||||
public string ExchangeToken {
|
||||
get {
|
||||
return ((string)(this["ExchangeToken"]));
|
||||
}
|
||||
set {
|
||||
this["ExchangeToken"] = value;
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("0")]
|
||||
public long TokenExpiration {
|
||||
get {
|
||||
return ((long)(this["TokenExpiration"]));
|
||||
}
|
||||
set {
|
||||
this["TokenExpiration"] = value;
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("")]
|
||||
|
|
|
|||
|
|
@ -116,12 +116,6 @@
|
|||
<Setting Name="createIconForSTWCardPacks" Type="System.Boolean" Scope="User">
|
||||
<Value Profile="(Default)">True</Value>
|
||||
</Setting>
|
||||
<Setting Name="eEmail" Type="System.String" Scope="User">
|
||||
<Value Profile="(Default)" />
|
||||
</Setting>
|
||||
<Setting Name="ePassword" Type="System.String" Scope="User">
|
||||
<Value Profile="(Default)" />
|
||||
</Setting>
|
||||
<Setting Name="IconLanguage" Type="System.String" Scope="User">
|
||||
<Value Profile="(Default)">English</Value>
|
||||
</Setting>
|
||||
|
|
@ -143,12 +137,6 @@
|
|||
<Setting Name="UMCTGalleries" Type="System.Boolean" Scope="User">
|
||||
<Value Profile="(Default)">False</Value>
|
||||
</Setting>
|
||||
<Setting Name="ExchangeToken" Type="System.String" Scope="User">
|
||||
<Value Profile="(Default)" />
|
||||
</Setting>
|
||||
<Setting Name="TokenExpiration" Type="System.Int64" Scope="User">
|
||||
<Value Profile="(Default)">0</Value>
|
||||
</Setting>
|
||||
<Setting Name="tConsKey" Type="System.String" Scope="User">
|
||||
<Value Profile="(Default)" />
|
||||
</Setting>
|
||||
|
|
|
|||
|
|
@ -93,3 +93,7 @@ I'd highly suggest you to use [UModel](https://github.com/gildor2/UModel) if you
|
|||
- [x] Load all paks
|
||||
- [x] Load only difference between 2 paks version
|
||||
- [x] Custom watermark option on icons
|
||||
|
||||
## Removal
|
||||
Contact me with an authorized, genuine email if you work for Epic Games and would like this removed.
|
||||
asval.contactme@gmail.com
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user