Example #1
0
    public void Load(ref XmlReader reader)
    {
        print ("Loading Piece");

        float tempX = -1;
        float tempY = -1;
        float tempZ = -1;

        print ("Loading Piece");

        while(reader.NodeType != XmlNodeType.EndElement){

            reader.Read ();

            if (reader.Name == "Texture"){
                while(reader.NodeType != XmlNodeType.EndElement){
                    reader.Read ();
                    if(reader.NodeType == XmlNodeType.Text){
                        //texture.name = reader.Value;
                    }
                }
                //texture.name = reader.Value;
                print ("Loading texture");
            }

            reader.Read();
            if (reader.Name == "Direction"){
                while(reader.NodeType != XmlNodeType.EndElement){
                    reader.Read ();
                    if(reader.NodeType == XmlNodeType.Text){
                        direction = reader.Value;
                    }
                }
                print ("Loading direction");
            }

            reader.Read();
            if (reader.Name == "Type"){
                while(reader.NodeType != XmlNodeType.EndElement){
                    reader.Read ();
                    if(reader.NodeType == XmlNodeType.Text){
                        type = reader.Value;
                    }
                }
                print ("Loading type");
            }

            reader.Read();
            if(reader.Name == "Moves"){
                while(reader.NodeType != XmlNodeType.EndElement)
                {
                    reader.Read();

                }
            }
        }
    }
Example #2
0
    protected void UploadButton_Click(object sender, EventArgs e)
    {
        var path = @"C:\Temp\Upload";

        if (FileUpload.HasFile)
        {
            var filename = FileUpload.FileName;

            path += filename;

            FileUpload.SaveAs(path);

            UploadStatusLabel.Text = "File saved as " + filename;

            var reader = new XmlReader();
            string orderXml = reader.Read(path);
            var parser = new OrderParser();
            var orderItems = parser.Parse(orderXml);

            GridView.DataSource = new List<Order>(orderItems);
            GridView.DataBind();
        }
        else
        {
            UploadStatusLabel.Text = "You did not specify a file to upload.";
        }
    }
Example #3
0
 internal XDeclaration(XmlReader r)
 {
     _version = r.GetAttribute("version");
     _encoding = r.GetAttribute("encoding");
     _standalone = r.GetAttribute("standalone");
     r.Read();
 }
    // Use this for initialization
    void Start()
    {
        string last_element = "";
        int counter = 1;

        textAsset = (TextAsset) Resources.Load("XMLs/tea_dialog");
        reader = XmlReader.Create(new StringReader(textAsset.text));

        //pull in the animation names from the xml file
        while (reader.Read ()) {

            if(reader.NodeType == XmlNodeType.Element){

                while(reader.MoveToNextAttribute())
                {
                    if(reader.Name == "id")
                    {
                        //print (counter + " : " + reader.Value);
                        animIndices.Add (counter, reader.Value);
                        counter += 1;
                    }
                }

            }
        }

        //print out hash table, for testing purposes
        //printHashTable ();
    }
Example #5
0
    private bool _NextToken(XmlReader reader)
    {
        while (!reader.EOF && reader.Read() && !reader.IsStartElement())
            ;

        return !reader.EOF;
    }
Example #6
0
 internal XDocumentType(XmlReader r)
 {
     _name = r.Name;
     _publicId = r.GetAttribute("PUBLIC");
     _systemId = r.GetAttribute("SYSTEM");
     _internalSubset = r.Value;
     r.Read();
 }
Example #7
0
 public void OnSkillOver(GameObject gobject)
 {
     onOver = true;
     XmlReader xr = new XmlReader();
     var name = gobject.GetComponentInParent<Skill>().name;
     int item = int.Parse(gobject.name) - 1;
     info = xr.Read(xr.LoadFile("SkillsDescription"), name, item);
 }
Example #8
0
    public static void PrintNodesCore (XmlReader reader, Action onNode) {
        int count = 0;

        while (reader.Read()) {
            count += 1;
            onNode();
        }

        Console.WriteLine("// {0} node(s)", count);
    }
Example #9
0
 public override object ReadObject(XmlReader reader)
 {
     ArrayOfLoanStateCompositeType ArrayOfLoanStateCompositeTypeField = null;
     if (IsParentStartElement(reader, false, true))
     {
         ArrayOfLoanStateCompositeTypeField = new ArrayOfLoanStateCompositeType();
         reader.Read();
         LoanStateCompositeTypeDataContractSerializer LoanStateCompositeTypeDCS = new LoanStateCompositeTypeDataContractSerializer("LoanStateCompositeType", "http://schemas.datacontract.org/2004/07/", "http://schemas.datacontract.org/2004/07/");
         System.Collections.ArrayList LoanStateCompositeType_List = new System.Collections.ArrayList();
         for (int i = 0; (i > -1); i = (i + 1))
         {
             if (!IsChildStartElement(reader, "LoanStateCompositeType", false, false))
             {
                 ArrayOfLoanStateCompositeTypeField.LoanStateCompositeType = new LoanStateCompositeType[LoanStateCompositeType_List.Count];
                 LoanStateCompositeType_List.CopyTo(ArrayOfLoanStateCompositeTypeField.LoanStateCompositeType);
                 break;
             }
             LoanStateCompositeType_List.Add(((LoanStateCompositeType)(LoanStateCompositeTypeDCS.ReadObject(reader))));
         }
         reader.ReadEndElement();
     }
     return ArrayOfLoanStateCompositeTypeField;
 }
Example #10
0
 internal void ReadContentFrom(XmlReader r, LoadOptions o)
 {
     if ((o & (LoadOptions.SetBaseUri | LoadOptions.SetLineInfo)) == 0)
     {
         ReadContentFrom(r);
         return;
     }
     if (r.ReadState != ReadState.Interactive) throw new InvalidOperationException(SR.InvalidOperation_ExpectedInteractive);
     XContainer c = this;
     XNode n = null;
     NamespaceCache eCache = new NamespaceCache();
     NamespaceCache aCache = new NamespaceCache();
     string baseUri = (o & LoadOptions.SetBaseUri) != 0 ? r.BaseURI : null;
     IXmlLineInfo li = (o & LoadOptions.SetLineInfo) != 0 ? r as IXmlLineInfo : null;
     do
     {
         string uri = r.BaseURI;
         switch (r.NodeType)
         {
             case XmlNodeType.Element:
                 {
                     XElement e = new XElement(eCache.Get(r.NamespaceURI).GetName(r.LocalName));
                     if (baseUri != null && baseUri != uri)
                     {
                         e.SetBaseUri(uri);
                     }
                     if (li != null && li.HasLineInfo())
                     {
                         e.SetLineInfo(li.LineNumber, li.LinePosition);
                     }
                     if (r.MoveToFirstAttribute())
                     {
                         do
                         {
                             XAttribute a = new XAttribute(aCache.Get(r.Prefix.Length == 0 ? string.Empty : r.NamespaceURI).GetName(r.LocalName), r.Value);
                             if (li != null && li.HasLineInfo())
                             {
                                 a.SetLineInfo(li.LineNumber, li.LinePosition);
                             }
                             e.AppendAttributeSkipNotify(a);
                         } while (r.MoveToNextAttribute());
                         r.MoveToElement();
                     }
                     c.AddNodeSkipNotify(e);
                     if (!r.IsEmptyElement)
                     {
                         c = e;
                         if (baseUri != null)
                         {
                             baseUri = uri;
                         }
                     }
                     break;
                 }
             case XmlNodeType.EndElement:
                 {
                     if (c.content == null)
                     {
                         c.content = string.Empty;
                     }
                     // Store the line info of the end element tag.
                     // Note that since we've got EndElement the current container must be an XElement
                     XElement e = c as XElement;
                     Debug.Assert(e != null, "EndElement received but the current container is not an element.");
                     if (e != null && li != null && li.HasLineInfo())
                     {
                         e.SetEndElementLineInfo(li.LineNumber, li.LinePosition);
                     }
                     if (c == this) return;
                     if (baseUri != null && c.HasBaseUri)
                     {
                         baseUri = c.parent.BaseUri;
                     }
                     c = c.parent;
                     break;
                 }
             case XmlNodeType.Text:
             case XmlNodeType.SignificantWhitespace:
             case XmlNodeType.Whitespace:
                 if ((baseUri != null && baseUri != uri) ||
                     (li != null && li.HasLineInfo()))
                 {
                     n = new XText(r.Value);
                 }
                 else
                 {
                     c.AddStringSkipNotify(r.Value);
                 }
                 break;
             case XmlNodeType.CDATA:
                 n = new XCData(r.Value);
                 break;
             case XmlNodeType.Comment:
                 n = new XComment(r.Value);
                 break;
             case XmlNodeType.ProcessingInstruction:
                 n = new XProcessingInstruction(r.Name, r.Value);
                 break;
             case XmlNodeType.DocumentType:
                 n = new XDocumentType(r.LocalName, r.GetAttribute("PUBLIC"), r.GetAttribute("SYSTEM"), r.Value);
                 break;
             case XmlNodeType.EntityReference:
                 if (!r.CanResolveEntity) throw new InvalidOperationException(SR.InvalidOperation_UnresolvedEntityReference);
                 r.ResolveEntity();
                 break;
             case XmlNodeType.EndEntity:
                 break;
             default:
                 throw new InvalidOperationException(SR.Format(SR.InvalidOperation_UnexpectedNodeType, r.NodeType));
         }
         if (n != null)
         {
             if (baseUri != null && baseUri != uri)
             {
                 n.SetBaseUri(uri);
             }
             if (li != null && li.HasLineInfo())
             {
                 n.SetLineInfo(li.LineNumber, li.LinePosition);
             }
             c.AddNodeSkipNotify(n);
             n = null;
         }
     } while (r.Read());
 }
Example #11
0
 private void Foo(XmlReader reader)
 {
     reader.Read();
     Bar(reader.ReadSubtree());
 }
Example #12
0
    public void ParseContextSetupReply(XmlReader reader)
    {
        // verify node is "context_setup_reply
        if (reader.Name == "context_setup_reply")
        {
            while (reader.Read())
            {
                if (reader.NodeType == XmlNodeType.Element && reader.Name == "apiversion")
                {
                    csr.apiversion = reader.ReadElementContentAsString();
                    //UnityEngine.Debug.Log("apiversion=" + csr.apiversion);
                }
                if (reader.NodeType == XmlNodeType.Element && reader.Name == "setup_request_status")
                {
                    csr.setup_request_status = reader.ReadElementContentAsInt();
                    //UnityEngine.Debug.Log("setup_request_status=" + csr.setup_request_status);
                }
                if (reader.NodeType == XmlNodeType.Element && reader.Name == "context_uid")
                {
                    csr.context_uid = reader.ReadElementContentAsString();
					
#if SHOW_INIT
                    QuickInfoMsg msg = new QuickInfoMsg();
                    msg.title = "NLU STATUS";
                    msg.text = "NLU Initialized : " + CmdTime + " seconds";
                    msg.timeout = 2.0f;
                    QuickInfoDialog.GetInstance().PutMessage(msg);
#endif

                    Initialized = true;

                    //UnityEngine.Debug.Log("context_uid=" + csr.context_uid);
                }
            }
        }
    }
Example #13
0
    public void ParseUtteranceReply(XmlReader reader)
    {
        pur = new process_utterance_reply();

        // verify node is "context_setup_reply
        if (reader.Name == "process_utterance_reply")
        {
            while (reader.Read())
            {
                if (reader.NodeType == XmlNodeType.Element && reader.Name == "utterance_request_status")
                {
                    pur.utterance_request_status = reader.ReadElementContentAsInt();
#if DEBUG_REPLY
                    UnityEngine.Debug.Log("utterance status=" + pur.utterance_request_status);
#endif
                    // report error
                    if (pur.utterance_request_status < 0 && errorCallback != null)
                    {
		                //'utterance_request_status' indicates if utterance process is final or NLU server starts 
		                // 0: OK. the 'match_record' list contains the simulation command(s) for the utterance
		                // 1: NLU server executes 'clarifying NLU sub-session' (see "SiTEL-SMS API Reqs & Specs" document)
		                //-1: cannot process utterance
		                //-2: MLU not ready for utterance processing
		                //-3: missing utterance text
                        string error="none";
                        switch (pur.utterance_request_status)
                        {
                            case -1:
                                error = "error -1: cannot process utterance";
                                break;
                            case -2:
                                error = "error -2: MLU not ready for utterance processing";
                                break;
                            case -3:
                                error = "error -3: missing utterance text";
                                break;
                        }
                        errorCallback(error);
                    }
                }
                if (reader.NodeType == XmlNodeType.Element && reader.Name == "match_records")
                {
                    List<sim_command_param> parameters=null;
                    List<missing_sim_command_param> missing = null;
                    match_record record = null;

                    while (reader.Read())
                    {
#if DEBUG_REPLY
                        if (reader.NodeType == XmlNodeType.Element)
                            UnityEngine.Debug.Log("NODE_NAME=" + reader.Name + ", NODE_TYPE=" + reader.NodeType.ToString());
                        else if (reader.NodeType == XmlNodeType.EndElement)
                            UnityEngine.Debug.Log("NODE_END=" + reader.Name + ", NODE_TYPE=" + reader.NodeType.ToString());
                        else
                            UnityEngine.Debug.Log("NODE_TYPE=" + reader.NodeType.ToString());
#endif
                       
                        // match START element
                        if (reader.NodeType == XmlNodeType.Element && reader.Name == "match")
                        {
                            if (reader.IsEmptyElement == false)
                            {
                                record = new match_record();
                                if ( reader.MoveToAttribute("index") == false )
                                    UnityEngine.Debug.Log("CAN'T FIND INDEX!");
                                record.index = reader.ReadContentAsInt();
                                if ( reader.MoveToAttribute("sim_command") == false )
                                    UnityEngine.Debug.Log("CAN'T FIND SIM_COMMAND!");
                                record.sim_command = reader.ReadContentAsString();
                                if ( reader.MoveToAttribute("score") == false )
                                    UnityEngine.Debug.Log("CAN'T FIND SCORE!");
                                record.score = reader.ReadContentAsFloat();
                                if ( reader.MoveToAttribute("input") == false )
                                    UnityEngine.Debug.Log("CAN'T FIND INPUT!");
                                record.input = reader.ReadContentAsString();

#if DEBUG_REPLY
                                UnityEngine.Debug.Log("START MATCH : sim_command=" + record.sim_command);
#endif
                            }
                        }
                        // match END element
                        if (reader.NodeType == XmlNodeType.EndElement && reader.Name == "match")
                        {
                            if (reader.IsEmptyElement == false)
                            {
#if DEBUG_REPLY
                                UnityEngine.Debug.Log("END MATCH");
#endif

                                pur.match_records.Add(record);

                                // do callback here, we have a valid match!!
                                if (utteranceCallback != null)
                                    utteranceCallback(record); 

                                record.Debug();
                            }
                        }
                        // sim command parameters
                        if (reader.NodeType == XmlNodeType.Element && reader.Name == "sim_command_params")
                        {
                            record.parameters = new List<sim_command_param>();

                            if (reader.IsEmptyElement == false)
                            {
#if DEBUG_REPLY
                                UnityEngine.Debug.Log("SIM_COMMAND_PARAMS");
#endif
                            }
                        }
                        // sc_param
                        if (reader.NodeType == XmlNodeType.Element && reader.Name == "sc_param")
                        {
                            sim_command_param sc_param = new sim_command_param();

                            if (reader.IsEmptyElement == false)
                            {
                                if (reader.MoveToAttribute("mandatory") == false)
                                    UnityEngine.Debug.Log("CAN'T FIND MANDATORY!");
                                sc_param.mandatory = reader.ReadContentAsString();
                                if ( reader.MoveToAttribute("name") == false )
                                    UnityEngine.Debug.Log("CAN'T FIND NAME!");
                                sc_param.name = reader.ReadContentAsString();
                                // value
                                reader.Read();
                                sc_param.value = reader.Value.Trim();
                                // add it
                                record.parameters.Add(sc_param);
    
                                sc_param.Debug();
                            }
                        }
                        if (reader.NodeType == XmlNodeType.Element && reader.Name == "missing_sim_command_params")
                        {
                            record.missing_parameters = new List<missing_sim_command_param>();

                            if (reader.IsEmptyElement == false)
                            {
#if DEBUG_REPLY
                                UnityEngine.Debug.Log("MISSING_SIM_COMMAND_PARAMS");
#endif
                            }
                        }
                        if (reader.NodeType == XmlNodeType.Element && reader.Name == "missing_sc_param") 
                        {
                            if (reader.IsEmptyElement == false)
                            {
                                missing_sim_command_param sc_param = new missing_sim_command_param();
#if DEBUG_REPLY
                                if (reader.MoveToAttribute("mandatory") == false)
                                    UnityEngine.Debug.Log("MISSING CAN'T FIND MANDATORY!");
                                sc_param.mandatory = reader.ReadContentAsString();
                                if (reader.MoveToAttribute("name") == false)
                                    UnityEngine.Debug.Log("MISSING CAN'T FIND NAME!");
#endif
                                sc_param.name = reader.ReadContentAsString();
                                record.missing_parameters.Add(sc_param);

                                sc_param.Debug();
                            }
                        }
                        if (reader.NodeType == XmlNodeType.Element && reader.Name == "readback")
                        {
                            if (reader.IsEmptyElement == false)
                            {
                                reader.Read();
                                record.readback = reader.Value.Trim();
#if DEBUG_REPLY
                                UnityEngine.Debug.Log("READBACK=<" + record.readback + ">");
#endif
                            }
                        }
                        if (reader.NodeType == XmlNodeType.Element && reader.Name == "feedback")
                        {
                            if (reader.IsEmptyElement == false)
                            {
                                reader.Read();
                                record.feedback = reader.Value.Trim();
#if DEBUG_REPLY
                                UnityEngine.Debug.Log("FEEDBACK=<" + record.feedback + ">");
#endif
                            }
                        }
                        if (reader.NodeType == XmlNodeType.Element && reader.Name == "command_subject")
                        {
                            if (reader.IsEmptyElement == false)
                            {
                                reader.Read();
                                record.command_subject = reader.Value.Trim();
#if DEBUG_REPLY
                                UnityEngine.Debug.Log("SUBJECT=<" + record.command_subject + ">");
#endif
                            }
                        }
                    }
                }
            }
        }
    }
Example #14
0
 /// <summary>
 /// Reads the elements from the loaded xmldocument in LoadResources
 /// </summary>
 /// <param name='reader'>
 /// Reader.
 /// </param>
 private void ReadElements(XmlReader reader)
 {
     while (reader.Read())
     {
         switch (reader.NodeType)
         {
             case XmlNodeType.Element:
                 //If this is a chunk of data, then parse it
                 if (reader.Name == "data")
                 {
                     ReadData(reader);
                 }
                 break;
         }
     }
 }
Example #15
0
 internal XComment(XmlReader r)
 {
     value = r.Value;
     r.Read();
 }
	private static void readRelationSubtree(XmlReader subtree, List<OsmRelationMember> members, List<OsmTag> tags) {
		while (subtree.Read ()) {
			switch (subtree.Name) {
			case "member":
				EntityType type = EntityTypeMethods.fromString (subtree ["type"]);
				members.Add (new OsmRelationMember (long.Parse (subtree ["ref"]), type, subtree ["role"]));
				break;
			case "tag":
				tags.Add (new OsmTag (subtree ["k"], subtree ["v"]));
				break;
			}
		}
	}
Example #17
0
 public override object ReadObject(XmlReader reader)
 {
     BookCompositeType BookCompositeTypeField = null;
     if (IsParentStartElement(reader, false, true))
     {
         BookCompositeTypeField = new BookCompositeType();
         reader.Read();
         schemas.microsoft.com.Serialization.Arrays.ArrayOfstringDataContractSerializer AuthorsDCS = new schemas.microsoft.com.Serialization.Arrays.ArrayOfstringDataContractSerializer("Authors", "http://schemas.datacontract.org/2004/07/", "http://schemas.microsoft.com/2003/10/Serialization/Arrays");
         AuthorsDCS.BodyParts = this.BodyParts;
         BookCompositeTypeField.Authors = ((schemas.microsoft.com.Serialization.Arrays.ArrayOfstring)(AuthorsDCS.ReadObject(reader)));
         if (IsChildStartElement(reader, "Description", true, false))
         {
             reader.Read();
             BookCompositeTypeField.Description = reader.ReadString();
             reader.ReadEndElement();
         }
         if (IsChildStartElement(reader, "ID", false, false))
         {
             reader.Read();
             BookCompositeTypeField.ID = XmlConvert.ToInt32(reader.ReadString());
             reader.ReadEndElement();
         }
         if (IsChildStartElement(reader, "ISBN", true, false))
         {
             reader.Read();
             BookCompositeTypeField.ISBN = reader.ReadString();
             reader.ReadEndElement();
         }
         if (IsChildStartElement(reader, "Language", true, false))
         {
             reader.Read();
             BookCompositeTypeField.Language = reader.ReadString();
             reader.ReadEndElement();
         }
         if (IsChildStartElement(reader, "PublicationDate", false, false))
         {
             reader.Read();
             //BookCompositeTypeField.PublicationDate = XmlConvert.ToDateTime(reader.ReadString());
             BookCompositeTypeField.PublicationDate = LibraryTerminal.Utils.Parse(reader.ReadString());
             reader.ReadEndElement();
         }
         if (IsChildStartElement(reader, "Publisher", true, false))
         {
             reader.Read();
             BookCompositeTypeField.Publisher = reader.ReadString();
             reader.ReadEndElement();
         }
         schemas.microsoft.com.Serialization.Arrays.ArrayOfstringDataContractSerializer SubjectsDCS = new schemas.microsoft.com.Serialization.Arrays.ArrayOfstringDataContractSerializer("Subjects", "http://schemas.datacontract.org/2004/07/", "http://schemas.microsoft.com/2003/10/Serialization/Arrays");
         SubjectsDCS.BodyParts = this.BodyParts;
         BookCompositeTypeField.Subjects = ((schemas.microsoft.com.Serialization.Arrays.ArrayOfstring)(SubjectsDCS.ReadObject(reader)));
         if (IsChildStartElement(reader, "Title", true, false))
         {
             reader.Read();
             BookCompositeTypeField.Title = reader.ReadString();
             reader.ReadEndElement();
         }
         reader.ReadEndElement();
     }
     return BookCompositeTypeField;
 }
 private void Init()
 {
     try
     {
         XmlReaderSettings settings = new XmlReaderSettings();
         settings.IgnoreComments = true;
         settings.IgnoreWhitespace = true;
         System.IO.MemoryStream stream = new System.IO.MemoryStream(serializedManifest);
         reader = XmlReader.Create(stream, settings);
         if (reader.Read() && reader.Name == "provider")
         {
             guid = new Guid(reader.GetAttribute("guid"));
             name = reader.GetAttribute("name");
             fileName = reader.GetAttribute("resourceFileName");
         }
     }
     catch (Exception e)
     {
         Debug.Assert(false, "Exception during manifest parsing");
         name = "";
         error = e;
     }
     inited = true;
 }
Example #19
0
 internal XProcessingInstruction(XmlReader r)
 {
     target = r.Name;
     data = r.Value;
     r.Read();
 }
Example #20
0
 private void Bar(XmlReader reader)
 {
     reader.Read();
     string foo = reader.ReadOuterXml();
     CError.Compare(foo, "<device xmlns=\"http://www.test.com/\">        <thing>1</thing>    </device>",
         "<device xmlns=\"http://www.test.com/\"><thing>1</thing></device>", "mismatch");
 }
Example #21
0
        public override object ReadObject(XmlReader reader)
        {
            LoanStateCompositeType LoanStateCompositeTypeField = null;
            if (IsParentStartElement(reader, false, true))
            {
                LoanStateCompositeTypeField = new LoanStateCompositeType();
                reader.Read();
                if (IsChildStartElement(reader, "BookID", false, false))
                {
                    reader.Read();
                    LoanStateCompositeTypeField.BookID = XmlConvert.ToInt32(reader.ReadString());
                    reader.ReadEndElement();
                }
                if (IsChildStartElement(reader, "Description", true, false))
                {
                    reader.Read();
                    LoanStateCompositeTypeField.Description = reader.ReadString();
                    reader.ReadEndElement();
                }
                if (IsChildStartElement(reader, "ISBN", true, false))
                {
                    reader.Read();
                    LoanStateCompositeTypeField.ISBN = reader.ReadString();
                    reader.ReadEndElement();
                }
                if (IsChildStartElement(reader, "Language", true, false))
                {
                    reader.Read();
                    LoanStateCompositeTypeField.Language = reader.ReadString();
                    reader.ReadEndElement();
                }
                if (IsChildStartElement(reader, "LoanExpirationDate", false, false))
                {
                    reader.Read();
                    // LoanStateCompositeTypeField.LoanExpirationDate = XmlConvert.ToDateTime(reader.ReadString());
                    LoanStateCompositeTypeField.LoanExpirationDate = LibraryTerminal.Utils.Parse(reader.ReadString());

                    reader.ReadEndElement();
                }
                if (IsChildStartElement(reader, "LoanStartDate", false, false))
                {
                    reader.Read();
                    //  LoanStateCompositeTypeField.LoanStartDate = XmlConvert.ToDateTime(reader.ReadString());
                    LoanStateCompositeTypeField.LoanStartDate = LibraryTerminal.Utils.Parse(reader.ReadString());
                    reader.ReadEndElement();
                }
                if (IsChildStartElement(reader, "PublicationDate", false, false))
                {
                    reader.Read();
                   // LoanStateCompositeTypeField.PublicationDate = XmlConvert.ToDateTime(reader.ReadString());
                    LoanStateCompositeTypeField.PublicationDate = LibraryTerminal.Utils.Parse(reader.ReadString());
                    reader.ReadEndElement();
                }
                if (IsChildStartElement(reader, "Publisher", true, false))
                {
                    reader.Read();
                    LoanStateCompositeTypeField.Publisher = reader.ReadString();
                    reader.ReadEndElement();
                }
                if (IsChildStartElement(reader, "Title", true, false))
                {
                    reader.Read();
                    LoanStateCompositeTypeField.Title = reader.ReadString();
                    reader.ReadEndElement();
                }
                reader.ReadEndElement();
            }
            return LoanStateCompositeTypeField;
        }
Example #22
0
 public override object ReadObject(XmlReader reader)
 {
     LoanCompositeType LoanCompositeTypeField = null;
     if (IsParentStartElement(reader, false, true))
     {
         LoanCompositeTypeField = new LoanCompositeType();
         reader.Read();
         if (IsChildStartElement(reader, "BookID", false, false))
         {
             reader.Read();
             LoanCompositeTypeField.BookID = XmlConvert.ToInt32(reader.ReadString());
             reader.ReadEndElement();
         }
         if (IsChildStartElement(reader, "DeliveryDate", true, false))
         {
             reader.Read();
             //LoanCompositeTypeField.DeliveryDate = XmlConvert.ToDateTime(reader.ReadString());
             LoanCompositeTypeField.DeliveryDate = LibraryTerminal.Utils.Parse(reader.ReadString());
             reader.ReadEndElement();
         }
         if (IsChildStartElement(reader, "ExpirationDate", false, false))
         {
             reader.Read();
             //LoanCompositeTypeField.ExpirationDate = XmlConvert.ToDateTime(reader.ReadString());
             LoanCompositeTypeField.ExpirationDate = LibraryTerminal.Utils.Parse(reader.ReadString());
             reader.ReadEndElement();
         }
         if (IsChildStartElement(reader, "StartDate", false, false))
         {
             reader.Read();
             //LoanCompositeTypeField.StartDate = XmlConvert.ToDateTime(reader.ReadString());
             LoanCompositeTypeField.StartDate = LibraryTerminal.Utils.Parse(reader.ReadString());
             reader.ReadEndElement();
         }
         if (IsChildStartElement(reader, "UserID", false, false))
         {
             reader.Read();
             LoanCompositeTypeField.UserID = XmlConvert.ToInt32(reader.ReadString());
             reader.ReadEndElement();
         }
         reader.ReadEndElement();
     }
     return LoanCompositeTypeField;
 }
	static void AddElementToList(string in_currentPathInProj, XmlReader in_reader, AssetType in_type, LinkedList<AkWwiseProjectData.PathElement> in_pathAndIcons, int in_wwuIndex)
	{
		if (in_type.RootDirectoryName == "Events" || in_type.RootDirectoryName == "Master-Mixer Hierarchy" || in_type.RootDirectoryName == "SoundBanks")
		{
			AkWwiseProjectData.Event valueToAdd = new AkWwiseProjectData.Event();
			
			valueToAdd.Name = in_reader.GetAttribute("Name");
			valueToAdd.Guid = new Guid(in_reader.GetAttribute("ID")).ToByteArray();
			valueToAdd.ID = (int)AkUtilities.ShortIDGenerator.Compute(valueToAdd.Name);
			valueToAdd.Path = in_type.RootDirectoryName == "Master-Mixer Hierarchy" ? in_currentPathInProj : Path.Combine(in_currentPathInProj, valueToAdd.Name);
			valueToAdd.PathAndIcons = new List<AkWwiseProjectData.PathElement>(in_pathAndIcons);
			
			if (in_type.RootDirectoryName == "Events")
			{
				valueToAdd.PathAndIcons.Add(new AkWwiseProjectData.PathElement(valueToAdd.Name, AkWwiseProjectData.WwiseObjectType.EVENT));
				AkWwiseProjectInfo.GetData().EventWwu[in_wwuIndex].List.Add(valueToAdd);
			}
			else if (in_type.RootDirectoryName == "SoundBanks")
			{
				valueToAdd.PathAndIcons.Add(new AkWwiseProjectData.PathElement(valueToAdd.Name, AkWwiseProjectData.WwiseObjectType.SOUNDBANK));
				AkWwiseProjectInfo.GetData().BankWwu[in_wwuIndex].List.Add(valueToAdd);
			}
			else
			{
				AkWwiseProjectInfo.GetData().AuxBusWwu[in_wwuIndex].List.Add(valueToAdd);
			}
			
			in_reader.Read();
		}
		else if (in_type.RootDirectoryName == "States" || in_type.RootDirectoryName == "Switches")
		{
			var XmlElement = XNode.ReadFrom(in_reader) as XElement;
			
			AkWwiseProjectData.GroupValue valueToAdd = new AkWwiseProjectData.GroupValue();
			AkWwiseProjectData.WwiseObjectType SubElemIcon;
			valueToAdd.Name = XmlElement.Attribute("Name").Value;
			valueToAdd.Guid = new Guid(XmlElement.Attribute("ID").Value).ToByteArray();
			valueToAdd.ID = (int)AkUtilities.ShortIDGenerator.Compute(valueToAdd.Name);
			valueToAdd.Path = Path.Combine(in_currentPathInProj, valueToAdd.Name);
			valueToAdd.PathAndIcons = new List<AkWwiseProjectData.PathElement>(in_pathAndIcons);
			
			if (in_type.RootDirectoryName == "States")
			{
				SubElemIcon = AkWwiseProjectData.WwiseObjectType.STATE;
				valueToAdd.PathAndIcons.Add(new AkWwiseProjectData.PathElement(valueToAdd.Name, AkWwiseProjectData.WwiseObjectType.STATEGROUP));
			}
			else
			{
				SubElemIcon = AkWwiseProjectData.WwiseObjectType.SWITCH;
				valueToAdd.PathAndIcons.Add(new AkWwiseProjectData.PathElement(valueToAdd.Name, AkWwiseProjectData.WwiseObjectType.SWITCHGROUP));
			}
			
			XName ChildrenList = XName.Get("ChildrenList");
			XName ChildElem = XName.Get(in_type.ChildElementName);
			
			XElement ChildrenElement = XmlElement.Element(ChildrenList);
			if (ChildrenElement != null)
			{
				foreach (var element in ChildrenElement.Elements(ChildElem))
				{
					if (element.Name == in_type.ChildElementName)
					{
						string elementName = element.Attribute("Name").Value;
						valueToAdd.values.Add(elementName);
						valueToAdd.ValueGuids.Add(new AkWwiseProjectData.ByteArrayWrapper( new Guid(element.Attribute("ID").Value).ToByteArray()));
						valueToAdd.valueIDs.Add((int)AkUtilities.ShortIDGenerator.Compute(elementName));
						valueToAdd.ValueIcons.Add(new AkWwiseProjectData.PathElement(elementName, SubElemIcon));
					}
				}
			}
			
			if (in_type.RootDirectoryName == "States")
			{
				AkWwiseProjectInfo.GetData().StateWwu[in_wwuIndex].List.Add(valueToAdd);
			}
			else
			{
				AkWwiseProjectInfo.GetData().SwitchWwu[in_wwuIndex].List.Add(valueToAdd);
			}
		}
		else
		{
			Debug.LogError("WwiseUnity: Unknown asset type in WWU parser");
		}
	}    
Example #24
0
 public override object ReadObject(XmlReader reader)
 {
     UserCompositeType UserCompositeTypeField = null;
     if (IsParentStartElement(reader, false, true))
     {
         UserCompositeTypeField = new UserCompositeType();
         reader.Read();
         if (IsChildStartElement(reader, "Delay", false, false))
         {
             reader.Read();
             UserCompositeTypeField.Delay = XmlConvert.ToBoolean(reader.ReadString());
             reader.ReadEndElement();
         }
         if (IsChildStartElement(reader, "FirstName", true, false))
         {
             reader.Read();
             UserCompositeTypeField.FirstName = reader.ReadString();
             reader.ReadEndElement();
         }
         if (IsChildStartElement(reader, "ID", false, false))
         {
             reader.Read();
             UserCompositeTypeField.ID = XmlConvert.ToInt32(reader.ReadString());
             reader.ReadEndElement();
         }
         if (IsChildStartElement(reader, "LastName", true, false))
         {
             reader.Read();
             UserCompositeTypeField.LastName = reader.ReadString();
             reader.ReadEndElement();
         }
         if (IsChildStartElement(reader, "MaxLoansReached", false, false))
         {
             reader.Read();
             UserCompositeTypeField.MaxLoansReached = XmlConvert.ToBoolean(reader.ReadString());
             reader.ReadEndElement();
         }
         reader.ReadEndElement();
     }
     return UserCompositeTypeField;
 }
    private void ComputeFieldInfo(DynamicTraceEventData template, XmlReader reader)
    {
        List<string> payloadNames = new List<string>();
        List<DynamicTraceEventData.PayloadFetch> payloadFetches = new List<DynamicTraceEventData.PayloadFetch>();
        short offset = 0;
        while (reader.Read())
        {
            if (reader.Name == "data")
            {
                Type type = GetTypeForManifestTypeName(reader.GetAttribute("inType"));
                short size = DynamicTraceEventData.SizeOfType(type);

                // TODO There is disagreement in what win:Boolean means.  Currently it is serialized as 1 byte
                // by manage code.  However all other windows tools assume it is 4 bytes.   we are likely
                // to change this to align with windows at some point.

                payloadNames.Add(reader.GetAttribute("name"));
                payloadFetches.Add(new DynamicTraceEventData.PayloadFetch(offset, size, type));
                if (offset >= 0)
                {
                    Debug.Assert(size != 0);
                    if (size >= 0)
                        offset += size;
                    else
                        offset = short.MinValue;
                }
            }
        }
        template.payloadNames = payloadNames.ToArray();
        template.payloadFetches = payloadFetches.ToArray();
    }
Example #26
0
        public override object ReadObject(XmlReader reader)
        {
            ArrayOfstring ArrayOfstringField = null;
            if (IsParentStartElement(reader, false, true))
            {
                ArrayOfstringField = new ArrayOfstring();
                reader.Read();

                System.Collections.ArrayList string_List = new System.Collections.ArrayList();
                for (int i = 0; (i > -1); i = (i + 1))
                {
                    if (!IsChildStartElement(reader, "string", false, false))
                    {
                        ArrayOfstringField.STRING = new string[string_List.Count];
                        string_List.CopyTo(ArrayOfstringField.STRING);
                        break;
                    }
                    string_List.Add(ReadString(reader));
                }
                reader.ReadEndElement();
            }
            return ArrayOfstringField;
        }
	private static void readWaySubtree(XmlReader subtree, List<OsmNodeReference> references, List<OsmTag> tags) {
		while (subtree.Read ()) {
			switch (subtree.Name) {
			case "tag":
				tags.Add (new OsmTag (subtree ["k"], subtree ["v"]));
				break;
			case "nd":
				references.Add (new OsmNodeReference (long.Parse (subtree ["ref"])));
				break;
			}
		}
	}
Example #28
0
 public string ReadString(XmlReader reader)
 {
     reader.Read();
     string s = reader.ReadString();
     reader.ReadEndElement();
     return s;
 }
	private static void readNodeSubtree(XmlReader subtree, List<OsmTag> tags) {
		while (subtree.Read ()) {
			switch (subtree.Name) {
			case "tag":
				tags.Add (new OsmTag (subtree ["k"], subtree ["v"]));
				break;
			}
		}
	}
Example #30
0
                public StackPanel( CreateParams parentParams, XmlReader reader )
                {
                    Initialize( );

                    // Always get our style first
                    mStyle = parentParams.Style;
                    Styles.Style.ParseStyleAttributesWithDefaults( reader, ref mStyle, ref ControlStyles.mStackPanel );

                    // check for attributes we support
                    RectangleF bounds = new RectangleF( );
                    SizeF parentSize = new SizeF( parentParams.Width, parentParams.Height );
                    ParseCommonAttribs( reader, ref parentSize, ref bounds );

                    // Get margins and padding
                    RectangleF padding;
                    RectangleF margin;
                    GetMarginsAndPadding( ref mStyle, ref parentSize, ref bounds, out margin, out padding );

                    // apply margins to as much of the bounds as we can (bottom must be done by our parent container)
                    ApplyImmediateMargins( ref bounds, ref margin, ref parentSize );
                    Margin = margin;

                    // check for border styling
                    int borderPaddingPx = 0;
                    if ( mStyle.mBorderColor.HasValue )
                    {
                        BorderView.BorderColor = mStyle.mBorderColor.Value;
                    }

                    if( mStyle.mBorderRadius.HasValue )
                    {
                        BorderView.CornerRadius = mStyle.mBorderRadius.Value;
                    }

                    if( mStyle.mBorderWidth.HasValue )
                    {
                        BorderView.BorderWidth = mStyle.mBorderWidth.Value;
                        borderPaddingPx = (int)Rock.Mobile.Graphics.Util.UnitToPx( mStyle.mBorderWidth.Value + PrivateNoteConfig.BorderPadding );
                    }

                    if( mStyle.mBackgroundColor.HasValue )
                    {
                        BorderView.BackgroundColor = mStyle.mBackgroundColor.Value;
                    }
                    //

                    // now calculate the available width based on padding. (Don't actually change our width)
                    float availableWidth = bounds.Width - padding.Left - padding.Width - (borderPaddingPx * 2);

                    // now read what our children's alignment should be
                    // check for alignment
                    string result = reader.GetAttribute( "ChildAlignment" );
                    if( string.IsNullOrEmpty( result ) == false )
                    {
                        switch( result )
                        {
                            case "Left":
                            {
                                ChildHorzAlignment = Alignment.Left;
                                break;
                            }
                            case "Right":
                            {
                                ChildHorzAlignment = Alignment.Right;
                                break;
                            }
                            case "Center":
                            {
                                ChildHorzAlignment = Alignment.Center;
                                break;
                            }
                            default:
                            {
                                ChildHorzAlignment = mStyle.mAlignment.Value;
                                break;
                            }
                        }
                    }
                    else
                    {
                        // if it wasn't specified, use left alignment.
                        ChildHorzAlignment = Alignment.Left;
                    }

                    // Parse Child Controls
                    bool finishedParsing = false;
                    while( finishedParsing == false && reader.Read( ) )
                    {
                        switch( reader.NodeType )
                        {
                            case XmlNodeType.Element:
                            {
                                // let each child have our available width.
                                Style style = new Style( );
                                style = mStyle;
                                style.mAlignment = ChildHorzAlignment;
                                IUIControl control = Parser.TryParseControl( new CreateParams( this, availableWidth, parentParams.Height, ref style ), reader );
                                if( control != null )
                                {
                                    ChildControls.Add( control );
                                }
                                break;
                            }

                            case XmlNodeType.EndElement:
                            {
                                // if we hit the end of our label, we're done.
                                //if( reader.Name == "StackPanel" || reader.Name == "SP" )
                                if( ElementTagMatches( reader.Name ) )
                                {
                                    finishedParsing = true;
                                }

                                break;
                            }
                        }
                    }

                    LayoutStackPanel( bounds, padding.Left, padding.Top, availableWidth, padding.Height, borderPaddingPx );
                }