Esempio n. 1
0
        public void loadAll()
        {
            var pos2 = GetPath("{game}\\TetraProject_Data\\StreamingAssets\\Packages\\Builtin\\Database\\CardCommand.csv");

            if (EdLib.HasFile(pos2))
            {
                if (AutoCompleteData == null)
                {
                    AutoCompleteData = new List <ICompletionData>();
                    var obj = new ReoGridControl();
                    obj.Load(pos2, unvell.ReoGrid.IO.FileFormat.CSV);
                    for (int i = 1; i < obj.CurrentWorksheet.RowCount; i++)
                    {
                        if (obj.CurrentWorksheet[i, 0] != null)
                        {
                            if (obj.CurrentWorksheet[i, 1] != null)
                            {
                                AutoCompleteData.Add(new MyCompletionData(obj.CurrentWorksheet[i, 0].ToString(), obj.CurrentWorksheet[i, 1].ToString()));
                            }
                        }
                    }
                    obj.Dispose();
                }
            }


            if (EdLib.HasFile(path_CurrentPackage, true))
            {
                //sheet.SetColumnsWidth(0, 1, 50);
                IsCurrentPackageSteamWorkshop = false;
                var pos = GetPath(path_CurrentPackage) + "\\Database\\";
                if (path_CurrentPackage.Contains("steamapps"))
                {
                    IsCurrentPackageSteamWorkshop = true;
                }
                //return;
                try
                {
                    if (IsCSVLoader)
                    {
                        LoadCSV(pos);
                    }
                    else
                    {
                        if (EdLib.HasFile(pos + "database.xlsx"))
                        {
                            ReoMain.Load(pos + "database.xlsx", unvell.ReoGrid.IO.FileFormat.Excel2007);
                        }
                        else
                        {
                            ReoMain.Load(pos + "database.xls", unvell.ReoGrid.IO.FileFormat.Excel2007);
                        }
                    }
                }
                catch (Exception e)
                {
                    if (e.Message.Contains("ZipFile"))
                    {
                        //直接读取--- csv
                        LoadCSV(pos);
                    }
                    else
                    {
                        EdLib.AskMsg("读取资料库时发生严重异常,错误信息:\n" + e.ToString() + "\n" + e.Message);

                        return;
                    }
                }

                ReoMain.Readonly = IsCurrentPackageSteamWorkshop;

                foreach (var item in reoGridControl2.Worksheets)
                {
                    item.NameTextColor          = EdLib.CFore;
                    item.NameBackColor          = EdLib.CBack;
                    item.SelectionRangeChanged += Item_SelectionRangeChanged;
                    if (item.Name == "Card")
                    {
                        ReoMain.CurrentWorksheet = item;
                    }
                }

                LoadSheet();
                return;
            }
        }