/// <summary> /// Initializes a new instance of the Form1 class. /// </summary> public Form1() { this.InitializeComponent(); Assembly a = Assembly.GetExecutingAssembly(); AssemblyName aname = a.GetName(); this.titleText = aname.Name; this.selectedFileToolStripMenuItem.Enabled = false; this.allFilesToolStripMenuItem.Enabled = false; fileType = CompressedFileType.Unknown; this.initialSize = this.Size; this.gutter = this.initialSize.Width - this.textBox1.Width - this.treeView1.Width; }
/// <summary> /// Initializes a new instance of the Form1 class. /// </summary> public Form1(IArcFileProvider arcFileProvider, IArzFileProvider arzFileProvider, IDBRecordCollectionProvider dBRecordCollectionProvider, IBitmapService bitmapService) { this.InitializeComponent(); Assembly a = Assembly.GetExecutingAssembly(); AssemblyName aname = a.GetName(); this.arcProv = arcFileProvider; this.arzProv = arzFileProvider; this.DBRecordCollectionProvider = dBRecordCollectionProvider; this.BitmapService = bitmapService; this.titleText = aname.Name; this.selectedFileToolStripMenuItem.Enabled = false; this.allFilesToolStripMenuItem.Enabled = false; fileType = CompressedFileType.Unknown; this.initialSize = this.Size; this.gutter = this.initialSize.Width - this.textBox1.Width - this.treeView1.Width; }
/// <summary> /// Initializes a new instance of the Form1 class. /// </summary> public MainForm(ILogger <MainForm> log, IArcFileProvider arcFileProvider, IArzFileProvider arzFileProvider, IDBRecordCollectionProvider dBRecordCollectionProvider, IBitmapService bitmapService) { this.InitializeComponent(); Assembly a = Assembly.GetExecutingAssembly(); AssemblyName aname = a.GetName(); this.Log = log.Logger; this.arcProv = arcFileProvider; this.arzProv = arzFileProvider; this.DBRecordCollectionProvider = dBRecordCollectionProvider; this.BitmapService = bitmapService; this.titleText = aname.Name; this.selectedFileToolStripMenuItem.Enabled = false; this.allFilesToolStripMenuItem.Enabled = false; fileType = CompressedFileType.Unknown; this.initialSize = this.Size; }
/// <summary> /// Opens a file and updates the tree view. /// </summary> /// <param name="filename">Name of the file we want to open.</param> private void OpenFile(string filename) { if (string.IsNullOrEmpty(filename)) { return; } this.sourceFile = filename; string fullSrcPath = null; if (string.IsNullOrEmpty(this.sourceFile)) { MessageBox.Show("You must enter a valid source file path."); return; } // See if path exists and create it if necessary if (!string.IsNullOrEmpty(this.sourceFile)) { fullSrcPath = Path.GetFullPath(this.sourceFile); } if (!File.Exists(fullSrcPath)) { // they did not give us a file MessageBox.Show("You must specify a file!"); return; } // Try to read it as an ARC file since those have a header. arcFile = new ArcFile(this.sourceFile); if (arcProv.Read(arcFile)) { fileType = CompressedFileType.ArcFile; } else { arcFile = null; fileType = CompressedFileType.Unknown; } // Try reading the file as an ARZ file. if (fileType == CompressedFileType.Unknown) { // Read our ARZ file into memory. arzFile = new ArzFile(this.sourceFile); if (arzProv.Read(arzFile)) { fileType = CompressedFileType.ArzFile; } else { arzFile = null; fileType = CompressedFileType.Unknown; } } // We failed reading the file // so we just clear everything out. if (fileType == CompressedFileType.Unknown) { this.Text = this.titleText; this.treeViewTOC.Nodes.Clear(); this.selectedFileToolStripMenuItem.Enabled = false; this.allFilesToolStripMenuItem.Enabled = false; this.textBoxDetails.Lines = null; MessageBox.Show(string.Format("Error Reading {0}", this.sourceFile)); return; } this.selectedFileToolStripMenuItem.Enabled = true; this.allFilesToolStripMenuItem.Enabled = true; this.hideZeroValuesToolStripMenuItem.Enabled = fileType == CompressedFileType.ArzFile; this.Text = string.Format("{0} - {1}", this.titleText, this.sourceFile); this.textBoxDetails.Lines = null; this.pictureBoxItem.Visible = false; this.BuildTreeView(); }
private void _setCompressedDirectory(string fullPath) { string fullFileName = CompressedFileName + "." + CompressedFileType.ToString(); CompressedDirectory = fullPath.Substring(0, fullPath.Length - fullFileName.Length); }
private void _setFileName(string fileName) { string extention = "." + CompressedFileType.ToString(); CompressedFileName = fileName.Substring(0, fileName.Length - extention.Length); }