示例#1
0
文件: ini2list.cs 项目: scarsty/sfe2
        public static List <R_modify> RiniInital()
        {
            List <R_modify> rini    = new List <R_modify>();
            R_modify        rmodtmp = new R_modify();

            rmodtmp.typeName = "新建类型";
            rmodtmp.ListR    = new List <R_dataType>();
            R_dataType rdatatmp = RdatatypeInital();

            rmodtmp.ListR.Add(rdatatmp);
            rini.Add(rmodtmp);
            return(rini);
        }
示例#2
0
文件: ini2list.cs 项目: scarsty/sfe2
        public static List <R_modify> ini2list(string inifilename)
        {
            try
            {
                inireader       sfeini     = new inireader(inifilename);
                int             TypeNumber = sfeini.ReadIniInt("R_Modify", "TypeNumber");
                List <R_modify> R_ini      = new List <R_modify>();
                for (int num = 0; num < TypeNumber; num++)
                {
                    R_modify Rmtmp = new R_modify();
                    Rmtmp.typeName = sfeini.ReadIniString("R_Modify", "TypeName" + num.ToString());
                    Rmtmp.ListR    = new List <R_dataType>();
                    int TypeDataItem = sfeini.ReadIniInt("R_Modify", "TypeDataItem" + num.ToString());
                    for (int i = 0; i < TypeDataItem; i++)
                    {
                        string     tmpstr   = sfeini.ReadIniString("R_Modify", string.Format("data({0},{1})", num, i));
                        string[]   splitstr = tmpstr.Split(' ');
                        R_dataType Rtmp     = new R_dataType();
                        //煞笔般的分割导入
                        Rtmp.dataNum        = splitstr[0].ToString();
                        Rtmp.dataStructNum  = splitstr[1].ToString();
                        Rtmp.byteNum        = splitstr[2].ToString();
                        Rtmp.isString       = splitstr[3].ToString();
                        Rtmp.isName         = splitstr[4].ToString();
                        Rtmp.dataType       = splitstr[5].ToString();
                        Rtmp.nameStr        = splitstr[6].ToString();
                        Rtmp.DescriptionStr = splitstr[7].ToString();
                        Rmtmp.ListR.Add(Rtmp);
                    }
                    R_ini.Add(Rmtmp);
                }

                return(R_ini);
            }
            catch (Exception ee)
            {
                return(null);
            }
        }