From a2cf75395e30334c04903ef791a3969929eeda3a Mon Sep 17 00:00:00 2001 From: Shravan Rajinikanth Date: Thu, 25 May 2017 00:11:30 -0500 Subject: [PATCH] Initial commit --- .gitignore | 236 ++++++++++++++++++ LICENSE | 21 ++ Pdb2Mdb-GUI.sln | 22 ++ Pdb2Mdb-GUI/App.config | 6 + Pdb2Mdb-GUI/ConversionResultsForm.Designer.cs | 69 +++++ Pdb2Mdb-GUI/ConversionResultsForm.cs | 36 +++ Pdb2Mdb-GUI/ConversionResultsForm.resx | 120 +++++++++ Pdb2Mdb-GUI/FodyWeavers.xml | 4 + Pdb2Mdb-GUI/MainForm.Designer.cs | 143 +++++++++++ Pdb2Mdb-GUI/MainForm.cs | 75 ++++++ Pdb2Mdb-GUI/MainForm.resx | 120 +++++++++ Pdb2Mdb-GUI/Pdb2Mdb-GUI.csproj | 129 ++++++++++ Pdb2Mdb-GUI/Pdb2MdbConverter.cs | 73 ++++++ Pdb2Mdb-GUI/Program.cs | 19 ++ Pdb2Mdb-GUI/Properties/AssemblyInfo.cs | 36 +++ Pdb2Mdb-GUI/Properties/Resources.Designer.cs | 71 ++++++ Pdb2Mdb-GUI/Properties/Resources.resx | 117 +++++++++ Pdb2Mdb-GUI/Properties/Settings.Designer.cs | 30 +++ Pdb2Mdb-GUI/Properties/Settings.settings | 7 + Pdb2Mdb-GUI/Properties/app.manifest | 70 ++++++ Pdb2Mdb-GUI/RichTextBoxExtensions.cs | 22 ++ Pdb2Mdb-GUI/packages.config | 6 + 22 files changed, 1432 insertions(+) create mode 100644 .gitignore create mode 100644 LICENSE create mode 100644 Pdb2Mdb-GUI.sln create mode 100644 Pdb2Mdb-GUI/App.config create mode 100644 Pdb2Mdb-GUI/ConversionResultsForm.Designer.cs create mode 100644 Pdb2Mdb-GUI/ConversionResultsForm.cs create mode 100644 Pdb2Mdb-GUI/ConversionResultsForm.resx create mode 100644 Pdb2Mdb-GUI/FodyWeavers.xml create mode 100644 Pdb2Mdb-GUI/MainForm.Designer.cs create mode 100644 Pdb2Mdb-GUI/MainForm.cs create mode 100644 Pdb2Mdb-GUI/MainForm.resx create mode 100644 Pdb2Mdb-GUI/Pdb2Mdb-GUI.csproj create mode 100644 Pdb2Mdb-GUI/Pdb2MdbConverter.cs create mode 100644 Pdb2Mdb-GUI/Program.cs create mode 100644 Pdb2Mdb-GUI/Properties/AssemblyInfo.cs create mode 100644 Pdb2Mdb-GUI/Properties/Resources.Designer.cs create mode 100644 Pdb2Mdb-GUI/Properties/Resources.resx create mode 100644 Pdb2Mdb-GUI/Properties/Settings.Designer.cs create mode 100644 Pdb2Mdb-GUI/Properties/Settings.settings create mode 100644 Pdb2Mdb-GUI/Properties/app.manifest create mode 100644 Pdb2Mdb-GUI/RichTextBoxExtensions.cs create mode 100644 Pdb2Mdb-GUI/packages.config diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..94420dc --- /dev/null +++ b/.gitignore @@ -0,0 +1,236 @@ +## Ignore Visual Studio temporary files, build results, and +## files generated by popular Visual Studio add-ons. + +# User-specific files +*.suo +*.user +*.userosscache +*.sln.docstates + +# User-specific files (MonoDevelop/Xamarin Studio) +*.userprefs + +# Build results +[Dd]ebug/ +[Dd]ebugPublic/ +[Rr]elease/ +[Rr]eleases/ +x64/ +x86/ +bld/ +[Bb]in/ +[Oo]bj/ + +# Visual Studio 2015 cache/options directory +.vs/ +# Uncomment if you have tasks that create the project's static files in wwwroot +#wwwroot/ + +# MSTest test Results +[Tt]est[Rr]esult*/ +[Bb]uild[Ll]og.* + +# NUNIT +*.VisualState.xml +TestResult.xml + +# Build Results of an ATL Project +[Dd]ebugPS/ +[Rr]eleasePS/ +dlldata.c + +# DNX +project.lock.json +artifacts/ + +*_i.c +*_p.c +*_i.h +*.ilk +*.meta +*.obj +*.pch +*.pdb +*.pgc +*.pgd +*.rsp +*.sbr +*.tlb +*.tli +*.tlh +*.tmp +*.tmp_proj +*.log +*.vspscc +*.vssscc +.builds +*.pidb +*.svclog +*.scc + +# Chutzpah Test files +_Chutzpah* + +# Visual C++ cache files +ipch/ +*.aps +*.ncb +*.opendb +*.opensdf +*.sdf +*.cachefile + +# Visual Studio profiler +*.psess +*.vsp +*.vspx +*.sap + +# TFS 2012 Local Workspace +$tf/ + +# Guidance Automation Toolkit +*.gpState + +# ReSharper is a .NET coding add-in +_ReSharper*/ +*.[Rr]e[Ss]harper +*.DotSettings.user + +# JustCode is a .NET coding add-in +.JustCode + +# TeamCity is a build add-in +_TeamCity* + +# DotCover is a Code Coverage Tool +*.dotCover + +# NCrunch +_NCrunch_* +.*crunch*.local.xml +nCrunchTemp_* + +# MightyMoose +*.mm.* +AutoTest.Net/ + +# Web workbench (sass) +.sass-cache/ + +# Installshield output folder +[Ee]xpress/ + +# DocProject is a documentation generator add-in +DocProject/buildhelp/ +DocProject/Help/*.HxT +DocProject/Help/*.HxC +DocProject/Help/*.hhc +DocProject/Help/*.hhk +DocProject/Help/*.hhp +DocProject/Help/Html2 +DocProject/Help/html + +# Click-Once directory +publish/ + +# Publish Web Output +*.[Pp]ublish.xml +*.azurePubxml +# TODO: Comment the next line if you want to checkin your web deploy settings +# but database connection strings (with potential passwords) will be unencrypted +*.pubxml +*.publishproj + +# NuGet Packages +*.nupkg +# The packages folder can be ignored because of Package Restore +**/packages/* +# except build/, which is used as an MSBuild target. +!**/packages/build/ +# Uncomment if necessary however generally it will be regenerated when needed +#!**/packages/repositories.config +# NuGet v3's project.json files produces more ignoreable files +*.nuget.props +*.nuget.targets + +# Microsoft Azure Build Output +csx/ +*.build.csdef + +# Microsoft Azure Emulator +ecf/ +rcf/ + +# Microsoft Azure ApplicationInsights config file +ApplicationInsights.config + +# Windows Store app package directory +AppPackages/ +BundleArtifacts/ + +# Visual Studio cache files +# files ending in .cache can be ignored +*.[Cc]ache +# but keep track of directories ending in .cache +!*.[Cc]ache/ + +# Others +ClientBin/ +~$* +*~ +*.dbmdl +*.dbproj.schemaview +*.pfx +*.publishsettings +node_modules/ +orleans.codegen.cs + +# RIA/Silverlight projects +Generated_Code/ + +# Backup & report files from converting an old project file +# to a newer Visual Studio version. Backup files are not needed, +# because we have git ;-) +_UpgradeReport_Files/ +Backup*/ +UpgradeLog*.XML +UpgradeLog*.htm + +# SQL Server files +*.mdf +*.ldf + +# Business Intelligence projects +*.rdl.data +*.bim.layout +*.bim_*.settings + +# Microsoft Fakes +FakesAssemblies/ + +# GhostDoc plugin setting file +*.GhostDoc.xml + +# Node.js Tools for Visual Studio +.ntvs_analysis.dat + +# Visual Studio 6 build log +*.plg + +# Visual Studio 6 workspace options file +*.opt + +# Visual Studio LightSwitch build output +**/*.HTMLClient/GeneratedArtifacts +**/*.DesktopClient/GeneratedArtifacts +**/*.DesktopClient/ModelManifest.xml +**/*.Server/GeneratedArtifacts +**/*.Server/ModelManifest.xml +_Pvt_Extensions + +# Paket dependency manager +.paket/paket.exe + +# FAKE - F# Make +.fake/ diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..5c62c1d --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2016 Shravan Rajinikanth + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/Pdb2Mdb-GUI.sln b/Pdb2Mdb-GUI.sln new file mode 100644 index 0000000..db2e73f --- /dev/null +++ b/Pdb2Mdb-GUI.sln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.26430.6 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Pdb2Mdb-GUI", "Pdb2Mdb-GUI\Pdb2Mdb-GUI.csproj", "{45EB73E2-CA91-4696-9F97-E4468C63BA74}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {45EB73E2-CA91-4696-9F97-E4468C63BA74}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {45EB73E2-CA91-4696-9F97-E4468C63BA74}.Debug|Any CPU.Build.0 = Debug|Any CPU + {45EB73E2-CA91-4696-9F97-E4468C63BA74}.Release|Any CPU.ActiveCfg = Release|Any CPU + {45EB73E2-CA91-4696-9F97-E4468C63BA74}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/Pdb2Mdb-GUI/App.config b/Pdb2Mdb-GUI/App.config new file mode 100644 index 0000000..88fa402 --- /dev/null +++ b/Pdb2Mdb-GUI/App.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/Pdb2Mdb-GUI/ConversionResultsForm.Designer.cs b/Pdb2Mdb-GUI/ConversionResultsForm.Designer.cs new file mode 100644 index 0000000..c201d86 --- /dev/null +++ b/Pdb2Mdb-GUI/ConversionResultsForm.Designer.cs @@ -0,0 +1,69 @@ +namespace Pdb2Mdb_GUI +{ + partial class ConversionResultsForm + { + /// + /// 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.ResultsBox = new System.Windows.Forms.RichTextBox(); + this.SuspendLayout(); + // + // ResultsBox + // + this.ResultsBox.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.ResultsBox.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.ResultsBox.Location = new System.Drawing.Point(12, 12); + this.ResultsBox.Name = "ResultsBox"; + this.ResultsBox.ReadOnly = true; + this.ResultsBox.Size = new System.Drawing.Size(846, 688); + this.ResultsBox.TabIndex = 0; + this.ResultsBox.Text = ""; + this.ResultsBox.WordWrap = false; + // + // ConversionResultsForm + // + this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 20F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(870, 712); + this.Controls.Add(this.ResultsBox); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.SizableToolWindow; + this.MinimumSize = new System.Drawing.Size(892, 768); + this.Name = "ConversionResultsForm"; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; + this.Text = "Conversion Results"; + this.TopMost = true; + this.Load += new System.EventHandler(this.ConversionResultsForm_Load); + this.ResumeLayout(false); + + } + + #endregion + + private System.Windows.Forms.RichTextBox ResultsBox; + } +} \ No newline at end of file diff --git a/Pdb2Mdb-GUI/ConversionResultsForm.cs b/Pdb2Mdb-GUI/ConversionResultsForm.cs new file mode 100644 index 0000000..2b6fef6 --- /dev/null +++ b/Pdb2Mdb-GUI/ConversionResultsForm.cs @@ -0,0 +1,36 @@ +using System.Collections.Generic; +using System.Drawing; +using System.IO; +using System.Windows.Forms; + +namespace Pdb2Mdb_GUI +{ + public partial class ConversionResultsForm : Form + { + private readonly Dictionary _conversionResults; + + public ConversionResultsForm(Dictionary conversionResults) + { + _conversionResults = conversionResults; + InitializeComponent(); + } + + private void ConversionResultsForm_Load(object sender, System.EventArgs e) + { + foreach (Pdb2MdbConverter.ConversionResult curResult in _conversionResults.Values) + { + if (curResult.Success) + { + ResultsBox.AppendText($"{Path.GetDirectoryName(curResult.Path)}\\", Color.LimeGreen); + ResultsBox.AppendText($"{Path.GetFileName(curResult.Path)}\n", Color.Green); + } + else + { + ResultsBox.AppendText($"{Path.GetDirectoryName(curResult.Path)}\\", Color.Red); + ResultsBox.AppendText($"{Path.GetFileName(curResult.Path)}", Color.DarkRed); + ResultsBox.AppendText($"({curResult.Error.Message})\n", Color.IndianRed); + } + } + } + } +} diff --git a/Pdb2Mdb-GUI/ConversionResultsForm.resx b/Pdb2Mdb-GUI/ConversionResultsForm.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/Pdb2Mdb-GUI/ConversionResultsForm.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/Pdb2Mdb-GUI/FodyWeavers.xml b/Pdb2Mdb-GUI/FodyWeavers.xml new file mode 100644 index 0000000..fcfc278 --- /dev/null +++ b/Pdb2Mdb-GUI/FodyWeavers.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/Pdb2Mdb-GUI/MainForm.Designer.cs b/Pdb2Mdb-GUI/MainForm.Designer.cs new file mode 100644 index 0000000..673c334 --- /dev/null +++ b/Pdb2Mdb-GUI/MainForm.Designer.cs @@ -0,0 +1,143 @@ +namespace Pdb2Mdb_GUI +{ + partial class MainForm + { + /// + /// 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.DndPanel = new System.Windows.Forms.Panel(); + this.ConversionProgress = new System.Windows.Forms.ProgressBar(); + this.DndLabel = new System.Windows.Forms.Label(); + this.ResultGroup = new System.Windows.Forms.GroupBox(); + this.SuccessLabel = new System.Windows.Forms.Label(); + this.SuccessResultLabel = new System.Windows.Forms.Label(); + this.DetailsButton = new System.Windows.Forms.Button(); + this.DndPanel.SuspendLayout(); + this.ResultGroup.SuspendLayout(); + this.SuspendLayout(); + // + // DndPanel + // + this.DndPanel.Controls.Add(this.DndLabel); + this.DndPanel.Location = new System.Drawing.Point(12, 12); + this.DndPanel.Name = "DndPanel"; + this.DndPanel.Size = new System.Drawing.Size(424, 204); + this.DndPanel.TabIndex = 0; + // + // ConversionProgress + // + this.ConversionProgress.Location = new System.Drawing.Point(12, 222); + this.ConversionProgress.Name = "ConversionProgress"; + this.ConversionProgress.Size = new System.Drawing.Size(424, 38); + this.ConversionProgress.TabIndex = 3; + // + // DndLabel + // + this.DndLabel.AllowDrop = true; + this.DndLabel.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.DndLabel.Dock = System.Windows.Forms.DockStyle.Fill; + this.DndLabel.Location = new System.Drawing.Point(0, 0); + this.DndLabel.Name = "DndLabel"; + this.DndLabel.Size = new System.Drawing.Size(424, 204); + this.DndLabel.TabIndex = 0; + this.DndLabel.Text = "To convert, drag .dll or .exe files or even directories here !"; + this.DndLabel.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + this.DndLabel.DragDrop += new System.Windows.Forms.DragEventHandler(this.DndLabel_DragDrop); + this.DndLabel.DragEnter += new System.Windows.Forms.DragEventHandler(this.DndLabel_DragEnter); + this.DndLabel.DragLeave += new System.EventHandler(this.DndLabel_DragLeave); + // + // ResultGroup + // + this.ResultGroup.Controls.Add(this.DetailsButton); + this.ResultGroup.Controls.Add(this.SuccessResultLabel); + this.ResultGroup.Controls.Add(this.SuccessLabel); + this.ResultGroup.Enabled = false; + this.ResultGroup.Location = new System.Drawing.Point(12, 266); + this.ResultGroup.Name = "ResultGroup"; + this.ResultGroup.Size = new System.Drawing.Size(424, 73); + this.ResultGroup.TabIndex = 4; + this.ResultGroup.TabStop = false; + this.ResultGroup.Text = "Conversion Results"; + // + // SuccessLabel + // + this.SuccessLabel.AutoSize = true; + this.SuccessLabel.Location = new System.Drawing.Point(16, 32); + this.SuccessLabel.Name = "SuccessLabel"; + this.SuccessLabel.Size = new System.Drawing.Size(74, 20); + this.SuccessLabel.TabIndex = 0; + this.SuccessLabel.Text = "Success:"; + // + // SuccessResultLabel + // + this.SuccessResultLabel.AutoSize = true; + this.SuccessResultLabel.Location = new System.Drawing.Point(113, 32); + this.SuccessResultLabel.Name = "SuccessResultLabel"; + this.SuccessResultLabel.Size = new System.Drawing.Size(14, 20); + this.SuccessResultLabel.TabIndex = 1; + this.SuccessResultLabel.Text = "-"; + // + // DetailsButton + // + this.DetailsButton.Location = new System.Drawing.Point(240, 27); + this.DetailsButton.Name = "DetailsButton"; + this.DetailsButton.Size = new System.Drawing.Size(166, 30); + this.DetailsButton.TabIndex = 2; + this.DetailsButton.Text = "Details"; + this.DetailsButton.UseVisualStyleBackColor = true; + this.DetailsButton.Click += new System.EventHandler(this.DetailsButton_Click); + // + // MainForm + // + this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 20F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(448, 350); + this.Controls.Add(this.ResultGroup); + this.Controls.Add(this.ConversionProgress); + this.Controls.Add(this.DndPanel); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow; + this.Name = "MainForm"; + this.Text = "Pdb2Mdb-GUI"; + this.TopMost = true; + this.DndPanel.ResumeLayout(false); + this.ResultGroup.ResumeLayout(false); + this.ResultGroup.PerformLayout(); + this.ResumeLayout(false); + + } + + #endregion + + private System.Windows.Forms.Panel DndPanel; + private System.Windows.Forms.Label DndLabel; + private System.Windows.Forms.ProgressBar ConversionProgress; + private System.Windows.Forms.GroupBox ResultGroup; + private System.Windows.Forms.Label SuccessLabel; + private System.Windows.Forms.Label SuccessResultLabel; + private System.Windows.Forms.Button DetailsButton; + } +} + diff --git a/Pdb2Mdb-GUI/MainForm.cs b/Pdb2Mdb-GUI/MainForm.cs new file mode 100644 index 0000000..8a16b9d --- /dev/null +++ b/Pdb2Mdb-GUI/MainForm.cs @@ -0,0 +1,75 @@ +using System; +using System.Collections.Generic; +using System.Drawing; +using System.IO; +using System.Linq; +using System.Threading.Tasks; +using System.Windows.Forms; +using Pdb2Mdb; + +namespace Pdb2Mdb_GUI +{ + public partial class MainForm : Form + { + private Dictionary _recentConversionResults; + + public MainForm() + { + InitializeComponent(); + } + + private void DndLabel_DragEnter(object sender, DragEventArgs e) + { + DndLabel.BackColor = Color.PaleGreen; + e.Effect = DragDropEffects.Copy; + } + + private void DndLabel_DragLeave(object sender, EventArgs e) + { + DndLabel.BackColor = Color.Transparent; + } + + private async void DndLabel_DragDrop(object sender, DragEventArgs e) + { + DndLabel.BackColor = Color.Transparent; + + string[] droppedPaths = (string[]) e.Data.GetData(DataFormats.FileDrop); + await ConvertAllAsync(droppedPaths); + } + + private void DetailsButton_Click(object sender, EventArgs e) + { + ConversionResultsForm resultsForm = new ConversionResultsForm(_recentConversionResults); + resultsForm.ShowDialog(); + } + + private async Task ConvertAllAsync(string[] paths) + { + List netPaths = Pdb2MdbConverter.GetNetResourcePaths(paths); + Dictionary conversionResults = new Dictionary(); + + // Clear results + DndPanel.Enabled = false; + ConversionProgress.Value = 0; + ResultGroup.Enabled = false; + SuccessResultLabel.Text = "-"; + + // Convert + for (int index = 0; index < netPaths.Count; index++) + { + Pdb2MdbConverter.ConversionResult curResult = await Pdb2MdbConverter.ConvertNetResourceAsync(netPaths[index]); + conversionResults.Add(netPaths[index], curResult); + + ConversionProgress.Value = (int) ((float) (index + 1) / netPaths.Count * 100); + } + + // Display results + DndPanel.Enabled = true; + ResultGroup.Enabled = true; + int numSuccessful = conversionResults.Values.Count(result => result.Success); + SuccessResultLabel.Text = $"{numSuccessful}/{netPaths.Count}"; + + _recentConversionResults = conversionResults; + } + } +} diff --git a/Pdb2Mdb-GUI/MainForm.resx b/Pdb2Mdb-GUI/MainForm.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/Pdb2Mdb-GUI/MainForm.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/Pdb2Mdb-GUI/Pdb2Mdb-GUI.csproj b/Pdb2Mdb-GUI/Pdb2Mdb-GUI.csproj new file mode 100644 index 0000000..49d17fc --- /dev/null +++ b/Pdb2Mdb-GUI/Pdb2Mdb-GUI.csproj @@ -0,0 +1,129 @@ + + + + + Debug + AnyCPU + {45EB73E2-CA91-4696-9F97-E4468C63BA74} + WinExe + Pdb2Mdb_GUI + Pdb2Mdb-GUI + v4.5.2 + 512 + true + + + + + AnyCPU + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + false + + + LocalIntranet + + + false + + + Properties\app.manifest + + + + False + ..\packages\Mono.Unofficial.pdb2mdb.4.2.3.4\tools\pdb2mdb.exe + + + + + + + + + + + + + + + + Form + + + ConversionResultsForm.cs + + + Form + + + MainForm.cs + + + + + + + ConversionResultsForm.cs + + + MainForm.cs + + + ResXFileCodeGenerator + Resources.Designer.cs + Designer + + + True + Resources.resx + + + + + SettingsSingleFileGenerator + Settings.Designer.cs + + + True + Settings.settings + True + + + + + + + + + + + + + + + + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. + + + + + + + \ No newline at end of file diff --git a/Pdb2Mdb-GUI/Pdb2MdbConverter.cs b/Pdb2Mdb-GUI/Pdb2MdbConverter.cs new file mode 100644 index 0000000..82d6bf0 --- /dev/null +++ b/Pdb2Mdb-GUI/Pdb2MdbConverter.cs @@ -0,0 +1,73 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Pdb2Mdb; + +namespace Pdb2Mdb_GUI +{ + public static class Pdb2MdbConverter + { + public static List GetNetResourcePaths(IEnumerable paths) + { + List netPaths = new List(); + + foreach (string path in paths) + { + FileAttributes attr = File.GetAttributes(path); + + if (attr.HasFlag(FileAttributes.Directory)) + { + // Path is a directory. + + // We do not recursively convert. This is intentional. + foreach (string subFile in Directory.EnumerateFiles(path)) + if (IsNetResource(subFile)) + netPaths.Add(subFile); + } + else + { + // Path is a file. + + if (IsNetResource(path)) + netPaths.Add(path); + } + } + + return netPaths; + } + + private static bool IsNetResource(string path) + { + string fileExtension = Path.GetExtension(path); + return (fileExtension == ".dll" || fileExtension == ".exe"); + } + + public static async Task ConvertNetResourceAsync(string path) + { + ConversionResult result = new ConversionResult { Path = path }; + + try + { + await Task.Run(() => Converter.Convert(path)); + result.Success = true; + } + catch (Exception ex) + { + result.Success = false; + result.Error = ex; + } + + return result; + } + + public class ConversionResult + { + public string Path { get; set; } + public bool Success { get; set; } + public Exception Error { get; set; } + } + } +} diff --git a/Pdb2Mdb-GUI/Program.cs b/Pdb2Mdb-GUI/Program.cs new file mode 100644 index 0000000..15104c2 --- /dev/null +++ b/Pdb2Mdb-GUI/Program.cs @@ -0,0 +1,19 @@ +using System; +using System.Windows.Forms; + +namespace Pdb2Mdb_GUI +{ + public static class Program + { + /// + /// The main entry point for the application. + /// + [STAThread] + private static void Main() + { + Application.EnableVisualStyles(); + Application.SetCompatibleTextRenderingDefault(false); + Application.Run(new MainForm()); + } + } +} diff --git a/Pdb2Mdb-GUI/Properties/AssemblyInfo.cs b/Pdb2Mdb-GUI/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..ca9306a --- /dev/null +++ b/Pdb2Mdb-GUI/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +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("Pdb2Mdb-GUI")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("Pdb2Mdb-GUI")] +[assembly: AssemblyCopyright("Copyright © 2017")] +[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("45eb73e2-ca91-4696-9f97-e4468c63ba74")] + +// 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")] diff --git a/Pdb2Mdb-GUI/Properties/Resources.Designer.cs b/Pdb2Mdb-GUI/Properties/Resources.Designer.cs new file mode 100644 index 0000000..982aaf3 --- /dev/null +++ b/Pdb2Mdb-GUI/Properties/Resources.Designer.cs @@ -0,0 +1,71 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace Pdb2Mdb_GUI.Properties +{ + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resources + { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() + { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager + { + get + { + if ((resourceMan == null)) + { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Pdb2Mdb_GUI.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture + { + get + { + return resourceCulture; + } + set + { + resourceCulture = value; + } + } + } +} diff --git a/Pdb2Mdb-GUI/Properties/Resources.resx b/Pdb2Mdb-GUI/Properties/Resources.resx new file mode 100644 index 0000000..af7dbeb --- /dev/null +++ b/Pdb2Mdb-GUI/Properties/Resources.resx @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/Pdb2Mdb-GUI/Properties/Settings.Designer.cs b/Pdb2Mdb-GUI/Properties/Settings.Designer.cs new file mode 100644 index 0000000..3d41e4b --- /dev/null +++ b/Pdb2Mdb-GUI/Properties/Settings.Designer.cs @@ -0,0 +1,30 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace Pdb2Mdb_GUI.Properties +{ + + + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] + internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase + { + + private static Settings defaultInstance = ((Settings) (global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); + + public static Settings Default + { + get + { + return defaultInstance; + } + } + } +} diff --git a/Pdb2Mdb-GUI/Properties/Settings.settings b/Pdb2Mdb-GUI/Properties/Settings.settings new file mode 100644 index 0000000..3964565 --- /dev/null +++ b/Pdb2Mdb-GUI/Properties/Settings.settings @@ -0,0 +1,7 @@ + + + + + + + diff --git a/Pdb2Mdb-GUI/Properties/app.manifest b/Pdb2Mdb-GUI/Properties/app.manifest new file mode 100644 index 0000000..d9fb3e7 --- /dev/null +++ b/Pdb2Mdb-GUI/Properties/app.manifest @@ -0,0 +1,70 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + true + + + + + + \ No newline at end of file diff --git a/Pdb2Mdb-GUI/RichTextBoxExtensions.cs b/Pdb2Mdb-GUI/RichTextBoxExtensions.cs new file mode 100644 index 0000000..2f9a621 --- /dev/null +++ b/Pdb2Mdb-GUI/RichTextBoxExtensions.cs @@ -0,0 +1,22 @@ +using System.Drawing; +using System.Windows.Forms; + +namespace Pdb2Mdb_GUI +{ + /* + * Credit: https://stackoverflow.com/users/8799/nathan-baulch from https://stackoverflow.com/questions/1926264/color-different-parts-of-a-richtextbox-string + */ + + public static class RichTextBoxExtensions + { + public static void AppendText(this RichTextBox box, string text, Color color) + { + box.SelectionStart = box.TextLength; + box.SelectionLength = 0; + + box.SelectionColor = color; + box.AppendText(text); + box.SelectionColor = box.ForeColor; + } + } +} diff --git a/Pdb2Mdb-GUI/packages.config b/Pdb2Mdb-GUI/packages.config new file mode 100644 index 0000000..ded54a6 --- /dev/null +++ b/Pdb2Mdb-GUI/packages.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file