Example #1
0
 protected void EBtnModify_Click(object sender, EventArgs e)
 {
     if (this.Page.IsValid)
     {
         SpecialInfo specialInfo = this.GetSpecialInfo();
         specialInfo.SpecialId      = this.specialId;
         specialInfo.OrderId        = DataConverter.CLng(this.HdnOrderId.Value);
         specialInfo.NeedCreateHtml = true;
         string specialName = specialInfo.SpecialName;
         if ((specialName != this.HdnSpecialName.Value) && Special.ExistsSpecialName(specialName))
         {
             AdminPage.WriteErrMsg("<li>此专题名已经存在,请输入其它的专题名!</li>", "Special.aspx");
         }
         if (Special.UpdateSpecial(specialInfo))
         {
             this.InputPermissions(specialInfo.SpecialId);
             this.InputRolePermission(specialInfo.SpecialId);
             IncludeFile.CreateIncludeFileByAssociateType(AssociateType.Special);
             AdminPage.WriteSuccessMsg("<li>专题信息保存成功!</li>", "SpecialManage.aspx");
         }
         else
         {
             AdminPage.WriteErrMsg("<li>专题信息保存失败!</li>", "SpecialManage.aspx");
         }
     }
 }
        protected void EBtnSubmit_Click(object sender, EventArgs e)
        {
            int nodeId       = DataConverter.CLng(this.LstFromNodes.SelectedValue);
            int moveToNodeId = DataConverter.CLng(this.LstToNodes.SelectedValue);

            if (nodeId == 0)
            {
                AdminPage.WriteErrMsg("<li>指定的节点不存在或者已经被删除!</li>", "CategoryMove.aspx?NodeID=" + nodeId);
            }
            if (string.IsNullOrEmpty(this.LstFromNodes.SelectedValue.ToString()))
            {
                AdminPage.WriteErrMsg("<li>请先选择要移动的目标节点!</li>", "CategoryMove.aspx?NodeID=" + nodeId);
            }
            int errorNum = Nodes.NodesMove(nodeId, moveToNodeId);

            if (errorNum > 0)
            {
                AdminPage.WriteErrMsg("<li>" + Nodes.WriteMessageByErrorNum(errorNum) + "</li>", "CategoryMove.aspx?NodeID=" + nodeId);
            }
            else
            {
                IncludeFile.CreateIncludeFileByAssociateType(AssociateType.Node);
                base.Response.Write("<script type='text/javascript'>parent.frames[\"left\"].location.reload();</script>");
                AdminPage.WriteSuccessMsg("<li>节点移动成功!</li>", "CategoryManage.aspx");
            }
        }
Example #3
0
        protected void EBtnSetOrderId_Click(object sender, EventArgs e)
        {
            string str = this.HdnSerNodeList.Value;

            if (!string.IsNullOrEmpty(str))
            {
                List <NodeInfo> nodeList = new List <NodeInfo>();
                string[]        strArray = str.Split(new char[] { '|' }, StringSplitOptions.RemoveEmptyEntries);
                for (int i = 0; i < strArray.Length; i++)
                {
                    NodeInfo cacheNodeById = Nodes.GetCacheNodeById(DataConverter.CLng(strArray[i]));
                    if (this.m_IsRootOrder)
                    {
                        cacheNodeById.RootId    = i + 1;
                        cacheNodeById.OrderType = 1;
                    }
                    else
                    {
                        cacheNodeById.OrderId   = i + 1;
                        cacheNodeById.OrderType = 0;
                    }
                    if (!cacheNodeById.IsNull)
                    {
                        nodeList.Add(cacheNodeById);
                    }
                }
                Nodes.OrderNode(nodeList);
                this.Repeater1.DataBind();
                IncludeFile.CreateIncludeFileByAssociateType(AssociateType.Node);
                base.Response.Write("<script type='text/javascript'>parent.frames[\"left\"].location.reload();</script>");
                AdminPage.WriteSuccessMsg("栏目排序成功!", "CategoryOrder.aspx");
            }
        }
Example #4
0
        public void ChooseScriptSources()
        {
            const string Separator      = @";";
            var          chooserMessage = new FileChooserMessage();

            if (IncludeFile == null)
            {
                IncludeFile = "";
            }
            chooserMessage.SelectedFiles    = IncludeFile?.Split(Separator.ToCharArray());
            chooserMessage.PropertyChanged += (sender, args) =>
            {
                if (args.PropertyName == @"SelectedFiles")
                {
                    if (chooserMessage.SelectedFiles != null)
                    {
                        if (string.IsNullOrEmpty(IncludeFile))
                        {
                            IncludeFile = string.Join(Separator, chooserMessage.SelectedFiles);
                        }
                        else
                        {
                            IncludeFile += Separator + string.Join(Separator, chooserMessage.SelectedFiles);
                        }
                    }
                }
            };
            _eventPublisher.Publish(chooserMessage);
        }
 protected void EBtnReset_Click(object sender, EventArgs e)
 {
     Nodes.ResetNodes();
     IncludeFile.CreateIncludeFileByAssociateType(AssociateType.Node);
     base.Response.Write("<script type='text/javascript'>parent.frames[\"left\"].location.reload();</script>");
     AdminPage.WriteSuccessMsg("<li>复位节点成功!</li>", "CategoryManage.aspx");
 }
Example #6
0
        protected void EBtnUnite_Click(object sender, EventArgs e)
        {
            int nodeId       = DataConverter.CLng(this.DropFromNode.SelectedValue);
            int targetNodeId = DataConverter.CLng(this.DropToNode.SelectedValue);

            if (nodeId == 0)
            {
                AdminPage.WriteErrMsg("<li>指定要合并的节点不存在或者已经被删除!</li>", "CategoryUnite.aspx");
            }
            if (targetNodeId == 0)
            {
                AdminPage.WriteErrMsg("<li>指定的目标节点不存在或者已经被删除!</li>", "CategoryUnite.aspx");
            }
            int errorType = Nodes.NodesUnite(nodeId, targetNodeId);

            if (errorType > 0)
            {
                AdminPage.WriteErrMsg("<li>" + Nodes.WriteNodesUniteMessage(errorType) + "</li>", "CategoryManage.aspx");
            }
            else
            {
                IncludeFile.CreateIncludeFileByAssociateType(AssociateType.Node);
                base.Response.Write("<script type='text/javascript'>parent.frames[\"left\"].location.reload();</script>");
                AdminPage.WriteSuccessMsg("<li>节点合并成功!已经将被合并节点及其下属子节点的所有数据转入目标节点中。</li><li>同时删除了被合并的节点及其子节点。</li><li>请重新生成目标节点的所有内容!。</li>", "CategoryManage.aspx");
            }
        }
Example #7
0
        protected void Page_Load(object sender, EventArgs e)
        {
            IncludeFileInfo includeFileInfoById = IncludeFile.GetIncludeFileInfoById(BasePage.RequestInt32("id"));

            if (!includeFileInfoById.IsNull)
            {
                this.LitName.Text = includeFileInfoById.Name;
                switch (includeFileInfoById.IncludeType)
                {
                case IncludeType.None:
                    return;

                case IncludeType.JSWriteHtml:
                case IncludeType.JS:
                    this.LitPreview.Text = "<script type=\"text/javascript\" src=\"" + base.BasePath + SiteConfig.SiteOption.IncludeFilePath + "/" + includeFileInfoById.FileName + "\"></script>";
                    return;

                case IncludeType.Html:
                    this.LitPreview.Text = "<iframe frameborder=\"0\" width=\"100%\" height=\"400px\" src=\"" + base.BasePath + SiteConfig.SiteOption.IncludeFilePath + "/" + includeFileInfoById.FileName + "\" scrolling=\"auto\" id=\"includeFile\"></iframe>";
                    return;
                }
            }
            else
            {
                AdminPage.WriteErrMsg("您修改的内嵌代码不存在!", "IncludeFileManage.aspx");
            }
        }
 protected void EBtnBacthSet_Click(object sender, EventArgs e)
 {
     if (this.Page.IsValid)
     {
         StringBuilder sb = new StringBuilder();
         foreach (ListItem item in this.LstSpecial.Items)
         {
             if (item.Selected)
             {
                 StringHelper.AppendString(sb, item.Value);
             }
         }
         if (sb.Length <= 0)
         {
             AdminPage.WriteErrMsg("请先指定要批量设置的专题!", "SpecialBatchSet.aspx");
         }
         if (Special.SpecialBatchSet(this.GetSpecialInfo(), sb.ToString(), this.GetCheckItem()))
         {
             IncludeFile.CreateIncludeFileByAssociateType(AssociateType.Special);
             AdminPage.WriteSuccessMsg("专题批量设置成功!", "SpecialManage.aspx");
         }
         else
         {
             AdminPage.WriteErrMsg("专题批量设置失败!", "SpecialBatchSet.aspx");
         }
     }
 }
Example #9
0
    void is_include_lc()
    {
        if (m_mw == null)
        {
            m_mw = new psggConverterLib.MacroWork();
        }
        m_mw.Init();
        m_mw.CheckMacro(m_line);
        if (m_mw.IsValid() && m_mw.IsInclude())
        {
            var matchstr = m_mw.GetMatchStr();
            var file     = m_mw.GetIncludFilename();
            var enc      = m_mw.GetIncludeFileEnc();
            var text     = IncludeFile.readfile(G, matchstr, file, enc);

            m_resultlist.Add(G.GetComment(" #start include -" + file));

            var tmplines = StringUtil.ReplaceWordsInLine(m_line, matchstr, text);
            m_resultlist.AddRange(tmplines);

            m_resultlist.Add(G.GetComment(" #end include -" + file));

            m_bContinue = true;
        }
    }
Example #10
0
        private bool BatchAddSpecial(SpecialInfo specialInfo, StringBuilder information)
        {
            bool flag = false;

            if (IsDir(specialInfo.SpecialDir))
            {
                information.Append("<li>" + specialInfo.SpecialName + "目录名只能是字母、数字、下划线组成,首字符不能是数字!</li>");
                return(flag);
            }
            if (Special.ExistsSpecialName(specialInfo.SpecialName))
            {
                information.Append("<li>" + specialInfo.SpecialName + "专题名已经存在,请输入其它的专题名!</li>");
                return(flag);
            }
            if (Special.ExistsSpecialDir(specialInfo.SpecialDir))
            {
                information.Append("<li>" + specialInfo.SpecialDir + "专题目录已经存在,请输入其它的目录名!</li>");
                return(flag);
            }
            if (Special.AddSpecial(specialInfo))
            {
                this.InputPermissions(specialInfo.SpecialId);
                this.InputRolePermission(specialInfo.SpecialId);
                IncludeFile.CreateIncludeFileByAssociateType(AssociateType.Special);
                return(true);
            }
            information.Append("<li>" + specialInfo.SpecialName + "专题信息保存失败!</li>");
            return(flag);
        }
Example #11
0
        /// <inheritdoc />
        public void Load()
        {
            string expTablePath = GameResourcesConstants.Paths.ExpTablePath;

            if (!File.Exists(expTablePath))
            {
                _logger.LogWarning("Unable to load exp table. Reason: Cannot find '{0}' file.", expTablePath);
                return;
            }

            using (var expTableFile = new IncludeFile(expTablePath, @"([(){}=,;\n\r\t ])"))
            {
                var dropLuckBlock = expTableFile.GetBlock("expDropLuck");
                if (dropLuckBlock is null)
                {
                    _logger.LogWarning("Unable to load exp table. Reason: Cannot find drop luck data.");
                    return;
                }

                var expCharacterBlock = expTableFile.GetBlock("expCharacter");
                if (expCharacterBlock is null)
                {
                    _logger.LogWarning("Unable to load exp table. Reason: Cannot find character experience data.");
                    return;
                }

                IEnumerable <long[]> dropLuck = LoadDropLuck(dropLuckBlock);
                IReadOnlyDictionary <int, CharacterExpTableData> characterExperience = LoadCharacterExperience(expCharacterBlock);
                var expTableData = new ExpTableData(dropLuck, characterExperience);
                _cache.Set(GameResourcesConstants.ExpTables, expTableData);
            }

            _logger.LogInformation("-> Experience tables loaded.");
        }
Example #12
0
        public void PrintClass(string fileName, Package.Class c)
        {
            var text = new CorrmStringBuilder($"// {c.FullName}{Utils.NLine}// ");

            if (c.InheritedSize > 0)
            {
                text += $"0x{c.Size - c.InheritedSize:X4} (0x{(long)c.Size:X4} - 0x{(long)c.InheritedSize:X4}){Utils.NLine}";
            }
            else
            {
                text += $"0x{(long)c.Size:X4}{Utils.NLine}";
            }

            text += $"{c.NameCppFull}{Utils.NLine}{{{Utils.NLine}public:{Utils.NLine}";

            // Member
            foreach (var m in c.Members)
            {
                text +=
                    $"\t{(m.IsStatic ? "static " + m.Type : m.Type),-50} {m.Name,-58}; // 0x{(long)m.Offset:X4}(0x{(long)m.Size:X4})" +
                    (!string.IsNullOrEmpty(m.Comment) ? " " + m.Comment : "") +
                    (!string.IsNullOrEmpty(m.FlagsString) ? " (" + m.FlagsString + ")" : "") +
                    $"{Utils.NLine}";
            }
            text += $"{Utils.NLine}";

            // Predefined Methods
            if (c.PredefinedMethods.Count > 0)
            {
                text += $"{Utils.NLine}";
                foreach (var m in c.PredefinedMethods)
                {
                    if (m.MethodType == PredefinedMethod.Type.Inline)
                    {
                        text += m.Body;
                    }
                    else
                    {
                        text += $"\t{m.Signature};";
                    }

                    text += $"{Utils.NLine}{Utils.NLine}";
                }
            }

            // Methods
            if (c.PredefinedMethods.Count > 0)
            {
                text += $"{Utils.NLine}";
                foreach (var m in c.Methods)
                {
                    text += $"\t{BuildMethodSignature(m, new Package.Class(), true)};{Utils.NLine}";
                }
            }

            text += $"}};{Utils.NLine}{Utils.NLine}";

            IncludeFile <CppLang> .AppendToSdk(Generator.SdkPath, fileName, text);
        }
Example #13
0
 protected void BtnBatchDelete_Click(object sender, EventArgs e)
 {
     foreach (string str in this.EgvIncludeFileList.SelectList.ToString().Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries))
     {
         IncludeFile.Delete(DataConverter.CLng(str));
     }
     AdminPage.WriteSuccessMsg("批量删除成功", "IncludeFileManage.aspx");
 }
 protected void WzdInstall_FinishButtonClick(object sender, WizardNavigationEventArgs e)
 {
     try
     {
         IncludeFile.CreateAllIncludeFile();
     }
     catch
     {
     }
     base.Response.Redirect("~/");
 }
Example #15
0
        /// <inheritdoc />
        public void Load()
        {
            IEnumerable <string> files = Directory.GetFiles(GameResources.ResourcePath, "character*.inc", SearchOption.AllDirectories);

            foreach (string file in files)
            {
                using (var npcFile = new IncludeFile(file))
                {
                    foreach (IStatement npcStatement in npcFile.Statements)
                    {
                        if (!(npcStatement is Block npcBlock))
                        {
                            continue;
                        }

                        string npcId   = npcStatement.Name;
                        string npcName = npcId;

                        // We gets the npc name.
                        foreach (IStatement npcInfoStatement in npcBlock.Statements)
                        {
                            if (npcInfoStatement is Instruction instruction && npcInfoStatement.Name == "SetName")
                            {
                                if (instruction.Parameters.Count > 0)
                                {
                                    npcName = this._texts[instruction.Parameters.First().ToString()];
                                }
                            }
                        }

                        //TODO: implement other npc settings (image, music, actions...)
                        //      + constants for statement (like SetName)

                        // We gets shop and dialog of this npc.
                        ShopData   shop   = this._shops.GetShopData(npcId);
                        DialogData dialog = this._dialogs.GetDialogData(npcId, this._configuration.Language);

                        var npc = new NpcData(npcId, npcName, shop, dialog);

                        if (this._npcData.ContainsKey(npc.Id))
                        {
                            this._npcData[npc.Id] = npc;
                            this._logger.LogWarning(GameResources.ObjectOverridedMessage, "NPC", npc.Id, "already declared");
                        }
                        else
                        {
                            this._npcData.Add(npc.Id, npc);
                        }
                    }
                }
            }

            this._logger.LogInformation($"-> {this._npcData.Count} NPCs loaded.");
        }
Example #16
0
 private void DeleteSpecialCategory()
 {
     if (Special.DeleteSpecialCategoryById(BasePage.RequestInt32("SpecialCategoryID")))
     {
         IncludeFile.CreateIncludeFileByAssociateType(AssociateType.Special);
         base.Response.Write("<script type='text/javascript'>parent.frames[\"left\"].location.reload();</script>");
         AdminPage.WriteSuccessMsg("<li>专题类别删除成功!</li>", "SpecialCategoryManage.aspx");
     }
     else
     {
         AdminPage.WriteErrMsg("<li>专题类别删除失败!</li>");
     }
 }
Example #17
0
        public void PrintEnum(string fileName, Package.Enum e)
        {
            CorrmStringBuilder text = new CorrmStringBuilder($"// {e.FullName}{Utils.NLine}enum class {e.Name} : uint8_t{Utils.NLine}{{{Utils.NLine}");

            for (int i = 0; i < e.Values.Count; i++)
            {
                text += $"\t{e.Values[i],-30} = {i},{Utils.NLine}";
            }

            text += $"{Utils.NLine}}};{Utils.NLine}{Utils.NLine}";

            IncludeFile <CppLang> .AppendToSdk(Generator.SdkPath, fileName, text);
        }
Example #18
0
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = base.GetHashCode();
         hashCode = (hashCode * 397) ^ (_sources != null ? _sources.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (int)ScriptType;
         hashCode = (hashCode * 397) ^ EscapeScript.GetHashCode();
         hashCode = (hashCode * 397) ^ (IncludeFile != null ? IncludeFile.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (Script != null ? Script.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (Result != null ? Result.GetHashCode() : 0);
         return(hashCode);
     }
 }
Example #19
0
        public string LocateIncludeFile(ProbeAppSettings appSettings, string sourceFileName, string fileName, bool searchSameDir)
        {
            if (string.IsNullOrEmpty(fileName))
            {
                return(null);
            }

            // Check if the include file is cached.
            IncludeFile file          = null;
            var         fileNameLower = fileName.ToLower();

            if (searchSameDir && !string.IsNullOrEmpty(sourceFileName))
            {
                if (_sameDirIncludeFiles.TryGetValue(fileNameLower, out file))
                {
                    return(file.FullPathName);
                }
            }

            if (_globalIncludeFiles.TryGetValue(fileNameLower, out file))
            {
                return(file.FullPathName);
            }

            // Search the disk in same directory.
            if (searchSameDir && !string.IsNullOrEmpty(sourceFileName))
            {
                var pathName = Path.Combine(Path.GetDirectoryName(sourceFileName), fileName);
                if (File.Exists(pathName))
                {
                    return(Path.GetFullPath(pathName));
                }
            }

            // Search the disk in global include directories.
            if (appSettings.Initialized)
            {
                foreach (var includeDir in appSettings.IncludeDirs)
                {
                    var pathName = Path.Combine(includeDir, fileName);
                    if (System.IO.File.Exists(pathName))
                    {
                        return(Path.GetFullPath(pathName));
                    }
                }
            }

            return(null);
        }
Example #20
0
        /// <inheritdoc />
        public void Load()
        {
            if (!File.Exists(GameResources.ExpTablePath))
            {
                this._logger.LogWarning("Unable to load exp table. Reason: cannot find '{0}' file.", GameResources.ExpTablePath);
                return;
            }

            using (var expTableFile = new IncludeFile(GameResources.ExpTablePath, @"([(){}=,;\n\r\t ])"))
            {
                this.LoadDropLuck(expTableFile.GetBlock("expDropLuck"));
            }

            this._logger.LogInformation("-> Experience tables loaded.");
        }
 protected void EBtnSubmit_Click(object sender, EventArgs e)
 {
     if (this.Page.IsValid)
     {
         bool flag = true;
         SpecialCategoryInfo specialCategoryInfo = new SpecialCategoryInfo();
         specialCategoryInfo.NeedCreateHtml = false;
         if (this.HdnAction.Value == "Modify")
         {
             specialCategoryInfo.SpecialCategoryId = BasePage.RequestInt32("SpecialCategoryID");
             specialCategoryInfo.OrderId           = DataConverter.CLng(this.HdnOrderId.Value);
             specialCategoryInfo.NeedCreateHtml    = true;
         }
         specialCategoryInfo.SpecialCategoryName = this.TxtSpecialCategoryName.Text;
         specialCategoryInfo.SpecialCategoryDir  = this.TxtSpecialCategoryDir.Text;
         specialCategoryInfo.SpecialTemplatePath = this.FileCSpecialTemplatePath.Text;
         specialCategoryInfo.SearchTemplatePath  = this.FileCSearchTemplatePath.Text;
         specialCategoryInfo.OpenType            = DataConverter.CBoolean(this.RadOpenType.SelectedValue);
         specialCategoryInfo.Description         = this.TxtDescription.Text;
         specialCategoryInfo.PagePostfix         = this.PagePostfix.Value;
         specialCategoryInfo.IsCreateHtml        = DataConverter.CBoolean(this.RadlCreatHtml.SelectedValue);
         string text = this.TxtSpecialCategoryName.Text;
         if (((this.HdnAction.Value == "Modify") && (text != this.HdnSpecialCategoryName.Value)) && Special.ExistsSpecialCategoryName(text))
         {
             AdminPage.WriteErrMsg("<li>系统已经有此专题类别名称,请返回重新填写专题类别名称!</li>");
         }
         if (this.HdnAction.Value == "Modify")
         {
             flag = Special.UpdateSpecialCategory(specialCategoryInfo);
         }
         else
         {
             flag = Special.AddSpecialCategory(specialCategoryInfo);
         }
         if (flag)
         {
             IncludeFile.CreateIncludeFileByAssociateType(AssociateType.Special);
             base.Response.Write("<script type='text/javascript'>parent.frames[\"left\"].location.reload();</script>");
             AdminPage.WriteSuccessMsg("<li>专题类别信息保存成功!</li>", "SpecialCategoryManage.aspx");
         }
         else
         {
             AdminPage.WriteErrMsg("<li>专题类别信息保存失败!</li>", "SpecialCategoryManage.aspx");
         }
     }
 }
 protected void EBtnBacthSet_Click(object sender, EventArgs e)
 {
     if (this.Page.IsValid)
     {
         StringBuilder sb = new StringBuilder();
         foreach (ListItem item in this.LstNodes.Items)
         {
             int num;
             if (item.Selected && int.TryParse(item.Value, out num))
             {
                 StringHelper.AppendString(sb, item.Value);
             }
         }
         if (sb.Length <= 0)
         {
             AdminPage.WriteErrMsg("请先选择要批量设置的节点!");
         }
         if (Nodes.BatchUpdate(this.GetNodesInfo(), sb.ToString(), this.GetCheckItem()))
         {
             if (this.ChkPermissions.Checked)
             {
                 foreach (string str in sb.ToString().Split(new char[] { ',' }))
                 {
                     this.InputPermissions(DataConverter.CLng(str));
                     this.InputRolePermission(DataConverter.CLng(str));
                 }
             }
             if (this.ChkFileCTemplate.Checked)
             {
                 IList <NodesModelTemplateRelationShipInfo> dataFromRepeater = this.GetDataFromRepeater();
                 foreach (string str2 in sb.ToString().Split(new char[] { ',' }))
                 {
                     ModelManager.UpdateNodesModelTemplateRelationShip(DataConverter.CLng(str2), dataFromRepeater);
                 }
             }
             IncludeFile.CreateIncludeFileByAssociateType(AssociateType.Node);
             base.Response.Write("<script type='text/javascript'>parent.frames[\"left\"].location.reload()</script>");
             AdminPage.WriteSuccessMsg("批量设置成功!", "CategoryManage.aspx");
         }
         else
         {
             AdminPage.WriteErrMsg("批量设置失败!");
         }
     }
 }
Example #23
0
        private void BtnAddFiles_Click(object sender, EventArgs e)
        {
            using (var open = new OpenFileDialog())
            {
                open.Multiselect = true;
                open.Filter      = "All files (*.*)|*.*";

                if (open.ShowDialog(this) == DialogResult.OK)
                {
                    foreach (var file in open.FileNames)
                    {
                        var includeFile = new IncludeFile(file, Path.GetFileName(file));

                        includedEntries.Add(new IncludedEntry(includeFile));
                    }
                }
            }
        }
Example #24
0
        /// <inheritdoc />
        public void Load()
        {
            if (!File.Exists(GameResources.MoversPropPath))
            {
                this._logger.LogWarning("Unable to load movers. Reason: cannot find '{0}' file.", GameResources.MoversPropPath);
                return;
            }

            using (var moversPropFile = new ResourceTableFile(GameResources.MoversPropPath, 1, this._definesLoader.Defines, this._textsLoader.Texts))
            {
                var movers = moversPropFile.GetRecords <MoverData>();

                foreach (var mover in movers)
                {
                    if (this._moversData.ContainsKey(mover.Id))
                    {
                        this._moversData[mover.Id] = mover;
                        this._logger.LogWarning(GameResources.ObjectOverridedMessage, "Mover", mover.Id, "already declared");
                    }
                    else
                    {
                        this._moversData.Add(mover.Id, mover);
                    }
                }
            }

            using (var moversPropExFile = new IncludeFile(GameResources.MoversPropExPath))
            {
                foreach (Block moverBlock in moversPropExFile.Statements)
                {
                    if (this._definesLoader.Defines.TryGetValue(moverBlock.Name, out int moverId) &&
                        this._moversData.TryGetValue(moverId, out MoverData mover))
                    {
                        this.LoadDropGold(mover, moverBlock.GetInstruction("DropGold"));
                        this.LoadDropItems(mover, moverBlock.GetInstructions("DropItem"));
                        this.LoadDropItemsKind(mover, moverBlock.GetInstructions("DropKind"));

                        mover.MaxDropItem = int.Parse(moverBlock.GetVariable("Maxitem").Value.ToString());
                    }
                }
            }

            this._logger.LogInformation("-> {0} movers loaded.", this._moversData.Count);
        }
Example #25
0
        /// <summary>
        /// Loads an official quest property file.
        /// </summary>
        /// <param name="filePath">Official quest property file path.</param>
        public void Load(string filePath)
        {
            using var questIncludeFile = new IncludeFile(filePath);

            foreach (IStatement questStatement in questIncludeFile.Statements)
            {
                if (!(questStatement is Block questBlock))
                {
                    continue;
                }

                QuestData quest = CreateQuest(questBlock);

                if (IsQuestValid(quest))
                {
                    _quests.Add(quest);
                }
            }
        }
Example #26
0
        public override async Task SaveStructs(Package package)
        {
            // Create file
            string fileName = GenerateFileName(FileContentType.Structs, await package.GetName());

            // Init File
            IncludeFile <CppLang> .CreateFile(Generator.SdkPath, fileName);

            IncludeFile <CppLang> .AppendToSdk(Generator.SdkPath, fileName, GetFileHeader(true));

            if (package.Constants.Count > 0)
            {
                IncludeFile <CppLang> .AppendToSdk(Generator.SdkPath, fileName, GetSectionHeader("Constants"));

                foreach (var c in package.Constants)
                {
                    PrintConstant(fileName, c);
                }
            }

            if (package.Enums.Count > 0)
            {
                IncludeFile <CppLang> .AppendToSdk(Generator.SdkPath, fileName, GetSectionHeader("Enums"));

                foreach (var e in package.Enums)
                {
                    PrintEnum(fileName, e);
                }
            }

            if (package.ScriptStructs.Count > 0)
            {
                IncludeFile <CppLang> .AppendToSdk(Generator.SdkPath, fileName, GetSectionHeader("Script Structs"));

                foreach (var ss in package.ScriptStructs)
                {
                    PrintStruct(fileName, ss);
                }
            }

            IncludeFile <CppLang> .AppendToSdk(Generator.SdkPath, fileName, GetFileFooter());
        }
Example #27
0
        private void BindDataToControls()
        {
            IncludeFileInfo includeFileInfoById = IncludeFile.GetIncludeFileInfoById(BasePage.RequestInt32("id"));

            if (!includeFileInfoById.IsNull)
            {
                this.TxtName.Text                    = includeFileInfoById.Name;
                this.ViewState["Name"]               = includeFileInfoById.Name;
                this.TxtDescription.Text             = includeFileInfoById.Description;
                this.TxtFileName.Text                = includeFileInfoById.FileName;
                this.ViewState["FileName"]           = includeFileInfoById.FileName;
                this.RadlIncludeType.SelectedValue   = Enum.GetName(typeof(IncludeType), includeFileInfoById.IncludeType);
                this.RadlAssociateType.SelectedValue = Enum.GetName(typeof(AssociateType), includeFileInfoById.AssociateType);
                this.TxtTemplate.Text                = includeFileInfoById.Template;
            }
            else
            {
                AdminPage.WriteErrMsg("您修改的内嵌代码不存在!", "IncludeFileManage.aspx");
            }
        }
Example #28
0
    void do_if_include()
    {
        m_bDone = false;
        if (m_mw.IsInclude())
        {
            var matchstr = m_mw.GetMatchStr();
            var file     = m_mw.GetIncludFilename();
            var enc      = m_mw.GetIncludeFileEnc();
            var text     = IncludeFile.readfile(G, matchstr, file, enc);

            m_resultlines.Add(G.GetComment(" #start include -" + file));

            var tmplines = StringUtil.ReplaceWordsInLine(m_line, matchstr, text);

            m_resultlines.AddRange(tmplines);

            m_resultlines.Add(G.GetComment(" #end include -" + file));

            m_bDone = true;
        }
    }
        private void DeleteNode()
        {
            if (BasePage.RequestInt32("NodeID") == -2)
            {
                AdminPage.WriteErrMsg("首页节点不允许删除!", "CategoryManage.aspx");
            }
            switch (Nodes.Delete(BasePage.RequestInt32("NodeID")))
            {
            case 0:
                AdminPage.WriteErrMsg("删除节点失败!", "CategoryManage.aspx");
                return;

            case 1:
                IncludeFile.CreateIncludeFileByAssociateType(AssociateType.Node);
                base.Response.Write("<script type='text/javascript'>parent.frames[\"left\"].location.reload();</script>");
                AdminPage.WriteSuccessMsg("删除节点成功!请记得重新生成相关节点的文件呀!", "CategoryManage.aspx");
                return;

            case 2:
                AdminPage.WriteErrMsg("节点不存在,或者已经被删除!", "CategoryManage.aspx");
                return;
            }
        }
        private void ResetChildNodes()
        {
            int num = 0;

            num = Nodes.ResetChildNodes(BasePage.RequestInt32("NodeID"));
            if (num > 0)
            {
                if (num == 1)
                {
                    AdminPage.WriteErrMsg("<li>请选择你要复位的一级节点,一级节点以下的节点不能进行复位操作!</li>", "CategoryManage.aspx");
                }
                else
                {
                    AdminPage.WriteErrMsg("<li>复位节点失败!</li>", "CategoryManage.aspx");
                }
            }
            else
            {
                IncludeFile.CreateIncludeFileByAssociateType(AssociateType.Node);
                base.Response.Write("<script type='text/javascript'>parent.frames[\"left\"].location.reload();</script>");
                AdminPage.WriteSuccessMsg("<li>复位节点成功!</li>", "CategoryManage.aspx");
            }
        }