public void Initialize(UserGameInfo game, GameProfile profile) { string documents = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments); string configFolder = Path.Combine(documents, @"My Games\Borderlands 2\WillowGame\SaveData"); DirectoryInfo[] userDirs = new DirectoryInfo(configFolder).GetDirectories(); for (int i = 0; i < userDirs.Length; i++) { DirectoryInfo user = userDirs[i]; FileInfo[] saves = user.GetFiles("*.sav"); for (int j = 0; j < saves.Length; j++) { FileInfo save = saves[j]; BorderlandsSaveControl con = new BorderlandsSaveControl(); using (Stream s = save.OpenRead()) { con.SaveFile = SaveFile.Deserialize(s, SaveFile.DeserializeSettings.None); } con.UserName = user.Name; //con.SaveName = con.SaveFile.SaveGame.AppliedCustomizations; this.flowLayoutPanel1.Controls.Add(con); } } }
public static void Main(string[] args) { using (var input = File.Open( @"savegame.dat", FileMode.Open, FileAccess.Read, FileShare.ReadWrite)) { var test = new SaveFile(); test.Deserialize(input); } }
private void OnOpen(object sender, EventArgs e) { if (this.openFileDialog.ShowDialog() != DialogResult.OK) { return; } var save = new SaveFile(); using (var input = this.openFileDialog.OpenFile()) { save.Deserialize(input); } this._Save = save; }
static void Main(string[] args) { string path; path = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments); path = Path.Combine(path, "My Games"); path = Path.Combine(path, "Borderlands"); path = Path.Combine(path, "SaveData"); path = Path.Combine(path, "Save0001.first"); Stream input = File.Open(path, FileMode.Open, FileAccess.Read, FileShare.ReadWrite); SaveFile save = new SaveFile(); save.Deserialize(input); input.Close(); }
private void OnOpen(object sender, EventArgs e) { if (this.openFileDialog.ShowDialog() != DialogResult.OK) { return; } SaveFile save = new SaveFile(); Stream input = this.openFileDialog.OpenFile(); save.Deserialize(input); input.Close(); this.Save = save; }