Dataset Viewer
Auto-converted to Parquet Duplicate
code
stringlengths
1
2.08M
repo_name
stringlengths
1
35
path
stringlengths
4
221
language
stringclasses
66 values
license
stringclasses
17 values
size
int64
1
2.08M
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; using System.Text.RegularExpressions; namespace FIS.iDET.Keygen { public partial class KeygenForm : Form { const string notValid = "(Machine ID not valid)"; public KeygenForm() { InitializeComponent(); } private void machineIDTextBox_TextChanged(object sender, EventArgs e) { // check if machine ID is valid string machineID = machineIDTextBox.Text.Trim().ToUpper(); Match match = Regex.Match( machineID, @"[A-F0-9]{4}-[A-F0-9]{4}-[A-F0-9]{4}-[A-F0-9]{4}-[A-F0-9]{4}-[A-F0-9]{4}-[A-F0-9]{4}-[A-F0-9]{4}" ); if (match.Success) serialTextBox.Text = LicenseService.GenarateSerialNumberFrom(machineID); else if (serialTextBox.Text != notValid) serialTextBox.Text = notValid; } private void serialTextBox_Click(object sender, EventArgs e) { serialTextBox.SelectAll(); } } }
2atgroup
TiffBrowserTestCSharp/Keygen/KeygenForm.cs
C#
Microsoft Reciprocal License (Ms-RL)
1,259
namespace FIS.iDET.Keygen { partial class KeygenForm { /// <summary> /// Required designer variable. /// </summary> private System.ComponentModel.IContainer components = null; /// <summary> /// Clean up any resources being used. /// </summary> /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param> protected override void Dispose(bool disposing) { if (disposing && (components != null)) { components.Dispose(); } base.Dispose(disposing); } #region Windows Form Designer generated code /// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(KeygenForm)); this.machineIDLabel = new System.Windows.Forms.Label(); this.serialLabel = new System.Windows.Forms.Label(); this.labelBackgroundMachineID = new System.Windows.Forms.Label(); this.machineIDTextBox = new System.Windows.Forms.TextBox(); this.labelBackgroundSerialNo = new System.Windows.Forms.Label(); this.serialTextBox = new System.Windows.Forms.TextBox(); this.SuspendLayout(); // // machineIDLabel // this.machineIDLabel.BackColor = System.Drawing.Color.Transparent; this.machineIDLabel.Font = new System.Drawing.Font("Arial", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.machineIDLabel.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(35)))), ((int)(((byte)(128)))), ((int)(((byte)(159))))); this.machineIDLabel.Location = new System.Drawing.Point(14, 37); this.machineIDLabel.Name = "machineIDLabel"; this.machineIDLabel.Size = new System.Drawing.Size(93, 23); this.machineIDLabel.TabIndex = 1; this.machineIDLabel.Text = "Machine ID"; this.machineIDLabel.TextAlign = System.Drawing.ContentAlignment.TopRight; // // serialLabel // this.serialLabel.BackColor = System.Drawing.Color.Transparent; this.serialLabel.Font = new System.Drawing.Font("Arial", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.serialLabel.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(144)))), ((int)(((byte)(6)))), ((int)(((byte)(157))))); this.serialLabel.Location = new System.Drawing.Point(14, 113); this.serialLabel.Name = "serialLabel"; this.serialLabel.Size = new System.Drawing.Size(93, 19); this.serialLabel.TabIndex = 3; this.serialLabel.Text = "Serial No"; this.serialLabel.TextAlign = System.Drawing.ContentAlignment.TopRight; // // labelBackgroundMachineID // this.labelBackgroundMachineID.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(53)))), ((int)(((byte)(144)))), ((int)(((byte)(174))))); this.labelBackgroundMachineID.Enabled = false; this.labelBackgroundMachineID.Location = new System.Drawing.Point(112, 27); this.labelBackgroundMachineID.Name = "labelBackgroundMachineID"; this.labelBackgroundMachineID.Size = new System.Drawing.Size(517, 35); this.labelBackgroundMachineID.TabIndex = 5; // // machineIDTextBox // this.machineIDTextBox.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(53)))), ((int)(((byte)(144)))), ((int)(((byte)(174))))); this.machineIDTextBox.BorderStyle = System.Windows.Forms.BorderStyle.None; this.machineIDTextBox.Font = new System.Drawing.Font("Arial", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.machineIDTextBox.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(211)))), ((int)(((byte)(237)))), ((int)(((byte)(246))))); this.machineIDTextBox.Location = new System.Drawing.Point(122, 33); this.machineIDTextBox.MaxLength = 39; this.machineIDTextBox.Name = "machineIDTextBox"; this.machineIDTextBox.Size = new System.Drawing.Size(496, 22); this.machineIDTextBox.TabIndex = 0; this.machineIDTextBox.TextChanged += new System.EventHandler(this.machineIDTextBox_TextChanged); // // labelBackgroundSerialNo // this.labelBackgroundSerialNo.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(124)))), ((int)(((byte)(38)))), ((int)(((byte)(133))))); this.labelBackgroundSerialNo.Enabled = false; this.labelBackgroundSerialNo.Location = new System.Drawing.Point(112, 103); this.labelBackgroundSerialNo.Name = "labelBackgroundSerialNo"; this.labelBackgroundSerialNo.Size = new System.Drawing.Size(516, 35); this.labelBackgroundSerialNo.TabIndex = 5; // // serialTextBox // this.serialTextBox.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(124)))), ((int)(((byte)(38)))), ((int)(((byte)(133))))); this.serialTextBox.BorderStyle = System.Windows.Forms.BorderStyle.None; this.serialTextBox.Font = new System.Drawing.Font("Arial", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.serialTextBox.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(243)))), ((int)(((byte)(206)))), ((int)(((byte)(246))))); this.serialTextBox.Location = new System.Drawing.Point(122, 109); this.serialTextBox.MaxLength = 39; this.serialTextBox.Name = "serialTextBox"; this.serialTextBox.Size = new System.Drawing.Size(496, 22); this.serialTextBox.TabIndex = 1; this.serialTextBox.Click += new System.EventHandler(this.serialTextBox_Click); // // KeygenForm // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(231)))), ((int)(((byte)(231)))), ((int)(((byte)(231))))); this.ClientSize = new System.Drawing.Size(647, 163); this.Controls.Add(this.serialTextBox); this.Controls.Add(this.machineIDTextBox); this.Controls.Add(this.labelBackgroundSerialNo); this.Controls.Add(this.labelBackgroundMachineID); this.Controls.Add(this.serialLabel); this.Controls.Add(this.machineIDLabel); this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); this.MaximizeBox = false; this.Name = "KeygenForm"; this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; this.Text = "Keygen for FIS iDET"; this.TopMost = true; this.ResumeLayout(false); this.PerformLayout(); } #endregion private System.Windows.Forms.Label machineIDLabel; private System.Windows.Forms.Label serialLabel; private System.Windows.Forms.Label labelBackgroundMachineID; private System.Windows.Forms.TextBox machineIDTextBox; private System.Windows.Forms.Label labelBackgroundSerialNo; private System.Windows.Forms.TextBox serialTextBox; } }
2atgroup
TiffBrowserTestCSharp/Keygen/KeygenForm.Designer.cs
C#
Microsoft Reciprocal License (Ms-RL)
8,209
using System; using System.Text; using System.Security.Cryptography; namespace FIS.iDET.Keygen { /// <summary> /// Calculate a serial number that matches a unique machine ID of a computer /// </summary> // Hoang add code ... public class LicenseService { public static string GenarateSerialNumberFrom(string machineID) { string serial = GetHash( "ID >> " + machineID + "Secret >> " + "aed45dba1f73080de226c193d3f9d605" ); return serial; } /// <summary> /// generate 16-byte hash of a string /// </summary> /// <param name="s">input string</param> /// <returns>16-byte hash string</returns> private static string GetHash(string s) { MD5 sec = new MD5CryptoServiceProvider(); ASCIIEncoding enc = new ASCIIEncoding(); byte[] bt = enc.GetBytes(s); return GetHexString(sec.ComputeHash(bt)); } /// <summary> /// intended to be used by GetHash() /// </summary> /// <param name="bt">input string</param> /// <returns>hex string</returns> private static string GetHexString(byte[] bt) { string s = string.Empty; for (int i = 0; i < bt.Length; i++) { byte b = bt[i]; int n, n1, n2; n = (int)b; n1 = n & 15; n2 = (n >> 4) & 15; if (n2 > 9) s += ((char)(n2 - 10 + (int)'A')).ToString(); else s += n2.ToString(); if (n1 > 9) s += ((char)(n1 - 10 + (int)'A')).ToString(); else s += n1.ToString(); if ((i + 1) != bt.Length && (i + 1) % 2 == 0) s += "-"; } return s; } } }
2atgroup
TiffBrowserTestCSharp/Keygen/LicenseService.cs
C#
Microsoft Reciprocal License (Ms-RL)
2,032
using System; using System.Collections.Generic; using System.Windows.Forms; namespace FIS.iDET.Keygen { static class Program { /// <summary> /// The main entry point for the application. /// </summary> [STAThread] static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new KeygenForm()); } } }
2atgroup
TiffBrowserTestCSharp/Keygen/Program.cs
C#
Microsoft Reciprocal License (Ms-RL)
492
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("FIS.iDET Keygen")] [assembly: AssemblyDescription("Keygen for FPT BPO Data Eentry Tool")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("FPT BPO. Developed by Revo21 Studio")] [assembly: AssemblyProduct("FIS.iDET Keygen")] [assembly: AssemblyCopyright("Copyright © 2012 by FPT BPO")] [assembly: AssemblyTrademark("FPT BPO")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("97300fa9-4f9d-4a34-af12-5cd332d0767f")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")]
2atgroup
TiffBrowserTestCSharp/Keygen/Properties/AssemblyInfo.cs
C#
Microsoft Reciprocal License (Ms-RL)
1,530
using System; using System.Drawing; namespace FIS.iDET.TemplateCreator { public class DataColumn { public DataColumn() { // set default values _width = 100; _type = DataTypeEnum.COLUMN_TYPE_TEXT; _header = "Untitled"; x = y = w = h = 0; } public DataColumn(string header) { // set default values _width = 100; _type = DataTypeEnum.COLUMN_TYPE_TEXT; _header = header; x = y = w = h = 0; } public DataColumn(string header, int type, int width, DoubleRectangle rect) { // set default values _width = width; _type = type; _header = header; x = rect.X; y = rect.Y; w = rect.Width; h = rect.Height; } private double x, y, w, h; public DataColumn(string header, int type, int width, double x, double y, double w, double h) { // set default values _width = width; _type = type; _header = header; this.x = x; this.y = y; this.w = w; this.h = h; } public DoubleRectangle Rect { get { return new DoubleRectangle(x, y, w, h); } set { x = value.X; y = value.Y; w = value.Width; h = value.Height; } } public double X { get { return x; } set { this.x = value; } } public double Y { get { return y; } set { this.y = value; } } public double W { get { return w; } set { this.w = value; } } public double H { get { return h; } set { this.h = value; } } private int _width; public int Width { get { return _width; } set { _width = value; } } private int _type; public int Type { get { return _type; } set { _type = value; } } private string _header; public string Header { get { return _header; } set { _header = value; } } } }
2atgroup
TiffBrowserTestCSharp/Template Creator/DataColumn.cs
C#
Microsoft Reciprocal License (Ms-RL)
2,632
using System; using System.Collections.Generic; using System.Text; namespace FIS.iDET.TemplateCreator { public static class DataTypeEnum { /* data type for datagridview column */ public const int COLUMN_TYPE_NUMBER = 0; public const int COLUMN_TYPE_DATE = 1; public const int COLUMN_TYPE_TEXT = 2; } }
2atgroup
TiffBrowserTestCSharp/Template Creator/DataTypeEnum.cs
C#
Microsoft Reciprocal License (Ms-RL)
364
using System; using System.Collections.Generic; using System.Text; namespace FIS.iDET.TemplateCreator { /*class DoublePoint { public double X=0, Y=0; public DoublePoint(double X, double Y) { this. } }*/ public class DoubleRectangle { public double X = 0, Y = 0, Width = 0, Height = 0; public DoubleRectangle(double x, double y, double width, double height) { this.X = x; this.Y = y; this.Width = width; this.Height = height; } public DoubleRectangle() { } } }
2atgroup
TiffBrowserTestCSharp/Template Creator/DoubleRectangle.cs
C#
Microsoft Reciprocal License (Ms-RL)
669
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; using System.Diagnostics; namespace FIS.iDET.TemplateCreator { public partial class FormAbout : Form { public FormAbout() { InitializeComponent(); } private void FormAbout_Load(object sender, EventArgs e) { LabelUserName.Text = GlobalConstants.Username; LabelProductID.Text = RegistryService.GetValue(GlobalConstants.REGISTRY_SERIAL_NUMBER_KEY); label1.Text = GlobalConstants.stringVersion; } private void buttonOK_Click(object sender, EventArgs e) { this.Close(); } private void FormAbout_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.R) { MessageBox.Show("Welcome to the developer world !"); Process.Start("http://revo21studio.com/"); } else if (e.KeyCode == Keys.I) { MessageBox.Show("There are still good men in this world!"); Process.Start("http://p.yusukekamiyamane.com/"); } } } }
2atgroup
TiffBrowserTestCSharp/Template Creator/FormAbout.cs
C#
Microsoft Reciprocal License (Ms-RL)
1,328
namespace FIS.iDET.TemplateCreator { partial class FormAbout { /// <summary> /// Required designer variable. /// </summary> private System.ComponentModel.IContainer components = null; /// <summary> /// Clean up any resources being used. /// </summary> /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param> protected override void Dispose(bool disposing) { if (disposing && (components != null)) { components.Dispose(); } base.Dispose(disposing); } #region Windows Form Designer generated code /// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FormAbout)); this.label1 = new System.Windows.Forms.Label(); this.label2 = new System.Windows.Forms.Label(); this.label6 = new System.Windows.Forms.Label(); this.label8 = new System.Windows.Forms.Label(); this.LabelUserName = new System.Windows.Forms.Label(); this.LabelProductID = new System.Windows.Forms.Label(); this.buttonOK = new System.Windows.Forms.Button(); this.label7 = new System.Windows.Forms.Label(); this.pictureBox2 = new System.Windows.Forms.PictureBox(); this.pictureBox1 = new System.Windows.Forms.PictureBox(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit(); this.SuspendLayout(); // // label1 // this.label1.AutoSize = true; this.label1.Font = new System.Drawing.Font("Arial", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.label1.ForeColor = System.Drawing.Color.SteelBlue; this.label1.Location = new System.Drawing.Point(168, 15); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(251, 22); this.label1.TabIndex = 2; this.label1.Text = "FIS Template Creator Tool"; // // label2 // this.label2.AutoSize = true; this.label2.Location = new System.Drawing.Point(169, 140); this.label2.Name = "label2"; this.label2.Size = new System.Drawing.Size(263, 45); this.label2.TabIndex = 2; this.label2.Text = "Copyright © 2012 by FPT Information System,\r\n " + " FPT BPO Services Center.\r\nAll rights reserved."; // // label6 // this.label6.AutoEllipsis = true; this.label6.ForeColor = System.Drawing.Color.Gray; this.label6.Location = new System.Drawing.Point(12, 217); this.label6.Name = "label6"; this.label6.Size = new System.Drawing.Size(377, 85); this.label6.TabIndex = 2; this.label6.Text = resources.GetString("label6.Text"); // // label8 // this.label8.AutoSize = true; this.label8.Location = new System.Drawing.Point(169, 67); this.label8.Name = "label8"; this.label8.Size = new System.Drawing.Size(154, 15); this.label8.TabIndex = 2; this.label8.Text = "This product is licensed to:"; // // LabelUserName // this.LabelUserName.AutoSize = true; this.LabelUserName.Font = new System.Drawing.Font("Courier New", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.LabelUserName.ForeColor = System.Drawing.SystemColors.InactiveCaptionText; this.LabelUserName.Location = new System.Drawing.Point(329, 67); this.LabelUserName.Name = "LabelUserName"; this.LabelUserName.Size = new System.Drawing.Size(78, 16); this.LabelUserName.TabIndex = 2; this.LabelUserName.Text = "John Smith"; // // LabelProductID // this.LabelProductID.AutoSize = true; this.LabelProductID.Font = new System.Drawing.Font("Courier New", 9F, System.Drawing.FontStyle.Bold); this.LabelProductID.ForeColor = System.Drawing.SystemColors.InactiveCaptionText; this.LabelProductID.Location = new System.Drawing.Point(169, 102); this.LabelProductID.Name = "LabelProductID"; this.LabelProductID.Size = new System.Drawing.Size(281, 16); this.LabelProductID.TabIndex = 2; this.LabelProductID.Text = "AAAA-AAAA-AAAA-AAAA-AAAA-AAAA-AAAA-AAAA"; // // buttonOK // this.buttonOK.BackColor = System.Drawing.SystemColors.GradientActiveCaption; this.buttonOK.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.buttonOK.Location = new System.Drawing.Point(392, 235); this.buttonOK.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4); this.buttonOK.Name = "buttonOK"; this.buttonOK.Size = new System.Drawing.Size(82, 31); this.buttonOK.TabIndex = 3; this.buttonOK.Text = "OK"; this.buttonOK.UseVisualStyleBackColor = false; this.buttonOK.Click += new System.EventHandler(this.buttonOK_Click); // // label7 // this.label7.AutoSize = true; this.label7.Location = new System.Drawing.Point(169, 86); this.label7.Name = "label7"; this.label7.Size = new System.Drawing.Size(90, 15); this.label7.TabIndex = 2; this.label7.Text = "Serial Number:"; // // pictureBox2 // this.pictureBox2.Image = global::FIS.iDET.TemplateCreator.Properties.Resources.fisHelp; this.pictureBox2.Location = new System.Drawing.Point(16, 6); this.pictureBox2.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4); this.pictureBox2.Name = "pictureBox2"; this.pictureBox2.Size = new System.Drawing.Size(120, 112); this.pictureBox2.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom; this.pictureBox2.TabIndex = 0; this.pictureBox2.TabStop = false; // // pictureBox1 // this.pictureBox1.Image = global::FIS.iDET.TemplateCreator.Properties.Resources.fisLogo; this.pictureBox1.Location = new System.Drawing.Point(15, 126); this.pictureBox1.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4); this.pictureBox1.Name = "pictureBox1"; this.pictureBox1.Size = new System.Drawing.Size(120, 87); this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom; this.pictureBox1.TabIndex = 0; this.pictureBox1.TabStop = false; // // FormAbout // this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.BackColor = System.Drawing.SystemColors.GradientInactiveCaption; this.ClientSize = new System.Drawing.Size(491, 302); this.Controls.Add(this.buttonOK); this.Controls.Add(this.label7); this.Controls.Add(this.LabelProductID); this.Controls.Add(this.LabelUserName); this.Controls.Add(this.label8); this.Controls.Add(this.label6); this.Controls.Add(this.label2); this.Controls.Add(this.label1); this.Controls.Add(this.pictureBox2); this.Controls.Add(this.pictureBox1); this.Font = new System.Drawing.Font("Arial", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); this.KeyPreview = true; this.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4); this.MaximizeBox = false; this.MinimizeBox = false; this.Name = "FormAbout"; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; this.Text = "About"; this.Load += new System.EventHandler(this.FormAbout_Load); this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.FormAbout_KeyDown); ((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit(); this.ResumeLayout(false); this.PerformLayout(); } #endregion private System.Windows.Forms.Label label1; private System.Windows.Forms.Label label2; private System.Windows.Forms.Label label6; private System.Windows.Forms.Label label8; private System.Windows.Forms.Label LabelUserName; private System.Windows.Forms.Label LabelProductID; private System.Windows.Forms.Button buttonOK; private System.Windows.Forms.Label label7; private System.Windows.Forms.PictureBox pictureBox1; private System.Windows.Forms.PictureBox pictureBox2; } }
2atgroup
TiffBrowserTestCSharp/Template Creator/FormAbout.Designer.cs
C#
Microsoft Reciprocal License (Ms-RL)
10,104
using System; using System.Windows.Forms; using System.Drawing; namespace FIS.iDET.TemplateCreator { public partial class FormEdit : Form { public FormEdit() { InitializeComponent(); } private FormTemplateCreator parentForm; private bool editMode = true; public FormEdit(FormTemplateCreator form, bool editMode) { InitializeComponent(); this.parentForm = form; this.editMode = editMode; if (!editMode) { createButton.Text = "Create Field"; this.Text = "Create new field"; comboBoxDataType.SelectedIndex = 2; } else { int i = parentForm.dataGridView.SelectedCells[0].ColumnIndex; textBoxFieldName.Text = parentForm.dataGridView.Columns[i].HeaderText; comboBoxDataType.Text = parentForm.dataGridView.Rows[0].Cells[i].Value.ToString(); } } private void cancelButton_Click(object sender, EventArgs e) { this.Close(); } private void createButton_Click(object sender, EventArgs e) { if (editMode) { // if user input data is valid if (textBoxFieldName.Text != "" && comboBoxDataType.SelectedIndex > -1) { // get index of selected column int i = parentForm.dataGridView.SelectedCells[0].ColumnIndex; // edit field name, ie column header text parentForm.dataGridView.Columns[i].HeaderText = textBoxFieldName.Text; // set new data type to row parentForm.dataGridView.Rows[0].Cells[i].Value = comboBoxDataType.Text; this.Close(); } else { MessageBox.Show("Please enter valid values for Field Name and Data Type"); } } else { // if user input data is valid if (textBoxFieldName.Text != "" && comboBoxDataType.SelectedIndex > -1) { // add new column int i = parentForm.dataGridView.Columns.Add((parentForm.count++).ToString(), textBoxFieldName.Text.Trim()); parentForm.dataGridView.Columns[i].ToolTipText = "Drag to re-order this field"; parentForm.dataGridView.Columns[i].SortMode = DataGridViewColumnSortMode.NotSortable; // add new column element in Column list GlobalVariables.columns.Add(new DataColumn(textBoxFieldName.Text.Trim(), comboBoxDataType.SelectedIndex, 100, new DoubleRectangle(0, 0, 0, 0))); // add one new row if there is none if (parentForm.dataGridView.RowCount == 0) parentForm.dataGridView.Rows.Add(); // set data type to row parentForm.dataGridView.Rows[0].Cells[i].Value = comboBoxDataType.Text; parentForm.dataGridView.Rows[0].Cells[i].ToolTipText = "Double click to edit this Data type"; textBoxFieldName.Text = ""; } else { MessageBox.Show("Please enter valid values for Field Name and Data Type"); } } } private void textBoxFieldName_KeyPress(object sender, KeyPressEventArgs e) { if (e.KeyChar == (char) Keys.Enter) { createButton_Click(sender, null); } else if (e.KeyChar == (char)Keys.Escape) { this.Close(); } } } }
2atgroup
TiffBrowserTestCSharp/Template Creator/FormEdit.cs
C#
Microsoft Reciprocal License (Ms-RL)
3,976
namespace FIS.iDET.TemplateCreator { partial class FormEdit { /// <summary> /// Required designer variable. /// </summary> private System.ComponentModel.IContainer components = null; /// <summary> /// Clean up any resources being used. /// </summary> /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param> protected override void Dispose(bool disposing) { if (disposing && (components != null)) { components.Dispose(); } base.Dispose(disposing); } #region Windows Form Designer generated code /// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { this.textBoxFieldName = new System.Windows.Forms.TextBox(); this.label2 = new System.Windows.Forms.Label(); this.label1 = new System.Windows.Forms.Label(); this.comboBoxDataType = new System.Windows.Forms.ComboBox(); this.createButton = new System.Windows.Forms.Button(); this.cancelButton = new System.Windows.Forms.Button(); this.SuspendLayout(); // // textBoxFieldName // this.textBoxFieldName.Location = new System.Drawing.Point(104, 6); this.textBoxFieldName.MaxLength = 256; this.textBoxFieldName.Name = "textBoxFieldName"; this.textBoxFieldName.Size = new System.Drawing.Size(173, 20); this.textBoxFieldName.TabIndex = 1; this.textBoxFieldName.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.textBoxFieldName_KeyPress); // // label2 // this.label2.AutoSize = true; this.label2.Location = new System.Drawing.Point(12, 9); this.label2.Name = "label2"; this.label2.Size = new System.Drawing.Size(60, 13); this.label2.TabIndex = 15; this.label2.Text = "Field Name"; // // label1 // this.label1.AutoSize = true; this.label1.Location = new System.Drawing.Point(15, 39); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(57, 13); this.label1.TabIndex = 15; this.label1.Text = "Data Type"; // // comboBoxDataType // this.comboBoxDataType.FormattingEnabled = true; this.comboBoxDataType.Items.AddRange(new object[] { "Date Time", "Number", "General Text"}); this.comboBoxDataType.Location = new System.Drawing.Point(104, 36); this.comboBoxDataType.Name = "comboBoxDataType"; this.comboBoxDataType.Size = new System.Drawing.Size(173, 21); this.comboBoxDataType.TabIndex = 2; // // createButton // this.createButton.Location = new System.Drawing.Point(15, 78); this.createButton.Name = "createButton"; this.createButton.Size = new System.Drawing.Size(119, 23); this.createButton.TabIndex = 3; this.createButton.Text = "Edit this Field"; this.createButton.UseVisualStyleBackColor = true; this.createButton.Click += new System.EventHandler(this.createButton_Click); // // cancelButton // this.cancelButton.Location = new System.Drawing.Point(157, 78); this.cancelButton.Name = "cancelButton"; this.cancelButton.Size = new System.Drawing.Size(119, 23); this.cancelButton.TabIndex = 4; this.cancelButton.Text = "Close"; this.cancelButton.UseVisualStyleBackColor = true; this.cancelButton.Click += new System.EventHandler(this.cancelButton_Click); // // FormEdit // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(288, 117); this.Controls.Add(this.textBoxFieldName); this.Controls.Add(this.label2); this.Controls.Add(this.label1); this.Controls.Add(this.comboBoxDataType); this.Controls.Add(this.cancelButton); this.Controls.Add(this.createButton); this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow; this.Name = "FormEdit"; this.Text = "Edit field"; this.ResumeLayout(false); this.PerformLayout(); } #endregion private System.Windows.Forms.TextBox textBoxFieldName; private System.Windows.Forms.Label label2; private System.Windows.Forms.Label label1; private System.Windows.Forms.ComboBox comboBoxDataType; private System.Windows.Forms.Button createButton; private System.Windows.Forms.Button cancelButton; } }
2atgroup
TiffBrowserTestCSharp/Template Creator/FormEdit.Designer.cs
C#
Microsoft Reciprocal License (Ms-RL)
5,426
using System; using System.Collections.Generic; using System.Drawing; using System.Windows.Forms; namespace FIS.iDET.TemplateCreator { public partial class FormTemplateCreator : Form { public static double zoomFactor = 1; ImageService tifImage = null; public int count = 0; private Point startPoint = new Point(0, 0); private Point imageStartPoint = new Point(0, 0); private Point endPoint = new Point(0, 0); DoubleRectangle rect = new DoubleRectangle(0, 0, 0, 0); public static int rows = 1; public FormTemplateCreator() { InitializeComponent(); } private void createButton_Click(object sender, EventArgs e) { FormEdit formEdit = new FormEdit(this, false); formEdit.ShowDialog(); } private void dataGridView_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { if (e.ColumnIndex > -1) { dataGridView.CurrentCell = dataGridView[e.ColumnIndex, 0]; dataGridView.CurrentCell.Selected = true; editButton_Click(null, null); } } private void deleteButton_Click(object sender, EventArgs e) { if (dataGridView.SelectedCells != null) { int i = dataGridView.SelectedCells[0].ColumnIndex; if (MessageBox.Show("Are you sure you want to delete this field: " + dataGridView.Columns[i].HeaderText, "Deleting field", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.Yes) { GlobalVariables.columns.RemoveAt(i); dataGridView.Columns.RemoveAt(i); if (dataGridView.Columns.Count == 0) saveButton.Enabled = false; } } else { MessageBox.Show("You have not set any column to delete"); } } private void editButton_Click(object sender, EventArgs e) { if (dataGridView.SelectedCells != null) { FormEdit formEdit = new FormEdit(this, true); formEdit.ShowDialog(); } else { MessageBox.Show("You have not set any column to delete"); } } private void FormTemplateCreator_Load(object sender, EventArgs e) { // init registry service RegistryService.Init(); // if app is not activated if (!LicenseService.AppIsActivated()) { // show license windows LicenseKeyForm licenseKeyForm = new LicenseKeyForm(); licenseKeyForm.ShowDialog(); } else { comboBoxZoomRatio.SelectedIndex = 4; textBoxRowsNumber.Text = "1"; this.Text += " - " + GlobalVariables.Version; } } private void loadButton_Click(object sender, EventArgs e) { OpenFileDialog openFileDialog = new OpenFileDialog(); openFileDialog.Filter = "FIS.iDET Template|*.fis"; openFileDialog.Title = "Load template"; openFileDialog.ShowDialog(); if (openFileDialog.FileName != null && openFileDialog.FileName != "") { // clear data grid view newButton_Click(null, null); // get column info from XML GlobalVariables.columns = XmlService.ReadXml(openFileDialog.FileName); //set zoom comboBoxZoomRatio.Text = ((int)(zoomFactor * 100)).ToString(); if (GlobalVariables.columns == null) { // cannot load data MessageBox.Show("Cannot load template, please make sure that it is valid!"); } else { // set column info to datagridview foreach (DataColumn column in GlobalVariables.columns) { // add new column int i = dataGridView.Columns.Add((count++).ToString(), column.Header.Trim()); dataGridView.Columns[i].ToolTipText = "Drag to re-order this field"; dataGridView.Columns[i].SortMode = DataGridViewColumnSortMode.NotSortable; dataGridView.Columns[i].Width = column.Width; // add one new row if there is none if (dataGridView.RowCount == 0) dataGridView.Rows.Add(); // set data type to row dataGridView.Rows[0].Cells[i].Value = XmlService.getDataTypeLongNameOf(column.Type); dataGridView.Rows[0].Cells[i].ToolTipText = "Double click to edit this Data type"; } dataGridView.Rows[0].Cells[0].Selected = true; if (GlobalVariables.TemplatePageCol != 0) { checkBoxPageNumber.Checked = true; checkBoxPageNumber_CheckedChanged(null, null); } } } } private void newButton_Click(object sender, EventArgs e) { dataGridView.CurrentCell = null; while (dataGridView.ColumnCount > 0) dataGridView.Columns.RemoveAt(0); GlobalVariables.columns.Clear(); pictBox.Image = null; EnableMenuIcons(false); saveButton.Enabled = false; } private void saveButton_Click(object sender, EventArgs e) { SaveFileDialog saveFileDialog = new SaveFileDialog(); saveFileDialog.Filter = "FIS.iDET Template|*.fis"; saveFileDialog.Title = "Save template"; saveFileDialog.ShowDialog(); if (saveFileDialog.FileName != null && saveFileDialog.FileName != "") { XmlService.WriteXml(saveFileDialog.FileName, dataGridView); } } private void LoadImage() { OpenFileDialog openFileDialog = new OpenFileDialog(); openFileDialog.Filter = "Tif Images|*.tif|Tiff Images|*.tiff|All files|*.*"; openFileDialog.Title = "Open Tiff Image"; DialogResult result = openFileDialog.ShowDialog(); if (result == DialogResult.OK && !String.IsNullOrEmpty(openFileDialog.FileName)) { // load tif file tifImage = new ImageService(openFileDialog.FileName); if (tifImage.FileLoadedOK) { // if template is in multipage mode, asks user to load excel file for this mode to work { textBoxPageNumber.ReadOnly = false; textBoxPageNumber.Text = (tifImage.CurrentFrame + 1).ToString(); } // set max page to toolStripLabelPage labelPage.Text = "/" + tifImage.TotalFrames.ToString(); // enable menu items // disable previous page button buttonPreviousPage.Enabled = false; // set default zoom factor tifImage.SetImageFrame(0); if (dataGridView.CurrentCell != null) { int id = dataGridView.CurrentCell.ColumnIndex; rect.X = GlobalVariables.columns[id].X; rect.Y = GlobalVariables.columns[id].Y; rect.Width = GlobalVariables.columns[id].W; rect.Height = GlobalVariables.columns[id].H; } pictBox.Image = tifImage.GetImageZoom(zoomFactor,rect); EnableMenuIcons(true); if (tifImage.TotalFrames == 1) buttonNextPage.Enabled = false; } else { ResetImageBox(); } } } private void EnableMenuIcons(Boolean enabled) { buttonNextPage.Enabled = enabled; buttonPreviousPage.Enabled = enabled; textBoxPageNumber.Enabled = enabled; comboBoxZoomRatio.Enabled = enabled; // H.NH added pictBox.Enabled = enabled; buttonRowHeight.Enabled = enabled; numericUpDown1.Enabled = enabled; textBoxRowsNumber.Enabled = enabled; } private void EnableButtonSize(Boolean enabled) { buttonPositionDown.Enabled = enabled; buttonPositionLeft.Enabled = enabled; buttonPositionRight.Enabled = enabled; buttonPositionUp.Enabled = enabled; buttonSizeDown.Enabled = enabled; buttonSizeUp.Enabled = enabled; buttonSizeLeft.Enabled = enabled; buttonSizeRight.Enabled = enabled; numericSpin.Enabled = enabled; // reverse textBoxRowsNumber.Enabled = !enabled; buttonRowHeight.Enabled = !enabled; } private void ResetImageBox() { // delete image pictBox.Image = null; // disable menu items EnableMenuIcons(false); pictBox.Enabled = false; EnableButtonSize(false); } private void buttonLoadImage_Click(object sender, EventArgs e) { LoadImage(); } private void RedrawPicture() // mode = 1 draw multiple rect { RedrawPicture(false); } private void RedrawPicture(bool mode) // mode = 1 draw multiple rect { /*if (navigationToolStripMenuItem.Checked) { DoubleRectangle rect; if (GlobalConstants.TemplatePageCol == 0) { rect = GetCurrentCellRectSingleLine(); } else { rect = GetCurrentCellRectMultiLine(); } PictBox.Image = tifImage.GetImageZoom(zoomFactor, rect); } else */ if (pictBox.Enabled) { pictBox.Image = tifImage.GetImageZoom(zoomFactor, rect, mode); pictBox.Refresh(); } } private void textBoxPageNumber_KeyPress(object sender, KeyPressEventArgs e) { if ( e.KeyChar == (char)Keys.Enter) { try { int page = Convert.ToInt32(textBoxPageNumber.Text); int frameToDisplay = 0; if (page > 0 && page <= tifImage.TotalFrames) { frameToDisplay = page - 1; // set image tifImage.SetImageFrame(frameToDisplay); RedrawPicture(); if (page == 1) { buttonNextPage.Enabled = true; buttonPreviousPage.Enabled = false; } if (page == tifImage.TotalFrames) { buttonNextPage.Enabled = false; buttonPreviousPage.Enabled = true; } } else textBoxPageNumber.Undo(); } catch { textBoxPageNumber.Undo(); } } } private void buttonPreviousPage_Click(object sender, EventArgs e) { tifImage.SetImageFrame(tifImage.CurrentFrame-1); RedrawPicture(); textBoxPageNumber.Text = (tifImage.CurrentFrame+1).ToString(); if (tifImage.CurrentFrame == 0) buttonPreviousPage.Enabled = false; if (tifImage.CurrentFrame < tifImage.TotalFrames-1) buttonNextPage.Enabled = true; } private void buttonNextPage_Click(object sender, EventArgs e) { tifImage.SetImageFrame(tifImage.CurrentFrame+1); RedrawPicture(); textBoxPageNumber.Text = (tifImage.CurrentFrame+1).ToString(); if (tifImage.CurrentFrame == tifImage.TotalFrames-1) buttonNextPage.Enabled = false; if (tifImage.CurrentFrame > 0) buttonPreviousPage.Enabled = true; } /* private Point ConvertToImageCoordinate(Point pictPoint) { Point imagePoint= new Point(0,0); int offsetX = panelPictBox.HorizontalScroll.Value / panelPictBox.HorizontalScroll.Maximum * (tifImage.Width - panelPictBox.Width); int x = (int)((rect.X + rect.Width - offsetX) * zoomFactor) + 10; int offsetY = panelPictBox.VerticalScroll.Value / panelPictBox.VerticalScroll.Maximum * (tifImage.Height - panelPictBox.Height); int y = (int)((rect.Y + rect.Height / 2 - offsetY) * zoomFactor) - 10; return imagePoint; } */ bool dragging = false; private void pictBox_MouseDown(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Left && dataGridView.Columns.Count > 0 && pictBox.Enabled) { EnableButtonSize(false); dragging = true; pictBox.Cursor = Cursors.Cross; startPoint.X = e.Location.X; startPoint.Y = e.Location.Y; //imageStartPoint = ConvertToImageCoordinate(startPoint); } } private void pictBox_MouseMove(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Left && dataGridView.Columns.Count> 0 && pictBox.Enabled && dragging ) { int x = startPoint.X < e.Location.X ? startPoint.X : e.Location.X; int y = startPoint.Y < e.Location.Y ? startPoint.Y : e.Location.Y; rect.X = (int) (x / zoomFactor); rect.Y = (int) (y / zoomFactor); rect.Width = Math.Abs((int)((e.Location.X - startPoint.X)/zoomFactor)); rect.Height = Math.Abs((int)((e.Location.Y - startPoint.Y)/zoomFactor)); //GlobalVariables.columns[curCol].Rect = rect; RedrawPicture(); } } private void pictBox_MouseUp(object sender, MouseEventArgs e) { if (dataGridView.Columns.Count > 0 && pictBox.Enabled && dragging) { dragging = false; int curCol = dataGridView.CurrentCell.ColumnIndex; int x = startPoint.X < e.Location.X ? startPoint.X : e.Location.X; int y = startPoint.Y < e.Location.Y ? startPoint.Y : e.Location.Y; rect.X = (int)(x / zoomFactor); rect.Y = (int)(y / zoomFactor); rect.Width = Math.Abs((int)((e.Location.X - startPoint.X) / zoomFactor)); rect.Height = Math.Abs((int)((e.Location.Y - startPoint.Y) / zoomFactor)); // Improve Rect Accuracy // rectMultiRow = rect; RedrawPicture(); } } private void comboBoxZoomRatio_SelectedIndexChanged(object sender, EventArgs e) { //PictBox.Focus(); if (comboBoxZoomRatio.SelectedIndex < 0) comboBoxZoomRatio.SelectedIndex = 4; //handle exception // else init zoom int pos = comboBoxZoomRatio.Text.IndexOf('%'); string zoomFactorString = comboBoxZoomRatio.Text.Remove(pos); zoomFactor = Convert.ToDouble(zoomFactorString) / 100; // active zoom buttons RedrawPicture(true); } private void comboBoxZoomRatio_KeyPress(object sender, KeyPressEventArgs e) { if (e.KeyChar == (char)Keys.Enter) { int pos = comboBoxZoomRatio.Text.IndexOf('%'); string zoomFactorString = comboBoxZoomRatio.Text; if (pos > -1) zoomFactorString = comboBoxZoomRatio.Text.Remove(pos); else comboBoxZoomRatio.Text += "%"; double dzoomFactor = 0; // end zoomComboBox if (double.TryParse(zoomFactorString, out dzoomFactor) && dzoomFactor > 0 && dzoomFactor < 500) { zoomFactor = Convert.ToDouble(zoomFactorString) / 100; RedrawPicture(); } else comboBoxZoomRatio.SelectedIndex = 4; } } private void dataGridView_CurrentCellChanged(object sender, EventArgs e) { if (dataGridView.CurrentCell != null && pictBox.Enabled) { rect = GlobalVariables.columns[dataGridView.CurrentCell.ColumnIndex].Rect; RedrawPicture(); if (rect.Height != 0 && rect.Width != 0) EnableButtonSize(true); else EnableButtonSize(false); } if (dataGridView.Columns.Count > 0) saveButton.Enabled = true; else saveButton.Enabled = false; if (dataGridView.CurrentCell != null) { editButton.Enabled = true; deleteButton.Enabled = true; } else { editButton.Enabled = false; deleteButton.Enabled = false; } } private void checkBoxPageNumber_CheckedChanged(object sender, EventArgs e) { comboBoxPageCol.Enabled = checkBoxPageNumber.Checked; comboBoxPageCol.Items.Clear(); if (checkBoxPageNumber.Checked) { for (int i = 1; i <= dataGridView.Columns.Count; i++) comboBoxPageCol.Items.Add(i); if (GlobalVariables.TemplatePageCol == 0 || GlobalVariables.TemplatePageCol > dataGridView.Columns.Count) { GlobalVariables.TemplatePageCol = dataGridView.Columns.Count; } comboBoxPageCol.SelectedIndex = GlobalVariables.TemplatePageCol - 1; } else { GlobalVariables.TemplatePageCol = 0; } } private void dataGridView_SelectionChanged(object sender, EventArgs e) { if (dataGridView.Columns.Count > 0) saveButton.Enabled = true; else saveButton.Enabled = false; if (dataGridView.CurrentCell != null) { editButton.Enabled = true; deleteButton.Enabled = true; } else { editButton.Enabled = false; deleteButton.Enabled = false; } //MessageBox.Show("yep"); } private void moveTooltipLeftToolStripMenuItem_Click() { if (dataGridView.CurrentCell != null && pictBox.Enabled) { GlobalVariables.columns[dataGridView.CurrentCell.ColumnIndex].X-=(int) numericSpin.Value; rect.X -= (int)numericSpin.Value; RedrawPicture(true); } } private void moveTooltipRightToolStripMenuItem_Click() { if (dataGridView.CurrentCell != null && pictBox.Enabled ) { GlobalVariables.columns[dataGridView.CurrentCell.ColumnIndex].X += (int)numericSpin.Value; rect.X += (int)numericSpin.Value; RedrawPicture(true); } } private void moveTooltipUpToolStripMenuItem_Click() { if (dataGridView.CurrentCell != null && pictBox.Enabled ) { GlobalVariables.columns[dataGridView.CurrentCell.ColumnIndex].Y -= (int)numericSpin.Value; rect.Y -= (int)numericSpin.Value; RedrawPicture(true); } } private void moveTooltipDownToolStripMenuItem_Click() { if (dataGridView.CurrentCell != null && pictBox.Enabled ) { GlobalVariables.columns[dataGridView.CurrentCell.ColumnIndex].Y++; rect.Y += (int)numericSpin.Value; RedrawPicture(true); } } private void increaseTooltipHeightToolStripMenuItem_Click() { if (dataGridView.CurrentCell != null && pictBox.Enabled ) { GlobalVariables.columns[dataGridView.CurrentCell.ColumnIndex].H++; rect.Height ++; RedrawPicture(true); } } private void increaseTooltipWidthToolStripMenuItem_Click() { if (dataGridView.CurrentCell != null && pictBox.Enabled ) { GlobalVariables.columns[dataGridView.CurrentCell.ColumnIndex].W++; rect.Width++; RedrawPicture(true); } } private void decreaseTooltipHeightToolStripMenuItem_Click() { if (dataGridView.CurrentCell != null && pictBox.Enabled ) { GlobalVariables.columns[dataGridView.CurrentCell.ColumnIndex].H--; rect.Height --; RedrawPicture(true); } } private void decreaseTooltipWidthToolStripMenuItem_Click() { if (dataGridView.CurrentCell != null && pictBox.Enabled ) { GlobalVariables.columns[dataGridView.CurrentCell.ColumnIndex].W--; rect.Width--; RedrawPicture(true); } } // Shorcut key comming here protected override bool ProcessCmdKey(ref Message msg, Keys keyData) { switch (keyData) { case Keys.Control | Keys.Shift | Keys.Up: moveTooltipUpToolStripMenuItem_Click(); return true; case Keys.Control | Keys.Shift | Keys.Down: moveTooltipDownToolStripMenuItem_Click(); return true; case Keys.Control | Keys.Shift | Keys.Left: moveTooltipLeftToolStripMenuItem_Click(); return true; case Keys.Control | Keys.Shift | Keys.Right: moveTooltipRightToolStripMenuItem_Click(); return true; case Keys.Control | Keys.Alt | Keys.Right: increaseTooltipWidthToolStripMenuItem_Click(); return true; case Keys.Control | Keys.Alt | Keys.Up: decreaseTooltipHeightToolStripMenuItem_Click(); return true; case Keys.Control | Keys.Alt | Keys.Left: decreaseTooltipWidthToolStripMenuItem_Click(); return true; case Keys.Control | Keys.Alt | Keys.Down: increaseTooltipHeightToolStripMenuItem_Click(); return true; } return base.ProcessCmdKey(ref msg, keyData); } private void buttonPositionUp_Click(object sender, EventArgs e) { moveTooltipUpToolStripMenuItem_Click(); } private void buttonPositionDown_Click(object sender, EventArgs e) { moveTooltipDownToolStripMenuItem_Click(); } private void buttonPositionLeft_Click(object sender, EventArgs e) { moveTooltipLeftToolStripMenuItem_Click(); } private void buttonPositionRight_Click(object sender, EventArgs e) { moveTooltipRightToolStripMenuItem_Click(); } private void buttonSizeUp_Click(object sender, EventArgs e) { decreaseTooltipHeightToolStripMenuItem_Click(); } private void buttonSizeDown_Click(object sender, EventArgs e) { increaseTooltipHeightToolStripMenuItem_Click(); } private void buttonSizeLeft_Click(object sender, EventArgs e) { decreaseTooltipWidthToolStripMenuItem_Click(); } private void buttonSizeRight_Click(object sender, EventArgs e) { increaseTooltipWidthToolStripMenuItem_Click(); } private void comboBoxPageCol_SelectedIndexChanged(object sender, EventArgs e) { GlobalVariables.TemplatePageCol = comboBoxPageCol.SelectedIndex + 1; } private void dataGridView_ColumnAdded(object sender, DataGridViewColumnEventArgs e) { if (checkBoxPageNumber.Checked == true) checkBoxPageNumber_CheckedChanged(null, null); } private void dataGridView_ColumnRemoved(object sender, DataGridViewColumnEventArgs e) { if (checkBoxPageNumber.Checked == false) return; if (dataGridView.Columns.Count == 0) { comboBoxPageCol.Enabled = checkBoxPageNumber.Checked = false; } else { checkBoxPageNumber_CheckedChanged(null, null); } } public int valueUpDown = 0; private void numericUpDown1_ValueChanged(object sender, EventArgs e) { /*if (numericUpDown1.Value > valueUpDown) {*/ // valueUpDown = (int)numericUpDown1.Value; /// rect.Y = (int)((double)rectMultiRow.Y + (double)rectMultiRow.Height * ((double)valueUpDown / (double)rows)); if (numericUpDown1.Value > valueUpDown) { valueUpDown = (int)numericUpDown1.Value; rect.Y += rect.Height; } else { valueUpDown = (int)numericUpDown1.Value; rect.Y -= rect.Height; } RedrawPicture(); /*} else { valueUpDown = (int)numericUpDown1.Value; rect.Y = (int)((double)rectMultiRow.Y - (double)rectMultiRow.Height * ((double)valueUpDown / (double)rows)); RedrawPicture(); }*/ } private void buttonRowHeight_Click(object sender, EventArgs e) { if (dataGridView.CurrentCell!=null && pictBox.Enabled && rect.Height!=0 && rect.Width!=0 ) if (Int32.TryParse(textBoxRowsNumber.Text, out rows)) { EnableButtonSize(true); int curCol = dataGridView.CurrentCell.ColumnIndex; if (rows < 1) { rows = 1; textBoxRowsNumber.Text = rows.ToString(); } //rect1row.Width = (rect.Width / rows); rect.Height = (rect.Height / rows); GlobalVariables.columns[curCol].Rect = rect; RedrawPicture(true); // true means draw multiple Rect mode //buttonRowHeight.Enabled = false; return; } else { MessageBox.Show("Please enter number of Rows in Navigation zone correctly !", "Wrong rows number", MessageBoxButtons.OK, MessageBoxIcon.Error); textBoxRowsNumber.Focus(); } buttonRowHeight.Enabled = false; } private void textBoxRowsNumber_KeyPress(object sender, KeyPressEventArgs e) { buttonRowHeight.Enabled = true; } private void panel2_Paint(object sender, PaintEventArgs e) { } private void numericSpin_ValueChanged(object sender, EventArgs e) { } private void buttonAbout_Click(object sender, EventArgs e) { FormAbout formAbout = new FormAbout(); formAbout.Show(); } private void buttonExit_Click(object sender, EventArgs e) { Application.Exit(); } } }
2atgroup
TiffBrowserTestCSharp/Template Creator/FormTemplateCreator.cs
C#
Microsoft Reciprocal License (Ms-RL)
29,774
namespace FIS.iDET.TemplateCreator { partial class FormTemplateCreator { /// <summary> /// Required designer variable. /// </summary> private System.ComponentModel.IContainer components = null; /// <summary> /// Clean up any resources being used. /// </summary> /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param> protected override void Dispose(bool disposing) { if (disposing && (components != null)) { components.Dispose(); } base.Dispose(disposing); } #region Windows Form Designer generated code /// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FormTemplateCreator)); this.dataGridView = new System.Windows.Forms.DataGridView(); this.createButton = new System.Windows.Forms.Button(); this.editButton = new System.Windows.Forms.Button(); this.deleteButton = new System.Windows.Forms.Button(); this.saveButton = new System.Windows.Forms.Button(); this.newButton = new System.Windows.Forms.Button(); this.loadButton = new System.Windows.Forms.Button(); this.label1 = new System.Windows.Forms.Label(); this.panelPictBox = new System.Windows.Forms.Panel(); this.pictBox = new System.Windows.Forms.PictureBox(); this.buttonLoadImage = new System.Windows.Forms.Button(); this.textBoxPageNumber = new System.Windows.Forms.TextBox(); this.labelPage = new System.Windows.Forms.Label(); this.comboBoxZoomRatio = new System.Windows.Forms.ComboBox(); this.checkBoxPageNumber = new System.Windows.Forms.CheckBox(); this.comboBoxPageCol = new System.Windows.Forms.ComboBox(); this.panel1 = new System.Windows.Forms.Panel(); this.panel2 = new System.Windows.Forms.Panel(); this.numericSpin = new System.Windows.Forms.NumericUpDown(); this.textBoxRowsNumber = new System.Windows.Forms.TextBox(); this.buttonSizeDown = new System.Windows.Forms.Button(); this.buttonPositionDown = new System.Windows.Forms.Button(); this.buttonSizeUp = new System.Windows.Forms.Button(); this.buttonSizeRight = new System.Windows.Forms.Button(); this.buttonPositionUp = new System.Windows.Forms.Button(); this.buttonSizeLeft = new System.Windows.Forms.Button(); this.buttonPositionRight = new System.Windows.Forms.Button(); this.label5 = new System.Windows.Forms.Label(); this.label7 = new System.Windows.Forms.Label(); this.label11 = new System.Windows.Forms.Label(); this.label3 = new System.Windows.Forms.Label(); this.buttonPositionLeft = new System.Windows.Forms.Button(); this.label4 = new System.Windows.Forms.Label(); this.label8 = new System.Windows.Forms.Label(); this.label12 = new System.Windows.Forms.Label(); this.label9 = new System.Windows.Forms.Label(); this.label2 = new System.Windows.Forms.Label(); this.buttonRowHeight = new System.Windows.Forms.Button(); this.buttonPreviousPage = new System.Windows.Forms.Button(); this.buttonNextPage = new System.Windows.Forms.Button(); this.numericUpDown1 = new System.Windows.Forms.NumericUpDown(); this.label6 = new System.Windows.Forms.Label(); this.panel3 = new System.Windows.Forms.Panel(); this.label10 = new System.Windows.Forms.Label(); this.buttonExit = new System.Windows.Forms.Button(); this.buttonAbout = new System.Windows.Forms.Button(); ((System.ComponentModel.ISupportInitialize)(this.dataGridView)).BeginInit(); this.panelPictBox.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.pictBox)).BeginInit(); this.panel1.SuspendLayout(); this.panel2.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.numericSpin)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).BeginInit(); this.panel3.SuspendLayout(); this.SuspendLayout(); // // dataGridView // this.dataGridView.AllowUserToAddRows = false; this.dataGridView.AllowUserToDeleteRows = false; this.dataGridView.AllowUserToOrderColumns = true; this.dataGridView.AllowUserToResizeRows = false; this.dataGridView.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.dataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; this.dataGridView.Location = new System.Drawing.Point(3, 22); this.dataGridView.MultiSelect = false; this.dataGridView.Name = "dataGridView"; this.dataGridView.ReadOnly = true; this.dataGridView.Size = new System.Drawing.Size(1148, 62); this.dataGridView.TabIndex = 10; this.dataGridView.CellDoubleClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dataGridView_CellDoubleClick); this.dataGridView.ColumnAdded += new System.Windows.Forms.DataGridViewColumnEventHandler(this.dataGridView_ColumnAdded); this.dataGridView.ColumnRemoved += new System.Windows.Forms.DataGridViewColumnEventHandler(this.dataGridView_ColumnRemoved); this.dataGridView.CurrentCellChanged += new System.EventHandler(this.dataGridView_CurrentCellChanged); this.dataGridView.SelectionChanged += new System.EventHandler(this.dataGridView_SelectionChanged); // // createButton // this.createButton.Location = new System.Drawing.Point(11, 125); this.createButton.Name = "createButton"; this.createButton.Size = new System.Drawing.Size(102, 22); this.createButton.TabIndex = 2; this.createButton.Text = "New Column"; this.createButton.UseVisualStyleBackColor = true; this.createButton.Click += new System.EventHandler(this.createButton_Click); // // editButton // this.editButton.Enabled = false; this.editButton.Location = new System.Drawing.Point(11, 153); this.editButton.Name = "editButton"; this.editButton.Size = new System.Drawing.Size(102, 22); this.editButton.TabIndex = 3; this.editButton.Text = "Edit Column"; this.editButton.UseVisualStyleBackColor = true; this.editButton.Click += new System.EventHandler(this.editButton_Click); // // deleteButton // this.deleteButton.Enabled = false; this.deleteButton.Location = new System.Drawing.Point(11, 181); this.deleteButton.Name = "deleteButton"; this.deleteButton.Size = new System.Drawing.Size(102, 22); this.deleteButton.TabIndex = 4; this.deleteButton.Text = "Detele Column"; this.deleteButton.UseVisualStyleBackColor = true; this.deleteButton.Click += new System.EventHandler(this.deleteButton_Click); // // saveButton // this.saveButton.Enabled = false; this.saveButton.Location = new System.Drawing.Point(12, 55); this.saveButton.Name = "saveButton"; this.saveButton.Size = new System.Drawing.Size(102, 22); this.saveButton.TabIndex = 6; this.saveButton.Text = "Save template"; this.saveButton.UseVisualStyleBackColor = true; this.saveButton.Click += new System.EventHandler(this.saveButton_Click); // // newButton // this.newButton.Location = new System.Drawing.Point(13, 83); this.newButton.Name = "newButton"; this.newButton.Size = new System.Drawing.Size(102, 22); this.newButton.TabIndex = 5; this.newButton.Text = "Clear template"; this.newButton.UseVisualStyleBackColor = true; this.newButton.Click += new System.EventHandler(this.newButton_Click); // // loadButton // this.loadButton.Location = new System.Drawing.Point(12, 27); this.loadButton.Name = "loadButton"; this.loadButton.Size = new System.Drawing.Size(102, 22); this.loadButton.TabIndex = 7; this.loadButton.Text = "Load template"; this.loadButton.UseVisualStyleBackColor = true; this.loadButton.Click += new System.EventHandler(this.loadButton_Click); // // label1 // this.label1.AutoSize = true; this.label1.Location = new System.Drawing.Point(3, 6); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(55, 13); this.label1.TabIndex = 12; this.label1.Text = "Data Field"; // // panelPictBox // this.panelPictBox.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.panelPictBox.AutoScroll = true; this.panelPictBox.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D; this.panelPictBox.Controls.Add(this.pictBox); this.panelPictBox.Location = new System.Drawing.Point(3, 90); this.panelPictBox.Name = "panelPictBox"; this.panelPictBox.Size = new System.Drawing.Size(1148, 587); this.panelPictBox.TabIndex = 13; // // pictBox // this.pictBox.Enabled = false; this.pictBox.Location = new System.Drawing.Point(3, 3); this.pictBox.Name = "pictBox"; this.pictBox.Size = new System.Drawing.Size(640, 346); this.pictBox.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize; this.pictBox.TabIndex = 11; this.pictBox.TabStop = false; this.pictBox.MouseDown += new System.Windows.Forms.MouseEventHandler(this.pictBox_MouseDown); this.pictBox.MouseMove += new System.Windows.Forms.MouseEventHandler(this.pictBox_MouseMove); this.pictBox.MouseUp += new System.Windows.Forms.MouseEventHandler(this.pictBox_MouseUp); // // buttonLoadImage // this.buttonLoadImage.Location = new System.Drawing.Point(12, 277); this.buttonLoadImage.Name = "buttonLoadImage"; this.buttonLoadImage.Size = new System.Drawing.Size(101, 22); this.buttonLoadImage.TabIndex = 2; this.buttonLoadImage.Text = "Load Image"; this.buttonLoadImage.UseVisualStyleBackColor = true; this.buttonLoadImage.Click += new System.EventHandler(this.buttonLoadImage_Click); // // textBoxPageNumber // this.textBoxPageNumber.Enabled = false; this.textBoxPageNumber.Location = new System.Drawing.Point(8, 305); this.textBoxPageNumber.Name = "textBoxPageNumber"; this.textBoxPageNumber.Size = new System.Drawing.Size(32, 20); this.textBoxPageNumber.TabIndex = 14; this.textBoxPageNumber.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.textBoxPageNumber_KeyPress); // // labelPage // this.labelPage.AutoSize = true; this.labelPage.Location = new System.Drawing.Point(40, 313); this.labelPage.Name = "labelPage"; this.labelPage.Size = new System.Drawing.Size(18, 13); this.labelPage.TabIndex = 15; this.labelPage.Text = "/0"; // // comboBoxZoomRatio // this.comboBoxZoomRatio.Enabled = false; this.comboBoxZoomRatio.FormattingEnabled = true; this.comboBoxZoomRatio.Items.AddRange(new object[] { "20%", "40%", "60%", "80%", "100%", "120%", "140%", "160%", "180%", "200%", "220%", "240%", "260%", "280%", "300%"}); this.comboBoxZoomRatio.Location = new System.Drawing.Point(51, 333); this.comboBoxZoomRatio.Name = "comboBoxZoomRatio"; this.comboBoxZoomRatio.Size = new System.Drawing.Size(61, 21); this.comboBoxZoomRatio.TabIndex = 16; this.comboBoxZoomRatio.SelectedIndexChanged += new System.EventHandler(this.comboBoxZoomRatio_SelectedIndexChanged); this.comboBoxZoomRatio.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.comboBoxZoomRatio_KeyPress); // // checkBoxPageNumber // this.checkBoxPageNumber.AutoSize = true; this.checkBoxPageNumber.Location = new System.Drawing.Point(11, 211); this.checkBoxPageNumber.Name = "checkBoxPageNumber"; this.checkBoxPageNumber.Size = new System.Drawing.Size(89, 17); this.checkBoxPageNumber.TabIndex = 18; this.checkBoxPageNumber.Text = "Page Column"; this.checkBoxPageNumber.UseVisualStyleBackColor = true; this.checkBoxPageNumber.CheckedChanged += new System.EventHandler(this.checkBoxPageNumber_CheckedChanged); // // comboBoxPageCol // this.comboBoxPageCol.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.comboBoxPageCol.Enabled = false; this.comboBoxPageCol.FormattingEnabled = true; this.comboBoxPageCol.Location = new System.Drawing.Point(11, 234); this.comboBoxPageCol.Name = "comboBoxPageCol"; this.comboBoxPageCol.Size = new System.Drawing.Size(101, 21); this.comboBoxPageCol.TabIndex = 19; this.comboBoxPageCol.SelectedIndexChanged += new System.EventHandler(this.comboBoxPageCol_SelectedIndexChanged); // // panel1 // this.panel1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.panel1.Controls.Add(this.panelPictBox); this.panel1.Controls.Add(this.dataGridView); this.panel1.Controls.Add(this.label1); this.panel1.Location = new System.Drawing.Point(0, 0); this.panel1.Name = "panel1"; this.panel1.Size = new System.Drawing.Size(1154, 680); this.panel1.TabIndex = 20; // // panel2 // this.panel2.Controls.Add(this.numericSpin); this.panel2.Controls.Add(this.newButton); this.panel2.Controls.Add(this.saveButton); this.panel2.Controls.Add(this.textBoxRowsNumber); this.panel2.Controls.Add(this.buttonSizeDown); this.panel2.Controls.Add(this.buttonPositionDown); this.panel2.Controls.Add(this.loadButton); this.panel2.Controls.Add(this.buttonSizeUp); this.panel2.Controls.Add(this.buttonSizeRight); this.panel2.Controls.Add(this.buttonPositionUp); this.panel2.Controls.Add(this.buttonSizeLeft); this.panel2.Controls.Add(this.buttonPositionRight); this.panel2.Controls.Add(this.label5); this.panel2.Controls.Add(this.label7); this.panel2.Controls.Add(this.label11); this.panel2.Controls.Add(this.label3); this.panel2.Controls.Add(this.buttonPositionLeft); this.panel2.Controls.Add(this.label4); this.panel2.Controls.Add(this.label8); this.panel2.Controls.Add(this.label12); this.panel2.Controls.Add(this.label9); this.panel2.Controls.Add(this.label2); this.panel2.Controls.Add(this.createButton); this.panel2.Controls.Add(this.buttonAbout); this.panel2.Controls.Add(this.buttonExit); this.panel2.Controls.Add(this.buttonRowHeight); this.panel2.Controls.Add(this.buttonLoadImage); this.panel2.Controls.Add(this.comboBoxPageCol); this.panel2.Controls.Add(this.buttonPreviousPage); this.panel2.Controls.Add(this.checkBoxPageNumber); this.panel2.Controls.Add(this.buttonNextPage); this.panel2.Controls.Add(this.comboBoxZoomRatio); this.panel2.Controls.Add(this.editButton); this.panel2.Controls.Add(this.labelPage); this.panel2.Controls.Add(this.deleteButton); this.panel2.Controls.Add(this.textBoxPageNumber); this.panel2.Dock = System.Windows.Forms.DockStyle.Right; this.panel2.Location = new System.Drawing.Point(1160, 0); this.panel2.Name = "panel2"; this.panel2.Size = new System.Drawing.Size(124, 701); this.panel2.TabIndex = 21; this.panel2.Paint += new System.Windows.Forms.PaintEventHandler(this.panel2_Paint); // // numericSpin // this.numericSpin.Location = new System.Drawing.Point(53, 527); this.numericSpin.Minimum = new decimal(new int[] { 1, 0, 0, 0}); this.numericSpin.Name = "numericSpin"; this.numericSpin.Size = new System.Drawing.Size(53, 20); this.numericSpin.TabIndex = 13; this.numericSpin.Value = new decimal(new int[] { 1, 0, 0, 0}); this.numericSpin.ValueChanged += new System.EventHandler(this.numericSpin_ValueChanged); // // textBoxRowsNumber // this.textBoxRowsNumber.Enabled = false; this.textBoxRowsNumber.Location = new System.Drawing.Point(52, 386); this.textBoxRowsNumber.Name = "textBoxRowsNumber"; this.textBoxRowsNumber.Size = new System.Drawing.Size(61, 20); this.textBoxRowsNumber.TabIndex = 22; this.textBoxRowsNumber.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.textBoxRowsNumber_KeyPress); // // buttonSizeDown // this.buttonSizeDown.AutoSize = true; this.buttonSizeDown.BackgroundImageLayout = System.Windows.Forms.ImageLayout.None; this.buttonSizeDown.Cursor = System.Windows.Forms.Cursors.Hand; this.buttonSizeDown.Enabled = false; this.buttonSizeDown.FlatAppearance.BorderSize = 0; this.buttonSizeDown.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.buttonSizeDown.Image = global::FIS.iDET.TemplateCreator.Properties.Resources.plus_circle; this.buttonSizeDown.Location = new System.Drawing.Point(45, 607); this.buttonSizeDown.Name = "buttonSizeDown"; this.buttonSizeDown.Size = new System.Drawing.Size(32, 32); this.buttonSizeDown.TabIndex = 21; this.buttonSizeDown.UseVisualStyleBackColor = false; this.buttonSizeDown.Click += new System.EventHandler(this.buttonSizeDown_Click); // // buttonPositionDown // this.buttonPositionDown.AutoSize = true; this.buttonPositionDown.BackgroundImageLayout = System.Windows.Forms.ImageLayout.None; this.buttonPositionDown.Cursor = System.Windows.Forms.Cursors.Hand; this.buttonPositionDown.Enabled = false; this.buttonPositionDown.FlatAppearance.BorderSize = 0; this.buttonPositionDown.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.buttonPositionDown.Image = ((System.Drawing.Image)(resources.GetObject("buttonPositionDown.Image"))); this.buttonPositionDown.Location = new System.Drawing.Point(46, 488); this.buttonPositionDown.Name = "buttonPositionDown"; this.buttonPositionDown.Size = new System.Drawing.Size(32, 32); this.buttonPositionDown.TabIndex = 21; this.buttonPositionDown.UseVisualStyleBackColor = false; this.buttonPositionDown.Click += new System.EventHandler(this.buttonPositionDown_Click); // // buttonSizeUp // this.buttonSizeUp.AutoSize = true; this.buttonSizeUp.BackgroundImageLayout = System.Windows.Forms.ImageLayout.None; this.buttonSizeUp.Cursor = System.Windows.Forms.Cursors.Hand; this.buttonSizeUp.Enabled = false; this.buttonSizeUp.FlatAppearance.BorderSize = 0; this.buttonSizeUp.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.buttonSizeUp.Image = global::FIS.iDET.TemplateCreator.Properties.Resources.minus_circle; this.buttonSizeUp.Location = new System.Drawing.Point(46, 553); this.buttonSizeUp.Name = "buttonSizeUp"; this.buttonSizeUp.Size = new System.Drawing.Size(30, 30); this.buttonSizeUp.TabIndex = 21; this.buttonSizeUp.UseVisualStyleBackColor = false; this.buttonSizeUp.Click += new System.EventHandler(this.buttonSizeUp_Click); // // buttonSizeRight // this.buttonSizeRight.AutoSize = true; this.buttonSizeRight.BackgroundImageLayout = System.Windows.Forms.ImageLayout.None; this.buttonSizeRight.Cursor = System.Windows.Forms.Cursors.Hand; this.buttonSizeRight.Enabled = false; this.buttonSizeRight.FlatAppearance.BorderSize = 0; this.buttonSizeRight.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.buttonSizeRight.Image = global::FIS.iDET.TemplateCreator.Properties.Resources.plus_circle; this.buttonSizeRight.Location = new System.Drawing.Point(79, 579); this.buttonSizeRight.Name = "buttonSizeRight"; this.buttonSizeRight.Size = new System.Drawing.Size(32, 32); this.buttonSizeRight.TabIndex = 21; this.buttonSizeRight.UseVisualStyleBackColor = false; this.buttonSizeRight.Click += new System.EventHandler(this.buttonSizeRight_Click); // // buttonPositionUp // this.buttonPositionUp.AutoSize = true; this.buttonPositionUp.BackgroundImageLayout = System.Windows.Forms.ImageLayout.None; this.buttonPositionUp.Cursor = System.Windows.Forms.Cursors.Hand; this.buttonPositionUp.Enabled = false; this.buttonPositionUp.FlatAppearance.BorderSize = 0; this.buttonPositionUp.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.buttonPositionUp.Image = global::FIS.iDET.TemplateCreator.Properties.Resources.arrow_up; this.buttonPositionUp.Location = new System.Drawing.Point(46, 437); this.buttonPositionUp.Name = "buttonPositionUp"; this.buttonPositionUp.Size = new System.Drawing.Size(32, 32); this.buttonPositionUp.TabIndex = 21; this.buttonPositionUp.UseVisualStyleBackColor = false; this.buttonPositionUp.Click += new System.EventHandler(this.buttonPositionUp_Click); // // buttonSizeLeft // this.buttonSizeLeft.AutoSize = true; this.buttonSizeLeft.BackgroundImageLayout = System.Windows.Forms.ImageLayout.None; this.buttonSizeLeft.Cursor = System.Windows.Forms.Cursors.Hand; this.buttonSizeLeft.Enabled = false; this.buttonSizeLeft.FlatAppearance.BorderSize = 0; this.buttonSizeLeft.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.buttonSizeLeft.Image = global::FIS.iDET.TemplateCreator.Properties.Resources.minus_circle; this.buttonSizeLeft.Location = new System.Drawing.Point(8, 580); this.buttonSizeLeft.Name = "buttonSizeLeft"; this.buttonSizeLeft.Size = new System.Drawing.Size(32, 32); this.buttonSizeLeft.TabIndex = 21; this.buttonSizeLeft.UseVisualStyleBackColor = false; this.buttonSizeLeft.Click += new System.EventHandler(this.buttonSizeLeft_Click); // // buttonPositionRight // this.buttonPositionRight.AutoSize = true; this.buttonPositionRight.BackgroundImageLayout = System.Windows.Forms.ImageLayout.None; this.buttonPositionRight.Cursor = System.Windows.Forms.Cursors.Hand; this.buttonPositionRight.Enabled = false; this.buttonPositionRight.FlatAppearance.BorderSize = 0; this.buttonPositionRight.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.buttonPositionRight.Image = global::FIS.iDET.TemplateCreator.Properties.Resources.arrow_right; this.buttonPositionRight.Location = new System.Drawing.Point(79, 464); this.buttonPositionRight.Name = "buttonPositionRight"; this.buttonPositionRight.Size = new System.Drawing.Size(30, 32); this.buttonPositionRight.TabIndex = 21; this.buttonPositionRight.UseVisualStyleBackColor = false; this.buttonPositionRight.Click += new System.EventHandler(this.buttonPositionRight_Click); // // label5 // this.label5.AutoSize = true; this.label5.Location = new System.Drawing.Point(12, 389); this.label5.Name = "label5"; this.label5.Size = new System.Drawing.Size(34, 13); this.label5.TabIndex = 20; this.label5.Text = "Rows"; // // label7 // this.label7.AutoSize = true; this.label7.Location = new System.Drawing.Point(40, 473); this.label7.Name = "label7"; this.label7.Size = new System.Drawing.Size(44, 13); this.label7.TabIndex = 20; this.label7.Text = "Position"; // // label11 // this.label11.AutoSize = true; this.label11.Location = new System.Drawing.Point(18, 530); this.label11.Name = "label11"; this.label11.Size = new System.Drawing.Size(28, 13); this.label11.TabIndex = 20; this.label11.Text = "Spin"; // // label3 // this.label3.AutoSize = true; this.label3.Location = new System.Drawing.Point(48, 590); this.label3.Name = "label3"; this.label3.Size = new System.Drawing.Size(27, 13); this.label3.TabIndex = 20; this.label3.Text = "Size"; // // buttonPositionLeft // this.buttonPositionLeft.AutoSize = true; this.buttonPositionLeft.BackgroundImageLayout = System.Windows.Forms.ImageLayout.None; this.buttonPositionLeft.Cursor = System.Windows.Forms.Cursors.Hand; this.buttonPositionLeft.Enabled = false; this.buttonPositionLeft.FlatAppearance.BorderSize = 0; this.buttonPositionLeft.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.buttonPositionLeft.Image = global::FIS.iDET.TemplateCreator.Properties.Resources.arrow_left; this.buttonPositionLeft.Location = new System.Drawing.Point(10, 464); this.buttonPositionLeft.Name = "buttonPositionLeft"; this.buttonPositionLeft.Size = new System.Drawing.Size(32, 32); this.buttonPositionLeft.TabIndex = 21; this.buttonPositionLeft.UseVisualStyleBackColor = false; this.buttonPositionLeft.Click += new System.EventHandler(this.buttonPositionLeft_Click); // // label4 // this.label4.AutoSize = true; this.label4.Location = new System.Drawing.Point(8, 336); this.label4.Name = "label4"; this.label4.Size = new System.Drawing.Size(34, 13); this.label4.TabIndex = 20; this.label4.Text = "Zoom"; // // label8 // this.label8.AutoSize = true; this.label8.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, ((System.Drawing.FontStyle)((System.Drawing.FontStyle.Bold | System.Drawing.FontStyle.Italic))), System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.label8.Location = new System.Drawing.Point(16, 365); this.label8.Name = "label8"; this.label8.Size = new System.Drawing.Size(87, 15); this.label8.TabIndex = 20; this.label8.Text = "NAVIGATION"; // // label12 // this.label12.AutoSize = true; this.label12.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, ((System.Drawing.FontStyle)((System.Drawing.FontStyle.Bold | System.Drawing.FontStyle.Italic))), System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.label12.Location = new System.Drawing.Point(35, 107); this.label12.Name = "label12"; this.label12.Size = new System.Drawing.Size(41, 15); this.label12.TabIndex = 20; this.label12.Text = "DATA"; // // label9 // this.label9.AutoSize = true; this.label9.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, ((System.Drawing.FontStyle)((System.Drawing.FontStyle.Bold | System.Drawing.FontStyle.Italic))), System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.label9.Location = new System.Drawing.Point(22, 9); this.label9.Name = "label9"; this.label9.Size = new System.Drawing.Size(78, 15); this.label9.TabIndex = 20; this.label9.Text = "TEMPLATE"; // // label2 // this.label2.AutoSize = true; this.label2.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, ((System.Drawing.FontStyle)((System.Drawing.FontStyle.Bold | System.Drawing.FontStyle.Italic))), System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.label2.Location = new System.Drawing.Point(34, 258); this.label2.Name = "label2"; this.label2.Size = new System.Drawing.Size(50, 15); this.label2.TabIndex = 20; this.label2.Text = "IMAGE"; // // buttonRowHeight // this.buttonRowHeight.Enabled = false; this.buttonRowHeight.Location = new System.Drawing.Point(12, 411); this.buttonRowHeight.Name = "buttonRowHeight"; this.buttonRowHeight.Size = new System.Drawing.Size(101, 22); this.buttonRowHeight.TabIndex = 2; this.buttonRowHeight.Text = "Cal Row Height"; this.buttonRowHeight.UseVisualStyleBackColor = true; this.buttonRowHeight.Click += new System.EventHandler(this.buttonRowHeight_Click); // // buttonPreviousPage // this.buttonPreviousPage.Enabled = false; this.buttonPreviousPage.Image = global::FIS.iDET.TemplateCreator.Properties.Resources.arrow_transition_180; this.buttonPreviousPage.Location = new System.Drawing.Point(76, 304); this.buttonPreviousPage.Name = "buttonPreviousPage"; this.buttonPreviousPage.Size = new System.Drawing.Size(23, 22); this.buttonPreviousPage.TabIndex = 2; this.buttonPreviousPage.UseVisualStyleBackColor = true; this.buttonPreviousPage.Click += new System.EventHandler(this.buttonPreviousPage_Click); // // buttonNextPage // this.buttonNextPage.Enabled = false; this.buttonNextPage.Image = global::FIS.iDET.TemplateCreator.Properties.Resources.arrow_transition; this.buttonNextPage.Location = new System.Drawing.Point(99, 304); this.buttonNextPage.Name = "buttonNextPage"; this.buttonNextPage.Size = new System.Drawing.Size(23, 22); this.buttonNextPage.TabIndex = 2; this.buttonNextPage.UseVisualStyleBackColor = true; this.buttonNextPage.Click += new System.EventHandler(this.buttonNextPage_Click); // // numericUpDown1 // this.numericUpDown1.Enabled = false; this.numericUpDown1.Location = new System.Drawing.Point(1086, 2); this.numericUpDown1.Name = "numericUpDown1"; this.numericUpDown1.Size = new System.Drawing.Size(40, 20); this.numericUpDown1.TabIndex = 23; this.numericUpDown1.Visible = false; this.numericUpDown1.ValueChanged += new System.EventHandler(this.numericUpDown1_ValueChanged); // // label6 // this.label6.AutoSize = true; this.label6.Location = new System.Drawing.Point(1029, 4); this.label6.Name = "label6"; this.label6.Size = new System.Drawing.Size(50, 13); this.label6.TabIndex = 20; this.label6.Text = "Navigate"; this.label6.Visible = false; // // panel3 // this.panel3.Controls.Add(this.label10); this.panel3.Controls.Add(this.numericUpDown1); this.panel3.Controls.Add(this.label6); this.panel3.Dock = System.Windows.Forms.DockStyle.Bottom; this.panel3.Location = new System.Drawing.Point(0, 679); this.panel3.Name = "panel3"; this.panel3.Size = new System.Drawing.Size(1160, 22); this.panel3.TabIndex = 22; // // label10 // this.label10.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); this.label10.AutoSize = true; this.label10.Location = new System.Drawing.Point(12, 2); this.label10.Name = "label10"; this.label10.Size = new System.Drawing.Size(324, 13); this.label10.TabIndex = 12; this.label10.Text = "Copyright © by FPT Information System, FPT BPO Services Center."; // // buttonExit // this.buttonExit.Location = new System.Drawing.Point(13, 673); this.buttonExit.Name = "buttonExit"; this.buttonExit.Size = new System.Drawing.Size(101, 22); this.buttonExit.TabIndex = 2; this.buttonExit.Text = "Exit"; this.buttonExit.UseVisualStyleBackColor = true; this.buttonExit.Click += new System.EventHandler(this.buttonExit_Click); // // buttonAbout // this.buttonAbout.Location = new System.Drawing.Point(13, 647); this.buttonAbout.Name = "buttonAbout"; this.buttonAbout.Size = new System.Drawing.Size(101, 22); this.buttonAbout.TabIndex = 2; this.buttonAbout.Text = "About"; this.buttonAbout.UseVisualStyleBackColor = true; this.buttonAbout.Click += new System.EventHandler(this.buttonAbout_Click); // // FormTemplateCreator // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(1284, 701); this.Controls.Add(this.panel3); this.Controls.Add(this.panel2); this.Controls.Add(this.panel1); this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); this.Name = "FormTemplateCreator"; this.Text = "FIS.iDET Template Creator"; this.WindowState = System.Windows.Forms.FormWindowState.Maximized; this.Load += new System.EventHandler(this.FormTemplateCreator_Load); ((System.ComponentModel.ISupportInitialize)(this.dataGridView)).EndInit(); this.panelPictBox.ResumeLayout(false); this.panelPictBox.PerformLayout(); ((System.ComponentModel.ISupportInitialize)(this.pictBox)).EndInit(); this.panel1.ResumeLayout(false); this.panel1.PerformLayout(); this.panel2.ResumeLayout(false); this.panel2.PerformLayout(); ((System.ComponentModel.ISupportInitialize)(this.numericSpin)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).EndInit(); this.panel3.ResumeLayout(false); this.panel3.PerformLayout(); this.ResumeLayout(false); } #endregion public System.Windows.Forms.DataGridView dataGridView; private System.Windows.Forms.Button createButton; private System.Windows.Forms.Button editButton; private System.Windows.Forms.Button deleteButton; private System.Windows.Forms.Button saveButton; private System.Windows.Forms.Button newButton; private System.Windows.Forms.Button loadButton; private System.Windows.Forms.PictureBox pictBox; private System.Windows.Forms.Label label1; private System.Windows.Forms.Panel panelPictBox; private System.Windows.Forms.Button buttonLoadImage; private System.Windows.Forms.TextBox textBoxPageNumber; private System.Windows.Forms.Label labelPage; private System.Windows.Forms.Button buttonPreviousPage; private System.Windows.Forms.Button buttonNextPage; public System.Windows.Forms.ComboBox comboBoxZoomRatio; public System.Windows.Forms.CheckBox checkBoxPageNumber; private System.Windows.Forms.ComboBox comboBoxPageCol; private System.Windows.Forms.Panel panel1; private System.Windows.Forms.Panel panel2; private System.Windows.Forms.Panel panel3; private System.Windows.Forms.Button buttonSizeDown; private System.Windows.Forms.Button buttonPositionDown; private System.Windows.Forms.Button buttonSizeUp; private System.Windows.Forms.Button buttonSizeRight; private System.Windows.Forms.Button buttonPositionUp; private System.Windows.Forms.Button buttonSizeLeft; private System.Windows.Forms.Button buttonPositionRight; private System.Windows.Forms.Label label3; private System.Windows.Forms.Button buttonPositionLeft; private System.Windows.Forms.Label label2; private System.Windows.Forms.TextBox textBoxRowsNumber; private System.Windows.Forms.NumericUpDown numericUpDown1; private System.Windows.Forms.Label label6; private System.Windows.Forms.Label label5; private System.Windows.Forms.Label label7; private System.Windows.Forms.Label label4; private System.Windows.Forms.Label label8; private System.Windows.Forms.Label label9; private System.Windows.Forms.Button buttonRowHeight; private System.Windows.Forms.Label label10; private System.Windows.Forms.Label label12; private System.Windows.Forms.NumericUpDown numericSpin; private System.Windows.Forms.Label label11; private System.Windows.Forms.Button buttonAbout; private System.Windows.Forms.Button buttonExit; } }
2atgroup
TiffBrowserTestCSharp/Template Creator/FormTemplateCreator.Designer.cs
C#
Microsoft Reciprocal License (Ms-RL)
41,552
using System; using System.Collections.Generic; using System.Text; using System.IO; using System.Windows.Forms; namespace FIS.iDET.TemplateCreator { public class GlobalConstants { /* VARIABLES */ // username public static string Username = "No Name"; //version public static string stringVersion = "FIS.iDET Template Creator Tool \nVersion 2.0.0 Pre-Final"; // data columns info public static void OptionInit() { // get user name Username = RegistryService.GetValue(REGISTRY_USER_NAME) == null ? "No Name" : RegistryService.GetValue(REGISTRY_USER_NAME).Trim(); // date format index } /*** CONSTANTS ***/ // secret key used to generate serial number from machine ID public const string SERIAL_SECRET_KEY = "aed45dba1f73080de226c193d3f9d605"; // Company name, mainly used for folder naming public const string COMPANY_NAME = "FPT BPO iDET"; /* registry */ // Default path of registry to store serial number public const string REGISTRY_PATH = "Software\\" + COMPANY_NAME; // serial number string name public const string REGISTRY_SERIAL_NUMBER_KEY = "Serial"; // user name public const string REGISTRY_USER_NAME = "UN"; // no user name public const string REGISTRY_USER_NAME_NO_NAME = "No name"; } }
2atgroup
TiffBrowserTestCSharp/Template Creator/GlobalConstants.cs
C#
Microsoft Reciprocal License (Ms-RL)
1,488
using System; using System.Collections.Generic; using System.Text; namespace FIS.iDET.TemplateCreator { class GlobalVariables { public static string Version = "Version 2.1.0"; // current version of template creator public static string TemplateVersion = "2.0.6"; public const bool IsTri = false; public static DateTime ExpDate = new DateTime(2013, 2, 28); // data public static List<DataColumn> columns = new List<DataColumn>(); public static int TemplatePageCol = 0; // Image public static int spint = 1; } }
2atgroup
TiffBrowserTestCSharp/Template Creator/GlobalVariables.cs
C#
Microsoft Reciprocal License (Ms-RL)
648
using System; using System.Drawing; using System.Drawing.Imaging; using System.Windows.Forms; namespace FIS.iDET.TemplateCreator { public class ImageService { string imageFileName; Bitmap tifImage; int totalFrames, currentFrame; Boolean fileLoadedOK = true; public ImageService() { fileLoadedOK = false; } public ImageService(string imageFileName) { this.imageFileName = imageFileName; LoadTifFile(); } public string FileName { get { return imageFileName; } set { imageFileName = value; LoadTifFile(); } } public int TotalFrames { get { return totalFrames; } set { totalFrames = value; } } public int Width { get { return tifImage.Width; } } public int Height { get { return tifImage.Height; } } public int CurrentFrame { get { return currentFrame; } set { currentFrame = value; } } public Boolean FileLoadedOK { get { return fileLoadedOK; } } private void LoadTifFile() { try { // decode tif image into bitmap tifImage = new Bitmap(imageFileName); // get total number of pages totalFrames = tifImage.GetFrameCount(FrameDimension.Page); } catch { fileLoadedOK = false; MessageBox.Show("Cannot load image file, please check if it is a valid TIFF image.", "Invalid image", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } private double zoomFactor = 1; public Bitmap GetImageZoom(double zoomFactor, DoubleRectangle rect) { return GetImageZoom(zoomFactor, rect, false); } public Bitmap GetImageZoom(double zoomFactor, DoubleRectangle rect, bool mode) // mode = 1 , draw multiple Rect { // calculate Zoom size this.zoomFactor = zoomFactor; int zoomWidth = scaleUp(Width); int zoomHeight = scaleUp(Height); // create a new empty temporary bitmap Bitmap tmp = new Bitmap(zoomWidth, zoomHeight); tmp.SetResolution(tifImage.HorizontalResolution, tifImage.VerticalResolution); // create new graphic object Graphics g = Graphics.FromImage(tmp); g.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.High; // Zoom here Rectangle srcRect = new Rectangle(0, 0, (int) Width, (int) Height); Rectangle desRect = new Rectangle(0, 0, (int) zoomWidth, (int) zoomHeight); g.DrawImage(tifImage, desRect, srcRect, GraphicsUnit.Pixel); // draw rulers float penStrokeWidth = (float)zoomFactor * 4; Pen penRed = new Pen(Color.Orange, penStrokeWidth); penRed.Alignment = System.Drawing.Drawing2D.PenAlignment.Outset; var intRect = new Rectangle(); if (!mode) { intRect.X = scaleUp(rect.X); intRect.Y = scaleUp(rect.Y); intRect.Width = scaleUp(rect.Width); intRect.Height = scaleUp(rect.Height); if (rect.Width != 0 && rect.Height != 0) { g.DrawRectangle(penRed, intRect); } } else { for (int i = 1; i <= FormTemplateCreator.rows; i++) { if (rect.Width != 0 && rect.Height != 0) { intRect.Width = scaleUp(rect.Width); intRect.Height = scaleUp(rect.Height); intRect.X = scaleUp(rect.X); intRect.Y = scaleUp(rect.Y + rect.Height * (i - 1)); g.DrawRectangle(penRed, intRect); } } } // release Resource g.Dispose(); GC.Collect(); return tmp; } public Bitmap GetImageZoom(double zoomFactor) { // calculate Zoom size this.zoomFactor = zoomFactor; int zoomWidth = scaleUp(Width); int zoomHeight = scaleUp(Height); // create a new empty temporary bitmap Bitmap tmp = new Bitmap(zoomWidth, zoomHeight); tmp.SetResolution(tifImage.HorizontalResolution, tifImage.VerticalResolution); // create new graphic object Graphics g = Graphics.FromImage(tmp); g.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.High; // Zoom here Rectangle srcRect = new Rectangle(0, 0, Width, Height); Rectangle desRect = new Rectangle(0, 0, zoomWidth, zoomHeight); g.DrawImage(tifImage, desRect, srcRect, GraphicsUnit.Pixel); // release Resource g.Dispose(); GC.Collect(); return tmp; } private int scaleUp(double original) { return (int) Math.Round(original * zoomFactor); } public void SetImageFrame(int frameToDisplay) { if (frameToDisplay >= 0 && frameToDisplay < totalFrames) currentFrame = frameToDisplay; // set active frame tifImage.SelectActiveFrame(FrameDimension.Page, currentFrame); } public Bitmap GetImageFrame(int frameToDisplay, double zoomFactor, DoubleRectangle rect) { SetImageFrame(frameToDisplay); return GetImageZoom(zoomFactor, rect,true); } } }
2atgroup
TiffBrowserTestCSharp/Template Creator/ImageService.cs
C#
Microsoft Reciprocal License (Ms-RL)
6,597
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; using Microsoft.Win32; using System.Text.RegularExpressions; namespace FIS.iDET.TemplateCreator { public partial class LicenseKeyForm : Form { public LicenseKeyForm() { InitializeComponent(); } private void LicenseKeyForm_Load(object sender, EventArgs e) { textBoxMachineID.Text = LicenseService.GetMachineID(); } private void buttonExit_Click(object sender, EventArgs e) { Application.ExitThread(); } private void buttonActivate_Click(object sender, EventArgs e) { string serialToCheck = textBoxLicenseKey.Text.Trim().ToUpper(); if (LicenseService.IsSerialNumberCorrect(serialToCheck)) { // activation succeeds // informs user MessageBox.Show("Activation succeeds! Application will now close, please re-open application to start using it.", "Activation succeeds", MessageBoxButtons.OK, MessageBoxIcon.Information); // add valid serial number to registry RegistryService.SetValue(GlobalConstants.REGISTRY_SERIAL_NUMBER_KEY, serialToCheck); // add user name to registry RegistryService.SetValue(GlobalConstants.REGISTRY_USER_NAME, textBoxUserName.Text); // exit app to finish activation Application.ExitThread(); } else { // activation fails MessageBox.Show("Wrong serial number!", "Activation fails", MessageBoxButtons.OK, MessageBoxIcon.Error); textBoxLicenseKey.Focus(); } } private void textBoxLicenseKey_TextChanged(object sender, EventArgs e) { // check if serial number form is valid string serial = textBoxLicenseKey.Text.Trim().ToUpper(); Match match = Regex.Match( serial, @"[A-F0-9]{4}-[A-F0-9]{4}-[A-F0-9]{4}-[A-F0-9]{4}-[A-F0-9]{4}-[A-F0-9]{4}-[A-F0-9]{4}-[A-F0-9]{4}" ); // change activate button status due to validation of user input's serial number labelActivate.Enabled = match.Success; } } }
2atgroup
TiffBrowserTestCSharp/Template Creator/LicenseKeyForm.cs
C#
Microsoft Reciprocal License (Ms-RL)
2,617
namespace FIS.iDET.TemplateCreator { partial class LicenseKeyForm { /// <summary> /// Required designer variable. /// </summary> private System.ComponentModel.IContainer components = null; /// <summary> /// Clean up any resources being used. /// </summary> /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param> protected override void Dispose(bool disposing) { if (disposing && (components != null)) { components.Dispose(); } base.Dispose(disposing); } #region Windows Form Designer generated code /// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(LicenseKeyForm)); this.label1 = new System.Windows.Forms.Label(); this.label3 = new System.Windows.Forms.Label(); this.textBoxLicenseKey = new System.Windows.Forms.TextBox(); this.textBoxMachineID = new System.Windows.Forms.TextBox(); this.label2 = new System.Windows.Forms.Label(); this.labelActivate = new System.Windows.Forms.Label(); this.labelExit = new System.Windows.Forms.Label(); this.label6 = new System.Windows.Forms.Label(); this.textBoxUserName = new System.Windows.Forms.TextBox(); this.SuspendLayout(); // // label1 // this.label1.AutoSize = true; this.label1.Font = new System.Drawing.Font("Arial", 18F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.label1.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(173)))), ((int)(((byte)(7)))), ((int)(((byte)(101))))); this.label1.Location = new System.Drawing.Point(32, 20); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(568, 29); this.label1.TabIndex = 0; this.label1.Text = "Application is not activated for this machine yet!"; // // label3 // this.label3.AutoSize = true; this.label3.Font = new System.Drawing.Font("Arial", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.label3.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(15)))), ((int)(((byte)(59)))), ((int)(((byte)(74))))); this.label3.Location = new System.Drawing.Point(35, 64); this.label3.Name = "label3"; this.label3.Size = new System.Drawing.Size(133, 19); this.label3.TabIndex = 0; this.label3.Text = "Your machine ID"; // // textBoxLicenseKey // this.textBoxLicenseKey.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; this.textBoxLicenseKey.Font = new System.Drawing.Font("Arial", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.textBoxLicenseKey.Location = new System.Drawing.Point(37, 220); this.textBoxLicenseKey.MaxLength = 39; this.textBoxLicenseKey.Name = "textBoxLicenseKey"; this.textBoxLicenseKey.Size = new System.Drawing.Size(626, 29); this.textBoxLicenseKey.TabIndex = 2; this.textBoxLicenseKey.TextChanged += new System.EventHandler(this.textBoxLicenseKey_TextChanged); // // textBoxMachineID // this.textBoxMachineID.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; this.textBoxMachineID.Font = new System.Drawing.Font("Arial", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.textBoxMachineID.Location = new System.Drawing.Point(37, 86); this.textBoxMachineID.MaxLength = 39; this.textBoxMachineID.Name = "textBoxMachineID"; this.textBoxMachineID.ReadOnly = true; this.textBoxMachineID.Size = new System.Drawing.Size(626, 29); this.textBoxMachineID.TabIndex = 3; // // label2 // this.label2.AutoSize = true; this.label2.Font = new System.Drawing.Font("Arial", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.label2.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(15)))), ((int)(((byte)(59)))), ((int)(((byte)(74))))); this.label2.Location = new System.Drawing.Point(33, 198); this.label2.Name = "label2"; this.label2.Size = new System.Drawing.Size(289, 19); this.label2.TabIndex = 0; this.label2.Text = "Serial Number (from IT administrator)"; // // labelActivate // this.labelActivate.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(8)))), ((int)(((byte)(96)))), ((int)(((byte)(76))))); this.labelActivate.Enabled = false; this.labelActivate.Font = new System.Drawing.Font("Arial", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.labelActivate.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(163)))), ((int)(((byte)(223)))), ((int)(((byte)(47))))); this.labelActivate.Location = new System.Drawing.Point(158, 267); this.labelActivate.Name = "labelActivate"; this.labelActivate.Size = new System.Drawing.Size(121, 37); this.labelActivate.TabIndex = 4; this.labelActivate.Text = "Activate"; this.labelActivate.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; this.labelActivate.Click += new System.EventHandler(this.buttonActivate_Click); // // labelExit // this.labelExit.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(36)))), ((int)(((byte)(46)))), ((int)(((byte)(63))))); this.labelExit.Font = new System.Drawing.Font("Arial", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.labelExit.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(167)))), ((int)(((byte)(173)))), ((int)(((byte)(184))))); this.labelExit.Location = new System.Drawing.Point(408, 267); this.labelExit.Name = "labelExit"; this.labelExit.Size = new System.Drawing.Size(121, 37); this.labelExit.TabIndex = 4; this.labelExit.Text = "Exit"; this.labelExit.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; this.labelExit.Click += new System.EventHandler(this.buttonExit_Click); // // label6 // this.label6.AutoSize = true; this.label6.Font = new System.Drawing.Font("Arial", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.label6.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(15)))), ((int)(((byte)(59)))), ((int)(((byte)(74))))); this.label6.Location = new System.Drawing.Point(33, 131); this.label6.Name = "label6"; this.label6.Size = new System.Drawing.Size(117, 19); this.label6.TabIndex = 0; this.label6.Text = "Your full name"; // // textBoxUserName // this.textBoxUserName.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; this.textBoxUserName.Font = new System.Drawing.Font("Arial", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.textBoxUserName.Location = new System.Drawing.Point(37, 153); this.textBoxUserName.MaxLength = 50; this.textBoxUserName.Name = "textBoxUserName"; this.textBoxUserName.Size = new System.Drawing.Size(626, 29); this.textBoxUserName.TabIndex = 2; // // LicenseKeyForm // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(118)))), ((int)(((byte)(164)))), ((int)(((byte)(200))))); this.ClientSize = new System.Drawing.Size(703, 323); this.Controls.Add(this.labelExit); this.Controls.Add(this.labelActivate); this.Controls.Add(this.textBoxMachineID); this.Controls.Add(this.textBoxUserName); this.Controls.Add(this.label6); this.Controls.Add(this.textBoxLicenseKey); this.Controls.Add(this.label2); this.Controls.Add(this.label3); this.Controls.Add(this.label1); this.ForeColor = System.Drawing.SystemColors.ActiveCaptionText; this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); this.MaximizeBox = false; this.MinimizeBox = false; this.Name = "LicenseKeyForm"; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; this.Text = "FIS.iDET Registration"; this.Load += new System.EventHandler(this.LicenseKeyForm_Load); this.ResumeLayout(false); this.PerformLayout(); } #endregion private System.Windows.Forms.Label label1; private System.Windows.Forms.Label label3; private System.Windows.Forms.TextBox textBoxLicenseKey; private System.Windows.Forms.TextBox textBoxMachineID; private System.Windows.Forms.Label label2; private System.Windows.Forms.Label labelActivate; private System.Windows.Forms.Label labelExit; private System.Windows.Forms.Label label6; private System.Windows.Forms.TextBox textBoxUserName; } }
2atgroup
TiffBrowserTestCSharp/Template Creator/LicenseKeyForm.Designer.cs
C#
Microsoft Reciprocal License (Ms-RL)
10,595
using System; using System.Security.Cryptography; using System.Text; namespace FIS.iDET.TemplateCreator { /// <summary> /// Generates a 16 byte Unique Identification code of a computer /// Example: 1234-8DB5-5763-69D3-FE52-8CF7-395D-2EA9 /// </summary> public class LicenseService { private static string MachineID = null; private static string ValidSerial = null; public static Boolean AppIsActivated() { string serialToCheck = RegistryService.GetValue(GlobalConstants.REGISTRY_SERIAL_NUMBER_KEY); return IsSerialNumberCorrect(serialToCheck); } /// <summary> /// gets the unique ID of current machine /// </summary> public static string GetMachineID() { // calculate machine ID for first time if (MachineID == null) { MachineID = GetHash( "CPU >> " + cpuId() + "\nBIOS >> " + biosId() //"\nBASE >> " + baseId() + //"\nDISK >> "+ diskId() + //"\nVIDEO >> " + videoId() + //"\nMAC >> " + macId() ); } return MachineID; } /// <summary> /// calculate serial number for a machine ID /// </summary> /// <param name="machineID"></param> /// <returns></returns> public static string GenerateSerialNumberFrom(string anyMachineID) { String serial = GetHash( "ID >> " + anyMachineID + "Secret >> " + GlobalConstants.SERIAL_SECRET_KEY ); return serial; } public static Boolean IsSerialNumberCorrect(string serialToCheck) { if (String.IsNullOrEmpty(serialToCheck)) return false; // normalize input serial serialToCheck = serialToCheck.Trim().ToUpper(); // calculate valid serial if needed if (ValidSerial == null) { if (MachineID == null) { GetMachineID(); } ValidSerial = GenerateSerialNumberFrom(MachineID); } return serialToCheck == ValidSerial; } /// <summary> /// generate 16-byte hash of a string /// </summary> /// <param name="s">input string</param> /// <returns>16-byte hash string</returns> private static string GetHash(string s) { MD5 sec = new MD5CryptoServiceProvider(); ASCIIEncoding enc = new ASCIIEncoding(); byte[] bt = enc.GetBytes(s); return GetHexString(sec.ComputeHash(bt)); } /// <summary> /// intended to be used by GetHash() /// </summary> /// <param name="bt">input string</param> /// <returns>hex string</returns> private static string GetHexString(byte[] bt) { string s = string.Empty; for (int i = 0; i < bt.Length; i++) { byte b = bt[i]; int n, n1, n2; n = (int)b; n1 = n & 15; n2 = (n >> 4) & 15; if (n2 > 9) s += ((char)(n2 - 10 + (int)'A')).ToString(); else s += n2.ToString(); if (n1 > 9) s += ((char)(n1 - 10 + (int)'A')).ToString(); else s += n1.ToString(); if ((i + 1) != bt.Length && (i + 1) % 2 == 0) s += "-"; } return s; } #region Original Device ID Getting Code //Return a hardware identifier private static string identifier(string wmiClass, string wmiProperty, string wmiMustBeTrue) { string result = ""; System.Management.ManagementClass mc = new System.Management.ManagementClass(wmiClass); System.Management.ManagementObjectCollection moc = mc.GetInstances(); foreach (System.Management.ManagementObject mo in moc) { if (mo[wmiMustBeTrue].ToString() == "True") { //Only get the first one if (result == "") { try { result = mo[wmiProperty].ToString(); break; } catch { } } } } return result; } //Return a hardware identifier private static string identifier(string wmiClass, string wmiProperty) { string result = ""; System.Management.ManagementClass mc = new System.Management.ManagementClass(wmiClass); System.Management.ManagementObjectCollection moc = mc.GetInstances(); foreach (System.Management.ManagementObject mo in moc) { //Only get the first one if (result == "") { try { if (mo[wmiProperty]!=null) result = mo[wmiProperty].ToString(); break; } catch { } } } return result; } private static string cpuId() { //Uses first CPU identifier available in order of preference //Don't get all identifiers, as it is very time consuming string retVal = identifier("Win32_Processor", "UniqueId"); if (retVal == "") //If no UniqueID, use ProcessorID { retVal = identifier("Win32_Processor", "ProcessorId"); if (retVal == "") //If no ProcessorId, use Name { retVal = identifier("Win32_Processor", "Name"); if (retVal == "") //If no Name, use Manufacturer { retVal = identifier("Win32_Processor", "Manufacturer"); } //Add clock speed for extra security retVal += identifier("Win32_Processor", "MaxClockSpeed"); } } return retVal; } //BIOS Identifier private static string biosId() { return identifier("Win32_BIOS", "Manufacturer") + identifier("Win32_BIOS", "SMBIOSBIOSVersion") + identifier("Win32_BIOS", "IdentificationCode") + identifier("Win32_BIOS", "SerialNumber") + identifier("Win32_BIOS", "ReleaseDate") + identifier("Win32_BIOS", "Version"); } //Main physical hard drive ID private static string diskId() { return identifier("Win32_DiskDrive", "Model") + identifier("Win32_DiskDrive", "Manufacturer") + identifier("Win32_DiskDrive", "Signature") + identifier("Win32_DiskDrive", "TotalHeads"); } //Motherboard ID private static string baseId() { return identifier("Win32_BaseBoard", "Model") + identifier("Win32_BaseBoard", "Manufacturer") + identifier("Win32_BaseBoard", "Name") + identifier("Win32_BaseBoard", "SerialNumber"); } //Primary video controller ID private static string videoId() { return identifier("Win32_VideoController", "DriverVersion") + identifier("Win32_VideoController", "Name"); } //First enabled network card ID private static string macId() { return identifier("Win32_NetworkAdapterConfiguration", "MACAddress", "IPEnabled"); } #endregion } }
2atgroup
TiffBrowserTestCSharp/Template Creator/LicenseService.cs
C#
Microsoft Reciprocal License (Ms-RL)
8,446
using System; using System.Collections.Generic; using System.Windows.Forms; namespace FIS.iDET.TemplateCreator { static class Program { /// <summary> /// The main entry point for the application. /// </summary> [STAThread] static void Main() { if (GlobalVariables.IsTri && DateTime.Now.CompareTo(GlobalVariables.ExpDate) > 0) { MessageBox.Show("Date_Time_Problem, contact developer !"); return; } Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new FormTemplateCreator()); } } }
2atgroup
TiffBrowserTestCSharp/Template Creator/Program.cs
C#
Microsoft Reciprocal License (Ms-RL)
738
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("Template Creator")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Developed by Revo21 Studio <hoang@revo21studio.com>")] [assembly: AssemblyProduct("Template Creator")] [assembly: AssemblyCopyright("Copyright © 2012 Developed by Revo21")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("1eb1457c-837f-4dc8-b52b-6e9c8982e00c")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("2.0.6.0")] [assembly: AssemblyFileVersion("2.0.6.0")]
2atgroup
TiffBrowserTestCSharp/Template Creator/Properties/AssemblyInfo.cs
C#
Microsoft Reciprocal License (Ms-RL)
1,514
using System; using System.Collections.Generic; using System.Text; using Microsoft.Win32; using System.Windows.Forms; namespace FIS.iDET.TemplateCreator { public class RegistryService { private static RegistryKey appRegistryKey = Registry.CurrentUser.OpenSubKey(GlobalConstants.REGISTRY_PATH, true); private static RegistryKey appRegistryLicenseKey = Registry.LocalMachine.OpenSubKey(GlobalConstants.REGISTRY_PATH, false); public static void Init() { // in case key does not exist if (appRegistryKey == null) { // create new one Registry.CurrentUser.CreateSubKey(GlobalConstants.REGISTRY_PATH); appRegistryKey = Registry.CurrentUser.OpenSubKey(GlobalConstants.REGISTRY_PATH, true); } try { if (appRegistryLicenseKey == null) { Registry.LocalMachine.CreateSubKey(GlobalConstants.REGISTRY_PATH); appRegistryLicenseKey = Registry.LocalMachine.OpenSubKey(GlobalConstants.REGISTRY_PATH, true); } } catch { MessageBox.Show("Your application hasn't been activated. Please run under administrative rights to active it!","Administrator Request",MessageBoxButtons.OK,MessageBoxIcon.Stop); Application.Exit(); } } /// <summary> /// gets application registry value from a key /// </summary> /// <param name="name">key name</param> /// <returns>key's value</returns> public static string GetValue(string name) { try { if (name == GlobalConstants.REGISTRY_SERIAL_NUMBER_KEY || name == GlobalConstants.REGISTRY_USER_NAME) return appRegistryLicenseKey.GetValue(name) as string; else return appRegistryKey.GetValue(name) as string; } catch (Exception ex) { MessageBox.Show("Error while reading from registry key \"" + appRegistryKey.ToString() + "\": " + ex.Message); return null; } } /// <summary> /// set application registry value to a key /// </summary> /// <param name="name">key name</param> /// <param name="value">new value to set to key</param> public static void SetValue(string name, string value) { try { if (name == GlobalConstants.REGISTRY_SERIAL_NUMBER_KEY || name == GlobalConstants.REGISTRY_USER_NAME) { //grant write permisson appRegistryLicenseKey = Registry.LocalMachine.OpenSubKey(GlobalConstants.REGISTRY_PATH, true); appRegistryLicenseKey.SetValue(name, value); appRegistryLicenseKey.Flush(); } else { appRegistryKey.SetValue(name, value); appRegistryKey.Flush(); } } catch { MessageBox.Show("Error while writing to registry key. Please call IT for support.", "Administrative Rights Needed",MessageBoxButtons.OK,MessageBoxIcon.Warning); } } } }
2atgroup
TiffBrowserTestCSharp/Template Creator/RegistryService.cs
C#
Microsoft Reciprocal License (Ms-RL)
3,516
using System; using System.Collections.Generic; using System.Xml; using System.IO; using System.Text; using System.Windows.Forms; namespace FIS.iDET.TemplateCreator { class XmlService { public static List<DataColumn> ReadXml(string fromFile) { try { FileStream fs = new FileStream(fromFile, FileMode.Open); XmlTextReader r = new XmlTextReader(fs); // array to store processed data List<DataColumn> columns = new List<DataColumn>(); // read column nodes while (r.Read()) { if (r.NodeType == XmlNodeType.Element && r.Name == "template") { // set template properties to global vars // GlobalConstants.TemplateName = r.GetAttribute("name"); FormTemplateCreator.zoomFactor = Convert.ToDouble(r.GetAttribute("zoom")) / 100; GlobalVariables.TemplateVersion = r.GetAttribute("version"); GlobalVariables.TemplatePageCol = Convert.ToInt32(r.GetAttribute("pagecol")); // break; } // get header text from current node's name if (r.NodeType == XmlNodeType.Element && r.Name == "col") { columns.Add( new DataColumn( r.GetAttribute("fieldname"), Convert.ToInt32(r.GetAttribute("datatype")), Convert.ToInt32(r.GetAttribute("colwidth")), Convert.ToDouble(r.GetAttribute("x")), Convert.ToDouble(r.GetAttribute("y")), Convert.ToDouble(r.GetAttribute("w")), Convert.ToDouble(r.GetAttribute("h")))); } } fs.Close(); return columns; } catch (Exception ex) { MessageBox.Show("Unexpected error while loading template file \"" + fromFile + "\"\nError details: " + ex.Message); return null; } } public static void WriteXml(string toFile, DataGridView dataGridView) { try { FileStream fs = new FileStream(toFile, FileMode.Create, FileAccess.Write); XmlTextWriter w = new XmlTextWriter(fs, Encoding.UTF8); w.Formatting = Formatting.Indented; w.Indentation = 4; w.WriteStartDocument(); // root node // <template zoom="100%" version="2.0"> w.WriteStartElement("template"); w.WriteAttributeString("zoom", (FormTemplateCreator.zoomFactor * 100).ToString()); w.WriteAttributeString("version", GlobalVariables.TemplateVersion); if (GlobalVariables.TemplatePageCol !=0) { w.WriteAttributeString("pagecol", GlobalVariables.TemplatePageCol.ToString()); } // element nodes // <col name="Field Name" datatype="number or text or date" width="100"/> // sort columns to display index int[] a = new int[dataGridView.ColumnCount]; int[] b = new int[dataGridView.ColumnCount]; for (int i = 0; i < dataGridView.ColumnCount; i++) { b[i] = dataGridView.Columns[i].DisplayIndex; } for (int i = 0; i < dataGridView.ColumnCount; i++) for (int j = 0; j < dataGridView.ColumnCount; j++) { if (b[j] == i) { a[i] = j; break; } } for (int j = 0; j < dataGridView.ColumnCount; j++) { int i = a[j]; w.WriteStartElement("col"); w.WriteAttributeString("fieldname", dataGridView.Columns[i].HeaderText); w.WriteAttributeString("datatype", getDataTypeShortNameOf(dataGridView.Rows[0].Cells[i].Value.ToString())); w.WriteAttributeString("colwidth", dataGridView.Columns[i].Width.ToString()); w.WriteAttributeString("x", GlobalVariables.columns[i].X.ToString()); w.WriteAttributeString("y", GlobalVariables.columns[i].Y.ToString()); w.WriteAttributeString("w", GlobalVariables.columns[i].W.ToString()); w.WriteAttributeString("h", GlobalVariables.columns[i].H.ToString()); w.WriteEndElement(); } // close xml tags w.WriteEndElement(); w.WriteEndDocument(); // close document w.Flush(); fs.Close(); MessageBox.Show("Template file saved to \"" + toFile + "\" successfully!"); } catch (Exception ex) { MessageBox.Show("Unexpected error while saving file to \"" + toFile + "\"\nError details: " + ex.Message); } } public static string getDataTypeShortNameOf(string longName) { if (longName == "Date Time") return DataTypeEnum.COLUMN_TYPE_DATE.ToString(); else if (longName == "Number") return DataTypeEnum.COLUMN_TYPE_NUMBER.ToString(); else return DataTypeEnum.COLUMN_TYPE_TEXT.ToString(); } public static string getDataTypeLongNameOf(int shortName) { switch (shortName) { case DataTypeEnum.COLUMN_TYPE_DATE: return "Date Time"; case DataTypeEnum.COLUMN_TYPE_NUMBER: return "Number"; default: return "General Text"; } } } }
2atgroup
TiffBrowserTestCSharp/Template Creator/XmlService.cs
C#
Microsoft Reciprocal License (Ms-RL)
6,435
using System; using System.Windows.Forms; namespace FIS.iDET { public class ClipboardUtils { public static void OnDataGridPaste(object grid, KeyEventArgs e) { //MessageBox.Show(e.KeyCode.ToString()); if (e.Control ) if ( e.KeyCode == Keys.V) PasteFromClipboard((DataGridView)grid); else if ( e.KeyCode == Keys.Oem7) PasteFromUpper((DataGridView)grid); if (e.KeyCode == Keys.Delete) DeleteSelectedArea((DataGridView)grid); } public static void DeleteSelectedArea(DataGridView grid) { for (int i = 0; i < grid.SelectedCells.Count; i++) grid.SelectedCells[i].Value = null; } public static void PasteFromUpper(DataGridView grid) { int currentRow = grid.SelectedCells[0].RowIndex; int currentColumn = grid.SelectedCells[0].ColumnIndex; if (grid.SelectedCells.Count > 1) { // choose the 1st cell for (int i = 1; i < grid.SelectedCells.Count; i++) { if (currentRow > grid.SelectedCells[i].RowIndex) currentRow = grid.SelectedCells[i].RowIndex; if (currentColumn > grid.SelectedCells[i].ColumnIndex) currentColumn = grid.SelectedCells[i].ColumnIndex; } DataGridViewCell cell = grid[currentColumn, currentRow]; // if 1st cell null if (cell.Value == null && currentRow>0 ) if (!cell.ReadOnly) //H.NH add cell.Value = grid[currentColumn, currentRow - 1].Value; //choose the upper cell for (int i = 0; i < grid.SelectedCells.Count; i++) { if (!grid.SelectedCells[i].ReadOnly) grid.SelectedCells[i].Value = cell.Value; //H.NH add } } else { if (currentRow > 0) grid[currentColumn, currentRow].Value = grid[currentColumn, currentRow - 1].Value; } } public static void PasteFromClipboard(DataGridView grid) { try { char[] rowSplitter = { '\r', '\n' }; char[] columnSplitter = { '\t' }; // Get the text from Clipboard IDataObject dataInClipboard = Clipboard.GetDataObject(); string stringInClipboard = (string)dataInClipboard.GetData(DataFormats.StringFormat); // split into rows string[] rowInClipboard = stringInClipboard.Split(rowSplitter, StringSplitOptions.RemoveEmptyEntries); // get current cell int currentRow = grid.SelectedCells[0].RowIndex; int currentColumn = grid.SelectedCells[0].ColumnIndex; // get 1st cell in selected area for (int i = 1; i < grid.SelectedCells.Count; i++) { if (currentRow > grid.SelectedCells[i].RowIndex) currentRow = grid.SelectedCells[i].RowIndex; if (currentColumn > grid.SelectedCells[i].ColumnIndex) currentColumn = grid.SelectedCells[i].ColumnIndex; } // add more rows if need to paste data /* if (grid.Rows.Count < rowInClipboard.Length + currentRow) grid.Rows.Add(rowInClipboard.Length + currentRow - grid.Rows.Count); */ // paste for (int iRow = 0; iRow < rowInClipboard.Length; iRow++) { if (iRow + currentRow < grid.Rows.Count) { string[] cellsInRow = rowInClipboard[iRow].Split(columnSplitter); for (int iCol = 0; iCol < cellsInRow.Length; iCol++) { if (grid.ColumnCount > currentColumn + iCol) { DataGridViewCell currentCell = grid.Rows[currentRow + iRow].Cells[currentColumn + iCol]; if (!currentCell.ReadOnly) // H.NH added to avoid Read only case. currentCell.Value = cellsInRow[iCol]; } } } else break; } } catch (Exception e) { MessageBox.Show("Sorry, can not paste from the clipboard.\nError: " + e.Message, "Paste Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } } }
2atgroup
TiffBrowserTestCSharp/TiffBrowserTestCSharp/ClipboardUtils.cs
C#
Microsoft Reciprocal License (Ms-RL)
4,946
using System; using System.Collections.Generic; using System.Text; using System.Drawing; namespace FIS.iDET { public class DataColumn { public DataColumn() { // set default values _width = 100; _type = DataTypeEnum.COLUMN_TYPE_TEXT; _header = "Untitled"; x = y = w = h = 0; } public DataColumn(string header) { // set default values _width = 100; _type = DataTypeEnum.COLUMN_TYPE_TEXT; _header = header; x = y = w = h = 0; } public DataColumn(string header, int type, int width, DoubleRectangle rect) { // set default values _width = width; _type = type; _header = header; x = rect.X; y = rect.Y; w = rect.Width; h = rect.Height; } private double x, y, w, h; public DataColumn(string header, int type, int width, double x, double y, double w, double h) { // set default values _width = width; _type = type; _header = header; this.x = x; this.y = y; this.w = w; this.h = h; } public DataColumn (DataColumn datacol) { this._header = datacol.Header; this._width = datacol.Width; this._type = datacol.Type; this.x = datacol.x; this.y = datacol.y; this.w = datacol.w; this.h = datacol.h; } public DoubleRectangle Rect { get { return new DoubleRectangle(x, y, w, h); } set { x = value.X; y = value.Y; w = value.Width; h = value.Height; } } public double X { get { return x; } set { this.x = value; } } public double Y { get { return y; } set { this.y = value; } } public double W { get { return w; } set { this.w = value; } } public double H { get { return h; } set { this.h = value; } } private int _width; public int Width { get { return _width; } set { _width = value; } } private int _type; public int Type { get { return _type; } set { _type = value; } } private string _header; public string Header { get { return _header; } set { _header = value; } } } }
2atgroup
TiffBrowserTestCSharp/TiffBrowserTestCSharp/DataColumn.cs
C#
Microsoft Reciprocal License (Ms-RL)
3,001
using System; using System.Collections.Generic; using System.Text; namespace FIS.iDET { public static class DataTypeEnum { /* data type for datagridview column */ public const int COLUMN_TYPE_NUMBER = 0; public const int COLUMN_TYPE_DATE = 1; public const int COLUMN_TYPE_TEXT = 2; } }
2atgroup
TiffBrowserTestCSharp/TiffBrowserTestCSharp/DataTypeEnum.cs
C#
Microsoft Reciprocal License (Ms-RL)
348
using System; using System.Collections.Generic; using System.Text; namespace FIS.iDET { /*class DoublePoint { public double X=0, Y=0; public DoublePoint(double X, double Y) { this. } }*/ public class DoubleRectangle { public double X = 0, Y = 0, Width = 0, Height = 0; public DoubleRectangle(double x, double y, double width, double height) { this.X = x; this.Y = y; this.Width = width; this.Height = height; } public DoubleRectangle() { } } }
2atgroup
TiffBrowserTestCSharp/TiffBrowserTestCSharp/DoubleRectangle.cs
C#
Microsoft Reciprocal License (Ms-RL)
653
End of preview. Expand in Data Studio

Microsoft CodePlex Archive Dataset

Dataset Description

Source code from the Microsoft CodePlex Archive on the Internet Archive. CodePlex was Microsoft's open-source project hosting service from 2006 to 2017, popular for .NET and Windows projects.

Dataset Summary

Statistic Value
Total Files 5,043,730
Total Repositories 38,087
Total Size 3.6 GB (compressed Parquet)
Programming Languages 91
File Format Parquet with Zstd compression (10 files)

Features

  • 38K repositories from the 2006-2017 period
  • 91 programming languages, dominated by C# and .NET
  • Metadata: repository name, file path, language, license, file size
  • Filtered to remove vendor code, build artifacts, and generated files

Languages

Top 30 of 91 languages by file count:

Rank Language File Count
1 C# 2,671,389
2 JavaScript 511,289
3 XML 210,627
4 HTML 203,106
5 C 200,427
6 CSS 192,974
7 HTML+Razor 150,753
8 C++ 149,283
9 ASP.NET 130,469
10 XAML 114,609
11 Visual Basic .NET 102,835
12 PHP 82,775
13 SQL 77,737
14 Java 70,745
15 INI 22,056
16 JSON 14,507
17 Less 12,785
18 Batchfile 12,327
19 Python 10,957
20 PowerShell 8,446
21 F# 7,879
22 Markdown 7,707
23 SCSS 7,594
24 Ruby 7,120
25 Objective-C 6,573
26 Swift 5,666
27 ActionScript 4,712
28 Java Server Pages 4,347
29 TypeScript 4,044
30 reStructuredText 3,597

Licenses

License File Count
Microsoft Public License (Ms-PL) 1,361,702
GNU General Public License version 2 (GPLv2) 757,005
Apache License 2.0 (Apache) 749,347
The MIT License (MIT) 577,346
Microsoft Reciprocal License (Ms-RL) 298,578
New BSD License (BSD) 240,622
GNU Library General Public License (LGPL) 204,837
GNU General Public License version 3 (GPLv3) 200,838
Common Development and Distribution License (CDDL) 165,029
GNU Lesser General Public License (LGPL) 132,699
Custom License 115,605
Mozilla Public License 2.0 (MPL-2.0) 62,260
Simplified BSD License (BSD) 58,250
Eclipse Public License (EPL) 46,882
Microsoft Permissive License (Ms-PL) v1.1 43,314
Mozilla Public License 1.1 (MPL) 26,129
Microsoft Community License (Ms-CL) v1.1 3,287

Dataset Structure

Data Fields

Field Type Description
code string File content (UTF-8)
repo_name string CodePlex project name
path string File path within repository
language string Programming language
license string Repository license
size int64 File size in bytes

Data Format

  • Format: Apache Parquet with Zstd compression
  • File Structure: 10 files (codeplex_0000.parquet to codeplex_0009.parquet)

Data Splits

Train split only.

Example Data Point

{
    "code": "using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Data;\nusing System.Drawing;\nusing System.Text;\nusing System.Windows.Forms;\n\nnamespace KeygenApp\n{\n    public partial class KeygenForm : Form\n    {\n        public KeygenForm()\n        {\n            InitializeComponent();\n        }\n    }\n}",
    "repo_name": "2atgroup",
    "path": "TiffBrowserTestCSharp/Keygen/KeygenForm.cs",
    "language": "C#",
    "license": "Microsoft Reciprocal License (Ms-RL)",
    "size": 1259
}

Dataset Creation

Pipeline

  1. Load project metadata from zips.csv (108,508 repositories)
  2. Extract 122 tar archives from the Internet Archive tars/ directory
  3. Extract source code from sourceCode/sourceCode.zip within each project
  4. Parse license/license.json for license metadata
  5. Filter non-code files
  6. Write to Parquet with Zstd compression

Language Detection

By file extension.

License Detection

Parsed from license/license.json in each project archive.

File Filtering

Size Limits

Limit Value
Max single file size 2 MB
Max line length 1,000 characters

Excluded Directories

  • Config: .git/, .github/, .gitlab/, .vscode/, .idea/, .vs/, .settings/, .eclipse/, .project/, .metadata/
  • Vendor: node_modules/, bower_components/, jspm_packages/, vendor/, third_party/, 3rdparty/, external/, packages/, deps/, lib/vendor/, target/dependency/, Pods/
  • Build: build/, dist/, out/, bin/, target/, release/, debug/, .next/, .nuxt/, _site/, _build/, __pycache__/, .pytest_cache/, cmake-build-*, .gradle/, .maven/, obj/
  • CodePlex metadata: discussions/, issues/, releases/, wiki/, wikiRender/
  • Tests: test/, tests/, spec/, specs/, __tests__/

Excluded Files

  • Lock files: package-lock.json, yarn.lock, pnpm-lock.yaml, Gemfile.lock, Cargo.lock, poetry.lock, Pipfile.lock, composer.lock, go.sum, mix.lock, packages.lock.json
  • Minified: files containing .min.
  • Hidden: files starting with . (except .htaccess)
  • Binary: .exe, .dll, .so, .dylib, .a, .lib, .o, .obj, .jar, .war, .ear, .class, .pyc, .pyo, .wasm, .bin, .dat, .pdf, .doc, .docx, .xls, .xlsx, .ppt, .pptx, .zip, .tar, .gz, .bz2, .7z, .rar, .jpg, .jpeg, .png, .gif, .bmp, .ico, .svg, .mp3, .mp4, .avi, .mov, .wav, .flac, .ttf, .otf, .woff, .woff2, .eot, .pdb, .nupkg, .snk
  • System: .DS_Store, thumbs.db

Content Filtering

  • UTF-8 Validation: must be valid UTF-8
  • Binary Detection: no null bytes, <30% non-printable characters in first 8KB
  • Generated Files: excluded if first 500 bytes contain generated by, do not edit, auto-generated, @generated, etc.
  • Empty Files: excluded
  • Long Lines: excluded if any line >1,000 characters in first 10 lines

Source Data

Microsoft CodePlex Archive on Internet Archive, tars/ directory (122 tar archives). 108,508 repositories accessible out of 108,516 listed.

Archive Structure

Each CodePlex project archive contains:

  • sourceCode/sourceCode.zip - source code (extracted)
  • license/license.json - license metadata (parsed)
  • discussions/, issues/, releases/, wiki/ - excluded

Considerations

Sensitive Information

May contain email addresses, accidentally committed credentials, or personal information in comments. Filter accordingly.

Licensing

Use must comply with the original repository licenses. The license field indicates each file's source license.

Downloads last month
24