//读取图片坐标信息,生成featureArea.h public string AnalyseFeatherHeaderFile(string savePath, string inputFilePath) { try { if (!File.Exists(savePath + FeatherName)) { // CassMessageBox.Information("当前工程不存在" + FeatherName + "文件!"); return("当前工程不存在" + FeatherName + "文件!"); } //读取feather.h文件 string fileContent = FileOperator.ReadFromFile2(savePath + FeatherName); string writeContent = null; if (fileContent == null)//当feather.h文件为空时,默认读取全图尺寸 { writeContent = GenerateDefaltFeatureAreaFile(inputFilePath); CassMessageBox.Information("当前为默认状态,全图操作。"); } else { writeContent = AnalyseFeatherContent(fileContent); } FileOperator.WriteToFile(savePath + FeatureAreaName, writeContent, Encoding.UTF8); } catch (Exception ex) { return(ex.ToString()); } return(null); }
/// <summary> /// 判断工程名书写规范 /// 必须以大写字母开头只能包括字母数字和下划线 /// </summary> /// <param name="projectname"></param> /// <returns></returns> private bool judgeProjectName(string projectName) { char[] tempArray = projectName.ToCharArray(); if (tempArray.Length > 0) { string newName = null; for (int i = 0; i < tempArray.Length; i++) { if (tempArray[i] >= 'a' && tempArray[i] <= 'z') { tempArray[i] = (char)(tempArray[i] - 'a' + 'A');//从小写到大些相差32阿斯克马值 } else if (!((tempArray[i] >= 'A' && tempArray[i] <= 'Z') || (tempArray[i] >= '0' && tempArray[i] <= '9') || tempArray[i] == '_')) { CassMessageBox.Information("工程名中不能含有字母数字下划线以外的符号!"); return(false); } newName += tempArray[i]; } ProjectName.Text = newName; return(true); } return(false); }
private void btn_Ok_Click(object sender, EventArgs e) { //3.调用委托,将参数传给主界面中的programPath dele_workSpace(this._currentWorkSpace); this.Close(); //提示完成切换 CassMessageBox.Information("工作目录切换成功!"); }