コード例 #1
0
 private void ClearTemporaryItems()
 {
     foreach (var temp in TemporaryRoms)
     {
         var tempRom = temp.Value;
         if (!string.IsNullOrEmpty(tempRom.RomPath) && File.Exists(tempRom.RomPath))
         {
             tempRom.RomPath.ClearReadOnlyAttribute();
             FileUtilities.DeleteFile(tempRom.RomPath, false, 4);
         }
         if (!string.IsNullOrEmpty(tempRom.ConfigPath) && File.Exists(tempRom.ConfigPath))
         {
             tempRom.ConfigPath.ClearReadOnlyAttribute();
             FileUtilities.DeleteFile(tempRom.ConfigPath, false, 4);
         }
     }
     TemporaryRoms.Clear();
     foreach (var temp in TemporaryCanonicalRoms)
     {
         var tempRom = temp.Value;
         if (!string.IsNullOrEmpty(tempRom.RomPath) && File.Exists(tempRom.RomPath))
         {
             tempRom.RomPath.ClearReadOnlyAttribute();
             FileUtilities.DeleteFile(tempRom.RomPath, false, 4);
         }
         if (!string.IsNullOrEmpty(tempRom.ConfigPath) && File.Exists(tempRom.ConfigPath))
         {
             tempRom.ConfigPath.ClearReadOnlyAttribute();
             FileUtilities.DeleteFile(tempRom.ConfigPath, false, 4);
         }
     }
     TemporaryCanonicalRoms.Clear();
 }
コード例 #2
0
        private IRom GetLuigRomForCompare(IRom rom, bool temporaryCopy)
        {
            string temporaryRomPath = null;
            IRom   tempRom          = null;

            if (temporaryCopy && !TemporaryRoms.TryGetValue(rom.RomPath, out tempRom))
            {
                temporaryRomPath = rom.RomPath.EnsureUniqueFileName();
            }
            if (tempRom == null)
            {
                tempRom = (temporaryCopy || rom.RomPath.IsPathOnRemovableDevice()) ? rom.CopyToLocalRomsDirectory(temporaryRomPath) : rom;
            }
            if (temporaryCopy)
            {
                TemporaryRoms[rom.RomPath] = tempRom;
            }
            var luigiPath           = Path.ChangeExtension(tempRom.RomPath, RomFormat.Luigi.FileExtension());
            var jzIntvConfiguration = SingleInstanceApplication.Instance.GetConfiguration <INTV.JzIntv.Model.Configuration>();
            var converterApp        = jzIntvConfiguration.GetConverterApps(tempRom, RomFormat.Luigi).First(); // Convert to LUIGI
            var result = INTV.Shared.Utility.RunExternalProgram.Call(converterApp.Item1, "\"" + tempRom.RomPath + "\"", RomListConfiguration.Instance.RomsDirectory);

            if ((result != 0) || !File.Exists(luigiPath))
            {
                var message = string.Format(System.Globalization.CultureInfo.CurrentCulture, Resources.Strings.LuigiConversionError_Format, rom.RomPath, result);
                throw new System.InvalidOperationException(message);
            }
            return(INTV.Core.Model.Rom.Create(luigiPath, null));
        }