コード例 #1
0
        public EditorINIData Read(FileEncoding encoding, int templateFileIndex)
        {
#if DEBUG
            System.Diagnostics.Stopwatch st = new System.Diagnostics.Stopwatch();
            st.Start();
#endif
            INIBlocks iniData = null;
            try
            {
                //read basic file structure
                if (encoding == FileEncoding.Automatic || encoding == FileEncoding.BINI)
                {
                    IsBini = true;

                    BINIManager biniManager = new BINIManager(File);
                    biniManager.Read();
                    if (biniManager.IsBini)
                    {
                        iniData = biniManager.Data;
                    }
                    else
                    {
                        if (encoding == FileEncoding.Automatic)
                        {
                            iniData = ReadINI();
                        }
                        else
                        {
                            return(null);
                        }
                    }
                }
                else
                {
                    iniData = ReadINI();
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
#if DEBUG
            st.Stop();
            System.Diagnostics.Debug.WriteLine("load data: " + st.ElapsedMilliseconds + "ms");
#endif

            return(GetEditorData(iniData, templateFileIndex));;
        }
コード例 #2
0
        public EditorINIData Read(FileEncoding encoding, int templateFileIndex)
        {
#if DEBUG
            Stopwatch st = new Stopwatch();
            st.Start();
#endif
            List <INIBlock> iniData;
            //read basic file structure
            if (encoding == FileEncoding.Automatic || encoding == FileEncoding.BINI)
            {
                IsBINI = true;

                BINIManager biniManager = new BINIManager(File);
                if (biniManager.Read())
                {
                    iniData = biniManager.Data;
                }
                else
                {
                    if (encoding == FileEncoding.Automatic)
                    {
                        iniData = ReadINI();
                    }
                    else
                    {
                        return(null);
                    }
                }
            }
            else
            {
                iniData = ReadINI();
            }
#if DEBUG
            st.Stop();
            Debug.WriteLine("load data: " + st.ElapsedMilliseconds + "ms");
#endif

            return(GetEditorData(iniData, templateFileIndex));
        }