Esempio n. 1
0
        private void setModifiedData(ModifyData data)
        {
            string graphStr = Regex.Match(jsonData, @"\{([^{]+?)" + data.FileName + @"([^}]+?)\}").Groups[0].Value;
            string sortNo   = Regex.Match(graphStr, @"api_sortno"":(\d+)").Groups[1].Value;
            string infoStr  = Regex.Match(jsonData, @"\{([^{]+?)api_sortno"":" + sortNo + @"([^}]+?)\}").Groups[0].Value;

            var graphReplaceStr = graphStr;
            var infoReplaceStr  = infoStr;

            var temp = data.Data["ship_name"];

            if (temp != null && temp.Length > 0)
            {
                infoReplaceStr = Regex.Replace(infoReplaceStr, @"api_name"":""(.+?)""", @"api_name"":""" + temp + @"""");
            }

            var modList = new string[] { "boko_n", "boko_d",
                                         "kaisyu_n", "kaisyu_d",
                                         "kaizo_n", "kaizo_d",
                                         "map_n", "map_d",
                                         "ensyuf_n", "ensyuf_d",
                                         "ensyue_n",
                                         "battle_n", "battle_d",
                                         "weda", "wedb" };

            foreach (var mod in modList)
            {
                if (!data.Data.ContainsKey("boko_n_left"))
                {
                    break;
                }

                temp = data.Data[mod + "_left"];
                if (temp != null && temp.Length > 0)
                {
                    graphReplaceStr = Regex.Replace(graphReplaceStr, mod + @""":\[([\d-]+),([\d-]+)\]", mod + @""":[" + temp + @",$2]");
                }

                temp = data.Data[mod + "_top"];
                if (temp != null && temp.Length > 0)
                {
                    graphReplaceStr = Regex.Replace(graphReplaceStr, mod + @""":\[([\d-]+),([\d-]+)\]", mod + @""":[$1," + temp + @"]");
                }
            }

            jsonData = jsonData.Replace(graphStr, graphReplaceStr);
            jsonData = jsonData.Replace(infoStr, infoReplaceStr);
        }
Esempio n. 2
0
        private void setModifiedData(ModifyData data)
        {
            string graphStr = Regex.Match(jsonData, @"\{([^{]+?)" + data.FileName + @"([^}]+?)\}").Groups[0].Value;
            string sortNo = Regex.Match(graphStr, @"api_sortno"":(\d+)").Groups[1].Value;
            string infoStr = Regex.Match(jsonData, @"\{([^{]+?)api_sortno"":" + sortNo + @"([^}]+?)\}").Groups[0].Value;

            var graphReplaceStr = graphStr;
            var infoReplaceStr = infoStr;

            var temp = data.Data["ship_name"];
            if (temp != null && temp.Length > 0)
            {
                infoReplaceStr = Regex.Replace(infoReplaceStr, @"api_name"":""(.+?)""", @"api_name"":""" + temp + @"""");
            }

            var modList = new string[] { "boko_n", "boko_d",
                                         "kaisyu_n", "kaisyu_d",
                                         "kaizo_n", "kaizo_d",
                                         "map_n", "map_d",
                                         "ensyuf_n", "ensyuf_d",
                                         "ensyue_n",
                                         "battle_n", "battle_d",
                                         "weda", "wedb" };
            foreach (var mod in modList)
            {
                if(!data.Data.ContainsKey("boko_n_left")) break;

                temp = data.Data[mod + "_left"];
                if (temp != null && temp.Length > 0)
                {
                    graphReplaceStr = Regex.Replace(graphReplaceStr, mod + @""":\[([\d-]+),([\d-]+)\]", mod + @""":[" + temp + @",$2]");
                }

                temp = data.Data[mod + "_top"];
                if (temp != null && temp.Length > 0)
                {
                    graphReplaceStr = Regex.Replace(graphReplaceStr, mod + @""":\[([\d-]+),([\d-]+)\]", mod + @""":[$1," + temp + @"]");
                }
            }

            jsonData = jsonData.Replace(graphStr, graphReplaceStr);
            jsonData = jsonData.Replace(infoStr, infoReplaceStr);
        }