/// <summary> /// Queues an install action to be run in a few seconds. /// </summary> /// <param name="action"> /// The install action. /// </param> private void QueueInstallAction(Action action) { lock (InstallActionsLock) { InstallActions.Add(action); if (InstallTimer == null) { var twentySeconds = 1000 * 20; InstallTimer = new Timer(twentySeconds); InstallTimer.AutoReset = false; InstallTimer.Elapsed += HandleInstallTimerElapsed; InstallTimer.Start(); } } }
private ModDestinations findDestination() { ReadOnlyCollection <ArchiveFileInfo> info; info = new SevenZipExtractor(FilePath).ArchiveFileData; bool couldBeJAR = false; bool couldBeMOD = false; Regex builtIn = new Regex(@"^[a-z]{1,3}.class"); Regex mod = new Regex(@"^mod_.+"); foreach (ArchiveFileInfo finfo in info) { if (builtIn.Match(finfo.FileName).Success) { couldBeJAR = true; } if (mod.Match(finfo.FileName).Success) { couldBeMOD = true; } } if (couldBeJAR) { InstallActions.Add(new DirectoryCopyAction(@"MODROOT", @"JAR", tags)); return(ModDestinations.JAR); } else if (couldBeMOD) { InstallActions.Add(new FileCopyAction(@"ZIP", @"MODS/NAME", tags)); return(ModDestinations.MODS); } else { return(ModDestinations.COMPLEX); } }