Esempio n. 1
0
        //processing files lists
        public static void ProcessFileLists(string sFolderPath, FolderProcessingParams cfg)
        {
            RefreshInfo(sFolderPath, false, false);
            FileSkipCount = 0;

            var iExcludeCount = 0;
            var argHandler    = new ArgumentsHandler();
            var lConvParms    = new List <ImageManager.ConversionParameters>();

            foreach (var s in fileList)
            {
                if (!argHandler.IsFileExcluded(s, cfg))
                {
                    lConvParms.Add(argHandler.GetConversionParameters(s, cfg));
                }
                else
                {
                    iExcludeCount += 1;
                }
            }

            var iStep = 0;

            MainForm.Log_WriteLine("-----");
            MainForm.Log_WriteLine("Starting conversion of " + fileList.Count + " files.");
            MainForm.Log_WriteLine("    MBM count : " + argHandler.Count_MBM + ".");
            MainForm.Log_WriteLine("    TGA count : " + argHandler.Count_TGA + ".");
            MainForm.Log_WriteLine("    PNG count : " + argHandler.Count_PNG + ".");
            MainForm.Log_WriteLine(iExcludeCount + " files excluded, " + argHandler.Count_NoMipmaps + " files without mipmaps. " + (argHandler.Count_ForceNormal + argHandler.Count_ForceNotNormal) + " files will skip normal detection." + argHandler.Count_NoResize + " files will not be resized.");
            MainForm.Log_WriteLine("-----");

            var sw = Stopwatch.StartNew();

            //processing
            foreach (var c in lConvParms)
            {
                if (c.FileType == ImageManager.FileType.MBM)
                {
                    ImageManager.ConvertMBMtoDDS(c, cfg);
                }
                else
                {
                    ImageManager.ConvertFileToDDS(c, cfg);
                }

                iStep += 1;

                MainForm.ReportProgress(Convert.ToInt32((iStep / lConvParms.Count) * 100), "Processing " + Path.GetFileName(c.FilePath) + ", file " + iStep + "\\" + lConvParms.Count);
                MainForm.Log_WriteLine("---");
                Application.DoEvents();
            }

            sw.Stop();
            MainForm.Log_WriteLine("-----");
            MainForm.Log_WriteLine(String.Format("Conversion done! {0} files processed in {1}ms.", lConvParms.Count, sw.Elapsed.TotalMilliseconds));
            if (FileSkipCount > 0)
            {
                MainForm.Log_WriteLine(FileSkipCount + " files skipped, check log.txt for more informations.");
            }
            MainForm.Log_WriteLine("-----");
        }