void Read(BinaryReader reader) { m_header = new TBHeader(reader); byte[] bytes = new byte[reader.BaseStream.Length - reader.BaseStream.Position]; reader.Read(bytes, 0, bytes.Length); using (MemoryStream stream = new MemoryStream(bytes)) { using (ZipFile zipFile = ZipFile.Read(stream)) { string tempDir = GetTempDirectory(".tilt-in"); foreach (var entry in zipFile.Entries) { entry.ExtractToFile(tempDir); } try { m_thumbnailBytes = ReadThumbnailBytes(Path.Combine(tempDir, kFileThumbnail)); m_brushStrokes = ReadBrushStrokes(Path.Combine(tempDir, kFileSketchData)); m_metadata = ReadMetadata(Path.Combine(tempDir, kFileMetadata)); } finally { Directory.Delete(tempDir, true); } } } }
public TBBrushStrokes Clone() { TBBrushStrokes clone = new TBBrushStrokes(); clone.m_version = m_version; clone.m_reserved = m_reserved; clone.m_size = m_size; clone.m_payload = m_payload; List <TBBrushStroke> brushStrokes = new List <TBBrushStroke>(m_brushStrokes.Count); foreach (var brushStroke in m_brushStrokes) { brushStrokes.Add(brushStroke.Clone()); } clone.m_brushStrokes = brushStrokes; return(clone); }