using System; using System.Drawing; using System.Collections; using System.ComponentModel; using System.Windows.Forms; using GZTW.AyaNova.BLL; using System.Text; using System.Reflection; using System.IO; namespace AyaNova { /// /// Summary description for About. /// public class About : System.Windows.Forms.Form { private System.Windows.Forms.TextBox edAbout; private System.Windows.Forms.Label lblCopyRight; private MenuStrip menuStrip1; private ToolStripMenuItem copyExtendedSupportInfoToClipboardToolStripMenuItem; /// /// Required designer variable. /// private System.ComponentModel.Container components = null; public About() { // // Required for Windows Form Designer support // InitializeComponent(); // // TODO: Add any constructor code after InitializeComponent call // } /// /// Clean up any resources being used. /// protected override void Dispose( bool disposing ) { if( disposing ) { if(components != null) { components.Dispose(); } } base.Dispose( disposing ); } #region Windows Form Designer generated code /// /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// private void InitializeComponent() { this.edAbout = new System.Windows.Forms.TextBox(); this.lblCopyRight = new System.Windows.Forms.Label(); this.menuStrip1 = new System.Windows.Forms.MenuStrip(); this.copyExtendedSupportInfoToClipboardToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.menuStrip1.SuspendLayout(); this.SuspendLayout(); // // edAbout // this.edAbout.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.edAbout.BorderStyle = System.Windows.Forms.BorderStyle.None; this.edAbout.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.edAbout.Location = new System.Drawing.Point(0, 134); this.edAbout.Multiline = true; this.edAbout.Name = "edAbout"; this.edAbout.ReadOnly = true; this.edAbout.ScrollBars = System.Windows.Forms.ScrollBars.Vertical; this.edAbout.Size = new System.Drawing.Size(775, 307); this.edAbout.TabIndex = 0; this.edAbout.Text = "afdasfasdf"; // // lblCopyRight // this.lblCopyRight.Dock = System.Windows.Forms.DockStyle.Top; this.lblCopyRight.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.lblCopyRight.Font = new System.Drawing.Font("Verdana", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.lblCopyRight.Location = new System.Drawing.Point(0, 26); this.lblCopyRight.Name = "lblCopyRight"; this.lblCopyRight.Size = new System.Drawing.Size(775, 103); this.lblCopyRight.TabIndex = 1; this.lblCopyRight.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; // // menuStrip1 // this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.copyExtendedSupportInfoToClipboardToolStripMenuItem}); this.menuStrip1.Location = new System.Drawing.Point(0, 0); this.menuStrip1.Name = "menuStrip1"; this.menuStrip1.Size = new System.Drawing.Size(775, 26); this.menuStrip1.TabIndex = 3; this.menuStrip1.Text = "menuStrip1"; // // copyExtendedSupportInfoToClipboardToolStripMenuItem // this.copyExtendedSupportInfoToClipboardToolStripMenuItem.Name = "copyExtendedSupportInfoToClipboardToolStripMenuItem"; this.copyExtendedSupportInfoToClipboardToolStripMenuItem.Size = new System.Drawing.Size(249, 22); this.copyExtendedSupportInfoToClipboardToolStripMenuItem.Text = "&Copy config and log file to clipboard"; this.copyExtendedSupportInfoToClipboardToolStripMenuItem.Click += new System.EventHandler(this.copyExtendedSupportInfoToClipboardToolStripMenuItem_Click); // // About // this.AutoScaleBaseSize = new System.Drawing.Size(6, 15); this.ClientSize = new System.Drawing.Size(775, 455); this.Controls.Add(this.lblCopyRight); this.Controls.Add(this.edAbout); this.Controls.Add(this.menuStrip1); this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; this.MainMenuStrip = this.menuStrip1; this.MinimizeBox = false; this.Name = "About"; this.Text = "About AyaNova"; this.Load += new System.EventHandler(this.About_Load); this.menuStrip1.ResumeLayout(false); this.menuStrip1.PerformLayout(); this.ResumeLayout(false); this.PerformLayout(); } #endregion private void About_Load(object sender, System.EventArgs e) { this.Icon = Resource1.AyaNova5; StringBuilder sb=new StringBuilder(); Assembly a=Assembly.GetExecutingAssembly(); sb.Append("AyaNovaź "); sb.Append(AyaBizUtils.DisplayVersion(a.GetName().Version));//case 2003 // sb.Append(a.GetName().Version.ToString()); sb.Append("\r\n"); System.Diagnostics.FileVersionInfo fileVersion = System.Diagnostics.FileVersionInfo.GetVersionInfo(a.Location); int nHotFix = fileVersion.FileBuildPart;//case 2003 if(nHotFix>0) sb.AppendLine("(Patch " + nHotFix.ToString() + ")"); sb.Append("Copyright © 1999-2019 Ground Zero Tech-Works Inc.\r\n"); sb.Append("All rights reserved\r\n"); lblCopyRight.Text=sb.ToString(); sb.Length=0; sb.Append("License information:\r\n"); sb.Append(AyaBizUtils.View()); sb.Append("\r\nTechnical information:\r\n"); sb.Append(Util.FullSupportInfo()); sb.Append("\r\nSession information:\r\n"); sb.Append(Util.FullSettingsInfo(User.GetItem(User.CurrentThreadUserID))); edAbout.Text=sb.ToString(); edAbout.SelectionStart=0; edAbout.SelectionLength=0; } private void copyExtendedSupportInfoToClipboardToolStripMenuItem_Click(object sender, EventArgs e) { //case 3663 Util.LogFullSupportInfoToFile(); StringBuilder sbInfo = new StringBuilder(); string currentAssemblyDirectoryName = System.IO.Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); //sbInfo.Append("Tech support info\r\n=-=-=-=-=-=-=-=-=-\r\n"); //sbInfo.Append(edAbout.Text); //sbInfo.Append("\r\n\r\n\r\n"); sbInfo.Append("CONFIG.TXT FILE CONTENTS\r\n=-=-=-=-=-=-=-=-=-\r\n"); if (File.Exists(currentAssemblyDirectoryName + "\\config.txt")) { try { sbInfo.Append(System.IO.File.ReadAllText(currentAssemblyDirectoryName + "\\config.txt")); } catch (Exception ex) { sbInfo.Append(ex.Message); } } else { sbInfo.Append("Config.txt file was not found as expected at: "); sbInfo.Append(currentAssemblyDirectoryName); } sbInfo.Append("\r\n\r\n\r\n"); //The following block allows to read the AyaLog.txt file even though it's locked by the logger sbInfo.Append("AYALOG.TXT FILE CONTENTS\r\n=-=-=-=-=-=-=-=-=-\r\n"); if (File.Exists(currentAssemblyDirectoryName + "\\AyaLog.txt")) { try { System.Text.StringBuilder sb = new StringBuilder(); FileStream logFileStream = new FileStream(currentAssemblyDirectoryName + "\\AyaLog.txt", FileMode.Open, FileAccess.Read, FileShare.ReadWrite); StreamReader logFileReader = new StreamReader(logFileStream); while (!logFileReader.EndOfStream) { sb.Append(logFileReader.ReadLine()); sb.Append("\r\n"); } // Clean up logFileReader.Close(); logFileStream.Close(); sbInfo.Append(sb.ToString()); sb.Length = 0; sb = null; } catch (Exception ex) { sbInfo.Append(ex.Message); } } else { sbInfo.Append("AyaLog.txt file was not found as expected at: "); sbInfo.Append(currentAssemblyDirectoryName); } //case 3664 get integration log sbInfo.Append("\r\n\r\n\r\n"); //The following block allows to read the AyaLog.txt file even though it's locked by the logger sbInfo.Append("INTEGRATION LOG\r\n=-=-=-=-=-=-=-=-=-\r\n"); IntegrationLogList ill = IntegrationLogList.GetList(); foreach (IntegrationLogList.IntegrationLogListInfo i in ill) { sbInfo.AppendLine(i.LogEntry); } sbInfo.Append("\r\n\r\n\r\n"); //case 3589 System.Windows.Forms.Clipboard.SetText(Util.RedactPasswords(sbInfo.ToString())); sbInfo.Length = 0; sbInfo = null; } } }