Provides ModMaker and general .mod functions.
        public static void AddJob(ITexture2D tex2D, string ReplacingImage, int WhichGame, string pathBIOGame)
        {
            if (JobList.Count == 0)
            {
                Initialise();
            }
            ModJob job = ModMaker.CreateTextureJob(tex2D, ReplacingImage, WhichGame, pathBIOGame);

            JobList.Add(job);
        }
            /// <summary>
            /// Updates current job script to new format. Returns true if all bits to udpdate are found. NOTE that true does not mean updated script works.
            /// </summary>
            /// <param name="BIOGames">List of BIOGame paths for the games. MUST have only 3 elements. Each can be null if game files not found.</param>
            /// <param name="ExecFolder">Path to the ME3Explorer \exec\ folder.</param>
            /// <returns>True if all bits to update are found in current script.</returns>
            public bool UpdateJob(List <string> BIOGames, string ExecFolder)
            {
                bool retval = true;

                // KFreon: Ensure game target known

                /*if (WhichGame == -1)
                 * {
                 *  // KFreon: See if given pcc's exist on disk, and if so which game to they belong to. All basegame pcc's must be part of the same game.
                 *  int game = PCCObjects.Misc.SearchForPCC(PCCs, BIOGames, ExpIDs, ObjectName, JobType =="TEXTURE");
                 *
                 *  DebugOutput.PrintLn("Got game: " + game);
                 *
                 *  if (game == -1)
                 *  {
                 *      DebugOutput.PrintLn("Unable to find pcc's for job: " + Name);
                 *      retval = false;
                 *      WhichGame = 0;
                 *  }
                 *  else
                 *      WhichGame = game;
                 * }*/

                // KFreon: Return if already failed
                if (!retval)
                {
                    return(retval);
                }


                // KFreon: If texture job, fix pcc pathing.

                //string pathBIOGame = WhichGame == 1 ? Path.GetDirectoryName(BIOGames[WhichGame - 1]) : BIOGames[WhichGame - 1];
                // Heff: Seems like we change the paths in so many places that it's bound to f**k up somewhere. Also VERY unfriendly to DLC mods, so chanigs this.
                string pathBIOGame = BIOGames[WhichGame - 1];

                /*if (WhichGame == 3)
                 *  pathBIOGame = Path.Combine(pathBIOGame, "CookedPCConsole");
                 * else
                 *  pathBIOGame = Path.Combine(pathBIOGame, "CookedPC");*/

                // KFreon: Deal with multiple files found during search
                List <string> multiples;
                List <int>    MultiInds;

                // KFreon: Must be the same number of pcc's and expID's
                if (PCCs.Count != ExpIDs.Count)
                {
                    DebugOutput.PrintLn("Job: " + Name + " has " + PCCs.Count + " PCC's and " + ExpIDs.Count + " ExpID's. Incorrect, so skipping...");
                }
                else
                {
                    string script = "";
                    DebugOutput.PrintLn("Validating pccs");
                    OrigPCCs = ValidateGivenModPCCs(ref PCCs, ExpIDs, WhichGame, pathBIOGame, out multiples, out MultiInds, ref retval, JobType == "TEXTURE");

                    // KFreon: Texture job
                    if (JobType == "TEXTURE")
                    {
                        DebugOutput.PrintLn(Name + " is a texture mod.");

                        // KFreon: Get script for job
                        script = ModMaker.GenerateTextureScript(ExecFolder, OrigPCCs, ExpIDs, Texname, WhichGame, pathBIOGame);
                    }
                    else
                    {
                        // KFreon: HOPEFULLY a mesh mod...
                        DebugOutput.PrintLn(Name + " is a mesh mod. Hopefully...");
                        script = ModMaker.GenerateMeshScript(ExpIDs[0].ToString(), PCCs[0]);

                        // SirCxyrtyx: Might be a pcc compare job, so check for added names
                        List <string> namesToAdd = GetNamesFromScript(Script);
                        if (namesToAdd.Count > 0)
                        {
                            string names = "";
                            foreach (var name in namesToAdd)
                            {
                                names += "names.Add(\"" + name + "\");" + Environment.NewLine;
                            }
                            script = script.Replace("// **KF_NAMES", names);
                        }
                    }
                    Script = script;
                }

                return(retval);
            }
            /// <summary>
            /// Gets details, like pcc's and expID's, from current script and sets local properties.
            /// Properties:
            ///     ExpID's, PCC's, Texname, WhichGame, JobType.
            /// </summary>
            public bool GetJobDetails(bool update, out bool versionConflict, int version)
            {
                JobType         = DetectJobType();
                versionConflict = false;

                DebugOutput.PrintLn(String.Format("Job: {0}  type: {1}", Name, JobType));

                bool isTexture = JobType == "TEXTURE" ? true : false;

                ExpIDs = ModMaker.GetExpIDsFromScript(Script, isTexture);

                //Heff: adjust script paths for legacy ME3 DLC mods that references un-extracted DLC's
                FixLegacyDLCPaths();

                PCCs      = ModMaker.GetPCCsFromScript(Script, isTexture);
                Texname   = ModMaker.GetObjectNameFromScript(Script, isTexture);
                WhichGame = version == -1 ? ModMaker.GetGameVersionFromScript(Script, isTexture) : version;

                DebugOutput.PrintLn(String.Format("Job: {0} Detected game version: {1}  Detected texname: {2}", Name, WhichGame, Texname));

                // KFreon: Extra stuff to guess various things - NEW rev696 - from the WPF builds. Maybe unstable.
                #region Extra stuff from WPF
                // KFreon: Guess game version if required
                if (WhichGame == -1 && update)
                {
                    DebugOutput.PrintLn("Attempting to guess game version...");

                    /*int index = PCCs[0].IndexOf("Mass Effect");
                     * char c = PCCs[0][index + 1];*/

                    DebugOutput.PrintLn("Found num PCCS: " + PCCs.Count);
                    WhichGame = GuessGame(PCCs);

                    if (WhichGame == -2)
                    {
                        versionConflict = true;
                        return(false);
                    }
                }

                if (WhichGame == -1)
                {
                    DebugOutput.PrintLn("ERROR: No game found matching the mod files!\n" +
                                        "Make sure that you have the proper game installed, and that the toolset has the correct path!\n" +
                                        "If the mod targets DLC files, make sure that you have extracted all relevant DLC's.");

                    MessageBox.Show("No game found matching the mod files!\n" +
                                    "Make sure that you have the proper game installed, and that the toolset has the correct path!\n" +
                                    "If the mod targets DLC files, make sure that you have extracted all relevant DLC's.", "Error!");
                    return(false);
                }
                else
                {
                    DebugOutput.PrintLn("Guessed gameversion: " + WhichGame);
                }

                // KFreon: Get ExpID's if required
                if (ExpIDs.Count == 0 && update)
                {
                    DebugOutput.PrintLn("Unable to find ExpID's in script. Attempting to find them manually. Game: " + WhichGame);

                    string        biogame   = MEDirectories.MEDirectories.GetDefaultBIOGame(WhichGame);
                    List <string> gameFiles = MEDirectories.MEDirectories.EnumerateGameFiles(WhichGame, biogame);
                    foreach (string pcc in PCCs)
                    {
                        //DebugOutput.PrintLn("Searching: " + pcc);
                        int index = -1;
                        if ((index = gameFiles.FindIndex(t => t.ToLower().Contains(pcc.ToLower()))) >= 0)
                        {
                            IPCCObject pccObject = PCCObjects.Creation.CreatePCCObject(gameFiles[index], WhichGame);
                            int        count     = 0;
                            foreach (IExportEntry export in pccObject.Exports)
                            {
                                //DebugOutput.PrintLn("Searching export: " + export.ObjectName);
                                if (export.ObjectName.Contains(Texname))
                                {
                                    ExpIDs.Add(count);
                                }
                                count++;
                            }
                        }
                    }
                    DebugOutput.PrintLn("Finished searching. Found: " + ExpIDs.Count + " matches.");
                }
                #endregion Extra Stuff from WPF

                OrigExpIDs     = new List <int>(ExpIDs);
                OrigPCCs       = new List <string>(PCCs);
                OriginalScript = Script;

                return(true);
            }