/// <summary> /// Duplicates the whole sack contents /// </summary> /// <returns>Sack instance of the duplicate sack</returns> public SackCollection Duplicate() { SackCollection newSack = new SackCollection(); foreach (Item item in this) { newSack.AddItem(item.Clone()); } return(newSack); }
/// <summary> /// Parses an item block within the file and coverts raw item data into internal item data /// </summary> /// <param name="fileOffset">Offset into the file</param> /// <param name="reader">BinaryReader instance</param> private void ParseItemBlock(int fileOffset, BinaryReader reader) { try { reader.BaseStream.Seek(fileOffset, SeekOrigin.Begin); reader.ReadInt32(); TQData.ValidateNextString("begin_block", reader); this.beginBlockCrap = reader.ReadInt32(); TQData.ValidateNextString("stashVersion", reader); this.stashVersion = reader.ReadInt32(); TQData.ValidateNextString("fName", reader); // Changed to raw data to support extended characters int stringLength = reader.ReadInt32(); this.name = reader.ReadBytes(stringLength); TQData.ValidateNextString("sackWidth", reader); this.Width = reader.ReadInt32(); TQData.ValidateNextString("sackHeight", reader); this.Height = reader.ReadInt32(); this.numberOfSacks = 1; this.sack = new SackCollection(); this.sack.SackType = SackType.Stash; this.sack.IsImmortalThrone = true; this.sack.Parse(reader); } catch (ArgumentException) { // The ValidateNextString Method can throw an ArgumentException. // We just pass it along at this point. throw; } }
/// <summary> /// Creates an empty sack /// </summary> public void CreateEmptySack() { this.sack = new SackCollection(); this.sack.IsModified = false; }