예제 #1
0
        public void TypelessWrite(Amf3String str)
        {
            // has this string been written before with this writer?
            if (str.mWriter == this)
            {
                // write string id reference
                TypelessWrite(str.mId << 1);
                return;
            }

            // special case empty strings
            if (string.IsNullOrEmpty(str.Value))
            {
                TypelessWrite(1);
                return;
            }

            // lookup string by value
            int index;

            if (stringTable.TryGetValue(str.Value, out index))
            {
                // cache id within string object
                str.mWriter = this;
                str.mId     = index;
                // write string id reference
                TypelessWrite(index << 1);
                return;
            }

            // write UTF8 bytes of string
            byte[] bytes = str.Bytes;
            TypelessWrite((bytes.Length << 1) | 1);
            Stream.Write(bytes);

            // cache id within string object
            str.mWriter = this;
            str.mId     = stringTable.Count;

            // store string value in string table
            stringTable[str.Value] = str.mId;
        }
예제 #2
0
		public Value(string name)
		{
			mName = new Amf3String(name);
		}
예제 #3
0
		public Value(Amf3String name)
		{
			mName = name;
		}
예제 #4
0
		public void TypelessWrite(Amf3String str)
		{
			// has this string been written before with this writer?
			if (str.mWriter == this) {
				// write string id reference
				TypelessWrite(str.mId << 1);
				return;
			}

			// special case empty strings
			if (string.IsNullOrEmpty(str.Value)) {
				TypelessWrite(1);
				return;
			}

			// lookup string by value
			int index;
			if (stringTable.TryGetValue(str.Value, out index)) {
				// cache id within string object
				str.mWriter = this;
				str.mId     = index;
				// write string id reference
				TypelessWrite(index << 1);
				return;
			}

			// write UTF8 bytes of string
			byte[] bytes = str.Bytes;
			TypelessWrite((bytes.Length << 1) | 1);
			Stream.Write(bytes);

			// cache id within string object
			str.mWriter = this;
			str.mId     = stringTable.Count;

			// store string value in string table
			stringTable[str.Value] = str.mId;
		}
예제 #5
0
		public void Write(Amf3String str)
		{
			Write(Amf3TypeCode.String);
			TypelessWrite(str);
		}
예제 #6
0
 public void Write(Amf3String str)
 {
     Write(Amf3TypeCode.String);
     TypelessWrite(str);
 }
예제 #7
0
		public Span(string name)
		{
			mName = new Amf3String(name);
		}
예제 #8
0
		public Span(Amf3String name)
		{
			mName = name;
		}