private C3DFile() { this._processorType = C3DConstants.FILE_DEFAULT_PROCESSOR_TYPE; this._header = new C3DHeader(); this._parameterDictionary = C3DParameterDictionary.CreateNewParameterDictionary(); this._frameCollection = new C3DFrameCollection(); }
private C3DFile(Stream stream) { C3DReader reader = null; try { reader = new C3DReader(stream); this._processorType = reader.CreateProcessorType; this._header = reader.ReadHeader(); this._parameterDictionary = reader.ReadParameters(); this._frameCollection = new C3DFrameCollection(); try { C3DParameterCache paramCache = C3DParameterCache.CreateCache(this); C3DFrame frame = null; while ((frame = reader.ReadNextFrame(paramCache)) != null) { this._frameCollection.Add(frame); } } catch { } } finally { if (reader != null) { reader.Close(); } } }
private void WriteFrameCollection(C3DParameterCache cache, C3DFrameCollection frameCollection) { Int32 startPosition = (this._newDataStartBlockIndex - 1) * C3DConstants.FILE_SECTION_SIZE; this._writer.Seek(startPosition, SeekOrigin.Begin); for (Int32 i = 0; i < frameCollection.Count; i++) { if (cache.ScaleFactor < 0) { this.WriteFloatFrame(cache, frameCollection[i]); } else { this.WriteIntFrame(cache, frameCollection[i]); } } Int16 finalIndex = (Int16)((this._writer.BaseStream.Position + C3DConstants.FILE_SECTION_SIZE) / C3DConstants.FILE_SECTION_SIZE + 1); this._writer.Write(new Byte[(finalIndex - 1) * C3DConstants.FILE_SECTION_SIZE - this._writer.BaseStream.Position]); }