public IEnumerable <Discount> GetDiscountsByProduct(int productId)
 {
     return(XmlRoot
            .SelectNodes($"Discount[@ProductId='{productId}']")
            ?.Cast <XmlNode>()
            ?.Select(GetEntity) ?? Enumerable.Empty <Discount>());
 }
Beispiel #2
0
        private string[] GetDBAccessInfoFromXML(ref PX_COMMON PX_COMMONData)
        {
            string[] syspara = new string[] { "", "", "" };

            // Configファイルの読込み
            string  path    = hostingEnvironment.ContentRootPath + "/DBConnect.xml";
            XmlRoot xmlData = PXLIB.PXCL_com.LoadXmlData <XmlRoot>(path);

            foreach (var item in xmlData.Domain)
            {
                if (ms_DomainHost == item.DomainName)
                {
                    PX_COMMONData.SYSDBSVRNM = item.SVRName;
                    PX_COMMONData.SYSDBSVRIP = item.SVRIP;
                    PX_COMMONData.SYSDBNM    = item.DBName;
                    PX_COMMONData.SYSDBSVRUR = item.DBUser;
                    PX_COMMONData.SYSDBSVRPW = item.DBPass;

                    PX_COMMONData.COPCD = item.COPCD;
                    syspara[0]          = item.SYSPARAID1;
                    syspara[1]          = item.SYSPARAID2;
                    syspara[2]          = item.SYSPARAID3;
                    break;
                }
            }
            return(syspara);
        }
Beispiel #3
0
        // XML
        public override void Read(XmlReader reader)
        {
            Clear();

            string name = null;

            while (reader.Read())
            {
                switch (reader.NodeType)
                {
                case XmlNodeType.Element:
                {
                    name = reader.Name;
                    break;
                }

                case XmlNodeType.Text:
                {
                    switch (name)
                    {
                    case XmlTag.Name:
                    {
                        Name = reader.Value;
                        break;
                    }

                    case XmlTag.Address:
                    {
                        Address = reader.Value;
                        break;
                    }

                    case XmlTag.Port:
                    {
                        Port = int.Parse(reader.Value);
                        break;
                    }

                    case XmlTag.Passphrase:
                    {
                        Passphrase = reader.Value;
                        break;
                    }
                    }

                    break;
                }

                case XmlNodeType.EndElement:
                {
                    if (XmlRoot.Equals(reader.Name))
                    {
                        return;
                    }

                    break;
                }
                }
            }
        }
        public override void InternalSerialize()
        {
            var node = XmlDocument.CreateElement(nameof(SerializableObject.Prop));

            node.InnerText = SerializableObject.Prop.ToString(CultureInfo.InvariantCulture);
            XmlRoot.AppendChild(node);
        }
Beispiel #5
0
 public void Write(System.IO.TextWriter writer)
 {
     var nodes = SerializerHelper.CreateSerializableNodes( Tree );
     var root = new XmlRoot{ objects=nodes };
     var serializer = new System.Xml.Serialization.XmlSerializer( typeof(XmlRoot) );
     serializer.Serialize( writer, root );
 }
        public void LoadTemplate()
        {
            if (Parent == null || Parent.Templates == null || Parent.Templates.Count == 0)
            {
                return;
            }

            var templateAttribute = XmlRoot.Attribute("Template");

            if (templateAttribute == null)
            {
                return;
            }

            var templateName = templateAttribute.Value;

            if (string.IsNullOrWhiteSpace(templateName))
            {
                return;
            }

            if (!Parent.Templates.ContainsKey(templateName))
            {
                return;
            }

            _template = Parent.Templates[templateName];
        } // loadTemplate
Beispiel #7
0
 public override void InternalSerialize()
 {
     foreach (SerializerTestItem item in SerializableObject.AsReadOnly())
     {
         var node = XmlDocument.CreateElement(nameof(SerializerTestItem));
         node.InnerText = item.Prop.ToString(CultureInfo.InvariantCulture);
         XmlRoot.AppendChild(node);
     }
 }
Beispiel #8
0
        public static BFLAN.Header FromXml(string text)
        {
            BFLAN.Header header = new BFLAN.Header();

            XmlSerializer serializer = new XmlSerializer(typeof(XmlRoot));
            XmlRoot       flyt       = (XmlRoot)serializer.Deserialize(new StringReader(text));

            return(header);
        }
Beispiel #9
0
        public void Write(System.IO.TextWriter writer)
        {
            var nodes = SerializerHelper.CreateSerializableNodes(Tree);
            var root  = new XmlRoot {
                objects = nodes
            };
            var serializer = new System.Xml.Serialization.XmlSerializer(typeof(XmlRoot));

            serializer.Serialize(writer, root);
        }
Beispiel #10
0
        public void Parse(XmlRoot xmlRoot)
        {
            if (xmlRoot?.Summary?.WinRiver_II_Section_by_Section_Summary == null)
            {
                throw new ArgumentNullException(nameof(xmlRoot));
            }

            var fieldVisitInfo = AppendMappedFieldVisitInfo(xmlRoot.Summary, _location);

            AppendMappedMeasurements(xmlRoot.Summary, fieldVisitInfo);
        }
Beispiel #11
0
        public void SavePlayers()
        {
            var root = new XmlRoot {
                Players = this._players
            };
            var serializer = new XmlSerializer(typeof(XmlRoot), new XmlRootAttribute("root"));

            using (var writer = new StreamWriter(this.PathToFile))
            {
                serializer.Serialize(writer, root);
            }
        }
        public void DeleteAllAlbumsWithPriceBiggerThan(double price, string saveToUrl)
        {
            foreach (XmlNode album in XmlRoot.ChildNodes)
            {
                if (double.Parse(album["price"].InnerText) > price)
                {
                    XmlRoot.RemoveChild(album);
                }
            }

            Document.Save(saveToUrl);
        }
Beispiel #13
0
        public void XmlToEntityUnit()
        {
            var ele = XElement.Parse($@"
<Root attr1=""attr1"" attr2=""attr2"">
	<Node attr3=""attr3"" attr4=""attr4"">
		<Field attr5=""attr5"" attr6=""attr6"" />
		<Field attr5=""attr5"" attr6=""attr6"" />
		<Field attr5=""attr5"" attr6=""attr6"" />
	</Node>
</Root>");

            XmlRoot test1 = ele.XmlToEntity <XmlRoot>();
        }
Beispiel #14
0
        public String GetDialogData(JsonGetDialogData data)
        {
            string result = "";

            string  path    = _hostingEnvironment.ContentRootPath + "/DBConnect.xml";
            XmlRoot xmlData = PXCL_com.LoadXmlData <XmlRoot>(path);


            //PX_COMMON PX_COMMONData = SetSysDB(_appSettings.Value, Request, data);
            PX_COMMON PX_COMMONData = new PX_COMMON();

            result = PXCL_com.GetDialogIndication(data.COPCD, data.SNDMSGKBN, data.SNDMSGNO, PX_COMMONData);

            return(result);
        }
        } // getXMLElement

        public XAttribute GetXMLAttribute(string name)
        {
            XAttribute att = null;

            if (_template != null)
            {
                att = _template.Attribute(name);
            }

            if (att == null)
            {
                att = XmlRoot.Attribute(name);
            }

            return(att);
        } // getXMLAttribute
        } // loadTemplate

        public XElement GetXMLElement(string name)
        {
            XElement el = null;

            if (_template != null)
            {
                el = _template.Element(name);
            }

            if (el == null)
            {
                el = XmlRoot.Element(name);
            }

            return(el);
        } // getXMLElement
Beispiel #17
0
        private ParseFileResult ParseXmlRootNoThrow(LocationInfo location, XmlRoot xmlRoot,
                                                    IFieldDataResultsAppender appender, ILog logger)
        {
            try
            {
                var parser = new Parser(location, appender, logger);

                parser.Parse(xmlRoot);

                return(ParseFileResult.SuccessfullyParsedAndDataValid());
            }
            catch (Exception exception)
            {
                logger.Error($"Something went wrong: {exception.Message}\n{exception.StackTrace}");
                return(ParseFileResult.SuccessfullyParsedButDataInvalid(exception));
            }
        }
Beispiel #18
0
 public bool LoadLocalUpdateCollection()
 {
     try
     {
         if (File.Exists(Paths.Files + "LocalUpdate.xml"))
         {
             //await Task.Delay(0);
             XDocument        RemoteXML         = XDocument.Load(Paths.Files + "LocalUpdate.xml");
             UpdateCollection tUpdateColleciton = new UpdateCollection();
             foreach (object UO in (from XmlRoot in RemoteXML.Element("update").Elements("file")
                                    select
                                    new UpdateObject
             {
                 localpath = (string)XmlRoot.Element("localpath"),
                 remotepath = (string)XmlRoot.Element("remotepath"),
                 version = (string)XmlRoot.Element("version"),
                 name = (string)XmlRoot.Element("name")
                        //replaceoriginal = (bool)XmlRoot.Element("localpath").Attribute("replaceoriginal")
             }
                                    )
                      )
             {
                 if (File.Exists(((UpdateObject)UO).localpath.Replace("_temp", "")))
                 {
                     tUpdateColleciton.AddObject((UpdateObject)UO);
                 }
             }
             _LocalUpdateCollection = tUpdateColleciton;
             return(true);
         }
         else
         {
             return(true);
         }
     }
     catch (Exception)
     {
         this._Form.AddToDetails("There was an issue loading the local updates, try restarting. You can play the game normally still.");
         return(false);
     }
 }
Beispiel #19
0
        public IActionResult Assortment()
        {
            //  ◆遷移元URL情報
            string host   = Request.Host.ToString();
            string domain = host.Split(".")[0];

            string parameter = "?";

            try
            {
                string path = hostingEnvironment.ContentRootPath + "/DomainAccess.xml";

                XmlRoot xmlData = PXCL_com.LoadXmlData <XmlRoot>(path);

                foreach (DomainCL DomainData in xmlData.Domain)
                {
                    if (DomainData.DomainName == domain)
                    {
                        parameter += "SysURL=" + DomainData.SysURL;
                        parameter += "&DomainType=" + DomainData.DomainType;
                        parameter += "&SysDB=" + "";
                    }
                }
            }
            catch (Exception ex)
            {
                string LogTitle = "ドメイン判定処理";
                string LogMsg   = "エラー「" + ex.Message + "」";
                PXCL_log.writeLog(PXCL_log.ERR, PXCL_log.SELECT, LogTitle, LogMsg, System.Reflection.MethodBase.GetCurrentMethod(), new PX_COMMON());
            }

            parameter += "SysURL=" + "test1";
            parameter += "&SysDB=" + "KN";
            parameter += "&DomainType=" + "PJ3_Next_PXAPI_";

            return(Redirect("~/PXAS/PXAS0000/PXAS0000VW" + parameter));
        }
        } // getXMLElement

        public XElement GetXMLElement(string parent, string name)
        {
            XElement el = null;

            if (_template != null)
            {
                var p = _template.Element(parent);
                if (p != null)
                {
                    el = p.Element(name);
                }
            }

            if (el == null)
            {
                var p = XmlRoot.Element(parent);
                if (p != null)
                {
                    el = p.Element(name);
                }
            }

            return(el);
        } // getXMLElement
        } // getXMLAttribute

        public XAttribute GetXMLAttribute(string parent, string name)
        {
            XAttribute att = null;

            if (_template != null)
            {
                var p = _template.Element(parent);
                if (p != null)
                {
                    att = p.Attribute(name);
                }
            }

            if (att == null)
            {
                var p = XmlRoot.Element(parent);
                if (p != null)
                {
                    att = p.Attribute(name);
                }
            }

            return(att);
        } // getXMLAttribute
 protected void ClearXmlRoot()
 {
     XmlRoot.RemoveAll();
 }
Beispiel #23
0
        public static string ToXml(BFLAN.Header header)
        {
            XmlRoot root = new XmlRoot();

            root.head = new Head();
            root.body = new Body();

            var generator = new Generator();

            root.head.generator = generator;
            generator.name      = "ST";
            generator.version   = "1.0"
            ;
            var create = new Create();

            root.head.create = create;
            create.date      = DateTime.Now.ToString("yyyy-MM-ddThh:mm:ss");

            BinaryInfo info = new BinaryInfo();

            info.layout.name     = header.AnimationTag.Name;
            info.version.major   = (byte)header.VersionMajor;
            info.version.minor   = (byte)header.VersionMinor;
            info.version.micro   = (byte)header.VersionMicro;
            info.version.micro2  = (byte)header.VersionMicro2;
            root.head.binaryInfo = info;

            AnimTag  tag      = new AnimTag();
            AnimInfo animInfo = new AnimInfo();

            if (header.AnimationInfo.Loop)
            {
                tag.animLoop = AnimLoopType.Loop;
            }

            tag.descendingBind = header.AnimationTag.ChildBinding;
            tag.name           = header.AnimationTag.Name;
            tag.fileName       = header.AnimationTag.Name;
            tag.startFrame     = header.AnimationTag.StartFrame;
            tag.endFrame       = header.AnimationTag.EndFrame;
            tag.group          = new Group[header.AnimationTag.Groups.Count];
            for (int i = 0; i < header.AnimationTag.Groups.Count; i++)
            {
                tag.group[i]      = new Group();
                tag.group[i].name = header.AnimationTag.Groups[i];
            }

            root.body.animTag[0] = tag;
            root.body.lan[0]     = animInfo;

            var bflanInfo   = header.AnimationInfo;
            var animContent = new AnimContent();

            animInfo.animContent    = new AnimContent[1];
            animInfo.animContent[0] = animContent;
            animInfo.startFrame     = bflanInfo.FrameSize;



            XmlWriterSettings settings = new XmlWriterSettings
            {
                Encoding    = Encoding.UTF8,
                Indent      = true,
                IndentChars = "  ",
            };


            XmlSerializerNamespaces ns = new XmlSerializerNamespaces();

            ns.Add("", "");

            XmlDocument    doc     = new XmlDocument();
            XmlDeclaration xmldecl = doc.CreateXmlDeclaration("1.0", null, null);

            xmldecl.Encoding   = "UTF-8";
            xmldecl.Standalone = "yes";

            var           stringWriter = new StringWriter();
            XmlSerializer serializer   = new XmlSerializer(typeof(XmlRoot));
            XmlWriter     output       = XmlWriter.Create(stringWriter, settings);

            serializer.Serialize(output, root, ns);
            return(stringWriter.ToString());
        }
Beispiel #24
0
        public bool LoadRemoteUpdateCollection()
        {
            try
            {
                this._Form.AddToDetails("Downloading remote update XML file....");
                if (File.Exists(Paths.Files + "RemoteUpdate.xml"))
                {
                    File.Delete(Paths.Files + "RemoteUpdate.xml");
                }
                WebClient Client         = new WebClient();
                bool      _isDownloading = false;
                Client.DownloadFileCompleted += (s, e) =>
                {
                    this._Form.UpdateProgress(100);
                    this._Form.AddToDetails("Download Complete.");

                    Client.Dispose();
                    Client         = null;
                    _isDownloading = false;
                };
                Client.DownloadProgressChanged += (s, e) =>
                {
                    this._Form.UpdateProgress(e.ProgressPercentage);
                };
                try
                {
                    Client.DownloadFileAsync(new Uri(Paths.RemoteUpdateXML), Paths.Files + "RemoteUpdate.xml");
                    _isDownloading = true;
                }
                catch (Exception) { throw new Exception("Error"); }
                //await Task.Run(() =>
                //{
                while (_isDownloading)
                {
                }
                // });
                XDocument        RemoteXML         = XDocument.Load(Paths.Files + "RemoteUpdate.xml");
                UpdateCollection tUpdateColleciton = new UpdateCollection();
                //replaceoriginal = (XmlRoot.Element("localpath").HasAttributes) ? ((XmlRoot.Element("localpath").Attribute("replaceoriginal") != null) ? true : false) : false
                foreach (object UO in (from XmlRoot in RemoteXML.Element("update").Elements("file")
                                       select
                                       new UpdateObject
                {
                    localpath = (string)XmlRoot.Element("localpath"),
                    remotepath = (string)XmlRoot.Element("remotepath"),
                    version = (string)XmlRoot.Element("version"),
                    name = (string)XmlRoot.Element("name")
                }
                                       )
                         )
                {
                    tUpdateColleciton.AddObject((UpdateObject)UO);
                }
                _RemoteUpdateCollection = tUpdateColleciton;
                return(true);
            }
            catch (Exception)
            {
                this._Form.AddToDetails("There was an issue loading the remote updates, try restarting. You can play the game normally still.");
                return(false);
            }
        }
Beispiel #25
0
        // XML
        public override void Read(XmlReader reader)
        {
            Clear();

            string name = null;

            Enabled = bool.Parse(reader.GetAttribute(XmlTag.Enabled));

            while (reader.Read())
            {
                switch (reader.NodeType)
                {
                case XmlNodeType.Element:
                {
                    name = reader.Name;

                    if (RemoteRouterData.XmlRoot.Equals(name))
                    {
                        Router.Read(reader);
                    }

                    break;
                }

                case XmlNodeType.Text:
                {
                    switch (name)
                    {
                    case XmlTag.Id:
                    {
                        Id = reader.Value;
                        break;
                    }

                    case XmlTag.Name:
                    {
                        Name = reader.Value;
                        break;
                    }

                    case XmlTag.GroupImage:
                    {
                        GroupPath = reader.Value;
                        break;
                    }

                    case XmlTag.DownloadFolder:
                    {
                        DownloadFolder = reader.Value;
                        break;
                    }

                    case XmlTag.Folder:
                    {
                        FileData data = new FileData(reader.Value)
                        {
                            Shared = true
                        };
                        AddFolder(data);
                        break;
                    }
                    }

                    break;
                }

                case XmlNodeType.EndElement:
                {
                    if (XmlRoot.Equals(reader.Name))
                    {
                        return;
                    }

                    break;
                }
                }
            }
        }
Beispiel #26
0
 public User GetByName(string name)
 {
     return(XmlRoot
            .SelectSingleNode($"User[Name='{name}']")
            .Return(GetEntity, null));
 }
Beispiel #27
0
 public Product GetById(int productId)
 {
     return(XmlRoot
            .SelectSingleNode($"Product[Id='{productId.ToString()}']")
            .Return(GetEntity, null));
 }