public viewer(entryViewerLink enl) { InitializeComponent(); this.showing = enl.showing; this.threadCount = enl.threadCount; this.setCamData = enl.cdat; this.imgdir = enl.imgdir; this.outdir = enl.outdir; this.console = enl.console; this.ipTag = enl.ipTag; this.style = enl.style; this.luc = enl.luc; this.normalising = enl.normaliseImage; this.setAR = enl.setAR; this.ipAddrs = enl.ips; this.timestamp = enl.timestamp; this.anonFileNames = enl.anonFileNames; }
public Bitmap generateStamp(string ip, string userpass, Font font, int imgWidth, bool timestamp, ipStyle style = ipStyle.fancy) { canvas = new Bitmap(1, 1); Graphics g = Graphics.FromImage(canvas); SizeF _ipSize = g.MeasureString(ip, font); SizeF _upSize = g.MeasureString(userpass, font); int setWidth = 0; if (_ipSize.Width > _upSize.Width) { setWidth = (int)_ipSize.Width; } else { setWidth = (int)_upSize.Width; } //leave space for a 2px buffer setWidth = setWidth + 12; int setHeight = (int)_ipSize.Height + (int)_upSize.Height + 12; canvas.Dispose(); g.Dispose(); if (style == ipStyle.fancy) { canvas = new Bitmap(setWidth, setHeight); g = Graphics.FromImage(canvas); Color midGray = Color.FromArgb(128, 128, 128); Color vDarkGray = Color.FromArgb(64, 64, 64); Pen FourPxBlack = new Pen(Brushes.Black, 8); Pen TwoPxLGray = new Pen(midGray, 4); Pen OnePxVDarkGray = new Pen(vDarkGray, 2); g.FillRectangle(Brushes.LightGray, 0, 0, setWidth, setHeight); g.DrawRectangle(FourPxBlack, 2, 2, setWidth - 4, setHeight - 4); g.DrawRectangle(TwoPxLGray, 1, 1, setWidth - 2, setHeight - 2); g.DrawLine(OnePxVDarkGray, 1, 1, 1, setHeight); g.DrawLine(OnePxVDarkGray, 2, 2, 2, setHeight); g.DrawLine(OnePxVDarkGray, 0, setHeight - 1, setWidth - 2, setHeight - 1); g.DrawLine(OnePxVDarkGray, 0, setHeight - 2, setWidth - 3, setHeight - 2); g.DrawString(ip, font, Brushes.Black, 4, 6); g.DrawString(userpass, font, Brushes.Black, 4, 6 + (int)_ipSize.Height); } if (style == ipStyle.basic) { canvas = new Bitmap(setWidth, setHeight); g = Graphics.FromImage(canvas); Color midGray = Color.FromArgb(128, 128, 128); SolidBrush mGrayBrush = new SolidBrush(midGray); g.FillRectangle(mGrayBrush, 0, 0, setWidth, setHeight); g.DrawString(ip, font, Brushes.Black, 4, 6); g.DrawString(userpass, font, Brushes.Black, 4, 6 + (int)_ipSize.Height); } if (style == ipStyle.barBottom || style == ipStyle.barTop) { canvas = new Bitmap(imgWidth, (setHeight / 2) - 4); g = Graphics.FromImage(canvas); g.FillRectangle(Brushes.Black, 0, 0, canvas.Width, canvas.Height); string combo = ip + " | " + userpass; g.DrawString(combo, font, Brushes.White, 1, 1); string time = ""; if (timestamp) { time = DateTime.Now.ToString(); } SizeF timeSize = g.MeasureString(time, font); g.DrawString(time, font, Brushes.White, canvas.Width - (int)timeSize.Width - 2, 1); } g.Dispose(); return(canvas); }
private void rbBasic_CheckedChanged(object sender, EventArgs e) { setStyle = ipStyle.basic; cbTime.Checked = false; }
private void rbBarBottom_CheckedChanged(object sender, EventArgs e) { setStyle = ipStyle.barBottom; cbTime.Enabled = rbBarBottom.Checked; }
private void rbFancy_CheckedChanged(object sender, EventArgs e) { setStyle = ipStyle.fancy; cbTime.Checked = false; }