MxEpoch/MxEpoch.Shards/Program.cs

68 lines
2.9 KiB
C#

/////////////////////////////////////////////////////////////////////////////////
// ___ ___ /////////////////////////////////////////////////////////////////////
// | \/ |_ __ ////////////////////////////////////////////////////////////////
// | . . \ \/ / ////////////////////////////////////////////////////////////////
// | |\/| |> < /////////////////////////////////////////////////////////////////
// | | | /_/\_\ ////////////////////////////////////////////////////////////////
// \_| |_| /////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////
// https://www.mikx.ovh // https://mxg.ovh // http://discord.mxg.ovh ////////////
/////////////////////////////////////////////////////////////////////////////////
// MxEpoch //////////////////////////////////////////////////////////////////////
// By mikx (https://mxgit.ovh) //////////////////////////////////////////////////
// Credits: /////////////////////////////////////////////////////////////////////
// Ash06 - LastEpochLib (https://fearlessrevolution.com/viewtopic.php?t=17089) //
/////////////////////////////////////////////////////////////////////////////////
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MxEpoch.Shards
{
internal class Program
{
static void Main(string[] args)
{
// Load file from args or by draging it on the exe
string file = args[0];
// Backup
if (!Directory.Exists("Backup")) { Directory.CreateDirectory("Backup"); }
DateTime dt = DateTime.Now;
string year = dt.Year.ToString();
string month = dt.Month.ToString();
string day = dt.Day.ToString();
string hour = dt.Hour.ToString();
string minute = dt.Minute.ToString();
string second = dt.Second.ToString();
File.Copy(file, $@"Backup\STASH_0.{year}-{month}-{day}.{hour}-{minute}-{second}");
// Load the stash data from the file
var stash = LastEpochLib.Stash.Load.Stash(file);
// Iterate throught the shards in the stash
foreach (var s in stash.SavedShards)
{
// Set the quantity for this shard
s.Quantity = 200;
}
// Iterate throught the glyphs in the stash
foreach (var g in stash.MaterialsList)
{
// Set the quantity for this glyph
g.Quantity = 200;
}
// Prepare a string to be saved as a new stash file
string contents = LastEpochLib.Get.StartFile + JsonConvert.SerializeObject((object)stash);
// Save the prepared string to the loaded file, with the modified data from above
File.WriteAllText(file, contents);
}
}
}