private void btnSendBugReport_Click(object sender, EventArgs e) { if (!string.IsNullOrEmpty(BugReportPath)) { ZAppHelper.LoadBrowserAsync(BugReportPath); } }
private void btnCopyAll_Click(object sender, EventArgs e) { string text = txtException.Text; if (!string.IsNullOrEmpty(text)) { ZAppHelper.CopyTextSafely(text); } }
public void LoadImage(string imagePath, string imageURL) { if (!string.IsNullOrEmpty(imagePath) && ZAppHelper.IsImageFile(imagePath) && File.Exists(imagePath)) { lblStatus.Text = "Loading local image..."; isLoadLocal = true; LoadImage(imagePath); } else if (!string.IsNullOrEmpty(imageURL) && ZAppHelper.IsImageFile(imageURL)) { lblStatus.Text = "Downloading image from URL..."; isLoadLocal = false; LoadImage(imageURL); } }
/// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { this.SuspendLayout(); this.BackColor = Color.White; this.BackgroundImage = screenshot; this.Bounds = ZAppHelper.GetScreenBounds(); this.Cursor = Cursors.Hand; this.DoubleBuffered = true; this.FormBorderStyle = FormBorderStyle.None; this.Text = "Image Viewer"; this.WindowState = FormWindowState.Maximized; this.Deactivate += new System.EventHandler(this.ShowScreenshot_Deactivate); this.Load += new System.EventHandler(this.ShowScreenshot_Load); this.Shown += new System.EventHandler(this.ShowScreenshot_Shown); this.Leave += new System.EventHandler(this.ShowScreenshot_Leave); this.MouseDown += new System.Windows.Forms.MouseEventHandler(this.ShowScreenshot_MouseDown); this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.ShowScreenshot_KeyDown); this.ResumeLayout(false); }
public string Convert(string pattern) { if (string.IsNullOrEmpty(pattern)) { return(string.Empty); } StringBuilder sb = new StringBuilder(pattern); #region Link, FileName, FileSize sb.Replace(ReplacementVariables.link.ToPrefixString(), Link); sb.Replace(ReplacementVariables.name.ToPrefixString(), FileName); sb.Replace(ReplacementVariables.size.ToPrefixString(), FileSize); #endregion Link, FileName, FileSize #region width, height (If Picture exist) string width = string.Empty, height = string.Empty; if (Picture != null) { width = Picture.Width.ToString(); height = Picture.Height.ToString(); } sb.Replace(ReplacementVariables.width.ToPrefixString(), width); sb.Replace(ReplacementVariables.height.ToPrefixString(), height); #endregion width, height (If Picture exist) #region t (If ActiveWindow or Watermark) if (Type == NameParserType.ActiveWindow || Type == NameParserType.Watermark || Type == NameParserType.Clipboard) { sb.Replace(ReplacementVariables.t.ToPrefixString(), WindowText); } #endregion t (If ActiveWindow or Watermark) #region host (If Host exist "FTP") if (!string.IsNullOrEmpty(Host)) { sb.Replace("%host", Host); } #endregion host (If Host exist "FTP") #region y, mo, mon, mon2, d DateTime dt; if (CustomDate != DateTime.MinValue) { dt = CustomDate; } else { dt = FastDateTime.Now; } sb.Replace(ReplacementVariables.mon2.ToPrefixString(), CultureInfo.InvariantCulture.DateTimeFormat.GetMonthName(dt.Month)) .Replace(ReplacementVariables.mon.ToPrefixString(), CultureInfo.CurrentCulture.DateTimeFormat.GetMonthName(dt.Month)) .Replace(ReplacementVariables.y.ToPrefixString(), dt.Year.ToString()) .Replace(ReplacementVariables.mo.ToPrefixString(), ZAppHelper.AddZeroes(dt.Month)) .Replace(ReplacementVariables.d.ToPrefixString(), ZAppHelper.AddZeroes(dt.Day)); #endregion y, mo, mon, mon2, d #region h, mi, s, ms, w, w2, pm, i (If not SaveFolder) if (Type != NameParserType.SaveFolder) { string hour; if (sb.ToString().Contains(ReplacementVariables.pm.ToPrefixString())) { hour = ZAppHelper.HourTo12(dt.Hour); } else { hour = ZAppHelper.AddZeroes(dt.Hour); } sb.Replace(ReplacementVariables.h.ToPrefixString(), hour) .Replace(ReplacementVariables.mi.ToPrefixString(), ZAppHelper.AddZeroes(dt.Minute)) .Replace(ReplacementVariables.s.ToPrefixString(), ZAppHelper.AddZeroes(dt.Second)) .Replace(ReplacementVariables.ms.ToPrefixString(), ZAppHelper.AddZeroes(dt.Millisecond, 3)) .Replace(ReplacementVariables.w2.ToPrefixString(), CultureInfo.InvariantCulture.DateTimeFormat.GetDayName(dt.DayOfWeek)) .Replace(ReplacementVariables.w.ToPrefixString(), CultureInfo.CurrentCulture.DateTimeFormat.GetDayName(dt.DayOfWeek)) .Replace(ReplacementVariables.pm.ToPrefixString(), (dt.Hour >= 12 ? "PM" : "AM")); if (!IsPreview && sb.ToString().Contains("%i")) { AutoIncrementNumber++; } sb.Replace(ReplacementVariables.i.ToPrefixString(), ZAppHelper.AddZeroes(AutoIncrementNumber, 4)); } #endregion h, mi, s, ms, w, w2, pm, i (If not SaveFolder) #region un, uln, cn, app, ver, n sb.Replace(ReplacementVariables.un.ToPrefixString(), Environment.UserName); sb.Replace(ReplacementVariables.uln.ToPrefixString(), Environment.UserDomainName); sb.Replace(ReplacementVariables.cn.ToPrefixString(), Environment.MachineName); string productName = string.IsNullOrEmpty(CustomProductName) ? Application.ProductName : CustomProductName; sb.Replace(ReplacementVariables.app.ToPrefixString(), productName); sb.Replace(ReplacementVariables.ver.ToPrefixString(), Application.ProductVersion); if (Type == NameParserType.Watermark) { sb.Replace(ReplacementVariables.n.ToPrefixString(), "\n"); } #endregion un, uln, cn, app, ver, n #region rn, ra string result = sb.ToString(); string rn = ReplacementVariables.rn.ToPrefixString(); while (result.ReplaceFirst(rn, ZAppHelper.GetRandomChar(ZAppHelper.Numbers).ToString(), out result)) { ; } string ra = ReplacementVariables.ra.ToPrefixString(); while (result.ReplaceFirst(ra, ZAppHelper.GetRandomChar(ZAppHelper.Alphanumeric).ToString(), out result)) { ; } #endregion rn, ra if (Type != NameParserType.Watermark & Type != NameParserType.Clipboard) { result = ZAppHelper.NormalizeString(result, Type != NameParserType.SaveFolder, IsFolderPath); } if (MaxNameLength > 0 && (Type == NameParserType.ActiveWindow || Type == NameParserType.EntireScreen) && result.Length > MaxNameLength) { result = result.Substring(0, MaxNameLength); } return(result); }