public void Transfer(DoomEternalSavePath dst) { List <Tuple <string, byte[]> > srcFiles = new List <Tuple <string, byte[]> >(); // read from source string srcAAD; if (Platform == DoomEternalSavePlatform.BethesdaNet) { srcAAD = "PAINELEMENTAL"; } else if (Platform == DoomEternalSavePlatform.Steam) { srcAAD = "MANCUBUS"; } else { throw new Exception("Unsupported source platform specified!"); } foreach (var single in GetAbsolutePaths()) { if (Encrypted) { srcFiles.Add(new Tuple <string, byte[]>(single.Replace(FullPath, "").Substring(1), Crypto.DecryptAndVerify($"{Identifier}{srcAAD}{Path.GetFileName(single)}", File.ReadAllBytes(single)))); } else { srcFiles.Add(new Tuple <string, byte[]>(single.Replace(FullPath, "").Substring(1), File.ReadAllBytes(single))); } } // copy to destination string dstAAD; if (dst.Platform == DoomEternalSavePlatform.BethesdaNet) { dstAAD = "PAINELEMENTAL"; } else if (dst.Platform == DoomEternalSavePlatform.Steam) { dstAAD = "MANCUBUS"; } else { throw new Exception("Unsupported destination platform specified!"); } foreach (var single in srcFiles) { Directory.CreateDirectory(Path.GetDirectoryName(Path.Combine(dst.FullPath, single.Item1))); if (dst.Encrypted) { File.WriteAllBytes(Path.Combine(dst.FullPath, single.Item1), Crypto.EncryptAndDigest($"{dst.Identifier}{dstAAD}{Path.GetFileName(single.Item1)}", single.Item2)); } else { File.WriteAllBytes(Path.Combine(dst.FullPath, single.Item1), single.Item2); } } }
public static void Transfer(DoomEternalSavePath src, DoomEternalSavePath dst) => src.Transfer(dst);