public bool Load(string strListFileName)
        {
            bool result;

            try
            {
                using (NDataReader nDataReader = new NDataReader())
                {
                    if (!nDataReader.Load(strListFileName))
                    {
                        this.m_bLoadedOrSkipped = false;
                        result = false;
                        return(result);
                    }
                    this.FilesList.Clear();
                    NDataReader nDataReader2 = nDataReader;
                    this.m_bLoadedOrSkipped = this.ReadFinalList2(ref nDataReader2);
                    if (!this.m_bLoadedOrSkipped)
                    {
                        this.m_bLoadedOrSkipped = this.ReadFinalList(ref nDataReader2);
                    }
                }
                result = this.m_bLoadedOrSkipped;
            }
            catch (Exception ex)
            {
                Console.WriteLine("The process failed: {0}", ex.ToString());
                this.m_bLoadedOrSkipped = false;
                result = false;
            }
            return(result);
        }
        public static float GetLocalResourceVersion(string localPath)
        {
            int    num  = 0;
            string text = Path.Combine(localPath, "PatchLevel.ini");

            if (File.Exists(text))
            {
                NDataReader nDataReader = new NDataReader();
                if (nDataReader.Load(text))
                {
                    num = nDataReader["Local"]["PatchLevel"];
                }
            }
            string text2 = Path.Combine(localPath, string.Format("PatchedVersion.{0}.txt", num));

            if (!File.Exists(text2))
            {
                return(-1f);
            }
            NDataReader nDataReader2 = new NDataReader();

            if (nDataReader2.Load(text2))
            {
                return(nDataReader2["Local"]["PatchedVersion"]);
            }
            return(-1f);
        }
示例#3
0
        public bool LoadFromDataReader(string path, string sectionName)
        {
            bool bAutoReplace = this.m_owner.CRLFReplaceTime == NTextManager.CRLFReplaceTimeType.LOADING;

            try
            {
                NDataReader nDataReader = new NDataReader();
                nDataReader.UseFileNameEncryption = this.m_UseFileNameEncryption;
                nDataReader.Load(path);
                NDataSection nDataSection = nDataReader[sectionName];
                foreach (NDataReader.Row row in nDataSection)
                {
                    int    textKeyStartColumnIndex = NTextManager.TextKeyStartColumnIndex;
                    string column  = row.GetColumn(textKeyStartColumnIndex, bAutoReplace);
                    string column2 = row.GetColumn(textKeyStartColumnIndex + 1, bAutoReplace);
                    this.SetText(column, column2);
                }
                return(true);
            }
            catch (Exception output)
            {
                this._OutputDebugLine(output);
            }
            return(false);
        }
示例#4
0
        public static void NDataReader_Performance(string strTestFileName, bool bUseOptimize, bool bLoadFromFile, int nTestMax, bool bDataPrint)
        {
            NDataReader.UseOptimize = bUseOptimize;
            TimeSpan t  = TimeSpan.MinValue;
            TimeSpan t2 = TimeSpan.MaxValue;
            TimeSpan t3 = TimeSpan.Zero;

            for (int i = 0; i < nTestMax; i++)
            {
                using (NDataReader nDataReader = new NDataReader())
                {
                    Stopwatch stopwatch = new Stopwatch();
                    if (bLoadFromFile)
                    {
                        stopwatch.Reset();
                        stopwatch.Start();
                        nDataReader.Load(strTestFileName);
                        stopwatch.Stop();
                    }
                    else
                    {
                        using (StreamReader streamReader = new StreamReader(strTestFileName, Encoding.Default, true))
                        {
                            string strContext = streamReader.ReadToEnd();
                            stopwatch.Reset();
                            stopwatch.Start();
                            nDataReader.BeginSection("[Table]");
                            nDataReader.LoadFrom(strContext);
                            stopwatch.Stop();
                            streamReader.Close();
                        }
                    }
                    if (t < stopwatch.Elapsed)
                    {
                        t = stopwatch.Elapsed;
                    }
                    if (stopwatch.Elapsed < t2)
                    {
                        t2 = stopwatch.Elapsed;
                    }
                    t3 += stopwatch.Elapsed;
                    if (bDataPrint)
                    {
                        foreach (NDataReader.Row value in nDataReader)
                        {
                            Console.WriteLine(value);
                        }
                    }
                }
            }
            Console.WriteLine("##### 최적화 여부 : {0} , 로드방식 : {1} #####", NDataReader.UseOptimize, (!bLoadFromFile) ? "컨텍스트로부터" : "파일로부터");
            Console.WriteLine("  * Test Amount : {0}", nTestMax);
            Console.WriteLine("  * Max Time : {0} tick ({1})", t.Ticks, t.ToString());
            Console.WriteLine("  * Min Time : {0} tick ({1})", t2.Ticks, t2.ToString());
            Console.WriteLine("  * Avg Time : {0} tick ({1})", t3.Ticks / (long)nTestMax, TimeSpan.FromTicks(t3.Ticks / (long)nTestMax).ToString());
            Console.WriteLine();
        }
        public static bool Load(string ndtfile, ITable table, NDataGenericLoader.DataCtor ctor, bool useFileNameEncryption = false)
        {
            NDataReader nDataReader = new NDataReader();

            nDataReader.UseFileNameEncryption = useFileNameEncryption;
            if (nDataReader.Load(ndtfile))
            {
                NDataGenericLoader.CommonParse(nDataReader, table, ctor);
                return(true);
            }
            return(false);
        }
示例#6
0
 public bool Load(string filename)
 {
     using (NDataReader nDataReader = new NDataReader())
     {
         nDataReader.Load(filename);
         NDataSection nDataSection = nDataReader["Table"];
         foreach (NDataReader.Row row in nDataSection)
         {
             if (!this.ParseRowData(row))
             {
                 return(false);
             }
         }
     }
     return(true);
 }
示例#7
0
        public static void NDataReader_Load_Instantly()
        {
            string strFileName = "D:\\quest.ndt";

            Example.TestBindee testBindee = new Example.TestBindee();
            using (NDataReader nDataReader = new NDataReader())
            {
                bool flag = nDataReader.Load(strFileName, "[table]", testBindee);
                if (flag)
                {
                }
            }
            foreach (NDataReader.Row current in testBindee.m_kRows)
            {
                Console.WriteLine(current);
            }
        }
        public bool Load(string strListFileName, IUpdateCustomCacheInfo updateCustomCacheInfo)
        {
            if (updateCustomCacheInfo != null)
            {
                this.UpdateCustomCacheInfo = updateCustomCacheInfo;
            }
            bool result;

            try
            {
                if (Path.GetExtension(strListFileName).ToLower() == ".zip")
                {
                    using (FileStream fileStream = new FileStream(strListFileName, FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
                    {
                        using (BinaryReader binaryReader = new BinaryReader(fileStream))
                        {
                            byte[] gzData = binaryReader.ReadBytes((int)fileStream.Length);
                            result = this.LoadFromComp(gzData, updateCustomCacheInfo);
                            return(result);
                        }
                    }
                }
                NDataReader nDataReader = new NDataReader();
                if (!nDataReader.Load(strListFileName))
                {
                    this.m_bLoadedOrSkipped = false;
                    result = false;
                }
                else
                {
                    this.FilesList.Clear();
                    this.m_bLoadedOrSkipped = this.ReadFinalList2(ref nDataReader);
                    result = this.m_bLoadedOrSkipped;
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine("The process failed: {0}", ex.ToString());
                this.m_bLoadedOrSkipped = false;
                result = false;
            }
            return(result);
        }
示例#9
0
 public bool LoadFromGroupList(string groupListPath, bool useFileNameEncryption = false, string sectinName = "[TextFiles]")
 {
     try
     {
         bool result;
         if (groupListPath == null)
         {
             result = false;
             return(result);
         }
         string      strFilePath = groupListPath.Substring(0, groupListPath.ToLower().IndexOf("/ndt/") + 1);
         NDataReader nDataReader = new NDataReader();
         nDataReader.UseFileNameEncryption = useFileNameEncryption;
         if (nDataReader.Load(groupListPath))
         {
             if (nDataReader.BeginSection(sectinName))
             {
                 foreach (NDataReader.Row row in nDataReader)
                 {
                     string str  = row[0].str;
                     string str2 = row[1].str;
                     if (!this.LoadTextGroup(str, str2, strFilePath, useFileNameEncryption))
                     {
                         result = false;
                         return(result);
                     }
                 }
             }
             result = true;
             return(result);
         }
         result = false;
         return(result);
     }
     catch (Exception output)
     {
         this._OutputDebugLine(output);
     }
     return(false);
 }