예제 #1
0
        /// <summary>
        /// 比较文件
        /// </summary>
        /// <param name="currentFilePath">当前文件目录</param>
        /// <returns>是否比较成功</returns>
        private bool CompareFile(string currentFilePath)
        {
            bool compareSuccess = false;

            string   destFilePath = currentFilePath.Replace(leftFolder, rightFolder);
            FileInfo fi           = new FileInfo(destFilePath);

            if (fi.Exists)
            {
                switch (fi.Extension.ToLower())
                {
                case ".logical":
                {
                    mapLocicalCompareForm = new MapLogicalCompare.MainForm();
                    mapLocicalCompareForm.CompareFile(currentFilePath, destFilePath);
                    mapLocicalCompareForm.WindowState = FormWindowState.Maximized;
                    mapLocicalCompareForm.ShowDialog();
                    mapLocicalCompareForm.Dispose();
                    break;
                }

                case ".tab":
                {
                    if (tabCompareForm == null)
                    {
                        tabCompareForm = new ClientDiff.Form1();
                    }

                    tabCompareForm.CompareFile(currentFilePath, destFilePath);
                    tabCompareForm.WindowState = FormWindowState.Maximized;
                    //tabCompareForm.ShowDialog();

                    break;
                }

                case ".txt":
                {
                    goto case ".tab";
                }

                default:
                {
                    ViewDiffExternal(currentFilePath, destFilePath);
                    break;
                }
                }

                compareSuccess = true;
            }

            return(compareSuccess);
        }
예제 #2
0
파일: MainForm.cs 프로젝트: viticm/pap2
        /// <summary>
        /// 比较文件
        /// </summary>
        /// <param name="currentFilePath">当前文件目录</param>
        /// <returns>是否比较成功</returns>
        private bool CompareFile(string currentFilePath)
        {
            bool compareSuccess = false;

            string destFilePath = currentFilePath.Replace(leftFolder, rightFolder);
            FileInfo fi = new FileInfo(destFilePath);

            if (fi.Exists)
            {
                switch (fi.Extension.ToLower())
                {
                    case ".logical":
                        {
                            mapLocicalCompareForm = new MapLogicalCompare.MainForm();
                            mapLocicalCompareForm.CompareFile(currentFilePath, destFilePath);
                            mapLocicalCompareForm.WindowState = FormWindowState.Maximized;
                            mapLocicalCompareForm.ShowDialog();
                            mapLocicalCompareForm.Dispose();
                            break;
                        }
                    case ".tab":
                        {
                            if (tabCompareForm == null)
                            {
                                tabCompareForm = new ClientDiff.Form1();
                            }

                            tabCompareForm.CompareFile(currentFilePath, destFilePath);
                            tabCompareForm.WindowState = FormWindowState.Maximized;
                            //tabCompareForm.ShowDialog();

                            break;
                        }
                    case ".txt":
                        {
                            goto case ".tab";
                        }
                    default:
                        {
                            ViewDiffExternal(currentFilePath, destFilePath);
                            break;
                        }
                }

                compareSuccess = true;
            }

            return compareSuccess;
        }