public bool postEntry(string user, string ip, string domain, string procID, string mac, string version, string project) { string formUrl = "https://docs.google.com/forms/d/e/1FAIpQLSd8JS4niI317jqmTXm-LtkgFbgDmFSJ1N1LI7njDTUyKaZz2Q/formResponse"; HttpWebRequest request = (HttpWebRequest)WebRequest.Create(formUrl); Dictionary <string, string> fieldValues = new Dictionary <string, string>(); fieldValues.Add("entry_1385243592", user); fieldValues.Add("entry_2102627521", ip); fieldValues.Add("entry_1599095637", domain); fieldValues.Add("entry_1237369755", procID); fieldValues.Add("entry_571267387", mac); fieldValues.Add("entry_1943528130", version); fieldValues.Add("entry_107462746", project); List <string> postData = new List <string>(); foreach (string key in fieldValues.Keys) { postData.Add(key + "=" + fieldValues[key]); } byte[] data = Encoding.ASCII.GetBytes(TypesHelper.Join(postData, "&")); request.Method = "POST"; request.ContentType = "application/x-www-form-urlencoded"; request.ContentLength = data.Length; try { using (Stream stream = request.GetRequestStream()) { stream.Write(data, 0, data.Length); } WebResponse response = null; int tries = 3; for (int i = tries; i > 0; i--) { try { response = (HttpWebResponse)request.GetResponse(); break; } catch { } } if (response != null) { string responseString = new StreamReader(response.GetResponseStream()).ReadToEnd(); } return(true); } catch {} return(false); }
private void setsSNTV_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e) { TreeNode node = e.Node; List <string> sel = Handler.GetSelectSet(node.FullPath); if (sel.Count > 0) { Handler.Error(TypesHelper.Join(sel)); Handler.SetSelection(sel); } }
private void BrowseBT_Click(object sender, EventArgs e) { if (_fileMode) { if (openFileDialog1.ShowDialog() == DialogResult.OK) { if (_addMode) { List <string> oldTexts = GetPaths(); if (!oldTexts.Contains(openFileDialog1.FileName)) { oldTexts.Add(openFileDialog1.FileName); } Text = TypesHelper.Join(oldTexts, ";"); } else { Text = openFileDialog1.FileName; } } } else { if (folderBrowserDialog1.ShowDialog() == DialogResult.OK) { if (_addMode) { List <string> oldTexts = GetPaths(); if (!oldTexts.Contains(folderBrowserDialog1.SelectedPath)) { oldTexts.Add(openFileDialog1.FileName); } Text = TypesHelper.Join(oldTexts, ";"); } else { Text = folderBrowserDialog1.SelectedPath; } } } }
private void ComparisonsDGV_MouseUp(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Right) { System.Windows.Forms.DataGridView.HitTestInfo hit = ComparisonsDGV.HitTest(e.X, e.Y); if (hit.Type == DataGridViewHitTestType.Cell && hit.ColumnIndex != _left.Entities[0].Properties.Count) { DataGridViewCell cell = ComparisonsDGV.Rows[hit.RowIndex].Cells[hit.ColumnIndex]; associateWithToolStripMenuItem.DropDownItems.Clear(); removeAssociationWithToolStripMenuItem.DropDownItems.Clear(); transferToolStripMenuItem.DropDownItems.Clear(); bool left = hit.ColumnIndex < _left.Entities[0].Properties.Count; _currentEntity = _comp.GetEntity((string)ComparisonsDGV.Rows[hit.RowIndex].Cells[left ? 0 : _left.Entities[0].Properties.Count + 1].Value, left); if (_currentEntity == null) { return; } List <string> entitiesList = new List <string>(); _currentEntities = new List <DataEntity>() { _currentEntity }; string currentProperty = _left.Entities[0].Properties[left ? hit.ColumnIndex : (hit.ColumnIndex - 1 - _left.Entities[0].Properties.Count)].Name; _currentProperties = new List <string>() { currentProperty }; entitiesList.Add((string)_currentEntity.Properties[0].Value); foreach (DataGridViewCell curCell in ComparisonsDGV.SelectedCells) { if ((left && curCell.ColumnIndex < _left.Entities[0].Properties.Count) || (!left && curCell.ColumnIndex > _left.Entities[0].Properties.Count)) { DataEntity entity = _comp.GetEntity((string)ComparisonsDGV.Rows[curCell.RowIndex].Cells[left ? 0 : _left.Entities[0].Properties.Count + 1].Value, left); if (!_currentEntities.Contains(entity)) { _currentEntities.Add(entity); entitiesList.Add((string)entity.Properties[0].Value); } string propName = _left.Entities[0].Properties[left ? curCell.ColumnIndex : (curCell.ColumnIndex - 1 - _left.Entities[0].Properties.Count)].Name; if (!_currentProperties.Contains(propName)) { _currentProperties.Add(propName); } } } Logger.Log(TypesHelper.Join(entitiesList) + " " + TypesHelper.Join(_currentProperties), LogSeverities.Info); string[] confirmedAssocs = _comp.GetConfirmedAssociations(_currentEntity.Id, left); foreach (string assoc in confirmedAssocs) { removeAssociationWithToolStripMenuItem.DropDownItems.Add(assoc, null, new EventHandler(DeAssociate_OnClick)); } string[] assocs = _comp.GetPossibleAssociations(_currentEntity.Id, left); foreach (string assoc in assocs) { associateWithToolStripMenuItem.DropDownItems.Add(assoc, null, new EventHandler(Associate_OnClick)); } dontAssociateToolStripMenuItem.Checked = _currentEntity.DontAssociate; toolStripMenuItem1.Visible = false; transferToolStripMenuItem.Visible = false; DataEntity currentAssociatedEntity = _currentEntity.AssociatedEntity; if (currentAssociatedEntity != null) { string[] transferables = _comp.GetTransferables(_currentEntity); if (transferables.Length > 0) { bool canTransfer = false; if (ArrayContains(transferables, currentProperty) && _comp.Comparisons[_currentEntity][currentAssociatedEntity][currentProperty] < 1.0) { transferToolStripMenuItem.DropDownItems.Add(currentProperty, null, new EventHandler(Transfer_OnClick)); transferToolStripMenuItem.DropDownItems.Add("-", null, null); transferToolStripMenuItem.DropDownItems.Add("All sel. props (" + TypesHelper.Join(_currentProperties) + ")", null, new EventHandler(Transfer_OnClick)); transferToolStripMenuItem.DropDownItems.Add("-", null, null); transferToolStripMenuItem.DropDownItems.Add("All", null, new EventHandler(TransferAll_OnClick)); canTransfer = true; } else { foreach (string transferable in transferables) { foreach (DataEntity currentEntity in _currentEntities) { if (_comp.Comparisons[currentEntity][currentEntity.AssociatedEntity][transferable] < 1.0) { transferToolStripMenuItem.DropDownItems.Add("All sel. props (" + TypesHelper.Join(_currentProperties) + ")", null, new EventHandler(Transfer_OnClick)); transferToolStripMenuItem.DropDownItems.Add("-", null, null); transferToolStripMenuItem.DropDownItems.Add("All", null, new EventHandler(TransferAll_OnClick)); canTransfer = true; break; } } if (canTransfer) { break; } } } if (canTransfer) { toolStripMenuItem1.Visible = true; transferToolStripMenuItem.Visible = true; } } } comparisonCtxt.Show(ComparisonsDGV.PointToScreen(new Point(e.X, e.Y))); } } }
public void SaveCsv(string inPath) { StringBuilder csv = new StringBuilder(); csv.Append("Cmd;Start;Duration\n"); foreach (TracedCall call in _callStack) { csv.Append(string.Format("{0};{1};{2:0.000};{3};{4}\n", call.Name, call.Start, call.Duration.TotalSeconds, TypesHelper.Join(call.Result as object[], "|"), call.Info)); } File.WriteAllText(inPath, csv.ToString()); }
public override void ExecuteCommand(string p, params string[] args) { List <string> lArgs = new List <string>(args); TKMessageBox.ShowError("Ask to execute command '" + p + "', args : '" + TypesHelper.Join(lArgs) + "'", "ExecuteCommand called"); }