public static void UpdateInfo(ProfilesList myProfileListInfo, int pos, string filePath) { FileStream myFile = new FileStream(filePath, FileMode.OpenOrCreate, FileAccess.ReadWrite); BinaryWriter writer = new BinaryWriter(myFile); myFile.Position = pos; writer.Write(myProfileListInfo.ProfileName); writer.Write(myProfileListInfo.LastLogin); writer.Write(myProfileListInfo.Description); myFile.Close(); writer.Close(); myFile.Dispose(); writer.Dispose(); return; }
//-------------------------------------------- public static ProfilesList FromFile(int pos, string filePath) { FileStream myFile = new FileStream(filePath, FileMode.Open, FileAccess.ReadWrite); BinaryReader reader = new BinaryReader(myFile); myFile.Position = pos; ProfilesList myListingInfo = new ProfilesList() { ProfileName = reader.ReadString(), LastLogin = reader.ReadString(), Description = reader.ReadString(), }; myFile.Close(); reader.Close(); reader.Dispose(); myFile.Dispose(); return(myListingInfo); }