Пример #1
1
			internal State(BinaryFormatter parent, SerializationHintsAttribute hints, Type t)
			{
				BinaryFormatter.WriteLine("New State: {0}", t != null ? t.FullName : "<null>");

				TypeDescriptor td = (t != null) ? new TypeDescriptor(t) : null;

				m_parent = parent;
				m_value = new TypeHandler(parent, hints, td);
			}
Пример #2
0
			internal TypeHandler(BinaryFormatter bf, SerializationHintsAttribute hints, TypeDescriptor expected)
			{
				m_bf = bf;

				m_value = null;
				m_type = null;
				m_hints = hints;

				m_typeExpected = expected;
				m_typeForced = null;
			}
Пример #3
0
		static public SerializationHintsAttribute GetHints(MemberInfo mi)
		{
			SerializationHintsAttribute hintsDst = null;

			if(mi != null)
			{
				//In order to break the dependency between Microsoft.SPOT.Debugger and Microsoft.SPOT.Native
				//SerializationHintsAttribute class is defined in both places. 
				//Microsoft.SPOT.Debugger.SerializationHintsAttribute needs to remain backwards compatible with 
				//Microsoft.SPOT.SerializationHintsAttribute.  This method converts the attributes applied to a 
				//client assembly with Native class to the debugger class.


				object[] lst = mi.GetCustomAttributes(false);
				bool fFoundSerializationHints = false;

				for(int iAttr = 0; iAttr < lst.Length; iAttr++)
				{
					object hintsSrc = lst[iAttr];

					if(hintsSrc.GetType().FullName == "Microsoft.SPOT.SerializationHintsAttribute")
					{
						if(fFoundSerializationHints)
						{
							throw new NotSupportedException("Only one attribute per type!");
						}

						fFoundSerializationHints = true;

						hintsDst = new SerializationHintsAttribute();

						ConvertObject(hintsDst, hintsSrc);
					}
				}
			}

			return hintsDst;
		}
Пример #4
0
		private SerializationHintsAttribute BuildHints(Type t)
		{
			if(t == null)
				return null;

			SerializationHintsAttribute hints = new SerializationHintsAttribute();

			hints.Flags = SerializationFlags.FixedType | SerializationFlags.PointerNeverNull;

			return hints;
		}
Пример #5
0
			private State AdvanceToTheNextElement()
			{
				if(m_array_CurrentPos++ < m_array_LastPos)
				{
					SerializationHintsAttribute hints;

					if(m_value.m_hints != null && (m_value.m_hints.Flags & (SerializationFlags.FixedType | SerializationFlags.PointerNeverNull)) != 0)
					{
						hints = new SerializationHintsAttribute();

						hints.BitPacked = 0;
						hints.Flags = m_value.m_hints.Flags & (SerializationFlags.FixedType | SerializationFlags.PointerNeverNull);
					}
					else
					{
						hints = null;
					}

					return CreateInstance(hints, m_array_ExpectedType);
				}

				return SetValueAndDestroyInstance();
			}
Пример #6
0
			State CreateInstance(SerializationHintsAttribute hints, Type t)
			{
				State next = new State(m_parent, hints, t);

				m_next = next;
				next.m_prev = this;

				return next;
			}