private void DuplicateRemover_Load(object sender, EventArgs e)
 {
     txtDirectory.Text     = RedundantHelper.GetDefaultDirectory();
     ttRegions.IsBalloon   = true;
     ttDirectory.IsBalloon = true;
     ttRegions.SetToolTip(lbRegions, "Write the priority of certain regions, whatever is not written will fall under the same priority level.\nExample: (USA), (Europe), (Japan)\nKeep in mind that some regions might be written as [U] instead.");
     ttDirectory.SetToolTip(lbDirectory, "Put the root directory of the roms that will be checked for duplicates, subdirectories will also be checked. \nCurrently checking across multiple emulators at the same time will yield results undesired.");
 }
Example #2
0
 private void CompressRom_Load(object sender, EventArgs e)
 {
     txtDirectory.Text     = RedundantHelper.GetDefaultDirectory();
     ttDirectory.IsBalloon = true;
     ttef.IsBalloon        = true;
     tte.IsBalloon         = true;
     tte.SetToolTip(lbEmulator, "These systems have at least one emulator that supports zip files.");
     ttDirectory.SetToolTip(lbDirectory, "Put the root directory of the roms that will be zip'd.");
     ttef.SetToolTip(cbExtract,
                     "Roms that are already zip'd up will be extracted and then zip'd up using this program's algorithm.\nThis is only to see if this program's algorithm can help you save some extra space.");
 }
Example #3
0
        private void BtnMove_Click(object sender, EventArgs e)
        {
            var reader = txtDirectory.Text;

            if (!RedundantHelper.DirectoryCheck(reader))
            {
                return;
            }

            var files      = from f in Directory.GetFiles(reader, "*.*", SearchOption.AllDirectories) where !Path.GetDirectoryName(f).EndsWith(new DirectoryInfo(reader).Name) select f;
            var failfolder = new ArrayList();

            if (cbRename.Checked)
            {
                foreach (var file in files)
                {
                    var newfile = Path.GetDirectoryName(file) + @"\" + new FileInfo(file).Directory.Name + Path.GetExtension(file);
                    if (!File.Exists(newfile))
                    {
                        File.Move(file, newfile);
                    }
                    else
                    {
                        failfolder.Add(newfile);
                    }
                }
            }

            RedundantHelper.FileMaker(failfolder, "FileFolderRenamer");

            if (!reader.EndsWith(@"\"))
            {
                reader = reader + @"\";
            }

            files = from f in Directory.GetFiles(reader, "*.*", SearchOption.AllDirectories) where !Path.GetDirectoryName(f).EndsWith(new DirectoryInfo(reader).Name) select f;
            var fail = new ArrayList();

            foreach (var file in files)
            {
                var newfile = reader + Path.GetFileName(file);
                if (!File.Exists(newfile))
                {
                    File.Move(file, newfile);
                }
                else
                {
                    fail.Add(newfile);
                }
            }

            RedundantHelper.FileMaker(fail, "MoveToRootFolder");
        }
        private void BtnSubmit_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrWhiteSpace(txtRegions.Text) && model is RegionDuplicateRemover)
            {
                MessageBox.Show(@"Revision field cannot be empty");
                return;
            }

            var files    = Directory.EnumerateFiles(txtDirectory.Text, "*.*", SearchOption.AllDirectories);
            var priority = model is RegionDuplicateRemover?
                           txtRegions.Text.Replace(" ", string.Empty).Split(',').ToList() : RedundantHelper.Alphabet;

            RedundantHelper.FileMaker(new ArrayList(model.dryRun(files, priority)), "DuplicateRemover");
            btnDelete.Enabled = true;
        }
Example #5
0
 private void BtnBrowse_Click(object sender, EventArgs e)
 {
     txtDirectory.Text = RedundantHelper.Browse(txtDirectory.Text);
 }
Example #6
0
        private void BtnStart_Work(object sender, EventArgs e)
        {
            var reader = txtDirectory.Text;

            if (!RedundantHelper.DirectoryCheck(reader))
            {
                return;
            }
            int percentage;

            if (cbExtract.Checked)
            {
                var extract = new List <string>();
                extract.AddRange(Directory.GetFiles(reader, "*.zip", SearchOption.AllDirectories));
                extract.AddRange(Directory.GetFiles(reader, "*.7z", SearchOption.AllDirectories));
                var i = 0;

                foreach (var rom in extract)
                {
                    Compressor.DecompressFile(rom, reader);

                    percentage = (i + 1) * 100 / extract.Count;
                    i++;
                    _bw.ReportProgress(percentage);
                }

                extract.Clear();
            }

            var extensions =
                new Dictionary <string, ArrayList>
            {
                { "nes", new ArrayList {
                      "nes", "smc", "sfc", "fig", "swc", "mgd", "fds"
                  } },
                { "sg-1000", new ArrayList {
                      "sg"
                  } },
                { "snes", new ArrayList {
                      "smc", "sfc", "fig", "swc"
                  } },
                { "gb", new ArrayList {
                      "gb"
                  } },
                { "gbc", new ArrayList {
                      "gbc"
                  } },
                { "gba", new ArrayList {
                      "gba"
                  } },
                { "ds", new ArrayList {
                      "nds"
                  } },
                { "32x", new ArrayList {
                      "32x", "smd", "bin", "md"
                  } },
                { "genesis", new ArrayList {
                      "smd", "bin", "md", "iso", "gen"
                  } },
                { "n64", new ArrayList {
                      "z64", "n64", "v64"
                  } },
                { "mastersystem", new ArrayList {
                      "sms"
                  } },
                { "atari2600", new ArrayList {
                      "bin", "a26", "rom", "gz"
                  } },
                { "lynx", new ArrayList {
                      "lnx"
                  } },
                { "gamegear", new ArrayList {
                      "gg"
                  } },
                { "ngp", new ArrayList {
                      "ngp"
                  } },
                { "ngc", new ArrayList {
                      "ngc"
                  } },
                { "pcengine", new ArrayList {
                      "pce", "cue"
                  } },
                { "z-machine", new ArrayList {
                      "dat", "z1", "z2", "z3", "z4", "z5", "z6", "z7", "z8"
                  } }
            };

            var emulators = new ArrayList();

            foreach (var c in gbEmulator.Controls.OfType <CheckBox>().Where(x => x.Checked))
            {
                emulators.Add(c.Text.Replace(" ", string.Empty).ToLower());
            }

            var mode = 0;

            if (rad7z.Checked)
            {
                mode = 1;
            }

            try
            {
                foreach (string emu in emulators)
                {
                    foreach (var ext in extensions[emu])
                    {
                        var roms = Directory.GetFiles(reader, "*." + ext, SearchOption.AllDirectories);
                        var i    = 0;

                        foreach (var rom in roms)
                        {
                            Compressor.CompressFile(rom, reader, mode, cbDeleteOriginal.Checked);
                            percentage = (i + 1) * 100 / roms.Length;
                            i++;
                            _bw.ReportProgress(percentage);
                        }
                    }
                }
            }

            catch
            {
                //ignored since an emulator was probably checked that the user doesn't have games for
            }
        }