Beispiel #1
0
        private static double LoadFilesBySelf()
        {
            List <string> packedFileNames = PackedFileMgr.Ins.PackedFileNames;

            SpeedTester2 = new SpeedTester("我的方案: ");
            for (int i = 0; i < packedFileNames.Count; i++)
            {
                string fileName = packedFileNames[i];

                byte[] returnData = PackedFileMgr.Ins.Load(fileName);
                if ((returnData != null) && (returnData.Length > 0))
                {
                    SelfFileCount++;
                    SpeedTester2.AddLoaded((uint)returnData.Length);
                }
                else
                {
                    ConsoleMgr.LogRed("错误:获取不到文件名为" + fileName + "的数据,该文件数据可能为空!");
                }
            }

            if (SelfFileCount == PackedFileMgr.Ins.PackFilesCount)
            {
                double mySpeed = SpeedTester2.GetSpeed();
                return(mySpeed);
            }

            return(0);
        }
Beispiel #2
0
        public static void Main(string[] args)
        {
            //方案1:用系统自带API
            SpeedTester1 = new SpeedTester("系统方案: ");
            LoadFiles();
            double systemSpeed = SpeedTester1.GetSpeed();

            Console.WriteLine("");

            //方案2:用自写API
            double mySpeed = LoadFilesBySelf();
            double compare = mySpeed / systemSpeed;

            Console.WriteLine("");
            ConsoleMgr.LogRed("我的方案速率是系统方案速率的 " + compare.ToString("F2") + " 倍");

            PackedFileMgr.Ins.Release();
        }