private void buttonDoSAUserGuide_Click(object sender, EventArgs e) { string strHelpFileFullName; CultureInfo ctInfo = Thread.CurrentThread.CurrentCulture; if (ctInfo.Name == "en-US") { strHelpFileFullName = Path.Combine(CSettingData.m_strProgramDirName, "Help", "DoSA_User_Guide_ENG.pdf"); } else if (ctInfo.Name == "ko-KR") { strHelpFileFullName = Path.Combine(CSettingData.m_strProgramDirName, "Help", "DoSA_User_Guide_KOR.pdf"); } else { return; } if (m_manageFile.isExistFile(strHelpFileFullName) == false) { CNotice.noticeWarningID("HFDN"); return; } System.Diagnostics.Process.Start(strHelpFileFullName); }
public bool loadSettingFromFile() { string strAppDataPath = Environment.GetEnvironmentVariable("APPDATA"); string strSettingFilePath = Path.Combine(strAppDataPath, "DoSA-Open_2D"); string strSettingFileFullName = Path.Combine(strSettingFilePath, "setting.ini"); // CSettingData.ProgramDirectory 가 초기화 되어 있어야 한다. if (m_manageFile.isExistFile(strSettingFileFullName) == false) { CNotice.noticeWarningID("TCFD"); return(false); } try { XmlSerializer xmlSerializer = new XmlSerializer(typeof(CSettingDataClone)); StreamReader reader = new StreamReader(strSettingFileFullName); CSettingDataClone settingDataClone = new CSettingDataClone(); settingDataClone = (CSettingDataClone)xmlSerializer.Deserialize(reader); settingDataClone.copyCloneToSettingData(); reader.Close(); } catch (Exception ex) { CNotice.printTrace(ex.Message); CNotice.printTraceID("AEOW"); } return(true); }
public bool loadSettingFromFile() { string strAppDataPath = Environment.GetEnvironmentVariable("APPDATA"); string strSettingFilePath = Path.Combine(strAppDataPath, "DoSA-2D"); string strSettingFileFullName = Path.Combine(strSettingFilePath, "setting.ini"); // CSettingData.ProgramDirectory 가 초기화 되어 있어야 한다. if (m_manageFile.isExistFile(strSettingFileFullName) == false) { CNotice.noticeWarningID("TCFD"); return(false); } try { XmlSerializer xmlSerializer = new XmlSerializer(typeof(CSettingDataClone)); StreamReader reader = new StreamReader(strSettingFileFullName); CSettingDataClone settingDataClone = new CSettingDataClone(); settingDataClone = (CSettingDataClone)xmlSerializer.Deserialize(reader); settingDataClone.copyCloneToSettingData(); reader.Close(); // 혹시 데이터의 오류는 발생하더라도 하나만 오류가 발생한다. // 따라서 다른 항목까지 다시 설정하지 않도록 오류가 있는 데이터라도 파일에서 읽어드림과 동시에 창에 입력해 둔다. uploadSettingData(); } catch (Exception ex) { CNotice.printLog(ex.Message); CNotice.printLogID("AEOW"); } return(true); }
public bool attachDefault(string strExperimentFullName, CPoint pointBoundaryBlock) { CReadFile readFile = new CReadFile(); CManageFile manageFile = new CManageFile(); List <string> listString = new List <string>(); string strLine = string.Empty; char[] separators = { ' ', '\t' }; string[] strArray; string strFileName = Path.GetFileNameWithoutExtension(strExperimentFullName); string strTempFileFullName = Path.Combine(Path.GetDirectoryName(strExperimentFullName), strFileName + "_temp.fem"); if (manageFile.isExistFile(strExperimentFullName) == false) { CNotice.printTraceID("NFFF"); return(false); } else { File.Move(strExperimentFullName, strTempFileFullName); } StreamWriter writeFile = new StreamWriter(strExperimentFullName); int iNumBlock = 0; int nCountBlock = 0; bool bBlockLabels = false; try { readFile.getAllLines(strTempFileFullName, ref listString); for (int i = 0; i < listString.Count; i++) { strLine = listString[i]; strArray = strLine.Split(separators, StringSplitOptions.None); if (strArray[0] == "[NumBlockLabels]") { iNumBlock = Int32.Parse(strArray[2]); nCountBlock = 0; bBlockLabels = true; writeFile.WriteLine(strLine); /// 구분 Label 행은 건너 뛴다. continue; } if (bBlockLabels == true) { if (pointBoundaryBlock.m_dX == Double.Parse(strArray[0]) && pointBoundaryBlock.m_dY == Double.Parse(strArray[1])) { if (strArray.Length != 9) { CNotice.printTraceID("TWAP2"); return(false); } /// dettach block setting strArray[8] = "2"; strLine = string.Empty; foreach (string str in strArray) { strLine += str + '\t'; } } nCountBlock++; if (nCountBlock >= iNumBlock) { bBlockLabels = false; } } writeFile.WriteLine(strLine); } File.Delete(strTempFileFullName); } catch (Exception ex) { CNotice.printTrace(ex.Message); writeFile.Close(); return(false); } writeFile.Close(); return(true); }
public static bool isSettingDataOK(bool bOpenNoticeDialog = true) { bool bCheck = false; bCheck = m_manageFile.isExistFile(m_strFemmExeFileFullName); if (bCheck == false) { if (bOpenNoticeDialog == true) { CNotice.noticeWarningID("TEFD"); } else { CNotice.printLogID("TEFD"); } return(false); } bCheck = m_manageFile.isExistDirectory(m_strBaseWorkingDirPath); if (bCheck == false) { if (bOpenNoticeDialog == true) { CNotice.noticeWarningID("TDWD"); } else { CNotice.printLogID("TDWD"); } return(false); } bCheck = m_manageFile.isExistDirectory(m_strProgramDirPath); if (bCheck == false) { if (bOpenNoticeDialog == true) { CNotice.noticeWarningID("TIAP2"); } else { CNotice.printLogID("TIAP2"); } return(false); } if (m_dMeshLevelPercent <= 0.05f) { if (bOpenNoticeDialog == true) { CNotice.noticeWarningID("TMSL"); } else { CNotice.printLogID("TMSL"); } return(false); } return(true); }
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); }