示例#1
0
        void RunTest(ListBox lb)
        {
            ArrayList dirs = FileTable.DefaultFolders;

            Wait.Start();
            Wait.Message = "Sync. Database Cache...";
            Database.FileList list  = new Database.FileList();
            DateTime          start = DateTime.Now;

            foreach (SimPe.FileTableItem s in dirs)
            {
                db.LoadUpdateableFiles(list, s);
                Application.DoEvents();
            }


            DatabaseSyncThread dst = new DatabaseSyncThread(db, list);

            dst.WaitForFinish();
            TimeSpan runtime = DateTime.Now - start;

            //db.AddPackageFile(@"F:\Die Sims 2\TSData\Res\Sims3D\Objects08.package");
            db.Result();
            Console.WriteLine("---------------------------------------------");
            Console.WriteLine("Total Runtime: " + runtime.ToString());
            Wait.Stop();
        }
示例#2
0
        public DatabaseSyncThread(Database db, Database.FileList list)
        {
            this.db   = db;
            this.list = list;

            threads = new Thread[Math.Max(1, SimPe.Helper.WindowsRegistry.SortProcessCount / 4)];
            for (int i = 0; i < threads.Length; i++)
            {
                threads[i]      = new Thread(new ThreadStart(StartThread));
                threads[i].Name = "Sync " + i;
                threads[i].Start();
            }
            while (Running == 0)
            {
                Thread.CurrentThread.Join(100);
            }
        }