Exemple #1
0
        /// <summary>
        /// Make new stage info base by basic node in game data
        /// </summary>
        /// <returns>Created new equip page</returns>
        public static XmlDataNode MakeNewStageInfoBase()
        {
            List <XmlDataNode> baseBookUseNode = DM.GameInfos.staticInfos["StageInfo"].rootDataNode.GetXmlDataNodesByPathWithXmlInfo("Stage",
                                                                                                                                     attributeToCheck: new Dictionary <string, string>()
            {
                { "id", "2" }
            });

            if (baseBookUseNode.Count > 0)
            {
                XmlDataNode bookUseIdBase = baseBookUseNode[0].Copy();
                bookUseIdBase.attribute["id"] = Tools.MathTools.GetRandomNumber(1000000, 9999999).ToString();
                bookUseIdBase.SetXmlInfoByPath("Name", "");
                bookUseIdBase.SetXmlInfoByPath("Chapter", "");
                bookUseIdBase.SetXmlInfoByPath("StoryType", "");

                bookUseIdBase.RemoveXmlInfosByPath("Wave");
                bookUseIdBase.RemoveXmlInfosByPath("Invitation/Book");

                bookUseIdBase.ActionXmlDataNodesByPath("Story", (XmlDataNode storyNode) =>
                {
                    storyNode.innerText = "";
                });
                return(bookUseIdBase);
            }
            else
            {
                return(null);
            }
        }
Exemple #2
0
        public static void CheckDatasBySyntaxCheckStrings(string menunName, string referencePath, XmlDataNode rootDataNode, List <string> checkSyntaxStrings, bool isCritical = true)
        {
            string REFERENCE_TEXT = "NO ID";

            if (referencePath.Contains('$'))
            {
                rootDataNode.ActionXmlDataNodesByPath(referencePath.Split('$')[0], (XmlDataNode checkNode) =>
                {
                    REFERENCE_TEXT = checkNode.GetAttributesSafe(referencePath.Split('$').Last());
                });
            }
            else
            {
                REFERENCE_TEXT = rootDataNode.GetInnerTextByPath(referencePath);
            }

            checkSyntaxStrings.ForEach((string checkSyntaxString) =>
            {
                if (checkSyntaxString.Split('#').Count() == 2)
                {
                    string CHECK_PATH = checkSyntaxString.Split('#')[0];
                    string CHECK_FUNC = checkSyntaxString.Split('#')[1];

                    List <string> DUPLICATE_CHECK = new List <string>();
                    rootDataNode.ActionXmlDataNodesByPath(CHECK_PATH.Split('$')[0], (XmlDataNode checkNode) =>
                    {
                        string CHECK_TEXT = "";
                        if (CHECK_PATH.Contains('$'))
                        {
                            CHECK_TEXT = checkNode.GetAttributesSafe(CHECK_PATH.Split('$').Last());
                        }
                        else
                        {
                            CHECK_TEXT = checkNode.innerText;
                        }

                        if (string.IsNullOrEmpty(CHECK_TEXT) && CHECK_FUNC.Contains("B"))
                        {
                            if (isCritical)
                            {
                                CheckDatas.MakeCriticalMessage("ERROR_MESSAGE_01", REFERENCE_TEXT, menunName, CHECK_PATH);
                            }
                            else
                            {
                                CheckDatas.MakeCautionMessage("ERROR_MESSAGE_01", REFERENCE_TEXT, menunName, CHECK_PATH);
                            }
                        }

                        if (!string.IsNullOrEmpty(CHECK_TEXT) && CHECK_FUNC.Contains("D"))
                        {
                            if (DUPLICATE_CHECK.Contains(CHECK_TEXT))
                            {
                                if (isCritical)
                                {
                                    CheckDatas.MakeCriticalMessage("ERROR_MESSAGE_02", REFERENCE_TEXT, menunName, CHECK_PATH);
                                }
                                else
                                {
                                    CheckDatas.MakeCautionMessage("ERROR_MESSAGE_02", REFERENCE_TEXT, menunName, CHECK_PATH);
                                }
                            }
                            DUPLICATE_CHECK.Add(CHECK_TEXT);
                        }

                        if (!string.IsNullOrEmpty(CHECK_TEXT) && CHECK_FUNC.Contains("I"))
                        {
                            if (!Tools.CheckInput.IsIntegerInputed(CHECK_TEXT))
                            {
                                if (isCritical)
                                {
                                    CheckDatas.MakeCriticalMessage("ERROR_MESSAGE_03", REFERENCE_TEXT, menunName, CHECK_PATH);
                                }
                                else
                                {
                                    CheckDatas.MakeCautionMessage("ERROR_MESSAGE_03", REFERENCE_TEXT, menunName, CHECK_PATH);
                                }
                            }
                        }

                        if (!string.IsNullOrEmpty(CHECK_TEXT) && CHECK_FUNC.Contains("D"))
                        {
                            if (!Tools.CheckInput.IsDoubleInputed(CHECK_TEXT))
                            {
                                if (isCritical)
                                {
                                    CheckDatas.MakeCriticalMessage("ERROR_MESSAGE_04", REFERENCE_TEXT, menunName, CHECK_PATH);
                                }
                                else
                                {
                                    CheckDatas.MakeCautionMessage("ERROR_MESSAGE_04", REFERENCE_TEXT, menunName, CHECK_PATH);
                                }
                            }
                        }
                    });
                }
            });
        }