Exemple #1
0
        internal static void GetGotoManualFiles(string sourceImageName, string targetImageName, string modelFolder, bool isGame, out string sourceFileName, out string targetFileName)
        {
            string str;
            string str1;

            sourceFileName = ReplaceClass.GetModelFileName(sourceImageName, modelFolder, isGame, out str, out str1);
            targetFileName = ReplaceClass.GetModelFileName(targetImageName, modelFolder, isGame, out str, out str1);
        }
Exemple #2
0
        private static string CopyTargetFile(string fileID, string modelFolderName, bool isGame, string exportFolderName)
        {
            string modelFileName = ReplaceClass.GetModelFileName(fileID, modelFolderName, isGame);
            string str           = Path.Combine(exportFolderName, string.Concat(fileID, ".upk"));

            if (File.Exists(str))
            {
                File.Delete(str);
            }
            File.Copy(modelFileName, str, true);
            return(str);
        }
Exemple #3
0
        private static string BackupSourceFile(string fileID, string modelFolderName, bool isGame, string exportFolderName)
        {
            string modelFileName = ReplaceClass.GetModelFileName(fileID, modelFolderName, isGame);
            string str           = Path.Combine(exportFolderName, "Backup source model");
            string str1          = Path.Combine(str, string.Concat(fileID, ".upk"));

            if (File.Exists(str1))
            {
                File.Delete(str1);
            }
            File.Copy(modelFileName, str1, true);
            return(str1);
        }
Exemple #4
0
        private static void replaceWorker_DoWork(object sender, DoWorkEventArgs e)
        {
            string           str;
            string           str1;
            string           str2;
            string           str3;
            string           str4;
            string           str5;
            string           argument         = (string)((object[])e.Argument)[0];
            string           argument1        = (string)((object[])e.Argument)[1];
            string           argument2        = (string)((object[])e.Argument)[2];
            string           argument3        = (string)((object[])e.Argument)[3];
            string           argument4        = (string)((object[])e.Argument)[4];
            bool             flag             = (bool)((object[])e.Argument)[5];
            BackgroundWorker backgroundWorker = ReplaceClass.replaceWorker;
            InvokeAction     invokeAction     = (object x) => {
                LogClass.AppendLine(string.Concat("Start to model transformation", DateTime.Now.ToString()), true);
                LogClass.AppendLine((string)x, false);
            };

            string[] fileNameWithoutExtension = new string[] { "Start", Path.GetFileNameWithoutExtension(argument), "to", Path.GetFileNameWithoutExtension(argument1), "Model Transformation" };
            backgroundWorker.ReportProgress(0, new Report(invokeAction, string.Concat(fileNameWithoutExtension)));
            if (!ReplaceClass.userCancelReplace)
            {
                string str6 = Path.Combine(argument3, "ModsOutput");
                string str7 = Path.Combine(str6, string.Concat(Path.GetFileNameWithoutExtension(argument), " to ", Path.GetFileNameWithoutExtension(argument1)));
                str6 = str7;
                ReplaceClass.exportCompletedReportDir = str7;
                string str8 = Path.Combine(str6, "Backup source model");
                if (!ReplaceClass.userCancelReplace)
                {
                    if (Directory.Exists(str6))
                    {
                        try
                        {
                            Directory.Delete(str6, true);
                        }
                        catch
                        {
                        }
                    }
                    if (!Directory.Exists(str6))
                    {
                        Directory.CreateDirectory(str6);
                    }
                    if (!Directory.Exists(str8))
                    {
                        Directory.CreateDirectory(str8);
                    }
                    string str9 = Path.Combine(str6, "Source");
                    if (!Directory.Exists(str9))
                    {
                        Directory.CreateDirectory(str9);
                    }
                    string str10 = Path.Combine(str6, "Target");
                    if (!Directory.Exists(str10))
                    {
                        Directory.CreateDirectory(str10);
                    }
                    if (!ReplaceClass.userCancelReplace)
                    {
                        string modelFileName  = ReplaceClass.GetModelFileName(argument, argument4, flag, out str, out str1);
                        string modelFileName1 = ReplaceClass.GetModelFileName(argument1, argument4, flag, out str2, out str3);
                        if (!ReplaceClass.userCancelReplace)
                        {
                            UEViewer uEViewer = new UEViewer(modelFileName, str9, Path.GetDirectoryName(argument2));
                            if (!ReplaceClass.userCancelReplace)
                            {
                                UEViewer uEViewer1 = new UEViewer(modelFileName1, str10, Path.GetDirectoryName(argument2));
                                if (!ReplaceClass.userCancelReplace && !ReplaceClass.userCancelReplace)
                                {
                                    bool flag1 = uEViewer.Unpack(out str4, argument4, flag);
                                    ReplaceClass.replaceWorker.ReportProgress(0, new Report((object x) => LogClass.AppendLine((string)x, false), str4));
                                    if (!ReplaceClass.userCancelReplace)
                                    {
                                        bool flag2 = uEViewer1.Unpack(out str5, argument4, flag);
                                        ReplaceClass.replaceWorker.ReportProgress(0, new Report((object x) => LogClass.AppendLine((string)x, false), str5));
                                        if (!ReplaceClass.userCancelReplace)
                                        {
                                            if (!flag1)
                                            {
                                                throw new Exception(string.Concat("error_source\\", str6));
                                            }
                                            if (!flag2)
                                            {
                                                throw new Exception(string.Concat("error_target\\", str6));
                                            }
                                            if (!ReplaceClass.userCancelReplace)
                                            {
                                                ReplaceClass.replaceWorker.ReportProgress(0, new Report((object x) => LogClass.AppendLine((string)x, false), "Official convert Start"));
                                                ReplaceClass.DoReplace(str9, str10, str, str2, str1, str3, argument4, flag, str6);
                                                ReplaceClass.replaceWorker.ReportProgress(0, new Report((object x) => LogClass.AppendLine((string)x, false), "Concluded an official convert"));
                                                e.Result = str6;
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }