示例#1
0
		public virtual uint Save (OrderedWriter writer, uint position)
		{
#if DEBUG_LOADER			
			Console.WriteLine ("writing entry {0} {1} {2}", Id, Type, Count);
#endif
			writer.Write ((ushort)Id);
			writer.Write ((ushort)Type);
			writer.Write ((uint)Count);
			if (Length > 4) {
				writer.Write ((uint)position);
				writer.Stream.Position = position;
				writer.Stream.Write (RawData, 0, RawData.Length);
				return (uint) (position + RawData.Length);
			} else {
				writer.Stream.Write (RawData, 0, RawData.Length);
				for (int i = 0; i < 4 - RawData.Length; i++)
					writer.Write ((byte)0);
			}
			return position;
		}
示例#2
0
		public uint Save (OrderedWriter writer, uint position)
		{
			writer.Write (position);
			writer.Stream.Position = position;

			writer.Write ((ushort)entries.Count);

			position += 2;
			uint  value_position = (uint) (position + 12 * entries.Count + 4);

			for (int i = 0; i < entries.Count; i++) {
				writer.Stream.Position = position + (12 * i);
				value_position = (uint)Entries[i].Save (writer, value_position);
			}
							
			writer.Stream.Position = position + (12 * entries.Count);
			if (next_directory != null)
				value_position = next_directory.Save (writer, value_position);
			else 
				writer.Write ((uint) 0);

			return value_position;
		}
示例#3
0
		public override uint Save (OrderedWriter writer, uint position)
		{
#if DEBUG_LOADER			
			Console.WriteLine ("writing entry {0} {1} {2} - value offset = {3}", Id, Type, Count, position);
#endif

			writer.Write ((ushort)Id);
			writer.Write ((ushort)Type);
			writer.Write ((uint)Count);


			if (Directory.Length == 1) {
				writer.Write ((uint)position);
				position = Directory [0].Save (writer, position);
			} else if (Directory.Length > 1) {
				writer.Write ((uint)position);
				uint value_position = (uint) (position + Directory.Length * 4);
				for (int i = 0; i < Directory.Length; i++) {
					writer.Stream.Position = position + i * 4;
					value_position = Directory [i].Save (writer, value_position);
				}
				return value_position;
			} else
				writer.Write ((uint) 0);

			return position;
		}
示例#4
0
		public void Save (System.IO.Stream out_stream)
		{
			OrderedWriter writer = new OrderedWriter (out_stream, endian == Endian.Little);
			
			/* Header */
			if (endian == Endian.Little) {
				writer.Write ((byte)'I');
				writer.Write ((byte)'I');
			} else {
				writer.Write ((byte)'M');
				writer.Write ((byte)'M');
			}
			
			writer.Write ((ushort)42);
			
			/* First IFD */
			Directory.Save (writer, 8);
		}