//Metodo para autentica o sistema entre o Administrador e Garçom public Pessoa Autentica(string email, string senha) { Pessoa obj = null; System.Data.IDbConnection objConexao; System.Data.IDbCommand ObjCommand; System.Data.IDataReader objDataReader; objConexao = Mapped.Connection(); ObjCommand = Mapped.Command("SELECT * FROM tbl_pessoa WHERE pes_email = ?email and pes_senha = ?senha", objConexao); ObjCommand.Parameters.Add(Mapped.Parameter("?email", email)); ObjCommand.Parameters.Add(Mapped.Parameter("?senha", senha)); objDataReader = ObjCommand.ExecuteReader(); while (objDataReader.Read()) { obj = new Pessoa(); obj.Codigo = Convert.ToInt32(objDataReader["pes_id"]); obj.Nome = Convert.ToString(objDataReader["pes_nome"]); obj.Email = Convert.ToString(objDataReader["pes_email"]); obj.Tipo = Convert.ToChar(objDataReader["pes_tipo"]); } objDataReader.Close(); objConexao.Close(); ObjCommand.Dispose(); objConexao.Dispose(); objDataReader.Dispose(); return(obj); }
/// <summary> /// SetPointMode相対位置機能関数 /// </summary> /// <param name="objCommData">入力データ例 objA|:|setpoint|(|left|,|objB|,|right|,|10|,|0|)</param> /// <param name="objAnaData">入力データ例 Ident|Colon|SetPoint|Lparen|Position|Comma|Ident|Comma|Position|Comma|IntNum|Comma|IntNum|Rparen</param> public void TheSetPointMode(string objCommData, string objAnaData) { #region Define Part //objA: setpoint(left, objB, right, 10, 0) //objCommData objA|:|setpoint|(|left|,|objB|,|right|,|10|,|0|) //命令解釈 Region:SetPoint("Point", relativeTo, "relativePoint", xOffset, yOffset) //objAnaData Ident|Colon|SetPoint|Lparen|Position|Comma|Ident|Comma|Position|Comma|IntNum|Comma|IntNum|Rparen //Define int identPosition = 0; string identA = "", identB = "", tempComm = ""; double objAstartX = 0, objAstartY = 0, objAendX = 0, objAendY = 0, objAlength = 0; double objBstartX = 0, objBstartY = 0, objBendX = 0, objBendY = 0, objBlength = 0; double tempWidth = 0, tempHeight = 0; string[] listBasedComm, listBasedAna; //Object B string[] listFixedComm, listFixedAna; //Object A ArrayList basedPointData = new ArrayList(); ArrayList basedEdgeData = new ArrayList(); ArrayList fixedPointData = new ArrayList(); ArrayList fixedEdgeData = new ArrayList(); ArrayList redrawPointData = new ArrayList(); List <string> positionData = new List <string>(); List <string> targetIdent = new List <string>(); List <double> objOffset = new List <double>(); string[] listCommData = Regex.Split(objCommData, @"\|", RegexOptions.IgnoreCase); string[] listAnaData = Regex.Split(objAnaData, @"\|", RegexOptions.IgnoreCase); LogOutput("Processing in TheSetPointMode Function"); #endregion #region 事前に入力データを検査する //string finder in listAnaData for (int i = 0; i < listAnaData.Length; i++) { if (listAnaData[i] == "Ident") { if (ObjectFinder(listCommData[i]) != -1) { targetIdent.Add(listCommData[i]); } } if (listAnaData[i] == "Position") { positionData.Add(listCommData[i].ToLower()); } if (listAnaData[i] == "IntNum" || listAnaData[i] == "DblNum") { objOffset.Add(Convert.ToDouble(listCommData[i])); } } if (targetIdent.Count != 2 || positionData.Count != 2) { LogOutput("TheSetPointMode相対位置関数パラメーターミス、処理中止。"); tobeRead.SpeakAsync("TheSetPointMode相対位置関数パラメーターミス、処理中止。もう一度入力してください!"); return; } #endregion #region Object B の輪郭を計算する identPosition = ObjectFinder(targetIdent[1]); tempComm = ObjCommand[identPosition].ToString(); AssignRemover(ref tempComm); listBasedComm = Regex.Split(tempComm, @"\|", RegexOptions.IgnoreCase); listBasedAna = Regex.Split(ObjAnalysis[identPosition].ToString(), @"\|", RegexOptions.IgnoreCase); //描画点を取る for (int i = 0; i < listBasedAna.Length; i++) { if (listBasedAna[i] == "IntNum" || listBasedAna[i] == "DblNum") { basedPointData.Add(listBasedComm[i]); } } //輪郭を計算する identB = listBasedAna[0]; switch (identB) { case "Line": #region Line Case if (basedPointData.Count == 4) { //AnchorPoint 左上 //basedPointData[0] 始点x -> objBstartX //basedPointData[1] 始点y -> objBstartY //basedPointData[2] 終点x -> objBendX //basedPointData[3] 終点y -> objBendY objBstartX = Convert.ToDouble(basedPointData[0]); objBstartY = Convert.ToDouble(basedPointData[1]); objBendX = Convert.ToDouble(basedPointData[2]); objBendY = Convert.ToDouble(basedPointData[3]); if (objBstartX < objBendX && objBstartY < objBendY) { basedEdgeData.Add(objBstartX); basedEdgeData.Add(objBendY); basedEdgeData.Add(objBendX - objBstartX); basedEdgeData.Add(objBendY - objBstartY); } else if (objBstartX < objBendX && objBstartY > objBendY) { basedEdgeData.Add(objBstartX); basedEdgeData.Add(objBstartY); basedEdgeData.Add(objBendX - objBstartX); basedEdgeData.Add(objBstartY - objBendY); } else if (objBstartX < objBendX && objBstartY == objBendY) { //水平線 basedEdgeData.Add(objBstartX); basedEdgeData.Add(objBstartY + 3); basedEdgeData.Add(objBendX - objBstartX); basedEdgeData.Add(5); } else if (objBstartX == objBendX && objBstartY < objBendY) { //垂直線 basedEdgeData.Add(objBendX - 3); basedEdgeData.Add(objBendY); basedEdgeData.Add(5); basedEdgeData.Add(objBendY - objBstartY); } else if (objBendX < objBstartX && objBendY < objBstartY) { //AnchorPoint 左上 basedEdgeData.Add(objBendX); basedEdgeData.Add(objBstartY); basedEdgeData.Add(objBstartX - objBendX); basedEdgeData.Add(objBstartY - objBendY); } else if (objBendX < objBstartX && objBendY > objBstartY) { //AnchorPoint 左上 basedEdgeData.Add(objBendX); basedEdgeData.Add(objBstartY); basedEdgeData.Add(objBstartX - objBendX); basedEdgeData.Add(objBstartY - objBendY); } else { LogOutput("線処理未知条件"); } } else if (basedPointData.Count == 5) { objBstartX = Convert.ToDouble(basedPointData[0]); objBstartY = Convert.ToDouble(basedPointData[1]); objBendX = Convert.ToDouble(basedPointData[2]); objBendY = Convert.ToDouble(basedPointData[3]); objBlength = Convert.ToDouble(basedPointData[4]); } else { LogOutput("パラメーターミス"); return; } #endregion break; case "Circle": #region Circle Case if (basedPointData.Count == 1) { //Anchor Point 左上 //basedPointData[0] 半径r //左上座標点 -> objBstartX, objBstartY //右下座標点 -> objBendX, objBendY //Define int index; string subIdent, subComm, subAna; string[] subCommData, subChkData; ArrayList subPointData = new ArrayList(); //Processing //chkData "["circle", "(", "c", ",", "5", ")"]" index = IdentFinder(ref listBasedAna); if (index == -1) { tobeRead.SpeakAsync("円定義の中にミスが存在している、もう一度確認してください。"); return; } subIdent = listBasedComm[index]; index = 0; foreach (string finder in ObjName) { if (finder == subIdent) { break; } index += 1; } if (ObjName.Count == index) { tobeRead.SpeakAsync("中心座標点の定義が存在しない、もう一度確認してください。"); LogOutput("中心座標点の定義が存在しない、もう一度確認してください。"); return; } if (ObjName[index].ToString() != subIdent) { tobeRead.SpeakAsync("中心座標点の定義が存在しない、もう一度確認してください。"); LogOutput("中心座標点の定義が存在しない、もう一度確認してください。"); return; } subComm = ObjCommand[index].ToString(); subAna = ObjAnalysis[index].ToString(); AssignRemover(ref subComm); subCommData = Regex.Split(subComm, @"\|", RegexOptions.IgnoreCase); subChkData = Regex.Split(subAna, @"\|", RegexOptions.IgnoreCase); for (int i = 0; i < subChkData.Length; i++) { if (subChkData[i] == "IntNum" || subChkData[i] == "DblNum") { subPointData.Add(subCommData[i]); } } if (subCommData[0].ToLower() == "point" && subChkData[0] == "Point" && subPointData.Count == 2) { subPointData.Add(basedPointData[basedPointData.Count - 1]); objBstartX = Convert.ToDouble(subPointData[0]) - Convert.ToDouble(subPointData[2]); objBstartY = Convert.ToDouble(subPointData[1]) - Convert.ToDouble(subPointData[2]); objBendX = Convert.ToDouble(subPointData[0]) + Convert.ToDouble(subPointData[2]); objBendY = Convert.ToDouble(subPointData[1]) + Convert.ToDouble(subPointData[2]); } else { if (subPointData.Count != 2) { tobeRead.SpeakAsync("Error @Draw_CircleMode" + "座標点異常ある"); } tobeRead.SpeakAsync("Error @Draw_CircleMode"); } } else if (basedPointData.Count == 3) { //Anchor Point 左上 //basedPointData[0] 中心座標点x //basedPointData[1] 中心座標点y //basedPointData[2] 半径r //左上座標点 -> objBstartX, objBstartY //右下座標点 -> objBendX, objBendY objBstartX = Convert.ToDouble(basedPointData[0]) - Convert.ToDouble(basedPointData[2]); objBstartY = Convert.ToDouble(basedPointData[1]) - Convert.ToDouble(basedPointData[2]); objBendX = Convert.ToDouble(basedPointData[0]) + Convert.ToDouble(basedPointData[2]); objBendY = Convert.ToDouble(basedPointData[1]) + Convert.ToDouble(basedPointData[2]); } else { LogOutput("円処理未知条件"); } #endregion break; default: codeOutput("Error Unsupported Ident " + identB + " @TheSetPointMode @switch 対象B処理."); break; } #endregion #region Object A の輪郭を計算する basedPointData.Clear(); identPosition = ObjectFinder(targetIdent[0]); tempComm = ObjCommand[identPosition].ToString(); AssignRemover(ref tempComm); listFixedComm = Regex.Split(tempComm, @"\|", RegexOptions.IgnoreCase); listFixedAna = Regex.Split(ObjAnalysis[identPosition].ToString(), @"\|", RegexOptions.IgnoreCase); //描画点を取る for (int i = 0; i < listFixedAna.Length; i++) { if (listFixedAna[i] == "IntNum" || listFixedAna[i] == "DblNum") { basedPointData.Add(listFixedComm[i]); } } //輪郭を計算する identA = listFixedAna[0]; switch (identA) { case "Line": break; case "Circle": #region Circle Case if (basedPointData.Count == 1) { //Anchor Point 左上 //basedPointData[0] 半径r //左上座標点 -> objAstartX, objAstartY //右下座標点 -> objAendX, objAendY //Define int index; string subIdent, subComm, subAna; string[] subCommData, subChkData; ArrayList subPointData = new ArrayList(); //Processing //chkData "["circle", "(", "c", ",", "5", ")"]" index = IdentFinder(ref listFixedAna); if (index == -1) { tobeRead.SpeakAsync("円定義の中にミスが存在している、もう一度確認してください。"); return; } subIdent = listFixedComm[index]; index = 0; foreach (string finder in ObjName) { if (finder == subIdent) { break; } index += 1; } if (ObjName.Count == index) { tobeRead.SpeakAsync("中心座標点の定義が存在しない、もう一度確認してください。"); LogOutput("中心座標点の定義が存在しない、もう一度確認してください。"); return; } if (ObjName[index].ToString() != subIdent) { tobeRead.SpeakAsync("中心座標点の定義が存在しない、もう一度確認してください。"); LogOutput("中心座標点の定義が存在しない、もう一度確認してください。"); return; } subComm = ObjCommand[index].ToString(); subAna = ObjAnalysis[index].ToString(); AssignRemover(ref subComm); subCommData = Regex.Split(subComm, @"\|", RegexOptions.IgnoreCase); subChkData = Regex.Split(subAna, @"\|", RegexOptions.IgnoreCase); for (int i = 0; i < subChkData.Length; i++) { if (subChkData[i] == "IntNum" || subChkData[i] == "DblNum") { subPointData.Add(subCommData[i]); } } if (subCommData[0].ToLower() == "point" && subChkData[0] == "Point" && subPointData.Count == 2) { subPointData.Add(basedPointData[basedPointData.Count - 1]); objAstartX = Convert.ToDouble(subPointData[0]) - Convert.ToDouble(subPointData[2]); objAstartY = Convert.ToDouble(subPointData[1]) - Convert.ToDouble(subPointData[2]); objAendX = Convert.ToDouble(subPointData[0]) + Convert.ToDouble(subPointData[2]); objAendY = Convert.ToDouble(subPointData[1]) + Convert.ToDouble(subPointData[2]); } else { if (subPointData.Count != 2) { tobeRead.SpeakAsync("Error @Draw_CircleMode" + "座標点異常ある"); } tobeRead.SpeakAsync("Error @Draw_CircleMode"); } } else if (basedPointData.Count == 3) { //Anchor Point 左上 //basedPointData[0] 中心座標点x //basedPointData[1] 中心座標点y //basedPointData[2] 半径r //左上座標点 -> objAstartX, objAstartY //右下座標点 -> objAendX, objAendY objAstartX = Convert.ToDouble(basedPointData[0]) - Convert.ToDouble(basedPointData[2]); objAstartY = Convert.ToDouble(basedPointData[1]) - Convert.ToDouble(basedPointData[2]); objAendX = Convert.ToDouble(basedPointData[0]) + Convert.ToDouble(basedPointData[2]); objAendY = Convert.ToDouble(basedPointData[1]) + Convert.ToDouble(basedPointData[2]); } else { LogOutput("円処理未知条件"); } #endregion break; default: codeOutput("Error Unsupported Ident " + identA + " @TheSetPointMode @switch 対象A処理."); break; } #endregion #region Object A の輪郭位置を再計算する //相対位置パラメーター positionData[0] -> left を基準になる //targetIdent[1] -> objB //相対位置パラメーター positionData[1] -> right //targetIdent[0] -> objA //objOffset[0] -> xOffset objOffset[1] -> yOffset tempWidth = objAendX - objAstartX; tempHeight = objAendY - objAstartY; //debug information LogOutput(targetIdent[1] + "座標データ >>" + "objBstartX: " + objBstartX + "/objBstartY: " + objBstartY + "/objBendX: " + objBendX + "/objBendY: " + objBendY); LogOutput(targetIdent[0] + "座標データ >>" + "objAstartX: " + objAstartX + "/objAstartY: " + objAstartY + "/objAendX: " + objAendX + "/objAendY: " + objAendY); LogOutput("tempWidth: " + tempWidth + " tempHeight: " + tempHeight); if (positionData[0].ToLower() == "left" && positionData[1].ToLower() == "right") { LogOutput(targetIdent[1] + "左 -> " + targetIdent[0] + "右"); //objB -> left objA -> right objAstartX = objBendX + objOffset[0]; objAstartY = objBstartY + objOffset[1]; objAendX = objAstartX + tempWidth; objAendY = objAstartY + tempHeight; } else if (positionData[0].ToLower() == "bottomright" && positionData[1].ToLower() == "topleft") { LogOutput(targetIdent[1] + "右下 -> " + targetIdent[0] + "左上"); //objB -> bottomright objA -> topleft objAendX = objBstartX - objOffset[0]; objAendY = objBstartY - objOffset[1]; objAstartX = objAendX - tempWidth; objAstartY = objAendY - tempHeight; } else if (positionData[0].ToLower() == "topright" && positionData[1].ToLower() == "bottomleft") { LogOutput(targetIdent[1] + "右上 -> " + targetIdent[0] + "左下"); //objB -> topright objA -> bottomleft objAendX = objBstartX - objOffset[0]; objAendY = objBendY + tempHeight + objOffset[1]; objAstartX = objAendX - tempWidth; objAstartY = objAendY - tempHeight; } else if (positionData[0].ToLower() == "right" && positionData[1].ToLower() == "left") { LogOutput(targetIdent[1] + "右 -> " + targetIdent[0] + "左"); //objB -> right objA -> left objAendX = objBstartX - objOffset[0]; objAendY = objBstartY + tempHeight + objOffset[1]; objAstartX = objAendX - tempWidth; objAstartY = objAendY - tempHeight; } else if (positionData[0].ToLower() == "bottomleft" && positionData[1].ToLower() == "topright") { LogOutput(targetIdent[1] + "左下 -> " + targetIdent[0] + "右上"); //objB -> bottomleft objA -> topright objAstartX = objBendX + objOffset[0]; objAstartY = objBstartY - tempHeight - objOffset[1]; objAendX = objAstartX + tempWidth; objAendY = objAstartY + tempHeight; } else if (positionData[0].ToLower() == "topleft" && positionData[1].ToLower() == "bottomright") { LogOutput(targetIdent[1] + "左上 -> " + targetIdent[0] + "右下"); //objB -> topleft objA -> bottomright objAstartX = objBendX + objOffset[0]; objAstartY = objBendY + objOffset[1]; objAendX = objAstartX + tempWidth; objAendY = objAstartY + tempHeight; } else if (positionData[0].ToLower() == "top" && positionData[1].ToLower() == "bottom") { LogOutput(targetIdent[1] + "上 -> " + targetIdent[0] + "下"); //objB -> top objA -> bottom objAstartX = objBstartX + objOffset[0]; objAstartY = objBendY + objOffset[1]; objAendX = objAstartX + tempWidth; objAendY = objAstartY + tempHeight; } else if (positionData[0].ToLower() == "bottom" && positionData[1].ToLower() == "top") { LogOutput(targetIdent[1] + "下 -> " + targetIdent[0] + "上"); //objB -> bottom objA -> top objAstartX = objBstartX - objOffset[0]; objAstartY = objBstartY - tempHeight - objOffset[1]; objAendX = objAstartX + tempWidth; objAendY = objAstartY + tempHeight; } else { LogOutput("入力した相対位置条件はサポートされていません。"); } LogOutput(targetIdent[0] + "再計算結果" + "/objAstartX: " + objAstartX + "/objAstartY: " + objAstartY + "/objAendX: " + objAendX + "/objAendY: " + objAendY); #endregion #region Object A を再描画する LogOutput("Object A を再描画する"); switch (identA) { case "Line": break; case "Circle": #region Circle Case if (tempHeight / 2 != tempWidth / 2) { return; } redrawPointData.Add(objAstartX + (tempWidth / 2)); redrawPointData.Add(objAstartY + (tempHeight / 2)); redrawPointData.Add(tempHeight / 2); DrawCircleMode(ref redrawPointData, pub_picPen); //Rewrite the Data identPosition = ObjectFinder(targetIdent[0]); //円形の命令データを書き直し ObjCommand.RemoveAt(identPosition); ObjCommand.Insert(identPosition, targetIdent[0] + "|=|" + identA + "|(|" + redrawPointData[0] + "|,|" + redrawPointData[1] + "|,|" + redrawPointData[2] + "|)"); //円形の解析データを書き直し ObjAnalysis.RemoveAt(identPosition); ObjAnalysis.Insert(identPosition, "Circle|Lparen|IntNum|Comma|IntNum|Comma|IntNum|Rparen"); #endregion break; default: codeOutput("Error Unsupported Ident " + identA + " @TheSetPointMode @switch 対象A処理."); break; } #endregion picBox.Refresh(); MakeObjectBraille(); }
/// <summary> /// 入力した内容を解析するアルゴリズム /// </summary> public void FormulaAnalysis() { //Define Parameters ToKen token; TknKind bef_tok_kind = TknKind.None; loopInfo = 0; //DV2_Drawing dv2d_FA = new DV2_Drawing(); string objName = ""; string objAnalysisData = ""; string objCommandData = ""; string[] storageData; int dataGridView_index = 0; int objFinder_index = 0; System.DateTime currentTime = new System.DateTime(); currentTime = System.DateTime.Now; #region Boolean Flags bool pointDef_flg = false; bool pointGet_flg = false; bool pointSol_flg = false; bool objPlus_flg = false; bool rotation_flg = false; bool setPoint_flg = false; bool clear_flg = false; bool cleartar_flg = false; #endregion //Debug //LogOutput("Resources.Graph_line :> " + Properties.Resources.Graph_line); LogOutput("Formula Analysis Strat at -> ******* " + currentTime + " *******"); //LogOutput("Settings.GraphicInstruction :> " + DV2.Net_Graphics_Application.Properties.Settings.Default.GraphicInstruction); //LogOutput(dataStorage.Text.Length); if (dataStorage.Text.Length != 0) { LogOutput(String.Format("{0, -15}", "Text") + String.Format("{0, -15}", "Kind") + String.Format("{0, -15}", "numVal")); LogOutput("---------------------------------------------"); #region コマンド内容はチャ-の単位として循環処理 for (char txtChar = ' '; loopInfo < dataStorage.Text.Length;) { txtChar = dataStorage.Text[loopInfo]; token = nextTkn(txtChar); LogOutput(">>>token.kind iS -> " + String.Format("{0, -15}", token.kind)); //LogOutput(">>bef_tok_kind iS -> " + String.Format("{0, -15}", bef_tok_kind)); #region コマンド終わり判断 if (token.kind == TknKind.END_line) { break; } #endregion #region Command "Assign" Route if (token.kind == TknKind.Assign) { //例:対象を定義する obj1 = line(0,0,20,10) if (bef_tok_kind == TknKind.Ident) { //dataStorage storageData = Regex.Split(dataStorage.Text, "=", RegexOptions.IgnoreCase); //LogOutput("TknKind.Ident+TknKind.Assign Length ->" + storageData.Length); //入力した命令を保存する if (storageData.Length == 2) { if (ObjectFinder(storageData[0].Replace(" ", "")) == -1) { ObjName.Add(storageData[0].Replace(" ", "")); ObjCommand.Add(storageData[1].Replace(" ", "")); } else { objName = storageData[0].Replace(" ", ""); ObjCommand[ObjectFinder(storageData[0].Replace(" ", ""))] = storageData[1].Replace(" ", ""); } //データ監視器--データ導入 dataGridView_index = this.dataGridView_monitor.Rows.Add(); this.dataGridView_monitor.Rows[dataGridView_index].Cells[0].Value = storageData[0].Replace(" ", ""); this.dataGridView_monitor.Rows[dataGridView_index].Cells[1].Value = storageData[1].Replace(" ", ""); } else { codeOutput("Error @FormulaAnalysis @341"); break; } } } #endregion #region Command "Show" Route if (token.kind == TknKind.Ident) { //表示命令を判別する if (bef_tok_kind == TknKind.Show) { //tabControl_Graphics.SelectTab(1); //表示したい対象名が存在するかどうかを判断する if (ObjectFinder(token.text) != -1) { objFinder_index = ObjectFinder(token.text); } else { tobeRead.SpeakAsync("表示される " + token.text + " 対象は不存在,もう一度確認してください。"); codeOutput("表示される " + token.text + " 対象は不存在,もう一度確認してください。"); return; } //表示したい対象名が存在する場合は,その同じ順番配列データの有効性を判断する if (ObjName[objFinder_index] != null && ObjAnalysis[objFinder_index] != null) { //LogOutput(ObjCommand[objFinder_index]); //LogOutput(ObjAnalysis[objFinder_index]); //分析結果を転送する ParameterChecker(ObjAnalysis[objFinder_index], objFinder_index); picBox.Refresh(); } else { tobeRead.SpeakAsync("表示される " + token.text + " 対象は不存在,もう一度確認してください。"); codeOutput("表示される " + token.text + " 対象は不存在,もう一度確認してください。"); } if (!ROTATIONFLAG) { LogOutput("ROTATIONFLAG is " + ROTATIONFLAG); debug_Image.RotateFlip(RotateFlipType.RotateNoneFlipY); picBox.Refresh(); ROTATIONFLAG = true; } MakeObjectBraille(); } } #endregion #region Command "Point Define" Route if (token.kind == TknKind.Point) { //変数pをPoint型として宣言 if (bef_tok_kind == TknKind.Colon) { //Ex:"var p : Point" -> "p = Point(0,0)" -- このコマンドは点pを原点に初期値(0,0)に設定する storageData = Regex.Split(dataStorage.Text, ":", RegexOptions.IgnoreCase); if (ObjectFinder(storageData[0].Replace(" ", "")) == -1) { ObjName.Add(storageData[0].Replace(" ", "")); ObjCommand.Add(storageData[1].Replace(" ", "")); } else { objName = storageData[0].Replace(" ", ""); ObjCommand[ObjectFinder(storageData[0].Replace(" ", ""))] = storageData[1].Replace(" ", ""); } //データ監視器--データ導入 dataGridView_index = this.dataGridView_monitor.Rows.Add(); this.dataGridView_monitor.Rows[dataGridView_index].Cells[0].Value = storageData[0]; this.dataGridView_monitor.Rows[dataGridView_index].Cells[1].Value = storageData[1].Replace(" ", ""); //pointDef_flgフラグをtrueに設定する pointDef_flg = true; } } #endregion #region Command "Get P" Route if (token.kind == TknKind.Ident) { //To get the finger point on the object //Ex:get p on obj1 if (bef_tok_kind == TknKind.Get) { //pointGet_flgフラグをtrueに設定する pointGet_flg = true; } } #endregion #region Command "Slove" Route if (token.kind == TknKind.Ident) { //Slove the math program //Ex:solve c by contact(obj1,obj2,p) if (bef_tok_kind == TknKind.Solve) { //pointSol_flgフラグをtrueに設定する pointSol_flg = true; } } #endregion #region Command "Object Plus" Route if (token.kind == TknKind.Ident) { //Ex:obj3=obj1+obj2 if (bef_tok_kind == TknKind.Plus) { //objPlus_flgフラグをtrueに設定する objPlus_flg = true; } } #endregion #region Command "Clear Object" Route if (token.kind == TknKind.Ident) { //Ex:clear obj if (bef_tok_kind == TknKind.Clear) { LogOutput("Clear The graphObj"); //cleartar_flgフラグをtrueに設定する cleartar_flg = true; } } #endregion #region Command "Clear ALL" Route if (token.kind == TknKind.Clear) { //Ex:clear if (dataStorage.Text.Length != 0 && dataStorage.Text.ToLower() == "clear") { LogOutput("Clear ALL The graphObj"); //clear_flgフラグをtrueに設定する clear_flg = true; } } #endregion #region Command "Set" Route if (token.kind == TknKind.Set) { //Setting the parameters } #endregion #region Command "Rotate" Route if (token.kind == TknKind.Lparen) { if (bef_tok_kind == TknKind.Rotation) { //画像を回転する rotation_flg = true; } } #endregion #region Command "SetPoint" Route if (token.kind == TknKind.SetPoint) { //相対位置処理入口 setPoint_flg = true; } #endregion bef_tok_kind = token.kind; objAnalysisData += token.kind + "|"; objCommandData += token.text + "|"; //LogOutput(String.Format("{0, -15}", token.text) + String.Format("{0, -15}", token.kind) + String.Format("{0, -15}", token.dblVal)); } #endregion #region 書き処理 //Modify old data if (ObjAnalysis.Count == ObjName.Count && objName != "" && ObjectFinder(objName) != -1) { bool assignFlag = false; int loop_i; //分析結果を保存する //正規表現関数 for (loop_i = 0; loop_i < Regex.Split(objAnalysisData, @"\|", RegexOptions.IgnoreCase).Length; loop_i++) { if (Regex.Split(objAnalysisData, @"\|", RegexOptions.IgnoreCase)[loop_i] == "Assign") { assignFlag = true; break; } } if (assignFlag) { objAnalysisData = string.Join("|", Regex.Split(objAnalysisData, @"\|", RegexOptions.IgnoreCase).Skip(loop_i + 1).ToArray()); ObjAnalysis[ObjectFinder(objName)] = objAnalysisData.Substring(0, objAnalysisData.Length - 1); this.dataGridView_monitor.Rows[dataGridView_index].Cells[2].Value = objAnalysisData.Substring(0, objAnalysisData.Length - 1); } else { ObjAnalysis[ObjectFinder(objName)] = objAnalysisData.Substring(0, objAnalysisData.Length - 1); this.dataGridView_monitor.Rows[dataGridView_index].Cells[2].Value = objAnalysisData.Substring(0, objAnalysisData.Length - 1); } //Ex:"obj1|=|line|(|1|,|2|,|20.0|,|25.5|)|" -> "obj1|=|line|(|1|,|2|,|20.0|,|25.5|)" ObjCommand[ObjectFinder(objName)] = objCommandData.Substring(0, objCommandData.Length - 1); LogOutput("Modify Debug Point"); } #endregion #region 解析結果 //New data appended! if (ObjAnalysis.Count < ObjName.Count) { bool assignFlag = false; int loop_i; //分析結果を保存する //正規表現関数 for (loop_i = 0; loop_i < Regex.Split(objAnalysisData, @"\|", RegexOptions.IgnoreCase).Length; loop_i++) { if (Regex.Split(objAnalysisData, @"\|", RegexOptions.IgnoreCase)[loop_i] == "Assign") { assignFlag = true; break; } } if (assignFlag) { objAnalysisData = String.Join("|", Regex.Split(objAnalysisData, @"\|", RegexOptions.IgnoreCase).Skip(loop_i + 1).ToArray()); ObjAnalysis.Add(objAnalysisData.Substring(0, objAnalysisData.Length - 1)); this.dataGridView_monitor.Rows[dataGridView_index].Cells[2].Value = objAnalysisData.Substring(0, objAnalysisData.Length - 1); } else { ObjAnalysis.Add(objAnalysisData.Substring(0, objAnalysisData.Length - 1)); this.dataGridView_monitor.Rows[dataGridView_index].Cells[2].Value = objAnalysisData.Substring(0, objAnalysisData.Length - 1); } if (ObjCommand.Count == ObjName.Count) { //Ex:"obj1|=|line|(|1|,|2|,|20.0|,|25.5|)|" -> "obj1|=|line|(|1|,|2|,|20.0|,|25.5|)" ObjCommand.RemoveAt(ObjCommand.Count - 1); ObjCommand.Add(objCommandData.Substring(0, objCommandData.Length - 1)); } } #endregion } else { codeOutput("Error @FormulaAnalysis MSG: Please Input Data!"); } //此処から処理するのデータは自動保存されていない。 if (dataStorage.Text.Length != 0 && ObjName.Count != 0) { //未完成 //予定機能は対象名の重複データをチェックする //DuplicateChecking(); } #region PointDefine Route if (pointDef_flg) { if (Regex.Split(objAnalysisData, @"\|", RegexOptions.IgnoreCase)[0].ToLower() == "var") { string[] temp = Regex.Split(ObjCommand[ObjCommand.Count - 1].ToString(), @"\|", RegexOptions.IgnoreCase); //Data Remove ObjName.RemoveAt(ObjName.Count - 1); ObjCommand.RemoveAt(ObjCommand.Count - 1); ObjAnalysis.RemoveAt(ObjAnalysis.Count - 1); //New Data Append ObjName.Add(temp[1]); ObjCommand.Add("Point|(|0|,|0|)"); ObjAnalysis.Add("Point|Lparen|IntNum|Comma|IntNum|Rparen"); //データ監視器 Rewirte this.dataGridView_monitor.Rows[dataGridView_index].Cells[0].Value = temp[1]; this.dataGridView_monitor.Rows[dataGridView_index].Cells[1].Value = "point(0,0)"; this.dataGridView_monitor.Rows[dataGridView_index].Cells[2].Value = "Point|Lparen|IntNum|Comma|IntNum|Rparen"; } } #endregion #region PointGet Route if (pointGet_flg) { //get P on obj1 //objCommandData "get|p|on|obj1|" //objAnalysisData "Get|Ident|On|Ident|" objCommandData = objCommandData.Substring(0, objCommandData.Length - 1); objAnalysisData = objAnalysisData.Substring(0, objAnalysisData.Length - 1); if (Regex.Split(objAnalysisData, @"\|", RegexOptions.IgnoreCase).Count() == 4) { GetPointOnObject(objCommandData, objAnalysisData); } else { //Error LogOutput("Error @FormulaAnalysis PointGet Route"); tobeRead.SpeakAsync("入力ミスが発生していた。"); } } #endregion #region The Solve Route if (pointSol_flg) { //solve c by contact(obj1,ojb2,p) //objCommandData "solve|c|by|contact|(|obj1|,|ojb2|,|p|)|" //objAnalysisData "Solve|Ident|Ident|Contact|Lparen|Ident|Comma|Ident|Comma|Ident|Rparen|" objCommandData = objCommandData.Substring(0, objCommandData.Length - 1); objAnalysisData = objAnalysisData.Substring(0, objAnalysisData.Length - 1); string[] tmpCommData = Regex.Split(objCommandData, @"\|", RegexOptions.IgnoreCase); string[] tmpAnaData = Regex.Split(objAnalysisData, @"\|", RegexOptions.IgnoreCase); int identCounter = 0; bool contact_flag = false; foreach (var temp in tmpAnaData) { if (temp == "Ident") { identCounter++; } if (temp == "Contact") { contact_flag = true; } } if (contact_flag == true && identCounter == 5) { TheSolveMode(objCommandData, tmpCommData, objAnalysisData, tmpAnaData); } } #endregion #region objPlus Route if (objPlus_flg) { //obj3=obj1+obj2 //objCommandData "obj3|=|obj1|+|obj2|" //objAnalysisData "Ident|Plus|Ident|" objCommandData = objCommandData.Substring(0, objCommandData.Length - 1); objAnalysisData = objAnalysisData.Substring(0, objAnalysisData.Length - 1); AssignRemover(ref objCommandData); string[] tmpCommData = Regex.Split(objCommandData, @"\|", RegexOptions.IgnoreCase); string[] tmpAnaData = Regex.Split(objAnalysisData, @"\|", RegexOptions.IgnoreCase); if (objAnalysisData != "Ident|Plus|Ident") { //Error Route return; } for (int i = 0; i < tmpAnaData.Length; i++) { if (tmpAnaData[i] == "Ident") { if (ObjectFinder(tmpCommData[i]) == -1) { tobeRead.SpeakAsync(ObjectFinder(tmpCommData[i]) + "対象は定義されていません!"); codeOutput(ObjectFinder(tmpCommData[i]) + "対象は定義されていません!"); } } } } #endregion #region Rotation Route if (rotation_flg) { //rotation -30 //objCommandData "rotation|(|obj1|,|30|)|" //objAnalysisData "Rotation|Lparen|Ident|Comma|IntNum|Rparen|" objCommandData = objCommandData.Substring(0, objCommandData.Length - 1); objAnalysisData = objAnalysisData.Substring(0, objAnalysisData.Length - 1); Rotation(objCommandData, objAnalysisData); } #endregion #region setPoint Route if (setPoint_flg) { //obj1:setpoint(LEFT,obj2,Right,10,0) //objCommandData "obj1|:|setpoint|(|LEFT|,|obj2|,|Right|,|10|,|0|)|" //objAnalysisData "Ident|Colon|SetPoint|Lparen|Left|Comma|Ident|Comma|Right|Comma|IntNum|Comma|IntNum|Rparen|" objCommandData = objCommandData.Substring(0, objCommandData.Length - 1); objAnalysisData = objAnalysisData.Substring(0, objAnalysisData.Length - 1); LogOutput("objCommandData " + objCommandData); LogOutput("objAnalysisData " + objAnalysisData); TheSetPointMode(objCommandData, objAnalysisData); } #endregion #region Clear Route if (clear_flg) { LogOutput("clear_flg" + clear_flg); graphObj.Dispose(); debug_Image.Dispose(); graphObj = PreparePaper(); picBox.Image = (Image)debug_Image; picBox.Refresh(); ObjDisplayed.Clear(); DotDataInitialization(ref forDisDots); DotDataInitialization(ref allDotData); Dv2Instance.SetDots(forDisDots, BlinkInterval); if (!ROTATIONFLAG) { LogOutput("ROTATIONFLAG is " + ROTATIONFLAG); debug_Image.RotateFlip(RotateFlipType.RotateNoneFlipY); picBox.Refresh(); ROTATIONFLAG = true; } } if (cleartar_flg) { //clear objA //objCommandData clear|objA //objAnalysisData Clear|Ident objCommandData = objCommandData.Substring(0, objCommandData.Length - 1); objAnalysisData = objAnalysisData.Substring(0, objAnalysisData.Length - 1); LogOutput("objCommandData " + objCommandData); LogOutput("objAnalysisData " + objAnalysisData); if (ObjDisplayed.Count == 1 || ObjDisplayed.Count == 0) { graphObj.Dispose(); debug_Image.Dispose(); graphObj = PreparePaper(); picBox.Image = (Image)debug_Image; picBox.Refresh(); ObjDisplayed.Clear(); DotDataInitialization(ref forDisDots); DotDataInitialization(ref allDotData); Dv2Instance.SetDots(forDisDots, BlinkInterval); } else { //Processing if (!ClearTargetAndCheck(objCommandData, objAnalysisData)) { //処理失敗の流れ } } } #endregion LogOutput("---------------------------------------------"); LogOutput("Formula Analysis End at -> ******* " + System.DateTime.Now + " *******"); if (ROTATIONFLAG) { LogOutput("ROTATIONFLAG is " + ROTATIONFLAG); debug_Image.RotateFlip(RotateFlipType.RotateNoneFlipY); ROTATIONFLAG = false; } }
/// <summary> /// DV-2のボタンを動作イベント関数 /// このイベントを宣言すると,DV-2のボタンが押された時に,処理できる /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Dv2KeyEventHandle(object sender, DV.KeyEventArgs e) { bool moved_flg = false; //for the test int objFinder_index = 0; tobeRead.SpeakAsyncCancelAll(); #region Debug if (false) { codeOutput("************************************************"); codeOutput("Shift -+-> " + e.Shift); codeOutput("Kind -+-> " + e.Kind); codeOutput("Value -+-> " + e.Value); } #endregion //DotViewの何かのキーが押された時の処理 #region フロントキー処理 // ***************フロントキー処理*************** if (e.Shift == 128 && e.Kind == 0 && e.Value == 0) { //親指キー tobeRead.SpeakAsync("親指キー"); int cir_x = 24 + movement.X; int cir_y = 16 + movement.Y; ObjName.Add("obj11"); ObjCommand.Add("obj11|=|circle|(|" + cir_x + "|,|" + cir_y + "|,|15|)"); ObjAnalysis.Add("Circle|Lparen|IntNum|Comma|IntNum|Comma|IntNum|Rparen"); objFinder_index = ObjectFinder("obj11"); ParameterChecker(ObjAnalysis[objFinder_index], objFinder_index); MakeObjectBraille(); } if (e.Shift == 64 && e.Kind == 0 && e.Value == 0) { //ステータスキー tobeRead.SpeakAsync("ステータスキー"); } if (e.Shift == 0 && e.Kind == 4 && e.Value == 16) { //拡大キー tobeRead.SpeakAsync("拡大キー"); } if (e.Shift == 0 && e.Kind == 4 && e.Value == 128) { //縮小キー tobeRead.SpeakAsync("縮小キー"); } if (e.Shift == 0 && e.Kind == 5 && e.Value == 8) { //方向レバー 上 //tobeRead.SpeakAsync("方向レバー 上"); movement.Y -= 1; moved_flg = true; if (movement.Y < 0) { movement.Y = 0; moved_flg = false; } } if (e.Shift == 0 && e.Kind == 5 && e.Value == 4) { //方向レバー 下 //tobeRead.SpeakAsync("方向レバー 下"); movement.Y += 1; moved_flg = true; if (movement.Y + 0 > picBox.Height) { movement.Y = picBox.Height - 0; moved_flg = false; } } if (e.Shift == 0 && e.Kind == 5 && e.Value == 16) { //方向レバー 左 //tobeRead.SpeakAsync("方向レバー 左"); movement.X -= 1; moved_flg = true; if (movement.X < 0) { movement.X = 0; moved_flg = false; } } if (e.Shift == 0 && e.Kind == 5 && e.Value == 2) { //方向レバー 右 //tobeRead.SpeakAsync("方向レバー 右"); movement.X += 1; moved_flg = true; if (movement.X + 0 > picBox.Width) { movement.X = picBox.Width - 0; moved_flg = false; } } if (e.Shift == 16 && e.Kind == 0 && e.Value == 0) { //方向レバー 中心 tobeRead.SpeakAsync("方向レバー 中心"); } #endregion #region サイドキー処理 // ***************サイドキー処理*************** if (e.Shift == 0 && e.Kind == 4 && e.Value == 1) { //上矢印キー tobeRead.SpeakAsync("上矢印キー"); } if (e.Shift == 0 && e.Kind == 4 && e.Value == 2) { //下矢印キー tobeRead.SpeakAsync("下矢印キー"); } if (e.Shift == 0 && e.Kind == 4 && e.Value == 8) { //左矢印キー tobeRead.SpeakAsync("左矢印キー"); } if (e.Shift == 0 && e.Kind == 4 && e.Value == 4) { //右矢印キー tobeRead.SpeakAsync("右矢印キー"); } if (e.Shift == 32 && e.Kind == 0 && e.Value == 0) { //センターキー tobeRead.SpeakAsync("センターキー"); } if (e.Shift == 0 && e.Kind == 4 && e.Value == 64) { //エンドキー tobeRead.SpeakAsync("エンドキー"); } if (e.Shift == 0 && e.Kind == 4 && e.Value == 32) { //ホームキー tobeRead.SpeakAsync("ホームキー"); } #endregion // *************** 移動処理 *************** if (moved_flg) { DotDataInitialization(ref forDisDots); for (int width = 0; width < 48; width++) { for (int height = 0; height < 32; height++) { #region for Test /* * if (movement.X + width >= picBox.Width) * { * movement.X = picBox.Width - width; * } * * if (movement.Y + height >= picBox.Height) * { * movement.Y = picBox.Height - height; * } */ #endregion forDisDots[width, height] = allDotData[movement.X + width, movement.Y + height]; } } Dv2Instance.SetDots(forDisDots, BlinkInterval); label_posX.Text = movement.X.ToString(); label_posY.Text = movement.Y.ToString(); } }