Example #1
0
        public bool BuildItemIndex(string dir_path)
        {
            BaseXlsParser parser = this.GetParser(XLS_PARSER_TYPE.ITEM);

            if (null == parser)
            {
                return(false);
            }

            string[] xls_list = { "W-装备.xls", "W-被动消耗类.xls", "W-主动使用消耗类.xls", "W-礼包类.xls", "W-虚拟类.xls" };

            XDocument xmldoc    = new XDocument();
            XElement  root_node = new XElement("config");

            xmldoc.Add(root_node);

            for (int i = 0; i < xls_list.Length; ++i)
            {
                List <ISheet> sheet_list = new List <ISheet>();
                if (!XlsReader.Instance.ReadExcel(dir_path + xls_list[i], sheet_list))
                {
                    return(false);
                }

                List <Table> temp_list = new List <Table>();
                if (!parser.Parse(sheet_list, temp_list))
                {
                    return(false);
                }

                string file_name = parser.GetFileName();

                foreach (Table table in temp_list)
                {
                    XElement table_node = new XElement(table.name);
                    root_node.Add(table_node);

                    foreach (var val_list in table.itemList)
                    {
                        XElement path_node = new XElement("path");
                        path_node.SetValue(string.Format("{0}/{1}.xml", file_name, val_list[0], val_list[1]));
                        table_node.Add(path_node);
                    }
                }
            }

            string path = string.Format("{0}/gameworld/itemmanager.xml", ConfigIni.XmlDir);

            Command.Instance.AddSvnAddFilePath(path);

            Writer.Instance.WriteXml(path, xmldoc);
            Command.Instance.AddSvnCommitFilePath(path);

            return(true);
        }
Example #2
0
        public bool BuildServer(XLS_PARSER_TYPE parser_type, List <ISheet> sheet_list)
        {
            BaseXlsParser parser = this.GetParser(parser_type);

            if (null == parser)
            {
                return(false);
            }

            List <Table> table_list = new List <Table>();

            if (!parser.Parse(sheet_list, table_list))
            {
                return(false);
            }

            return(parser.BuildServerXml(table_list));
        }
Example #3
0
        public bool BuildClient(XLS_PARSER_TYPE parser_type, List <ISheet> sheet_list)
        {
            BaseXlsParser parser = this.GetParser(parser_type);

            if (null == parser)
            {
                return(false);
            }

            List <Table> table_list = new List <Table>();

            if (!parser.Parse(sheet_list, table_list))
            {
                return(false);
            }

            parser.PostProcessTableList(table_list);

            return(parser.BuildClientLua(table_list));
        }