예제 #1
0
        /// <summary>
        /// 获得csvmod加载的文件内容,并按照“前后名id”,放到NameContainer的各自的List中(0->只做前名,1->只做后名,2->前后名都可以做)
        /// NameContainer< <0, <前名...> > , <1, <后名...> , <2 ,<前/后...> > >
        /// </summary>
        private void InitNameDictionary()
        {
            if (0 == (tempList = csvmod.GetAllData()).Count)//若是没加载Name.csv文件,先加载.
            {
                if (!csvmod.LoadCsvStr())
                {
                    DebugMod.Log("Load NameFile Failed!");
                }
                else
                {
                    for (int index = 0; index < tempList.Count; index++)
                    {
                        int    nameId = int.Parse(tempList[index]["前后代号"]); //前后代号:各种名字的id
                        string name   = tempList[index]["备用名字"];            // 代号对应的名字

                        if (NameContainer.ContainsKey(nameId))
                        {
                            NameContainer[nameId].Add(name);
                        }
                        else
                        {
                            NameContainer.Add(nameId, new List <string>());
                        }
                    }
                }
            }
        }
예제 #2
0
        private int getRowNumById(int id)
        {
            int index = 0;
            List <Dictionary <string, string> > tempList = null;

            tempList = csvMod.GetAllData();
            foreach (var temp in tempList)
            {
                if (id == int.Parse(temp["ID"]))
                {
                    return(index);
                }
                index++;
            }

            return(-1);
        }