Beispiel #1
0
        public override void VisitStringsHeap(StringsHeap heap)
        {
            VisitHeap(heap);

            if (heap.Data.Length < 1 && heap.Data [0] != 0)
            {
                throw new MetadataFormatException("Malformed #Strings heap");
            }

            heap [(uint)0] = string.Empty;
        }
Beispiel #2
0
        public override void VisitStringsHeap(StringsHeap heap)
        {
            this.VisitHeap(heap);

            if (heap.Data.Length < 1 && heap.Data [0] != 0)
            {
                throw new MetadataFormatException("Malformed #Strings heap");
            }

            heap [(uint)0] = string.Empty;

            BinaryReader br = new BinaryReader(
                new MemoryStream(heap.Data), Encoding.UTF8);

            try {
                br.BaseStream.Position++;

                StringBuilder buffer = new StringBuilder();
                for (long index = br.BaseStream.Position; br.BaseStream.Position < br.BaseStream.Length;)
                {
                    char cur = br.ReadChar();
                    if (cur == '\0' && buffer.Length > 0)
                    {
                        heap [(uint)index] = buffer.ToString();
                        buffer             = new StringBuilder();
                        index = br.BaseStream.Position;
                    }
                    else
                    {
                        buffer.Append(cur);
                    }
                }
            } finally {
                // COMPACT FRAMEWORK NOTE: BinaryReader is not IDisposable
                br.Close();
            }
        }
Beispiel #3
0
 public override void VisitStringsHeap(StringsHeap heap)
 {
     PatchStreamHeaderOffset(heap);
     WriteMemStream(m_stringWriter);
 }
        public override void VisitStringsHeap(StringsHeap heap)
        {
            this.VisitHeap (heap);

            if (heap.Data.Length < 1 && heap.Data [0] != 0)
                throw new MetadataFormatException ("Malformed #Strings heap");

            heap [(uint) 0] = string.Empty;

            BinaryReader br = new BinaryReader (
                new MemoryStream (heap.Data), Encoding.UTF8);

            try {

                br.BaseStream.Position++;

                StringBuilder buffer = new StringBuilder ();
                for (long index = br.BaseStream.Position ; br.BaseStream.Position < br.BaseStream.Length ; ) {
                    char cur = br.ReadChar ();
                    if (cur == '\0' && buffer.Length > 0) {
                        heap [(uint) index] = buffer.ToString ();
                        buffer = new StringBuilder ();
                        index = br.BaseStream.Position;
                    } else
                        buffer.Append (cur);
                }
            } finally {
                // COMPACT FRAMEWORK NOTE: BinaryReader is not IDisposable
                br.Close();
            }
        }
Beispiel #5
0
 public override void VisitStringsHeap(StringsHeap heap)
 {
     PatchStreamHeaderOffset (heap);
     WriteMemStream (m_stringWriter);
 }
Beispiel #6
0
		public override void VisitStringsHeap (StringsHeap heap)
		{
			VisitHeap (heap);

			if (heap.Data.Length < 1 && heap.Data [0] != 0)
				throw new MetadataFormatException ("Malformed #Strings heap");

			heap [(uint) 0] = string.Empty;
		}
Beispiel #7
0
		public override void VisitStringsHeap (StringsHeap heap)
		{
			this.asm.StaticArray (moduleName + " StringsHeap", heap.Data);
		}