Update Lib hinzugefügt

This commit is contained in:
Husky
2021-03-25 19:01:54 +01:00
parent 69e10af592
commit b7048beede
12 changed files with 597 additions and 29 deletions

View File

@@ -400,6 +400,10 @@
<Project>{e4979419-5eae-4b6d-a6a0-9632c1de87a0}</Project> <Project>{e4979419-5eae-4b6d-a6a0-9632c1de87a0}</Project>
<Name>TempCAN</Name> <Name>TempCAN</Name>
</ProjectReference> </ProjectReference>
<ProjectReference Include="..\UpdateLib\UpdateLib.csproj">
<Project>{cf95db30-247b-4382-948e-3bd5eb73c938}</Project>
<Name>UpdateLib</Name>
</ProjectReference>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<EmbeddedResource Include="UCWerkseitigImprägniert.resx"> <EmbeddedResource Include="UCWerkseitigImprägniert.resx">

View File

@@ -37,6 +37,7 @@
this.öffnenToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.öffnenToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.stammdatenImportierenToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.stammdatenImportierenToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.auftraggeberToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.auftraggeberToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.prefixSuffixToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.speichernToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.speichernToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.massenstatistikToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.massenstatistikToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.projektordnerÖffnenToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.projektordnerÖffnenToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
@@ -48,7 +49,7 @@
this.statusStrip1 = new System.Windows.Forms.StatusStrip(); this.statusStrip1 = new System.Windows.Forms.StatusStrip();
this.toolStripStatus_projekt_Label = new System.Windows.Forms.ToolStripStatusLabel(); this.toolStripStatus_projekt_Label = new System.Windows.Forms.ToolStripStatusLabel();
this.toolstrip_gesamtLiner = new System.Windows.Forms.ToolStripStatusLabel(); this.toolstrip_gesamtLiner = new System.Windows.Forms.ToolStripStatusLabel();
this.prefixSuffixToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.update = new UpdateLib.Updater();
this.mainmenu.SuspendLayout(); this.mainmenu.SuspendLayout();
this.statusStrip1.SuspendLayout(); this.statusStrip1.SuspendLayout();
this.SuspendLayout(); this.SuspendLayout();
@@ -67,8 +68,7 @@
this.berichteToolStripMenuItem}); this.berichteToolStripMenuItem});
this.mainmenu.Location = new System.Drawing.Point(0, 0); this.mainmenu.Location = new System.Drawing.Point(0, 0);
this.mainmenu.Name = "mainmenu"; this.mainmenu.Name = "mainmenu";
this.mainmenu.Padding = new System.Windows.Forms.Padding(8, 2, 0, 2); this.mainmenu.Size = new System.Drawing.Size(813, 29);
this.mainmenu.Size = new System.Drawing.Size(1084, 36);
this.mainmenu.TabIndex = 1; this.mainmenu.TabIndex = 1;
this.mainmenu.Text = "menuStrip1"; this.mainmenu.Text = "menuStrip1";
// //
@@ -81,67 +81,74 @@
this.auftraggeberToolStripMenuItem, this.auftraggeberToolStripMenuItem,
this.prefixSuffixToolStripMenuItem}); this.prefixSuffixToolStripMenuItem});
this.projektToolStripMenuItem.Name = "projektToolStripMenuItem"; this.projektToolStripMenuItem.Name = "projektToolStripMenuItem";
this.projektToolStripMenuItem.Size = new System.Drawing.Size(88, 32); this.projektToolStripMenuItem.Size = new System.Drawing.Size(71, 25);
this.projektToolStripMenuItem.Text = "Projekt"; this.projektToolStripMenuItem.Text = "Projekt";
// //
// neuToolStripMenuItem // neuToolStripMenuItem
// //
this.neuToolStripMenuItem.Name = "neuToolStripMenuItem"; this.neuToolStripMenuItem.Name = "neuToolStripMenuItem";
this.neuToolStripMenuItem.Size = new System.Drawing.Size(318, 32); this.neuToolStripMenuItem.Size = new System.Drawing.Size(254, 26);
this.neuToolStripMenuItem.Text = "Neu"; this.neuToolStripMenuItem.Text = "Neu";
this.neuToolStripMenuItem.Click += new System.EventHandler(this.neuToolStripMenuItem_Click); this.neuToolStripMenuItem.Click += new System.EventHandler(this.neuToolStripMenuItem_Click);
// //
// öffnenToolStripMenuItem // öffnenToolStripMenuItem
// //
this.öffnenToolStripMenuItem.Name = "öffnenToolStripMenuItem"; this.öffnenToolStripMenuItem.Name = "öffnenToolStripMenuItem";
this.öffnenToolStripMenuItem.Size = new System.Drawing.Size(318, 32); this.öffnenToolStripMenuItem.Size = new System.Drawing.Size(254, 26);
this.öffnenToolStripMenuItem.Text = "Öffnen"; this.öffnenToolStripMenuItem.Text = "Öffnen";
this.öffnenToolStripMenuItem.Click += new System.EventHandler(this.öffnenToolStripMenuItem_Click); this.öffnenToolStripMenuItem.Click += new System.EventHandler(this.öffnenToolStripMenuItem_Click);
// //
// stammdatenImportierenToolStripMenuItem // stammdatenImportierenToolStripMenuItem
// //
this.stammdatenImportierenToolStripMenuItem.Name = "stammdatenImportierenToolStripMenuItem"; this.stammdatenImportierenToolStripMenuItem.Name = "stammdatenImportierenToolStripMenuItem";
this.stammdatenImportierenToolStripMenuItem.Size = new System.Drawing.Size(318, 32); this.stammdatenImportierenToolStripMenuItem.Size = new System.Drawing.Size(254, 26);
this.stammdatenImportierenToolStripMenuItem.Text = "Stammdaten importieren"; this.stammdatenImportierenToolStripMenuItem.Text = "Stammdaten importieren";
this.stammdatenImportierenToolStripMenuItem.Click += new System.EventHandler(this.stammdatenImportierenToolStripMenuItem_Click); this.stammdatenImportierenToolStripMenuItem.Click += new System.EventHandler(this.stammdatenImportierenToolStripMenuItem_Click);
// //
// auftraggeberToolStripMenuItem // auftraggeberToolStripMenuItem
// //
this.auftraggeberToolStripMenuItem.Name = "auftraggeberToolStripMenuItem"; this.auftraggeberToolStripMenuItem.Name = "auftraggeberToolStripMenuItem";
this.auftraggeberToolStripMenuItem.Size = new System.Drawing.Size(318, 32); this.auftraggeberToolStripMenuItem.Size = new System.Drawing.Size(254, 26);
this.auftraggeberToolStripMenuItem.Text = "Auftraggeber"; this.auftraggeberToolStripMenuItem.Text = "Auftraggeber";
this.auftraggeberToolStripMenuItem.Click += new System.EventHandler(this.auftraggeberToolStripMenuItem_Click); this.auftraggeberToolStripMenuItem.Click += new System.EventHandler(this.auftraggeberToolStripMenuItem_Click);
// //
// prefixSuffixToolStripMenuItem
//
this.prefixSuffixToolStripMenuItem.Name = "prefixSuffixToolStripMenuItem";
this.prefixSuffixToolStripMenuItem.Size = new System.Drawing.Size(254, 26);
this.prefixSuffixToolStripMenuItem.Text = "Prefix / Suffix";
this.prefixSuffixToolStripMenuItem.Click += new System.EventHandler(this.PrefixSuffixToolStripMenuItem_Click);
//
// speichernToolStripMenuItem // speichernToolStripMenuItem
// //
this.speichernToolStripMenuItem.Name = "speichernToolStripMenuItem"; this.speichernToolStripMenuItem.Name = "speichernToolStripMenuItem";
this.speichernToolStripMenuItem.Size = new System.Drawing.Size(112, 32); this.speichernToolStripMenuItem.Size = new System.Drawing.Size(91, 25);
this.speichernToolStripMenuItem.Text = "Speichern"; this.speichernToolStripMenuItem.Text = "Speichern";
this.speichernToolStripMenuItem.Click += new System.EventHandler(this.speichernToolStripMenuItem_Click); this.speichernToolStripMenuItem.Click += new System.EventHandler(this.speichernToolStripMenuItem_Click);
// //
// massenstatistikToolStripMenuItem // massenstatistikToolStripMenuItem
// //
this.massenstatistikToolStripMenuItem.Name = "massenstatistikToolStripMenuItem"; this.massenstatistikToolStripMenuItem.Name = "massenstatistikToolStripMenuItem";
this.massenstatistikToolStripMenuItem.Size = new System.Drawing.Size(158, 32); this.massenstatistikToolStripMenuItem.Size = new System.Drawing.Size(128, 25);
this.massenstatistikToolStripMenuItem.Text = "Massenstatistik"; this.massenstatistikToolStripMenuItem.Text = "Massenstatistik";
this.massenstatistikToolStripMenuItem.Click += new System.EventHandler(this.massenstatistikToolStripMenuItem_Click); this.massenstatistikToolStripMenuItem.Click += new System.EventHandler(this.massenstatistikToolStripMenuItem_Click);
// //
// projektordnerÖffnenToolStripMenuItem // projektordnerÖffnenToolStripMenuItem
// //
this.projektordnerÖffnenToolStripMenuItem.Name = "projektordnerÖffnenToolStripMenuItem"; this.projektordnerÖffnenToolStripMenuItem.Name = "projektordnerÖffnenToolStripMenuItem";
this.projektordnerÖffnenToolStripMenuItem.Size = new System.Drawing.Size(211, 32); this.projektordnerÖffnenToolStripMenuItem.Size = new System.Drawing.Size(170, 25);
this.projektordnerÖffnenToolStripMenuItem.Text = "Projektordner Öffnen"; this.projektordnerÖffnenToolStripMenuItem.Text = "Projektordner Öffnen";
this.projektordnerÖffnenToolStripMenuItem.Click += new System.EventHandler(this.ProjektordnerÖffnenToolStripMenuItem_Click); this.projektordnerÖffnenToolStripMenuItem.Click += new System.EventHandler(this.ProjektordnerÖffnenToolStripMenuItem_Click);
// //
// toolStripMenuItem1 // toolStripMenuItem1
// //
this.toolStripMenuItem1.Name = "toolStripMenuItem1"; this.toolStripMenuItem1.Name = "toolStripMenuItem1";
this.toolStripMenuItem1.Size = new System.Drawing.Size(14, 32); this.toolStripMenuItem1.Size = new System.Drawing.Size(12, 25);
// //
// imprägnierberichteToolStripMenuItem // imprägnierberichteToolStripMenuItem
// //
this.imprägnierberichteToolStripMenuItem.Name = "imprägnierberichteToolStripMenuItem"; this.imprägnierberichteToolStripMenuItem.Name = "imprägnierberichteToolStripMenuItem";
this.imprägnierberichteToolStripMenuItem.Size = new System.Drawing.Size(193, 32); this.imprägnierberichteToolStripMenuItem.Size = new System.Drawing.Size(155, 25);
this.imprägnierberichteToolStripMenuItem.Text = "Imprägnierberichte"; this.imprägnierberichteToolStripMenuItem.Text = "Imprägnierberichte";
this.imprägnierberichteToolStripMenuItem.Click += new System.EventHandler(this.ImprägnierberichteToolStripMenuItem_Click); this.imprägnierberichteToolStripMenuItem.Click += new System.EventHandler(this.ImprägnierberichteToolStripMenuItem_Click);
// //
@@ -151,20 +158,20 @@
this.massenberichteToolStripMenuItem, this.massenberichteToolStripMenuItem,
this.verbrauchToolStripMenuItem}); this.verbrauchToolStripMenuItem});
this.berichteToolStripMenuItem.Name = "berichteToolStripMenuItem"; this.berichteToolStripMenuItem.Name = "berichteToolStripMenuItem";
this.berichteToolStripMenuItem.Size = new System.Drawing.Size(101, 32); this.berichteToolStripMenuItem.Size = new System.Drawing.Size(82, 25);
this.berichteToolStripMenuItem.Text = "Berichte "; this.berichteToolStripMenuItem.Text = "Berichte ";
// //
// massenberichteToolStripMenuItem // massenberichteToolStripMenuItem
// //
this.massenberichteToolStripMenuItem.Name = "massenberichteToolStripMenuItem"; this.massenberichteToolStripMenuItem.Name = "massenberichteToolStripMenuItem";
this.massenberichteToolStripMenuItem.Size = new System.Drawing.Size(234, 32); this.massenberichteToolStripMenuItem.Size = new System.Drawing.Size(189, 26);
this.massenberichteToolStripMenuItem.Text = "Massenberichte"; this.massenberichteToolStripMenuItem.Text = "Massenberichte";
this.massenberichteToolStripMenuItem.Click += new System.EventHandler(this.MassenberichteToolStripMenuItem_Click); this.massenberichteToolStripMenuItem.Click += new System.EventHandler(this.MassenberichteToolStripMenuItem_Click);
// //
// verbrauchToolStripMenuItem // verbrauchToolStripMenuItem
// //
this.verbrauchToolStripMenuItem.Name = "verbrauchToolStripMenuItem"; this.verbrauchToolStripMenuItem.Name = "verbrauchToolStripMenuItem";
this.verbrauchToolStripMenuItem.Size = new System.Drawing.Size(234, 32); this.verbrauchToolStripMenuItem.Size = new System.Drawing.Size(189, 26);
this.verbrauchToolStripMenuItem.Text = "Verbrauch"; this.verbrauchToolStripMenuItem.Text = "Verbrauch";
this.verbrauchToolStripMenuItem.Click += new System.EventHandler(this.VerbrauchToolStripMenuItem_Click); this.verbrauchToolStripMenuItem.Click += new System.EventHandler(this.VerbrauchToolStripMenuItem_Click);
// //
@@ -174,42 +181,38 @@
this.statusStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.statusStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.toolStripStatus_projekt_Label, this.toolStripStatus_projekt_Label,
this.toolstrip_gesamtLiner}); this.toolstrip_gesamtLiner});
this.statusStrip1.Location = new System.Drawing.Point(0, 532); this.statusStrip1.Location = new System.Drawing.Point(0, 431);
this.statusStrip1.Name = "statusStrip1"; this.statusStrip1.Name = "statusStrip1";
this.statusStrip1.Padding = new System.Windows.Forms.Padding(1, 0, 19, 0); this.statusStrip1.Size = new System.Drawing.Size(813, 22);
this.statusStrip1.Size = new System.Drawing.Size(1084, 26);
this.statusStrip1.TabIndex = 3; this.statusStrip1.TabIndex = 3;
this.statusStrip1.Text = "statusStrip1"; this.statusStrip1.Text = "statusStrip1";
// //
// toolStripStatus_projekt_Label // toolStripStatus_projekt_Label
// //
this.toolStripStatus_projekt_Label.Name = "toolStripStatus_projekt_Label"; this.toolStripStatus_projekt_Label.Name = "toolStripStatus_projekt_Label";
this.toolStripStatus_projekt_Label.Size = new System.Drawing.Size(55, 20); this.toolStripStatus_projekt_Label.Size = new System.Drawing.Size(44, 17);
this.toolStripStatus_projekt_Label.Text = "Projekt"; this.toolStripStatus_projekt_Label.Text = "Projekt";
// //
// toolstrip_gesamtLiner // toolstrip_gesamtLiner
// //
this.toolstrip_gesamtLiner.Name = "toolstrip_gesamtLiner"; this.toolstrip_gesamtLiner.Name = "toolstrip_gesamtLiner";
this.toolstrip_gesamtLiner.Size = new System.Drawing.Size(138, 20); this.toolstrip_gesamtLiner.Size = new System.Drawing.Size(111, 17);
this.toolstrip_gesamtLiner.Text = "Insgesammt Einbau"; this.toolstrip_gesamtLiner.Text = "Insgesammt Einbau";
// //
// prefixSuffixToolStripMenuItem // update
// //
this.prefixSuffixToolStripMenuItem.Name = "prefixSuffixToolStripMenuItem"; this.update.UpdateUrl = "http://home.cosysda.de/sanverwaltung/UpdateInfo.dat";
this.prefixSuffixToolStripMenuItem.Size = new System.Drawing.Size(318, 32);
this.prefixSuffixToolStripMenuItem.Text = "Prefix / Suffix";
this.prefixSuffixToolStripMenuItem.Click += new System.EventHandler(this.PrefixSuffixToolStripMenuItem_Click);
// //
// frmMain // frmMain
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F); this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(1084, 558); this.ClientSize = new System.Drawing.Size(813, 453);
this.Controls.Add(this.statusStrip1); this.Controls.Add(this.statusStrip1);
this.Controls.Add(this.mainmenu); this.Controls.Add(this.mainmenu);
this.IsMdiContainer = true; this.IsMdiContainer = true;
this.MainMenuStrip = this.mainmenu; this.MainMenuStrip = this.mainmenu;
this.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
this.Name = "frmMain"; this.Name = "frmMain";
this.Text = "Kanalsanierungsverwaltung"; this.Text = "Kanalsanierungsverwaltung";
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.frm_main_FormClosing); this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.frm_main_FormClosing);
@@ -243,6 +246,7 @@
private System.Windows.Forms.ToolStripMenuItem verbrauchToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem verbrauchToolStripMenuItem;
private System.Windows.Forms.ToolStripStatusLabel toolstrip_gesamtLiner; private System.Windows.Forms.ToolStripStatusLabel toolstrip_gesamtLiner;
private System.Windows.Forms.ToolStripMenuItem prefixSuffixToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem prefixSuffixToolStripMenuItem;
private UpdateLib.Updater update;
} }
} }

View File

@@ -30,6 +30,7 @@ namespace SanSystem
public frmMain() public frmMain()
{ {
InitializeComponent(); InitializeComponent();
update.CheckForUpdates();
string sx = Properties.Settings.Default.DATABASEMAIN; string sx = Properties.Settings.Default.DATABASEMAIN;

View File

@@ -123,4 +123,7 @@
<metadata name="statusStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> <metadata name="statusStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>127, 17</value> <value>127, 17</value>
</metadata> </metadata>
<metadata name="update.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>243, 17</value>
</metadata>
</root> </root>

View File

@@ -33,6 +33,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tests", "Tests", "{DDF8C748
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Dichtheitsprüfung", "Dichtheitspruefung\Dichtheitsprüfung\Dichtheitsprüfung.csproj", "{324277C6-2EB3-47B7-9DD5-7FA520E7D349}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Dichtheitsprüfung", "Dichtheitspruefung\Dichtheitsprüfung\Dichtheitsprüfung.csproj", "{324277C6-2EB3-47B7-9DD5-7FA520E7D349}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UpdateLib", "UpdateLib\UpdateLib.csproj", "{CF95DB30-247B-4382-948E-3BD5EB73C938}"
EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU Debug|Any CPU = Debug|Any CPU
@@ -91,6 +93,10 @@ Global
{324277C6-2EB3-47B7-9DD5-7FA520E7D349}.Debug|Any CPU.Build.0 = Debug|Any CPU {324277C6-2EB3-47B7-9DD5-7FA520E7D349}.Debug|Any CPU.Build.0 = Debug|Any CPU
{324277C6-2EB3-47B7-9DD5-7FA520E7D349}.Release|Any CPU.ActiveCfg = Release|Any CPU {324277C6-2EB3-47B7-9DD5-7FA520E7D349}.Release|Any CPU.ActiveCfg = Release|Any CPU
{324277C6-2EB3-47B7-9DD5-7FA520E7D349}.Release|Any CPU.Build.0 = Release|Any CPU {324277C6-2EB3-47B7-9DD5-7FA520E7D349}.Release|Any CPU.Build.0 = Release|Any CPU
{CF95DB30-247B-4382-948E-3BD5EB73C938}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{CF95DB30-247B-4382-948E-3BD5EB73C938}.Debug|Any CPU.Build.0 = Debug|Any CPU
{CF95DB30-247B-4382-948E-3BD5EB73C938}.Release|Any CPU.ActiveCfg = Release|Any CPU
{CF95DB30-247B-4382-948E-3BD5EB73C938}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE

View File

@@ -0,0 +1,21 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace UpdateLib.Data
{
[Serializable]
public class UpdateFileInfo
{
public string Name { get; set; }
public string Description { get; set; }
public UpdateFileInfo(string name, string desc)
{
this.Name = name;
this.Description = desc;
}
}
}

View File

@@ -0,0 +1,34 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace UpdateLib.Data
{
[Serializable]
public class UpdateSaveFile
{
public String VersionString { get; set; }
public List<UpdateFileInfo> _coll;
public List<UpdateFileInfo> UpdateFileCollection
{
get
{
return _coll;
}
set
{
_coll = value;
}
}
public UpdateSaveFile(String version)
{
this.VersionString = version;
UpdateFileCollection = new List<UpdateFileInfo>();
}
}
}

View File

@@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// Allgemeine Informationen über eine Assembly werden über die folgenden
// Attribute gesteuert. Ändern Sie diese Attributwerte, um die Informationen zu ändern,
// die einer Assembly zugeordnet sind.
[assembly: AssemblyTitle("UpdateLib")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("UpdateLib")]
[assembly: AssemblyCopyright("Copyright © 2017")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Durch Festlegen von ComVisible auf FALSE werden die Typen in dieser Assembly
// für COM-Komponenten unsichtbar. Wenn Sie auf einen Typ in dieser Assembly von
// COM aus zugreifen müssen, sollten Sie das ComVisible-Attribut für diesen Typ auf "True" festlegen.
[assembly: ComVisible(false)]
// Die folgende GUID bestimmt die ID der Typbibliothek, wenn dieses Projekt für COM verfügbar gemacht wird
[assembly: Guid("cf95db30-247b-4382-948e-3bd5eb73c938")]
// Versionsinformationen für eine Assembly bestehen aus den folgenden vier Werten:
//
// Hauptversion
// Nebenversion
// Buildnummer
// Revision
//
// Sie können alle Werte angeben oder Standardwerte für die Build- und Revisionsnummern verwenden,
// indem Sie "*" wie unten gezeigt eingeben:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

187
UpdateLib/UI/frmUpdater.Designer.cs generated Normal file
View File

@@ -0,0 +1,187 @@
namespace UpdateLib.UI
{
partial class frmUpdater
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.panel1 = new System.Windows.Forms.Panel();
this.btnInstall = new System.Windows.Forms.Button();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.pbInstall = new System.Windows.Forms.ProgressBar();
this.pbDownload = new System.Windows.Forms.ProgressBar();
this.label2 = new System.Windows.Forms.Label();
this.label1 = new System.Windows.Forms.Label();
this.lblStatus = new System.Windows.Forms.Label();
this.lvItems = new System.Windows.Forms.ListView();
this.clmName = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.clmStatus = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.clmDesc = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.panel1.SuspendLayout();
this.groupBox1.SuspendLayout();
this.SuspendLayout();
//
// panel1
//
this.panel1.BackColor = System.Drawing.SystemColors.Control;
this.panel1.Controls.Add(this.btnInstall);
this.panel1.Dock = System.Windows.Forms.DockStyle.Bottom;
this.panel1.Location = new System.Drawing.Point(0, 319);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(472, 49);
this.panel1.TabIndex = 0;
//
// btnInstall
//
this.btnInstall.Location = new System.Drawing.Point(385, 13);
this.btnInstall.Name = "btnInstall";
this.btnInstall.Size = new System.Drawing.Size(75, 23);
this.btnInstall.TabIndex = 0;
this.btnInstall.Text = "Install";
this.btnInstall.UseVisualStyleBackColor = true;
this.btnInstall.Click += new System.EventHandler(this.btnInstall_Click);
//
// groupBox1
//
this.groupBox1.Controls.Add(this.pbInstall);
this.groupBox1.Controls.Add(this.pbDownload);
this.groupBox1.Controls.Add(this.label2);
this.groupBox1.Controls.Add(this.label1);
this.groupBox1.Location = new System.Drawing.Point(12, 235);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(448, 78);
this.groupBox1.TabIndex = 1;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "Details";
//
// pbInstall
//
this.pbInstall.Location = new System.Drawing.Point(120, 45);
this.pbInstall.Name = "pbInstall";
this.pbInstall.Size = new System.Drawing.Size(322, 23);
this.pbInstall.TabIndex = 3;
//
// pbDownload
//
this.pbDownload.Location = new System.Drawing.Point(120, 16);
this.pbDownload.Name = "pbDownload";
this.pbDownload.Size = new System.Drawing.Size(322, 23);
this.pbDownload.TabIndex = 2;
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(15, 51);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(84, 13);
this.label2.TabIndex = 1;
this.label2.Text = "Install Progress: ";
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(15, 21);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(105, 13);
this.label1.TabIndex = 0;
this.label1.Text = "Download Progress: ";
//
// lblStatus
//
this.lblStatus.AutoSize = true;
this.lblStatus.Font = new System.Drawing.Font("Segoe UI", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.lblStatus.Location = new System.Drawing.Point(12, 9);
this.lblStatus.Name = "lblStatus";
this.lblStatus.Size = new System.Drawing.Size(148, 25);
this.lblStatus.TabIndex = 2;
this.lblStatus.Text = "Status: Waiting...";
//
// lvItems
//
this.lvItems.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
this.clmName,
this.clmStatus,
this.clmDesc});
this.lvItems.Location = new System.Drawing.Point(12, 41);
this.lvItems.Name = "lvItems";
this.lvItems.Size = new System.Drawing.Size(448, 188);
this.lvItems.TabIndex = 3;
this.lvItems.UseCompatibleStateImageBehavior = false;
this.lvItems.View = System.Windows.Forms.View.Details;
//
// clmName
//
this.clmName.Text = "Name";
this.clmName.Width = 104;
//
// clmStatus
//
this.clmStatus.Text = "Status";
this.clmStatus.Width = 99;
//
// clmDesc
//
this.clmDesc.Text = "Description";
this.clmDesc.Width = 228;
//
// frmUpdater
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BackColor = System.Drawing.SystemColors.ButtonHighlight;
this.ClientSize = new System.Drawing.Size(472, 368);
this.ControlBox = false;
this.Controls.Add(this.lvItems);
this.Controls.Add(this.lblStatus);
this.Controls.Add(this.groupBox1);
this.Controls.Add(this.panel1);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "frmUpdater";
this.Text = "Programm updater";
this.panel1.ResumeLayout(false);
this.groupBox1.ResumeLayout(false);
this.groupBox1.PerformLayout();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Panel panel1;
private System.Windows.Forms.Button btnInstall;
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.ProgressBar pbInstall;
private System.Windows.Forms.ProgressBar pbDownload;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label lblStatus;
private System.Windows.Forms.ListView lvItems;
private System.Windows.Forms.ColumnHeader clmName;
private System.Windows.Forms.ColumnHeader clmStatus;
private System.Windows.Forms.ColumnHeader clmDesc;
}
}

107
UpdateLib/UI/frmUpdater.cs Normal file
View File

@@ -0,0 +1,107 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Net;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using UpdateLib.Data;
namespace UpdateLib.UI
{
public partial class frmUpdater : Form
{
int index = 0;
private UpdateSaveFile localInfoFile;
private String baseUrl;
public frmUpdater(UpdateSaveFile file, String baseUrl)
{
InitializeComponent();
localInfoFile = file;
pbInstall.Maximum = (file.UpdateFileCollection.Count) * 100;
this.baseUrl = baseUrl;
foreach (UpdateFileInfo fileInfo in file.UpdateFileCollection)
{
ListViewItem lvItem = new ListViewItem(new String[] { fileInfo.Name, "Waiting...", fileInfo.Description });
lvItems.Items.Add(lvItem);
}
}
private void btnInstall_Click(object sender, EventArgs e)
{
if (btnInstall.Text.Equals("Finish"))
{
MessageBox.Show("Update erfolgreich. Programm wird beendet");
Application.Exit();
}
else
{
btnInstall.Enabled = false;
DownloadFile();
}
}
private void DownloadFile()
{
WebClient downloadClient = new WebClient();
downloadClient.DownloadProgressChanged += new DownloadProgressChangedEventHandler(downloadClient_DownloadProgressChanged);
downloadClient.DownloadFileCompleted += new AsyncCompletedEventHandler(downloadClient_DownloadFileCompleted);
ListViewItem currItem = lvItems.Items[index];
String name = currItem.SubItems[0].Text;
SetStatus(String.Format("Downloading {0} ...", name));
currItem.SubItems[1].Text = "Downloading...";
String local = String.Format(@".\{0}", name);
String online = String.Format("{0}{1}", baseUrl, name);
if (File.Exists(local))
{
if (File.Exists(local + ".old"))
File.Delete(local + ".old");
File.Move(local, local + ".old");
}
downloadClient.DownloadFileAsync(new Uri(online), local);
}
private void SetStatus(string p)
{
lblStatus.Text = String.Format("Status: {0}", p);
}
private void downloadClient_DownloadFileCompleted(object sender, AsyncCompletedEventArgs e)
{
ListViewItem currItem = lvItems.Items[index];
currItem.SubItems[1].Text = "Downloaded";
pbInstall.Increment(100);
pbDownload.Value = 0;
index++;
if (lvItems.Items.Count - 1 >= index)
DownloadFile();
else
{
SetStatus("Finished!");
btnInstall.Text = "Finish";
btnInstall.Enabled = true;
}
}
private void downloadClient_DownloadProgressChanged(object sender, DownloadProgressChangedEventArgs e)
{
pbDownload.Value = e.ProgressPercentage;
}
}
}

View File

@@ -0,0 +1,60 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{CF95DB30-247B-4382-948E-3BD5EB73C938}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>UpdateLib</RootNamespace>
<AssemblyName>UpdateLib</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Data\UpdateFileInfo.cs" />
<Compile Include="Data\UpdateSaveFile.cs" />
<Compile Include="UI\frmUpdater.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="UI\frmUpdater.Designer.cs">
<DependentUpon>frmUpdater.cs</DependentUpon>
</Compile>
<Compile Include="Updater.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

105
UpdateLib/Updater.cs Normal file
View File

@@ -0,0 +1,105 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.IO;
using System.Linq;
using System.Net;
using System.Reflection;
using System.Runtime.Serialization.Formatters.Binary;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using UpdateLib.Data;
using UpdateLib.UI;
namespace UpdateLib
{
public class Updater : Component
{
private const String localUpdateFile = @".\UpdateInfo";
public String UpdateUrl { get; set; }
public void CheckForUpdates()
{
try
{
CleanUp();
WebClient downloadclient = new WebClient();
downloadclient.DownloadFile(UpdateUrl, localUpdateFile);
downloadclient.Dispose();
if(!File.Exists(localUpdateFile))
{
throw new FileNotFoundException("Lokale Update datei ist beschädigt");
}
UpdateSaveFile localFile = DecodeSaveFile(localUpdateFile);
Version localVersion = Assembly.GetEntryAssembly().GetName().Version;
Version onlineVersion = Version.Parse(localFile.VersionString);
if(onlineVersion > localVersion)
{
string MsgBox = String.Format("Version {0} verfügbar",onlineVersion);
if(MessageBox.Show(MsgBox,"Update",MessageBoxButtons.YesNo) == DialogResult.Yes)
{
frmUpdater updateform = new frmUpdater(localFile,GetPath(UpdateUrl));
updateform.ShowDialog();
}
}
else
{
MessageBox.Show(onlineVersion.ToString());
MessageBox.Show(localVersion.ToString());
MessageBox.Show("Software ist in der aktuellste Version");
}
}
catch(Exception e)
{
MessageBox.Show("Fehler beim uberprüfen von Updates\nVersuchen Sie später nochmal!\n\nFehlertext: " + e.Message, "Update", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private string GetPath(string UpdateUrl)
{
StringBuilder sb = new StringBuilder();
String[] updatePieces = UpdateUrl.Split('/');
for(int i = 0; i < updatePieces.Length -1; i++)
{
sb.Append(updatePieces[i] + "/");
}
return sb.ToString();
}
private UpdateSaveFile DecodeSaveFile(string localUpdateFile)
{
FileStream localFileStream = null;
BinaryFormatter decoder = null;
try
{
localFileStream = File.Open(localUpdateFile, FileMode.Open, FileAccess.Read);
decoder = new BinaryFormatter();
return (UpdateSaveFile)decoder.Deserialize(localFileStream);
}
catch(Exception e)
{
throw new InvalidDataException("Der lokale updatedatei ist beschädigt "+e.Message);
}
finally
{
if (localFileStream != null)
localFileStream.Dispose();
}
}
private void CleanUp()
{
DirectoryInfo di = new DirectoryInfo(Application.StartupPath);
foreach (FileInfo fi in di.GetFiles("*.old", SearchOption.TopDirectoryOnly))
fi.Delete();
}
}
}