示例#1
0
        private bool isInputDataOK()
        {
            bool bCheck;

            try
            {
                // 빈칸 확인으로 null 비교를 사용하지 말라. (.Length == 0 나 "" 를 사용하라)
                if (textBoxDesignName.Text.Length == 0)
                {
                    CNotice.noticeWarningID("PEAN");
                    return(false);
                }

                if (textBoxSTEPFileFullName.Text.Length == 0)
                {
                    if (CSettingData.m_emLanguage == EMLanguage.Korean)
                    {
                        CNotice.noticeWarning("STEP 파일을 선택해 주세요.");
                    }
                    else
                    {
                        CNotice.noticeWarning("You need to select a STEP file.");
                    }

                    return(false);
                }

                // 가능성은 낮지만 선택한 STEP 파일이 없는지를 검사한다.
                bCheck = m_manageFile.isExistFile(this.textBoxSTEPFileFullName.Text);
                if (bCheck == false)
                {
                    CNotice.printTrace("선택한 STEP 파일이 존재하지 않는다.");
                    return(false);
                }

                // 디자인을 무조건 프로그램 작업디렉토리에 생성하는 것으로 한다.
                // 따라서 디자인을 생성할 때의 적용버튼 임으로 작업 디렉토리는 프로그램 작업 디렉토리를 사용하고 있다.
                List <string> listDirectories = m_manageFile.getDirectoryList(CSettingData.m_strWorkingDirName);

                // 소문자로 비교하기 위해서 임시로 사용한다.
                string strOldTempName, strNewTempName;

                foreach (string directoryName in listDirectories)
                {
                    // 디렉토리 경로에 GetFileName 을 사용하면 가장 마지막 디렉토리가 넘어온다.
                    strOldTempName = Path.GetFileName(directoryName).ToLower();
                    strNewTempName = m_strDesignName.ToLower();

                    if (strOldTempName == strNewTempName)
                    {
                        // 기존 디자인이 이미 존재할 때 삭제하고 새롭게 시작할지를 물어 온다
                        DialogResult ret = CNotice.noticeWarningOKCancelID("TSDA", "W");

                        if (ret == DialogResult.OK)
                        {
                            m_manageFile.deleteDirectory(directoryName);
                            return(true);
                        }
                        else
                        {
                            return(false);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                CNotice.printTrace(ex.Message);
                return(false);
            }

            return(true);
        }
示例#2
0
        private bool isInputDataOK()
        {
            try
            {
                // 빈칸 확인으로 null 비교를 사용하지 말라. (.Length == 0 나 "" 를 사용하라)
                if (textBoxName.Text.Length == 0)
                {
                    CNotice.noticeWarningID("PEAN");
                    return(false);
                }

                /// Design 생성이다.
                if (m_strNewKind == "Design")
                {
                    // 디자인을 무조건 프로그램 작업디렉토리에 생성하는 것으로 한다.
                    // 따라서 디자인을 생성할 때의 적용버튼 임으로 작업 디렉토리는 프로그램 작업 디렉토리를 사용하고 있다.
                    List <string> listDirectories = m_manageFile.getDirectoryList(CSettingData.m_strWorkingDirName);

                    // 소문자로 비교하기 위해서 임시로 사용한다.
                    string strOldTempName, strNewTempName;

                    foreach (string directoryName in listDirectories)
                    {
                        // 디렉토리 경로에 GetFileName 을 사용하면 가장 마지막 디렉토리가 넘어온다.
                        strOldTempName = Path.GetFileName(directoryName).ToLower();
                        strNewTempName = m_strName.ToLower();

                        if (strOldTempName == strNewTempName)
                        {
                            // 기존 디자인이 이미 존재할 때 삭제하고 새롭게 시작할지를 물어 온다
                            DialogResult ret = CNotice.noticeWarningOKCancelID("TSDA", "W");

                            if (ret == DialogResult.OK)
                            {
                                m_manageFile.deleteDirectory(directoryName);
                                return(true);
                            }
                            else
                            {
                                return(false);
                            }
                        }
                    }
                }
                /// Experiment 들의 생성이다.
                else
                {
                    /// 호출할 때 Owner 를 FormMain 으로 초기화 해야 확실하게 얻을 수 있다.
                    FormMain formMain = ((FormMain)this.Owner);

                    if (formMain == null)
                    {
                        CNotice.printTraceID("CNGM");
                        return(false);
                    }

                    if (true == formMain.m_design.isExistNode(textBoxName.Text))
                    {
                        CNotice.noticeWarningID("IIAE");
                        return(false);
                    }
                }
            }
            catch (Exception ex)
            {
                CNotice.printTrace(ex.Message);
                return(false);
            }

            return(true);
        }