Ejemplo n.º 1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="AttributeTempFile"/> class.
 /// </summary>
 /// <param name="tempPath">
 /// The temp path.
 /// </param>
 /// <param name="map">
 /// The dimension position in the ARR map
 /// </param>
 /// <param name="level">
 /// The level.
 /// </param>
 public AttributeTempFile(string tempPath, GesmesKeyMap map, RelStatus level)
 {
     string filePath = Path.Combine(tempPath, Path.GetRandomFileName());
     this._fileStream = File.Create(filePath, BufferSize, FileOptions.DeleteOnClose | FileOptions.SequentialScan);
     this._writer = new GesmesAttributeGroupWriter(this._fileStream);
     this._currentGroup = new GesmesAttributeGroup(map, level);
 }
        /// <summary>
        /// Write the specified <paramref name="gesmesAttributeGroup"/> to output
        /// </summary>
        /// <param name="gesmesAttributeGroup">
        /// The GESMES attribute group that contains a single ARR and all of it's attributes
        /// </param>
        public void Write(GesmesAttributeGroup gesmesAttributeGroup)
        {
            int length = gesmesAttributeGroup.DimensionValues.Length;
            this.Write(length);
            for (int i = 0; i < length; i++)
            {
                this.Write(gesmesAttributeGroup.DimensionValues[i]);
            }

            this.Write(gesmesAttributeGroup.AttributeValues.Count);
            for (int i = 0; i < gesmesAttributeGroup.AttributeValues.Count; i++)
            {
                this.Write(gesmesAttributeGroup.AttributeValues[i].Key);
                this.Write(gesmesAttributeGroup.AttributeValues[i].Value ?? string.Empty);
            }
        }