KFreonLib.Scripting.ModMaker.ModJob.GetJobDetails C# (CSharp) Method

GetJobDetails() public method

Gets details, like pcc's and expID's, from current script and sets local properties. Properties: ExpID's, PCC's, Texname, WhichGame, JobType.
public GetJobDetails ( bool update, bool &versionConflict, int version ) : bool
update bool
versionConflict bool
version int
return bool
            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;
            }