private void ErrorDetailsMenu_Click(object sender, RoutedEventArgs e) { NetworkTrace trace = FileView.SelectedItem as NetworkTrace; if (trace != null) { TextDetails td = new TextDetails(trace.FileName, trace.Exceptions); td.Show(); } }
public override bool Equals(object obj) { TextDetails td = obj as TextDetails; if (td == null) { return(false); } return(_text == td._text && _font.Equals(td._font) && _width == td._width); }
protected void AddToDatabase_Click(object sender, EventArgs e) { ServiceReference1.Encrypt_DecryptService1Client sc = new ServiceReference1.Encrypt_DecryptService1Client("BasicHttpBinding_IEncrypt_DecryptService1"); TextDetails td = new TextDetails(); td.Plaintext = TextBox1.Text; td.Encryptedtext = Label3.Text; td.Decryptedtext = Label5.Text; sc.AddData(td); Label6.Text = "Details Added Successfully!!!!"; }
public static Size MeasureString(Graphics g, string text, Font font, int width) { Size size; TextDetails td = new TextDetails(text, font, width); if (_mapTextSizes.TryGetValue(td, out size)) { return(size); } IntPtr hDC = g.GetHdc(); try { IntPtr hFont = font.ToHfont(); try { IntPtr hOldFont = Gdi.SelectObject(hDC, hFont); try { Rectangle rect = new Rectangle(0, 0, width, 0); RECT r = new RECT(rect); User.DrawTextFlags uFormat = User.DrawTextFlags.DT_WORDBREAK | User.DrawTextFlags.DT_CALCRECT; User.DrawText(hDC, text, text.Length, ref r, uFormat); size = new Size(r.Right, r.Bottom); _mapTextSizes[td] = size; return(size); } finally { Gdi.SelectObject(hDC, hOldFont); } } finally { Gdi.DeleteObject(hFont); } } finally { g.ReleaseHdc(hDC); } }
public TextDetails Get(string id) { Console.WriteLine($"Get text details for id: {id}"); TextDetails result = new TextDetails(); result.Id = id; Redis.Instance.SetDatabase(Redis.Instance.CalculateDatabase(id)); if (!Redis.Instance.Database.KeyExists($"{ConstantLibrary.Redis.Prefix.Text}{id}")) { result.Status = "Invalid text id"; } result.Status = Redis.Instance.Database.StringGet($"{ConstantLibrary.Redis.Prefix.Status}{id}"); result.Rank = Redis.Instance.Database.StringGet($"{ConstantLibrary.Redis.Prefix.Rank}{id}"); Console.WriteLine($"'{ConstantLibrary.Redis.Prefix.Rank}{id}: {result.Rank}' from redis database({Redis.Instance.Database.Database})"); return(result); }
private void StatsMenu_Click(object sender, RoutedEventArgs e) { double pps = GlobalStats.PacketCount / (GlobalStats.LoadTime.TotalMilliseconds / 1000); StringBuilder output = new StringBuilder(); output.AppendLine("Files: " + GlobalStats.FileCount); output.AppendLine("Packets: " + GlobalStats.PacketCount); output.AppendLine("Parsed Trace Time: " + GlobalStats.LoadTime); output.AppendLine("Packets per Sec: " + pps); output.AppendLine("Messages: " + GlobalStats.MessageCount); output.AppendLine("Message Type Counts"); foreach (var item in GlobalStats.MessageTypeCounter) { output.AppendLine(String.Format(" {1} : 0x{2:X}/{0}", item.Key, item.Value, (int)item.Key)); } TextDetails td = new TextDetails("Global Stats", output.ToString()); td.Show(); }
public async Task <IActionResult> TextDetails(TextDetails textDetails) { TextDetails result = null; if (textDetails.Id != null) { uint retries = 0; while (result == null && retries != 5) { result = await TryToGetTextDetails(textDetails.Id); if (result == null) { ++retries; System.Threading.Thread.Sleep(2000); } } } return(View(result)); }
protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e) { ServiceReference1.Encrypt_DecryptService1Client sc = new ServiceReference1.Encrypt_DecryptService1Client("BasicHttpBinding_IEncrypt_DecryptService1"); int ID = (int)e.Keys["Id"]; TextDetails td = new TextDetails(); string plainText = (string)e.NewValues["plaintext"]; string encryptedText = (string)e.NewValues["encryptedtext"]; string decryptedText = (string)e.NewValues["decryptedtext"]; td.ID = ID; string encrypt = sc.Encryption(plainText); string decrypt = sc.Decryption(encrypt); td.Plaintext = plainText; td.Encryptedtext = encrypt; td.Decryptedtext = decrypt; sc.UpdateTextDetail(td); Label1.Text = "Data Updated Successfully!!!"; GridView1.EditIndex = -1; BindData(); }
public async Task <IActionResult> Index(FormModel formModel) { if (formModel.Data != null) { string id; string url = "http://127.0.0.1:5050/api/values"; StringContent stringContent = new StringContent($"{{ \"data\": \"{formModel.Data}\"}}", Encoding.UTF8, "application/json"); using (HttpClient httpClient = new HttpClient()) { httpClient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("text/plain")); using (HttpResponseMessage response = await httpClient.PostAsync(url, stringContent)) using (HttpContent content = response.Content) { id = content.ReadAsStringAsync().Result; } } TextDetails textDetails = new TextDetails(); textDetails.Id = id; return(RedirectToAction("TextDetails", "Home", textDetails)); } return(View(formModel)); }
public static Size MeasureString( Graphics g, string text, Font font, int width ) { Size size; TextDetails td = new TextDetails( text, font, width ); if( _mapTextSizes.TryGetValue( td, out size ) ) { return size; } IntPtr hDC = g.GetHdc(); try { IntPtr hFont = font.ToHfont(); try { IntPtr hOldFont = Gdi.SelectObject( hDC, hFont ); try { Rectangle rect = new Rectangle( 0, 0, width, 0 ); Utility.Win32.Common.RECT r = new Utility.Win32.Common.RECT( rect ); Utility.Win32.User.DrawTextFlags uFormat = Utility.Win32.User.DrawTextFlags.DT_WORDBREAK | Utility.Win32.User.DrawTextFlags.DT_CALCRECT; Utility.Win32.User.DrawText( hDC, text, text.Length, ref r, uFormat ); size = new Size( r.Right, r.Bottom ); _mapTextSizes[td] = size; return size; } finally { Gdi.SelectObject( hDC, hOldFont ); } } finally { Gdi.DeleteObject( hFont ); } } finally { g.ReleaseHdc( hDC ); } }