Beispiel #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);
        }
Beispiel #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);
        }
Beispiel #3
0
 private static void BeginRefresh()
 {
     if (!ReplaceClass.refreshWorker.IsBusy)
     {
         ReplaceClass.SetControlState(ReplaceStates.Refresh);
         BackgroundWorker backgroundWorker = ReplaceClass.refreshWorker;
         object[]         text             = new object[] { ReplaceClass.mainForm.txtOutputFolder.Text, null };
         bool[]           @checked         = new bool[] { ReplaceClass.mainForm.chkReplaceJinM.Checked, ReplaceClass.mainForm.chkReplaceJinF.Checked, ReplaceClass.mainForm.chkReplaceGonM.Checked, ReplaceClass.mainForm.chkReplaceGonF.Checked, ReplaceClass.mainForm.chkReplaceLynM.Checked, ReplaceClass.mainForm.chkReplaceLynF.Checked, ReplaceClass.mainForm.chkReplaceKunN.Checked, ReplaceClass.mainForm.chkReplaceOther.Checked };
         text[1] = @checked;
         backgroundWorker.RunWorkerAsync(text);
     }
 }
Beispiel #4
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);
        }
Beispiel #5
0
        private static void mainForm_DoOperation(object sender, OperationEventArgs e)
        {
            if ((e.Operation != Operations.LeaveSettings ? true : Directory.Exists(ReplaceClass.mainForm.txtModelFolder.Text)))
            {
                switch (e.Operation)
                {
                case Operations.LeaveSettings:
                case Operations.RefreshReplaceList:
                {
                    ReplaceClass.TryCancelRefresh();
                    ReplaceClass.BeginRefresh();
                    break;
                }

                case Operations.RefreshAnalysisList:
                case Operations.CancelRefreshanalysisList:
                case Operations.BeginAnalysis:
                case Operations.CancelAnalysis:
                case Operations.DragAnalysis:
                case Operations.CurrentAnalysis:
                case Operations.ManualAction:
                {
                    ReplaceClass.SetControlState(ReplaceStates.OtherWork);
                    break;
                }

                case Operations.BeginReplace:
                {
                    ReplaceClass.BeginReplace();
                    break;
                }

                case Operations.CancelReplace:
                {
                    ReplaceClass.TryCancelReplace();
                    break;
                }

                case Operations.None:
                {
                    ReplaceClass.SetControlState(ReplaceStates.None);
                    break;
                }
                }
            }
        }
Beispiel #6
0
        private static void ReplaceTargetToSourceWithASCII(string sourceFileFullName, string targetFileFullName, string sourceSkeletalMeshID, string targetSkeletalMeshID, string sourceMaterialInstanceConstant, string targetMaterialInstanceConstant, string sourceTexture2D, string targetTexture2D, string sourceObjectID, string targetObjectID)
        {
            FileInfo   fileInfo   = new FileInfo(targetFileFullName);
            FileStream fileStream = fileInfo.Open(FileMode.Open, FileAccess.ReadWrite, FileShare.None);

            byte[] numArray = new byte[checked ((int)fileStream.Length)];
            fileStream.Read(numArray, 0, (int)numArray.Length);
            numArray            = ReplaceClass.ReplaceWithByte(ref numArray, targetSkeletalMeshID, sourceSkeletalMeshID);
            numArray            = ReplaceClass.ReplaceWithByte(ref numArray, targetMaterialInstanceConstant, sourceMaterialInstanceConstant);
            numArray            = ReplaceClass.ReplaceWithByte(ref numArray, targetTexture2D, sourceTexture2D);
            numArray            = ReplaceClass.ReplaceWithByte(ref numArray, targetObjectID, sourceObjectID);
            fileStream.Position = 0L;
            fileStream.Write(numArray, 0, (int)numArray.Length);
            fileStream.Flush();
            fileStream.Close();
            string str = Path.Combine(Path.GetDirectoryName(targetFileFullName), Path.GetFileName(sourceFileFullName));

            fileInfo.MoveTo(str);
        }
Beispiel #7
0
 private static void BeginReplace()
 {
     if (ReplaceClass.mainForm.picSourceImage.Tag == null)
     {
         MessageBox.Show("Please set the source model.");
     }
     else if (ReplaceClass.mainForm.picTargetImage.Tag != null)
     {
         string str  = ReplaceClass.mainForm.picSourceImage.Tag.ToString();
         string str1 = ReplaceClass.mainForm.picTargetImage.Tag.ToString();
         if (str != str1)
         {
             string str2 = Path.Combine(Application.StartupPath, "umodel.exe");
             if (!File.Exists(str2))
             {
                 MessageBox.Show(string.Concat("\"", str2, "\"does not exist\"http://www.gildor.org/en/projects/umodel\"Download site UEViewer program and copy all the files to the Program folder."));
             }
             else if (MessageBox.Show(
                          //"是否Start自动模型转换?错误的转换可能导致下列问题:\n\n1、源模型与目标模型种类不同,进到游戏有读取人物模型时会报错退出。\n2、按照已研究出来的规律仍无法解析对照规则,需要用户自己点击“去手动转换”按钮进行手动转换。"
                          "Start automatic model transformation? Conversion error may cause the following problems:\n\n1、Source model and the target model of different types,There would be an error into the will game stop reading character models。\n2、Has come up in accordance with the law still does not parse the control rules,Require the user to click“Go to manual conversion”Button manual conversion."
                          , "Ask before convert", MessageBoxButtons.OKCancel) == DialogResult.OK)
             {
                 ReplaceClass.mainForm.btnReplaceModel.Text = "Cancel";
                 ReplaceClass.SetControlState(ReplaceStates.Build);
                 ReplaceClass.mainForm.pbReplace.Style = ProgressBarStyle.Marquee;
                 BackgroundWorker backgroundWorker = ReplaceClass.replaceWorker;
                 object[]         text             = new object[] { str, str1, str2, ReplaceClass.mainForm.txtOutputFolder.Text, ReplaceClass.mainForm.txtModelFolder.Text, ReplaceClass.mainForm.rbSetup.Checked };
                 backgroundWorker.RunWorkerAsync(text);
             }
         }
         else
         {
             MessageBox.Show("Source and target are the same,Can not be replaced");
         }
     }
     else
     {
         MessageBox.Show("Please set the target model.");
     }
 }
Beispiel #8
0
        private static void replaceWorker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
        {
            DialogResult dialogResult;
            Process      process;
            DateTime     now = DateTime.Now;

            LogClass.AppendLine(string.Concat("Model transformation ending", now.ToString()), false);
            ReplaceClass.mainForm.OnDoOperation(Operations.None);
            ReplaceClass.mainForm.pbReplace.Style      = ProgressBarStyle.Blocks;
            ReplaceClass.mainForm.btnReplaceModel.Text = "Generate New Model";
            if (e.Error != null)
            {
                string str = null;
                if (e.Error.Message.StartsWith("error_source\\"))
                {
                    str          = e.Error.Message.Substring("error_source\\".Length);
                    dialogResult = MessageBox.Show("Parse error source model, select 'Yes' to clean up residual files, select 'No' then open the exported folder, select 'Cancel' Stop operation.", "Model conversion failed", MessageBoxButtons.YesNoCancel);
                    if (dialogResult == DialogResult.Yes)
                    {
                        ReplaceClass.DeleteDirAndAllFiles(str);
                    }
                    else if (dialogResult == DialogResult.No)
                    {
                        process = new Process();
                        process.StartInfo.FileName  = "explorer.exe";
                        process.StartInfo.Arguments = str;
                        process.Start();
                    }
                }
                else if (!e.Error.Message.StartsWith("error_target\\"))
                {
                    MessageBox.Show(e.Error.Message);
                    LogClass.AppendLine(string.Concat("Tracking error:", e.Error.ToString()), false);
                    str = ReplaceClass.exportCompletedReportDir;
                    if (Directory.Exists(str))
                    {
                        dialogResult = MessageBox.Show("Model conversion failed, select 'Yes' to clean up residual files, select 'No' then open the exported folder, select 'Cancel' Stop operation.", "Model conversion failed", MessageBoxButtons.YesNoCancel);
                        if (dialogResult == DialogResult.Yes)
                        {
                            ReplaceClass.DeleteDirAndAllFiles(str);
                        }
                        else if (dialogResult == DialogResult.No)
                        {
                            process = new Process();
                            process.StartInfo.FileName  = "explorer.exe";
                            process.StartInfo.Arguments = str;
                            process.Start();
                        }
                    }
                }
                else
                {
                    str          = e.Error.Message.Substring("error_target\\".Length);
                    dialogResult = MessageBox.Show("Target model parsing error, select 'Yes' to clean up residual files, select 'No' then open the exported folder, select 'Cancel' Stop operation.", "Model conversion failed", MessageBoxButtons.YesNoCancel);
                    if (dialogResult == DialogResult.Yes)
                    {
                        ReplaceClass.DeleteDirAndAllFiles(str);
                    }
                    else if (dialogResult == DialogResult.No)
                    {
                        process = new Process();
                        process.StartInfo.FileName  = "explorer.exe";
                        process.StartInfo.Arguments = str;
                        process.Start();
                    }
                }
            }
            else if ((ReplaceClass.userCancelReplace ? false : MessageBox.Show("Model conversion is complete,Do you want to open export folder?", string.Empty, MessageBoxButtons.OKCancel) == DialogResult.OK))
            {
                process = new Process();
                process.StartInfo.FileName  = "explorer.exe";
                process.StartInfo.Arguments = (string)e.Result;
                process.Start();
            }
            ReplaceClass.userCancelReplace = false;
        }
Beispiel #9
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;
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
Beispiel #10
0
 internal static byte[] ReplaceWithByte(ref byte[] buffer, string source, string target)
 {
     byte[] bytes    = Encoding.ASCII.GetBytes(source);
     byte[] numArray = Encoding.ASCII.GetBytes(target);
     return(ReplaceClass.ReplaceWithByte(ref buffer, bytes, numArray));
 }
Beispiel #11
0
        private static void DoReplace(string dirSourceName, string dirTargetName, string sourceFileID, string targetFileID, string sourceObjectID, string targetObjectID, string modelFolder, bool isGameFolder, string exportFolder)
        {
            bool          flag;
            DirectoryInfo directoryInfo;
            bool          flag1;

            DirectoryInfo[] directoryInfoArray;
            int             num;
            DirectoryInfo   directoryInfo1 = new DirectoryInfo(dirSourceName);
            DirectoryInfo   directoryInfo2 = new DirectoryInfo(dirTargetName);
            string          name           = null;
            string          str            = null;
            string          name1          = null;
            string          str1           = null;
            string          name2          = null;
            string          str2           = null;
            string          str3           = null;
            string          str4           = null;

            DirectoryInfo[] directories         = directoryInfo1.GetDirectories("SkeletalMesh3", SearchOption.AllDirectories);
            DirectoryInfo[] directories1        = directoryInfo1.GetDirectories("MaterialInstanceConstant", SearchOption.AllDirectories);
            DirectoryInfo[] directoryInfoArray1 = directoryInfo1.GetDirectories("Texture2D", SearchOption.AllDirectories);
            if ((int)directories.Length == 1)
            {
                name = directories[0].Parent.Name;
            }
            else
            {
                flag = false;
                directoryInfoArray = directories;
                num = 0;
                while (true)
                {
                    if (num < (int)directoryInfoArray.Length)
                    {
                        directoryInfo = directoryInfoArray[num];
                        if (directoryInfo.Parent.Name == sourceFileID)
                        {
                            name = sourceFileID;
                            flag = true;
                            break;
                        }
                        else
                        {
                            num++;
                        }
                    }
                    else
                    {
                        break;
                    }
                }
                if (!flag)
                {
                    throw new Exception(
                              //"源模型在Source文件夹下的SkeletalMesh3文件夹不唯一,无法自动转换模型,请尝试手动转换。"
                              "Source Model Source folder SkeletalMesh3 folder is not unique,Can not be automatically converted model, try to manually convert.");
                }
            }
            if ((int)directories1.Length == 1)
            {
                name1 = directories1[0].Parent.Name;
            }
            else
            {
                flag = false;
                directoryInfoArray = directories1;
                num = 0;
                while (true)
                {
                    if (num < (int)directoryInfoArray.Length)
                    {
                        directoryInfo = directoryInfoArray[num];
                        if (directoryInfo.Parent.Name != sourceFileID)
                        {
                            name = directoryInfo.Parent.Name;
                            flag = true;
                            break;
                        }
                        else
                        {
                            num++;
                        }
                    }
                    else
                    {
                        break;
                    }
                }
                if (!flag)
                {
                    throw new Exception(
                              //"源模型在Source文件夹下的MaterialInstanceConstant文件夹不唯一,无法自动转换模型,请尝试手动转换。"
                              "Source Model Source folder MaterialInstanceConstant folder is not unique, Can not be automatically converted model, try to manually convert.");
                }
            }
            if ((int)directoryInfoArray1.Length == 1)
            {
                name2 = directoryInfoArray1[0].Parent.Name;
            }
            else
            {
                flag1 = false;
                directoryInfoArray = directoryInfoArray1;
                num = 0;
                while (true)
                {
                    if (num < (int)directoryInfoArray.Length)
                    {
                        directoryInfo = directoryInfoArray[num];
                        if ((directoryInfo.Parent.Name == name ? true : directoryInfo.Parent.Name == name1) || (int)directoryInfo.GetFiles(string.Concat("*", ReplaceClass.TryGetObjectNumberWithoutRaceSex(sourceObjectID), "*.tga")).Length <= 0)
                        {
                            num++;
                        }
                        else
                        {
                            str2  = directoryInfo.Parent.Name;
                            flag1 = true;
                            break;
                        }
                    }
                    else
                    {
                        break;
                    }
                }
                if (!flag1)
                {
                    throw new Exception(
                              //"源模型在Source文件夹下的Texture2D文件夹不唯一,无法自动转换模型,请尝试手动转换。"
                              "Source Model Source folder Texture2D folder is not unique, Can not be automatically converted model, try to manually convert.");
                }
            }
            directories         = directoryInfo2.GetDirectories("SkeletalMesh3", SearchOption.AllDirectories);
            directories1        = directoryInfo2.GetDirectories("MaterialInstanceConstant", SearchOption.AllDirectories);
            directoryInfoArray1 = directoryInfo2.GetDirectories("Texture2D", SearchOption.AllDirectories);
            if ((int)directories.Length == 1)
            {
                str = directories[0].Parent.Name;
            }
            else
            {
                flag = false;
                directoryInfoArray = directories;
                num = 0;
                while (true)
                {
                    if (num < (int)directoryInfoArray.Length)
                    {
                        directoryInfo = directoryInfoArray[num];
                        if (directoryInfo.Parent.Name == sourceFileID)
                        {
                            name = sourceFileID;
                            flag = true;
                            break;
                        }
                        else
                        {
                            num++;
                        }
                    }
                    else
                    {
                        break;
                    }
                }
                if (!flag)
                {
                    throw new Exception(
                              // "目标模型在Target文件夹下的SkeletalMesh3文件夹不唯一,无法自动转换模型,请尝试手动转换。"
                              "SkeletalMesh 3 target model file folder in Target folder is not unique, Can not be automatically converted model, try to manually convert.");
                }
            }
            if ((int)directories1.Length == 1)
            {
                str1 = directories1[0].Parent.Name;
            }
            else
            {
                flag = false;
                directoryInfoArray = directories1;
                num = 0;
                while (true)
                {
                    if (num < (int)directoryInfoArray.Length)
                    {
                        directoryInfo = directoryInfoArray[num];
                        if (directoryInfo.Parent.Name != targetFileID)
                        {
                            str1 = directoryInfo.Parent.Name;
                            flag = true;
                            break;
                        }
                        else
                        {
                            num++;
                        }
                    }
                    else
                    {
                        break;
                    }
                }
                if (!flag)
                {
                    throw new Exception(
                              //"目标模型在Target文件夹下的MaterialInstanceConstant文件夹不唯一,无法自动转换模型,请尝试手动转换。"
                              "Target model Target folder Material Instance Constant folder is not unique, Can not be automatically converted model, try to manually convert.");
                }
            }
            if ((int)directoryInfoArray1.Length == 1)
            {
                str2 = directoryInfoArray1[0].Parent.Name;
            }
            else
            {
                flag1 = false;
                directoryInfoArray = directoryInfoArray1;
                num = 0;
                while (true)
                {
                    if (num < (int)directoryInfoArray.Length)
                    {
                        directoryInfo = directoryInfoArray[num];
                        if ((directoryInfo.Parent.Name == str ? true : directoryInfo.Parent.Name == str1) || (int)directoryInfo.GetFiles(string.Concat("*", ReplaceClass.TryGetObjectNumberWithoutRaceSex(targetObjectID), "*.tga")).Length <= 0)
                        {
                            num++;
                        }
                        else
                        {
                            str2  = directoryInfo.Parent.Name;
                            flag1 = true;
                            break;
                        }
                    }
                    else
                    {
                        break;
                    }
                }
                if (!flag1)
                {
                    throw new Exception(
                              //"目标模型在Target文件夹下的Texture2D文件夹不唯一,无法自动转换模型,请尝试手动转换。"
                              "Target model Target folder Texture2D folder is not unique, Can not be automatically converted model, try to manually convert.");
                }
            }
            str3 = ReplaceClass.BackupSourceFile(name, modelFolder, isGameFolder, exportFolder);
            string str5 = ReplaceClass.BackupSourceFile(name1, modelFolder, isGameFolder, exportFolder);
            string str6 = ReplaceClass.BackupSourceFile(name2, modelFolder, isGameFolder, exportFolder);

            str4 = ReplaceClass.CopyTargetFile(str, modelFolder, isGameFolder, exportFolder);
            string str7 = ReplaceClass.CopyTargetFile(str1, modelFolder, isGameFolder, exportFolder);
            string str8 = ReplaceClass.CopyTargetFile(str2, modelFolder, isGameFolder, exportFolder);

            ReplaceClass.ReplaceTargetToSourceWithASCII(str3, str4, name, str, name1, str1, name2, str2, sourceObjectID, targetObjectID);
            ReplaceClass.ReplaceTargetToSourceWithASCII(str5, str7, name, str, name1, str1, name2, str2, sourceObjectID, targetObjectID);
            ReplaceClass.ReplaceTargetToSourceWithASCII(str6, str8, name, str, name1, str1, name2, str2, sourceObjectID, targetObjectID);
        }
Beispiel #12
0
        private static void Replace(string fileFullName, string sourceFileFullName, string sourceFileNameX, string sourceFileNameY, string sourceFileNameZ, string targetFileNameX, string targetFileNameY, string targetFileNameZ, string sourceObjectID, string targetObjectID)
        {
            string fileNameWithoutExtension = null;
            string str = null;
            string fileNameWithoutExtension1 = null;
            string str1 = null;
            string fileNameWithoutExtension2 = null;
            string str2 = null;

            if (!string.IsNullOrEmpty(sourceFileNameX))
            {
                fileNameWithoutExtension = Path.GetFileNameWithoutExtension(sourceFileNameX);
            }
            if (!string.IsNullOrEmpty(sourceFileNameY))
            {
                str = Path.GetFileNameWithoutExtension(sourceFileNameY);
            }
            if (!string.IsNullOrEmpty(sourceFileNameZ))
            {
                fileNameWithoutExtension1 = Path.GetFileNameWithoutExtension(sourceFileNameZ);
            }
            if (!string.IsNullOrEmpty(targetFileNameX))
            {
                str1 = Path.GetFileNameWithoutExtension(targetFileNameX);
            }
            if (!string.IsNullOrEmpty(targetFileNameY))
            {
                fileNameWithoutExtension2 = Path.GetFileNameWithoutExtension(targetFileNameY);
            }
            if (!string.IsNullOrEmpty(targetFileNameZ))
            {
                str2 = Path.GetFileNameWithoutExtension(targetFileNameZ);
            }
            FileInfo   fileInfo   = new FileInfo(fileFullName);
            FileStream fileStream = fileInfo.Open(FileMode.Open, FileAccess.ReadWrite, FileShare.None);

            byte[] numArray = new byte[checked ((int)fileStream.Length)];
            //byte[] numArray = new byte[fileStream.Length];
            fileStream.Read(numArray, 0, (int)numArray.Length);
            if ((fileNameWithoutExtension == null ? false : str1 != null))
            {
                numArray = ReplaceClass.ReplaceWithByte(ref numArray, str1, fileNameWithoutExtension);
            }
            if ((str == null ? false : fileNameWithoutExtension2 != null))
            {
                numArray = ReplaceClass.ReplaceWithByte(ref numArray, fileNameWithoutExtension2, str);
            }
            if ((fileNameWithoutExtension1 == null ? false : str2 != null))
            {
                numArray = ReplaceClass.ReplaceWithByte(ref numArray, str2, fileNameWithoutExtension1);
            }
            if ((sourceObjectID == null ? false : targetObjectID != null))
            {
                numArray = ReplaceClass.ReplaceWithByte(ref numArray, targetObjectID, sourceObjectID);
            }
            fileStream.Position = 0L;
            fileStream.Write(numArray, 0, (int)numArray.Length);
            fileStream.Flush();
            fileStream.Close();
            string str3 = Path.Combine(Path.GetDirectoryName(fileFullName), Path.GetFileName(sourceFileFullName));

            fileInfo.MoveTo(str3);
        }