Ejemplo n.º 1
0
        internal Sitemap(REST aRest, System.IO.BinaryReader aReader)
        {
            Name = aReader.ReadString();
            Link = new Uri(aReader.ReadString());
            Homepage = new Uri(aReader.ReadString());

            var count = aReader.ReadInt32();
            for (var idx = 0; idx < count; ++idx)
            {
                Item item;
                if (aRest.Items.TryGetValue(aReader.ReadString(), out item))
                    Items[item.Name] = item;
            }

            Page page;
            count = aReader.ReadInt32();
            for (var idx = 0; idx < count; ++idx)
            {
                if (aRest.Pages.TryGetValue(aReader.ReadString(), out page))
                    Pages[page.Id] = page;
            }

            if (aRest.Pages.TryGetValue(aReader.ReadString(), out page))
                Page = page;
        }
Ejemplo n.º 2
0
 public override void ReadXml(System.Xml.Linq.XElement element)
 {
     X = new DrawingExpression(this, "Center X =", element.ReadString("X"));
     Y = new DrawingExpression(this, "Center Y =", element.ReadString("Y"));
     R = new DrawingExpression(this, "Radius =", element.ReadString("R"));
     base.ReadXml(element);
 }
		public void Read(System.IO.BinaryReader reader)
		{
			// read the Id from string format
			string guid = reader.ReadString();
			Guid parsedId;
			if (Guid.TryParse(guid, out parsedId))
			{
				Id = parsedId;
			}
			else
			{
				Id = Guid.NewGuid();
			}

			// read the name
			Name = reader.ReadString();

			// read the Contacts
			Contacts = new List<Contact>();
			int contactsCount = reader.ReadInt32();
			if (contactsCount > 0)
			{
				for (int i = 0; i < contactsCount; ++i)
				{
					var contact = new Contact();
					contact.Read(reader);
					Contacts.Add(contact);
				}
			}
		}
Ejemplo n.º 4
0
 internal Texture2D( Scene _Owner, System.IO.BinaryReader _Reader )
 {
     m_Owner = _Owner;
     m_ID = _Reader.ReadInt32();
     m_URL = _Reader.ReadString();
     m_OpacityURL = _Reader.ReadString();
 }
Ejemplo n.º 5
0
  /// <summary>
  /// deserialize from the reader to recreate the struct
  /// </summary>
  /// <param name="r">BinaryReader</param>
  void IBinarySerialize.Read(System.IO.BinaryReader r)
  {
    _delimiter = r.ReadString();
    _accumulator = new StringBuilder(r.ReadString());

    if (_accumulator.Length != 0) this.IsNull = false;
  }
		public void Read(System.IO.BinaryReader reader)
		{
			// read the name
			Name = reader.ReadString();

			// read the number
			Number = reader.ReadString();
		}
Ejemplo n.º 7
0
 public void SetDataFrom(System.IO.BinaryReader reader)
 {
     CorrelationId = new Guid(reader.ReadString());
     Port = reader.ReadInt32();
     NUnitTestRunner = reader.ReadString();
     MsTestRunner = reader.ReadString();
     LoggingEnabled = reader.ReadBoolean();
     StartedPaused = reader.ReadBoolean();
 }
Ejemplo n.º 8
0
 public override object Deserialize(System.IO.BinaryReader binaryReader)
 {
     bool hasValue = binaryReader.ReadBoolean ();
     if (!hasValue)
         return null;
     int typeID = binaryReader.ReadByte ();
     switch (typeID) {
     case 1:
         return binaryReader.ReadBoolean ();
     case 2:
         return binaryReader.ReadByte ();
     case 128:
         return binaryReader.ReadSByte ();
     case 3:
         return binaryReader.ReadInt16 ();
     case 129:
         return binaryReader.ReadUInt16 ();
     case 4:
         return binaryReader.ReadInt32 ();
     case 130:
         return binaryReader.ReadUInt32 ();
     case 5:
         return binaryReader.ReadInt64 ();
     case 131:
         return binaryReader.ReadUInt64 ();
     case 9:
         return binaryReader.ReadDouble ();
     case 16:
         return binaryReader.ReadString ();
     case 144:
         return binaryReader.ReadChar ();
     case 24:
         return new DateTime (binaryReader.ReadInt64 ());
     case 32:
         return new Guid (binaryReader.ReadBytes (16));
     case 36:
         return binaryReader.ReadBytes (binaryReader.ReadInt32 ());
     case 37:
         {
             int count = binaryReader.ReadInt32 ();
             string[] r = new string[count];
             for (int n = 0; n != count; n++)
                 r [n] = binaryReader.ReadString ();
             return r;
         }
     case 38:
         {
             int count = binaryReader.ReadInt32 ();
             long[] r = new long[count];
             for (int n = 0; n != count; n++)
                 r [n] = binaryReader.ReadInt64 ();
             return r;
         }
     default:
         throw new Exception (string.Format ("Serialization for type <{0}> is not supported", typeID));
     }
 }
Ejemplo n.º 9
0
    /// <summary>
    /// deserialize from the reader to recreate the struct
    /// </summary>
    /// <param name="reader">BinaryReader</param>
    void IBinarySerialize.Read(System.IO.BinaryReader reader)
    {
        this.delimiter = reader.ReadString();
        this.accumulator = new StringBuilder(reader.ReadString());

        if (this.accumulator.Length != 0)
        {
            this.IsNull = false;
        }
    }
Ejemplo n.º 10
0
 internal static Bestilling Load(System.IO.BinaryReader br)
 {
     Bestilling best = new Bestilling();
     best.koli = br.ReadInt32();
     best.fraktnr = br.ReadInt32();
     best.sender = br.ReadString();
     best.mottakerpers = br.ReadString();
     best.transportertav = br.ReadString();
     best.sendt = DateTime.Parse(br.ReadString());
     return best;
 }
        public override object Deserialize(Type type, System.IO.BinaryReader reader)
        {
            if (typeof(PrimaryCacheKey) == type)
            {
                var uri = reader.ReadString();
                var method = reader.ReadString();

                return new PrimaryCacheKey(uri, method);
            }

            throw new NotImplementedException();
        }
Ejemplo n.º 12
0
 public void ReadFrom(System.Xml.XmlReader x)
 {
     while(x.Read())
         switch (x.LocalName)
         {
             case "CompilerArg":
                 CompilerArguments = x.ReadString();
                 break;
             case "LinkerArgs":
                 LinkerArguments = x.ReadString();
                 break;
         }
 }
Ejemplo n.º 13
0
        public Lesson(System.IO.BinaryReader reader)
        {
            DayIndex = reader.ReadByte();
            PeriodIndex = reader.ReadByte();
            YearIndex = reader.ReadByte();
            FormIndex = reader.ReadByte();

            TeacherAbbreviation = reader.ReadString();
            SubjectAbbreviation = reader.ReadString();
            RoomCode = reader.ReadString();
            homeworkAmount = reader.ReadByte();
            invisible = reader.ReadBoolean();
            locked = reader.ReadBoolean();
        }
Ejemplo n.º 14
0
        public void ReadXml(System.Xml.XmlReader reader)
        {
            if (reader.LocalName != "argument" && !reader.ReadToDescendant("argument"))
                throw new InvalidDataException();

            var dict = new Dictionary<string, Action>()
            {
                {"name", () => this.Name = reader.ReadString()},
                {"direction", () => this.Direction = reader.ReadString()},
                {"relatedStateVariable", () => this.RelatedStateVariable = reader.ReadString()}
            };

            XmlHelper.ParseXml(reader, dict);
        }
Ejemplo n.º 15
0
        public override void Load(System.Xml.XmlReader reader)
        {
            string accountGroupNameBuffer = null;
            List<Command> commandBuffer = new List<Command>();

            while (reader.Read())
            {
                var content = reader.MoveToContent();
                if (content == System.Xml.XmlNodeType.Element)
                {
                    if (reader.Name == "AccountGroup")
                    {
                        if (accountGroupNameBuffer != null)
                            throw new Exception("AccountGroup nodes cannot be nested");

                        accountGroupNameBuffer = reader.GetAttribute("name");
                        commandBuffer.Clear();
                    }
                    else if (reader.Name == "Command")
                    {
                        if (accountGroupNameBuffer == null)
                            throw new Exception("Command nodes cannot be nested in non-AccountGroup nodes");

                        string commandName = reader.ReadString();
                        commandBuffer.Add(Command.GetCommand(commandName));
                        if (commandBuffer[commandBuffer.Count - 1] == null)
                            throw new Exception("Command '" + commandName + "' not found");
                    }
                    else if (reader.Name == "Account")
                    {
                        if (accountGroupNameBuffer != null)
                            throw new Exception("Account nodes cannot be nested in AccountGroup nodes");

                        string group = reader.GetAttribute("group");
                        string accountName = reader.ReadString();
                        accounts.Add(accountName, group);
                    }
                }
                else if (content == System.Xml.XmlNodeType.EndElement)
                {
                    if (reader.Name == "AccountGroup")
                    {
                        if (accountGroupNameBuffer != null)
                            accountGroups.Add(accountGroupNameBuffer, commandBuffer.ToArray());

                        accountGroupNameBuffer = null;
                    }
                }
            }
        }
Ejemplo n.º 16
0
        public void ReadXml(System.Xml.XmlReader reader)
        {
            if (reader.LocalName != "stateVariable" && !reader.ReadToDescendant("stateVariable"))
                throw new InvalidDataException();

            if (reader.HasAttributes)
                this.SendEvents = ((reader.GetAttribute("sendEvents") ?? "no") == "yes");

            XmlHelper.ParseXml(reader, new XmlParseSet
            {
                {"name", () => this.Name = reader.ReadString()},
                {"dataType", () => this.DataType = reader.ReadString()}
            });
        }
        /// <summary>
        /// Lê comando.
        /// </summary>
        /// <param name="p_reader">Objeto XML.</param>
        private void ReadCommand(System.Xml.XmlReader p_reader)
        {
            System.Xml.XmlReader v_item;

            this.v_cmd = new Spartacus.Database.Command();

            while (p_reader.Read())
            {
                if (p_reader.IsStartElement())
                {
                    switch (p_reader.Name)
                    {
                        case "sql":
                            this.v_cmd.v_text = p_reader.ReadString();
                            break;
                        case "parameter":
                            v_item = p_reader.ReadSubtree();
                            this.ReadParameter(v_item);
                            v_item.Close();
                            break;
                        default:
                            break;
                    }
                }
            }
        }
Ejemplo n.º 18
0
Archivo: CDATA.cs Proyecto: xqgzh/Z
        /// <summary>
        /// ReadXml
        /// </summary>
        /// <param name="reader"></param>
        void IXmlSerializable.ReadXml(System.Xml.XmlReader reader)
        {
            //(@update 04-nov-2005, vedi errata korrige)

            this.text = reader.ReadString();
            //reader.Read()
        }
Ejemplo n.º 19
0
        public override void ReadXML(System.Xml.XmlReader input)
        {
            input.ReadToDescendant("min");
            var s = input.ReadString().Split(new char[] { ',' });
            if (s.Length != 3) throw new FormatException("Bounding box vector value formatted incorrectly.");
            this.MinX = float.Parse(s[0].Trim());
            this.MinY = float.Parse(s[1].Trim());
            this.MinZ = float.Parse(s[2].Trim());

            input.ReadToNextSibling("max");
            s = input.ReadString().Split(new char[] { ',' });
            if (s.Length != 3) throw new FormatException("Bounding box vector value formatted incorrectly.");
            this.MaxX = float.Parse(s[0].Trim());
            this.MaxY = float.Parse(s[1].Trim());
            this.MaxZ = float.Parse(s[2].Trim());
        }
Ejemplo n.º 20
0
        public override void Deserialize(System.IO.BinaryReader reader)
        {
            base.Deserialize(reader);

            Speed = reader.ReadSingle();
            FirstMarker = reader.ReadString();
        }
Ejemplo n.º 21
0
    /// <summary>
    /// Generates an object from its XML representation.
    /// </summary>
    /// <param name="reader">The <see cref="XmlReader" /> stream from which the object is deserialized.</param>
    public void ReadXml(System.Xml.XmlReader reader)
    {
      // Read the opening tag of the encapsulating element
      reader.ReadStartElement();

      reader.ReadStartElement("body");
      this.Body = reader.ReadString();
      reader.ReadEndElement();

      reader.ReadStartElement("app-id");
      this.AppId = reader.ReadString();
      reader.ReadEndElement();

      // Read the end tag of the encapsulating element
      reader.ReadEndElement();
    }
Ejemplo n.º 22
0
        public override void Deserialize(System.IO.BinaryReader reader)
        {
            base.Deserialize(reader);

            ParticleTemplate = new Particle();
            ParticleTemplate.Template = true;

            ParticleTemplate.Color = new Color(reader.ReadByte(), reader.ReadByte(), reader.ReadByte(), reader.ReadByte());
            ParticleTemplate.Texture = Texture2D.FromStream(Engine.graphicsDevice, System.IO.File.OpenRead(reader.ReadString()));

            ParticleTemplate.Velocity = new Vector2(reader.ReadSingle(), reader.ReadSingle());

            ParticleTemplate.FadeColor = new Color(reader.ReadByte(), reader.ReadByte(), reader.ReadByte(), reader.ReadByte());
            ParticleTemplate.FadeStartTime = reader.ReadInt32();
            ParticleTemplate.FadeTime = reader.ReadInt32();

            ParticleTemplate.Rotation = reader.ReadInt32();
            ParticleTemplate.RotationSpeed = reader.ReadInt32();

            InitialVelocity = new Vector2(reader.ReadSingle(), reader.ReadSingle());
            InitialRandom = new Vector2(reader.ReadSingle(), reader.ReadSingle());

            Time = reader.ReadInt32();
            Amount = reader.ReadInt32();

            StartEnabled = reader.ReadBoolean();
        }
Ejemplo n.º 23
0
        public override void Deserialize(System.IO.BinaryReader reader)
        {
            base.Deserialize(reader);

            Stop = reader.ReadBoolean();
            NextMarker = reader.ReadString();
        }
Ejemplo n.º 24
0
        /// <summary>
        /// Creates a scene node from a stream
        /// </summary>
        /// <param name="_Owner"></param>
        /// <param name="_Parent"></param>
        /// <param name="_Reader"></param>
        internal Node( Scene _Owner, Node _Parent, System.IO.BinaryReader _Reader )
        {
            m_Owner = _Owner;

            //			m_NodeType = _Reader.ReadInt32();	// Don't read back the node type as it has already been consumed by the parent
            m_ID = _Reader.ReadInt32();
            m_Owner.RegisterNodeID( this );
            m_Name = _Reader.ReadString();

            m_Parent = _Parent;
            if ( _Parent != null )
                m_Parent.AddChild( this );

            // Read the matrix
            m_Local2Parent.m[0,0] = _Reader.ReadSingle();
            m_Local2Parent.m[0,1] = _Reader.ReadSingle();
            m_Local2Parent.m[0,2] = _Reader.ReadSingle();
            m_Local2Parent.m[0,3] = _Reader.ReadSingle();
            m_Local2Parent.m[1,0] = _Reader.ReadSingle();
            m_Local2Parent.m[1,1] = _Reader.ReadSingle();
            m_Local2Parent.m[1,2] = _Reader.ReadSingle();
            m_Local2Parent.m[1,3] = _Reader.ReadSingle();
            m_Local2Parent.m[2,0] = _Reader.ReadSingle();
            m_Local2Parent.m[2,1] = _Reader.ReadSingle();
            m_Local2Parent.m[2,2] = _Reader.ReadSingle();
            m_Local2Parent.m[2,3] = _Reader.ReadSingle();
            m_Local2Parent.m[3,0] = _Reader.ReadSingle();
            m_Local2Parent.m[3,1] = _Reader.ReadSingle();
            m_Local2Parent.m[3,2] = _Reader.ReadSingle();
            m_Local2Parent.m[3,3] = _Reader.ReadSingle();

            // Read specific data
            LoadSpecific( _Reader );

            // Read children
            int	ChildrenCount = _Reader.ReadInt32();
            for ( int ChildIndex=0; ChildIndex < ChildrenCount; ChildIndex++ )
            {
                NODE_TYPE	ChildType = (NODE_TYPE) _Reader.ReadByte();
                switch ( ChildType )
                {
                case NODE_TYPE.NODE:
                    new Node( _Owner, this, _Reader );
                    break;

                case NODE_TYPE.MESH:
                    new Mesh( _Owner, this, _Reader );
                    break;

                case NODE_TYPE.LIGHT:
                    new Light( _Owner, this, _Reader );
                    break;

                case NODE_TYPE.CAMERA:
                    new Camera( _Owner, this, _Reader );
                    break;
                }
            }
        }
Ejemplo n.º 25
0
        public override void Deserialize(System.IO.BinaryReader reader)
        {
            base.Deserialize(reader);

            Text = reader.ReadString();
            Color = new Color(reader.ReadByte(), reader.ReadByte(), reader.ReadByte(), reader.ReadByte());
            DisplayTime = reader.ReadInt32();
        }
Ejemplo n.º 26
0
 public bool UnpersistExportEdgeAttributes(System.Xml.XmlReader reader)
 {
     // Assumes reader has started the read of element "ExportEdgeAttributes"
     reader.ReadStartElement(ExportNetworkParamBag._ExportEdgeAttributes_ParamName);
     string valStr = reader.ReadString();
     reader.ReadEndElement();
     return XmlConvert.ToBoolean(valStr);
 }
Ejemplo n.º 27
0
 public override void ReadXML(System.Xml.XmlReader input)
 {
     var tid = input.GetAttribute("tableid");
     var iid = input.GetAttribute("instanceid");
     this.TableId = tid==null ? 0 : SporeMaster.NameRegistry.Files.toHash( tid );
     this.InstanceId = iid==null ? 0 : SporeMaster.NameRegistry.Files.toHash( iid );
     this.PlaceholderText = input.ReadString();
 }
Ejemplo n.º 28
0
 /// <summary>
 /// Assumes the reader is right at the start element with the name <paramref name="startElName"/>
 /// and reads in the value and end element and returns it as an integer.  If the element value is invalid then an
 /// exception is thrown there is no default.
 /// </summary>
 /// <param name="reader">System.Xml.XmlReader</param>
 /// <param name="startElName">The name of the element containing a string value to be read</param>
 /// <returns>string</returns>
 public string UnpersistString(System.Xml.XmlReader reader, string startElName)
 {
     // Assumes reader has started the read of element startElName
     reader.ReadStartElement(startElName);
     string valStr = reader.ReadString();
     reader.ReadEndElement();
     return valStr;
 }
Ejemplo n.º 29
0
 public string UnpersistFileName(System.Xml.XmlReader reader)
 {
     // Assumes reader has started the read of element "FileNameValue"
     reader.ReadStartElement(ImportNetworkParamBag._FileName_ParamName);
     string valStr = reader.ReadString();
     reader.ReadEndElement();
     return valStr;
 }
Ejemplo n.º 30
0
        public void DeserializePacket(System.IO.BinaryReader reader)
        {
            Version = reader.ReadString();

            var packetCount = reader.ReadInt32();

            for (var i = 0; i < packetCount; i++)
                CustomPackets.Add(reader.ReadInt16());
        }