コード例 #1
0
ファイル: ManualClass.cs プロジェクト: DemonRem/BnsModTool
        private static void exportWorker_DoWork(object sender, DoWorkEventArgs e)
        {
            string argument = ((object[])e.Argument)[0] as string;
            string str      = ((object[])e.Argument)[1] as string;
            bool   flag     = (bool)((object[])e.Argument)[2];

            ManualClass.ExportFile(argument, str, flag);
        }
コード例 #2
0
ファイル: ManualClass.cs プロジェクト: DemonRem/BnsModTool
        private static void buildWorker_DoWork(object sender, DoWorkEventArgs e)
        {
            string argument  = ((object[])e.Argument)[0] as string;
            string str       = ((object[])e.Argument)[1] as string;
            string argument1 = ((object[])e.Argument)[2] as string;
            string str1      = ((object[])e.Argument)[3] as string;
            string argument2 = ((object[])e.Argument)[4] as string;
            string str2      = ((object[])e.Argument)[5] as string;
            string argument3 = ((object[])e.Argument)[6] as string;
            string str3      = ((object[])e.Argument)[7] as string;
            string argument4 = ((object[])e.Argument)[8] as string;

            ManualClass.Build(argument, str, argument1, str1, argument2, str2, argument3, str3, argument4);
        }
コード例 #3
0
ファイル: ManualClass.cs プロジェクト: DemonRem/BnsModTool
        private static void mainForm_DoOperation(object sender, OperationEventArgs e)
        {
            if ((e.Operation != Operations.LeaveSettings ? true : Directory.Exists(ManualClass.mainForm.txtModelFolder.Text)))
            {
                switch (e.Operation)
                {
                case Operations.LeaveSettings:
                case Operations.RefreshAnalysisList:
                case Operations.CancelRefreshanalysisList:
                case Operations.LookModel:
                case Operations.BeginAnalysis:
                case Operations.CancelAnalysis:
                case Operations.DragAnalysis:
                case Operations.CurrentAnalysis:
                case Operations.RefreshReplaceList:
                case Operations.BeginReplace:
                case Operations.CancelReplace:
                {
                    ManualClass.SetControlState(true, true);
                    break;
                }

                case Operations.ManualAction:
                {
                    ManualClass.SetControlState(true, false);
                    break;
                }

                case Operations.None:
                {
                    ManualClass.SetControlState(false, true);
                    break;
                }
                }
            }
        }
コード例 #4
0
ファイル: ManualClass.cs プロジェクト: DemonRem/BnsModTool
        private static void Build(string outputFolderName, string sourceFileNameX, string sourceFileNameY, string sourceFileNameZ, string targetFileNameX, string targetFileNameY, string targetFileNameZ, string sourceObjectID, string targetObjectID)
        {
            string str;
            bool   flag;
            bool   flag1;
            bool   flag2;

            ManualClass.buildWorker.ReportProgress(0, new Report((object x) => LogClass.AppendLine(string.Concat("Start to manual conversion", DateTime.Now.ToString()), true), null));
            if (string.IsNullOrEmpty(sourceFileNameX) && !string.IsNullOrEmpty(targetFileNameX) || !string.IsNullOrEmpty(sourceFileNameX) && string.IsNullOrEmpty(targetFileNameX))
            {
                flag = false;
            }
            else if (string.IsNullOrEmpty(sourceFileNameX) || string.IsNullOrEmpty(targetFileNameX))
            {
                flag = true;
            }
            else
            {
                flag = (File.Exists(sourceFileNameX) ? true : !File.Exists(targetFileNameX));
            }
            if (!flag)
            {
                throw new Exception("Source file X and target file X do not create the relation, can not be converted.");
            }
            if (string.IsNullOrEmpty(sourceFileNameY) && !string.IsNullOrEmpty(targetFileNameY) || !string.IsNullOrEmpty(sourceFileNameY) && string.IsNullOrEmpty(targetFileNameY))
            {
                flag1 = false;
            }
            else if (string.IsNullOrEmpty(sourceFileNameY) || string.IsNullOrEmpty(targetFileNameY))
            {
                flag1 = true;
            }
            else
            {
                flag1 = (File.Exists(sourceFileNameY) ? true : !File.Exists(targetFileNameY));
            }
            if (!flag1)
            {
                throw new Exception("Source file Y and target file Y do not create the relation, can not be converted.");
            }
            if (string.IsNullOrEmpty(sourceFileNameZ) && !string.IsNullOrEmpty(targetFileNameZ) || !string.IsNullOrEmpty(sourceFileNameZ) && string.IsNullOrEmpty(targetFileNameZ))
            {
                flag2 = false;
            }
            else if (string.IsNullOrEmpty(sourceFileNameZ) || string.IsNullOrEmpty(targetFileNameZ))
            {
                flag2 = true;
            }
            else
            {
                flag2 = (File.Exists(sourceFileNameZ) ? true : !File.Exists(targetFileNameZ));
            }
            if (!flag2)
            {
                throw new Exception("Source file Z and target file Z do not create the relation, can not be converted.");
            }
            if ((string.IsNullOrEmpty(sourceObjectID) || string.IsNullOrEmpty(targetObjectID) ? true : sourceObjectID == targetObjectID))
            {
                throw new Exception("Source model number and the model number is not set target correspondence, can not be converted.");
            }
            string str1 = Path.Combine(outputFolderName, "Backup source model");

            if (!Directory.Exists(str1))
            {
                Directory.CreateDirectory(str1);
            }
            if (!string.IsNullOrEmpty(sourceFileNameX))
            {
                File.Copy(sourceFileNameX, Path.Combine(str1, Path.GetFileName(sourceFileNameX)), true);
                str = Path.Combine(outputFolderName, Path.GetFileName(sourceFileNameX));
                if (File.Exists(str))
                {
                    File.Delete(str);
                }
            }
            if (!string.IsNullOrEmpty(sourceFileNameY))
            {
                File.Copy(sourceFileNameY, Path.Combine(str1, Path.GetFileName(sourceFileNameY)), true);
                str = Path.Combine(outputFolderName, Path.GetFileName(sourceFileNameY));
                if (File.Exists(str))
                {
                    File.Delete(str);
                }
            }
            if (!string.IsNullOrEmpty(sourceFileNameZ))
            {
                File.Copy(sourceFileNameZ, Path.Combine(str1, Path.GetFileName(sourceFileNameZ)), true);
                str = Path.Combine(outputFolderName, Path.GetFileName(sourceFileNameZ));
                if (File.Exists(str))
                {
                    File.Delete(str);
                }
            }
            string str2 = null;
            string str3 = null;
            string str4 = null;

            if (!string.IsNullOrEmpty(targetFileNameX))
            {
                str2 = Path.Combine(outputFolderName, Path.GetFileName(targetFileNameX));
                File.Copy(targetFileNameX, str2, true);
            }
            if (!string.IsNullOrEmpty(targetFileNameY))
            {
                str3 = Path.Combine(outputFolderName, Path.GetFileName(targetFileNameY));
                File.Copy(targetFileNameY, str3, true);
            }
            if (!string.IsNullOrEmpty(targetFileNameZ))
            {
                str4 = Path.Combine(outputFolderName, Path.GetFileName(targetFileNameZ));
                File.Copy(targetFileNameZ, str4, true);
            }
            if (str2 != null)
            {
                ManualClass.Replace(str2, sourceFileNameX, sourceFileNameX, sourceFileNameY, sourceFileNameZ, targetFileNameX, targetFileNameY, targetFileNameZ, sourceObjectID, targetObjectID);
            }
            if (str3 != null)
            {
                ManualClass.Replace(str3, sourceFileNameY, sourceFileNameX, sourceFileNameY, sourceFileNameZ, targetFileNameX, targetFileNameY, targetFileNameZ, sourceObjectID, targetObjectID);
            }
            if (str4 != null)
            {
                ManualClass.Replace(str4, sourceFileNameZ, sourceFileNameX, sourceFileNameY, sourceFileNameZ, targetFileNameX, targetFileNameY, targetFileNameZ, sourceObjectID, targetObjectID);
            }
        }