예제 #1
0
 public void CreateModJobs()
 {
     if (isEdited)
     {
         byte[] buff = Vector3ToBuff(location);
         int f = -1;
         for (int i = 0; i < Props.Count; i++)
             if (pcc.getNameEntry(Props[i].Name) == "location")
             {
                 f = i;
                 break;
             };
         if (f != -1)//has prop
         {
             int off = Props[f].offend - 12;
             for (int i = 0; i < 12; i++)
                 data[off + i] = buff[i];
         }
         else//have to add prop
         {
             DebugOutput.PrintLn(MyIndex + " : cant find location property");
         }
         KFreonLib.Scripting.ModMaker.ModJob mj = new KFreonLib.Scripting.ModMaker.ModJob();
         string currfile = Path.GetFileName(pcc.pccFileName);
         mj.data = data;
         mj.Name = "Binary Replacement for file \"" + currfile + "\" in Object #" + MyIndex + " with " + data.Length + " bytes of data";
         string lc = Path.GetDirectoryName(Application.ExecutablePath);
         string template = System.IO.File.ReadAllText(lc + "\\exec\\JobTemplate_Binary2.txt");
         template = template.Replace("**m1**", MyIndex.ToString());
         template = template.Replace("**m2**", currfile);
         mj.Script = template;
         KFreonLib.Scripting.ModMaker.JobList.Add(mj);
         DebugOutput.PrintLn("Created Mod job : " + mj.Name);
     }
 }
예제 #2
0
        public static ModJob GenerateMeshModJob(string newfile, int expID, string pccname, byte[] data)
        {
            KFreonLib.Scripting.ModMaker.ModJob mj = new KFreonLib.Scripting.ModMaker.ModJob();

            // KFreon: Get replacing data
            byte[] buff = data;
            if (data == null)
            {
                FileStream fs = new FileStream(newfile, FileMode.Open, FileAccess.Read);
                buff = new byte[fs.Length];
                int cnt;
                int sum = 0;
                while ((cnt = fs.Read(buff, sum, buff.Length - sum)) > 0)
                {
                    sum += cnt;
                }
                fs.Close();
            }


            string currfile = Path.GetFileName(pccname);

            mj.data   = buff;
            mj.Name   = "Binary Replacement for file \"" + currfile + "\" in Object #" + expID + " with " + buff.Length + " bytes of data";
            mj.Script = GenerateMeshScript(expID.ToString(), currfile);
            return(mj);
        }
예제 #3
0
        private void createReplaceModJobToolStripMenuItem_Click(object sender, EventArgs e)
        {
            TreeNode t = treeView1.SelectedNode;

            if (DLC == null || t == null || t.Parent == null || t.Parent.Text != "FileEntries")
            {
                return;
            }
            int            n        = t.Index;
            OpenFileDialog d        = new OpenFileDialog();
            string         filename = DLC.Files[n].FileName;

            d.Filter   = Path.GetFileName(filename) + " | " + Path.GetFileName(filename);
            d.FileName = Path.GetFileName(filename);
            if (d.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                KFreonLib.Scripting.ModMaker.ModJob mj = new KFreonLib.Scripting.ModMaker.ModJob();
                string file = DLC.FileName;                //full path
                string t1   = Path.GetDirectoryName(file); //cooked
                string t2   = Path.GetDirectoryName(t1);   //DLC_Name
                string t3   = Path.GetDirectoryName(t2);   //DLC
                t3     += "\\";
                file    = file.Substring(t3.Length);
                file    = file.Replace("\\", "\\\\");
                mj.data = File.ReadAllBytes(d.FileName);
                mj.Name = "DLC File Replacement in DLC \"" + file + "\" with File #" + n + " with " + mj.data.Length + " bytes of data";
                string loc      = Path.GetDirectoryName(Application.ExecutablePath);
                string template = System.IO.File.ReadAllText(loc + "\\exec\\JobTemplate_DLCReplace.txt");
                template  = template.Replace("**m1**", n.ToString());
                template  = template.Replace("**m2**", file);
                mj.Script = template;
                KFreonLib.Scripting.ModMaker.JobList.Add(mj);
                MessageBox.Show("Done.");
            }
        }
 public void CreateModJobs()
 {
     if (isEdited)
     {
         int pos = Props[Props.Count - 1].offend;
         for (int i = 0; i < Matrices.Count; i++)
         {
             byte[] buff = MatrixToBuff(Matrices[i]);
             for (int j = 0; j < 64; j++)
             {
                 data[pos + j] = buff[j];
             }
             pos += 64;
         }
         KFreonLib.Scripting.ModMaker.ModJob mj = new KFreonLib.Scripting.ModMaker.ModJob();
         string currfile = Path.GetFileName(pcc.FileName);
         mj.data = data;
         mj.Name = "Binary Replacement for file \"" + currfile + "\" in Object #" + MyIndex + " with " + data.Length + " bytes of data";
         string loc      = Path.GetDirectoryName(Application.ExecutablePath);
         string template = System.IO.File.ReadAllText(loc + "\\exec\\JobTemplate_Binary2.txt");
         template  = template.Replace("**m1**", MyIndex.ToString());
         template  = template.Replace("**m2**", currfile);
         mj.Script = template;
         KFreonLib.Scripting.ModMaker.JobList.Add(mj);
         DebugOutput.PrintLn("Created Mod job : " + mj.Name);
     }
 }
예제 #5
0
        public static ModJob GenerateMeshModJob(string newfile, int expID, string pccname, byte[] data)
        {
            KFreonLib.Scripting.ModMaker.ModJob mj = new KFreonLib.Scripting.ModMaker.ModJob();

            // KFreon: Get replacing data
            byte[] buff = data;
            if (data == null)
            {
                FileStream fs = new FileStream(newfile, FileMode.Open, FileAccess.Read);
                buff = new byte[fs.Length];
                int cnt;
                int sum = 0;
                while ((cnt = fs.Read(buff, sum, buff.Length - sum)) > 0) sum += cnt;
                fs.Close();
            }

            string currfile = Path.GetFileName(pccname);
            mj.data = buff;
            mj.Name = "Binary Replacement for file \"" + currfile + "\" in Object #" + expID + " with " + buff.Length + " bytes of data";
            mj.Script = GenerateMeshScript(expID.ToString(), currfile);
            return mj;
        }
예제 #6
0
        private List<string> InstallJob(ModJob job)
        {
            List<string> results = new List<string>();
            
            KFreonLib.Scripting.ModMaker.ModData = job.data;

            try
            {
                results.Add(ScriptCompiler.CompileAndRun(job.Script));
            }
            catch (Exception e)
            {
                DebugOutput.PrintLn("Error occured: " + e.Message);
            }
            return results;
        }
예제 #7
0
        private void UpdatePCCList(int index, ModJob job, bool currentItemChecked, int pccInd)
        {
            // KFreon: Update script from PCC Checkbox
            job.PCCs.Clear();
            job.ExpIDs.Clear();
            for (int i = 0; i < PCCList.Items.Count; i++)
            {
                if (i == pccInd && currentItemChecked || i != pccInd && PCCList.GetItemChecked(i))
                {
                    job.PCCs.Add(job.OrigPCCs[i]);
                    job.ExpIDs.Add(job.OrigExpIDs[i]);
                }
            }



            job.Script = KFreonLib.Scripting.ModMaker.GenerateTextureScript(ExecFolder, job.PCCs, job.ExpIDs, job.Texname, job.WhichGame, BIOGames[job.WhichGame - 1]);
            ScriptPane.Text = job.Script;
            KFreonLib.Scripting.ModMaker.JobList[index] = job;
        }
예제 #8
0
        private void PCCListRewrite(ModJob job, bool CheckAll = false)
        {
            lock (SuppressLocker)
                SuppressCheckEvent = true;
            if (MainListView.InvokeRequired)
                this.Invoke(new Action(() => PCCListRewrite(job, CheckAll)));
            else
            {
                PCCList.Items.Clear();

                if (job.PCCs == null || (job.PCCs.Count == 0 && job.OrigPCCs.Count == 0))
                {
                    DebugOutput.PrintLn("Failed to get PCC's from script.");
                    PCCList.Items.Add("FAILED TO GET PCC'S");
                }
                else if (job.ExpIDs == null || (job.ExpIDs.Count == 0 && job.OrigExpIDs.Count == 0))
                {
                    DebugOutput.PrintLn("Failed to get ExpID's from script.");
                    PCCList.Items.Add("FAILED TO GET EXPID'S");
                }
                else if (job.PCCs.Count != job.ExpIDs.Count)
                {
                    DebugOutput.PrintLn("Number of PCC's and ExpID's extracted from script do not match.");
                    PCCList.Items.Add("PCC/EXPID COUNT MISMATCH");
                }
                else
                    for (int i = 0; i < job.OrigPCCs.Count; i++)
                        PCCList.Items.Add(job.OrigPCCs[i] + "  @ " + job.OrigExpIDs[i], CheckAll ? true : job.PCCs.Contains(job.OrigPCCs[i]));
                lock (SuppressLocker)
                    SuppressCheckEvent = false;
            }
        }
예제 #9
0
        private void DisplayDetails(ModJob job)
        {
            // KFreon: Fill details 
            string message = "Details:" + Environment.NewLine;
            message += "Texname: " + job.Texname + Environment.NewLine;
            message += "Number of ExpID's detected: " + job.ExpIDs.Count + Environment.NewLine;
            message += "Number of PCC's detected: " + job.PCCs.Count + Environment.NewLine;

            // KFreon: Check flimsy validity
            string fail = "";
            if (job.ExpIDs.Count == 0)
                fail += "EXPIDS ";

            if (job.PCCs.Count == 0)
                fail += "PCCS ";

            if (job.Texname == "")
                fail += "TEXNAME ";

            if (job.WhichGame == -1)
                fail += "WHICHGAME ";

            message += "Valid? " + job.Valid + "  " + fail;
            DetailsBox.Text = message;
        }
 public void CreateModJobs()
 {
     if (isEdited)
     {
         int pos = Props[Props.Count - 1].offend;
         for (int i = 0; i < Matrices.Count; i++)
         {
             byte[] buff = MatrixToBuff(Matrices[i]);
             for (int j = 0; j < 64; j++)
                 data[pos + j] = buff[j];
             pos += 64;
         }
         KFreonLib.Scripting.ModMaker.ModJob mj = new KFreonLib.Scripting.ModMaker.ModJob();
         string currfile = Path.GetFileName(pcc.pccFileName);
         mj.data = data;
         mj.Name = "Binary Replacement for file \"" + currfile + "\" in Object #" + MyIndex + " with " + data.Length + " bytes of data";
         string loc = Path.GetDirectoryName(Application.ExecutablePath);
         string template = System.IO.File.ReadAllText(loc + "\\exec\\JobTemplate_Binary2.txt");
         template = template.Replace("**m1**", MyIndex.ToString());
         template = template.Replace("**m2**", currfile);
         mj.Script = template;
         KFreonLib.Scripting.ModMaker.JobList.Add(mj);
         DebugOutput.PrintLn("Created Mod job : " + mj.Name);
     }
 }
예제 #11
0
        public void CreateJobsFromPCCDiff(string basePCCName, string modPCCName)
        {
            // KFreon: This is all just renamed stuff from WV's work. No credit to me.
            StatusUpdater.UpdateText("Comparing PCC's...");


            // KFreon: Get pcc's
            IPCCObject basePCC = new ME3PCCObject(basePCCName);
            IPCCObject modifiedPCC = new ME3PCCObject(modPCCName);


            // KFreon: Compare PCC's and build script
            string loc = Path.GetDirectoryName(Application.ExecutablePath);
            string script = File.ReadAllText(loc + "\\exec\\JobTemplate_Binary2.txt");

            // KFreon: Set pcc name
            var bits = modifiedPCC.pccFileName.Split('\\').ToList();
            string filename = bits.Last();

            int index = bits.IndexOf("DLC");
            if (index > 0)
            {
                var dlcpaths = bits.GetRange(index, bits.Count - index);
                filename = string.Join("\\", dlcpaths);
            }


            // KFreon: Filename must contain CookedPCConsole
            if (!filename.Contains("cookedpcconsole", StringComparison.OrdinalIgnoreCase))
                filename = Path.Combine("CookedPCConsole", filename);

            filename = filename.Replace("\\\\", "\\").Replace("\\", "\\\\"); // KFreon: Need to not end up with \\\\\\\\\\\ or something, so chances are the only thing it would have at this stage is \\\\ so reset that to \\ then expand to \\\\.
            script = script.Replace("**m2**", filename);


            if (basePCC.NameCount != modifiedPCC.NameCount)
            {
                StringBuilder names = new StringBuilder();
                foreach (var name in modifiedPCC.Names)
                    if (!basePCC.Names.Contains(name))
                        names.AppendLine("names.Add(\"" + name + "\");" + Environment.NewLine);
                script = script.Replace("// **KF_NAMES", names.ToString());
            }

            int jobCount = 0;
            for (int i = 0; i < basePCC.ExportCount; i++)
            {
                if (modifiedPCC.Exports.Count == i)  // KFreon: Not adding Exports just yet.
                    break;


                if (!basePCC.Exports[i].Data.SequenceEqual(modifiedPCC.Exports[i].Data))
                {
                    ModJob job = new ModJob();
                    job.OriginalScript = script.Replace("**m1**", i.ToString());
                    job.Script = job.OriginalScript;

                    job.data = modifiedPCC.Exports[i].Data;
                    job.Name = "Binary Replacement Job for " + bits.Last();

                    job.ExpIDs = new List<int>();
                    job.ExpIDs.Add(i);

                    job.OrigExpIDs = new List<int>();
                    job.OrigExpIDs.Add(i);

                    job.PCCs = new List<string>();
                    job.OrigPCCs = new List<string>();
                    job.OrigPCCs.Add(modifiedPCC.pccFileName);
                    job.PCCs.Add(modifiedPCC.pccFileName);
                    job.Texname = basePCC.Exports[i].ObjectName;
                    KFreonLib.Scripting.ModMaker.JobList.Add(job);
                    jobCount++;
                }
            }


            if (jobCount > 0)
            {
                StatusUpdater.UpdateText("Created Job.");
            }
            else
            {
                StatusUpdater.UpdateText("No differences found!");
            }
            MainProgBar.ChangeProgressBar(1, 1);
            ExternalRefresh();
        }
예제 #12
0
 private void createReplaceModJobToolStripMenuItem_Click(object sender, EventArgs e)
 {
     TreeNode t = treeView1.SelectedNode;
     if (DLC == null || t == null || t.Parent == null || t.Parent.Text != "FileEntries")
         return;
     int n = t.Index;
     OpenFileDialog d = new OpenFileDialog();
     string filename = DLC.Files[n].FileName;
     d.Filter = Path.GetFileName(filename) + " | " + Path.GetFileName(filename);
     d.FileName = Path.GetFileName(filename);
     if (d.ShowDialog() == System.Windows.Forms.DialogResult.OK)
     {
         KFreonLib.Scripting.ModMaker.ModJob mj = new KFreonLib.Scripting.ModMaker.ModJob();
         string file = DLC.MyFileName;               //full path
         string t1 = Path.GetDirectoryName(file);    //cooked
         string t2 = Path.GetDirectoryName(t1);      //DLC_Name
         string t3 = Path.GetDirectoryName(t2);      //DLC
         t3 += "\\";
         file = file.Substring(t3.Length);
         file = file.Replace("\\", "\\\\");
         mj.data = File.ReadAllBytes(d.FileName);
         mj.Name = "DLC File Replacement in DLC \"" + file + "\" with File #" + n + " with " + mj.data.Length + " bytes of data";
         string loc = Path.GetDirectoryName(Application.ExecutablePath);
         string template = System.IO.File.ReadAllText(loc + "\\exec\\JobTemplate_DLCReplace.txt");
         template = template.Replace("**m1**", n.ToString());
         template = template.Replace("**m2**", file);
         mj.Script = template;
         KFreonLib.Scripting.ModMaker.JobList.Add(mj);
         MessageBox.Show("Done.");
     }
 }
예제 #13
0
 public void CreateModJobs()
 {
     if (isEdited)
     {
         byte[] buff = Vector3ToBuff(location);
         int f = -1;
         for (int i = 0; i < Props.Count; i++)
             if (pcc.getNameEntry(Props[i].Name) == "location")
             {
                 f = i;
                 break;
             };
         if (f != -1)//has prop
         {
             int off = Props[f].offend - 12;
             for (int i = 0; i < 12; i++)
                 data[off + i] = buff[i];
         }
         else//have to add prop
         {
             DebugOutput.PrintLn(MyIndex + " : cant find location property");
         }
         KFreonLib.Scripting.ModMaker.ModJob mj = new KFreonLib.Scripting.ModMaker.ModJob();
         string currfile = Path.GetFileName(pcc.FileName);
         mj.data = data;
         mj.Name = "Binary Replacement for file \"" + currfile + "\" in Object #" + MyIndex + " with " + data.Length + " bytes of data";
         string lc = Path.GetDirectoryName(Application.ExecutablePath);
         string template = System.IO.File.ReadAllText(lc + "\\exec\\JobTemplate_Binary2.txt");
         template = template.Replace("**m1**", MyIndex.ToString());
         template = template.Replace("**m2**", currfile);
         mj.Script = template;
         KFreonLib.Scripting.ModMaker.JobList.Add(mj);
         DebugOutput.PrintLn("Created Mod job : " + mj.Name);
     }
 }
예제 #14
0
        private void CreateFromPCCDiffButton_Click(object sender, EventArgs e)
        {
            // KFreon: This is all just renamed stuff from WV's work. No credit to me.


            // KFreon: Get pcc's
            IPCCObject basePCC = null;
            IPCCObject modifiedPCC = null;
            using (OpenFileDialog ofd = new OpenFileDialog())
            {
                ofd.Filter = "PCC Files|*.pcc";
                ofd.Title = "Select base (unmodified) pcc";
                if (ofd.ShowDialog() != DialogResult.OK)
                    return;

                basePCC = new ME3PCCObject(ofd.FileName);

                ofd.Title = "Select modified pcc";
                if (ofd.ShowDialog() != DialogResult.OK)
                    return;

                modifiedPCC = new ME3PCCObject(ofd.FileName);
            }


            // KFreon: Compare PCC's and build script
            string loc = Path.GetDirectoryName(Application.ExecutablePath);
            string script = File.ReadAllText(loc + "\\exec\\JobTemplate_Binary2.txt");

            if (basePCC.ExportCount != modifiedPCC.ExportCount)
                throw new NotImplementedException("This is apparently not implemented yet.");

            // KFreon: Set pcc name
            var bits = basePCC.pccFileName.Split('\\');
            script.Replace("**m1**", bits.Last());

            if (basePCC.NameCount != modifiedPCC.NameCount)
            {
                StringBuilder names = new StringBuilder();
                foreach (var name in modifiedPCC.Names)
                    if (!basePCC.Names.Contains(name))
                        names.AppendLine("AddName(\"" + name + "\");");
                script = script.Replace("**m2**", names.ToString());
            }
            else
                script = script.Replace("**m2**", "\\ No names to add");

            StringBuilder exports = new StringBuilder();
            using(MemoryStream data = new MemoryStream())
            {
                for (int i = 0; i < basePCC.ExportCount; i++)
                {
                    if (!basePCC.Exports[i].Data.SequenceEqual(modifiedPCC.Exports[i].Data))
                    {
                        int offset = (int)data.Position;
                        data.WriteBytes(modifiedPCC.Exports[i].Data);
                        exports.AppendLine("ReplaceData(" + i + ", " + offset + ", " + modifiedPCC.Exports[i].Data.Length + ");");
                    }
                }
                script = script.Replace("**m3**", exports.ToString());

                ModJob job = new ModJob();
                job.data = data.ToArray();
                job.Name = "PCC Replacement Job for " + bits.Last();
                job.Script = script;
                KFreonLib.Scripting.ModMaker.JobList.Add(job);
            }

            Refresh();
        }
예제 #15
0
 private void createBinaryReplaceJobFromFileToolStripMenuItem_Click(object sender, EventArgs e)
 {
     int n = GetSelected();
     if (n == -1 || !(CurrentView == 2 || CurrentView == 3))
         return;
     if (!IsFromDLC)
     {
         OpenFileDialog d = new OpenFileDialog();
         d.Filter = "*.bin|*.bin";
         if (d.ShowDialog() == System.Windows.Forms.DialogResult.OK)
         {
             FileStream fs = new FileStream(d.FileName, FileMode.Open, FileAccess.Read);
             byte[] buff = new byte[fs.Length];
             int cnt;
             int sum = 0;
             while ((cnt = fs.Read(buff, sum, buff.Length - sum)) > 0) sum += cnt;
             fs.Close();
             KFreonLib.Scripting.ModMaker.ModJob mj = new KFreonLib.Scripting.ModMaker.ModJob();
             string currfile = Path.GetFileName(pcc.pccFileName);
             mj.data = buff;
             mj.Name = "Binary Replacement for file \"" + currfile + "\" in Object #" + n + " with " + buff.Length + " bytes of data";
             string loc = Path.GetDirectoryName(Application.ExecutablePath);
             string template = System.IO.File.ReadAllText(loc + "\\exec\\JobTemplate_Binary2.txt");
             template = template.Replace("**m1**", n.ToString());
             template = template.Replace("**m2**", currfile);
             mj.Script = template;
             KFreonLib.Scripting.ModMaker.JobList.Add(mj);
             MessageBox.Show("Done");
         }
     }
     else
     {
         if (DLCPath == null || DLCPath == "" || inDLCFilename == null || inDLCFilename == "")
             return;
         string s1 = DLCPath;
         string s2 = Path.GetDirectoryName(s1);
         string s3 = Path.GetDirectoryName(s2);
         string s4 = Path.GetDirectoryName(s3);
         string DLCp = DLCPath.Substring(s4.Length + 1);                
         OpenFileDialog d = new OpenFileDialog();
         d.Filter = "*.bin|*.bin";
         if (d.ShowDialog() == System.Windows.Forms.DialogResult.OK)
         {
             FileStream fs = new FileStream(d.FileName, FileMode.Open, FileAccess.Read);
             byte[] buff = new byte[fs.Length];
             int cnt;
             int sum = 0;
             while ((cnt = fs.Read(buff, sum, buff.Length - sum)) > 0) sum += cnt;
             fs.Close();
             KFreonLib.Scripting.ModMaker.ModJob mj = new KFreonLib.Scripting.ModMaker.ModJob();
             mj.data = buff;
             mj.Name = "Binary Replacement for file \"" + inDLCFilename + "\" in Object #" + n + " with " + buff.Length + " bytes of data";
             string loc = Path.GetDirectoryName(Application.ExecutablePath);
             string template = System.IO.File.ReadAllText(loc + "\\exec\\JobTemplate_Binary3DLC.txt");
             template = template.Replace("**m1**", n.ToString());
             template = template.Replace("**m2**", inDLCFilename);
             template = template.Replace("**m3**", DLCp.Replace("\\", "\\\\"));
             mj.Script = template;
             KFreonLib.Scripting.ModMaker.JobList.Add(mj);
             MessageBox.Show("Done");
         }
     }
 }
예제 #16
0
 private void createBinaryReplaceJobFromFileToolStripMenuItem_Click(object sender, EventArgs e)
 {
     int n;
     if (pcc == null || !GetSelected(out n) || n < 0)
     {
         return;
     }
     OpenFileDialog d = new OpenFileDialog();
     d.Filter = "*.bin|*.bin";
     if (d.ShowDialog() == DialogResult.OK)
     {
         FileStream fs = new FileStream(d.FileName, FileMode.Open, FileAccess.Read);
         byte[] buff = new byte[fs.Length];
         int cnt;
         int sum = 0;
         while ((cnt = fs.Read(buff, sum, buff.Length - sum)) > 0) sum += cnt;
         fs.Close();
         KFreonLib.Scripting.ModMaker.ModJob mj = new KFreonLib.Scripting.ModMaker.ModJob();
         string currfile = Path.GetFileName(pcc.FileName);
         mj.data = buff;
         mj.Name = "Binary Replacement for file \"" + currfile + "\" in Object #" + n + " with " + buff.Length + " bytes of data";
         string loc = Path.GetDirectoryName(Application.ExecutablePath);
         string template = File.ReadAllText(loc + "\\exec\\JobTemplate_Binary2.txt");
         template = template.Replace("**m1**", n.ToString());
         template = template.Replace("**m2**", currfile);
         mj.Script = template;
         KFreonLib.Scripting.ModMaker.JobList.Add(mj);
         MessageBox.Show("Done");
     }
 }
예제 #17
0
        private List<string> InstallJob(ModJob job)
        {
            List<string> DLCPCCs = new List<string>();

            ScriptCompiler sc = new ScriptCompiler();
            KFreonLib.Scripting.ModMaker.ModData = job.data;
            sc.rtb1.Text = job.Script;

            try
            {
                sc.Compile();
                foreach (string pcc in job.PCCs)
                {
                    string dlcname = KFreonLib.Misc.Methods.GetDLCNameFromPath(pcc);
                    if (dlcname != null && dlcname != "" && !DLCPCCs.Contains(dlcname))
                        DLCPCCs.Add(dlcname);
                }
            }
            catch (Exception e)
            {
                DebugOutput.PrintLn("Error occured: " + e.Message);
            }
            return DLCPCCs;
        }
예제 #18
0
 private void createBinaryReplaceJobFromObjectToolStripMenuItem_Click(object sender, EventArgs e)
 {
     int n = GetSelected();
     if (n == -1 || !(CurrentView == 2 || CurrentView == 3))
         return;
     if (!IsFromDLC)
     {
         KFreonLib.Scripting.ModMaker.ModJob mj = KFreonLib.Scripting.ModMaker.GenerateMeshModJob(null, n, pcc.pccFileName, CopyArray(pcc.Exports[n].Data));
         KFreonLib.Scripting.ModMaker.JobList.Add(mj);
         MessageBox.Show("Done");
     }
     else
     {
         if (DLCPath == null || DLCPath == "" || inDLCFilename == null || inDLCFilename == "")
             return;
         string s1 = DLCPath;
         string s2 = Path.GetDirectoryName(s1);
         string s3 = Path.GetDirectoryName(s2);
         string s4 = Path.GetDirectoryName(s3);
         string DLCp = DLCPath.Substring(s4.Length + 1);
         KFreonLib.Scripting.ModMaker.ModJob mj = new KFreonLib.Scripting.ModMaker.ModJob();
         string currfile = Path.GetFileName(pcc.pccFileName);
         mj.data = CopyArray(pcc.Exports[n].Data);
         mj.Name = "Binary Replacement for file \"" + currfile + "\" in Object #" + n + " with " + pcc.Exports[n].Data.Length + " bytes of data";
         string loc = Path.GetDirectoryName(Application.ExecutablePath);
         string template = System.IO.File.ReadAllText(loc + "\\exec\\JobTemplate_Binary3DLC.txt");
         template = template.Replace("**m1**", n.ToString());
         template = template.Replace("**m2**", inDLCFilename);
         template = template.Replace("**m3**", DLCp.Replace("\\", "\\\\"));
         mj.Script = template;
         KFreonLib.Scripting.ModMaker.JobList.Add(mj);
         MessageBox.Show("Done");
     }
 }