private static void InitPatches() { // Don't need to try running the loop if the list is null or there aren't any files in it. if (options.PatchFiles == null || options.PatchFiles.Count < 1) { return; } for (int i = 0; i < options.PatchFiles.Count; i++) { ILumpContainer container = null; string file = options.PatchFiles [i]; if (File.Exists(file)) { if (ZipLumpContainer.CheckContainer(file)) { container = new ZipLumpContainer(file); } } if (container != null) { GConsole.WriteLine(" Adding \"{0}\", {1} lumps", file, container.Count); LumpManager.AddContainer(container); } else { throw new FatalError(string.Format("Could not identify patch {0}. Stopping execution.", file)); } } }
/// <summary> /// Adds a container to the container list. /// </summary> /// <param name="container">The container to add.</param> /// <returns>True if the container was added successfully. False if the container couldn't be added -or- the container is already in the list.</returns> /// <exception cref="ArgumentNullException">Thrown if container is null.</exception> public static bool AddContainer(ILumpContainer container) { if (container == null) { throw new ArgumentNullException("container"); } if (containers.Contains(container)) { return(false); } containers.Add(container); return(true); }