diff --git a/NovetusLauncher/.vs/NovetusLauncher/v14/.suo b/NovetusLauncher/.vs/NovetusLauncher/v14/.suo index 30276c7..70447da 100644 Binary files a/NovetusLauncher/.vs/NovetusLauncher/v14/.suo and b/NovetusLauncher/.vs/NovetusLauncher/v14/.suo differ diff --git a/NovetusTest_FileDownloader/.vs/NovetusTest_FileDownloader/v14/.suo b/NovetusTest_FileDownloader/.vs/NovetusTest_FileDownloader/v14/.suo new file mode 100644 index 0000000..40a57c2 Binary files /dev/null and b/NovetusTest_FileDownloader/.vs/NovetusTest_FileDownloader/v14/.suo differ diff --git a/NovetusTest_FileDownloader/NovetusTest_FileDownloader.sln b/NovetusTest_FileDownloader/NovetusTest_FileDownloader.sln new file mode 100644 index 0000000..90ad2b6 --- /dev/null +++ b/NovetusTest_FileDownloader/NovetusTest_FileDownloader.sln @@ -0,0 +1,22 @@ + +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}") = "NovetusTest_FileDownloader", "NovetusTest_FileDownloader\NovetusTest_FileDownloader.csproj", "{8638EB3E-97F1-4468-ADC1-DCFCB2902BBB}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {8638EB3E-97F1-4468-ADC1-DCFCB2902BBB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {8638EB3E-97F1-4468-ADC1-DCFCB2902BBB}.Debug|Any CPU.Build.0 = Debug|Any CPU + {8638EB3E-97F1-4468-ADC1-DCFCB2902BBB}.Release|Any CPU.ActiveCfg = Release|Any CPU + {8638EB3E-97F1-4468-ADC1-DCFCB2902BBB}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/NovetusTest_FileDownloader/NovetusTest_FileDownloader/App.config b/NovetusTest_FileDownloader/NovetusTest_FileDownloader/App.config new file mode 100644 index 0000000..88fa402 --- /dev/null +++ b/NovetusTest_FileDownloader/NovetusTest_FileDownloader/App.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/NovetusTest_FileDownloader/NovetusTest_FileDownloader/Downloader.cs b/NovetusTest_FileDownloader/NovetusTest_FileDownloader/Downloader.cs new file mode 100644 index 0000000..08c397e --- /dev/null +++ b/NovetusTest_FileDownloader/NovetusTest_FileDownloader/Downloader.cs @@ -0,0 +1,80 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Net; +using System.Windows.Forms; +using System.IO; +using System.ComponentModel; + +class Downloader +{ + private string fileURL; + private string fileName; + private string fullFileName; + private string fileEXT; + private string fileFilter; + private string downloadOutcome; + private string downloadOutcomeAddText; + private ProgressBar downloadProgress; + private SaveFileDialog saveFileDialog1; + + public Downloader(string url, string name, string ext, string filter, ProgressBar progress) + { + fileName = name; + fileEXT = ext; + fileURL = url; + fileFilter = filter; + fullFileName = fileName + fileEXT; + downloadProgress = progress; + } + + public void setDownloadOutcome(string text) + { + downloadOutcome = text; + } + + public string getDownloadOutcome() + { + return downloadOutcome; + } + + public void InitDownload(string additionalText = "") + { + downloadOutcomeAddText = additionalText; + + saveFileDialog1 = new SaveFileDialog() + { + FileName = fullFileName, + //"Compressed zip files (*.zip)|*.zip|All files (*.*)|*.*" + Filter = fileFilter, + Title = "Save " + fullFileName + }; + + if (saveFileDialog1.ShowDialog() == DialogResult.OK) + { + try + { + MessageBox.Show(saveFileDialog1.FileName); + + using (WebClient wc = new WebClient()) + { + wc.DownloadProgressChanged += wc_DownloadProgressChanged; + wc.DownloadFileAsync(new Uri(fileURL), saveFileDialog1.FileName); + } + + downloadOutcome = "File " + fullFileName + " downloaded!" + downloadOutcomeAddText; + } + catch (Exception ex) + { + downloadOutcome = "Error when downloading file: " + ex.Message; + } + } + } + + void wc_DownloadProgressChanged(object sender, DownloadProgressChangedEventArgs e) + { + downloadProgress.Value = e.ProgressPercentage; + } +} diff --git a/NovetusTest_FileDownloader/NovetusTest_FileDownloader/Form1.Designer.cs b/NovetusTest_FileDownloader/NovetusTest_FileDownloader/Form1.Designer.cs new file mode 100644 index 0000000..30ca180 --- /dev/null +++ b/NovetusTest_FileDownloader/NovetusTest_FileDownloader/Form1.Designer.cs @@ -0,0 +1,140 @@ +namespace NovetusTest_FileDownloader +{ + partial class Form1 + { + /// + /// 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.button1 = new System.Windows.Forms.Button(); + this.progressBar1 = new System.Windows.Forms.ProgressBar(); + this.label1 = new System.Windows.Forms.Label(); + this.textBox1 = new System.Windows.Forms.TextBox(); + this.textBox2 = new System.Windows.Forms.TextBox(); + this.label2 = new System.Windows.Forms.Label(); + this.textBox3 = new System.Windows.Forms.TextBox(); + this.label3 = new System.Windows.Forms.Label(); + this.SuspendLayout(); + // + // button1 + // + this.button1.Location = new System.Drawing.Point(36, 101); + this.button1.Name = "button1"; + this.button1.Size = new System.Drawing.Size(365, 23); + this.button1.TabIndex = 0; + this.button1.Text = "download"; + this.button1.UseVisualStyleBackColor = true; + this.button1.Click += new System.EventHandler(this.button1_Click); + // + // progressBar1 + // + this.progressBar1.Location = new System.Drawing.Point(36, 72); + this.progressBar1.Name = "progressBar1"; + this.progressBar1.Size = new System.Drawing.Size(365, 23); + this.progressBar1.TabIndex = 1; + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Location = new System.Drawing.Point(59, 13); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(46, 13); + this.label1.TabIndex = 2; + this.label1.Text = "filename"; + // + // textBox1 + // + this.textBox1.Location = new System.Drawing.Point(36, 36); + this.textBox1.Name = "textBox1"; + this.textBox1.Size = new System.Drawing.Size(100, 20); + this.textBox1.TabIndex = 3; + // + // textBox2 + // + this.textBox2.Location = new System.Drawing.Point(162, 36); + this.textBox2.Name = "textBox2"; + this.textBox2.Size = new System.Drawing.Size(100, 20); + this.textBox2.TabIndex = 4; + // + // label2 + // + this.label2.AutoSize = true; + this.label2.Location = new System.Drawing.Point(201, 13); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(18, 13); + this.label2.TabIndex = 5; + this.label2.Text = "url"; + // + // textBox3 + // + this.textBox3.Location = new System.Drawing.Point(301, 36); + this.textBox3.Name = "textBox3"; + this.textBox3.Size = new System.Drawing.Size(100, 20); + this.textBox3.TabIndex = 6; + // + // label3 + // + this.label3.AutoSize = true; + this.label3.Location = new System.Drawing.Point(328, 13); + this.label3.Name = "label3"; + this.label3.Size = new System.Drawing.Size(40, 13); + this.label3.TabIndex = 7; + this.label3.Text = "file ext."; + // + // Form1 + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(439, 139); + this.Controls.Add(this.label3); + this.Controls.Add(this.textBox3); + this.Controls.Add(this.label2); + this.Controls.Add(this.textBox2); + this.Controls.Add(this.textBox1); + this.Controls.Add(this.label1); + this.Controls.Add(this.progressBar1); + this.Controls.Add(this.button1); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow; + this.MaximizeBox = false; + this.Name = "Form1"; + this.Text = "Test File Downloader"; + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.Button button1; + private System.Windows.Forms.ProgressBar progressBar1; + private System.Windows.Forms.Label label1; + private System.Windows.Forms.TextBox textBox1; + private System.Windows.Forms.TextBox textBox2; + private System.Windows.Forms.Label label2; + private System.Windows.Forms.TextBox textBox3; + private System.Windows.Forms.Label label3; + } +} + diff --git a/NovetusTest_FileDownloader/NovetusTest_FileDownloader/Form1.cs b/NovetusTest_FileDownloader/NovetusTest_FileDownloader/Form1.cs new file mode 100644 index 0000000..0bdae76 --- /dev/null +++ b/NovetusTest_FileDownloader/NovetusTest_FileDownloader/Form1.cs @@ -0,0 +1,38 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace NovetusTest_FileDownloader +{ + public partial class Form1 : Form + { + public Form1() + { + InitializeComponent(); + } + + private void button1_Click(object sender, EventArgs e) + { + Downloader download = new Downloader(textBox2.Text, textBox1.Text, textBox3.Text, "All files (*.*)|*.*", progressBar1); + + try + { + download.InitDownload(" This was a test download."); + } + catch (Exception) + { + } + + if (!string.IsNullOrWhiteSpace(download.getDownloadOutcome())) + { + MessageBox.Show(download.getDownloadOutcome()); + } + } + } +} diff --git a/NovetusTest_FileDownloader/NovetusTest_FileDownloader/Form1.resx b/NovetusTest_FileDownloader/NovetusTest_FileDownloader/Form1.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/NovetusTest_FileDownloader/NovetusTest_FileDownloader/Form1.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/NovetusTest_FileDownloader/NovetusTest_FileDownloader/NovetusTest_FileDownloader.csproj b/NovetusTest_FileDownloader/NovetusTest_FileDownloader/NovetusTest_FileDownloader.csproj new file mode 100644 index 0000000..26496f2 --- /dev/null +++ b/NovetusTest_FileDownloader/NovetusTest_FileDownloader/NovetusTest_FileDownloader.csproj @@ -0,0 +1,91 @@ + + + + + Debug + AnyCPU + {8638EB3E-97F1-4468-ADC1-DCFCB2902BBB} + WinExe + Properties + NovetusTest_FileDownloader + NovetusTest_FileDownloader + v4.5.2 + 512 + true + + + AnyCPU + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + + + + + + Form + + + Form1.cs + + + + + Form1.cs + + + ResXFileCodeGenerator + Resources.Designer.cs + Designer + + + True + Resources.resx + + + SettingsSingleFileGenerator + Settings.Designer.cs + + + True + Settings.settings + True + + + + + + + + \ No newline at end of file diff --git a/NovetusTest_FileDownloader/NovetusTest_FileDownloader/Program.cs b/NovetusTest_FileDownloader/NovetusTest_FileDownloader/Program.cs new file mode 100644 index 0000000..2d7fd53 --- /dev/null +++ b/NovetusTest_FileDownloader/NovetusTest_FileDownloader/Program.cs @@ -0,0 +1,22 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace NovetusTest_FileDownloader +{ + static class Program + { + /// + /// The main entry point for the application. + /// + [STAThread] + static void Main() + { + Application.EnableVisualStyles(); + Application.SetCompatibleTextRenderingDefault(false); + Application.Run(new Form1()); + } + } +} diff --git a/NovetusTest_FileDownloader/NovetusTest_FileDownloader/Properties/AssemblyInfo.cs b/NovetusTest_FileDownloader/NovetusTest_FileDownloader/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..3911c44 --- /dev/null +++ b/NovetusTest_FileDownloader/NovetusTest_FileDownloader/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("NovetusTest_FileDownloader")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("NovetusTest_FileDownloader")] +[assembly: AssemblyCopyright("Copyright © 2019")] +[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("8638eb3e-97f1-4468-adc1-dcfcb2902bbb")] + +// 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/NovetusTest_FileDownloader/NovetusTest_FileDownloader/Properties/Resources.Designer.cs b/NovetusTest_FileDownloader/NovetusTest_FileDownloader/Properties/Resources.Designer.cs new file mode 100644 index 0000000..9238352 --- /dev/null +++ b/NovetusTest_FileDownloader/NovetusTest_FileDownloader/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 NovetusTest_FileDownloader.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("NovetusTest_FileDownloader.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/NovetusTest_FileDownloader/NovetusTest_FileDownloader/Properties/Resources.resx b/NovetusTest_FileDownloader/NovetusTest_FileDownloader/Properties/Resources.resx new file mode 100644 index 0000000..af7dbeb --- /dev/null +++ b/NovetusTest_FileDownloader/NovetusTest_FileDownloader/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/NovetusTest_FileDownloader/NovetusTest_FileDownloader/Properties/Settings.Designer.cs b/NovetusTest_FileDownloader/NovetusTest_FileDownloader/Properties/Settings.Designer.cs new file mode 100644 index 0000000..6b32b0c --- /dev/null +++ b/NovetusTest_FileDownloader/NovetusTest_FileDownloader/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 NovetusTest_FileDownloader.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/NovetusTest_FileDownloader/NovetusTest_FileDownloader/Properties/Settings.settings b/NovetusTest_FileDownloader/NovetusTest_FileDownloader/Properties/Settings.settings new file mode 100644 index 0000000..3964565 --- /dev/null +++ b/NovetusTest_FileDownloader/NovetusTest_FileDownloader/Properties/Settings.settings @@ -0,0 +1,7 @@ + + + + + + +