Esempio n. 1
0
        internal static void DoScan(string path, string filter, bool checkTmd, bool checkVdf, bool checkTim, bool checkPmd, bool checkTod, bool checkHmd, bool log, bool noVerbose, bool debug, bool checkCroc, bool checkPsx, bool checkAn, bool ignoreTmdVersion, bool checkBff)
        {
            if (!Directory.Exists(path) && !File.Exists(path))
            {
                Logger.WriteErrorLine("Directory/File not found");
                return;
            }

            Scanning = true;

            Logger = new Logger(log, noVerbose);

            _checkAll = !(checkTmd || checkVdf || checkTim || checkPmd || checkTod || checkHmd || checkCroc || checkPsx || checkAn || checkBff);
            _path     = path;
            Filter    = filter;
            _checkTmd = checkTmd;
            _checkVdf = checkVdf;
            _checkTim = checkTim;
            //_checkTimAlt = checkTimAlt;
            _checkPmd  = checkPmd;
            _checkTod  = checkTod;
            _checkHmd  = checkHmd;
            _checkCroc = checkCroc;
            _checkPsx  = checkPsx;
            _checkAn   = checkAn;
            _checkBff  = checkBff;

            Log       = log;
            NoVerbose = noVerbose;

            IgnoreTmdVersion = ignoreTmdVersion;
            Debug            = debug;

            AllEntities   = new List <RootEntity>();
            AllTextures   = new List <Texture>();
            AllAnimations = new List <Animation>();

            PreviewForm = new PreviewForm((form) =>
            {
                form.UpdateAnimations(AllAnimations);
                form.UpdateRootEntities(AllEntities);
                form.UpdateTextures(AllTextures);
            });

            var thread = new Thread(new ThreadStart(delegate
            {
                Application.EnableVisualStyles();
                Application.Run(PreviewForm);
            }));

            thread.SetApartmentState(ApartmentState.STA);
            thread.Start();

            try
            {
                //Program.Logger.WriteLine("");
                Program.Logger.WriteLine("Scan begin {0}", DateTime.Now.ToString(CultureInfo.InvariantCulture));

                ScanFiles();

                //Program.Logger.WriteLine("");
                Program.Logger.WriteLine("Scan End {0}", DateTime.Now.ToString(CultureInfo.InvariantCulture));
                Program.Logger.WritePositiveLine("Found {0} Models", AllEntities.Count);
                Program.Logger.WritePositiveLine("Found {0} Textures", AllTextures.Count);
                Program.Logger.WritePositiveLine("Found {0} Animations", AllAnimations.Count);

                PreviewForm.UpdateProgress(0, 0, true, $"{AllEntities.Count} Models, {AllTextures.Count} Textures, {AllAnimations.Count} Animations Found");
            }
            catch (Exception exp)
            {
                Program.Logger.WriteErrorLine(exp);
            }

            Scanning = false;
        }
Esempio n. 2
0
        internal static void DoScan(string path, string filter, bool checkTmd, bool checkTmdAlt, bool checkTim, bool checkTimAlt, bool checkPmd, bool checkTod, bool checkHmdModels, bool log, bool noVerbose, bool debug)
        {
            if (!Directory.Exists(path) && !File.Exists(path))
            {
                Logger.WriteLine("Directory/File not found");
                return;
            }

            Scanning = true;

            Logger = new Logger(log, noVerbose);

            _checkAll       = !(checkTmd || checkTmdAlt || checkTim || checkTimAlt || checkPmd || checkTod || checkHmdModels);
            _path           = path;
            _filter         = filter;
            _checkTmd       = checkTmd;
            _checkTmdAlt    = checkTmdAlt;
            _checkTim       = checkTim;
            _checkTimAlt    = checkTimAlt;
            _checkPmd       = checkPmd;
            _checkTod       = checkTod;
            _checkHmdModels = checkHmdModels;
            _log            = log;
            _noVerbose      = noVerbose;
            _debug          = debug;

            AllEntities   = new List <RootEntity>();
            AllTextures   = new List <Texture>();
            AllAnimations = new List <Animation>();
            PreviewForm   = new PreviewForm((form) =>
            {
                form.UpdateAnimations(AllAnimations);
                form.UpdateRootEntities(AllEntities);
                form.UpdateTextures(AllTextures);
            });

            var t = new Thread(new ThreadStart(delegate
            {
                Application.EnableVisualStyles();
                Application.Run(PreviewForm);
            }));

            t.SetApartmentState(ApartmentState.STA);
            t.Start();

            try
            {
                Logger.WriteLine("");
                Logger.WriteLine("Scan begin {0}", DateTime.Now.ToString(CultureInfo.InvariantCulture));

                ScanFiles();

                Logger.WriteLine("");
                Logger.WriteLine("Scan End {0}", DateTime.Now.ToString(CultureInfo.InvariantCulture));
                Logger.WriteLine("Found {0} Models", AllEntities.Count);
                Logger.WriteLine("Found {0} Textures", AllTextures.Count);
                Logger.WriteLine("Found {0} Animations", AllAnimations.Count);

                PreviewForm.UpdateProgress(0, 0, true, $"{AllEntities.Count} Models, {AllTextures.Count} Textures, {AllAnimations.Count} Animations Found");
            }
            catch (Exception exp)
            {
                Logger.WriteLine(exp);
            }

            Scanning = false;
        }