From bbea4845d40c294a3f3a9e8515c759723a0c14a1 Mon Sep 17 00:00:00 2001 From: "Valeriano A.R" Date: Thu, 17 Aug 2023 14:27:34 +0200 Subject: [PATCH] Delete old Windows.Forms project. --- CsvView.Old.csproj | 116 ----------------- CsvView.sln | 14 +- Program.cs | 26 ---- Properties/AssemblyInfo.cs | 14 -- UI/CTextBox.cs | 34 ----- UI/DoubleBufferPanel.cs | 56 -------- UI/FrmCsvViewer.Designer.cs | 247 ------------------------------------ UI/FrmCsvViewer.cs | 203 ----------------------------- UI/MessageBoxEx.cs | 86 ------------- app.manifest | 75 ----------- 10 files changed, 8 insertions(+), 863 deletions(-) delete mode 100644 CsvView.Old.csproj delete mode 100644 Program.cs delete mode 100644 Properties/AssemblyInfo.cs delete mode 100644 UI/CTextBox.cs delete mode 100644 UI/DoubleBufferPanel.cs delete mode 100644 UI/FrmCsvViewer.Designer.cs delete mode 100644 UI/FrmCsvViewer.cs delete mode 100644 UI/MessageBoxEx.cs delete mode 100644 app.manifest diff --git a/CsvView.Old.csproj b/CsvView.Old.csproj deleted file mode 100644 index b870ec6..0000000 --- a/CsvView.Old.csproj +++ /dev/null @@ -1,116 +0,0 @@ - - - - - Debug - AnyCPU - {587169B9-7891-4A2F-8537-9196898B86AF} - WinExe - Properties - CsvView - CsvView.Old - v4.6.1 - 512 - true - publish\ - true - Disk - false - Foreground - 7 - Days - false - false - true - 0 - 1.0.0.%2a - false - false - true - - - AnyCPU - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - AnyCPU - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - app.manifest - - - - - - - - - - - - - - - - - Component - - - Component - - - Form - - - FrmCsvViewer.cs - - - - - - - - - - - - False - Microsoft .NET Framework 4.6.1 %28x86 and x64%29 - true - - - False - .NET Framework 3.5 SP1 - false - - - - - - - - {eb0fdb60-8b9d-401c-85a8-4cf4105d5063} - CsvLib - - - - - \ No newline at end of file diff --git a/CsvView.sln b/CsvView.sln index 4366a40..7e87715 100644 --- a/CsvView.sln +++ b/CsvView.sln @@ -3,24 +3,26 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 14 VisualStudioVersion = 14.0.25420.1 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CsvView.Old", "CsvView.Old.csproj", "{587169B9-7891-4A2F-8537-9196898B86AF}" -EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CsvLib", "CsvLib\CsvLib.csproj", "{EB0FDB60-8B9D-401C-85A8-4CF4105D5063}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CsvLib.Tests", "CsvLib.Tests\CsvLib.Tests.csproj", "{EC5C84D8-1CDE-4AED-9C16-6C4086A20893}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CsvView", "CsvView\CsvView.csproj", "{65A0A7DA-5884-4DFE-8223-C8F5DBD881A8}" EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Misc", "Misc", "{94D4A247-9453-45F4-8552-0D106801C9F0}" + ProjectSection(SolutionItems) = preProject + README.md = README.md + LICENSE.txt = LICENSE.txt + .editorconfig = .editorconfig + .gitignore = .gitignore + EndProjectSection +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU Release|Any CPU = Release|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {587169B9-7891-4A2F-8537-9196898B86AF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {587169B9-7891-4A2F-8537-9196898B86AF}.Debug|Any CPU.Build.0 = Debug|Any CPU - {587169B9-7891-4A2F-8537-9196898B86AF}.Release|Any CPU.ActiveCfg = Release|Any CPU - {587169B9-7891-4A2F-8537-9196898B86AF}.Release|Any CPU.Build.0 = Release|Any CPU {EB0FDB60-8B9D-401C-85A8-4CF4105D5063}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {EB0FDB60-8B9D-401C-85A8-4CF4105D5063}.Debug|Any CPU.Build.0 = Debug|Any CPU {EB0FDB60-8B9D-401C-85A8-4CF4105D5063}.Release|Any CPU.ActiveCfg = Release|Any CPU diff --git a/Program.cs b/Program.cs deleted file mode 100644 index 5169956..0000000 --- a/Program.cs +++ /dev/null @@ -1,26 +0,0 @@ -using System; -using System.Windows.Forms; -using CsvView.UI; - -namespace CsvView -{ - static class Program - { - [STAThread] - static void Main(string[] args) - { - Application.EnableVisualStyles(); - Application.SetCompatibleTextRenderingDefault(false); - - var frmCsvViewer = new FrmCsvViewer(); - if (args.Length > 0) - { - if (System.IO.File.Exists(args[0])) - { - frmCsvViewer.LoadFile(args[0]); - } - } - Application.Run(frmCsvViewer); - } - } -} diff --git a/Properties/AssemblyInfo.cs b/Properties/AssemblyInfo.cs deleted file mode 100644 index 0636657..0000000 --- a/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,14 +0,0 @@ -using System.Reflection; -using System.Runtime.InteropServices; - -[assembly: AssemblyTitle("CSVView.Net")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("CSVView.Net")] -[assembly: AssemblyCopyright("Copyright © 2017")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] -[assembly: ComVisible(false)] -[assembly: Guid("587169b9-7891-4a2f-8537-9196898b86af")] -[assembly: AssemblyVersion("1.0.*")] diff --git a/UI/CTextBox.cs b/UI/CTextBox.cs deleted file mode 100644 index 5278cea..0000000 --- a/UI/CTextBox.cs +++ /dev/null @@ -1,34 +0,0 @@ -using System; -using System.Windows.Forms; -using System.Runtime.InteropServices; -using System.Drawing; - -namespace CsvView.UI -{ - public class CTextBox : TextBox - { - public CTextBox() - { - WordWrap = false; - ScrollBars = ScrollBars.Horizontal; - Font = new Font("Courier New", 9, FontStyle.Regular, GraphicsUnit.Point, 0); - } - - [DllImport("user32.dll")] - private static extern IntPtr SendMessage(IntPtr hWnd, int msg, IntPtr wp, IntPtr lp); - - private const int WM_MOUSEWHEEL = 0x20a; - - protected override void WndProc(ref Message m) - { - if (m.Msg == WM_MOUSEWHEEL) - { - SendMessage(Parent.Handle, m.Msg, m.WParam, m.LParam); - } - else - { - base.WndProc(ref m); - } - } - } -} diff --git a/UI/DoubleBufferPanel.cs b/UI/DoubleBufferPanel.cs deleted file mode 100644 index e5ad59c..0000000 --- a/UI/DoubleBufferPanel.cs +++ /dev/null @@ -1,56 +0,0 @@ -using System; -using System.ComponentModel; -using System.Drawing; -using System.Runtime.InteropServices; -using System.Windows.Forms; - -namespace CsvView.UI -{ - public class DoubleBufferPanel : Panel - { - public DoubleBufferPanel() - { - DoubleBuffered = true; - SetStyle(ControlStyles.UserPaint | - ControlStyles.AllPaintingInWmPaint | - ControlStyles.ResizeRedraw | - ControlStyles.ContainerControl | - ControlStyles.OptimizedDoubleBuffer | - ControlStyles.SupportsTransparentBackColor - , true); - } - - [DllImport("user32.dll", CharSet = CharSet.Auto)] - public static extern int SendMessage(IntPtr hWnd, Int32 wMsg, bool wParam, Int32 lParam); - - private const int WM_SetRedraw = 0XB; - - public void SuspendDrawing() - { - SuspendLayout(); - SendMessage(Handle, WM_SetRedraw, false, 0); - } - - public void ResumeDrawing() - { - ResumeLayout(true); - SendMessage(Handle, WM_SetRedraw, true, 0); - Refresh(); - } - - [DefaultValue(false)] - [Localizable(false)] - [Category("CatLayout")] - [Description("DisableAutoScrollDescr")] - public bool DisableAutoScroll { get; set; } - - protected override Point ScrollToControl(Control activeControl) - { - if (DisableAutoScroll) - { - return DisplayRectangle.Location; - } - return base.ScrollToControl(activeControl); - } - } -} diff --git a/UI/FrmCsvViewer.Designer.cs b/UI/FrmCsvViewer.Designer.cs deleted file mode 100644 index 5a28af5..0000000 --- a/UI/FrmCsvViewer.Designer.cs +++ /dev/null @@ -1,247 +0,0 @@ -namespace CsvView.UI -{ - partial class FrmCsvViewer - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (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.txtPath = new System.Windows.Forms.TextBox(); - this.btnLoad = new System.Windows.Forms.Button(); - this.grpFile = new System.Windows.Forms.GroupBox(); - this.pnlScrollData = new CsvView.UI.DoubleBufferPanel(); - this.pnlData = new CsvView.UI.DoubleBufferPanel(); - this.pnlReg = new CsvView.UI.DoubleBufferPanel(); - this.btnPrevReg = new System.Windows.Forms.Button(); - this.tblRegNumbers = new System.Windows.Forms.TableLayoutPanel(); - this.txtCurrentReg = new System.Windows.Forms.TextBox(); - this.txtTotalRegs = new System.Windows.Forms.TextBox(); - this.btnFirstReg = new System.Windows.Forms.Button(); - this.btnLastReg = new System.Windows.Forms.Button(); - this.btnNextReg = new System.Windows.Forms.Button(); - this.grpFile.SuspendLayout(); - this.pnlScrollData.SuspendLayout(); - this.pnlReg.SuspendLayout(); - this.tblRegNumbers.SuspendLayout(); - this.SuspendLayout(); - // - // txtPath - // - this.txtPath.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.txtPath.Location = new System.Drawing.Point(5, 18); - this.txtPath.Name = "txtPath"; - this.txtPath.Size = new System.Drawing.Size(452, 20); - this.txtPath.TabIndex = 0; - this.txtPath.DoubleClick += new System.EventHandler(this.txtPath_DoubleClick); - // - // btnLoad - // - this.btnLoad.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this.btnLoad.Location = new System.Drawing.Point(461, 18); - this.btnLoad.Name = "btnLoad"; - this.btnLoad.Size = new System.Drawing.Size(45, 20); - this.btnLoad.TabIndex = 3; - this.btnLoad.Text = "Load"; - this.btnLoad.UseVisualStyleBackColor = true; - this.btnLoad.Click += new System.EventHandler(this.btnLoad_Click); - // - // grpFile - // - this.grpFile.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.grpFile.Controls.Add(this.btnLoad); - this.grpFile.Controls.Add(this.txtPath); - this.grpFile.Location = new System.Drawing.Point(13, 8); - this.grpFile.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); - this.grpFile.Name = "grpFile"; - this.grpFile.Padding = new System.Windows.Forms.Padding(2, 2, 2, 2); - this.grpFile.Size = new System.Drawing.Size(511, 44); - this.grpFile.TabIndex = 12; - this.grpFile.TabStop = false; - this.grpFile.Text = "File"; - // - // pnlScrollData - // - this.pnlScrollData.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.pnlScrollData.AutoScroll = true; - this.pnlScrollData.Controls.Add(this.pnlData); - this.pnlScrollData.DisableAutoScroll = true; - this.pnlScrollData.Location = new System.Drawing.Point(13, 85); - this.pnlScrollData.Margin = new System.Windows.Forms.Padding(2); - this.pnlScrollData.Name = "pnlScrollData"; - this.pnlScrollData.Size = new System.Drawing.Size(511, 429); - this.pnlScrollData.TabIndex = 12; - // - // pnlData - // - this.pnlData.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.pnlData.BackColor = System.Drawing.SystemColors.Control; - this.pnlData.DisableAutoScroll = true; - this.pnlData.Location = new System.Drawing.Point(0, 1); - this.pnlData.Name = "pnlData"; - this.pnlData.Size = new System.Drawing.Size(511, 51); - this.pnlData.TabIndex = 11; - // - // pnlReg - // - this.pnlReg.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.pnlReg.BackColor = System.Drawing.SystemColors.Control; - this.pnlReg.Controls.Add(this.btnPrevReg); - this.pnlReg.Controls.Add(this.tblRegNumbers); - this.pnlReg.Controls.Add(this.btnFirstReg); - this.pnlReg.Controls.Add(this.btnLastReg); - this.pnlReg.Controls.Add(this.btnNextReg); - this.pnlReg.Enabled = false; - this.pnlReg.Location = new System.Drawing.Point(14, 57); - this.pnlReg.Name = "pnlReg"; - this.pnlReg.Size = new System.Drawing.Size(510, 456); - this.pnlReg.TabIndex = 11; - // - // btnPrevReg - // - this.btnPrevReg.Font = new System.Drawing.Font("Courier New", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.btnPrevReg.Location = new System.Drawing.Point(41, 0); - this.btnPrevReg.Name = "btnPrevReg"; - this.btnPrevReg.Size = new System.Drawing.Size(36, 23); - this.btnPrevReg.TabIndex = 5; - this.btnPrevReg.Text = "<"; - this.btnPrevReg.UseVisualStyleBackColor = true; - this.btnPrevReg.Click += new System.EventHandler(this.btnPrevReg_Click); - // - // tblRegNumbers - // - this.tblRegNumbers.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.tblRegNumbers.ColumnCount = 2; - this.tblRegNumbers.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F)); - this.tblRegNumbers.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F)); - this.tblRegNumbers.Controls.Add(this.txtCurrentReg, 0, 0); - this.tblRegNumbers.Controls.Add(this.txtTotalRegs, 1, 0); - this.tblRegNumbers.Location = new System.Drawing.Point(83, 0); - this.tblRegNumbers.Name = "tblRegNumbers"; - this.tblRegNumbers.RowCount = 1; - this.tblRegNumbers.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F)); - this.tblRegNumbers.Size = new System.Drawing.Size(345, 28); - this.tblRegNumbers.TabIndex = 10; - // - // txtCurrentReg - // - this.txtCurrentReg.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.txtCurrentReg.Location = new System.Drawing.Point(3, 3); - this.txtCurrentReg.Name = "txtCurrentReg"; - this.txtCurrentReg.Size = new System.Drawing.Size(166, 20); - this.txtCurrentReg.TabIndex = 8; - this.txtCurrentReg.TextChanged += new System.EventHandler(this.txtCurrentReg_TextChanged); - // - // txtTotalRegs - // - this.txtTotalRegs.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.txtTotalRegs.Location = new System.Drawing.Point(175, 3); - this.txtTotalRegs.Name = "txtTotalRegs"; - this.txtTotalRegs.ReadOnly = true; - this.txtTotalRegs.Size = new System.Drawing.Size(167, 20); - this.txtTotalRegs.TabIndex = 9; - // - // btnFirstReg - // - this.btnFirstReg.Font = new System.Drawing.Font("Courier New", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.btnFirstReg.Location = new System.Drawing.Point(0, 0); - this.btnFirstReg.Name = "btnFirstReg"; - this.btnFirstReg.Size = new System.Drawing.Size(36, 23); - this.btnFirstReg.TabIndex = 4; - this.btnFirstReg.Text = "|<"; - this.btnFirstReg.UseVisualStyleBackColor = true; - this.btnFirstReg.Click += new System.EventHandler(this.btnFirstReg_Click); - // - // btnLastReg - // - this.btnLastReg.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this.btnLastReg.Font = new System.Drawing.Font("Courier New", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.btnLastReg.Location = new System.Drawing.Point(474, 0); - this.btnLastReg.Name = "btnLastReg"; - this.btnLastReg.Size = new System.Drawing.Size(36, 23); - this.btnLastReg.TabIndex = 7; - this.btnLastReg.Text = ">|"; - this.btnLastReg.UseVisualStyleBackColor = true; - this.btnLastReg.Click += new System.EventHandler(this.btnLastReg_Click); - // - // btnNextReg - // - this.btnNextReg.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this.btnNextReg.Font = new System.Drawing.Font("Courier New", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.btnNextReg.Location = new System.Drawing.Point(433, 0); - this.btnNextReg.Name = "btnNextReg"; - this.btnNextReg.Size = new System.Drawing.Size(36, 23); - this.btnNextReg.TabIndex = 6; - this.btnNextReg.Text = ">"; - this.btnNextReg.UseVisualStyleBackColor = true; - this.btnNextReg.Click += new System.EventHandler(this.btnNextReg_Click); - // - // FrmCsvViewer - // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(532, 521); - this.Controls.Add(this.pnlScrollData); - this.Controls.Add(this.grpFile); - this.Controls.Add(this.pnlReg); - this.Name = "FrmCsvViewer"; - this.Text = "CsvViewer"; - this.grpFile.ResumeLayout(false); - this.grpFile.PerformLayout(); - this.pnlScrollData.ResumeLayout(false); - this.pnlReg.ResumeLayout(false); - this.tblRegNumbers.ResumeLayout(false); - this.tblRegNumbers.PerformLayout(); - this.ResumeLayout(false); - - } - - #endregion - - private System.Windows.Forms.TextBox txtPath; - private System.Windows.Forms.Button btnLoad; - private System.Windows.Forms.Button btnFirstReg; - private System.Windows.Forms.Button btnPrevReg; - private System.Windows.Forms.Button btnNextReg; - private System.Windows.Forms.Button btnLastReg; - private System.Windows.Forms.TextBox txtCurrentReg; - private System.Windows.Forms.TextBox txtTotalRegs; - private System.Windows.Forms.TableLayoutPanel tblRegNumbers; - private CsvView.UI.DoubleBufferPanel pnlReg; - private CsvView.UI.DoubleBufferPanel pnlData; - private System.Windows.Forms.GroupBox grpFile; - private CsvView.UI.DoubleBufferPanel pnlScrollData; - } -} - diff --git a/UI/FrmCsvViewer.cs b/UI/FrmCsvViewer.cs deleted file mode 100644 index ad4eea5..0000000 --- a/UI/FrmCsvViewer.cs +++ /dev/null @@ -1,203 +0,0 @@ -using System; -using System.Collections.Generic; -using System.IO; -using System.Windows.Forms; -using CsvLib; - -namespace CsvView.UI -{ - public partial class FrmCsvViewer : Form - { - public FrmCsvViewer() - { - InitializeComponent(); - } - - private void txtPath_DoubleClick(object sender, EventArgs e) - { - OpenFileDialog loadDialog = new OpenFileDialog(); - loadDialog.InitialDirectory = Path.GetDirectoryName(System.Reflection.Assembly.GetEntryAssembly().Location); - loadDialog.DefaultExt = "csv"; - loadDialog.Filter = "CSV Files|*.csv|Any File|*"; - DialogResult result = loadDialog.ShowDialog(); - if (result == DialogResult.OK) - { - txtPath.Text = loadDialog.FileName; - } - } - - private string _loadedFile = string.Empty; - private long _currentReg; - private long _totalRegs; - private List _index; - - private void btnLoad_Click(object sender, EventArgs e) - { - if (File.Exists(txtPath.Text) == false) - { - RenderRegClean(); - _loadedFile = null; - _totalRegs = 0; - _index = null; - MessageBoxEx.Show(this, "FileNotFound"); - return; - } - - LoadFile(txtPath.Text); - } - - public void LoadFile(string fileName) - { - _loadedFile = fileName; - txtPath.Text = fileName; - - CsvIndexer csvIndexer = new CsvIndexer(); - csvIndexer.LoadIndexOfFile(_loadedFile); - _index = csvIndexer.Index; - _totalRegs = _index.Count - 1; - - RenderReg(0); - } - - private List Index_LoadReg(int idx) - { - var csvParser = new CsvParser(); - csvParser.ParseFile(_loadedFile, _index[idx], 1); - return csvParser.Data[0]; - } - - bool _rendering; - private void RenderReg(long currentReg) - { - if (_index == null || _index.Count <= 0) - { - RenderRegClean(); - } - - if (_rendering) { return; } - _rendering = true; - - pnlReg.Enabled = true; - bool first = false; - bool last = false; - if (currentReg <= 0) - { - currentReg = 0; - first = true; - } - if (currentReg >= (_totalRegs - 1)) - { - currentReg = _totalRegs - 1; - last = true; - } - - pnlScrollData.SuspendDrawing(); - pnlScrollData.VerticalScroll.Value = 0; - pnlData.Height = 10; - - pnlData.Controls.Clear(); - _currentReg = currentReg; - txtCurrentReg.Text = Convert.ToString(currentReg); - txtTotalRegs.Text = Convert.ToString(_totalRegs); - - btnFirstReg.Enabled = (first == false); - btnPrevReg.Enabled = (first == false); - btnLastReg.Enabled = (last == false); - btnNextReg.Enabled = (last == false); - - List currentData = Index_LoadReg((int)currentReg); - - int y = 0; - const int textBoxPadding = 5; - const int paddingLeft = 0; - const int paddingRight = 0; - const int paddingBetween = 10; - const int lineHeight = 15; - for (int i = 0; i < currentData.Count; i++) - { - TextBox txtValue = RenderValue(currentData[i], y, textBoxPadding, paddingLeft, paddingRight, lineHeight); - pnlData.Controls.Add(txtValue); - y += txtValue.Height + paddingBetween; - } - pnlData.Height = y; - - pnlScrollData.ResumeDrawing(); - _rendering = false; - } - - private TextBox RenderValue(string value, int y, int textBoxPadding, int paddingLeft, int paddingRight, int lineHeight) - { - string[] valueLines = value.Split('\n'); - CTextBox txtValue = new CTextBox() - { - Anchor = (AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right), - Width = pnlData.Width - (paddingLeft + paddingRight), - Height = (valueLines.Length * lineHeight) + textBoxPadding, - Multiline = (valueLines.Length > 1), - Top = y, - Left = paddingLeft, - ReadOnly = true, - }; - for (int j = 0; j < valueLines.Length; j++) - { - if (j > 0) - { - txtValue.AppendText("\n"); - } - txtValue.AppendText(valueLines[j]); - } - return txtValue; - } - - private void RenderRegClean() - { - if (_rendering) { return; } - _rendering = true; - - pnlScrollData.SuspendDrawing(); - pnlScrollData.VerticalScroll.Value = 0; - pnlData.Height = 10; - - pnlData.Controls.Clear(); - pnlReg.Enabled = false; - txtCurrentReg.Text = string.Empty; - txtTotalRegs.Text = string.Empty; - - pnlScrollData.ResumeDrawing(); - _rendering = false; - } - - private void btnFirstReg_Click(object sender, EventArgs e) - { - RenderReg(0); - } - - private void btnPrevReg_Click(object sender, EventArgs e) - { - RenderReg(_currentReg - 1); - } - - private void btnNextReg_Click(object sender, EventArgs e) - { - RenderReg(_currentReg + 1); - } - - private void btnLastReg_Click(object sender, EventArgs e) - { - RenderReg(_totalRegs - 1); - } - - private void txtCurrentReg_TextChanged(object sender, EventArgs e) - { - int newReg = 0; - if (int.TryParse(txtCurrentReg.Text, out newReg)) - { - RenderReg(newReg); - } - else - { - RenderReg(_currentReg); - } - } - } -} diff --git a/UI/MessageBoxEx.cs b/UI/MessageBoxEx.cs deleted file mode 100644 index 7723e81..0000000 --- a/UI/MessageBoxEx.cs +++ /dev/null @@ -1,86 +0,0 @@ -using System.Windows.Forms; - -namespace CsvView.UI -{ - public static class MessageBoxEx - { - public static DialogResult Show(string text) - { - Initialize(); - return MessageBox.Show(text); - } - - public static DialogResult Show(string text, string caption) - { - Initialize(); - return MessageBox.Show(text, caption); - } - - public static DialogResult Show(string text, string caption, MessageBoxButtons buttons) - { - Initialize(); - return MessageBox.Show(text, caption, buttons); - } - - public static DialogResult Show(string text, string caption, MessageBoxButtons buttons, MessageBoxIcon icon) - { - Initialize(); - return MessageBox.Show(text, caption, buttons, icon); - } - - public static DialogResult Show(string text, string caption, MessageBoxButtons buttons, MessageBoxIcon icon, MessageBoxDefaultButton defButton) - { - Initialize(); - return MessageBox.Show(text, caption, buttons, icon, defButton); - } - - public static DialogResult Show(string text, string caption, MessageBoxButtons buttons, MessageBoxIcon icon, MessageBoxDefaultButton defButton, MessageBoxOptions options) - { - Initialize(); - return MessageBox.Show(text, caption, buttons, icon, defButton, options); - } - - public static DialogResult Show(IWin32Window owner, string text) - { - Initialize(); - return MessageBox.Show(owner, text); - } - - public static DialogResult Show(IWin32Window owner, string text, string caption) - { - Initialize(); - return MessageBox.Show(owner, text, caption); - } - - public static DialogResult Show(IWin32Window owner, string text, string caption, MessageBoxButtons buttons) - { - Initialize(); - return MessageBox.Show(owner, text, caption, buttons); - } - - public static DialogResult Show(IWin32Window owner, string text, string caption, MessageBoxButtons buttons, MessageBoxIcon icon) - { - Initialize(); - return MessageBox.Show(owner, text, caption, buttons, icon); - } - - public static DialogResult Show(IWin32Window owner, string text, string caption, MessageBoxButtons buttons, MessageBoxIcon icon, MessageBoxDefaultButton defButton) - { - Initialize(); - return MessageBox.Show(owner, text, caption, buttons, icon, defButton); - } - - public static DialogResult Show(IWin32Window owner, string text, string caption, MessageBoxButtons buttons, MessageBoxIcon icon, MessageBoxDefaultButton defButton, MessageBoxOptions options) - { - Initialize(); - return MessageBox.Show(owner, text, caption, buttons, icon, - defButton, options); - } - - private static void Initialize() - { - - } - - } -} \ No newline at end of file diff --git a/app.manifest b/app.manifest deleted file mode 100644 index 6c647ae..0000000 --- a/app.manifest +++ /dev/null @@ -1,75 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - true - - - - - - -