Ejemplo n.º 1
0
 public void RenderAndSaveFixedFile(string path, bool flagAsConverted = false)
 {
     if (!HasFileConvertedFlag() && (file != null))
     {
         while (!FixerHelper.IsFileReady(path))
         {
         }
         file.RenderAndSaveFile(path, flagAsConverted);
     }
 }
Ejemplo n.º 2
0
        public Fixer(string filePath)
        {
            if (File.Exists(filePath) && allowedFiles.Any(x => filePath.EndsWith(x)))
            {
                while (!FixerHelper.IsFileReady(filePath))
                {
                }
                file = new File_ChCr_746(filePath);


                if (!file.HasConvertedFlag() && (!file.HasWrongSignature()))
                {
                    FixFile();
                }
                else
                {
                    isFileConverted = true;
                    Console.WriteLine(file.filePath);
                    Console.WriteLine("FILE ALREADY CONVERTED - IGNORING");
                }
            }
        }
Ejemplo n.º 3
0
 static void Main(string[] args)
 {
     try
     {
         if (args.Length > 0)
         {
             if (args[0] == "-LY")
             {
                 Console.WriteLine("LUMBERYARD");
                 foreach (string path in args)
                 {
                     if (path.Length > 0 && File.Exists(path) && File.Exists(path + "m"))
                     {
                         if (!path.EndsWith("m"))
                         {
                             Fixer fixerPrimary   = new Fixer(path);
                             Fixer fixerSecondary = new Fixer(path + "m");
                             fixerPrimary.RenderAndSaveFixedFile(path, true);
                             fixerSecondary.RenderAndSaveFixedFile(path + "m", true);
                             Merger merger = new Merger(path, path + "m");
                             merger.RenderAndSaveMergedFile(path);
                             File.Delete(path + "m");
                         }
                     }
                     else if (path.Length > 0 && Directory.Exists(path))
                     {
                         Console.WriteLine("Loading Directory Tree...");
                         string[] filesnames = FixerHelper.GetFiles(path);
                         Console.WriteLine("Found {0} files", filesnames.Count());
                         int count = 0;
                         foreach (string path2 in filesnames)
                         {
                             try
                             {
                                 count++;
                                 if (path2.Length > 0 && File.Exists(path2) && File.Exists(path2 + "m"))
                                 {
                                     if (!path.EndsWith("m"))
                                     {
                                         Console.WriteLine("[{0}/{1}]", count, filesnames.Count());
                                         Fixer fixerPrimary   = new Fixer(path2);
                                         Fixer fixerSecondary = new Fixer(path2 + "m");
                                         fixerPrimary.RenderAndSaveFixedFile(path2, true);
                                         fixerSecondary.RenderAndSaveFixedFile(path2 + "m", true);
                                         Merger merger = new Merger(path2, path2 + "m");
                                         merger.RenderAndSaveMergedFile(path2);
                                         File.Delete(path2 + "m");
                                     }
                                 }
                             }
                             catch (Exception e)
                             {
                                 Console.WriteLine(">> Error: " + e);
                                 Console.WriteLine("");
                                 Console.WriteLine("Press Enter to continue converting.");
                                 Console.Read();
                             }
                         }
                     }
                 }
             }
             else
             {
                 foreach (string path in args)
                 {
                     if (path.Length > 0 && File.Exists(path) && Fixer.allowedFiles.Any(x => path.EndsWith(x)))
                     {
                         Fixer fixer = new Fixer(path);
                         fixer.RenderAndSaveFixedFile(path, true);
                     }
                     else if (path.Length > 0 && Directory.Exists(path))
                     {
                         Console.WriteLine("Loading Directory Tree...");
                         string[] filesnames = FixerHelper.GetFiles(path);
                         Console.WriteLine("Found {0} files", filesnames.Count());
                         int count = 0;
                         foreach (string path2 in filesnames)
                         {
                             try
                             {
                                 count++;
                                 if (path2.Length > 0 && File.Exists(path2) && Fixer.allowedFiles.Any(x => path2.EndsWith(x)))
                                 {
                                     Console.WriteLine("[{0}/{1}]", count, filesnames.Count());
                                     Fixer fixer = new Fixer(path2);
                                     fixer.RenderAndSaveFixedFile(path2, true);
                                 }
                             }
                             catch (Exception e)
                             {
                                 Console.WriteLine(path2);
                                 Console.WriteLine(">> Error: " + e);
                                 Console.WriteLine("");
                                 Console.WriteLine("Press Enter to continue converting.");
                                 Console.Read();
                             }
                         }
                     }
                 }
             }
         }
     }
     catch (Exception e)
     {
         Console.WriteLine(">> Error: " + e);
         Console.Read();
     }
     Console.Write("ALL DONE\n");
     Console.Read();
 }