Пример #1
0
 public void ExecuteSaveRequest()
 {
     if (isEnabled)
     {
         DataValue = CreateSaveValue();
         FILERequest.SaveFile(DirectoryName, FileName, DataValue);
     }
 }
Пример #2
0
        public void ExecuteLoadRequest()
        {
            if (isEnabled && usingLoadSettings)
            {
                DataValue = FILERequest.LoadFile(DirectoryName, FileName);
                if (usingDataRequest)
                {
                    XmlDocument xmldoc;
                    XmlNodeList xmlnodelist;
                    XmlNode     xmlnode;
                    xmldoc = new XmlDocument();
                    xmldoc.LoadXml(DataValue);

                    int total = 0;
                    xmlnodelist = xmldoc.GetElementsByTagName("TotalData");
                    for (int j = 0; j <= xmlnodelist.Count - 1; j++)
                    {
                        xmlnode = xmlnodelist.Item(j);
                        total   = int.Parse(xmlnode.FirstChild.InnerText);
                    }

                    for (int k = 0; k < total; k++)
                    {
                        xmlnodelist = xmldoc.GetElementsByTagName("XMLObject" + k.ToString());
                        xmlnode     = xmlnodelist.Item(0);
                        XmlNode currentNode = xmlnode.FirstChild;

                        DATAObject.CXMLData tempXMLData = new DATAObject.CXMLData();
                        tempXMLData.DATAObject_Name = currentNode.InnerText;

                        currentNode = currentNode.NextSibling;
                        tempXMLData.DATAObject_ID = currentNode.InnerText;

                        currentNode = currentNode.NextSibling;
                        tempXMLData.DATAObject_User = currentNode.InnerText;

                        currentNode = currentNode.NextSibling;
                        tempXMLData.DATAObject_Group = currentNode.InnerText;

                        currentNode = currentNode.NextSibling;
                        tempXMLData.DATAObject_Prefab = currentNode.InnerText;

                        currentNode = currentNode.NextSibling;
                        tempXMLData.DATAObject_Machine = currentNode.InnerText;

                        currentNode = currentNode.NextSibling;
                        tempXMLData.DATAObject_Tag = currentNode.InnerText;

                        currentNode = currentNode.NextSibling;
                        tempXMLData.DATAObject_Layer = int.Parse(currentNode.InnerText);

                        currentNode = currentNode.NextSibling;
                        tempXMLData.DATAObject_Position = GetXMLVector(currentNode.InnerText);

                        currentNode = currentNode.NextSibling;
                        tempXMLData.DATAObject_Rotation = GetXMLVector(currentNode.InnerText);

                        currentNode = currentNode.NextSibling;
                        tempXMLData.DATAObject_Scale = GetXMLVector(currentNode.InnerText);

                        DataRequest.AddData(tempXMLData);
                    }
                }
            }
        }