private static void ExportFile(string outputFolderName, string exportFileFullName, bool isSource) { string str; ManualClass.exportWorker.ReportProgress(0, new Report((object x) => LogClass.AppendLine(string.Concat("Start manual Unpack", DateTime.Now.ToString()), true), null)); if (!Directory.Exists(outputFolderName)) { throw new Exception(string.Concat("Export folder\"", outputFolderName, "\"does not exist, Please fix")); } string str1 = Path.Combine(outputFolderName, (isSource ? "Source" : "Target")); if (!Directory.Exists(str1)) { Directory.CreateDirectory(str1); } UEViewer uEViewer = new UEViewer(exportFileFullName, str1, Application.StartupPath); uEViewer.Unpack(out str); ManualClass.exportWorker.ReportProgress(0, new Report((object x) => LogClass.AppendLine((string)x, false), str)); }
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; } } } } } } } } } }