small code refactoring
This commit is contained in:
10
Directory.Build.props
Normal file
10
Directory.Build.props
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
<Project>
|
||||||
|
<PropertyGroup>
|
||||||
|
<PackageProjectUrl>https://git.pilzinsel64.de/pilz-framework</PackageProjectUrl>
|
||||||
|
<PackageLicenseExpression>MIT</PackageLicenseExpression>
|
||||||
|
<GenerateSerializationAssemblies>False</GenerateSerializationAssemblies>
|
||||||
|
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
|
||||||
|
<GenerateDocumentationFile>True</GenerateDocumentationFile>
|
||||||
|
<NoWarn>1591</NoWarn>
|
||||||
|
</PropertyGroup>
|
||||||
|
</Project>
|
||||||
@@ -1,7 +1,3 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<configuration>
|
<configuration>
|
||||||
<packageSources>
|
|
||||||
<add key="Telerik UI for WinForms 2022.2.510.0" value="C:\Program Files (x86)\Progress\Telerik UI for WinForms R2 2022\Bin60\NuGet" />
|
|
||||||
<add key="Telerik UI for WinForms UI.for.WinForms.AllControls.Net60.2022.3.1109" value="C:\Users\Pilz\AppData\Roaming\Telerik\Updates\Telerik_UI_For_WinForms_2022_3_1109_Dev_dlls\Bin60\NuGet" />
|
|
||||||
</packageSources>
|
|
||||||
</configuration>
|
</configuration>
|
||||||
@@ -1,76 +1,74 @@
|
|||||||
using System;
|
using System;
|
||||||
using Microsoft.VisualBasic.CompilerServices;
|
|
||||||
using Telerik.WinControls.UI;
|
using Telerik.WinControls.UI;
|
||||||
|
|
||||||
namespace Pilz.Updating.Administration.GUI
|
namespace Pilz.Updating.Administration.GUI;
|
||||||
|
|
||||||
|
public partial class ApplicationVersionInput
|
||||||
{
|
{
|
||||||
public partial class ApplicationVersionInput
|
|
||||||
|
// C o n s t r u c t o r s
|
||||||
|
|
||||||
|
public ApplicationVersionInput()
|
||||||
{
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
|
||||||
// C o n s t r u c t o r s
|
// Init Channel-ComboBox
|
||||||
|
radDropDownList_Channel.Items.Add(new RadListDataItem() { Text = My.Resources.UpdatingAdministrationLangRes.Channel_Stable, Tag = Channels.Stable });
|
||||||
|
radDropDownList_Channel.Items.Add(new RadListDataItem() { Text = My.Resources.UpdatingAdministrationLangRes.Channel_PreRelease, Tag = Channels.PreRelease });
|
||||||
|
radDropDownList_Channel.Items.Add(new RadListDataItem() { Text = My.Resources.UpdatingAdministrationLangRes.Channel_Beta, Tag = Channels.Beta });
|
||||||
|
radDropDownList_Channel.Items.Add(new RadListDataItem() { Text = My.Resources.UpdatingAdministrationLangRes.Channel_Alpha, Tag = Channels.Alpha });
|
||||||
|
radDropDownList_Channel.SelectedIndex = 0;
|
||||||
|
}
|
||||||
|
|
||||||
public ApplicationVersionInput()
|
// P r o p e r t i e s
|
||||||
|
|
||||||
|
public Version Version
|
||||||
|
{
|
||||||
|
get
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
return new Version(radTextBoxControl_Version.Text.Trim());
|
||||||
|
|
||||||
// Init Channel-ComboBox
|
|
||||||
radDropDownList_Channel.Items.Add(new RadListDataItem() { Text = My.Resources.UpdatingAdministrationLangRes.Channel_Stable, Tag = Channels.Stable });
|
|
||||||
radDropDownList_Channel.Items.Add(new RadListDataItem() { Text = My.Resources.UpdatingAdministrationLangRes.Channel_PreRelease, Tag = Channels.PreRelease });
|
|
||||||
radDropDownList_Channel.Items.Add(new RadListDataItem() { Text = My.Resources.UpdatingAdministrationLangRes.Channel_Beta, Tag = Channels.Beta });
|
|
||||||
radDropDownList_Channel.Items.Add(new RadListDataItem() { Text = My.Resources.UpdatingAdministrationLangRes.Channel_Alpha, Tag = Channels.Alpha });
|
|
||||||
radDropDownList_Channel.SelectedIndex = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// P r o p e r t i e s
|
set
|
||||||
|
|
||||||
public Version Version
|
|
||||||
{
|
{
|
||||||
get
|
radTextBoxControl_Version.Text = value.ToString();
|
||||||
{
|
}
|
||||||
return new Version(radTextBoxControl_Version.Text.Trim());
|
}
|
||||||
}
|
|
||||||
|
|
||||||
set
|
public Channels Channel
|
||||||
{
|
{
|
||||||
radTextBoxControl_Version.Text = value.ToString();
|
get
|
||||||
}
|
{
|
||||||
|
return (Channels)radDropDownList_Channel.SelectedItem.Tag;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Channels Channel
|
set
|
||||||
{
|
{
|
||||||
get
|
foreach (var ci in radDropDownList_Channel.Items)
|
||||||
{
|
{
|
||||||
return (Channels)radDropDownList_Channel.SelectedItem.Tag;
|
if ((Channels)ci.Tag == value)
|
||||||
}
|
|
||||||
|
|
||||||
set
|
|
||||||
{
|
|
||||||
foreach (var ci in radDropDownList_Channel.Items)
|
|
||||||
{
|
{
|
||||||
if ((Channels)ci.Tag == value)
|
radDropDownList_Channel.SelectedItem = ci;
|
||||||
{
|
|
||||||
radDropDownList_Channel.SelectedItem = ci;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public int Build
|
public int Build
|
||||||
|
{
|
||||||
|
get
|
||||||
{
|
{
|
||||||
get
|
return (int)Math.Round(radSpinEditor_Build.Value);
|
||||||
{
|
|
||||||
return (int)Math.Round(radSpinEditor_Build.Value);
|
|
||||||
}
|
|
||||||
|
|
||||||
set
|
|
||||||
{
|
|
||||||
radSpinEditor_Build.Value = value;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void radButton_Accept_Click(object sender, EventArgs e)
|
set
|
||||||
{
|
{
|
||||||
|
radSpinEditor_Build.Value = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void radButton_Accept_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,70 +1,63 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.ComponentModel;
|
|
||||||
using System.Data;
|
|
||||||
using System.Drawing;
|
|
||||||
using System.Text;
|
|
||||||
using System.Windows.Forms;
|
|
||||||
using Pilz.Updating.Administration.Discord;
|
using Pilz.Updating.Administration.Discord;
|
||||||
|
using System;
|
||||||
using Telerik.WinControls.UI;
|
using Telerik.WinControls.UI;
|
||||||
|
|
||||||
namespace Pilz.Updating.Administration.GUI
|
namespace Pilz.Updating.Administration.GUI;
|
||||||
|
|
||||||
|
public partial class DiscordBotSettingsWindow : RadForm
|
||||||
{
|
{
|
||||||
public partial class DiscordBotSettingsWindow : RadForm
|
private readonly DiscordBotConfig config = null;
|
||||||
|
private Channels currentChannel = Channels.Stable;
|
||||||
|
private readonly bool hasInit = false;
|
||||||
|
|
||||||
|
public DiscordBotSettingsWindow(DiscordBotConfig config)
|
||||||
{
|
{
|
||||||
private readonly DiscordBotConfig config = null;
|
this.config = config;
|
||||||
private Channels currentChannel = Channels.Stable;
|
|
||||||
private readonly bool hasInit = false;
|
|
||||||
|
|
||||||
public DiscordBotSettingsWindow(DiscordBotConfig config)
|
InitializeComponent();
|
||||||
{
|
|
||||||
this.config = config;
|
|
||||||
|
|
||||||
InitializeComponent();
|
foreach (var value in Enum.GetValues<Channels>())
|
||||||
|
radDropDownList_PresetChannel.Items.Add(new RadListDataItem(Enum.GetName(value), value));
|
||||||
|
radDropDownList_PresetChannel.SelectedValue = Channels.Stable;
|
||||||
|
|
||||||
foreach (var value in Enum.GetValues<Channels>())
|
radTextBoxControl_BotToken.Text = config.DiscordBotToken;
|
||||||
radDropDownList_PresetChannel.Items.Add(new RadListDataItem(Enum.GetName(value), value));
|
radTextBoxControl_DefaultProgramName.Text = config.DefaultAppName;
|
||||||
radDropDownList_PresetChannel.SelectedValue = Channels.Stable;
|
ShowDefaultMessage();
|
||||||
|
radToggleSwitch_UseProxy.Value = config.UseProxy;
|
||||||
|
|
||||||
radTextBoxControl_BotToken.Text = config.DiscordBotToken;
|
hasInit = true;
|
||||||
radTextBoxControl_DefaultProgramName.Text = config.DefaultAppName;
|
}
|
||||||
ShowDefaultMessage();
|
|
||||||
radToggleSwitch_UseProxy.Value = config.UseProxy;
|
|
||||||
|
|
||||||
hasInit = true;
|
private Channels GetCurrentChannel()
|
||||||
}
|
{
|
||||||
|
return radDropDownList_PresetChannel?.SelectedValue as Channels? ?? Channels.Stable;
|
||||||
|
}
|
||||||
|
|
||||||
private Channels GetCurrentChannel()
|
private void ShowDefaultMessage()
|
||||||
{
|
{
|
||||||
return radDropDownList_PresetChannel?.SelectedValue as Channels? ?? Channels.Stable;
|
radTextBox_DefaultMessage.Text = config.DefaultUpdateMessages[currentChannel];
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ShowDefaultMessage()
|
private void SaveDefaultMessage()
|
||||||
{
|
{
|
||||||
radTextBox_DefaultMessage.Text = config.DefaultUpdateMessages[currentChannel];
|
config.DefaultUpdateMessages[currentChannel] = radTextBox_DefaultMessage.Text.Trim();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SaveDefaultMessage()
|
private void ButtonX_Okay_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
config.DefaultUpdateMessages[currentChannel] = radTextBox_DefaultMessage.Text.Trim();
|
SaveDefaultMessage();
|
||||||
}
|
config.DefaultAppName = radTextBoxControl_DefaultProgramName.Text.Trim();
|
||||||
|
config.DiscordBotToken = radTextBoxControl_BotToken.Text.Trim();
|
||||||
|
config.UseProxy = radToggleSwitch_UseProxy.Value;
|
||||||
|
}
|
||||||
|
|
||||||
private void ButtonX_Okay_Click(object sender, EventArgs e)
|
private void radDropDownList_PresetChannel_SelectedValueChanged(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
|
if (hasInit)
|
||||||
SaveDefaultMessage();
|
SaveDefaultMessage();
|
||||||
config.DefaultAppName = radTextBoxControl_DefaultProgramName.Text.Trim();
|
|
||||||
config.DiscordBotToken = radTextBoxControl_BotToken.Text.Trim();
|
|
||||||
config.UseProxy = radToggleSwitch_UseProxy.Value;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void radDropDownList_PresetChannel_SelectedValueChanged(object sender, EventArgs e)
|
currentChannel = radDropDownList_PresetChannel?.SelectedValue as Channels? ?? Channels.Stable;
|
||||||
{
|
|
||||||
if (hasInit)
|
|
||||||
SaveDefaultMessage();
|
|
||||||
|
|
||||||
currentChannel = radDropDownList_PresetChannel?.SelectedValue as Channels? ?? Channels.Stable;
|
ShowDefaultMessage();
|
||||||
|
|
||||||
ShowDefaultMessage();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,91 +1,85 @@
|
|||||||
using Pilz.Updating.Administration.Discord;
|
using Pilz.Updating.Administration.Discord;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.ComponentModel;
|
|
||||||
using System.Data;
|
using System.Data;
|
||||||
using System.Drawing;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using Telerik.WinControls;
|
using Telerik.WinControls;
|
||||||
using Telerik.WinControls.UI;
|
using Telerik.WinControls.UI;
|
||||||
|
|
||||||
namespace Pilz.Updating.Administration.GUI
|
namespace Pilz.Updating.Administration.GUI;
|
||||||
|
|
||||||
|
public partial class DiscordPostDialog : RadForm
|
||||||
{
|
{
|
||||||
public partial class DiscordPostDialog : RadForm
|
// F i e l d s
|
||||||
|
|
||||||
|
private readonly DiscordBot bot;
|
||||||
|
private readonly UpdatePackageInfo package;
|
||||||
|
|
||||||
|
// C o n s t r u c t o r
|
||||||
|
|
||||||
|
public DiscordPostDialog(DiscordBot bot, UpdatePackageInfo package)
|
||||||
{
|
{
|
||||||
// F i e l d s
|
this.bot = bot;
|
||||||
|
this.package = package;
|
||||||
|
|
||||||
private readonly DiscordBot bot;
|
InitializeComponent();
|
||||||
private readonly UpdatePackageInfo package;
|
|
||||||
|
|
||||||
// C o n s t r u c t o r
|
radTextBoxControl_ProgramName.Text = General.CurProject.DiscordBotConfig.DefaultAppName;
|
||||||
|
radTextBox_Message.Text = General.CurProject.DiscordBotConfig.DefaultUpdateMessages[package.Version.Channel];
|
||||||
|
|
||||||
public DiscordPostDialog(DiscordBot bot, UpdatePackageInfo package)
|
LoadBgrTree();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void LoadBgrTree()
|
||||||
|
{
|
||||||
|
radTreeView_Channels.BeginUpdate();
|
||||||
|
radTreeView_Channels.Nodes.Clear();
|
||||||
|
|
||||||
|
foreach (var guild in bot.GetGuilds())
|
||||||
{
|
{
|
||||||
this.bot = bot;
|
var nGuild = new RadTreeNode()
|
||||||
this.package = package;
|
|
||||||
|
|
||||||
InitializeComponent();
|
|
||||||
|
|
||||||
radTextBoxControl_ProgramName.Text = General.CurProject.DiscordBotConfig.DefaultAppName;
|
|
||||||
radTextBox_Message.Text = General.CurProject.DiscordBotConfig.DefaultUpdateMessages[package.Version.Channel];
|
|
||||||
|
|
||||||
LoadBgrTree();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void LoadBgrTree()
|
|
||||||
{
|
|
||||||
radTreeView_Channels.BeginUpdate();
|
|
||||||
radTreeView_Channels.Nodes.Clear();
|
|
||||||
|
|
||||||
foreach (var guild in bot.GetGuilds())
|
|
||||||
{
|
{
|
||||||
var nGuild = new RadTreeNode()
|
Name = "g" + guild.Key,
|
||||||
|
Text = guild.Value,
|
||||||
|
Tag = guild.Key,
|
||||||
|
Expanded = true
|
||||||
|
};
|
||||||
|
|
||||||
|
foreach (var channel in bot.GetTextChannels(guild.Key).OrderBy((n) => n.Value))
|
||||||
|
{
|
||||||
|
var nChannel = new RadTreeNode()
|
||||||
{
|
{
|
||||||
Name = "g" + guild.Key,
|
Name = "c" + channel.Key,
|
||||||
Text = guild.Value,
|
Text = "#" + channel.Value,
|
||||||
Tag = guild.Key,
|
Tag = channel.Key
|
||||||
Expanded = true
|
|
||||||
};
|
};
|
||||||
|
|
||||||
foreach (var channel in bot.GetTextChannels(guild.Key).OrderBy((n) => n.Value))
|
nGuild.Nodes.Add(nChannel);
|
||||||
{
|
|
||||||
var nChannel = new RadTreeNode()
|
|
||||||
{
|
|
||||||
Name = "c" + channel.Key,
|
|
||||||
Text = "#" + channel.Value,
|
|
||||||
Tag = channel.Key
|
|
||||||
};
|
|
||||||
|
|
||||||
nGuild.Nodes.Add(nChannel);
|
|
||||||
}
|
|
||||||
|
|
||||||
radTreeView_Channels.Nodes.Add(nGuild);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
radTreeView_Channels.EndUpdate();
|
radTreeView_Channels.Nodes.Add(nGuild);
|
||||||
}
|
}
|
||||||
|
|
||||||
private async void ButtonX_SendMsg_Click(object sender, EventArgs e)
|
radTreeView_Channels.EndUpdate();
|
||||||
|
}
|
||||||
|
|
||||||
|
private async void ButtonX_SendMsg_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
try
|
var selNode = radTreeView_Channels.SelectedNode;
|
||||||
{
|
ulong gID = (ulong)selNode.Parent.Tag;
|
||||||
var selNode = radTreeView_Channels.SelectedNode;
|
ulong cID = (ulong)selNode.Tag;
|
||||||
ulong gID = (ulong)selNode.Parent.Tag;
|
var msg = radTextBox_Message.Text;
|
||||||
ulong cID = (ulong)selNode.Tag;
|
|
||||||
var msg = radTextBox_Message.Text;
|
|
||||||
|
|
||||||
await bot.SendUpdateNotification(package, gID, cID, radTextBoxControl_ProgramName.Text, msg, radCheckBox_AttachDescription.Checked, radCheckBoxPingAtEveryone.Checked);
|
await bot.SendUpdateNotification(package, gID, cID, radTextBoxControl_ProgramName.Text, msg, radCheckBox_AttachDescription.Checked, radCheckBoxPingAtEveryone.Checked);
|
||||||
|
|
||||||
RadMessageBox.Show(this, "Nachricht erfolgreich gesendet.", string.Empty, MessageBoxButtons.OK, RadMessageIcon.Info);
|
RadMessageBox.Show(this, "Nachricht erfolgreich gesendet.", string.Empty, MessageBoxButtons.OK, RadMessageIcon.Info);
|
||||||
DialogResult = DialogResult.OK;
|
DialogResult = DialogResult.OK;
|
||||||
}
|
}
|
||||||
catch(Exception)
|
catch (Exception)
|
||||||
{
|
{
|
||||||
RadMessageBox.Show(this, "Fehler beim Senden der Nachricht.", string.Empty, MessageBoxButtons.OK, RadMessageIcon.Error);
|
RadMessageBox.Show(this, "Fehler beim Senden der Nachricht.", string.Empty, MessageBoxButtons.OK, RadMessageIcon.Error);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,35 +1,28 @@
|
|||||||
using System;
|
using System.IO;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.IO;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Net;
|
using System.Net;
|
||||||
using System.Reflection;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace Pilz.Updating.Administration.GUI
|
namespace Pilz.Updating.Administration.GUI;
|
||||||
|
|
||||||
|
public static class General
|
||||||
{
|
{
|
||||||
public static class General
|
private static string myAppPath = string.Empty;
|
||||||
|
public static UpdateProject CurProject { get; set; } = null;
|
||||||
|
|
||||||
|
public static string MyAppPath
|
||||||
{
|
{
|
||||||
private static string myAppPath = string.Empty;
|
get
|
||||||
public static UpdateProject CurProject { get; set; } = null;
|
|
||||||
|
|
||||||
public static string MyAppPath
|
|
||||||
{
|
{
|
||||||
get
|
if (string.IsNullOrEmpty(myAppPath))
|
||||||
{
|
Path.GetDirectoryName(IO.Extensions.GetExecutablePath());
|
||||||
if (string.IsNullOrEmpty(myAppPath))
|
return myAppPath;
|
||||||
Path.GetDirectoryName(IO.Extensions.GetExecutablePath());
|
|
||||||
return myAppPath;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void SetProxyConfig()
|
|
||||||
{
|
|
||||||
if (CurProject.ProxyConfig.UseProxyAuth)
|
|
||||||
WebRequest.DefaultWebProxy.Credentials = new NetworkCredential(CurProject.ProxyConfig.Username, CurProject.ProxyConfig.Password);
|
|
||||||
else
|
|
||||||
WebRequest.DefaultWebProxy.Credentials = null;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void SetProxyConfig()
|
||||||
|
{
|
||||||
|
if (CurProject.ProxyConfig.UseProxyAuth)
|
||||||
|
WebRequest.DefaultWebProxy.Credentials = new NetworkCredential(CurProject.ProxyConfig.Username, CurProject.ProxyConfig.Password);
|
||||||
|
else
|
||||||
|
WebRequest.DefaultWebProxy.Credentials = null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,38 +0,0 @@
|
|||||||
// ------------------------------------------------------------------------------
|
|
||||||
// <auto-generated>
|
|
||||||
// Dieser Code wurde von einem Tool generiert.
|
|
||||||
// Laufzeitversion:4.0.30319.42000
|
|
||||||
//
|
|
||||||
// Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn
|
|
||||||
// der Code erneut generiert wird.
|
|
||||||
// </auto-generated>
|
|
||||||
// ------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
using System.Diagnostics;
|
|
||||||
|
|
||||||
namespace Pilz.Updating.Administration.GUI.My
|
|
||||||
{
|
|
||||||
|
|
||||||
// HINWEIS: Diese Datei wird automatisch generiert und darf nicht direkt bearbeitet werden. Wenn Sie Änderungen vornehmen möchten
|
|
||||||
// oder in dieser Datei Buildfehler auftreten, wechseln Sie zum Projekt-Designer.
|
|
||||||
// (Wechseln Sie dazu zu den Projekteigenschaften, oder doppelklicken Sie auf den Knoten "Mein Projekt" im
|
|
||||||
// Projektmappen-Explorer). Nehmen Sie auf der Registerkarte "Anwendung" entsprechende Änderungen vor.
|
|
||||||
//
|
|
||||||
internal partial class MyApplication
|
|
||||||
{
|
|
||||||
[DebuggerStepThrough()]
|
|
||||||
public MyApplication() : base(Microsoft.VisualBasic.ApplicationServices.AuthenticationMode.Windows)
|
|
||||||
{
|
|
||||||
IsSingleInstance = false;
|
|
||||||
EnableVisualStyles = true;
|
|
||||||
SaveMySettingsOnExit = true;
|
|
||||||
ShutdownStyle = Microsoft.VisualBasic.ApplicationServices.ShutdownMode.AfterAllFormsClose;
|
|
||||||
}
|
|
||||||
|
|
||||||
[DebuggerStepThrough()]
|
|
||||||
protected override void OnCreateMainForm()
|
|
||||||
{
|
|
||||||
MainForm = MyProject.Forms.UpdateManagerWindow;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<MyApplicationData xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
|
|
||||||
<MySubMain>true</MySubMain>
|
|
||||||
<MainForm>ToolSelectionWindow</MainForm>
|
|
||||||
<SingleInstance>false</SingleInstance>
|
|
||||||
<ShutdownMode>1</ShutdownMode>
|
|
||||||
<EnableVisualStyles>true</EnableVisualStyles>
|
|
||||||
<AuthenticationMode>0</AuthenticationMode>
|
|
||||||
<SaveMySettingsOnExit>true</SaveMySettingsOnExit>
|
|
||||||
</MyApplicationData>
|
|
||||||
@@ -1,81 +0,0 @@
|
|||||||
using global::System;
|
|
||||||
using global::System.ComponentModel;
|
|
||||||
using global::System.Diagnostics;
|
|
||||||
|
|
||||||
namespace Pilz.Updating.Administration.GUI.My
|
|
||||||
{
|
|
||||||
internal static partial class MyProject
|
|
||||||
{
|
|
||||||
internal partial class MyForms
|
|
||||||
{
|
|
||||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
|
||||||
public ApplicationVersionInput m_ApplicationVersionInput;
|
|
||||||
|
|
||||||
public ApplicationVersionInput ApplicationVersionInput
|
|
||||||
{
|
|
||||||
[DebuggerHidden]
|
|
||||||
get
|
|
||||||
{
|
|
||||||
m_ApplicationVersionInput = MyForms.Create__Instance__(m_ApplicationVersionInput);
|
|
||||||
return m_ApplicationVersionInput;
|
|
||||||
}
|
|
||||||
|
|
||||||
[DebuggerHidden]
|
|
||||||
set
|
|
||||||
{
|
|
||||||
if (value == m_ApplicationVersionInput)
|
|
||||||
return;
|
|
||||||
if (value is object)
|
|
||||||
throw new ArgumentException("Property can only be set to Nothing");
|
|
||||||
Dispose__Instance__(ref m_ApplicationVersionInput);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
|
||||||
public UpdateManagerWindow m_UpdateManagerWindow;
|
|
||||||
|
|
||||||
public UpdateManagerWindow UpdateManagerWindow
|
|
||||||
{
|
|
||||||
[DebuggerHidden]
|
|
||||||
get
|
|
||||||
{
|
|
||||||
m_UpdateManagerWindow = MyForms.Create__Instance__(m_UpdateManagerWindow);
|
|
||||||
return m_UpdateManagerWindow;
|
|
||||||
}
|
|
||||||
|
|
||||||
[DebuggerHidden]
|
|
||||||
set
|
|
||||||
{
|
|
||||||
if (value == m_UpdateManagerWindow)
|
|
||||||
return;
|
|
||||||
if (value is object)
|
|
||||||
throw new ArgumentException("Property can only be set to Nothing");
|
|
||||||
Dispose__Instance__(ref m_UpdateManagerWindow);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
|
||||||
public UpdateServerInfoEditor m_UpdateServerInfoEditor;
|
|
||||||
|
|
||||||
public UpdateServerInfoEditor UpdateServerInfoEditor
|
|
||||||
{
|
|
||||||
[DebuggerHidden]
|
|
||||||
get
|
|
||||||
{
|
|
||||||
m_UpdateServerInfoEditor = MyForms.Create__Instance__(m_UpdateServerInfoEditor);
|
|
||||||
return m_UpdateServerInfoEditor;
|
|
||||||
}
|
|
||||||
|
|
||||||
[DebuggerHidden]
|
|
||||||
set
|
|
||||||
{
|
|
||||||
if (value == m_UpdateServerInfoEditor)
|
|
||||||
return;
|
|
||||||
if (value is object)
|
|
||||||
throw new ArgumentException("Property can only be set to Nothing");
|
|
||||||
Dispose__Instance__(ref m_UpdateServerInfoEditor);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,305 +0,0 @@
|
|||||||
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
|
||||||
|
|
||||||
using System;
|
|
||||||
using System.Collections;
|
|
||||||
using System.Diagnostics;
|
|
||||||
using System.Windows.Forms;
|
|
||||||
using Microsoft.VisualBasic;
|
|
||||||
|
|
||||||
/* TODO ERROR: Skipped IfDirectiveTrivia *//* TODO ERROR: Skipped DisabledTextTrivia *//* TODO ERROR: Skipped EndIfDirectiveTrivia */
|
|
||||||
/* TODO ERROR: Skipped IfDirectiveTrivia */
|
|
||||||
/* TODO ERROR: Skipped DefineDirectiveTrivia *//* TODO ERROR: Skipped DefineDirectiveTrivia *//* TODO ERROR: Skipped DefineDirectiveTrivia *//* TODO ERROR: Skipped DefineDirectiveTrivia *//* TODO ERROR: Skipped DefineDirectiveTrivia */
|
|
||||||
/* TODO ERROR: Skipped ElifDirectiveTrivia *//* TODO ERROR: Skipped DisabledTextTrivia *//* TODO ERROR: Skipped ElifDirectiveTrivia *//* TODO ERROR: Skipped DisabledTextTrivia *//* TODO ERROR: Skipped ElifDirectiveTrivia *//* TODO ERROR: Skipped DisabledTextTrivia *//* TODO ERROR: Skipped ElifDirectiveTrivia *//* TODO ERROR: Skipped DisabledTextTrivia *//* TODO ERROR: Skipped ElifDirectiveTrivia *//* TODO ERROR: Skipped DisabledTextTrivia *//* TODO ERROR: Skipped ElifDirectiveTrivia *//* TODO ERROR: Skipped DisabledTextTrivia *//* TODO ERROR: Skipped ElifDirectiveTrivia *//* TODO ERROR: Skipped DisabledTextTrivia *//* TODO ERROR: Skipped EndIfDirectiveTrivia */
|
|
||||||
/* TODO ERROR: Skipped IfDirectiveTrivia */
|
|
||||||
namespace Pilz.Updating.Administration.GUI.My
|
|
||||||
{
|
|
||||||
|
|
||||||
/* TODO ERROR: Skipped IfDirectiveTrivia */
|
|
||||||
[System.CodeDom.Compiler.GeneratedCode("MyTemplate", "11.0.0.0")]
|
|
||||||
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
|
|
||||||
|
|
||||||
/* TODO ERROR: Skipped IfDirectiveTrivia */
|
|
||||||
internal partial class MyApplication : Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase
|
|
||||||
{
|
|
||||||
/* TODO ERROR: Skipped IfDirectiveTrivia */
|
|
||||||
[STAThread()]
|
|
||||||
[DebuggerHidden()]
|
|
||||||
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Advanced)]
|
|
||||||
internal static void Main(string[] Args)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
Application.SetCompatibleTextRenderingDefault(UseCompatibleTextRendering);
|
|
||||||
}
|
|
||||||
finally
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
MyProject.Application.Run(Args);
|
|
||||||
}
|
|
||||||
/* TODO ERROR: Skipped EndIfDirectiveTrivia */
|
|
||||||
/* TODO ERROR: Skipped ElifDirectiveTrivia *//* TODO ERROR: Skipped DisabledTextTrivia *//* TODO ERROR: Skipped ElifDirectiveTrivia *//* TODO ERROR: Skipped DisabledTextTrivia *//* TODO ERROR: Skipped EndIfDirectiveTrivia */
|
|
||||||
}
|
|
||||||
|
|
||||||
/* TODO ERROR: Skipped EndIfDirectiveTrivia */
|
|
||||||
/* TODO ERROR: Skipped IfDirectiveTrivia */
|
|
||||||
[System.CodeDom.Compiler.GeneratedCode("MyTemplate", "11.0.0.0")]
|
|
||||||
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
|
|
||||||
|
|
||||||
/* TODO ERROR: Skipped IfDirectiveTrivia */
|
|
||||||
internal partial class MyComputer : Microsoft.VisualBasic.Devices.Computer
|
|
||||||
{
|
|
||||||
/* TODO ERROR: Skipped ElifDirectiveTrivia *//* TODO ERROR: Skipped DisabledTextTrivia *//* TODO ERROR: Skipped EndIfDirectiveTrivia */
|
|
||||||
[DebuggerHidden()]
|
|
||||||
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
|
|
||||||
public MyComputer() : base()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/* TODO ERROR: Skipped EndIfDirectiveTrivia */
|
|
||||||
[HideModuleName()]
|
|
||||||
[System.CodeDom.Compiler.GeneratedCode("MyTemplate", "11.0.0.0")]
|
|
||||||
internal static partial class MyProject
|
|
||||||
{
|
|
||||||
|
|
||||||
/* TODO ERROR: Skipped IfDirectiveTrivia */
|
|
||||||
[System.ComponentModel.Design.HelpKeyword("My.Computer")]
|
|
||||||
internal static MyComputer Computer
|
|
||||||
{
|
|
||||||
[DebuggerHidden()]
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return m_ComputerObjectProvider.GetInstance;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private readonly static ThreadSafeObjectProvider<MyComputer> m_ComputerObjectProvider = new ThreadSafeObjectProvider<MyComputer>();
|
|
||||||
/* TODO ERROR: Skipped EndIfDirectiveTrivia */
|
|
||||||
/* TODO ERROR: Skipped IfDirectiveTrivia */
|
|
||||||
[System.ComponentModel.Design.HelpKeyword("My.Application")]
|
|
||||||
internal static MyApplication Application
|
|
||||||
{
|
|
||||||
[DebuggerHidden()]
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return m_AppObjectProvider.GetInstance;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private readonly static ThreadSafeObjectProvider<MyApplication> m_AppObjectProvider = new ThreadSafeObjectProvider<MyApplication>();
|
|
||||||
/* TODO ERROR: Skipped EndIfDirectiveTrivia */
|
|
||||||
/* TODO ERROR: Skipped IfDirectiveTrivia */
|
|
||||||
[System.ComponentModel.Design.HelpKeyword("My.User")]
|
|
||||||
internal static Microsoft.VisualBasic.ApplicationServices.User User
|
|
||||||
{
|
|
||||||
[DebuggerHidden()]
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return m_UserObjectProvider.GetInstance;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private readonly static ThreadSafeObjectProvider<Microsoft.VisualBasic.ApplicationServices.User> m_UserObjectProvider = new ThreadSafeObjectProvider<Microsoft.VisualBasic.ApplicationServices.User>();
|
|
||||||
/* TODO ERROR: Skipped ElifDirectiveTrivia *//* TODO ERROR: Skipped DisabledTextTrivia *//* TODO ERROR: Skipped EndIfDirectiveTrivia */
|
|
||||||
/* TODO ERROR: Skipped IfDirectiveTrivia */
|
|
||||||
/* TODO ERROR: Skipped DefineDirectiveTrivia */
|
|
||||||
[System.ComponentModel.Design.HelpKeyword("My.Forms")]
|
|
||||||
internal static MyForms Forms
|
|
||||||
{
|
|
||||||
[DebuggerHidden()]
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return m_MyFormsObjectProvider.GetInstance;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
|
|
||||||
[MyGroupCollection("System.Windows.Forms.Form", "Create__Instance__", "Dispose__Instance__", "My.MyProject.Forms")]
|
|
||||||
internal sealed partial class MyForms
|
|
||||||
{
|
|
||||||
[DebuggerHidden()]
|
|
||||||
private static T Create__Instance__<T>(T Instance) where T : Form, new()
|
|
||||||
{
|
|
||||||
if (Instance is null || Instance.IsDisposed)
|
|
||||||
{
|
|
||||||
if (m_FormBeingCreated is object)
|
|
||||||
{
|
|
||||||
if (m_FormBeingCreated.ContainsKey(typeof(T)) == true)
|
|
||||||
{
|
|
||||||
throw new InvalidOperationException(Microsoft.VisualBasic.CompilerServices.Utils.GetResourceString("WinForms_RecursiveFormCreate"));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
m_FormBeingCreated = new Hashtable();
|
|
||||||
}
|
|
||||||
|
|
||||||
m_FormBeingCreated.Add(typeof(T), null);
|
|
||||||
try
|
|
||||||
{
|
|
||||||
return new T();
|
|
||||||
}
|
|
||||||
catch (System.Reflection.TargetInvocationException ex) when (ex.InnerException is object)
|
|
||||||
{
|
|
||||||
string BetterMessage = Microsoft.VisualBasic.CompilerServices.Utils.GetResourceString("WinForms_SeeInnerException", ex.InnerException.Message);
|
|
||||||
throw new InvalidOperationException(BetterMessage, ex.InnerException);
|
|
||||||
}
|
|
||||||
finally
|
|
||||||
{
|
|
||||||
m_FormBeingCreated.Remove(typeof(T));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return Instance;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
[DebuggerHidden()]
|
|
||||||
private void Dispose__Instance__<T>(ref T instance) where T : Form
|
|
||||||
{
|
|
||||||
instance.Dispose();
|
|
||||||
instance = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
[DebuggerHidden()]
|
|
||||||
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
|
|
||||||
public MyForms() : base()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
[ThreadStatic()]
|
|
||||||
private static Hashtable m_FormBeingCreated;
|
|
||||||
|
|
||||||
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
|
|
||||||
public override bool Equals(object o)
|
|
||||||
{
|
|
||||||
return base.Equals(o);
|
|
||||||
}
|
|
||||||
|
|
||||||
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
|
|
||||||
public override int GetHashCode()
|
|
||||||
{
|
|
||||||
return base.GetHashCode();
|
|
||||||
}
|
|
||||||
|
|
||||||
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
|
|
||||||
internal new Type GetType()
|
|
||||||
{
|
|
||||||
return typeof(MyForms);
|
|
||||||
}
|
|
||||||
|
|
||||||
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
|
|
||||||
public override string ToString()
|
|
||||||
{
|
|
||||||
return base.ToString();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static ThreadSafeObjectProvider<MyForms> m_MyFormsObjectProvider = new ThreadSafeObjectProvider<MyForms>();
|
|
||||||
|
|
||||||
/* TODO ERROR: Skipped EndIfDirectiveTrivia */
|
|
||||||
/* TODO ERROR: Skipped IfDirectiveTrivia */
|
|
||||||
[System.ComponentModel.Design.HelpKeyword("My.WebServices")]
|
|
||||||
internal static MyWebServices WebServices
|
|
||||||
{
|
|
||||||
[DebuggerHidden()]
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return m_MyWebServicesObjectProvider.GetInstance;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
|
|
||||||
[MyGroupCollection("System.Web.Services.Protocols.SoapHttpClientProtocol", "Create__Instance__", "Dispose__Instance__", "")]
|
|
||||||
internal sealed class MyWebServices
|
|
||||||
{
|
|
||||||
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
|
|
||||||
[DebuggerHidden()]
|
|
||||||
public override bool Equals(object o)
|
|
||||||
{
|
|
||||||
return base.Equals(o);
|
|
||||||
}
|
|
||||||
|
|
||||||
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
|
|
||||||
[DebuggerHidden()]
|
|
||||||
public override int GetHashCode()
|
|
||||||
{
|
|
||||||
return base.GetHashCode();
|
|
||||||
}
|
|
||||||
|
|
||||||
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
|
|
||||||
[DebuggerHidden()]
|
|
||||||
internal new Type GetType()
|
|
||||||
{
|
|
||||||
return typeof(MyWebServices);
|
|
||||||
}
|
|
||||||
|
|
||||||
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
|
|
||||||
[DebuggerHidden()]
|
|
||||||
public override string ToString()
|
|
||||||
{
|
|
||||||
return base.ToString();
|
|
||||||
}
|
|
||||||
|
|
||||||
[DebuggerHidden()]
|
|
||||||
private static T Create__Instance__<T>(T instance) where T : new()
|
|
||||||
{
|
|
||||||
if (instance == null)
|
|
||||||
{
|
|
||||||
return new T();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return instance;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
[DebuggerHidden()]
|
|
||||||
private void Dispose__Instance__<T>(ref T instance)
|
|
||||||
{
|
|
||||||
instance = default;
|
|
||||||
}
|
|
||||||
|
|
||||||
[DebuggerHidden()]
|
|
||||||
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
|
|
||||||
public MyWebServices() : base()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private readonly static ThreadSafeObjectProvider<MyWebServices> m_MyWebServicesObjectProvider = new ThreadSafeObjectProvider<MyWebServices>();
|
|
||||||
/* TODO ERROR: Skipped EndIfDirectiveTrivia */
|
|
||||||
/* TODO ERROR: Skipped IfDirectiveTrivia *//* TODO ERROR: Skipped DisabledTextTrivia *//* TODO ERROR: Skipped EndIfDirectiveTrivia */
|
|
||||||
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
|
|
||||||
[System.Runtime.InteropServices.ComVisible(false)]
|
|
||||||
internal sealed class ThreadSafeObjectProvider<T> where T : new()
|
|
||||||
{
|
|
||||||
internal T GetInstance
|
|
||||||
{
|
|
||||||
/* TODO ERROR: Skipped IfDirectiveTrivia *//* TODO ERROR: Skipped DisabledTextTrivia *//* TODO ERROR: Skipped ElseDirectiveTrivia */
|
|
||||||
[DebuggerHidden()]
|
|
||||||
get
|
|
||||||
{
|
|
||||||
if (m_ThreadStaticValue == null)
|
|
||||||
m_ThreadStaticValue = new T();
|
|
||||||
return m_ThreadStaticValue;
|
|
||||||
}
|
|
||||||
/* TODO ERROR: Skipped EndIfDirectiveTrivia */
|
|
||||||
}
|
|
||||||
|
|
||||||
[DebuggerHidden()]
|
|
||||||
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
|
|
||||||
public ThreadSafeObjectProvider() : base()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/* TODO ERROR: Skipped IfDirectiveTrivia *//* TODO ERROR: Skipped DisabledTextTrivia *//* TODO ERROR: Skipped ElseDirectiveTrivia */
|
|
||||||
[System.Runtime.CompilerServices.CompilerGenerated()]
|
|
||||||
[ThreadStatic()]
|
|
||||||
private static T m_ThreadStaticValue;
|
|
||||||
/* TODO ERROR: Skipped EndIfDirectiveTrivia */
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/* TODO ERROR: Skipped EndIfDirectiveTrivia */
|
|
||||||
@@ -1,253 +0,0 @@
|
|||||||
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
|
||||||
|
|
||||||
// See Compiler::LoadXmlSolutionExtension
|
|
||||||
using System.Collections;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Data;
|
|
||||||
using System.Diagnostics;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Xml.Linq;
|
|
||||||
using Microsoft.VisualBasic;
|
|
||||||
using Microsoft.VisualBasic.CompilerServices;
|
|
||||||
|
|
||||||
namespace Pilz.Updating.Administration.GUI.My
|
|
||||||
{
|
|
||||||
[Embedded()]
|
|
||||||
[DebuggerNonUserCode()]
|
|
||||||
[System.Runtime.CompilerServices.CompilerGenerated()]
|
|
||||||
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
|
|
||||||
internal sealed class InternalXmlHelper
|
|
||||||
{
|
|
||||||
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
|
|
||||||
private InternalXmlHelper()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public static string get_Value(IEnumerable<XElement> source)
|
|
||||||
{
|
|
||||||
foreach (XElement item in source)
|
|
||||||
return item.Value;
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void set_Value(IEnumerable<XElement> source, string value)
|
|
||||||
{
|
|
||||||
foreach (XElement item in source)
|
|
||||||
{
|
|
||||||
item.Value = value;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static string get_AttributeValue(IEnumerable<XElement> source, XName name)
|
|
||||||
{
|
|
||||||
foreach (XElement item in source)
|
|
||||||
return Conversions.ToString(item.Attribute(name));
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void set_AttributeValue(IEnumerable<XElement> source, XName name, string value)
|
|
||||||
{
|
|
||||||
foreach (XElement item in source)
|
|
||||||
{
|
|
||||||
item.SetAttributeValue(name, value);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static string get_AttributeValue(XElement source, XName name)
|
|
||||||
{
|
|
||||||
return Conversions.ToString(source.Attribute(name));
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void set_AttributeValue(XElement source, XName name, string value)
|
|
||||||
{
|
|
||||||
source.SetAttributeValue(name, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
|
|
||||||
public static XAttribute CreateAttribute(XName name, object value)
|
|
||||||
{
|
|
||||||
if (value is null)
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
return new XAttribute(name, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
|
|
||||||
public static XAttribute CreateNamespaceAttribute(XName name, XNamespace ns)
|
|
||||||
{
|
|
||||||
var a = new XAttribute(name, ns.NamespaceName);
|
|
||||||
a.AddAnnotation(ns);
|
|
||||||
return a;
|
|
||||||
}
|
|
||||||
|
|
||||||
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
|
|
||||||
public static object RemoveNamespaceAttributes(string[] inScopePrefixes, XNamespace[] inScopeNs, List<XAttribute> attributes, object obj)
|
|
||||||
{
|
|
||||||
if (obj is object)
|
|
||||||
{
|
|
||||||
XElement elem = obj as XElement;
|
|
||||||
if (elem is object)
|
|
||||||
{
|
|
||||||
return RemoveNamespaceAttributes(inScopePrefixes, inScopeNs, attributes, elem);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
IEnumerable elems = obj as IEnumerable;
|
|
||||||
if (elems is object)
|
|
||||||
{
|
|
||||||
return RemoveNamespaceAttributes(inScopePrefixes, inScopeNs, attributes, elems);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return obj;
|
|
||||||
}
|
|
||||||
|
|
||||||
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
|
|
||||||
public static IEnumerable RemoveNamespaceAttributes(string[] inScopePrefixes, XNamespace[] inScopeNs, List<XAttribute> attributes, IEnumerable obj)
|
|
||||||
{
|
|
||||||
if (obj is object)
|
|
||||||
{
|
|
||||||
IEnumerable<XElement> elems = obj as IEnumerable<XElement>;
|
|
||||||
if (elems is object)
|
|
||||||
{
|
|
||||||
return elems.Select(new RemoveNamespaceAttributesClosure(inScopePrefixes, inScopeNs, attributes).ProcessXElement);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return obj.Cast<object>().Select(new RemoveNamespaceAttributesClosure(inScopePrefixes, inScopeNs, attributes).ProcessObject);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return obj;
|
|
||||||
}
|
|
||||||
|
|
||||||
[DebuggerNonUserCode()]
|
|
||||||
[System.Runtime.CompilerServices.CompilerGenerated()]
|
|
||||||
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
|
|
||||||
private sealed class RemoveNamespaceAttributesClosure
|
|
||||||
{
|
|
||||||
private readonly string[] m_inScopePrefixes;
|
|
||||||
private readonly XNamespace[] m_inScopeNs;
|
|
||||||
private readonly List<XAttribute> m_attributes;
|
|
||||||
|
|
||||||
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
|
|
||||||
internal RemoveNamespaceAttributesClosure(string[] inScopePrefixes, XNamespace[] inScopeNs, List<XAttribute> attributes)
|
|
||||||
{
|
|
||||||
m_inScopePrefixes = inScopePrefixes;
|
|
||||||
m_inScopeNs = inScopeNs;
|
|
||||||
m_attributes = attributes;
|
|
||||||
}
|
|
||||||
|
|
||||||
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
|
|
||||||
internal XElement ProcessXElement(XElement elem)
|
|
||||||
{
|
|
||||||
return RemoveNamespaceAttributes(m_inScopePrefixes, m_inScopeNs, m_attributes, elem);
|
|
||||||
}
|
|
||||||
|
|
||||||
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
|
|
||||||
internal object ProcessObject(object obj)
|
|
||||||
{
|
|
||||||
XElement elem = obj as XElement;
|
|
||||||
if (elem is object)
|
|
||||||
{
|
|
||||||
return RemoveNamespaceAttributes(m_inScopePrefixes, m_inScopeNs, m_attributes, elem);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return obj;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
|
|
||||||
public static XElement RemoveNamespaceAttributes(string[] inScopePrefixes, XNamespace[] inScopeNs, List<XAttribute> attributes, XElement e)
|
|
||||||
{
|
|
||||||
if (e is object)
|
|
||||||
{
|
|
||||||
var a = e.FirstAttribute;
|
|
||||||
while (a is object)
|
|
||||||
{
|
|
||||||
var nextA = a.NextAttribute;
|
|
||||||
if (a.IsNamespaceDeclaration)
|
|
||||||
{
|
|
||||||
var ns = a.Annotation<XNamespace>();
|
|
||||||
string prefix = a.Name.LocalName;
|
|
||||||
if (ns is object)
|
|
||||||
{
|
|
||||||
if (inScopePrefixes is object && inScopeNs is object)
|
|
||||||
{
|
|
||||||
int lastIndex = inScopePrefixes.Length - 1;
|
|
||||||
for (int i = 0, loopTo = lastIndex; i <= loopTo; i++)
|
|
||||||
{
|
|
||||||
string currentInScopePrefix = inScopePrefixes[i];
|
|
||||||
var currentInScopeNs = inScopeNs[i];
|
|
||||||
if (prefix.Equals(currentInScopePrefix))
|
|
||||||
{
|
|
||||||
if (ns == currentInScopeNs)
|
|
||||||
{
|
|
||||||
// prefix and namespace match. Remove the unneeded ns attribute
|
|
||||||
a.Remove();
|
|
||||||
}
|
|
||||||
|
|
||||||
// prefix is in scope but refers to something else. Leave the ns attribute.
|
|
||||||
a = null;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (a is object)
|
|
||||||
{
|
|
||||||
// Prefix is not in scope
|
|
||||||
// Now check whether it's going to be in scope because it is in the attributes list
|
|
||||||
|
|
||||||
if (attributes is object)
|
|
||||||
{
|
|
||||||
int lastIndex = attributes.Count - 1;
|
|
||||||
for (int i = 0, loopTo1 = lastIndex; i <= loopTo1; i++)
|
|
||||||
{
|
|
||||||
var currentA = attributes[i];
|
|
||||||
string currentInScopePrefix = currentA.Name.LocalName;
|
|
||||||
var currentInScopeNs = currentA.Annotation<XNamespace>();
|
|
||||||
if (currentInScopeNs is object)
|
|
||||||
{
|
|
||||||
if (prefix.Equals(currentInScopePrefix))
|
|
||||||
{
|
|
||||||
if (ns == currentInScopeNs)
|
|
||||||
{
|
|
||||||
// prefix and namespace match. Remove the unneeded ns attribute
|
|
||||||
a.Remove();
|
|
||||||
}
|
|
||||||
|
|
||||||
// prefix is in scope but refers to something else. Leave the ns attribute.
|
|
||||||
a = null;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (a is object)
|
|
||||||
{
|
|
||||||
// Prefix is definitely not in scope
|
|
||||||
a.Remove();
|
|
||||||
// namespace is not defined either. Add this attributes list
|
|
||||||
attributes.Add(a);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
a = nextA;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return e;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
|
||||||
|
|
||||||
using System;
|
|
||||||
|
|
||||||
namespace Microsoft.VisualBasic
|
|
||||||
{
|
|
||||||
[Embedded()]
|
|
||||||
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Module | AttributeTargets.Assembly, Inherited = false)]
|
|
||||||
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
|
|
||||||
[System.Runtime.CompilerServices.CompilerGenerated()]
|
|
||||||
internal sealed class Embedded : Attribute
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,29 +0,0 @@
|
|||||||
using Microsoft.VisualBasic.ApplicationServices;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Reflection;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using Telerik.WinControls;
|
|
||||||
using Telerik.WinControls.Themes;
|
|
||||||
|
|
||||||
namespace Pilz.Updating.Administration.GUI.My
|
|
||||||
{
|
|
||||||
|
|
||||||
// HINWEIS: Diese Datei wird automatisch generiert und darf nicht direkt bearbeitet werden. Wenn Sie Änderungen vornehmen möchten
|
|
||||||
// oder in dieser Datei Buildfehler auftreten, wechseln Sie zum Projekt-Designer.
|
|
||||||
// (Wechseln Sie dazu zu den Projekteigenschaften, oder doppelklicken Sie auf den Knoten "Mein Projekt" im
|
|
||||||
// Projektmappen-Explorer). Nehmen Sie auf der Registerkarte "Anwendung" entsprechende Änderungen vor.
|
|
||||||
//
|
|
||||||
internal partial class MyApplication
|
|
||||||
{
|
|
||||||
protected override bool OnStartup(StartupEventArgs eventArgs)
|
|
||||||
{
|
|
||||||
var success = ThemeResolutionService.LoadPackageResource("Pilz.Updating.Administration.GUI.CustomThemes.Office2019DarkPurple.tssp");
|
|
||||||
if (success)
|
|
||||||
ThemeResolutionService.ApplicationThemeName = "Office2019DarkPurple";
|
|
||||||
return base.OnStartup(eventArgs);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,62 +1,60 @@
|
|||||||
using System;
|
using System;
|
||||||
using Microsoft.VisualBasic.CompilerServices;
|
|
||||||
using Telerik.WinControls.UI;
|
using Telerik.WinControls.UI;
|
||||||
|
|
||||||
namespace Pilz.Updating.Administration.GUI
|
namespace Pilz.Updating.Administration.GUI;
|
||||||
|
|
||||||
|
public partial class PackageDescriptionEditor
|
||||||
{
|
{
|
||||||
public partial class PackageDescriptionEditor
|
|
||||||
|
// C o n s t r u c t o r s
|
||||||
|
|
||||||
|
public PackageDescriptionEditor()
|
||||||
{
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
|
||||||
// C o n s t r u c t o r s
|
radDropDownList_Formatting.Items.AddRange(new RadListDataItem[]
|
||||||
|
|
||||||
public PackageDescriptionEditor()
|
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
new() { Text = "Nur Text", Tag = UpdateNotesContentType.PlainText },
|
||||||
|
new() { Text = "Markdown", Tag = UpdateNotesContentType.Markdown },
|
||||||
|
new() { Text = "HTML", Tag = UpdateNotesContentType.HTML },
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
radDropDownList_Formatting.Items.AddRange(new RadListDataItem[]
|
// P r o p e r t i e s
|
||||||
{
|
|
||||||
new RadListDataItem { Text = "Nur Text", Tag = UpdateNotesContentType.PlainText },
|
public string Titel
|
||||||
new RadListDataItem { Text = "Markdown", Tag = UpdateNotesContentType.Markdown },
|
{
|
||||||
new RadListDataItem { Text = "HTML", Tag = UpdateNotesContentType.HTML },
|
get
|
||||||
});
|
{
|
||||||
|
return radTextBoxControl_Titel.Text;
|
||||||
}
|
}
|
||||||
|
set
|
||||||
// P r o p e r t i e s
|
|
||||||
|
|
||||||
public string Titel
|
|
||||||
{
|
{
|
||||||
get
|
radTextBoxControl_Titel.Text = value;
|
||||||
{
|
|
||||||
return radTextBoxControl_Titel.Text;
|
|
||||||
}
|
|
||||||
set
|
|
||||||
{
|
|
||||||
radTextBoxControl_Titel.Text = value;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public string Description
|
public string Description
|
||||||
|
{
|
||||||
|
get
|
||||||
{
|
{
|
||||||
get
|
return radTextBox_Description.Text;
|
||||||
{
|
|
||||||
return radTextBox_Description.Text;
|
|
||||||
}
|
|
||||||
set
|
|
||||||
{
|
|
||||||
radTextBox_Description.Text = value ?? String.Empty;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
set
|
||||||
public UpdateNotesContentType DescriptionType
|
|
||||||
{
|
{
|
||||||
get =>
|
radTextBox_Description.Text = value ?? String.Empty;
|
||||||
(UpdateNotesContentType)radDropDownList_Formatting.SelectedItem?.Tag;
|
}
|
||||||
set
|
}
|
||||||
{
|
|
||||||
foreach (var item in radDropDownList_Formatting.Items)
|
public UpdateNotesContentType DescriptionType
|
||||||
if ((UpdateNotesContentType)item.Tag == value)
|
{
|
||||||
radDropDownList_Formatting.SelectedItem = item;
|
get =>
|
||||||
}
|
(UpdateNotesContentType)radDropDownList_Formatting.SelectedItem?.Tag;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
foreach (var item in radDropDownList_Formatting.Items)
|
||||||
|
if ((UpdateNotesContentType)item.Tag == value)
|
||||||
|
radDropDownList_Formatting.SelectedItem = item;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -48,13 +48,10 @@
|
|||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Microsoft-WindowsAPICodePack-Shell" Version="1.1.5" />
|
<PackageReference Include="Microsoft-WindowsAPICodePack-Shell" Version="1.1.5" />
|
||||||
<PackageReference Include="Microsoft.VisualBasic" Version="10.3.0" />
|
<PackageReference Include="Microsoft.VisualBasic" Version="10.3.0" />
|
||||||
<PackageReference Include="Pilz.Cryptography" Version="2.0.0" />
|
<PackageReference Include="Pilz.Cryptography" Version="2.0.1" />
|
||||||
<PackageReference Include="Pilz.IO" Version="2.0.0" />
|
<PackageReference Include="Pilz.IO" Version="2.0.0" />
|
||||||
<PackageReference Include="System.Data.DataSetExtensions" Version="4.5.0" />
|
<PackageReference Include="System.Data.DataSetExtensions" Version="4.5.0" />
|
||||||
<PackageReference Include="System.Net.Http" Version="4.3.4" />
|
<PackageReference Include="System.Net.Http" Version="4.3.4" />
|
||||||
<PackageReference Include="UI.for.WinForms.AllControls.Net60">
|
|
||||||
<Version>2023.1.117</Version>
|
|
||||||
</PackageReference>
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Import Include="Microsoft.VisualBasic" />
|
<Import Include="Microsoft.VisualBasic" />
|
||||||
@@ -71,15 +68,11 @@
|
|||||||
<Import Include="Z.Collections.Extensions" />
|
<Import Include="Z.Collections.Extensions" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Update="DiscordBotSettingsWindow.cs">
|
<Compile Update="DiscordBotSettingsWindow.cs" />
|
||||||
<SubType>Form</SubType>
|
|
||||||
</Compile>
|
|
||||||
<Compile Update="DiscordBotSettingsWindow.Designer.cs">
|
<Compile Update="DiscordBotSettingsWindow.Designer.cs">
|
||||||
<DependentUpon>DiscordBotSettingsWindow.cs</DependentUpon>
|
<DependentUpon>DiscordBotSettingsWindow.cs</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Update="DiscordPostDialog.cs">
|
<Compile Update="DiscordPostDialog.cs" />
|
||||||
<SubType>Form</SubType>
|
|
||||||
</Compile>
|
|
||||||
<Compile Update="DiscordPostDialog.Designer.cs">
|
<Compile Update="DiscordPostDialog.Designer.cs">
|
||||||
<DependentUpon>DiscordPostDialog.cs</DependentUpon>
|
<DependentUpon>DiscordPostDialog.cs</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
@@ -90,17 +83,11 @@
|
|||||||
<Compile Update="ApplicationVersionInput.Designer.cs">
|
<Compile Update="ApplicationVersionInput.Designer.cs">
|
||||||
<DependentUpon>ApplicationVersionInput.cs</DependentUpon>
|
<DependentUpon>ApplicationVersionInput.cs</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Update="ApplicationVersionInput.cs">
|
<Compile Update="ApplicationVersionInput.cs" />
|
||||||
<SubType>Form</SubType>
|
|
||||||
</Compile>
|
|
||||||
<Compile Update="UpdateManagerWindow.cs" />
|
<Compile Update="UpdateManagerWindow.cs" />
|
||||||
<Compile Update="UpdateManagerWindow.Designer.cs">
|
<Compile Update="UpdateManagerWindow.Designer.cs">
|
||||||
<DependentUpon>UpdateManagerWindow.cs</DependentUpon>
|
<DependentUpon>UpdateManagerWindow.cs</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Update="My Project\Application.Designer.cs">
|
|
||||||
<AutoGen>True</AutoGen>
|
|
||||||
<DependentUpon>Application.myapp</DependentUpon>
|
|
||||||
</Compile>
|
|
||||||
<Compile Update="Properties\Resources.Designer.cs">
|
<Compile Update="Properties\Resources.Designer.cs">
|
||||||
<AutoGen>True</AutoGen>
|
<AutoGen>True</AutoGen>
|
||||||
<DesignTime>True</DesignTime>
|
<DesignTime>True</DesignTime>
|
||||||
@@ -111,9 +98,7 @@
|
|||||||
<DependentUpon>Settings.settings</DependentUpon>
|
<DependentUpon>Settings.settings</DependentUpon>
|
||||||
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Update="ProxyConfigEditor.cs">
|
<Compile Update="ProxyConfigEditor.cs" />
|
||||||
<SubType>Form</SubType>
|
|
||||||
</Compile>
|
|
||||||
<Compile Update="ProxyConfigEditor.Designer.cs">
|
<Compile Update="ProxyConfigEditor.Designer.cs">
|
||||||
<DependentUpon>ProxyConfigEditor.cs</DependentUpon>
|
<DependentUpon>ProxyConfigEditor.cs</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
@@ -162,10 +147,6 @@
|
|||||||
</EmbeddedResource>
|
</EmbeddedResource>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include="My Project\Application.myapp">
|
|
||||||
<Generator>MyApplicationCodeGenerator</Generator>
|
|
||||||
<LastGenOutput>Application.Designer.cs</LastGenOutput>
|
|
||||||
</None>
|
|
||||||
<None Include="Properties\Settings.settings">
|
<None Include="Properties\Settings.settings">
|
||||||
<Generator>SettingsSingleFileGenerator</Generator>
|
<Generator>SettingsSingleFileGenerator</Generator>
|
||||||
<CustomToolNamespace>Pilz.Updating.Administration.GUI.My</CustomToolNamespace>
|
<CustomToolNamespace>Pilz.Updating.Administration.GUI.My</CustomToolNamespace>
|
||||||
@@ -217,9 +198,11 @@
|
|||||||
<ProjectReference Include="..\Pilz.Updating\Pilz.Updating.csproj" />
|
<ProjectReference Include="..\Pilz.Updating\Pilz.Updating.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Markdig" Version="0.33.0" />
|
<PackageReference Include="Markdig" Version="0.37.0" />
|
||||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
||||||
<PackageReference Include="System.Runtime.CompilerServices.Unsafe" Version="6.0.0" />
|
<PackageReference Include="System.Runtime.CompilerServices.Unsafe" Version="6.0.0" />
|
||||||
|
<PackageReference Include="UI.for.WinForms.Common" Version="2024.2.514" />
|
||||||
|
<PackageReference Include="UI.for.WinForms.Themes" Version="2024.2.514" />
|
||||||
<PackageReference Include="Z.ExtensionMethods.WithNamespace" Version="2.1.1" />
|
<PackageReference Include="Z.ExtensionMethods.WithNamespace" Version="2.1.1" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|||||||
21
Pilz.Updating.Administration.GUI/Program.cs
Normal file
21
Pilz.Updating.Administration.GUI/Program.cs
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
using Pilz.Updating.Administration.GUI;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
using Telerik.WinControls;
|
||||||
|
|
||||||
|
namespace Pilz.Updating.UpdateInstaller;
|
||||||
|
|
||||||
|
internal static class Program
|
||||||
|
{
|
||||||
|
internal static void Main(string[] args)
|
||||||
|
{
|
||||||
|
Application.EnableVisualStyles();
|
||||||
|
Application.SetCompatibleTextRenderingDefault(false);
|
||||||
|
Application.SetHighDpiMode(HighDpiMode.PerMonitorV2);
|
||||||
|
|
||||||
|
var success = ThemeResolutionService.LoadPackageResource("Pilz.Updating.Administration.GUI.CustomThemes.Office2019DarkPurple.tssp");
|
||||||
|
if (success)
|
||||||
|
ThemeResolutionService.ApplicationThemeName = "Office2019DarkPurple";
|
||||||
|
|
||||||
|
Application.Run(new UpdateManagerWindow());
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,5 +1,4 @@
|
|||||||
using global::System;
|
using global::System;
|
||||||
using global::System.Reflection;
|
|
||||||
using global::System.Runtime.InteropServices;
|
using global::System.Runtime.InteropServices;
|
||||||
[assembly: ComVisible(false)]
|
[assembly: ComVisible(false)]
|
||||||
|
|
||||||
|
|||||||
@@ -1,38 +1,29 @@
|
|||||||
using System;
|
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;
|
|
||||||
using Telerik.WinControls.UI;
|
using Telerik.WinControls.UI;
|
||||||
|
|
||||||
namespace Pilz.Updating.Administration.GUI
|
namespace Pilz.Updating.Administration.GUI;
|
||||||
|
|
||||||
|
public partial class ProxyConfigEditor : RadForm
|
||||||
{
|
{
|
||||||
public partial class ProxyConfigEditor : RadForm
|
private readonly ProxyConfiguration config = null;
|
||||||
|
|
||||||
|
public ProxyConfigEditor(ProxyConfiguration config)
|
||||||
{
|
{
|
||||||
private readonly ProxyConfiguration config = null;
|
this.config = config;
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
|
||||||
public ProxyConfigEditor(ProxyConfiguration config)
|
private void UpdateServerInfoEditor_Shown(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
this.config = config;
|
radToggleSwitch_UserProxy.Value = config.UseProxyAuth;
|
||||||
InitializeComponent();
|
radTextBoxControl_Username.Text = config.Username;
|
||||||
}
|
radTextBoxControl_Password.Text = config.Password ?? string.Empty;
|
||||||
|
}
|
||||||
|
|
||||||
private void UpdateServerInfoEditor_Shown(object sender, EventArgs e)
|
private void ButtonX_OK_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
radToggleSwitch_UserProxy.Value = config.UseProxyAuth;
|
config.UseProxyAuth = radToggleSwitch_UserProxy.Value;
|
||||||
radTextBoxControl_Username.Text = config.Username;
|
config.Username = radTextBoxControl_Username.Text.Trim();
|
||||||
radTextBoxControl_Password.Text = config.Password ?? string.Empty;
|
config.Password = radTextBoxControl_Password.Text;
|
||||||
}
|
|
||||||
|
|
||||||
private void ButtonX_OK_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
config.UseProxyAuth = radToggleSwitch_UserProxy.Value;
|
|
||||||
config.Username = radTextBoxControl_Username.Text.Trim();
|
|
||||||
config.Password = radTextBoxControl_Password.Text;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -1,41 +1,32 @@
|
|||||||
using System;
|
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;
|
|
||||||
using Telerik.WinControls.UI;
|
using Telerik.WinControls.UI;
|
||||||
|
|
||||||
namespace Pilz.Updating.Administration.GUI
|
namespace Pilz.Updating.Administration.GUI;
|
||||||
|
|
||||||
|
public partial class UpdateServerInfoEditor : RadForm
|
||||||
{
|
{
|
||||||
public partial class UpdateServerInfoEditor : RadForm
|
public UpdateServerInfoEditor()
|
||||||
{
|
{
|
||||||
public UpdateServerInfoEditor()
|
InitializeComponent();
|
||||||
{
|
}
|
||||||
InitializeComponent();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void UpdateServerInfoEditor_Shown(object sender, EventArgs e)
|
private void UpdateServerInfoEditor_Shown(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
radTextBoxControl_ServerAddress.Text = General.CurProject.UpdateServerConfig.ServerAdress;
|
radTextBoxControl_ServerAddress.Text = General.CurProject.UpdateServerConfig.ServerAdress;
|
||||||
radTextBoxControl_PublicBasisURL.Text = General.CurProject.UpdateServerConfig.PublicPackageBaseURL;
|
radTextBoxControl_PublicBasisURL.Text = General.CurProject.UpdateServerConfig.PublicPackageBaseURL;
|
||||||
radTextBoxControl_PackageConfigurationFileName.Text = General.CurProject.UpdateServerConfig.UpdateInfoFilename;
|
radTextBoxControl_PackageConfigurationFileName.Text = General.CurProject.UpdateServerConfig.UpdateInfoFilename;
|
||||||
radTextBoxControl_Username.Text = General.CurProject.UpdateServerConfig.Username;
|
radTextBoxControl_Username.Text = General.CurProject.UpdateServerConfig.Username;
|
||||||
radTextBoxControl_Password.Text = General.CurProject.UpdateServerConfig.Password;
|
radTextBoxControl_Password.Text = General.CurProject.UpdateServerConfig.Password;
|
||||||
radToggleSwitch_UseProxyForWebDAV.Value = General.CurProject.UpdateServerConfig.UseProxyForWebDAV;
|
radToggleSwitch_UseProxyForWebDAV.Value = General.CurProject.UpdateServerConfig.UseProxyForWebDAV;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ButtonX_OK_Click(object sender, EventArgs e)
|
private void ButtonX_OK_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
General.CurProject.UpdateServerConfig.ServerAdress = radTextBoxControl_ServerAddress.Text.Trim();
|
General.CurProject.UpdateServerConfig.ServerAdress = radTextBoxControl_ServerAddress.Text.Trim();
|
||||||
General.CurProject.UpdateServerConfig.PublicPackageBaseURL = radTextBoxControl_PublicBasisURL.Text.Trim();
|
General.CurProject.UpdateServerConfig.PublicPackageBaseURL = radTextBoxControl_PublicBasisURL.Text.Trim();
|
||||||
General.CurProject.UpdateServerConfig.UpdateInfoFilename = radTextBoxControl_PackageConfigurationFileName.Text.Trim();
|
General.CurProject.UpdateServerConfig.UpdateInfoFilename = radTextBoxControl_PackageConfigurationFileName.Text.Trim();
|
||||||
General.CurProject.UpdateServerConfig.Username = radTextBoxControl_Username.Text.Trim();
|
General.CurProject.UpdateServerConfig.Username = radTextBoxControl_Username.Text.Trim();
|
||||||
General.CurProject.UpdateServerConfig.Password = radTextBoxControl_Password.Text;
|
General.CurProject.UpdateServerConfig.Password = radTextBoxControl_Password.Text;
|
||||||
General.CurProject.UpdateServerConfig.UseProxyForWebDAV = radToggleSwitch_UseProxyForWebDAV.Value;
|
General.CurProject.UpdateServerConfig.UseProxyForWebDAV = radToggleSwitch_UseProxyForWebDAV.Value;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,228 +4,227 @@ using Discord.Net.WebSockets;
|
|||||||
using Discord.WebSocket;
|
using Discord.WebSocket;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace Pilz.Updating.Administration.Discord
|
namespace Pilz.Updating.Administration.Discord;
|
||||||
|
|
||||||
|
public class DiscordBot
|
||||||
{
|
{
|
||||||
public class DiscordBot
|
public delegate void LoggedMsgEventHandler(object sender, string logmsg, bool isError);
|
||||||
|
|
||||||
|
public event EventHandler GotReady;
|
||||||
|
public event EventHandler HasDisconnected;
|
||||||
|
public event LoggedMsgEventHandler LoggedMsg;
|
||||||
|
|
||||||
|
public DiscordBotConfig Config { get; private set; }
|
||||||
|
public DiscordSocketClient Client { get; private set; }
|
||||||
|
public bool IsReady { get; private set; } = false;
|
||||||
|
|
||||||
|
// C o n s t r u c t o r
|
||||||
|
|
||||||
|
public DiscordBot(DiscordBotConfig config)
|
||||||
{
|
{
|
||||||
public delegate void LoggedMsgEventHandler(object sender, string logmsg, bool isError);
|
Config = config;
|
||||||
|
}
|
||||||
|
|
||||||
public event EventHandler GotReady;
|
// M a i n
|
||||||
public event EventHandler HasDisconnected;
|
|
||||||
public event LoggedMsgEventHandler LoggedMsg;
|
|
||||||
|
|
||||||
public DiscordBotConfig Config { get; private set; }
|
public async void Start()
|
||||||
public DiscordSocketClient Client { get; private set; }
|
{
|
||||||
public bool IsReady { get; private set; } = false;
|
if (!string.IsNullOrEmpty(Config.DiscordBotToken))
|
||||||
|
|
||||||
// C o n s t r u c t o r
|
|
||||||
|
|
||||||
public DiscordBot(DiscordBotConfig config)
|
|
||||||
{
|
{
|
||||||
Config = config;
|
var socketConfig = new DiscordSocketConfig
|
||||||
|
{
|
||||||
|
RestClientProvider = DefaultRestClientProvider.Create(useProxy: true),
|
||||||
|
WebSocketProvider = DefaultWebSocketProvider.Create(System.Net.WebRequest.DefaultWebProxy)
|
||||||
|
};
|
||||||
|
|
||||||
|
Client = new DiscordSocketClient(socketConfig);
|
||||||
|
|
||||||
|
Client.Log += Client_Log;
|
||||||
|
Client.Ready += Client_Ready;
|
||||||
|
Client.Disconnected += Client_Disconnected;
|
||||||
|
|
||||||
|
await Client.LoginAsync(TokenType.Bot, Config.DiscordBotToken);
|
||||||
|
await Client.StartAsync();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
LoggedMsg?.Invoke(this, "Disabled or Token invalid", true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public async void Stop()
|
||||||
|
{
|
||||||
|
await Client.StopAsync();
|
||||||
|
await Client.LogoutAsync();
|
||||||
|
}
|
||||||
|
|
||||||
|
// C l i e n t - E v e n t s
|
||||||
|
|
||||||
|
private Task Client_Disconnected(Exception exception)
|
||||||
|
{
|
||||||
|
Task.Run(() => HasDisconnected?.Invoke(this, new EventArgs()));
|
||||||
|
return Task.CompletedTask;
|
||||||
|
}
|
||||||
|
|
||||||
|
private Task Client_Ready()
|
||||||
|
{
|
||||||
|
Task.Run(() =>
|
||||||
|
{
|
||||||
|
Task.Delay(10);
|
||||||
|
IsReady = true;
|
||||||
|
GotReady?.Invoke(this, new EventArgs());
|
||||||
|
});
|
||||||
|
return Task.CompletedTask;
|
||||||
|
}
|
||||||
|
|
||||||
|
private Task Client_Log(LogMessage msg)
|
||||||
|
{
|
||||||
|
Task.Run(() => LoggedMsg?.Invoke(this, msg.Message, msg.Exception is object));
|
||||||
|
return Task.CompletedTask;
|
||||||
|
}
|
||||||
|
|
||||||
|
// F e a t u r e s
|
||||||
|
|
||||||
|
public IReadOnlyDictionary<ulong, string> GetGuilds()
|
||||||
|
{
|
||||||
|
var dic = new Dictionary<ulong, string>();
|
||||||
|
|
||||||
|
foreach (var guild in Client.Guilds)
|
||||||
|
dic.Add(guild.Id, guild.Name);
|
||||||
|
|
||||||
|
return dic;
|
||||||
|
}
|
||||||
|
|
||||||
|
public IReadOnlyDictionary<ulong, string> GetTextChannels(ulong guildID)
|
||||||
|
{
|
||||||
|
var dic = new Dictionary<ulong, string>();
|
||||||
|
var guild = Client.GetGuild(guildID);
|
||||||
|
|
||||||
|
if (guild is object)
|
||||||
|
{
|
||||||
|
foreach (var channel in guild.TextChannels)
|
||||||
|
dic.Add(channel.Id, channel.Name);
|
||||||
}
|
}
|
||||||
|
|
||||||
// M a i n
|
return dic;
|
||||||
|
}
|
||||||
|
|
||||||
public async void Start()
|
public IReadOnlyDictionary<ulong, string> GetRoles(ulong guildID)
|
||||||
|
{
|
||||||
|
var dic = new Dictionary<ulong, string>();
|
||||||
|
|
||||||
|
foreach (var role in Client.GetGuild(guildID).Roles)
|
||||||
|
dic.Add(role.Id, role.Name);
|
||||||
|
|
||||||
|
return dic;
|
||||||
|
}
|
||||||
|
|
||||||
|
private string GetPingMessage(ulong? pingRole)
|
||||||
|
{
|
||||||
|
return pingRole != null ? $"<@&{pingRole ?? default}>" : string.Empty;
|
||||||
|
}
|
||||||
|
|
||||||
|
//private async Task<string> BuildUpdateMsg(string versionName, ApplicationVersion version, string changelog, ulong guildID, ulong channelID, string appName, string message, bool addChangelog, ulong? pingRole)
|
||||||
|
//{
|
||||||
|
// string msg = string.Empty;
|
||||||
|
|
||||||
|
// // Add ping
|
||||||
|
// if (pingRole != null)
|
||||||
|
// msg += $"<{GetPingMessage(pingRole)}\n\n";
|
||||||
|
|
||||||
|
// // Add version as titel
|
||||||
|
// var versionString = version.ToString();
|
||||||
|
// if (version.Channel == Channels.Stable && version.Build == 1)
|
||||||
|
// versionString = versionString.Remove(versionString.IndexOf(" "));
|
||||||
|
// msg += $"**Update:** {appName} **Version __{versionString}__**";
|
||||||
|
|
||||||
|
// // Add titel
|
||||||
|
// if (!string.IsNullOrEmpty(versionName))
|
||||||
|
// msg += $"\n> {versionName}";
|
||||||
|
|
||||||
|
// // Add message
|
||||||
|
// if (!string.IsNullOrEmpty(message))
|
||||||
|
// msg += "\n\n" + message;
|
||||||
|
|
||||||
|
// // Add changelog
|
||||||
|
// if (addChangelog && !string.IsNullOrEmpty(changelog))
|
||||||
|
// {
|
||||||
|
// var sr = new StringReader(changelog);
|
||||||
|
// var sw = new StringWriter();
|
||||||
|
|
||||||
|
// while (sr.Peek() != -1)
|
||||||
|
// {
|
||||||
|
// var line = await sr.ReadLineAsync();
|
||||||
|
// await sw.WriteLineAsync($"> {line}");
|
||||||
|
// }
|
||||||
|
|
||||||
|
// msg += "\n\nChangelog:\n" + sw.ToString();
|
||||||
|
// sr.Close();
|
||||||
|
// sw.Close();
|
||||||
|
// }
|
||||||
|
|
||||||
|
// return msg;
|
||||||
|
//}
|
||||||
|
|
||||||
|
public async Task SendUpdateNotification(UpdatePackageInfo package, ulong guildID, ulong channelID, string appName, string message, bool addChangelog, bool pingEveryone)
|
||||||
|
{
|
||||||
|
ulong? pingRole;
|
||||||
|
var updateNotifyRoleLower = Config.UpdateNotificationRoll.ToLower();
|
||||||
|
|
||||||
|
if (pingEveryone)
|
||||||
|
pingRole = GetRoles(guildID).FirstOrDefault(n => n.Value.ToLower() == updateNotifyRoleLower).Key;
|
||||||
|
else
|
||||||
|
pingRole = null;
|
||||||
|
|
||||||
|
string msg = GetPingMessage(pingRole); //await BuildUpdateMsg(versionName, version, changelog, guildID, channelID, appName, message, addChangelog, pingRole);
|
||||||
|
var embed = BuildEmbed(package, appName, message, addChangelog);
|
||||||
|
var channel = Client.GetGuild(guildID)?.GetTextChannel(channelID);
|
||||||
|
|
||||||
|
if (string.IsNullOrEmpty(msg))
|
||||||
|
msg = null;
|
||||||
|
|
||||||
|
if (channel != null)
|
||||||
|
await channel.SendMessageAsync(text: msg, embed: embed);
|
||||||
|
}
|
||||||
|
|
||||||
|
private Embed BuildEmbed(UpdatePackageInfo package, string appName, string message, bool addChangelog)
|
||||||
|
{
|
||||||
|
var embed = new EmbedBuilder();
|
||||||
|
|
||||||
|
// Add titel
|
||||||
|
var versionString = package.Version.ToString();
|
||||||
|
if (package.Version.Channel == Channels.Stable && package.Version.Build == 1)
|
||||||
|
versionString = versionString.Remove(versionString.IndexOf(" "));
|
||||||
|
var strTitle = $"**Update:** {appName} **Version __{versionString}__**";
|
||||||
|
|
||||||
|
if (!string.IsNullOrEmpty(package.Name))
|
||||||
|
strTitle += $"\n{package.Name}";
|
||||||
|
|
||||||
|
embed.Title = strTitle;
|
||||||
|
|
||||||
|
// Add Description
|
||||||
|
if (!string.IsNullOrEmpty(message))
|
||||||
|
embed.Description += message;
|
||||||
|
|
||||||
|
// Add changelog
|
||||||
|
if (addChangelog && !string.IsNullOrEmpty(package.Notes.Content) && package.Notes.ContentType != UpdateNotesContentType.HTML)
|
||||||
{
|
{
|
||||||
if (!string.IsNullOrEmpty(Config.DiscordBotToken))
|
switch (true)
|
||||||
{
|
{
|
||||||
var socketConfig = new DiscordSocketConfig();
|
case object _ when package.Notes.ContentType == UpdateNotesContentType.PlainText && package.Notes.Content.Length <= 2048:
|
||||||
socketConfig.RestClientProvider = DefaultRestClientProvider.Create(useProxy: true);
|
embed.AddField("Changelog:", package.Notes.Content);
|
||||||
socketConfig.WebSocketProvider = DefaultWebSocketProvider.Create(System.Net.WebRequest.DefaultWebProxy);
|
break;
|
||||||
|
case object _ when package.Notes.ContentType == UpdateNotesContentType.PlainText:
|
||||||
Client = new DiscordSocketClient(socketConfig);
|
case object _ when package.Notes.ContentType == UpdateNotesContentType.Markdown:
|
||||||
|
embed.AddField("Changelog:", Markdig.Markdown.ToPlainText(package.Notes.Content));
|
||||||
Client.Log += Client_Log;
|
break;
|
||||||
Client.Ready += Client_Ready;
|
|
||||||
Client.Disconnected += Client_Disconnected;
|
|
||||||
|
|
||||||
await Client.LoginAsync(TokenType.Bot, Config.DiscordBotToken);
|
|
||||||
await Client.StartAsync();
|
|
||||||
}
|
}
|
||||||
else
|
|
||||||
LoggedMsg?.Invoke(this, "Disabled or Token invalid", true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public async void Stop()
|
// Author
|
||||||
{
|
// ...
|
||||||
await Client.StopAsync();
|
|
||||||
await Client.LogoutAsync();
|
|
||||||
}
|
|
||||||
|
|
||||||
// C l i e n t - E v e n t s
|
return embed.Build();
|
||||||
|
|
||||||
private Task Client_Disconnected(Exception exception)
|
|
||||||
{
|
|
||||||
Task.Run(() => HasDisconnected?.Invoke(this, new EventArgs()));
|
|
||||||
return Task.CompletedTask;
|
|
||||||
}
|
|
||||||
|
|
||||||
private Task Client_Ready()
|
|
||||||
{
|
|
||||||
Task.Run(() =>
|
|
||||||
{
|
|
||||||
Task.Delay(10);
|
|
||||||
IsReady = true;
|
|
||||||
GotReady?.Invoke(this, new EventArgs());
|
|
||||||
});
|
|
||||||
return Task.CompletedTask;
|
|
||||||
}
|
|
||||||
|
|
||||||
private Task Client_Log(LogMessage msg)
|
|
||||||
{
|
|
||||||
Task.Run(() => LoggedMsg?.Invoke(this, msg.Message, msg.Exception is object));
|
|
||||||
return Task.CompletedTask;
|
|
||||||
}
|
|
||||||
|
|
||||||
// F e a t u r e s
|
|
||||||
|
|
||||||
public IReadOnlyDictionary<ulong, string> GetGuilds()
|
|
||||||
{
|
|
||||||
var dic = new Dictionary<ulong, string>();
|
|
||||||
|
|
||||||
foreach (var guild in Client.Guilds)
|
|
||||||
dic.Add(guild.Id, guild.Name);
|
|
||||||
|
|
||||||
return dic;
|
|
||||||
}
|
|
||||||
|
|
||||||
public IReadOnlyDictionary<ulong, string> GetTextChannels(ulong guildID)
|
|
||||||
{
|
|
||||||
var dic = new Dictionary<ulong, string>();
|
|
||||||
var guild = Client.GetGuild(guildID);
|
|
||||||
|
|
||||||
if (guild is object)
|
|
||||||
{
|
|
||||||
foreach (var channel in guild.TextChannels)
|
|
||||||
dic.Add(channel.Id, channel.Name);
|
|
||||||
}
|
|
||||||
|
|
||||||
return dic;
|
|
||||||
}
|
|
||||||
|
|
||||||
public IReadOnlyDictionary<ulong, string> GetRoles(ulong guildID)
|
|
||||||
{
|
|
||||||
var dic = new Dictionary<ulong, string>();
|
|
||||||
|
|
||||||
foreach (var role in Client.GetGuild(guildID).Roles)
|
|
||||||
dic.Add(role.Id, role.Name);
|
|
||||||
|
|
||||||
return dic;
|
|
||||||
}
|
|
||||||
|
|
||||||
private string GetPingMessage(ulong? pingRole)
|
|
||||||
{
|
|
||||||
return pingRole != null ? $"<@&{pingRole ?? default}>" : string.Empty;
|
|
||||||
}
|
|
||||||
|
|
||||||
//private async Task<string> BuildUpdateMsg(string versionName, ApplicationVersion version, string changelog, ulong guildID, ulong channelID, string appName, string message, bool addChangelog, ulong? pingRole)
|
|
||||||
//{
|
|
||||||
// string msg = string.Empty;
|
|
||||||
|
|
||||||
// // Add ping
|
|
||||||
// if (pingRole != null)
|
|
||||||
// msg += $"<{GetPingMessage(pingRole)}\n\n";
|
|
||||||
|
|
||||||
// // Add version as titel
|
|
||||||
// var versionString = version.ToString();
|
|
||||||
// if (version.Channel == Channels.Stable && version.Build == 1)
|
|
||||||
// versionString = versionString.Remove(versionString.IndexOf(" "));
|
|
||||||
// msg += $"**Update:** {appName} **Version __{versionString}__**";
|
|
||||||
|
|
||||||
// // Add titel
|
|
||||||
// if (!string.IsNullOrEmpty(versionName))
|
|
||||||
// msg += $"\n> {versionName}";
|
|
||||||
|
|
||||||
// // Add message
|
|
||||||
// if (!string.IsNullOrEmpty(message))
|
|
||||||
// msg += "\n\n" + message;
|
|
||||||
|
|
||||||
// // Add changelog
|
|
||||||
// if (addChangelog && !string.IsNullOrEmpty(changelog))
|
|
||||||
// {
|
|
||||||
// var sr = new StringReader(changelog);
|
|
||||||
// var sw = new StringWriter();
|
|
||||||
|
|
||||||
// while (sr.Peek() != -1)
|
|
||||||
// {
|
|
||||||
// var line = await sr.ReadLineAsync();
|
|
||||||
// await sw.WriteLineAsync($"> {line}");
|
|
||||||
// }
|
|
||||||
|
|
||||||
// msg += "\n\nChangelog:\n" + sw.ToString();
|
|
||||||
// sr.Close();
|
|
||||||
// sw.Close();
|
|
||||||
// }
|
|
||||||
|
|
||||||
// return msg;
|
|
||||||
//}
|
|
||||||
|
|
||||||
public async Task SendUpdateNotification(UpdatePackageInfo package, ulong guildID, ulong channelID, string appName, string message, bool addChangelog, bool pingEveryone)
|
|
||||||
{
|
|
||||||
ulong? pingRole;
|
|
||||||
var updateNotifyRoleLower = Config.UpdateNotificationRoll.ToLower();
|
|
||||||
|
|
||||||
if (pingEveryone)
|
|
||||||
pingRole = GetRoles(guildID).FirstOrDefault(n => n.Value.ToLower() == updateNotifyRoleLower).Key;
|
|
||||||
else
|
|
||||||
pingRole = null;
|
|
||||||
|
|
||||||
string msg = GetPingMessage(pingRole); //await BuildUpdateMsg(versionName, version, changelog, guildID, channelID, appName, message, addChangelog, pingRole);
|
|
||||||
var embed = BuildEmbed(package, appName, message, addChangelog);
|
|
||||||
var channel = Client.GetGuild(guildID)?.GetTextChannel(channelID);
|
|
||||||
|
|
||||||
if (string.IsNullOrEmpty(msg))
|
|
||||||
msg = null;
|
|
||||||
|
|
||||||
if (channel != null)
|
|
||||||
await channel.SendMessageAsync(text:msg, embed:embed);
|
|
||||||
}
|
|
||||||
|
|
||||||
private Embed BuildEmbed(UpdatePackageInfo package, string appName, string message, bool addChangelog)
|
|
||||||
{
|
|
||||||
var embed = new EmbedBuilder();
|
|
||||||
|
|
||||||
// Add titel
|
|
||||||
var versionString = package.Version.ToString();
|
|
||||||
if (package.Version.Channel == Channels.Stable && package.Version.Build == 1)
|
|
||||||
versionString = versionString.Remove(versionString.IndexOf(" "));
|
|
||||||
var strTitle = $"**Update:** {appName} **Version __{versionString}__**";
|
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(package.Name))
|
|
||||||
strTitle += $"\n{package.Name}";
|
|
||||||
|
|
||||||
embed.Title = strTitle;
|
|
||||||
|
|
||||||
// Add Description
|
|
||||||
if (!string.IsNullOrEmpty(message))
|
|
||||||
embed.Description += message;
|
|
||||||
|
|
||||||
// Add changelog
|
|
||||||
if (addChangelog && !string.IsNullOrEmpty(package.Notes.Content) && package.Notes.ContentType != UpdateNotesContentType.HTML)
|
|
||||||
{
|
|
||||||
switch (true)
|
|
||||||
{
|
|
||||||
case object _ when package.Notes.ContentType == UpdateNotesContentType.PlainText && package.Notes.Content.Length <= 2048:
|
|
||||||
embed.AddField("Changelog:", package.Notes.Content);
|
|
||||||
break;
|
|
||||||
case object _ when package.Notes.ContentType == UpdateNotesContentType.PlainText:
|
|
||||||
case object _ when package.Notes.ContentType == UpdateNotesContentType.Markdown:
|
|
||||||
embed.AddField("Changelog:", Markdig.Markdown.ToPlainText(package.Notes.Content));
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Author
|
|
||||||
// ...
|
|
||||||
|
|
||||||
return embed.Build();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,34 +1,30 @@
|
|||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace Pilz.Updating.Administration.Discord
|
namespace Pilz.Updating.Administration.Discord;
|
||||||
|
|
||||||
|
public class DiscordBotConfig
|
||||||
{
|
{
|
||||||
public class DiscordBotConfig
|
public string DiscordBotToken { get; set; } = string.Empty;
|
||||||
|
public string DefaultAppName { get; set; } = string.Empty;
|
||||||
|
public string UpdateNotificationRoll { get; set; } = string.Empty;
|
||||||
|
public bool UseProxy { get; set; } = true;
|
||||||
|
public Dictionary<Channels, string> DefaultUpdateMessages { get; } = new()
|
||||||
{
|
{
|
||||||
public string DiscordBotToken { get; set; } = string.Empty;
|
{ Channels.Stable, null },
|
||||||
public string DefaultAppName { get; set; } = string.Empty;
|
{ Channels.PreRelease, null },
|
||||||
public string UpdateNotificationRoll { get; set; } = string.Empty;
|
{ Channels.Beta, null },
|
||||||
public bool UseProxy { get; set; } = true;
|
{ Channels.Alpha, null }
|
||||||
public Dictionary<Channels, string> DefaultUpdateMessages { get; } = new()
|
};
|
||||||
{
|
|
||||||
{ Channels.Stable, null },
|
|
||||||
{ Channels.PreRelease, null },
|
|
||||||
{ Channels.Beta, null },
|
|
||||||
{ Channels.Alpha, null }
|
|
||||||
};
|
|
||||||
|
|
||||||
[JsonProperty, Obsolete]
|
[JsonProperty, Obsolete]
|
||||||
private string DefaultUpdateMessage
|
private string DefaultUpdateMessage
|
||||||
|
{
|
||||||
|
set
|
||||||
{
|
{
|
||||||
set
|
foreach (var keys in DefaultUpdateMessages.Keys)
|
||||||
{
|
DefaultUpdateMessages[keys] = value;
|
||||||
foreach (var keys in DefaultUpdateMessages.Keys)
|
|
||||||
DefaultUpdateMessages[keys] = value;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,107 +1,106 @@
|
|||||||
using System.Collections.Generic;
|
using global::Newtonsoft.Json.Linq;
|
||||||
using global::System.IO;
|
using global::System.IO;
|
||||||
using global::System.Reflection;
|
using global::System.Reflection;
|
||||||
using Microsoft.VisualBasic.CompilerServices;
|
using Microsoft.VisualBasic.CompilerServices;
|
||||||
using global::Newtonsoft.Json.Linq;
|
|
||||||
using Z.Collections.Extensions;
|
|
||||||
using Pilz.Updating.UpdateInstaller;
|
using Pilz.Updating.UpdateInstaller;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using Z.Collections.Extensions;
|
||||||
|
|
||||||
namespace Pilz.Updating.Administration.Packaging
|
namespace Pilz.Updating.Administration.Packaging;
|
||||||
|
|
||||||
|
internal class UpdatePackageManager
|
||||||
{
|
{
|
||||||
internal class UpdatePackageManager
|
|
||||||
|
// F i e l d s
|
||||||
|
|
||||||
|
private UpdatePackageTemplate template;
|
||||||
|
|
||||||
|
// P r o p e r t i e s
|
||||||
|
|
||||||
|
public string FilesToCopyPath
|
||||||
{
|
{
|
||||||
|
get
|
||||||
// F i e l d s
|
|
||||||
|
|
||||||
private UpdatePackageTemplate template;
|
|
||||||
|
|
||||||
// P r o p e r t i e s
|
|
||||||
|
|
||||||
public string FilesToCopyPath
|
|
||||||
{
|
{
|
||||||
get
|
return template.FilesToCopyPath;
|
||||||
{
|
|
||||||
return template.FilesToCopyPath;
|
|
||||||
}
|
|
||||||
|
|
||||||
set
|
|
||||||
{
|
|
||||||
template.FilesToCopyPath = value;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// C o n s t r u c o t r s
|
set
|
||||||
|
|
||||||
public UpdatePackageManager()
|
|
||||||
{
|
{
|
||||||
NewTemplate();
|
template.FilesToCopyPath = value;
|
||||||
}
|
|
||||||
|
|
||||||
// F e a t u r e s
|
|
||||||
|
|
||||||
public void LoadTemplate(string filePath)
|
|
||||||
{
|
|
||||||
template = JObject.Parse(File.ReadAllText(filePath)).ToObject<UpdatePackageTemplate>();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void SaveTemplate(string filePath)
|
|
||||||
{
|
|
||||||
File.WriteAllText(filePath, JObject.FromObject(template).ToString());
|
|
||||||
}
|
|
||||||
|
|
||||||
public void NewTemplate()
|
|
||||||
{
|
|
||||||
template = new UpdatePackageTemplate();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void ExportPackage(string path)
|
|
||||||
{
|
|
||||||
var exporter = new UpdatePackagePackager(template);
|
|
||||||
exporter.Export(path);
|
|
||||||
}
|
|
||||||
|
|
||||||
private bool CheckUpdateInstallerAddOn(string path)
|
|
||||||
{
|
|
||||||
var asm = Assembly.ReflectionOnlyLoadFrom(path);
|
|
||||||
var t = asm.GetType($"{UpdateInstallerAddOnNameDefinitions.UPDATE_INSTALLER_ADDON_NAMESPACE}.{UpdateInstallerAddOnNameDefinitions.UPDATE_INSTALLER_ADDON_TYPE}", false);
|
|
||||||
bool isSupported = false;
|
|
||||||
if (t is object)
|
|
||||||
{
|
|
||||||
var mi = t.GetMethod(UpdateInstallerAddOnNameDefinitions.UPDATE_INSTALLER_ADDON_METHOD, BindingFlags.Static | BindingFlags.Public);
|
|
||||||
if (mi is object)
|
|
||||||
{
|
|
||||||
var @params = mi.GetParameters();
|
|
||||||
if (@params.Length == 1 && @params.GetType() == typeof(Dictionary<string, object>))
|
|
||||||
{
|
|
||||||
isSupported = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return isSupported;
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool AddUpdateInstallerAddOn(string path)
|
|
||||||
{
|
|
||||||
if (Conversions.ToBoolean(!template.UpdateInstallerAddOns.Contains(path) && CheckUpdateInstallerAddOn(path)))
|
|
||||||
{
|
|
||||||
template.UpdateInstallerAddOns.Add(path);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public IEnumerable<string> GetAllUpdateInstallerÁddOn()
|
|
||||||
{
|
|
||||||
return template.UpdateInstallerAddOns;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void RemoveUpdateInstallerAddOn(string path)
|
|
||||||
{
|
|
||||||
template.UpdateInstallerAddOns.RemoveIfContains(path);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// C o n s t r u c o t r s
|
||||||
|
|
||||||
|
public UpdatePackageManager()
|
||||||
|
{
|
||||||
|
NewTemplate();
|
||||||
|
}
|
||||||
|
|
||||||
|
// F e a t u r e s
|
||||||
|
|
||||||
|
public void LoadTemplate(string filePath)
|
||||||
|
{
|
||||||
|
template = JObject.Parse(File.ReadAllText(filePath)).ToObject<UpdatePackageTemplate>();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SaveTemplate(string filePath)
|
||||||
|
{
|
||||||
|
File.WriteAllText(filePath, JObject.FromObject(template).ToString());
|
||||||
|
}
|
||||||
|
|
||||||
|
public void NewTemplate()
|
||||||
|
{
|
||||||
|
template = new UpdatePackageTemplate();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void ExportPackage(string path)
|
||||||
|
{
|
||||||
|
var exporter = new UpdatePackagePackager(template);
|
||||||
|
exporter.Export(path);
|
||||||
|
}
|
||||||
|
|
||||||
|
private bool CheckUpdateInstallerAddOn(string path)
|
||||||
|
{
|
||||||
|
var asm = Assembly.ReflectionOnlyLoadFrom(path);
|
||||||
|
var t = asm.GetType($"{UpdateInstallerAddOnNameDefinitions.UPDATE_INSTALLER_ADDON_NAMESPACE}.{UpdateInstallerAddOnNameDefinitions.UPDATE_INSTALLER_ADDON_TYPE}", false);
|
||||||
|
bool isSupported = false;
|
||||||
|
if (t is object)
|
||||||
|
{
|
||||||
|
var mi = t.GetMethod(UpdateInstallerAddOnNameDefinitions.UPDATE_INSTALLER_ADDON_METHOD, BindingFlags.Static | BindingFlags.Public);
|
||||||
|
if (mi is object)
|
||||||
|
{
|
||||||
|
var @params = mi.GetParameters();
|
||||||
|
if (@params.Length == 1 && @params.GetType() == typeof(Dictionary<string, object>))
|
||||||
|
{
|
||||||
|
isSupported = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return isSupported;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool AddUpdateInstallerAddOn(string path)
|
||||||
|
{
|
||||||
|
if (Conversions.ToBoolean(!template.UpdateInstallerAddOns.Contains(path) && CheckUpdateInstallerAddOn(path)))
|
||||||
|
{
|
||||||
|
template.UpdateInstallerAddOns.Add(path);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public IEnumerable<string> GetAllUpdateInstallerÁddOn()
|
||||||
|
{
|
||||||
|
return template.UpdateInstallerAddOns;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void RemoveUpdateInstallerAddOn(string path)
|
||||||
|
{
|
||||||
|
template.UpdateInstallerAddOns.RemoveIfContains(path);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,52 +1,51 @@
|
|||||||
using global::System.IO;
|
using System.IO;
|
||||||
using global::System.IO.Compression;
|
using System.IO.Compression;
|
||||||
using Pilz.Updating.UpdateInstaller;
|
using Pilz.Updating.UpdateInstaller;
|
||||||
using Z.IO.Extensions;
|
using Z.IO.Extensions;
|
||||||
|
|
||||||
namespace Pilz.Updating.Administration.Packaging
|
namespace Pilz.Updating.Administration.Packaging;
|
||||||
|
|
||||||
|
public class UpdatePackagePackager
|
||||||
{
|
{
|
||||||
public class UpdatePackagePackager
|
public UpdatePackageTemplate UpdatePackageTemplate { get; set; }
|
||||||
|
|
||||||
|
public UpdatePackagePackager(UpdatePackageTemplate updatePackageTemplate)
|
||||||
{
|
{
|
||||||
public UpdatePackageTemplate UpdatePackageTemplate { get; set; }
|
UpdatePackageTemplate = updatePackageTemplate;
|
||||||
|
}
|
||||||
|
|
||||||
public UpdatePackagePackager(UpdatePackageTemplate updatePackageTemplate)
|
public void Export(string exportPath)
|
||||||
{
|
{
|
||||||
UpdatePackageTemplate = updatePackageTemplate;
|
string tempPath = MyPaths.GetMyAppDataPath();
|
||||||
}
|
var packageDir = new DirectoryInfo(Path.Combine(tempPath, "UpdatePackageCreation"));
|
||||||
|
|
||||||
public void Export(string exportPath)
|
// Ensure package directory exists and is empty
|
||||||
{
|
if (packageDir.Exists)
|
||||||
string tempPath = MyPaths.GetMyAppDataPath();
|
|
||||||
var packageDir = new DirectoryInfo(Path.Combine(tempPath, "UpdatePackageCreation"));
|
|
||||||
|
|
||||||
// Ensure package directory exists and is empty
|
|
||||||
if (packageDir.Exists)
|
|
||||||
packageDir.Delete(true);
|
|
||||||
packageDir.Create();
|
|
||||||
|
|
||||||
// Copy local data to temp data directory
|
|
||||||
var dataDir = packageDir.CreateSubdirectory(PackageFileNameDefinations.ZIP_APP_DATA_FILES_DIRECTORY);
|
|
||||||
var localDataDir = new DirectoryInfo(UpdatePackageTemplate.FilesToCopyPath);
|
|
||||||
localDataDir.CopyTo(dataDir.FullName, SearchOption.AllDirectories);
|
|
||||||
|
|
||||||
// Copy all UpdateInstaller AddOns
|
|
||||||
var addOnsDir = packageDir.CreateSubdirectory(PackageFileNameDefinations.ZIP_UPDATE_INSTALLER_ADDONS_DIRECTORY);
|
|
||||||
uint curAddOnID = 0;
|
|
||||||
foreach (string fAddOn in UpdatePackageTemplate.UpdateInstallerAddOns)
|
|
||||||
{
|
|
||||||
File.Copy(fAddOn, Path.Combine(addOnsDir.FullName, $"installer_addon_{curAddOnID}.dll"));
|
|
||||||
curAddOnID += 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Ensure destination file doesn't exist
|
|
||||||
if (File.Exists(exportPath))
|
|
||||||
File.Delete(exportPath);
|
|
||||||
|
|
||||||
// Export to ZIP
|
|
||||||
ZipFile.CreateFromDirectory(packageDir.FullName, exportPath);
|
|
||||||
|
|
||||||
// Delete temp directory
|
|
||||||
packageDir.Delete(true);
|
packageDir.Delete(true);
|
||||||
|
packageDir.Create();
|
||||||
|
|
||||||
|
// Copy local data to temp data directory
|
||||||
|
var dataDir = packageDir.CreateSubdirectory(PackageFileNameDefinations.ZIP_APP_DATA_FILES_DIRECTORY);
|
||||||
|
var localDataDir = new DirectoryInfo(UpdatePackageTemplate.FilesToCopyPath);
|
||||||
|
localDataDir.CopyTo(dataDir.FullName, SearchOption.AllDirectories);
|
||||||
|
|
||||||
|
// Copy all UpdateInstaller AddOns
|
||||||
|
var addOnsDir = packageDir.CreateSubdirectory(PackageFileNameDefinations.ZIP_UPDATE_INSTALLER_ADDONS_DIRECTORY);
|
||||||
|
uint curAddOnID = 0;
|
||||||
|
foreach (string fAddOn in UpdatePackageTemplate.UpdateInstallerAddOns)
|
||||||
|
{
|
||||||
|
File.Copy(fAddOn, Path.Combine(addOnsDir.FullName, $"installer_addon_{curAddOnID}.dll"));
|
||||||
|
curAddOnID += 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Ensure destination file doesn't exist
|
||||||
|
if (File.Exists(exportPath))
|
||||||
|
File.Delete(exportPath);
|
||||||
|
|
||||||
|
// Export to ZIP
|
||||||
|
ZipFile.CreateFromDirectory(packageDir.FullName, exportPath);
|
||||||
|
|
||||||
|
// Delete temp directory
|
||||||
|
packageDir.Delete(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,10 +1,9 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace Pilz.Updating.Administration.Packaging
|
namespace Pilz.Updating.Administration.Packaging;
|
||||||
|
|
||||||
|
public class UpdatePackageTemplate
|
||||||
{
|
{
|
||||||
public class UpdatePackageTemplate
|
public string FilesToCopyPath { get; set; }
|
||||||
{
|
public List<string> UpdateInstallerAddOns { get; set; } = [];
|
||||||
public string FilesToCopyPath { get; set; }
|
|
||||||
public List<string> UpdateInstallerAddOns { get; set; } = new List<string>();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">
|
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<RootNamespace>Pilz.Updating.Administration</RootNamespace>
|
<RootNamespace>Pilz.Updating.Administration</RootNamespace>
|
||||||
<TargetFrameworks>net6.0-windows;net8.0-windows</TargetFrameworks>
|
<TargetFrameworks>net8.0-windows</TargetFrameworks>
|
||||||
<DefaultItemExcludes>$(DefaultItemExcludes);$(ProjectDir)**\*.vb</DefaultItemExcludes>
|
<DefaultItemExcludes>$(DefaultItemExcludes);$(ProjectDir)**\*.vb</DefaultItemExcludes>
|
||||||
<LangVersion>latest</LangVersion>
|
<LangVersion>latest</LangVersion>
|
||||||
<AssemblyTitle>Pilz.Updating.Server</AssemblyTitle>
|
<AssemblyTitle>Pilz.Updating.Server</AssemblyTitle>
|
||||||
@@ -11,7 +11,6 @@
|
|||||||
<DocumentationFile>Pilz.Updating.Administration.xml</DocumentationFile>
|
<DocumentationFile>Pilz.Updating.Administration.xml</DocumentationFile>
|
||||||
<DefineTrace>true</DefineTrace>
|
<DefineTrace>true</DefineTrace>
|
||||||
<NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022,CS1591,CS0660,CS0661,CS0436</NoWarn>
|
<NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022,CS1591,CS0660,CS0661,CS0436</NoWarn>
|
||||||
<UseWindowsForms>true</UseWindowsForms>
|
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||||
<DefineDebug>true</DefineDebug>
|
<DefineDebug>true</DefineDebug>
|
||||||
@@ -37,13 +36,12 @@
|
|||||||
<DefineConstants>TRACE;RelMono</DefineConstants>
|
<DefineConstants>TRACE;RelMono</DefineConstants>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
|
|
||||||
<Version>2.0.0</Version>
|
<Version>2.0.0</Version>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Microsoft.CSharp" Version="4.7.0" />
|
<PackageReference Include="Microsoft.CSharp" Version="4.7.0" />
|
||||||
<PackageReference Include="Microsoft.VisualBasic" Version="10.3.0" />
|
<PackageReference Include="Microsoft.VisualBasic" Version="10.3.0" />
|
||||||
<PackageReference Include="Pilz.Cryptography" Version="2.0.0" />
|
<PackageReference Include="Pilz.Cryptography" Version="2.0.1" />
|
||||||
<PackageReference Include="System.Data.DataSetExtensions" Version="4.5.0" />
|
<PackageReference Include="System.Data.DataSetExtensions" Version="4.5.0" />
|
||||||
<PackageReference Include="System.Net.Http" Version="4.3.4" />
|
<PackageReference Include="System.Net.Http" Version="4.3.4" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
@@ -92,8 +90,8 @@
|
|||||||
<ProjectReference Include="..\Pilz.Updating\Pilz.Updating.csproj" />
|
<ProjectReference Include="..\Pilz.Updating\Pilz.Updating.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Discord.Net" Version="3.13.0" />
|
<PackageReference Include="Discord.Net" Version="3.15.2" />
|
||||||
<PackageReference Include="Markdig" Version="0.33.0" />
|
<PackageReference Include="Markdig" Version="0.37.0" />
|
||||||
<PackageReference Include="Microsoft.Bcl.AsyncInterfaces" Version="8.0.0" />
|
<PackageReference Include="Microsoft.Bcl.AsyncInterfaces" Version="8.0.0" />
|
||||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
||||||
<PackageReference Include="System.Collections.Immutable" Version="8.0.0" />
|
<PackageReference Include="System.Collections.Immutable" Version="8.0.0" />
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
using global::System;
|
using global::System;
|
||||||
using global::System.Reflection;
|
|
||||||
using global::System.Runtime.CompilerServices;
|
using global::System.Runtime.CompilerServices;
|
||||||
using global::System.Runtime.InteropServices;
|
using global::System.Runtime.InteropServices;
|
||||||
[assembly: ComVisible(false)]
|
[assembly: ComVisible(false)]
|
||||||
|
|||||||
@@ -1,18 +1,12 @@
|
|||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using Pilz.Cryptography;
|
using Pilz.Cryptography;
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace Pilz.Updating.Administration
|
namespace Pilz.Updating.Administration;
|
||||||
|
|
||||||
|
public class ProxyConfiguration
|
||||||
{
|
{
|
||||||
public class ProxyConfiguration
|
public bool UseProxyAuth { get; set; }
|
||||||
{
|
public string Username { get; set; }
|
||||||
public bool UseProxyAuth { get; set; }
|
[JsonProperty("PasswordV3")]
|
||||||
public string Username { get; set; }
|
public SecureString Password { get; set; }
|
||||||
[JsonProperty("PasswordV3")]
|
|
||||||
public SecureString Password { get; set; }
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,8 @@
|
|||||||
namespace Pilz.Updating.UpdateInstaller
|
namespace Pilz.Updating.UpdateInstaller;
|
||||||
|
|
||||||
|
public static class PackageFileNameDefinations
|
||||||
{
|
{
|
||||||
public static class PackageFileNameDefinations
|
public const string ZIP_PACKAGE_FILENAME = "updatepackage.zip";
|
||||||
{
|
public const string ZIP_UPDATE_INSTALLER_ADDONS_DIRECTORY = "installer_addons";
|
||||||
public const string ZIP_PACKAGE_FILENAME = "updatepackage.zip";
|
public const string ZIP_APP_DATA_FILES_DIRECTORY = "appdata";
|
||||||
public const string ZIP_UPDATE_INSTALLER_ADDONS_DIRECTORY = "installer_addons";
|
|
||||||
public const string ZIP_APP_DATA_FILES_DIRECTORY = "appdata";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -1,9 +1,8 @@
|
|||||||
namespace Pilz.Updating.UpdateInstaller
|
namespace Pilz.Updating.UpdateInstaller;
|
||||||
|
|
||||||
|
public static partial class UpdateInstallerAddOnNameDefinitions
|
||||||
{
|
{
|
||||||
public static partial class UpdateInstallerAddOnNameDefinitions
|
public const string UPDATE_INSTALLER_ADDON_NAMESPACE = "UpdateInstaller";
|
||||||
{
|
public const string UPDATE_INSTALLER_ADDON_TYPE = "AddOn";
|
||||||
public const string UPDATE_INSTALLER_ADDON_NAMESPACE = "UpdateInstaller";
|
public const string UPDATE_INSTALLER_ADDON_METHOD = "Main";
|
||||||
public const string UPDATE_INSTALLER_ADDON_TYPE = "AddOn";
|
|
||||||
public const string UPDATE_INSTALLER_ADDON_METHOD = "Main";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -1,31 +1,25 @@
|
|||||||
using Newtonsoft.Json.Linq;
|
using Newtonsoft.Json.Linq;
|
||||||
using Pilz.Updating.Administration.Discord;
|
using Pilz.Updating.Administration.Discord;
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace Pilz.Updating.Administration
|
namespace Pilz.Updating.Administration;
|
||||||
|
|
||||||
|
public class UpdateProject
|
||||||
{
|
{
|
||||||
public class UpdateProject
|
public UpdateServerConfig UpdateServerConfig { get; } = new UpdateServerConfig();
|
||||||
|
public DiscordBotConfig DiscordBotConfig { get; } = new DiscordBotConfig();
|
||||||
|
public ProxyConfiguration ProxyConfig { get; } = new ProxyConfiguration();
|
||||||
|
|
||||||
|
public static UpdateProject Load(string filePath)
|
||||||
{
|
{
|
||||||
public UpdateServerConfig UpdateServerConfig { get; } = new UpdateServerConfig();
|
if (File.Exists(filePath))
|
||||||
public DiscordBotConfig DiscordBotConfig { get; } = new DiscordBotConfig();
|
return JObject.Parse(File.ReadAllText(filePath)).ToObject<UpdateProject>();
|
||||||
public ProxyConfiguration ProxyConfig { get; } = new ProxyConfiguration();
|
else
|
||||||
|
return new UpdateProject();
|
||||||
|
}
|
||||||
|
|
||||||
public static UpdateProject Load(string filePath)
|
public void Save(string filePath)
|
||||||
{
|
{
|
||||||
if (File.Exists(filePath))
|
File.WriteAllText(filePath, JObject.FromObject(this).ToString());
|
||||||
return JObject.Parse(File.ReadAllText(filePath)).ToObject<UpdateProject>();
|
|
||||||
else
|
|
||||||
return new UpdateProject();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Save(string filePath)
|
|
||||||
{
|
|
||||||
File.WriteAllText(filePath, JObject.FromObject(this).ToString());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,22 +1,16 @@
|
|||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using Pilz.Cryptography;
|
using Pilz.Cryptography;
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace Pilz.Updating.Administration
|
namespace Pilz.Updating.Administration;
|
||||||
|
|
||||||
|
public class UpdateServerConfig
|
||||||
{
|
{
|
||||||
public class UpdateServerConfig
|
public bool UseProxyForWebDAV { get; set; } = false;
|
||||||
{
|
public string ServerAdress { get; set; }
|
||||||
public bool UseProxyForWebDAV { get; set; } = false;
|
public string PublicPackageBaseURL { get; set; }
|
||||||
public string ServerAdress { get; set; }
|
public string UpdateInfoFilename { get; set; }
|
||||||
public string PublicPackageBaseURL { get; set; }
|
public string Username { get; set; }
|
||||||
public string UpdateInfoFilename { get; set; }
|
|
||||||
public string Username { get; set; }
|
|
||||||
|
|
||||||
[JsonProperty("PasswordV3")]
|
[JsonProperty("PasswordV3")]
|
||||||
public SecureString Password { get; set; }
|
public SecureString Password { get; set; }
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,134 +1,99 @@
|
|||||||
using global::System.IO;
|
using Microsoft.VisualBasic;
|
||||||
using global::Newtonsoft.Json.Linq;
|
using Newtonsoft.Json.Linq;
|
||||||
using WebDav;
|
|
||||||
using System.Net;
|
|
||||||
using System;
|
using System;
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Net;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using WebDav;
|
||||||
using static Microsoft.VisualBasic.CompilerServices.LikeOperator;
|
using static Microsoft.VisualBasic.CompilerServices.LikeOperator;
|
||||||
using Microsoft.VisualBasic;
|
|
||||||
|
|
||||||
namespace Pilz.Updating.Administration
|
namespace Pilz.Updating.Administration;
|
||||||
|
|
||||||
|
public class UpdateServerManager
|
||||||
{
|
{
|
||||||
public class UpdateServerManager
|
private const string PKG_SEARCHTEXT = "pkg*.*.*.*.zip";
|
||||||
|
private const string PKG_FILENAME_TEMPLATE = "pkg{0}{1}.zip";
|
||||||
|
private const string PKG_FILENAME_ALPHADEFINITION = "a";
|
||||||
|
private const string PKG_FILENAME_BETADEFINITION = "b";
|
||||||
|
private const string PKG_FILENAME_RCDEFINITION = "rc";
|
||||||
|
private const string PKG_FILENAME_RELEASEDEFINITION = "r";
|
||||||
|
|
||||||
|
private WebDavClient client;
|
||||||
|
public UpdateInfo UpdateInfo { get; private set; }
|
||||||
|
public UpdateServerConfig Config { get; private set; }
|
||||||
|
public bool IsReady { get; private set; }
|
||||||
|
|
||||||
|
public UpdateServerManager(UpdateServerConfig config)
|
||||||
{
|
{
|
||||||
private const string PKG_SEARCHTEXT = "pkg*.*.*.*.zip";
|
GenerateClient(config);
|
||||||
private const string PKG_FILENAME_TEMPLATE = "pkg{0}{1}.zip";
|
NewInfo();
|
||||||
private const string PKG_FILENAME_ALPHADEFINITION = "a";
|
}
|
||||||
private const string PKG_FILENAME_BETADEFINITION = "b";
|
|
||||||
private const string PKG_FILENAME_RCDEFINITION = "rc";
|
|
||||||
private const string PKG_FILENAME_RELEASEDEFINITION = "r";
|
|
||||||
|
|
||||||
private WebDavClient client;
|
public bool GenerateClient(UpdateServerConfig config)
|
||||||
public UpdateInfo UpdateInfo { get; private set; }
|
{
|
||||||
public UpdateServerConfig Config { get; private set; }
|
bool success;
|
||||||
public bool IsReady { get; private set; }
|
|
||||||
|
|
||||||
public UpdateServerManager(UpdateServerConfig config)
|
try
|
||||||
{
|
{
|
||||||
GenerateClient(config);
|
// Create client params
|
||||||
NewInfo();
|
var clientparams = new WebDavClientParams()
|
||||||
|
{
|
||||||
|
BaseAddress = new Uri(config.ServerAdress),
|
||||||
|
Credentials = new NetworkCredential(config.Username, config.Password),
|
||||||
|
UseProxy = false
|
||||||
|
};
|
||||||
|
|
||||||
|
// Create client
|
||||||
|
client = new WebDavClient(clientparams);
|
||||||
|
|
||||||
|
// Remember config
|
||||||
|
Config = config;
|
||||||
|
|
||||||
|
success = true;
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
success = false;
|
||||||
|
Config = null;
|
||||||
|
client = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool GenerateClient(UpdateServerConfig config)
|
return success;
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<bool> LoadInfoFromServer()
|
||||||
|
{
|
||||||
|
bool success;
|
||||||
|
|
||||||
|
try
|
||||||
{
|
{
|
||||||
bool success;
|
var response = await client.GetProcessedFile(Config.UpdateInfoFilename);
|
||||||
|
|
||||||
try
|
if (response.IsSuccessful)
|
||||||
{
|
{
|
||||||
// Create client params
|
var sr = new StreamReader(response.Stream);
|
||||||
var clientparams = new WebDavClientParams()
|
var raw = await sr.ReadToEndAsync();
|
||||||
{
|
sr.Close();
|
||||||
BaseAddress = new Uri(config.ServerAdress),
|
UpdateInfo = JObject.Parse(raw).ToObject<UpdateInfo>();
|
||||||
Credentials = new NetworkCredential(config.Username, config.Password),
|
|
||||||
UseProxy = false
|
|
||||||
};
|
|
||||||
|
|
||||||
// Create client
|
|
||||||
client = new WebDavClient(clientparams);
|
|
||||||
|
|
||||||
// Remember config
|
|
||||||
Config = config;
|
|
||||||
|
|
||||||
success = true;
|
|
||||||
}
|
|
||||||
catch (Exception)
|
|
||||||
{
|
|
||||||
success = false;
|
|
||||||
Config = null;
|
|
||||||
client = null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return success;
|
success = true;
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
success = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<bool> LoadInfoFromServer()
|
return success;
|
||||||
{
|
}
|
||||||
bool success;
|
|
||||||
|
|
||||||
try
|
public async Task<bool> SaveInfoToServer()
|
||||||
{
|
{
|
||||||
var response = await client.GetProcessedFile(Config.UpdateInfoFilename);
|
bool success;
|
||||||
|
|
||||||
if (response.IsSuccessful)
|
try
|
||||||
{
|
|
||||||
var sr = new StreamReader(response.Stream);
|
|
||||||
var raw = await sr.ReadToEndAsync();
|
|
||||||
sr.Close();
|
|
||||||
UpdateInfo = JObject.Parse(raw).ToObject<UpdateInfo>();
|
|
||||||
}
|
|
||||||
|
|
||||||
success = true;
|
|
||||||
}
|
|
||||||
catch (Exception)
|
|
||||||
{
|
|
||||||
success = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return success;
|
|
||||||
}
|
|
||||||
|
|
||||||
public async Task<bool> SaveInfoToServer()
|
|
||||||
{
|
|
||||||
bool success;
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
// Remove configs of non-existing packages
|
|
||||||
await ClearUpdateInfo();
|
|
||||||
|
|
||||||
// Update Packagelinks
|
|
||||||
UpdatePackageLinks();
|
|
||||||
|
|
||||||
// Write
|
|
||||||
var raw = UpdateInfo.ToString();
|
|
||||||
var ms = new MemoryStream();
|
|
||||||
var sw = new StreamWriter(ms);
|
|
||||||
await sw.WriteAsync(raw);
|
|
||||||
await sw.FlushAsync();
|
|
||||||
|
|
||||||
// Upload
|
|
||||||
ms.Position = 0;
|
|
||||||
await client.PutFile(Config.UpdateInfoFilename, ms);
|
|
||||||
|
|
||||||
ms.Close();
|
|
||||||
success = true;
|
|
||||||
}
|
|
||||||
catch (Exception)
|
|
||||||
{
|
|
||||||
success = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return success;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void LoadInfoFromFile(string filePath)
|
|
||||||
{
|
|
||||||
UpdateInfo = JObject.Parse(File.ReadAllText(filePath)).ToObject<UpdateInfo>();
|
|
||||||
}
|
|
||||||
|
|
||||||
public async Task SaveInfoToFile(string filePath)
|
|
||||||
{
|
{
|
||||||
// Remove configs of non-existing packages
|
// Remove configs of non-existing packages
|
||||||
await ClearUpdateInfo();
|
await ClearUpdateInfo();
|
||||||
@@ -137,269 +102,302 @@ namespace Pilz.Updating.Administration
|
|||||||
UpdatePackageLinks();
|
UpdatePackageLinks();
|
||||||
|
|
||||||
// Write
|
// Write
|
||||||
File.WriteAllText(filePath, UpdateInfo.ToString());
|
var raw = UpdateInfo.ToString();
|
||||||
}
|
var ms = new MemoryStream();
|
||||||
|
var sw = new StreamWriter(ms);
|
||||||
public void NewInfo()
|
await sw.WriteAsync(raw);
|
||||||
{
|
await sw.FlushAsync();
|
||||||
UpdateInfo = new UpdateInfo();
|
|
||||||
}
|
|
||||||
|
|
||||||
private async Task ClearUpdateInfo()
|
|
||||||
{
|
|
||||||
var pkgs = await GetUpdatePackagesList();
|
|
||||||
var infosToRemove = new List<UpdatePackageInfo>();
|
|
||||||
|
|
||||||
// Find non-existing packages
|
|
||||||
foreach (var info in UpdateInfo.Packages)
|
|
||||||
{
|
|
||||||
if (!pkgs.Where((n) => n == info.Version).Any())
|
|
||||||
{
|
|
||||||
infosToRemove.Add(info);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Remove found packages
|
|
||||||
foreach (var info in infosToRemove)
|
|
||||||
UpdateInfo.Packages.Remove(info);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void UpdatePackageLinks()
|
|
||||||
{
|
|
||||||
foreach (var info in UpdateInfo.Packages)
|
|
||||||
UpdatePackageLink(info);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void UpdatePackageLink(UpdatePackageInfo info)
|
|
||||||
{
|
|
||||||
info.Packagelink = Config.PublicPackageBaseURL + BuildPackageFilename(info.Version);
|
|
||||||
}
|
|
||||||
|
|
||||||
public async Task<IEnumerable<ApplicationVersion>> GetUpdatePackagesList()
|
|
||||||
{
|
|
||||||
var pkgs = new List<ApplicationVersion>();
|
|
||||||
var response = await client.Propfind(string.Empty);
|
|
||||||
|
|
||||||
if (response.IsSuccessful)
|
|
||||||
{
|
|
||||||
foreach (var resource in response.Resources)
|
|
||||||
{
|
|
||||||
var fileName = Path.GetFileName(resource.Uri);
|
|
||||||
if (!string.IsNullOrEmpty(fileName) && fileName.ToLower() != Config.UpdateInfoFilename && LikeString(fileName, "pkg*.*.*.*.zip", CompareMethod.Text))
|
|
||||||
{
|
|
||||||
var appVersion = new ApplicationVersion();
|
|
||||||
bool allowAdd = true;
|
|
||||||
|
|
||||||
fileName = Path.GetFileNameWithoutExtension(fileName);
|
|
||||||
fileName = fileName.Substring(3);
|
|
||||||
|
|
||||||
// Get alpha/beta/rc value
|
|
||||||
{
|
|
||||||
int indexAlpha, indexBeta, indexRC, indexRelease;
|
|
||||||
indexAlpha = fileName.IndexOf(PKG_FILENAME_ALPHADEFINITION);
|
|
||||||
indexBeta = fileName.IndexOf(PKG_FILENAME_BETADEFINITION);
|
|
||||||
indexRC = fileName.IndexOf(PKG_FILENAME_RCDEFINITION);
|
|
||||||
indexRelease = fileName.IndexOf(PKG_FILENAME_RELEASEDEFINITION);
|
|
||||||
|
|
||||||
int indexDef;
|
|
||||||
string pkgFilenameDef;
|
|
||||||
if (indexAlpha > -1)
|
|
||||||
{
|
|
||||||
indexDef = indexAlpha;
|
|
||||||
pkgFilenameDef = PKG_FILENAME_ALPHADEFINITION;
|
|
||||||
}
|
|
||||||
else if (indexBeta > -1)
|
|
||||||
{
|
|
||||||
indexDef = indexBeta;
|
|
||||||
pkgFilenameDef = PKG_FILENAME_BETADEFINITION;
|
|
||||||
}
|
|
||||||
else if (indexRC > -1)
|
|
||||||
{
|
|
||||||
indexDef = indexRC;
|
|
||||||
pkgFilenameDef = PKG_FILENAME_RCDEFINITION;
|
|
||||||
}
|
|
||||||
else if (indexRelease > -1)
|
|
||||||
{
|
|
||||||
indexDef = indexRelease;
|
|
||||||
pkgFilenameDef = PKG_FILENAME_RELEASEDEFINITION;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
indexDef = -1;
|
|
||||||
pkgFilenameDef = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (indexDef > -1)
|
|
||||||
{
|
|
||||||
// Get def from filename
|
|
||||||
var def = fileName.Substring(indexDef);
|
|
||||||
fileName = fileName.Remove(indexDef);
|
|
||||||
|
|
||||||
// Get channel
|
|
||||||
switch (pkgFilenameDef)
|
|
||||||
{
|
|
||||||
case PKG_FILENAME_ALPHADEFINITION:
|
|
||||||
appVersion.Channel = Channels.Alpha;
|
|
||||||
break;
|
|
||||||
case PKG_FILENAME_BETADEFINITION:
|
|
||||||
appVersion.Channel = Channels.Beta;
|
|
||||||
break;
|
|
||||||
case PKG_FILENAME_RCDEFINITION:
|
|
||||||
appVersion.Channel = Channels.PreRelease;
|
|
||||||
break;
|
|
||||||
case PKG_FILENAME_RELEASEDEFINITION:
|
|
||||||
appVersion.Channel = Channels.Stable;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get build
|
|
||||||
var defBuild = def.Substring(pkgFilenameDef.Length);
|
|
||||||
appVersion.Build = Convert.ToInt32(defBuild);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// Set to default
|
|
||||||
appVersion.Build = 1;
|
|
||||||
appVersion.Channel = Channels.Stable;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get version
|
|
||||||
if (Version.TryParse(fileName, out Version version))
|
|
||||||
appVersion.Version = version;
|
|
||||||
else
|
|
||||||
allowAdd = false;
|
|
||||||
|
|
||||||
if (allowAdd)
|
|
||||||
pkgs.Add(appVersion);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return pkgs;
|
|
||||||
}
|
|
||||||
|
|
||||||
public async Task<bool> DeletePackage(ApplicationVersion version)
|
|
||||||
{
|
|
||||||
var fileName = BuildPackageFilename(version);
|
|
||||||
var response = await client.Delete(fileName);
|
|
||||||
return response.IsSuccessful;
|
|
||||||
}
|
|
||||||
|
|
||||||
public async Task<bool> UploadPackage(string filePath, ApplicationVersion version)
|
|
||||||
{
|
|
||||||
bool success;
|
|
||||||
var fileName = BuildPackageFilename(version);
|
|
||||||
|
|
||||||
// Upload
|
// Upload
|
||||||
var fs = new FileStream(filePath, FileMode.Open, FileAccess.Read);
|
ms.Position = 0;
|
||||||
var response = await client.PutFile(fileName, fs);
|
await client.PutFile(Config.UpdateInfoFilename, ms);
|
||||||
fs.Close();
|
|
||||||
success = response.IsSuccessful;
|
|
||||||
|
|
||||||
// Generate public downloadlink
|
ms.Close();
|
||||||
if (success)
|
success = true;
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
success = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return success;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void LoadInfoFromFile(string filePath)
|
||||||
|
{
|
||||||
|
UpdateInfo = JObject.Parse(File.ReadAllText(filePath)).ToObject<UpdateInfo>();
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task SaveInfoToFile(string filePath)
|
||||||
|
{
|
||||||
|
// Remove configs of non-existing packages
|
||||||
|
await ClearUpdateInfo();
|
||||||
|
|
||||||
|
// Update Packagelinks
|
||||||
|
UpdatePackageLinks();
|
||||||
|
|
||||||
|
// Write
|
||||||
|
File.WriteAllText(filePath, UpdateInfo.ToString());
|
||||||
|
}
|
||||||
|
|
||||||
|
public void NewInfo()
|
||||||
|
{
|
||||||
|
UpdateInfo = new UpdateInfo();
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task ClearUpdateInfo()
|
||||||
|
{
|
||||||
|
var pkgs = await GetUpdatePackagesList();
|
||||||
|
var infosToRemove = new List<UpdatePackageInfo>();
|
||||||
|
|
||||||
|
// Find non-existing packages
|
||||||
|
foreach (var info in UpdateInfo.Packages)
|
||||||
|
{
|
||||||
|
if (!pkgs.Where((n) => n == info.Version).Any())
|
||||||
{
|
{
|
||||||
var pkgInfo = GetOrCreateUpdatePackageInfo(version);
|
infosToRemove.Add(info);
|
||||||
pkgInfo.Packagelink = Config.PublicPackageBaseURL + fileName;
|
|
||||||
}
|
|
||||||
|
|
||||||
return success;
|
|
||||||
}
|
|
||||||
|
|
||||||
private string BuildPackageFilename(ApplicationVersion version)
|
|
||||||
{
|
|
||||||
// Build channel/build definition of filename
|
|
||||||
string def = string.Empty;
|
|
||||||
switch (version.Channel)
|
|
||||||
{
|
|
||||||
case Channels.Alpha:
|
|
||||||
def = PKG_FILENAME_ALPHADEFINITION + version.Build;
|
|
||||||
break;
|
|
||||||
case Channels.Stable:
|
|
||||||
if (version.Build != 1)
|
|
||||||
def = PKG_FILENAME_RELEASEDEFINITION + version.Build;
|
|
||||||
break;
|
|
||||||
case Channels.PreRelease:
|
|
||||||
def = PKG_FILENAME_RCDEFINITION + version.Build;
|
|
||||||
break;
|
|
||||||
case Channels.Beta:
|
|
||||||
def = PKG_FILENAME_BETADEFINITION + version.Build;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Build filename
|
|
||||||
var fileName = string.Format(PKG_FILENAME_TEMPLATE, version.Version, def);
|
|
||||||
|
|
||||||
return fileName;
|
|
||||||
}
|
|
||||||
|
|
||||||
private UpdatePackageInfo GetOrCreateUpdatePackageInfo(ApplicationVersion version)
|
|
||||||
{
|
|
||||||
var info = GetUpdatePackageInfo(version);
|
|
||||||
|
|
||||||
if (info == null)
|
|
||||||
info = CreateUpdatePackageInfo(version);
|
|
||||||
|
|
||||||
return info;
|
|
||||||
}
|
|
||||||
|
|
||||||
public UpdatePackageInfo GetUpdatePackageInfo(ApplicationVersion version)
|
|
||||||
{
|
|
||||||
return UpdateInfo.Packages.FirstOrDefault((n) => n.Version == version);
|
|
||||||
}
|
|
||||||
|
|
||||||
private UpdatePackageInfo CreateUpdatePackageInfo(ApplicationVersion version)
|
|
||||||
{
|
|
||||||
var info = new UpdatePackageInfo()
|
|
||||||
{
|
|
||||||
Version = version
|
|
||||||
};
|
|
||||||
UpdateInfo.Packages.Add(info);
|
|
||||||
return info;
|
|
||||||
}
|
|
||||||
|
|
||||||
public (string name, string description, UpdateNotesContentType descriptionType) GetPackageDescription(ApplicationVersion version)
|
|
||||||
{
|
|
||||||
var pkg = GetUpdatePackageInfo(version);
|
|
||||||
if (pkg is object)
|
|
||||||
return (pkg.Name, pkg.Notes.Content, pkg.Notes.ContentType);
|
|
||||||
else
|
|
||||||
return default;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void SetPackageDescription(ApplicationVersion version, string name, string description, UpdateNotesContentType descriptionType)
|
|
||||||
{
|
|
||||||
var pkg = GetOrCreateUpdatePackageInfo(version);
|
|
||||||
if (pkg is object)
|
|
||||||
{
|
|
||||||
pkg.Name = name;
|
|
||||||
pkg.Notes.Content = description;
|
|
||||||
pkg.Notes.ContentType = descriptionType;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<bool> ChangePackageVersion(ApplicationVersion currentVersion, ApplicationVersion newVersion)
|
// Remove found packages
|
||||||
|
foreach (var info in infosToRemove)
|
||||||
|
UpdateInfo.Packages.Remove(info);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void UpdatePackageLinks()
|
||||||
|
{
|
||||||
|
foreach (var info in UpdateInfo.Packages)
|
||||||
|
UpdatePackageLink(info);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void UpdatePackageLink(UpdatePackageInfo info)
|
||||||
|
{
|
||||||
|
info.Packagelink = Config.PublicPackageBaseURL + BuildPackageFilename(info.Version);
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<IEnumerable<ApplicationVersion>> GetUpdatePackagesList()
|
||||||
|
{
|
||||||
|
var pkgs = new List<ApplicationVersion>();
|
||||||
|
var response = await client.Propfind(string.Empty);
|
||||||
|
|
||||||
|
if (response.IsSuccessful)
|
||||||
{
|
{
|
||||||
bool success = false;
|
foreach (var resource in response.Resources)
|
||||||
|
|
||||||
// Get file names
|
|
||||||
var currentFilename = BuildPackageFilename(currentVersion);
|
|
||||||
var newFilename = BuildPackageFilename(newVersion);
|
|
||||||
|
|
||||||
// Move
|
|
||||||
var response = await client.Move(currentFilename, newFilename);
|
|
||||||
|
|
||||||
// Change package info version, if exists
|
|
||||||
if (response.IsSuccessful)
|
|
||||||
{
|
{
|
||||||
var pkg = GetUpdatePackageInfo(currentVersion);
|
var fileName = Path.GetFileName(resource.Uri);
|
||||||
if (pkg is object)
|
if (!string.IsNullOrEmpty(fileName) && fileName.ToLower() != Config.UpdateInfoFilename && LikeString(fileName, "pkg*.*.*.*.zip", CompareMethod.Text))
|
||||||
pkg.Version = newVersion;
|
{
|
||||||
success = true;
|
var appVersion = new ApplicationVersion();
|
||||||
}
|
bool allowAdd = true;
|
||||||
|
|
||||||
return success;
|
fileName = Path.GetFileNameWithoutExtension(fileName);
|
||||||
|
fileName = fileName.Substring(3);
|
||||||
|
|
||||||
|
// Get alpha/beta/rc value
|
||||||
|
{
|
||||||
|
int indexAlpha, indexBeta, indexRC, indexRelease;
|
||||||
|
indexAlpha = fileName.IndexOf(PKG_FILENAME_ALPHADEFINITION);
|
||||||
|
indexBeta = fileName.IndexOf(PKG_FILENAME_BETADEFINITION);
|
||||||
|
indexRC = fileName.IndexOf(PKG_FILENAME_RCDEFINITION);
|
||||||
|
indexRelease = fileName.IndexOf(PKG_FILENAME_RELEASEDEFINITION);
|
||||||
|
|
||||||
|
int indexDef;
|
||||||
|
string pkgFilenameDef;
|
||||||
|
if (indexAlpha > -1)
|
||||||
|
{
|
||||||
|
indexDef = indexAlpha;
|
||||||
|
pkgFilenameDef = PKG_FILENAME_ALPHADEFINITION;
|
||||||
|
}
|
||||||
|
else if (indexBeta > -1)
|
||||||
|
{
|
||||||
|
indexDef = indexBeta;
|
||||||
|
pkgFilenameDef = PKG_FILENAME_BETADEFINITION;
|
||||||
|
}
|
||||||
|
else if (indexRC > -1)
|
||||||
|
{
|
||||||
|
indexDef = indexRC;
|
||||||
|
pkgFilenameDef = PKG_FILENAME_RCDEFINITION;
|
||||||
|
}
|
||||||
|
else if (indexRelease > -1)
|
||||||
|
{
|
||||||
|
indexDef = indexRelease;
|
||||||
|
pkgFilenameDef = PKG_FILENAME_RELEASEDEFINITION;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
indexDef = -1;
|
||||||
|
pkgFilenameDef = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (indexDef > -1)
|
||||||
|
{
|
||||||
|
// Get def from filename
|
||||||
|
var def = fileName.Substring(indexDef);
|
||||||
|
fileName = fileName.Remove(indexDef);
|
||||||
|
|
||||||
|
// Get channel
|
||||||
|
switch (pkgFilenameDef)
|
||||||
|
{
|
||||||
|
case PKG_FILENAME_ALPHADEFINITION:
|
||||||
|
appVersion.Channel = Channels.Alpha;
|
||||||
|
break;
|
||||||
|
case PKG_FILENAME_BETADEFINITION:
|
||||||
|
appVersion.Channel = Channels.Beta;
|
||||||
|
break;
|
||||||
|
case PKG_FILENAME_RCDEFINITION:
|
||||||
|
appVersion.Channel = Channels.PreRelease;
|
||||||
|
break;
|
||||||
|
case PKG_FILENAME_RELEASEDEFINITION:
|
||||||
|
appVersion.Channel = Channels.Stable;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get build
|
||||||
|
var defBuild = def.Substring(pkgFilenameDef.Length);
|
||||||
|
appVersion.Build = Convert.ToInt32(defBuild);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Set to default
|
||||||
|
appVersion.Build = 1;
|
||||||
|
appVersion.Channel = Channels.Stable;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get version
|
||||||
|
if (Version.TryParse(fileName, out Version version))
|
||||||
|
appVersion.Version = version;
|
||||||
|
else
|
||||||
|
allowAdd = false;
|
||||||
|
|
||||||
|
if (allowAdd)
|
||||||
|
pkgs.Add(appVersion);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return pkgs;
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<bool> DeletePackage(ApplicationVersion version)
|
||||||
|
{
|
||||||
|
var fileName = BuildPackageFilename(version);
|
||||||
|
var response = await client.Delete(fileName);
|
||||||
|
return response.IsSuccessful;
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<bool> UploadPackage(string filePath, ApplicationVersion version)
|
||||||
|
{
|
||||||
|
bool success;
|
||||||
|
var fileName = BuildPackageFilename(version);
|
||||||
|
|
||||||
|
// Upload
|
||||||
|
var fs = new FileStream(filePath, FileMode.Open, FileAccess.Read);
|
||||||
|
var response = await client.PutFile(fileName, fs);
|
||||||
|
fs.Close();
|
||||||
|
success = response.IsSuccessful;
|
||||||
|
|
||||||
|
// Generate public downloadlink
|
||||||
|
if (success)
|
||||||
|
{
|
||||||
|
var pkgInfo = GetOrCreateUpdatePackageInfo(version);
|
||||||
|
pkgInfo.Packagelink = Config.PublicPackageBaseURL + fileName;
|
||||||
|
}
|
||||||
|
|
||||||
|
return success;
|
||||||
|
}
|
||||||
|
|
||||||
|
private string BuildPackageFilename(ApplicationVersion version)
|
||||||
|
{
|
||||||
|
// Build channel/build definition of filename
|
||||||
|
string def = string.Empty;
|
||||||
|
switch (version.Channel)
|
||||||
|
{
|
||||||
|
case Channels.Alpha:
|
||||||
|
def = PKG_FILENAME_ALPHADEFINITION + version.Build;
|
||||||
|
break;
|
||||||
|
case Channels.Stable:
|
||||||
|
if (version.Build != 1)
|
||||||
|
def = PKG_FILENAME_RELEASEDEFINITION + version.Build;
|
||||||
|
break;
|
||||||
|
case Channels.PreRelease:
|
||||||
|
def = PKG_FILENAME_RCDEFINITION + version.Build;
|
||||||
|
break;
|
||||||
|
case Channels.Beta:
|
||||||
|
def = PKG_FILENAME_BETADEFINITION + version.Build;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Build filename
|
||||||
|
var fileName = string.Format(PKG_FILENAME_TEMPLATE, version.Version, def);
|
||||||
|
|
||||||
|
return fileName;
|
||||||
|
}
|
||||||
|
|
||||||
|
private UpdatePackageInfo GetOrCreateUpdatePackageInfo(ApplicationVersion version)
|
||||||
|
{
|
||||||
|
var info = GetUpdatePackageInfo(version);
|
||||||
|
|
||||||
|
info ??= CreateUpdatePackageInfo(version);
|
||||||
|
|
||||||
|
return info;
|
||||||
|
}
|
||||||
|
|
||||||
|
public UpdatePackageInfo GetUpdatePackageInfo(ApplicationVersion version)
|
||||||
|
{
|
||||||
|
return UpdateInfo.Packages.FirstOrDefault((n) => n.Version == version);
|
||||||
|
}
|
||||||
|
|
||||||
|
private UpdatePackageInfo CreateUpdatePackageInfo(ApplicationVersion version)
|
||||||
|
{
|
||||||
|
var info = new UpdatePackageInfo()
|
||||||
|
{
|
||||||
|
Version = version
|
||||||
|
};
|
||||||
|
UpdateInfo.Packages.Add(info);
|
||||||
|
return info;
|
||||||
|
}
|
||||||
|
|
||||||
|
public (string name, string description, UpdateNotesContentType descriptionType) GetPackageDescription(ApplicationVersion version)
|
||||||
|
{
|
||||||
|
var pkg = GetUpdatePackageInfo(version);
|
||||||
|
if (pkg is object)
|
||||||
|
return (pkg.Name, pkg.Notes.Content, pkg.Notes.ContentType);
|
||||||
|
else
|
||||||
|
return default;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetPackageDescription(ApplicationVersion version, string name, string description, UpdateNotesContentType descriptionType)
|
||||||
|
{
|
||||||
|
var pkg = GetOrCreateUpdatePackageInfo(version);
|
||||||
|
if (pkg is object)
|
||||||
|
{
|
||||||
|
pkg.Name = name;
|
||||||
|
pkg.Notes.Content = description;
|
||||||
|
pkg.Notes.ContentType = descriptionType;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public async Task<bool> ChangePackageVersion(ApplicationVersion currentVersion, ApplicationVersion newVersion)
|
||||||
|
{
|
||||||
|
bool success = false;
|
||||||
|
|
||||||
|
// Get file names
|
||||||
|
var currentFilename = BuildPackageFilename(currentVersion);
|
||||||
|
var newFilename = BuildPackageFilename(newVersion);
|
||||||
|
|
||||||
|
// Move
|
||||||
|
var response = await client.Move(currentFilename, newFilename);
|
||||||
|
|
||||||
|
// Change package info version, if exists
|
||||||
|
if (response.IsSuccessful)
|
||||||
|
{
|
||||||
|
var pkg = GetUpdatePackageInfo(currentVersion);
|
||||||
|
if (pkg is object)
|
||||||
|
pkg.Version = newVersion;
|
||||||
|
success = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return success;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
// ------------------------------------------------------------------------------
|
|
||||||
// <auto-generated>
|
|
||||||
// Dieser Code wurde von einem Tool generiert.
|
|
||||||
// Laufzeitversion:4.0.30319.42000
|
|
||||||
//
|
|
||||||
// Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn
|
|
||||||
// der Code erneut generiert wird.
|
|
||||||
// </auto-generated>
|
|
||||||
// ------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<MyApplicationData xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
|
|
||||||
<MySubMain>true</MySubMain>
|
|
||||||
<MainForm>Form1</MainForm>
|
|
||||||
<SingleInstance>false</SingleInstance>
|
|
||||||
<ShutdownMode>0</ShutdownMode>
|
|
||||||
<EnableVisualStyles>true</EnableVisualStyles>
|
|
||||||
<AuthenticationMode>0</AuthenticationMode>
|
|
||||||
<ApplicationType>0</ApplicationType>
|
|
||||||
<SaveMySettingsOnExit>true</SaveMySettingsOnExit>
|
|
||||||
</MyApplicationData>
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
using global::System;
|
|
||||||
using global::System.Reflection;
|
|
||||||
using global::System.Runtime.InteropServices;
|
|
||||||
[assembly: ComVisible(false)]
|
|
||||||
|
|
||||||
// Die folgende GUID bestimmt die ID der Typbibliothek, wenn dieses Projekt für COM verfügbar gemacht wird.
|
|
||||||
[assembly: Guid("f26b0b17-862f-42e2-afd5-340ef6761192")]
|
|
||||||
|
|
||||||
@@ -1,192 +0,0 @@
|
|||||||
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
|
||||||
|
|
||||||
using System;
|
|
||||||
using System.Diagnostics;
|
|
||||||
using Microsoft.VisualBasic;
|
|
||||||
|
|
||||||
/* TODO ERROR: Skipped IfDirectiveTrivia *//* TODO ERROR: Skipped DisabledTextTrivia *//* TODO ERROR: Skipped EndIfDirectiveTrivia */
|
|
||||||
/* TODO ERROR: Skipped IfDirectiveTrivia *//* TODO ERROR: Skipped DisabledTextTrivia *//* TODO ERROR: Skipped ElifDirectiveTrivia *//* TODO ERROR: Skipped DisabledTextTrivia *//* TODO ERROR: Skipped ElifDirectiveTrivia */
|
|
||||||
/* TODO ERROR: Skipped DefineDirectiveTrivia *//* TODO ERROR: Skipped DefineDirectiveTrivia *//* TODO ERROR: Skipped DefineDirectiveTrivia *//* TODO ERROR: Skipped DefineDirectiveTrivia */
|
|
||||||
/* TODO ERROR: Skipped ElifDirectiveTrivia *//* TODO ERROR: Skipped DisabledTextTrivia *//* TODO ERROR: Skipped ElifDirectiveTrivia *//* TODO ERROR: Skipped DisabledTextTrivia *//* TODO ERROR: Skipped ElifDirectiveTrivia *//* TODO ERROR: Skipped DisabledTextTrivia *//* TODO ERROR: Skipped ElifDirectiveTrivia *//* TODO ERROR: Skipped DisabledTextTrivia *//* TODO ERROR: Skipped ElifDirectiveTrivia *//* TODO ERROR: Skipped DisabledTextTrivia *//* TODO ERROR: Skipped EndIfDirectiveTrivia */
|
|
||||||
/* TODO ERROR: Skipped IfDirectiveTrivia */
|
|
||||||
namespace Pilz.Updating.Client.GUI.My
|
|
||||||
{
|
|
||||||
|
|
||||||
/* TODO ERROR: Skipped IfDirectiveTrivia */
|
|
||||||
[System.CodeDom.Compiler.GeneratedCode("MyTemplate", "11.0.0.0")]
|
|
||||||
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
|
|
||||||
|
|
||||||
/* TODO ERROR: Skipped IfDirectiveTrivia *//* TODO ERROR: Skipped DisabledTextTrivia *//* TODO ERROR: Skipped ElifDirectiveTrivia */
|
|
||||||
internal partial class MyApplication : Microsoft.VisualBasic.ApplicationServices.ApplicationBase
|
|
||||||
{
|
|
||||||
/* TODO ERROR: Skipped ElifDirectiveTrivia *//* TODO ERROR: Skipped DisabledTextTrivia *//* TODO ERROR: Skipped EndIfDirectiveTrivia */
|
|
||||||
}
|
|
||||||
|
|
||||||
/* TODO ERROR: Skipped EndIfDirectiveTrivia */
|
|
||||||
/* TODO ERROR: Skipped IfDirectiveTrivia */
|
|
||||||
[System.CodeDom.Compiler.GeneratedCode("MyTemplate", "11.0.0.0")]
|
|
||||||
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
|
|
||||||
|
|
||||||
/* TODO ERROR: Skipped IfDirectiveTrivia */
|
|
||||||
internal partial class MyComputer : Microsoft.VisualBasic.Devices.Computer
|
|
||||||
{
|
|
||||||
/* TODO ERROR: Skipped ElifDirectiveTrivia *//* TODO ERROR: Skipped DisabledTextTrivia *//* TODO ERROR: Skipped EndIfDirectiveTrivia */
|
|
||||||
[DebuggerHidden()]
|
|
||||||
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
|
|
||||||
public MyComputer() : base()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/* TODO ERROR: Skipped EndIfDirectiveTrivia */
|
|
||||||
[HideModuleName()]
|
|
||||||
[System.CodeDom.Compiler.GeneratedCode("MyTemplate", "11.0.0.0")]
|
|
||||||
internal static class MyProject
|
|
||||||
{
|
|
||||||
|
|
||||||
/* TODO ERROR: Skipped IfDirectiveTrivia */
|
|
||||||
[System.ComponentModel.Design.HelpKeyword("My.Computer")]
|
|
||||||
internal static MyComputer Computer
|
|
||||||
{
|
|
||||||
[DebuggerHidden()]
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return m_ComputerObjectProvider.GetInstance;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private readonly static ThreadSafeObjectProvider<MyComputer> m_ComputerObjectProvider = new ThreadSafeObjectProvider<MyComputer>();
|
|
||||||
/* TODO ERROR: Skipped EndIfDirectiveTrivia */
|
|
||||||
/* TODO ERROR: Skipped IfDirectiveTrivia */
|
|
||||||
[System.ComponentModel.Design.HelpKeyword("My.Application")]
|
|
||||||
internal static MyApplication Application
|
|
||||||
{
|
|
||||||
[DebuggerHidden()]
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return m_AppObjectProvider.GetInstance;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private readonly static ThreadSafeObjectProvider<MyApplication> m_AppObjectProvider = new ThreadSafeObjectProvider<MyApplication>();
|
|
||||||
/* TODO ERROR: Skipped EndIfDirectiveTrivia */
|
|
||||||
/* TODO ERROR: Skipped IfDirectiveTrivia */
|
|
||||||
[System.ComponentModel.Design.HelpKeyword("My.User")]
|
|
||||||
internal static Microsoft.VisualBasic.ApplicationServices.User User
|
|
||||||
{
|
|
||||||
[DebuggerHidden()]
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return m_UserObjectProvider.GetInstance;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private readonly static ThreadSafeObjectProvider<Microsoft.VisualBasic.ApplicationServices.User> m_UserObjectProvider = new ThreadSafeObjectProvider<Microsoft.VisualBasic.ApplicationServices.User>();
|
|
||||||
/* TODO ERROR: Skipped ElifDirectiveTrivia *//* TODO ERROR: Skipped DisabledTextTrivia *//* TODO ERROR: Skipped EndIfDirectiveTrivia */
|
|
||||||
/* TODO ERROR: Skipped IfDirectiveTrivia *//* TODO ERROR: Skipped DisabledTextTrivia *//* TODO ERROR: Skipped EndIfDirectiveTrivia */
|
|
||||||
/* TODO ERROR: Skipped IfDirectiveTrivia */
|
|
||||||
[System.ComponentModel.Design.HelpKeyword("My.WebServices")]
|
|
||||||
internal static MyWebServices WebServices
|
|
||||||
{
|
|
||||||
[DebuggerHidden()]
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return m_MyWebServicesObjectProvider.GetInstance;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
|
|
||||||
[MyGroupCollection("System.Web.Services.Protocols.SoapHttpClientProtocol", "Create__Instance__", "Dispose__Instance__", "")]
|
|
||||||
internal sealed class MyWebServices
|
|
||||||
{
|
|
||||||
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
|
|
||||||
[DebuggerHidden()]
|
|
||||||
public override bool Equals(object o)
|
|
||||||
{
|
|
||||||
return base.Equals(o);
|
|
||||||
}
|
|
||||||
|
|
||||||
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
|
|
||||||
[DebuggerHidden()]
|
|
||||||
public override int GetHashCode()
|
|
||||||
{
|
|
||||||
return base.GetHashCode();
|
|
||||||
}
|
|
||||||
|
|
||||||
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
|
|
||||||
[DebuggerHidden()]
|
|
||||||
internal new Type GetType()
|
|
||||||
{
|
|
||||||
return typeof(MyWebServices);
|
|
||||||
}
|
|
||||||
|
|
||||||
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
|
|
||||||
[DebuggerHidden()]
|
|
||||||
public override string ToString()
|
|
||||||
{
|
|
||||||
return base.ToString();
|
|
||||||
}
|
|
||||||
|
|
||||||
[DebuggerHidden()]
|
|
||||||
private static T Create__Instance__<T>(T instance) where T : new()
|
|
||||||
{
|
|
||||||
if (instance == null)
|
|
||||||
{
|
|
||||||
return new T();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return instance;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
[DebuggerHidden()]
|
|
||||||
private void Dispose__Instance__<T>(ref T instance)
|
|
||||||
{
|
|
||||||
instance = default;
|
|
||||||
}
|
|
||||||
|
|
||||||
[DebuggerHidden()]
|
|
||||||
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
|
|
||||||
public MyWebServices() : base()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private readonly static ThreadSafeObjectProvider<MyWebServices> m_MyWebServicesObjectProvider = new ThreadSafeObjectProvider<MyWebServices>();
|
|
||||||
/* TODO ERROR: Skipped EndIfDirectiveTrivia */
|
|
||||||
/* TODO ERROR: Skipped IfDirectiveTrivia *//* TODO ERROR: Skipped DisabledTextTrivia *//* TODO ERROR: Skipped EndIfDirectiveTrivia */
|
|
||||||
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
|
|
||||||
[System.Runtime.InteropServices.ComVisible(false)]
|
|
||||||
internal sealed class ThreadSafeObjectProvider<T> where T : new()
|
|
||||||
{
|
|
||||||
internal T GetInstance
|
|
||||||
{
|
|
||||||
/* TODO ERROR: Skipped IfDirectiveTrivia */
|
|
||||||
[DebuggerHidden()]
|
|
||||||
get
|
|
||||||
{
|
|
||||||
var Value = m_Context.Value;
|
|
||||||
if (Value == null)
|
|
||||||
{
|
|
||||||
Value = new T();
|
|
||||||
m_Context.Value = Value;
|
|
||||||
}
|
|
||||||
|
|
||||||
return Value;
|
|
||||||
}
|
|
||||||
/* TODO ERROR: Skipped ElseDirectiveTrivia *//* TODO ERROR: Skipped DisabledTextTrivia *//* TODO ERROR: Skipped EndIfDirectiveTrivia */
|
|
||||||
}
|
|
||||||
|
|
||||||
[DebuggerHidden()]
|
|
||||||
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
|
|
||||||
public ThreadSafeObjectProvider() : base()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/* TODO ERROR: Skipped IfDirectiveTrivia */
|
|
||||||
private readonly Microsoft.VisualBasic.MyServices.Internal.ContextValue<T> m_Context = new Microsoft.VisualBasic.MyServices.Internal.ContextValue<T>();
|
|
||||||
/* TODO ERROR: Skipped ElseDirectiveTrivia *//* TODO ERROR: Skipped DisabledTextTrivia *//* TODO ERROR: Skipped EndIfDirectiveTrivia */
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/* TODO ERROR: Skipped EndIfDirectiveTrivia */
|
|
||||||
@@ -1,253 +0,0 @@
|
|||||||
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
|
||||||
|
|
||||||
// See Compiler::LoadXmlSolutionExtension
|
|
||||||
using System.Collections;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Data;
|
|
||||||
using System.Diagnostics;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Xml.Linq;
|
|
||||||
using Microsoft.VisualBasic;
|
|
||||||
using Microsoft.VisualBasic.CompilerServices;
|
|
||||||
|
|
||||||
namespace Pilz.Updating.Client.GUI.My
|
|
||||||
{
|
|
||||||
[Embedded()]
|
|
||||||
[DebuggerNonUserCode()]
|
|
||||||
[System.Runtime.CompilerServices.CompilerGenerated()]
|
|
||||||
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
|
|
||||||
internal sealed class InternalXmlHelper
|
|
||||||
{
|
|
||||||
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
|
|
||||||
private InternalXmlHelper()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public static string get_Value(IEnumerable<XElement> source)
|
|
||||||
{
|
|
||||||
foreach (XElement item in source)
|
|
||||||
return item.Value;
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void set_Value(IEnumerable<XElement> source, string value)
|
|
||||||
{
|
|
||||||
foreach (XElement item in source)
|
|
||||||
{
|
|
||||||
item.Value = value;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static string get_AttributeValue(IEnumerable<XElement> source, XName name)
|
|
||||||
{
|
|
||||||
foreach (XElement item in source)
|
|
||||||
return Conversions.ToString(item.Attribute(name));
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void set_AttributeValue(IEnumerable<XElement> source, XName name, string value)
|
|
||||||
{
|
|
||||||
foreach (XElement item in source)
|
|
||||||
{
|
|
||||||
item.SetAttributeValue(name, value);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static string get_AttributeValue(XElement source, XName name)
|
|
||||||
{
|
|
||||||
return Conversions.ToString(source.Attribute(name));
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void set_AttributeValue(XElement source, XName name, string value)
|
|
||||||
{
|
|
||||||
source.SetAttributeValue(name, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
|
|
||||||
public static XAttribute CreateAttribute(XName name, object value)
|
|
||||||
{
|
|
||||||
if (value is null)
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
return new XAttribute(name, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
|
|
||||||
public static XAttribute CreateNamespaceAttribute(XName name, XNamespace ns)
|
|
||||||
{
|
|
||||||
var a = new XAttribute(name, ns.NamespaceName);
|
|
||||||
a.AddAnnotation(ns);
|
|
||||||
return a;
|
|
||||||
}
|
|
||||||
|
|
||||||
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
|
|
||||||
public static object RemoveNamespaceAttributes(string[] inScopePrefixes, XNamespace[] inScopeNs, List<XAttribute> attributes, object obj)
|
|
||||||
{
|
|
||||||
if (obj is object)
|
|
||||||
{
|
|
||||||
XElement elem = obj as XElement;
|
|
||||||
if (elem is object)
|
|
||||||
{
|
|
||||||
return RemoveNamespaceAttributes(inScopePrefixes, inScopeNs, attributes, elem);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
IEnumerable elems = obj as IEnumerable;
|
|
||||||
if (elems is object)
|
|
||||||
{
|
|
||||||
return RemoveNamespaceAttributes(inScopePrefixes, inScopeNs, attributes, elems);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return obj;
|
|
||||||
}
|
|
||||||
|
|
||||||
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
|
|
||||||
public static IEnumerable RemoveNamespaceAttributes(string[] inScopePrefixes, XNamespace[] inScopeNs, List<XAttribute> attributes, IEnumerable obj)
|
|
||||||
{
|
|
||||||
if (obj is object)
|
|
||||||
{
|
|
||||||
IEnumerable<XElement> elems = obj as IEnumerable<XElement>;
|
|
||||||
if (elems is object)
|
|
||||||
{
|
|
||||||
return elems.Select(new RemoveNamespaceAttributesClosure(inScopePrefixes, inScopeNs, attributes).ProcessXElement);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return obj.Cast<object>().Select(new RemoveNamespaceAttributesClosure(inScopePrefixes, inScopeNs, attributes).ProcessObject);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return obj;
|
|
||||||
}
|
|
||||||
|
|
||||||
[DebuggerNonUserCode()]
|
|
||||||
[System.Runtime.CompilerServices.CompilerGenerated()]
|
|
||||||
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
|
|
||||||
private sealed class RemoveNamespaceAttributesClosure
|
|
||||||
{
|
|
||||||
private readonly string[] m_inScopePrefixes;
|
|
||||||
private readonly XNamespace[] m_inScopeNs;
|
|
||||||
private readonly List<XAttribute> m_attributes;
|
|
||||||
|
|
||||||
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
|
|
||||||
internal RemoveNamespaceAttributesClosure(string[] inScopePrefixes, XNamespace[] inScopeNs, List<XAttribute> attributes)
|
|
||||||
{
|
|
||||||
m_inScopePrefixes = inScopePrefixes;
|
|
||||||
m_inScopeNs = inScopeNs;
|
|
||||||
m_attributes = attributes;
|
|
||||||
}
|
|
||||||
|
|
||||||
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
|
|
||||||
internal XElement ProcessXElement(XElement elem)
|
|
||||||
{
|
|
||||||
return RemoveNamespaceAttributes(m_inScopePrefixes, m_inScopeNs, m_attributes, elem);
|
|
||||||
}
|
|
||||||
|
|
||||||
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
|
|
||||||
internal object ProcessObject(object obj)
|
|
||||||
{
|
|
||||||
XElement elem = obj as XElement;
|
|
||||||
if (elem is object)
|
|
||||||
{
|
|
||||||
return RemoveNamespaceAttributes(m_inScopePrefixes, m_inScopeNs, m_attributes, elem);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return obj;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
|
|
||||||
public static XElement RemoveNamespaceAttributes(string[] inScopePrefixes, XNamespace[] inScopeNs, List<XAttribute> attributes, XElement e)
|
|
||||||
{
|
|
||||||
if (e is object)
|
|
||||||
{
|
|
||||||
var a = e.FirstAttribute;
|
|
||||||
while (a is object)
|
|
||||||
{
|
|
||||||
var nextA = a.NextAttribute;
|
|
||||||
if (a.IsNamespaceDeclaration)
|
|
||||||
{
|
|
||||||
var ns = a.Annotation<XNamespace>();
|
|
||||||
string prefix = a.Name.LocalName;
|
|
||||||
if (ns is object)
|
|
||||||
{
|
|
||||||
if (inScopePrefixes is object && inScopeNs is object)
|
|
||||||
{
|
|
||||||
int lastIndex = inScopePrefixes.Length - 1;
|
|
||||||
for (int i = 0, loopTo = lastIndex; i <= loopTo; i++)
|
|
||||||
{
|
|
||||||
string currentInScopePrefix = inScopePrefixes[i];
|
|
||||||
var currentInScopeNs = inScopeNs[i];
|
|
||||||
if (prefix.Equals(currentInScopePrefix))
|
|
||||||
{
|
|
||||||
if (ns == currentInScopeNs)
|
|
||||||
{
|
|
||||||
// prefix and namespace match. Remove the unneeded ns attribute
|
|
||||||
a.Remove();
|
|
||||||
}
|
|
||||||
|
|
||||||
// prefix is in scope but refers to something else. Leave the ns attribute.
|
|
||||||
a = null;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (a is object)
|
|
||||||
{
|
|
||||||
// Prefix is not in scope
|
|
||||||
// Now check whether it's going to be in scope because it is in the attributes list
|
|
||||||
|
|
||||||
if (attributes is object)
|
|
||||||
{
|
|
||||||
int lastIndex = attributes.Count - 1;
|
|
||||||
for (int i = 0, loopTo1 = lastIndex; i <= loopTo1; i++)
|
|
||||||
{
|
|
||||||
var currentA = attributes[i];
|
|
||||||
string currentInScopePrefix = currentA.Name.LocalName;
|
|
||||||
var currentInScopeNs = currentA.Annotation<XNamespace>();
|
|
||||||
if (currentInScopeNs is object)
|
|
||||||
{
|
|
||||||
if (prefix.Equals(currentInScopePrefix))
|
|
||||||
{
|
|
||||||
if (ns == currentInScopeNs)
|
|
||||||
{
|
|
||||||
// prefix and namespace match. Remove the unneeded ns attribute
|
|
||||||
a.Remove();
|
|
||||||
}
|
|
||||||
|
|
||||||
// prefix is in scope but refers to something else. Leave the ns attribute.
|
|
||||||
a = null;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (a is object)
|
|
||||||
{
|
|
||||||
// Prefix is definitely not in scope
|
|
||||||
a.Remove();
|
|
||||||
// namespace is not defined either. Add this attributes list
|
|
||||||
attributes.Add(a);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
a = nextA;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return e;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
|
||||||
|
|
||||||
using System;
|
|
||||||
|
|
||||||
namespace Microsoft.VisualBasic
|
|
||||||
{
|
|
||||||
[Embedded()]
|
|
||||||
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Module | AttributeTargets.Assembly, Inherited = false)]
|
|
||||||
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
|
|
||||||
[System.Runtime.CompilerServices.CompilerGenerated()]
|
|
||||||
internal sealed class Embedded : Attribute
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,117 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<root>
|
|
||||||
<!--
|
|
||||||
Microsoft ResX Schema
|
|
||||||
|
|
||||||
Version 2.0
|
|
||||||
|
|
||||||
The primary goals of this format is to allow a simple XML format
|
|
||||||
that is mostly human readable. The generation and parsing of the
|
|
||||||
various data types are done through the TypeConverter classes
|
|
||||||
associated with the data types.
|
|
||||||
|
|
||||||
Example:
|
|
||||||
|
|
||||||
... ado.net/XML headers & schema ...
|
|
||||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
|
||||||
<resheader name="version">2.0</resheader>
|
|
||||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
|
||||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
|
||||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
|
||||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
|
||||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
|
||||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
|
||||||
</data>
|
|
||||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
|
||||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
|
||||||
<comment>This is a comment</comment>
|
|
||||||
</data>
|
|
||||||
|
|
||||||
There are any number of "resheader" rows that contain simple
|
|
||||||
name/value pairs.
|
|
||||||
|
|
||||||
Each data row contains a name, and value. The row also contains a
|
|
||||||
type or mimetype. Type corresponds to a .NET class that support
|
|
||||||
text/value conversion through the TypeConverter architecture.
|
|
||||||
Classes that don't support this are serialized and stored with the
|
|
||||||
mimetype set.
|
|
||||||
|
|
||||||
The mimetype is used for serialized objects, and tells the
|
|
||||||
ResXResourceReader how to depersist the object. This is currently not
|
|
||||||
extensible. For a given mimetype the value must be set accordingly:
|
|
||||||
|
|
||||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
|
||||||
that the ResXResourceWriter will generate, however the reader can
|
|
||||||
read any of the formats listed below.
|
|
||||||
|
|
||||||
mimetype: application/x-microsoft.net.object.binary.base64
|
|
||||||
value : The object must be serialized with
|
|
||||||
: System.Serialization.Formatters.Binary.BinaryFormatter
|
|
||||||
: and then encoded with base64 encoding.
|
|
||||||
|
|
||||||
mimetype: application/x-microsoft.net.object.soap.base64
|
|
||||||
value : The object must be serialized with
|
|
||||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
|
||||||
: and then encoded with base64 encoding.
|
|
||||||
|
|
||||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
|
||||||
value : The object must be serialized into a byte array
|
|
||||||
: using a System.ComponentModel.TypeConverter
|
|
||||||
: and then encoded with base64 encoding.
|
|
||||||
-->
|
|
||||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
|
||||||
<xsd:element name="root" msdata:IsDataSet="true">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:choice maxOccurs="unbounded">
|
|
||||||
<xsd:element name="metadata">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:sequence>
|
|
||||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
|
||||||
</xsd:sequence>
|
|
||||||
<xsd:attribute name="name" type="xsd:string" />
|
|
||||||
<xsd:attribute name="type" type="xsd:string" />
|
|
||||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
<xsd:element name="assembly">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:attribute name="alias" type="xsd:string" />
|
|
||||||
<xsd:attribute name="name" type="xsd:string" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
<xsd:element name="data">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:sequence>
|
|
||||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
|
||||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
|
||||||
</xsd:sequence>
|
|
||||||
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
|
|
||||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
|
||||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
<xsd:element name="resheader">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:sequence>
|
|
||||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
|
||||||
</xsd:sequence>
|
|
||||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
</xsd:choice>
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
</xsd:schema>
|
|
||||||
<resheader name="resmimetype">
|
|
||||||
<value>text/microsoft-resx</value>
|
|
||||||
</resheader>
|
|
||||||
<resheader name="version">
|
|
||||||
<value>2.0</value>
|
|
||||||
</resheader>
|
|
||||||
<resheader name="reader">
|
|
||||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
|
||||||
</resheader>
|
|
||||||
<resheader name="writer">
|
|
||||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
|
||||||
</resheader>
|
|
||||||
</root>
|
|
||||||
@@ -1,52 +0,0 @@
|
|||||||
// ------------------------------------------------------------------------------
|
|
||||||
// <auto-generated>
|
|
||||||
// Dieser Code wurde von einem Tool generiert.
|
|
||||||
// Laufzeitversion:4.0.30319.42000
|
|
||||||
//
|
|
||||||
// Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn
|
|
||||||
// der Code erneut generiert wird.
|
|
||||||
// </auto-generated>
|
|
||||||
// ------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
using System.Diagnostics;
|
|
||||||
using Microsoft.VisualBasic;
|
|
||||||
|
|
||||||
namespace Pilz.Updating.Client.GUI.My
|
|
||||||
{
|
|
||||||
[System.Runtime.CompilerServices.CompilerGenerated()]
|
|
||||||
[System.CodeDom.Compiler.GeneratedCode("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.9.0.0")]
|
|
||||||
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Advanced)]
|
|
||||||
internal sealed partial class MySettings : System.Configuration.ApplicationSettingsBase
|
|
||||||
{
|
|
||||||
private static MySettings defaultInstance = (MySettings)Synchronized(new MySettings());
|
|
||||||
|
|
||||||
/* TODO ERROR: Skipped RegionDirectiveTrivia *//* TODO ERROR: Skipped IfDirectiveTrivia *//* TODO ERROR: Skipped DisabledTextTrivia *//* TODO ERROR: Skipped EndIfDirectiveTrivia *//* TODO ERROR: Skipped EndRegionDirectiveTrivia */
|
|
||||||
public static MySettings Default
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
|
|
||||||
/* TODO ERROR: Skipped IfDirectiveTrivia *//* TODO ERROR: Skipped DisabledTextTrivia *//* TODO ERROR: Skipped EndIfDirectiveTrivia */
|
|
||||||
return defaultInstance;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace Pilz.Updating.Client.GUI.My
|
|
||||||
{
|
|
||||||
[HideModuleName()]
|
|
||||||
[DebuggerNonUserCode()]
|
|
||||||
[System.Runtime.CompilerServices.CompilerGenerated()]
|
|
||||||
internal static class MySettingsProperty
|
|
||||||
{
|
|
||||||
[System.ComponentModel.Design.HelpKeyword("My.Settings")]
|
|
||||||
internal static MySettings Settings
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return MySettings.Default;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
<?xml version='1.0' encoding='utf-8'?>
|
|
||||||
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" UseMySettingsClassName="true">
|
|
||||||
<Profiles>
|
|
||||||
<Profile Name="(Default)" />
|
|
||||||
</Profiles>
|
|
||||||
<Settings />
|
|
||||||
</SettingsFile>
|
|
||||||
@@ -1,8 +1,7 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<StartupObject />
|
|
||||||
<RootNamespace>SM64_ROM_Manager.Updating.Client.GUI</RootNamespace>
|
<RootNamespace>SM64_ROM_Manager.Updating.Client.GUI</RootNamespace>
|
||||||
<TargetFrameworks>net6.0-windows;net8.0-windows</TargetFrameworks>
|
<TargetFrameworks>net8.0-windows</TargetFrameworks>
|
||||||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
||||||
<DefaultItemExcludes>$(DefaultItemExcludes);$(ProjectDir)**\*.vb</DefaultItemExcludes>
|
<DefaultItemExcludes>$(DefaultItemExcludes);$(ProjectDir)**\*.vb</DefaultItemExcludes>
|
||||||
<LangVersion>latest</LangVersion>
|
<LangVersion>latest</LangVersion>
|
||||||
@@ -38,7 +37,6 @@
|
|||||||
<DefineConstants>TRACE</DefineConstants>
|
<DefineConstants>TRACE</DefineConstants>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
|
|
||||||
<Version>2.0.0</Version>
|
<Version>2.0.0</Version>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
@@ -46,9 +44,6 @@
|
|||||||
<PackageReference Include="Pilz.IO" Version="2.0.0" />
|
<PackageReference Include="Pilz.IO" Version="2.0.0" />
|
||||||
<PackageReference Include="System.Data.DataSetExtensions" Version="4.5.0" />
|
<PackageReference Include="System.Data.DataSetExtensions" Version="4.5.0" />
|
||||||
<PackageReference Include="System.Net.Http" Version="4.3.4" />
|
<PackageReference Include="System.Net.Http" Version="4.3.4" />
|
||||||
<PackageReference Include="UI.for.WinForms.AllControls.Net60">
|
|
||||||
<Version>2023.1.117</Version>
|
|
||||||
</PackageReference>
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Import Include="Microsoft.VisualBasic" />
|
<Import Include="Microsoft.VisualBasic" />
|
||||||
@@ -83,20 +78,11 @@
|
|||||||
<DependentUpon>UpdatesAvailableDialog.cs</DependentUpon>
|
<DependentUpon>UpdatesAvailableDialog.cs</DependentUpon>
|
||||||
<SubType>Form</SubType>
|
<SubType>Form</SubType>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Update="My Project\Application.Designer.cs">
|
|
||||||
<AutoGen>True</AutoGen>
|
|
||||||
<DependentUpon>Application.myapp</DependentUpon>
|
|
||||||
</Compile>
|
|
||||||
<Compile Update="Resources.Designer.cs">
|
<Compile Update="Resources.Designer.cs">
|
||||||
<AutoGen>True</AutoGen>
|
<AutoGen>True</AutoGen>
|
||||||
<DesignTime>True</DesignTime>
|
<DesignTime>True</DesignTime>
|
||||||
<DependentUpon>Resources.resx</DependentUpon>
|
<DependentUpon>Resources.resx</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Update="My Project\Settings.Designer.cs">
|
|
||||||
<AutoGen>True</AutoGen>
|
|
||||||
<DependentUpon>Settings.settings</DependentUpon>
|
|
||||||
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
|
||||||
</Compile>
|
|
||||||
<Compile Update="UpdatingClientGuiLangRes.Designer.cs">
|
<Compile Update="UpdatingClientGuiLangRes.Designer.cs">
|
||||||
<AutoGen>True</AutoGen>
|
<AutoGen>True</AutoGen>
|
||||||
<DesignTime>True</DesignTime>
|
<DesignTime>True</DesignTime>
|
||||||
@@ -137,17 +123,6 @@
|
|||||||
<LastGenOutput>UpdatingClientGuiLangRes.Designer.cs</LastGenOutput>
|
<LastGenOutput>UpdatingClientGuiLangRes.Designer.cs</LastGenOutput>
|
||||||
</EmbeddedResource>
|
</EmbeddedResource>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
|
||||||
<None Include="My Project\Application.myapp">
|
|
||||||
<Generator>MyApplicationCodeGenerator</Generator>
|
|
||||||
<LastGenOutput>Application.Designer.cs</LastGenOutput>
|
|
||||||
</None>
|
|
||||||
<None Include="My Project\Settings.settings">
|
|
||||||
<Generator>SettingsSingleFileGenerator</Generator>
|
|
||||||
<CustomToolNamespace>SM64_ROM_Manager.Updating.Client.GUI.My</CustomToolNamespace>
|
|
||||||
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
|
|
||||||
</None>
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\Pilz.Updating.Client\Pilz.Updating.Client.csproj" />
|
<ProjectReference Include="..\Pilz.Updating.Client\Pilz.Updating.Client.csproj" />
|
||||||
<ProjectReference Include="..\Pilz.Updating.GUIBase\Pilz.Updating.GUIBase.csproj" />
|
<ProjectReference Include="..\Pilz.Updating.GUIBase\Pilz.Updating.GUIBase.csproj" />
|
||||||
@@ -155,8 +130,10 @@
|
|||||||
<ProjectReference Include="..\Pilz.Updating\Pilz.Updating.csproj" />
|
<ProjectReference Include="..\Pilz.Updating\Pilz.Updating.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Markdig" Version="0.33.0" />
|
<PackageReference Include="Markdig" Version="0.37.0" />
|
||||||
<PackageReference Include="System.Runtime.CompilerServices.Unsafe" Version="6.0.0" />
|
<PackageReference Include="System.Runtime.CompilerServices.Unsafe" Version="6.0.0" />
|
||||||
|
<PackageReference Include="UI.for.WinForms.Common" Version="2024.2.514" />
|
||||||
|
<PackageReference Include="UI.for.WinForms.RichTextEditor" Version="2024.2.514" />
|
||||||
<PackageReference Include="Westermo.HtmlRenderer.WinForms" Version="1.6.0" />
|
<PackageReference Include="Westermo.HtmlRenderer.WinForms" Version="1.6.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|||||||
@@ -1,29 +1,28 @@
|
|||||||
namespace Pilz.Updating.Client.GUI
|
namespace Pilz.Updating.Client.GUI;
|
||||||
|
|
||||||
|
public partial class SimpleActionDialog
|
||||||
{
|
{
|
||||||
public partial class SimpleActionDialog
|
public SimpleActionDialog()
|
||||||
{
|
{
|
||||||
public SimpleActionDialog()
|
InitializeComponent();
|
||||||
{
|
SetCurrentState(UpdateStatus.Waiting);
|
||||||
InitializeComponent();
|
}
|
||||||
SetCurrentState(UpdateStatus.Waiting);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void SetCurrentState(UpdateStatus curAction)
|
public void SetCurrentState(UpdateStatus curAction)
|
||||||
|
{
|
||||||
|
string progressText = curAction switch
|
||||||
{
|
{
|
||||||
string progressText = curAction switch
|
UpdateStatus.Waiting => UpdatingClientGuiLangRes.SimpleActions_Waiting,
|
||||||
{
|
UpdateStatus.Searching => UpdatingClientGuiLangRes.SimpleActions_Searching,
|
||||||
UpdateStatus.Waiting => UpdatingClientGuiLangRes.SimpleActions_Waiting,
|
UpdateStatus.DownloadingPackage => UpdatingClientGuiLangRes.SimpleActions_DownloadingPackage,
|
||||||
UpdateStatus.Searching => UpdatingClientGuiLangRes.SimpleActions_Searching,
|
UpdateStatus.DownloadingInstaller => UpdatingClientGuiLangRes.SimpleActions_DownloadingInstaller,
|
||||||
UpdateStatus.DownloadingPackage => UpdatingClientGuiLangRes.SimpleActions_DownloadingPackage,
|
UpdateStatus.StartingInstaller => UpdatingClientGuiLangRes.SimpleActions_StartingInstaller,
|
||||||
UpdateStatus.DownloadingInstaller => UpdatingClientGuiLangRes.SimpleActions_DownloadingInstaller,
|
_ => string.Empty,
|
||||||
UpdateStatus.StartingInstaller => UpdatingClientGuiLangRes.SimpleActions_StartingInstaller,
|
};
|
||||||
_ => string.Empty,
|
|
||||||
};
|
|
||||||
|
|
||||||
radProgressBar1.Visible = false;
|
radProgressBar1.Visible = false;
|
||||||
radWaitingBar1.Text = progressText;
|
radWaitingBar1.Text = progressText;
|
||||||
radWaitingBar1.BringToFront();
|
radWaitingBar1.BringToFront();
|
||||||
radWaitingBar1.StartWaiting();
|
radWaitingBar1.StartWaiting();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,146 +1,144 @@
|
|||||||
using System.ComponentModel;
|
using Microsoft.VisualBasic.CompilerServices;
|
||||||
using System.Drawing;
|
|
||||||
using System.Reflection;
|
|
||||||
using System.Runtime.CompilerServices;
|
|
||||||
using System.Windows.Forms;
|
|
||||||
using Microsoft.VisualBasic.CompilerServices;
|
|
||||||
using System;
|
using System;
|
||||||
using Telerik.WinControls;
|
using System.ComponentModel;
|
||||||
|
using System.Drawing;
|
||||||
|
using System.Runtime.CompilerServices;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
using Telerik.WinControls;
|
||||||
|
|
||||||
namespace Pilz.Updating.Client.GUI
|
namespace Pilz.Updating.Client.GUI;
|
||||||
|
|
||||||
|
public class UpdateClientGUI
|
||||||
{
|
{
|
||||||
public class UpdateClientGUI
|
|
||||||
|
// F i e l d s
|
||||||
|
|
||||||
|
private Form parentForm;
|
||||||
|
private UpdateClient _UpdateClient;
|
||||||
|
|
||||||
|
private UpdateClient UpdateClient
|
||||||
{
|
{
|
||||||
|
[MethodImpl(MethodImplOptions.Synchronized)]
|
||||||
// F i e l d s
|
get
|
||||||
|
|
||||||
private Form parentForm;
|
|
||||||
private UpdateClient _UpdateClient;
|
|
||||||
|
|
||||||
private UpdateClient UpdateClient
|
|
||||||
{
|
{
|
||||||
[MethodImpl(MethodImplOptions.Synchronized)]
|
return _UpdateClient;
|
||||||
get
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.Synchronized)]
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (_UpdateClient != null)
|
||||||
{
|
{
|
||||||
return _UpdateClient;
|
|
||||||
|
// U p d a t e C l i e n t - E v e n t s
|
||||||
|
|
||||||
|
_UpdateClient.UpdateStatusChanged -= MyUpdateClient_UpdateStatusChanged;
|
||||||
|
_UpdateClient.DownloadingUpdate -= MyUpdateClient_DownloadingUpdate;
|
||||||
|
_UpdateClient.InstallingUpdate -= MyUpdateClient_InstallingUpdate;
|
||||||
|
_UpdateClient.UpdateInstallerStarted -= MyUpdateClient_FinishWork;
|
||||||
|
_UpdateClient.NoUpdatesFound -= MyUpdateClient_NoUpdatesFound;
|
||||||
}
|
}
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.Synchronized)]
|
_UpdateClient = value;
|
||||||
set
|
if (_UpdateClient != null)
|
||||||
{
|
{
|
||||||
if (_UpdateClient != null)
|
_UpdateClient.UpdateStatusChanged += MyUpdateClient_UpdateStatusChanged;
|
||||||
{
|
_UpdateClient.DownloadingUpdate += MyUpdateClient_DownloadingUpdate;
|
||||||
|
_UpdateClient.InstallingUpdate += MyUpdateClient_InstallingUpdate;
|
||||||
// U p d a t e C l i e n t - E v e n t s
|
_UpdateClient.UpdateInstallerStarted += MyUpdateClient_FinishWork;
|
||||||
|
_UpdateClient.NoUpdatesFound += MyUpdateClient_NoUpdatesFound;
|
||||||
_UpdateClient.UpdateStatusChanged -= MyUpdateClient_UpdateStatusChanged;
|
|
||||||
_UpdateClient.DownloadingUpdate -= MyUpdateClient_DownloadingUpdate;
|
|
||||||
_UpdateClient.InstallingUpdate -= MyUpdateClient_InstallingUpdate;
|
|
||||||
_UpdateClient.UpdateInstallerStarted -= MyUpdateClient_FinishWork;
|
|
||||||
_UpdateClient.NoUpdatesFound -= MyUpdateClient_NoUpdatesFound;
|
|
||||||
}
|
|
||||||
|
|
||||||
_UpdateClient = value;
|
|
||||||
if (_UpdateClient != null)
|
|
||||||
{
|
|
||||||
_UpdateClient.UpdateStatusChanged += MyUpdateClient_UpdateStatusChanged;
|
|
||||||
_UpdateClient.DownloadingUpdate += MyUpdateClient_DownloadingUpdate;
|
|
||||||
_UpdateClient.InstallingUpdate += MyUpdateClient_InstallingUpdate;
|
|
||||||
_UpdateClient.UpdateInstallerStarted += MyUpdateClient_FinishWork;
|
|
||||||
_UpdateClient.NoUpdatesFound += MyUpdateClient_NoUpdatesFound;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private SimpleActionDialog curProgressDialog = null;
|
|
||||||
|
|
||||||
// P r o p e r t i e s
|
|
||||||
|
|
||||||
public bool UseHiddenSearch { get; set; } = false;
|
|
||||||
|
|
||||||
private static Image MyAppIcon => Icon.ExtractAssociatedIcon(IO.Extensions.GetExecutablePath()).ToBitmap();
|
|
||||||
|
|
||||||
// C o n s t r u c t o r s
|
|
||||||
|
|
||||||
public UpdateClientGUI(UpdateClient updateClient)
|
|
||||||
{
|
|
||||||
UpdateClient = updateClient;
|
|
||||||
}
|
|
||||||
|
|
||||||
// F e a t u r e s
|
|
||||||
|
|
||||||
public async Task UpdateInteractive(Form parentForm)
|
|
||||||
{
|
|
||||||
this.parentForm = parentForm;
|
|
||||||
await UpdateClient.UpdateInteractive();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void EndUpdating()
|
|
||||||
{
|
|
||||||
curProgressDialog?.Invoke(new Action(() => curProgressDialog.Close()));
|
|
||||||
UpdateClient = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void MyUpdateClient_UpdateStatusChanged(UpdateStatus newStatus)
|
|
||||||
{
|
|
||||||
bool useGui = false;
|
|
||||||
if (!(newStatus == UpdateStatus.Searching && UseHiddenSearch))
|
|
||||||
{
|
|
||||||
useGui = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (useGui && curProgressDialog is null)
|
|
||||||
{
|
|
||||||
parentForm.Invoke(new Action(() =>
|
|
||||||
{
|
|
||||||
curProgressDialog = new SimpleActionDialog();
|
|
||||||
curProgressDialog.SetCurrentState(UpdateStatus.Waiting);
|
|
||||||
curProgressDialog.Show(parentForm);
|
|
||||||
}));
|
|
||||||
}
|
|
||||||
|
|
||||||
curProgressDialog?.Invoke(new Action(() => curProgressDialog.SetCurrentState(newStatus)));
|
|
||||||
}
|
|
||||||
|
|
||||||
private void MyUpdateClient_DownloadingUpdate(UpdatePackageInfo pkg, CancelEventArgs e)
|
|
||||||
{
|
|
||||||
curProgressDialog?.Invoke(new Action(() => curProgressDialog.Hide()));
|
|
||||||
var dres = default(DialogResult);
|
|
||||||
parentForm.Invoke(new Action(() =>
|
|
||||||
{
|
|
||||||
var dialog = new UpdatesAvailableDialog(MyAppIcon, UpdateClient.CurrentVersion.Version.ToString(), UpdateClient.CurrentVersion.Channel.ToString(), Conversions.ToString(UpdateClient.CurrentVersion.Build), pkg.Version.Version.ToString(), pkg.Version.Channel.ToString(), Conversions.ToString(pkg.Version.Build), pkg.Notes, UpdateClient.InstallAsAdmin);
|
|
||||||
dres = dialog.ShowDialog(parentForm);
|
|
||||||
}));
|
|
||||||
if (dres != DialogResult.OK)
|
|
||||||
{
|
|
||||||
e.Cancel = true;
|
|
||||||
EndUpdating();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
e.Cancel = false;
|
|
||||||
curProgressDialog?.Invoke(new Action(() => curProgressDialog.Show()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void MyUpdateClient_InstallingUpdate(UpdatePackageInfo pkg, CancelEventArgs e)
|
|
||||||
{
|
|
||||||
e.Cancel = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void MyUpdateClient_FinishWork()
|
|
||||||
{
|
|
||||||
EndUpdating();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void MyUpdateClient_NoUpdatesFound()
|
|
||||||
{
|
|
||||||
EndUpdating();
|
|
||||||
if (!UseHiddenSearch)
|
|
||||||
{
|
|
||||||
RadMessageBox.Show(UpdatingClientGuiLangRes.MsgBox_NoUpdatesFound, UpdatingClientGuiLangRes.MsgBox_NoUpdatesFound_Titel, MessageBoxButtons.OK, RadMessageIcon.Info);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private SimpleActionDialog curProgressDialog = null;
|
||||||
|
|
||||||
|
// P r o p e r t i e s
|
||||||
|
|
||||||
|
public bool UseHiddenSearch { get; set; } = false;
|
||||||
|
|
||||||
|
private static Image MyAppIcon => Icon.ExtractAssociatedIcon(IO.Extensions.GetExecutablePath()).ToBitmap();
|
||||||
|
|
||||||
|
// C o n s t r u c t o r s
|
||||||
|
|
||||||
|
public UpdateClientGUI(UpdateClient updateClient)
|
||||||
|
{
|
||||||
|
UpdateClient = updateClient;
|
||||||
|
}
|
||||||
|
|
||||||
|
// F e a t u r e s
|
||||||
|
|
||||||
|
public async Task UpdateInteractive(Form parentForm)
|
||||||
|
{
|
||||||
|
this.parentForm = parentForm;
|
||||||
|
await UpdateClient.UpdateInteractive();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void EndUpdating()
|
||||||
|
{
|
||||||
|
curProgressDialog?.Invoke(new Action(() => curProgressDialog.Close()));
|
||||||
|
UpdateClient = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void MyUpdateClient_UpdateStatusChanged(UpdateStatus newStatus)
|
||||||
|
{
|
||||||
|
bool useGui = false;
|
||||||
|
if (!(newStatus == UpdateStatus.Searching && UseHiddenSearch))
|
||||||
|
{
|
||||||
|
useGui = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (useGui && curProgressDialog is null)
|
||||||
|
{
|
||||||
|
parentForm.Invoke(new Action(() =>
|
||||||
|
{
|
||||||
|
curProgressDialog = new SimpleActionDialog();
|
||||||
|
curProgressDialog.SetCurrentState(UpdateStatus.Waiting);
|
||||||
|
curProgressDialog.Show(parentForm);
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
|
curProgressDialog?.Invoke(new Action(() => curProgressDialog.SetCurrentState(newStatus)));
|
||||||
|
}
|
||||||
|
|
||||||
|
private void MyUpdateClient_DownloadingUpdate(UpdatePackageInfo pkg, CancelEventArgs e)
|
||||||
|
{
|
||||||
|
curProgressDialog?.Invoke(new Action(() => curProgressDialog.Hide()));
|
||||||
|
var dres = default(DialogResult);
|
||||||
|
parentForm.Invoke(new Action(() =>
|
||||||
|
{
|
||||||
|
var dialog = new UpdatesAvailableDialog(MyAppIcon, UpdateClient.CurrentVersion.Version.ToString(), UpdateClient.CurrentVersion.Channel.ToString(), Conversions.ToString(UpdateClient.CurrentVersion.Build), pkg.Version.Version.ToString(), pkg.Version.Channel.ToString(), Conversions.ToString(pkg.Version.Build), pkg.Notes, UpdateClient.InstallAsAdmin);
|
||||||
|
dres = dialog.ShowDialog(parentForm);
|
||||||
|
}));
|
||||||
|
if (dres != DialogResult.OK)
|
||||||
|
{
|
||||||
|
e.Cancel = true;
|
||||||
|
EndUpdating();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
e.Cancel = false;
|
||||||
|
curProgressDialog?.Invoke(new Action(() => curProgressDialog.Show()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void MyUpdateClient_InstallingUpdate(UpdatePackageInfo pkg, CancelEventArgs e)
|
||||||
|
{
|
||||||
|
e.Cancel = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void MyUpdateClient_FinishWork()
|
||||||
|
{
|
||||||
|
EndUpdating();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void MyUpdateClient_NoUpdatesFound()
|
||||||
|
{
|
||||||
|
EndUpdating();
|
||||||
|
if (!UseHiddenSearch)
|
||||||
|
{
|
||||||
|
RadMessageBox.Show(UpdatingClientGuiLangRes.MsgBox_NoUpdatesFound, UpdatingClientGuiLangRes.MsgBox_NoUpdatesFound_Titel, MessageBoxButtons.OK, RadMessageIcon.Info);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,57 +1,55 @@
|
|||||||
using System.Drawing;
|
using Pilz.Updating.GUIBase;
|
||||||
|
using System.Drawing;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using Pilz.Updating.GUIBase;
|
|
||||||
using Telerik.WinControls;
|
|
||||||
using Telerik.WinControls.UI;
|
using Telerik.WinControls.UI;
|
||||||
|
|
||||||
namespace Pilz.Updating.Client.GUI
|
namespace Pilz.Updating.Client.GUI;
|
||||||
|
|
||||||
|
internal partial class UpdatesAvailableDialog
|
||||||
{
|
{
|
||||||
internal partial class UpdatesAvailableDialog
|
public UpdatesAvailableDialog(Image appIcon, string curVersion, string curChannel, string curBuild, string newVersion, string newChannel, string newBuild, UpdateNotes updateNotes, bool installAsAdmin)
|
||||||
{
|
{
|
||||||
public UpdatesAvailableDialog(Image appIcon, string curVersion, string curChannel, string curBuild, string newVersion, string newChannel, string newBuild, UpdateNotes updateNotes, bool installAsAdmin)
|
InitializeComponent();
|
||||||
|
|
||||||
|
if (installAsAdmin)
|
||||||
|
radButton_Install.Image = BaseFeatures.GetUacShieldImage();
|
||||||
|
|
||||||
|
radPictureBox1.Image = appIcon ?? Icon.ToBitmap();
|
||||||
|
radLabel_CurrentVersion.Text = curVersion;
|
||||||
|
radLabel_CurrentVersionChannel.Text = curChannel;
|
||||||
|
radLabel_CurrentVersionBuild.Text = curBuild;
|
||||||
|
radLabel_AvailableVersion.Text = newVersion;
|
||||||
|
radLabel_AvailableVersionChannel.Text = newChannel;
|
||||||
|
radLabel_AvailableVersionBuild.Text = newBuild;
|
||||||
|
|
||||||
|
// Update Notes
|
||||||
|
Control updateNotesControl = null;
|
||||||
|
switch (updateNotes.ContentType)
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
case UpdateNotesContentType.PlainText:
|
||||||
|
var newUpdateNotesControl = new RadRichTextEditor
|
||||||
if (installAsAdmin)
|
{
|
||||||
radButton_Install.Image = BaseFeatures.GetUacShieldImage();
|
Text = updateNotes.Content
|
||||||
|
};
|
||||||
radPictureBox1.Image = appIcon ?? Icon.ToBitmap();
|
updateNotesControl = newUpdateNotesControl;
|
||||||
radLabel_CurrentVersion.Text = curVersion;
|
break;
|
||||||
radLabel_CurrentVersionChannel.Text = curChannel;
|
case UpdateNotesContentType.Markdown:
|
||||||
radLabel_CurrentVersionBuild.Text = curBuild;
|
updateNotesControl = new Westermo.HtmlRenderer.WinForms.HtmlPanel
|
||||||
radLabel_AvailableVersion.Text = newVersion;
|
{
|
||||||
radLabel_AvailableVersionChannel.Text = newChannel;
|
Text = Markdig.Markdown.ToHtml(updateNotes.Content)
|
||||||
radLabel_AvailableVersionBuild.Text = newBuild;
|
};
|
||||||
|
break;
|
||||||
// Update Notes
|
case UpdateNotesContentType.HTML:
|
||||||
Control updateNotesControl = null;
|
updateNotesControl = new Westermo.HtmlRenderer.WinForms.HtmlPanel
|
||||||
switch (updateNotes.ContentType)
|
{
|
||||||
{
|
Text = updateNotes.Content
|
||||||
case UpdateNotesContentType.PlainText:
|
};
|
||||||
var newUpdateNotesControl = new RadRichTextEditor
|
break;
|
||||||
{
|
}
|
||||||
Text = updateNotes.Content
|
if (updateNotesControl is not null)
|
||||||
};
|
{
|
||||||
updateNotesControl = newUpdateNotesControl;
|
updateNotesControl.Dock = DockStyle.Fill;
|
||||||
break;
|
panel_ChangelogPanel.Controls.Add(updateNotesControl);
|
||||||
case UpdateNotesContentType.Markdown:
|
|
||||||
updateNotesControl = new Westermo.HtmlRenderer.WinForms.HtmlPanel
|
|
||||||
{
|
|
||||||
Text = Markdig.Markdown.ToHtml(updateNotes.Content)
|
|
||||||
};
|
|
||||||
break;
|
|
||||||
case UpdateNotesContentType.HTML:
|
|
||||||
updateNotesControl = new Westermo.HtmlRenderer.WinForms.HtmlPanel
|
|
||||||
{
|
|
||||||
Text = updateNotes.Content
|
|
||||||
};
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (updateNotesControl is not null)
|
|
||||||
{
|
|
||||||
updateNotesControl.Dock = DockStyle.Fill;
|
|
||||||
panel_ChangelogPanel.Controls.Add(updateNotesControl);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<RootNamespace>Pilz.Updating</RootNamespace>
|
<RootNamespace>Pilz.Updating</RootNamespace>
|
||||||
<TargetFrameworks>net6.0-windows;net8.0-windows</TargetFrameworks>
|
<TargetFrameworks>net8.0-windows</TargetFrameworks>
|
||||||
<DefaultItemExcludes>$(DefaultItemExcludes);$(ProjectDir)**\*.vb</DefaultItemExcludes>
|
<DefaultItemExcludes>$(DefaultItemExcludes);$(ProjectDir)**\*.vb</DefaultItemExcludes>
|
||||||
<LangVersion>latest</LangVersion>
|
<LangVersion>latest</LangVersion>
|
||||||
<AssemblyTitle>Pilz.Updating.Client</AssemblyTitle>
|
<AssemblyTitle>Pilz.Updating.Client</AssemblyTitle>
|
||||||
@@ -11,7 +11,6 @@
|
|||||||
<DocumentationFile>Pilz.Updating.Client.xml</DocumentationFile>
|
<DocumentationFile>Pilz.Updating.Client.xml</DocumentationFile>
|
||||||
<DefineTrace>true</DefineTrace>
|
<DefineTrace>true</DefineTrace>
|
||||||
<NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022,CS1591,CS0660,CS0661,CS0436</NoWarn>
|
<NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022,CS1591,CS0660,CS0661,CS0436</NoWarn>
|
||||||
<UseWindowsForms>true</UseWindowsForms>
|
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||||
<DefineDebug>true</DefineDebug>
|
<DefineDebug>true</DefineDebug>
|
||||||
@@ -37,7 +36,6 @@
|
|||||||
<DefineConstants>TRACE;RelMono</DefineConstants>
|
<DefineConstants>TRACE;RelMono</DefineConstants>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
|
|
||||||
<Version>2.0.0</Version>
|
<Version>2.0.0</Version>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
using global::System;
|
using global::System;
|
||||||
using global::System.Reflection;
|
|
||||||
using global::System.Runtime.InteropServices;
|
using global::System.Runtime.InteropServices;
|
||||||
[assembly: ComVisible(false)]
|
[assembly: ComVisible(false)]
|
||||||
|
|
||||||
|
|||||||
@@ -1,267 +1,261 @@
|
|||||||
using System;
|
using Microsoft.VisualBasic.CompilerServices;
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Drawing;
|
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.IO.Compression;
|
using System.IO.Compression;
|
||||||
using System.IO.Pipes;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Net;
|
|
||||||
using System.Net.Http;
|
using System.Net.Http;
|
||||||
using System.Reflection;
|
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Microsoft.VisualBasic.CompilerServices;
|
|
||||||
using Pilz.Updating.UpdateInstaller;
|
|
||||||
|
|
||||||
namespace Pilz.Updating
|
namespace Pilz.Updating;
|
||||||
|
|
||||||
|
public class UpdateClient
|
||||||
{
|
{
|
||||||
public class UpdateClient
|
|
||||||
|
// E b v e n t s
|
||||||
|
|
||||||
|
public event UpdateStatusChangedEventHandler UpdateStatusChanged;
|
||||||
|
|
||||||
|
public delegate void UpdateStatusChangedEventHandler(UpdateStatus newStatus);
|
||||||
|
|
||||||
|
public event DownloadingUpdateEventHandler DownloadingUpdate;
|
||||||
|
|
||||||
|
public delegate void DownloadingUpdateEventHandler(UpdatePackageInfo pkg, CancelEventArgs e);
|
||||||
|
|
||||||
|
public event InstallingUpdateEventHandler InstallingUpdate;
|
||||||
|
|
||||||
|
public delegate void InstallingUpdateEventHandler(UpdatePackageInfo pkg, CancelEventArgs e);
|
||||||
|
|
||||||
|
public event UpdateInstallerStartedEventHandler UpdateInstallerStarted;
|
||||||
|
|
||||||
|
public delegate void UpdateInstallerStartedEventHandler();
|
||||||
|
|
||||||
|
public event NoUpdatesFoundEventHandler NoUpdatesFound;
|
||||||
|
|
||||||
|
public delegate void NoUpdatesFoundEventHandler();
|
||||||
|
|
||||||
|
// F i e l d s
|
||||||
|
|
||||||
|
private readonly Dictionary<UpdatePackageInfo, string> dicPackagePaths = [];
|
||||||
|
private UpdateStatus curDownloadingStatus = UpdateStatus.Waiting;
|
||||||
|
|
||||||
|
// P r o p e r t i e s
|
||||||
|
|
||||||
|
public HttpClient WebClient { get; private set; } = new();
|
||||||
|
public string UpdateUrl { get; private set; }
|
||||||
|
public ApplicationVersion CurrentVersion { get; private set; }
|
||||||
|
public Channels MinimumChannel { get; private set; }
|
||||||
|
public UpdateInfo UpdateInfo { get; private set; } = null;
|
||||||
|
public UpdatePackageInfo UpdatePackageInfo { get; private set; } = null;
|
||||||
|
public bool AutoCloseHostApplication { get; set; } = false;
|
||||||
|
public bool AutoRestartHostApplication { get; set; } = false;
|
||||||
|
public string RestartHostApplicationArguments { get; set; }
|
||||||
|
public string HostApplicationPath { get; set; } = string.Empty;
|
||||||
|
public string ApplicationName { get; set; } = string.Empty;
|
||||||
|
public bool InstallAsAdmin { get; set; } = false;
|
||||||
|
public uint MillisecondsToWaitForHostApplicationToClose { get; set; } = 10000;
|
||||||
|
public bool ForceClosingHostApplication { get; set; } = true;
|
||||||
|
public bool UIDarkMode { get; set; } = false;
|
||||||
|
|
||||||
|
// C o n s t r u c t o r s
|
||||||
|
|
||||||
|
public UpdateClient(string updateUrl, ApplicationVersion currentVersion, Channels minimumChannel)
|
||||||
{
|
{
|
||||||
|
UpdateUrl = updateUrl;
|
||||||
|
CurrentVersion = currentVersion;
|
||||||
|
MinimumChannel = (Channels)Math.Max((int)minimumChannel, (int)currentVersion.Channel);
|
||||||
|
}
|
||||||
|
|
||||||
// E b v e n t s
|
// E v e n t M e t h o d s
|
||||||
|
|
||||||
public event UpdateStatusChangedEventHandler UpdateStatusChanged;
|
private bool RaiseDownloadingUpdate(UpdatePackageInfo pkg)
|
||||||
|
{
|
||||||
|
var e = new CancelEventArgs(false);
|
||||||
|
DownloadingUpdate?.Invoke(pkg, e);
|
||||||
|
return e.Cancel;
|
||||||
|
}
|
||||||
|
|
||||||
public delegate void UpdateStatusChangedEventHandler(UpdateStatus newStatus);
|
private bool RaiseInstallingUpdate(UpdatePackageInfo pkg)
|
||||||
|
{
|
||||||
|
var e = new CancelEventArgs(true);
|
||||||
|
InstallingUpdate?.Invoke(pkg, e);
|
||||||
|
return e.Cancel;
|
||||||
|
}
|
||||||
|
|
||||||
public event DownloadingUpdateEventHandler DownloadingUpdate;
|
// U p d a t e R o u t i n e s
|
||||||
|
|
||||||
public delegate void DownloadingUpdateEventHandler(UpdatePackageInfo pkg, CancelEventArgs e);
|
public async Task UpdateInteractive()
|
||||||
|
{
|
||||||
|
var latestVersion = await CheckForUpdate();
|
||||||
|
if (latestVersion is null)
|
||||||
|
NoUpdatesFound?.Invoke();
|
||||||
|
else
|
||||||
|
await UpdateInteractive(latestVersion);
|
||||||
|
}
|
||||||
|
|
||||||
public event InstallingUpdateEventHandler InstallingUpdate;
|
public async Task UpdateInteractive(UpdatePackageInfo package)
|
||||||
|
{
|
||||||
public delegate void InstallingUpdateEventHandler(UpdatePackageInfo pkg, CancelEventArgs e);
|
if (!RaiseDownloadingUpdate(package) && await DownloadPackageAsync(package))
|
||||||
|
|
||||||
public event UpdateInstallerStartedEventHandler UpdateInstallerStarted;
|
|
||||||
|
|
||||||
public delegate void UpdateInstallerStartedEventHandler();
|
|
||||||
|
|
||||||
public event NoUpdatesFoundEventHandler NoUpdatesFound;
|
|
||||||
|
|
||||||
public delegate void NoUpdatesFoundEventHandler();
|
|
||||||
|
|
||||||
// F i e l d s
|
|
||||||
|
|
||||||
private readonly Dictionary<UpdatePackageInfo, string> dicPackagePaths = new Dictionary<UpdatePackageInfo, string>();
|
|
||||||
private UpdateStatus curDownloadingStatus = UpdateStatus.Waiting;
|
|
||||||
|
|
||||||
// P r o p e r t i e s
|
|
||||||
|
|
||||||
public HttpClient WebClient { get; private set; } = new();
|
|
||||||
public string UpdateUrl { get; private set; }
|
|
||||||
public ApplicationVersion CurrentVersion { get; private set; }
|
|
||||||
public Channels MinimumChannel { get; private set; }
|
|
||||||
public UpdateInfo UpdateInfo { get; private set; } = null;
|
|
||||||
public UpdatePackageInfo UpdatePackageInfo { get; private set; } = null;
|
|
||||||
public bool AutoCloseHostApplication { get; set; } = false;
|
|
||||||
public bool AutoRestartHostApplication { get; set; } = false;
|
|
||||||
public string RestartHostApplicationArguments { get; set; }
|
|
||||||
public string HostApplicationPath { get; set; } = string.Empty;
|
|
||||||
public string ApplicationName { get; set; } = string.Empty;
|
|
||||||
public bool InstallAsAdmin { get; set; } = false;
|
|
||||||
public uint MillisecondsToWaitForHostApplicationToClose { get; set; } = 10000;
|
|
||||||
public bool ForceClosingHostApplication { get; set; } = true;
|
|
||||||
public bool UIDarkMode { get; set; } = false;
|
|
||||||
|
|
||||||
// C o n s t r u c t o r s
|
|
||||||
|
|
||||||
public UpdateClient(string updateUrl, ApplicationVersion currentVersion, Channels minimumChannel)
|
|
||||||
{
|
{
|
||||||
UpdateUrl = updateUrl;
|
if (!RaiseInstallingUpdate(package))
|
||||||
CurrentVersion = currentVersion;
|
await InstallPackage(package);
|
||||||
MinimumChannel = (Channels)Math.Max((int)minimumChannel, (int)currentVersion.Channel);
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// E v e n t M e t h o d s
|
public void RaiseUpdateStatusChanged(UpdateStatus newStatus)
|
||||||
|
{
|
||||||
|
UpdateStatusChanged?.Invoke(newStatus);
|
||||||
|
}
|
||||||
|
|
||||||
private bool RaiseDownloadingUpdate(UpdatePackageInfo pkg)
|
// F e a t u r e s
|
||||||
|
|
||||||
|
public async Task<UpdateInfo> GetUpdateInfo()
|
||||||
|
{
|
||||||
|
string str = await WebClient.GetStringAsync(UpdateUrl);
|
||||||
|
var info = UpdateInfo.Parse(str);
|
||||||
|
return info;
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<UpdatePackageInfo> CheckForUpdate()
|
||||||
|
{
|
||||||
|
RaiseUpdateStatusChanged(UpdateStatus.Searching);
|
||||||
|
UpdateInfo = await GetUpdateInfo();
|
||||||
|
if (UpdateInfo is not null)
|
||||||
|
return CheckForUpdate(UpdateInfo);
|
||||||
|
else
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public UpdatePackageInfo CheckForUpdate(UpdateInfo updateInfo)
|
||||||
|
{
|
||||||
|
UpdatePackageInfo foundPkgInfo = null;
|
||||||
|
var latestVersion = CurrentVersion;
|
||||||
|
RaiseUpdateStatusChanged(UpdateStatus.Searching);
|
||||||
|
foreach (UpdatePackageInfo pkgInfo in updateInfo.Packages)
|
||||||
{
|
{
|
||||||
var e = new CancelEventArgs(false);
|
if (pkgInfo.Version.Channel <= MinimumChannel && pkgInfo.Version > latestVersion)
|
||||||
DownloadingUpdate?.Invoke(pkg, e);
|
|
||||||
return e.Cancel;
|
|
||||||
}
|
|
||||||
|
|
||||||
private bool RaiseInstallingUpdate(UpdatePackageInfo pkg)
|
|
||||||
{
|
|
||||||
var e = new CancelEventArgs(true);
|
|
||||||
InstallingUpdate?.Invoke(pkg, e);
|
|
||||||
return e.Cancel;
|
|
||||||
}
|
|
||||||
|
|
||||||
// U p d a t e R o u t i n e s
|
|
||||||
|
|
||||||
public async Task UpdateInteractive()
|
|
||||||
{
|
|
||||||
var latestVersion = await CheckForUpdate();
|
|
||||||
if (latestVersion is null)
|
|
||||||
NoUpdatesFound?.Invoke();
|
|
||||||
else
|
|
||||||
await UpdateInteractive(latestVersion);
|
|
||||||
}
|
|
||||||
|
|
||||||
public async Task UpdateInteractive(UpdatePackageInfo package)
|
|
||||||
{
|
|
||||||
if (!RaiseDownloadingUpdate(package) && await DownloadPackageAsync(package))
|
|
||||||
{
|
{
|
||||||
if (!RaiseInstallingUpdate(package))
|
foundPkgInfo = pkgInfo;
|
||||||
await InstallPackage(package);
|
latestVersion = pkgInfo.Version;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void RaiseUpdateStatusChanged(UpdateStatus newStatus)
|
UpdatePackageInfo = foundPkgInfo;
|
||||||
|
return foundPkgInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<bool> DownloadPackageAsync(UpdatePackageInfo package)
|
||||||
|
{
|
||||||
|
curDownloadingStatus = UpdateStatus.DownloadingPackage;
|
||||||
|
RaiseUpdateStatusChanged(curDownloadingStatus);
|
||||||
|
string dirPath = Path.Combine(MyPaths.GetMyAppDataPath(), Conversions.ToString(package.GetHashCode()));
|
||||||
|
string zipPath = Path.Combine(dirPath, PackageFileNameDefinations.ZIP_PACKAGE_FILENAME);
|
||||||
|
var dir = new DirectoryInfo(dirPath);
|
||||||
|
try
|
||||||
{
|
{
|
||||||
UpdateStatusChanged?.Invoke(newStatus);
|
// Ensure existing and empty directory for the Zip File
|
||||||
|
if (dir.Exists)
|
||||||
|
dir.Delete(true);
|
||||||
|
|
||||||
|
dir.Create();
|
||||||
|
|
||||||
|
// Download zip package
|
||||||
|
using var zipFile = new FileStream(zipPath, FileMode.Create, FileAccess.ReadWrite);
|
||||||
|
using var zipStream = await WebClient.GetStreamAsync(package.Packagelink);
|
||||||
|
await zipStream.CopyToAsync(zipFile);
|
||||||
|
|
||||||
|
// Remember path to package directory
|
||||||
|
dicPackagePaths.Add(package, dirPath);
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// F e a t u r e s
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
public async Task<UpdateInfo> GetUpdateInfo()
|
private async Task<FileInfo> DownloadUpdateInstaller()
|
||||||
|
{
|
||||||
|
curDownloadingStatus = UpdateStatus.DownloadingInstaller;
|
||||||
|
RaiseUpdateStatusChanged(curDownloadingStatus);
|
||||||
|
|
||||||
|
// Ensure update installer path is empty
|
||||||
|
var installerDirPath = new DirectoryInfo(Path.Combine(MyPaths.GetMyAppDataPath(), "UpdateInstallerTool"));
|
||||||
|
if (installerDirPath.Exists)
|
||||||
|
installerDirPath.Delete(true);
|
||||||
|
|
||||||
|
await Task.Delay(100);
|
||||||
|
installerDirPath.Create();
|
||||||
|
await Task.Delay(100);
|
||||||
|
|
||||||
|
// Download update installer zip
|
||||||
|
var installerZipPath = Path.Combine(installerDirPath.FullName, "UpdatenInstaller.zip");
|
||||||
|
using (var installerZipFile = new FileStream(installerZipPath, FileMode.Create, FileAccess.ReadWrite))
|
||||||
{
|
{
|
||||||
string str = await WebClient.GetStringAsync(UpdateUrl);
|
using var installerZipStream = await WebClient.GetStreamAsync(UpdateInfo.UpdateInstallerLink);
|
||||||
var info = UpdateInfo.Parse(str);
|
await installerZipStream.CopyToAsync(installerZipFile);
|
||||||
return info;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<UpdatePackageInfo> CheckForUpdate()
|
// Extract update installer
|
||||||
|
var installerExtractPath = installerDirPath.CreateSubdirectory("extracted");
|
||||||
|
ZipFile.ExtractToDirectory(installerZipPath, installerExtractPath.FullName);
|
||||||
|
File.Delete(installerZipPath);
|
||||||
|
|
||||||
|
// Get UpdateInstaller.exe file
|
||||||
|
return installerExtractPath.EnumerateFiles("*.exe").FirstOrDefault();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void StartUpdateInstaller(string packagePath, string installerPath)
|
||||||
|
{
|
||||||
|
RaiseUpdateStatusChanged(UpdateStatus.StartingInstaller);
|
||||||
|
|
||||||
|
// Create update settings
|
||||||
|
var myAppPath = IO.Extensions.GetExecutablePath();
|
||||||
|
var updateConfig = new UpdateInstallerConfig
|
||||||
{
|
{
|
||||||
RaiseUpdateStatusChanged(UpdateStatus.Searching);
|
PackagePath = packagePath,
|
||||||
UpdateInfo = await GetUpdateInfo();
|
RestartHostApplication = AutoRestartHostApplication,
|
||||||
if (UpdateInfo is not null)
|
RestartHostApplicationArguments = AutoRestartHostApplication ? RestartHostApplicationArguments : string.Empty,
|
||||||
return CheckForUpdate(UpdateInfo);
|
ApplicationName = ApplicationName,
|
||||||
else
|
HostApplicationPath = string.IsNullOrEmpty(HostApplicationPath) ? Path.GetDirectoryName(myAppPath) : HostApplicationPath,
|
||||||
return null;
|
HostApplicationProcessPath = myAppPath,
|
||||||
}
|
MillisecondsToWaitForHostApplicationToClose = MillisecondsToWaitForHostApplicationToClose,
|
||||||
|
ForceClosingHostApplication = ForceClosingHostApplication,
|
||||||
|
UIDarkMode = UIDarkMode
|
||||||
|
};
|
||||||
|
|
||||||
public UpdatePackageInfo CheckForUpdate(UpdateInfo updateInfo)
|
// Start UpdateInstaller
|
||||||
|
var procStartInfo = new ProcessStartInfo
|
||||||
{
|
{
|
||||||
UpdatePackageInfo foundPkgInfo = null;
|
FileName = installerPath,
|
||||||
var latestVersion = CurrentVersion;
|
Arguments = updateConfig.ToString(),
|
||||||
RaiseUpdateStatusChanged(UpdateStatus.Searching);
|
UseShellExecute = false,
|
||||||
foreach (UpdatePackageInfo pkgInfo in updateInfo.Packages)
|
Verb = InstallAsAdmin ? "runas" : string.Empty
|
||||||
{
|
};
|
||||||
if (pkgInfo.Version.Channel <= MinimumChannel && pkgInfo.Version > latestVersion)
|
Process.Start(procStartInfo);
|
||||||
{
|
UpdateInstallerStarted?.Invoke();
|
||||||
foundPkgInfo = pkgInfo;
|
}
|
||||||
latestVersion = pkgInfo.Version;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
UpdatePackageInfo = foundPkgInfo;
|
public async Task<bool> InstallPackage(UpdatePackageInfo package)
|
||||||
return foundPkgInfo;
|
{
|
||||||
}
|
if (dicPackagePaths.TryGetValue(package, out var packagePath))
|
||||||
|
|
||||||
public async Task<bool> DownloadPackageAsync(UpdatePackageInfo package)
|
|
||||||
{
|
{
|
||||||
curDownloadingStatus = UpdateStatus.DownloadingPackage;
|
// Download update installer
|
||||||
RaiseUpdateStatusChanged(curDownloadingStatus);
|
var installerPath = await DownloadUpdateInstaller();
|
||||||
string dirPath = Path.Combine(MyPaths.GetMyAppDataPath(), Conversions.ToString(package.GetHashCode()));
|
|
||||||
string zipPath = Path.Combine(dirPath, PackageFileNameDefinations.ZIP_PACKAGE_FILENAME);
|
|
||||||
var dir = new DirectoryInfo(dirPath);
|
|
||||||
try
|
|
||||||
{
|
|
||||||
// Ensure existing and empty directory for the Zip File
|
|
||||||
if (dir.Exists)
|
|
||||||
dir.Delete(true);
|
|
||||||
|
|
||||||
dir.Create();
|
// Start update installer
|
||||||
|
StartUpdateInstaller(packagePath, installerPath.FullName);
|
||||||
|
|
||||||
// Download zip package
|
// Close Host Application
|
||||||
using var zipFile = new FileStream(zipPath, FileMode.Create, FileAccess.ReadWrite);
|
if (AutoCloseHostApplication)
|
||||||
using var zipStream = await WebClient.GetStreamAsync(package.Packagelink);
|
Environment.Exit(Environment.ExitCode);
|
||||||
await zipStream.CopyToAsync(zipFile);
|
|
||||||
|
|
||||||
// Remember path to package directory
|
|
||||||
dicPackagePaths.Add(package, dirPath);
|
|
||||||
}
|
|
||||||
catch (Exception)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task<FileInfo> DownloadUpdateInstaller()
|
return false;
|
||||||
{
|
|
||||||
curDownloadingStatus = UpdateStatus.DownloadingInstaller;
|
|
||||||
RaiseUpdateStatusChanged(curDownloadingStatus);
|
|
||||||
|
|
||||||
// Ensure update installer path is empty
|
|
||||||
var installerDirPath = new DirectoryInfo(Path.Combine(MyPaths.GetMyAppDataPath(), "UpdateInstallerTool"));
|
|
||||||
if (installerDirPath.Exists)
|
|
||||||
installerDirPath.Delete(true);
|
|
||||||
|
|
||||||
await Task.Delay(100);
|
|
||||||
installerDirPath.Create();
|
|
||||||
await Task.Delay(100);
|
|
||||||
|
|
||||||
// Download update installer zip
|
|
||||||
var installerZipPath = Path.Combine(installerDirPath.FullName, "UpdatenInstaller.zip");
|
|
||||||
using (var installerZipFile = new FileStream(installerZipPath, FileMode.Create, FileAccess.ReadWrite))
|
|
||||||
{
|
|
||||||
using var installerZipStream = await WebClient.GetStreamAsync(UpdateInfo.UpdateInstallerLink);
|
|
||||||
await installerZipStream.CopyToAsync(installerZipFile);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Extract update installer
|
|
||||||
var installerExtractPath = installerDirPath.CreateSubdirectory("extracted");
|
|
||||||
ZipFile.ExtractToDirectory(installerZipPath, installerExtractPath.FullName);
|
|
||||||
File.Delete(installerZipPath);
|
|
||||||
|
|
||||||
// Get UpdateInstaller.exe file
|
|
||||||
return installerExtractPath.EnumerateFiles("*.exe").FirstOrDefault();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void StartUpdateInstaller(string packagePath, string installerPath)
|
|
||||||
{
|
|
||||||
RaiseUpdateStatusChanged(UpdateStatus.StartingInstaller);
|
|
||||||
|
|
||||||
// Create update settings
|
|
||||||
var myAppPath = IO.Extensions.GetExecutablePath();
|
|
||||||
var updateConfig = new UpdateInstallerConfig
|
|
||||||
{
|
|
||||||
PackagePath = packagePath,
|
|
||||||
RestartHostApplication = AutoRestartHostApplication,
|
|
||||||
RestartHostApplicationArguments = AutoRestartHostApplication ? RestartHostApplicationArguments : string.Empty,
|
|
||||||
ApplicationName = ApplicationName,
|
|
||||||
HostApplicationPath = string.IsNullOrEmpty(HostApplicationPath) ? Path.GetDirectoryName(myAppPath) : HostApplicationPath,
|
|
||||||
HostApplicationProcessPath = myAppPath,
|
|
||||||
MillisecondsToWaitForHostApplicationToClose = MillisecondsToWaitForHostApplicationToClose,
|
|
||||||
ForceClosingHostApplication = ForceClosingHostApplication,
|
|
||||||
UIDarkMode = UIDarkMode
|
|
||||||
};
|
|
||||||
|
|
||||||
// Start UpdateInstaller
|
|
||||||
var procStartInfo = new ProcessStartInfo
|
|
||||||
{
|
|
||||||
FileName = installerPath,
|
|
||||||
Arguments = updateConfig.ToString(),
|
|
||||||
UseShellExecute = false,
|
|
||||||
Verb = InstallAsAdmin ? "runas" : string.Empty
|
|
||||||
};
|
|
||||||
Process.Start(procStartInfo);
|
|
||||||
UpdateInstallerStarted?.Invoke();
|
|
||||||
}
|
|
||||||
|
|
||||||
public async Task<bool> InstallPackage(UpdatePackageInfo package)
|
|
||||||
{
|
|
||||||
if (dicPackagePaths.TryGetValue(package, out var packagePath))
|
|
||||||
{
|
|
||||||
// Download update installer
|
|
||||||
var installerPath = await DownloadUpdateInstaller();
|
|
||||||
|
|
||||||
// Start update installer
|
|
||||||
StartUpdateInstaller(packagePath, installerPath.FullName);
|
|
||||||
|
|
||||||
// Close Host Application
|
|
||||||
if (AutoCloseHostApplication)
|
|
||||||
Environment.Exit(Environment.ExitCode);
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,11 +1,10 @@
|
|||||||
namespace Pilz.Updating
|
namespace Pilz.Updating;
|
||||||
|
|
||||||
|
public enum UpdateStatus
|
||||||
{
|
{
|
||||||
public enum UpdateStatus
|
Waiting,
|
||||||
{
|
Searching,
|
||||||
Waiting,
|
DownloadingPackage,
|
||||||
Searching,
|
DownloadingInstaller,
|
||||||
DownloadingPackage,
|
StartingInstaller
|
||||||
DownloadingInstaller,
|
|
||||||
StartingInstaller
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -1,113 +1,114 @@
|
|||||||
using System;
|
using System.Drawing;
|
||||||
using global::System.Drawing;
|
using System.Runtime.InteropServices;
|
||||||
using global::System.Runtime.InteropServices;
|
using System;
|
||||||
using global::System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
|
|
||||||
namespace Pilz.Updating.GUIBase
|
namespace Pilz.Updating.GUIBase;
|
||||||
|
|
||||||
|
internal static class BaseFeatures
|
||||||
{
|
{
|
||||||
internal static class BaseFeatures
|
[DllImport("user32")]
|
||||||
|
private static extern uint SendMessage(IntPtr hWnd, uint msg, uint wParam, uint lParam);
|
||||||
|
|
||||||
|
private const int BCM_FIRST = 0x1600; // Normal button
|
||||||
|
private const int BCM_SETSHIELD = BCM_FIRST + 0xC; // Elevated button
|
||||||
|
|
||||||
|
public static void AddShieldToButton(Button b)
|
||||||
{
|
{
|
||||||
[DllImport("user32")]
|
b.FlatStyle = FlatStyle.System;
|
||||||
private static extern uint SendMessage(IntPtr hWnd, uint msg, uint wParam, uint lParam);
|
SendMessage(b.Handle, BCM_SETSHIELD, 0, 0xFFFFFFFFU);
|
||||||
|
}
|
||||||
|
|
||||||
private const int BCM_FIRST = 0x1600; // Normal button
|
// Return a bitmap containing the UAC shield.
|
||||||
private const int BCM_SETSHIELD = BCM_FIRST + 0xC; // Elevated button
|
private static Bitmap shield_bm = null;
|
||||||
|
|
||||||
public static void AddShieldToButton(Button b)
|
public static Bitmap GetUacShieldImage()
|
||||||
|
{
|
||||||
|
if (shield_bm is object)
|
||||||
{
|
{
|
||||||
b.FlatStyle = FlatStyle.System;
|
|
||||||
SendMessage(b.Handle, BCM_SETSHIELD, 0, 0xFFFFFFFFU);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Return a bitmap containing the UAC shield.
|
|
||||||
private static Bitmap shield_bm = null;
|
|
||||||
|
|
||||||
public static Bitmap GetUacShieldImage()
|
|
||||||
{
|
|
||||||
if (shield_bm is object)
|
|
||||||
{
|
|
||||||
return shield_bm;
|
|
||||||
}
|
|
||||||
|
|
||||||
const int WID = 50;
|
|
||||||
const int HGT = 50;
|
|
||||||
const int MARGIN = 4;
|
|
||||||
|
|
||||||
// Make the button. For some reason, it must
|
|
||||||
// have text or the UAC shield won't appear.
|
|
||||||
var btn = new Button();
|
|
||||||
btn.Text = " ";
|
|
||||||
btn.Size = new Size(WID, HGT);
|
|
||||||
AddShieldToButton(btn);
|
|
||||||
|
|
||||||
// Draw the button onto a bitmap.
|
|
||||||
var bm = new Bitmap(WID, HGT);
|
|
||||||
btn.Refresh();
|
|
||||||
btn.DrawToBitmap(bm, new Rectangle(0, 0, WID, HGT));
|
|
||||||
|
|
||||||
// Find the part containing the shield.
|
|
||||||
int min_x = WID;
|
|
||||||
int max_x = 0;
|
|
||||||
int min_y = HGT;
|
|
||||||
int max_y = 0;
|
|
||||||
|
|
||||||
// Fill on the left.
|
|
||||||
int y = MARGIN;
|
|
||||||
while (y < HGT - MARGIN)
|
|
||||||
{
|
|
||||||
// Get the leftmost pixel's color.
|
|
||||||
var target_color = bm.GetPixel(MARGIN, y);
|
|
||||||
|
|
||||||
// Fill in with this color as long as we see the target.
|
|
||||||
int x = MARGIN;
|
|
||||||
while (x < WID - MARGIN)
|
|
||||||
{
|
|
||||||
// See if this pixel is part of the shield.
|
|
||||||
if (bm.GetPixel(x, y).Equals(target_color))
|
|
||||||
{
|
|
||||||
// It's not part of the shield.
|
|
||||||
// Clear the pixel.
|
|
||||||
bm.SetPixel(x, y, Color.Transparent);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// It's part of the shield.
|
|
||||||
if (min_y > y)
|
|
||||||
{
|
|
||||||
min_y = y;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (min_x > x)
|
|
||||||
{
|
|
||||||
min_x = x;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (max_y < y)
|
|
||||||
{
|
|
||||||
max_y = y;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (max_x < x)
|
|
||||||
{
|
|
||||||
max_x = x;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
x += 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
y += 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Clip out the shield part.
|
|
||||||
int shield_wid = max_x - min_x + 1;
|
|
||||||
int shield_hgt = max_y - min_y + 1;
|
|
||||||
shield_bm = new Bitmap(shield_wid, shield_hgt);
|
|
||||||
var shield_gr = Graphics.FromImage(shield_bm);
|
|
||||||
shield_gr.DrawImage(bm, 0, 0, new Rectangle(min_x, min_y, shield_wid, shield_hgt), GraphicsUnit.Pixel);
|
|
||||||
|
|
||||||
// Return the shield.
|
|
||||||
return shield_bm;
|
return shield_bm;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const int WID = 50;
|
||||||
|
const int HGT = 50;
|
||||||
|
const int MARGIN = 4;
|
||||||
|
|
||||||
|
// Make the button. For some reason, it must
|
||||||
|
// have text or the UAC shield won't appear.
|
||||||
|
var btn = new Button
|
||||||
|
{
|
||||||
|
Text = " ",
|
||||||
|
Size = new Size(WID, HGT)
|
||||||
|
};
|
||||||
|
AddShieldToButton(btn);
|
||||||
|
|
||||||
|
// Draw the button onto a bitmap.
|
||||||
|
var bm = new Bitmap(WID, HGT);
|
||||||
|
btn.Refresh();
|
||||||
|
btn.DrawToBitmap(bm, new Rectangle(0, 0, WID, HGT));
|
||||||
|
|
||||||
|
// Find the part containing the shield.
|
||||||
|
int min_x = WID;
|
||||||
|
int max_x = 0;
|
||||||
|
int min_y = HGT;
|
||||||
|
int max_y = 0;
|
||||||
|
|
||||||
|
// Fill on the left.
|
||||||
|
int y = MARGIN;
|
||||||
|
while (y < HGT - MARGIN)
|
||||||
|
{
|
||||||
|
// Get the leftmost pixel's color.
|
||||||
|
var target_color = bm.GetPixel(MARGIN, y);
|
||||||
|
|
||||||
|
// Fill in with this color as long as we see the target.
|
||||||
|
int x = MARGIN;
|
||||||
|
while (x < WID - MARGIN)
|
||||||
|
{
|
||||||
|
// See if this pixel is part of the shield.
|
||||||
|
if (bm.GetPixel(x, y).Equals(target_color))
|
||||||
|
{
|
||||||
|
// It's not part of the shield.
|
||||||
|
// Clear the pixel.
|
||||||
|
bm.SetPixel(x, y, Color.Transparent);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// It's part of the shield.
|
||||||
|
if (min_y > y)
|
||||||
|
{
|
||||||
|
min_y = y;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (min_x > x)
|
||||||
|
{
|
||||||
|
min_x = x;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (max_y < y)
|
||||||
|
{
|
||||||
|
max_y = y;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (max_x < x)
|
||||||
|
{
|
||||||
|
max_x = x;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
x += 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
y += 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Clip out the shield part.
|
||||||
|
int shield_wid = max_x - min_x + 1;
|
||||||
|
int shield_hgt = max_y - min_y + 1;
|
||||||
|
shield_bm = new Bitmap(shield_wid, shield_hgt);
|
||||||
|
var shield_gr = Graphics.FromImage(shield_bm);
|
||||||
|
shield_gr.DrawImage(bm, 0, 0, new Rectangle(min_x, min_y, shield_wid, shield_hgt), GraphicsUnit.Pixel);
|
||||||
|
|
||||||
|
// Return the shield.
|
||||||
|
return shield_bm;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
// ------------------------------------------------------------------------------
|
|
||||||
// <auto-generated>
|
|
||||||
// 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.
|
|
||||||
// </auto-generated>
|
|
||||||
// ------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<MyApplicationData xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
|
|
||||||
<MySubMain>false</MySubMain>
|
|
||||||
<SingleInstance>false</SingleInstance>
|
|
||||||
<ShutdownMode>0</ShutdownMode>
|
|
||||||
<EnableVisualStyles>true</EnableVisualStyles>
|
|
||||||
<AuthenticationMode>0</AuthenticationMode>
|
|
||||||
<ApplicationType>1</ApplicationType>
|
|
||||||
<SaveMySettingsOnExit>true</SaveMySettingsOnExit>
|
|
||||||
</MyApplicationData>
|
|
||||||
@@ -1,192 +0,0 @@
|
|||||||
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
|
||||||
|
|
||||||
using System;
|
|
||||||
using System.Diagnostics;
|
|
||||||
using Microsoft.VisualBasic;
|
|
||||||
|
|
||||||
/* TODO ERROR: Skipped IfDirectiveTrivia *//* TODO ERROR: Skipped DisabledTextTrivia *//* TODO ERROR: Skipped EndIfDirectiveTrivia */
|
|
||||||
/* TODO ERROR: Skipped IfDirectiveTrivia *//* TODO ERROR: Skipped DisabledTextTrivia *//* TODO ERROR: Skipped ElifDirectiveTrivia *//* TODO ERROR: Skipped DisabledTextTrivia *//* TODO ERROR: Skipped ElifDirectiveTrivia */
|
|
||||||
/* TODO ERROR: Skipped DefineDirectiveTrivia *//* TODO ERROR: Skipped DefineDirectiveTrivia *//* TODO ERROR: Skipped DefineDirectiveTrivia *//* TODO ERROR: Skipped DefineDirectiveTrivia */
|
|
||||||
/* TODO ERROR: Skipped ElifDirectiveTrivia *//* TODO ERROR: Skipped DisabledTextTrivia *//* TODO ERROR: Skipped ElifDirectiveTrivia *//* TODO ERROR: Skipped DisabledTextTrivia *//* TODO ERROR: Skipped ElifDirectiveTrivia *//* TODO ERROR: Skipped DisabledTextTrivia *//* TODO ERROR: Skipped ElifDirectiveTrivia *//* TODO ERROR: Skipped DisabledTextTrivia *//* TODO ERROR: Skipped ElifDirectiveTrivia *//* TODO ERROR: Skipped DisabledTextTrivia *//* TODO ERROR: Skipped EndIfDirectiveTrivia */
|
|
||||||
/* TODO ERROR: Skipped IfDirectiveTrivia */
|
|
||||||
namespace Pilz.Updating.GUIBase.My
|
|
||||||
{
|
|
||||||
|
|
||||||
/* TODO ERROR: Skipped IfDirectiveTrivia */
|
|
||||||
[System.CodeDom.Compiler.GeneratedCode("MyTemplate", "11.0.0.0")]
|
|
||||||
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
|
|
||||||
|
|
||||||
/* TODO ERROR: Skipped IfDirectiveTrivia *//* TODO ERROR: Skipped DisabledTextTrivia *//* TODO ERROR: Skipped ElifDirectiveTrivia */
|
|
||||||
internal partial class MyApplication : Microsoft.VisualBasic.ApplicationServices.ApplicationBase
|
|
||||||
{
|
|
||||||
/* TODO ERROR: Skipped ElifDirectiveTrivia *//* TODO ERROR: Skipped DisabledTextTrivia *//* TODO ERROR: Skipped EndIfDirectiveTrivia */
|
|
||||||
}
|
|
||||||
|
|
||||||
/* TODO ERROR: Skipped EndIfDirectiveTrivia */
|
|
||||||
/* TODO ERROR: Skipped IfDirectiveTrivia */
|
|
||||||
[System.CodeDom.Compiler.GeneratedCode("MyTemplate", "11.0.0.0")]
|
|
||||||
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
|
|
||||||
|
|
||||||
/* TODO ERROR: Skipped IfDirectiveTrivia */
|
|
||||||
internal partial class MyComputer : Microsoft.VisualBasic.Devices.Computer
|
|
||||||
{
|
|
||||||
/* TODO ERROR: Skipped ElifDirectiveTrivia *//* TODO ERROR: Skipped DisabledTextTrivia *//* TODO ERROR: Skipped EndIfDirectiveTrivia */
|
|
||||||
[DebuggerHidden()]
|
|
||||||
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
|
|
||||||
public MyComputer() : base()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/* TODO ERROR: Skipped EndIfDirectiveTrivia */
|
|
||||||
[HideModuleName()]
|
|
||||||
[System.CodeDom.Compiler.GeneratedCode("MyTemplate", "11.0.0.0")]
|
|
||||||
internal static class MyProject
|
|
||||||
{
|
|
||||||
|
|
||||||
/* TODO ERROR: Skipped IfDirectiveTrivia */
|
|
||||||
[System.ComponentModel.Design.HelpKeyword("My.Computer")]
|
|
||||||
internal static MyComputer Computer
|
|
||||||
{
|
|
||||||
[DebuggerHidden()]
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return m_ComputerObjectProvider.GetInstance;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private readonly static ThreadSafeObjectProvider<MyComputer> m_ComputerObjectProvider = new ThreadSafeObjectProvider<MyComputer>();
|
|
||||||
/* TODO ERROR: Skipped EndIfDirectiveTrivia */
|
|
||||||
/* TODO ERROR: Skipped IfDirectiveTrivia */
|
|
||||||
[System.ComponentModel.Design.HelpKeyword("My.Application")]
|
|
||||||
internal static MyApplication Application
|
|
||||||
{
|
|
||||||
[DebuggerHidden()]
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return m_AppObjectProvider.GetInstance;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private readonly static ThreadSafeObjectProvider<MyApplication> m_AppObjectProvider = new ThreadSafeObjectProvider<MyApplication>();
|
|
||||||
/* TODO ERROR: Skipped EndIfDirectiveTrivia */
|
|
||||||
/* TODO ERROR: Skipped IfDirectiveTrivia */
|
|
||||||
[System.ComponentModel.Design.HelpKeyword("My.User")]
|
|
||||||
internal static Microsoft.VisualBasic.ApplicationServices.User User
|
|
||||||
{
|
|
||||||
[DebuggerHidden()]
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return m_UserObjectProvider.GetInstance;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private readonly static ThreadSafeObjectProvider<Microsoft.VisualBasic.ApplicationServices.User> m_UserObjectProvider = new ThreadSafeObjectProvider<Microsoft.VisualBasic.ApplicationServices.User>();
|
|
||||||
/* TODO ERROR: Skipped ElifDirectiveTrivia *//* TODO ERROR: Skipped DisabledTextTrivia *//* TODO ERROR: Skipped EndIfDirectiveTrivia */
|
|
||||||
/* TODO ERROR: Skipped IfDirectiveTrivia *//* TODO ERROR: Skipped DisabledTextTrivia *//* TODO ERROR: Skipped EndIfDirectiveTrivia */
|
|
||||||
/* TODO ERROR: Skipped IfDirectiveTrivia */
|
|
||||||
[System.ComponentModel.Design.HelpKeyword("My.WebServices")]
|
|
||||||
internal static MyWebServices WebServices
|
|
||||||
{
|
|
||||||
[DebuggerHidden()]
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return m_MyWebServicesObjectProvider.GetInstance;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
|
|
||||||
[MyGroupCollection("System.Web.Services.Protocols.SoapHttpClientProtocol", "Create__Instance__", "Dispose__Instance__", "")]
|
|
||||||
internal sealed class MyWebServices
|
|
||||||
{
|
|
||||||
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
|
|
||||||
[DebuggerHidden()]
|
|
||||||
public override bool Equals(object o)
|
|
||||||
{
|
|
||||||
return base.Equals(o);
|
|
||||||
}
|
|
||||||
|
|
||||||
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
|
|
||||||
[DebuggerHidden()]
|
|
||||||
public override int GetHashCode()
|
|
||||||
{
|
|
||||||
return base.GetHashCode();
|
|
||||||
}
|
|
||||||
|
|
||||||
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
|
|
||||||
[DebuggerHidden()]
|
|
||||||
internal new Type GetType()
|
|
||||||
{
|
|
||||||
return typeof(MyWebServices);
|
|
||||||
}
|
|
||||||
|
|
||||||
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
|
|
||||||
[DebuggerHidden()]
|
|
||||||
public override string ToString()
|
|
||||||
{
|
|
||||||
return base.ToString();
|
|
||||||
}
|
|
||||||
|
|
||||||
[DebuggerHidden()]
|
|
||||||
private static T Create__Instance__<T>(T instance) where T : new()
|
|
||||||
{
|
|
||||||
if (instance == null)
|
|
||||||
{
|
|
||||||
return new T();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return instance;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
[DebuggerHidden()]
|
|
||||||
private void Dispose__Instance__<T>(ref T instance)
|
|
||||||
{
|
|
||||||
instance = default;
|
|
||||||
}
|
|
||||||
|
|
||||||
[DebuggerHidden()]
|
|
||||||
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
|
|
||||||
public MyWebServices() : base()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private readonly static ThreadSafeObjectProvider<MyWebServices> m_MyWebServicesObjectProvider = new ThreadSafeObjectProvider<MyWebServices>();
|
|
||||||
/* TODO ERROR: Skipped EndIfDirectiveTrivia */
|
|
||||||
/* TODO ERROR: Skipped IfDirectiveTrivia *//* TODO ERROR: Skipped DisabledTextTrivia *//* TODO ERROR: Skipped EndIfDirectiveTrivia */
|
|
||||||
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
|
|
||||||
[System.Runtime.InteropServices.ComVisible(false)]
|
|
||||||
internal sealed class ThreadSafeObjectProvider<T> where T : new()
|
|
||||||
{
|
|
||||||
internal T GetInstance
|
|
||||||
{
|
|
||||||
/* TODO ERROR: Skipped IfDirectiveTrivia */
|
|
||||||
[DebuggerHidden()]
|
|
||||||
get
|
|
||||||
{
|
|
||||||
var Value = m_Context.Value;
|
|
||||||
if (Value == null)
|
|
||||||
{
|
|
||||||
Value = new T();
|
|
||||||
m_Context.Value = Value;
|
|
||||||
}
|
|
||||||
|
|
||||||
return Value;
|
|
||||||
}
|
|
||||||
/* TODO ERROR: Skipped ElseDirectiveTrivia *//* TODO ERROR: Skipped DisabledTextTrivia *//* TODO ERROR: Skipped EndIfDirectiveTrivia */
|
|
||||||
}
|
|
||||||
|
|
||||||
[DebuggerHidden()]
|
|
||||||
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
|
|
||||||
public ThreadSafeObjectProvider() : base()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/* TODO ERROR: Skipped IfDirectiveTrivia */
|
|
||||||
private readonly Microsoft.VisualBasic.MyServices.Internal.ContextValue<T> m_Context = new Microsoft.VisualBasic.MyServices.Internal.ContextValue<T>();
|
|
||||||
/* TODO ERROR: Skipped ElseDirectiveTrivia *//* TODO ERROR: Skipped DisabledTextTrivia *//* TODO ERROR: Skipped EndIfDirectiveTrivia */
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/* TODO ERROR: Skipped EndIfDirectiveTrivia */
|
|
||||||
@@ -1,253 +0,0 @@
|
|||||||
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
|
||||||
|
|
||||||
// See Compiler::LoadXmlSolutionExtension
|
|
||||||
using System.Collections;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Data;
|
|
||||||
using System.Diagnostics;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Xml.Linq;
|
|
||||||
using Microsoft.VisualBasic;
|
|
||||||
using Microsoft.VisualBasic.CompilerServices;
|
|
||||||
|
|
||||||
namespace Pilz.Updating.GUIBase.My
|
|
||||||
{
|
|
||||||
[Embedded()]
|
|
||||||
[DebuggerNonUserCode()]
|
|
||||||
[System.Runtime.CompilerServices.CompilerGenerated()]
|
|
||||||
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
|
|
||||||
internal sealed class InternalXmlHelper
|
|
||||||
{
|
|
||||||
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
|
|
||||||
private InternalXmlHelper()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public static string get_Value(IEnumerable<XElement> source)
|
|
||||||
{
|
|
||||||
foreach (XElement item in source)
|
|
||||||
return item.Value;
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void set_Value(IEnumerable<XElement> source, string value)
|
|
||||||
{
|
|
||||||
foreach (XElement item in source)
|
|
||||||
{
|
|
||||||
item.Value = value;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static string get_AttributeValue(IEnumerable<XElement> source, XName name)
|
|
||||||
{
|
|
||||||
foreach (XElement item in source)
|
|
||||||
return Conversions.ToString(item.Attribute(name));
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void set_AttributeValue(IEnumerable<XElement> source, XName name, string value)
|
|
||||||
{
|
|
||||||
foreach (XElement item in source)
|
|
||||||
{
|
|
||||||
item.SetAttributeValue(name, value);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static string get_AttributeValue(XElement source, XName name)
|
|
||||||
{
|
|
||||||
return Conversions.ToString(source.Attribute(name));
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void set_AttributeValue(XElement source, XName name, string value)
|
|
||||||
{
|
|
||||||
source.SetAttributeValue(name, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
|
|
||||||
public static XAttribute CreateAttribute(XName name, object value)
|
|
||||||
{
|
|
||||||
if (value is null)
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
return new XAttribute(name, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
|
|
||||||
public static XAttribute CreateNamespaceAttribute(XName name, XNamespace ns)
|
|
||||||
{
|
|
||||||
var a = new XAttribute(name, ns.NamespaceName);
|
|
||||||
a.AddAnnotation(ns);
|
|
||||||
return a;
|
|
||||||
}
|
|
||||||
|
|
||||||
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
|
|
||||||
public static object RemoveNamespaceAttributes(string[] inScopePrefixes, XNamespace[] inScopeNs, List<XAttribute> attributes, object obj)
|
|
||||||
{
|
|
||||||
if (obj is object)
|
|
||||||
{
|
|
||||||
XElement elem = obj as XElement;
|
|
||||||
if (elem is object)
|
|
||||||
{
|
|
||||||
return RemoveNamespaceAttributes(inScopePrefixes, inScopeNs, attributes, elem);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
IEnumerable elems = obj as IEnumerable;
|
|
||||||
if (elems is object)
|
|
||||||
{
|
|
||||||
return RemoveNamespaceAttributes(inScopePrefixes, inScopeNs, attributes, elems);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return obj;
|
|
||||||
}
|
|
||||||
|
|
||||||
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
|
|
||||||
public static IEnumerable RemoveNamespaceAttributes(string[] inScopePrefixes, XNamespace[] inScopeNs, List<XAttribute> attributes, IEnumerable obj)
|
|
||||||
{
|
|
||||||
if (obj is object)
|
|
||||||
{
|
|
||||||
IEnumerable<XElement> elems = obj as IEnumerable<XElement>;
|
|
||||||
if (elems is object)
|
|
||||||
{
|
|
||||||
return elems.Select(new RemoveNamespaceAttributesClosure(inScopePrefixes, inScopeNs, attributes).ProcessXElement);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return obj.Cast<object>().Select(new RemoveNamespaceAttributesClosure(inScopePrefixes, inScopeNs, attributes).ProcessObject);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return obj;
|
|
||||||
}
|
|
||||||
|
|
||||||
[DebuggerNonUserCode()]
|
|
||||||
[System.Runtime.CompilerServices.CompilerGenerated()]
|
|
||||||
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
|
|
||||||
private sealed class RemoveNamespaceAttributesClosure
|
|
||||||
{
|
|
||||||
private readonly string[] m_inScopePrefixes;
|
|
||||||
private readonly XNamespace[] m_inScopeNs;
|
|
||||||
private readonly List<XAttribute> m_attributes;
|
|
||||||
|
|
||||||
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
|
|
||||||
internal RemoveNamespaceAttributesClosure(string[] inScopePrefixes, XNamespace[] inScopeNs, List<XAttribute> attributes)
|
|
||||||
{
|
|
||||||
m_inScopePrefixes = inScopePrefixes;
|
|
||||||
m_inScopeNs = inScopeNs;
|
|
||||||
m_attributes = attributes;
|
|
||||||
}
|
|
||||||
|
|
||||||
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
|
|
||||||
internal XElement ProcessXElement(XElement elem)
|
|
||||||
{
|
|
||||||
return RemoveNamespaceAttributes(m_inScopePrefixes, m_inScopeNs, m_attributes, elem);
|
|
||||||
}
|
|
||||||
|
|
||||||
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
|
|
||||||
internal object ProcessObject(object obj)
|
|
||||||
{
|
|
||||||
XElement elem = obj as XElement;
|
|
||||||
if (elem is object)
|
|
||||||
{
|
|
||||||
return RemoveNamespaceAttributes(m_inScopePrefixes, m_inScopeNs, m_attributes, elem);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return obj;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
|
|
||||||
public static XElement RemoveNamespaceAttributes(string[] inScopePrefixes, XNamespace[] inScopeNs, List<XAttribute> attributes, XElement e)
|
|
||||||
{
|
|
||||||
if (e is object)
|
|
||||||
{
|
|
||||||
var a = e.FirstAttribute;
|
|
||||||
while (a is object)
|
|
||||||
{
|
|
||||||
var nextA = a.NextAttribute;
|
|
||||||
if (a.IsNamespaceDeclaration)
|
|
||||||
{
|
|
||||||
var ns = a.Annotation<XNamespace>();
|
|
||||||
string prefix = a.Name.LocalName;
|
|
||||||
if (ns is object)
|
|
||||||
{
|
|
||||||
if (inScopePrefixes is object && inScopeNs is object)
|
|
||||||
{
|
|
||||||
int lastIndex = inScopePrefixes.Length - 1;
|
|
||||||
for (int i = 0, loopTo = lastIndex; i <= loopTo; i++)
|
|
||||||
{
|
|
||||||
string currentInScopePrefix = inScopePrefixes[i];
|
|
||||||
var currentInScopeNs = inScopeNs[i];
|
|
||||||
if (prefix.Equals(currentInScopePrefix))
|
|
||||||
{
|
|
||||||
if (ns == currentInScopeNs)
|
|
||||||
{
|
|
||||||
// prefix and namespace match. Remove the unneeded ns attribute
|
|
||||||
a.Remove();
|
|
||||||
}
|
|
||||||
|
|
||||||
// prefix is in scope but refers to something else. Leave the ns attribute.
|
|
||||||
a = null;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (a is object)
|
|
||||||
{
|
|
||||||
// Prefix is not in scope
|
|
||||||
// Now check whether it's going to be in scope because it is in the attributes list
|
|
||||||
|
|
||||||
if (attributes is object)
|
|
||||||
{
|
|
||||||
int lastIndex = attributes.Count - 1;
|
|
||||||
for (int i = 0, loopTo1 = lastIndex; i <= loopTo1; i++)
|
|
||||||
{
|
|
||||||
var currentA = attributes[i];
|
|
||||||
string currentInScopePrefix = currentA.Name.LocalName;
|
|
||||||
var currentInScopeNs = currentA.Annotation<XNamespace>();
|
|
||||||
if (currentInScopeNs is object)
|
|
||||||
{
|
|
||||||
if (prefix.Equals(currentInScopePrefix))
|
|
||||||
{
|
|
||||||
if (ns == currentInScopeNs)
|
|
||||||
{
|
|
||||||
// prefix and namespace match. Remove the unneeded ns attribute
|
|
||||||
a.Remove();
|
|
||||||
}
|
|
||||||
|
|
||||||
// prefix is in scope but refers to something else. Leave the ns attribute.
|
|
||||||
a = null;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (a is object)
|
|
||||||
{
|
|
||||||
// Prefix is definitely not in scope
|
|
||||||
a.Remove();
|
|
||||||
// namespace is not defined either. Add this attributes list
|
|
||||||
attributes.Add(a);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
a = nextA;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return e;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
|
||||||
|
|
||||||
using System;
|
|
||||||
|
|
||||||
namespace Microsoft.VisualBasic
|
|
||||||
{
|
|
||||||
[Embedded()]
|
|
||||||
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Module | AttributeTargets.Assembly, Inherited = false)]
|
|
||||||
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
|
|
||||||
[System.Runtime.CompilerServices.CompilerGenerated()]
|
|
||||||
internal sealed class Embedded : Attribute
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,117 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<root>
|
|
||||||
<!--
|
|
||||||
Microsoft ResX Schema
|
|
||||||
|
|
||||||
Version 2.0
|
|
||||||
|
|
||||||
The primary goals of this format is to allow a simple XML format
|
|
||||||
that is mostly human readable. The generation and parsing of the
|
|
||||||
various data types are done through the TypeConverter classes
|
|
||||||
associated with the data types.
|
|
||||||
|
|
||||||
Example:
|
|
||||||
|
|
||||||
... ado.net/XML headers & schema ...
|
|
||||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
|
||||||
<resheader name="version">2.0</resheader>
|
|
||||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
|
||||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
|
||||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
|
||||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
|
||||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
|
||||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
|
||||||
</data>
|
|
||||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
|
||||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
|
||||||
<comment>This is a comment</comment>
|
|
||||||
</data>
|
|
||||||
|
|
||||||
There are any number of "resheader" rows that contain simple
|
|
||||||
name/value pairs.
|
|
||||||
|
|
||||||
Each data row contains a name, and value. The row also contains a
|
|
||||||
type or mimetype. Type corresponds to a .NET class that support
|
|
||||||
text/value conversion through the TypeConverter architecture.
|
|
||||||
Classes that don't support this are serialized and stored with the
|
|
||||||
mimetype set.
|
|
||||||
|
|
||||||
The mimetype is used for serialized objects, and tells the
|
|
||||||
ResXResourceReader how to depersist the object. This is currently not
|
|
||||||
extensible. For a given mimetype the value must be set accordingly:
|
|
||||||
|
|
||||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
|
||||||
that the ResXResourceWriter will generate, however the reader can
|
|
||||||
read any of the formats listed below.
|
|
||||||
|
|
||||||
mimetype: application/x-microsoft.net.object.binary.base64
|
|
||||||
value : The object must be serialized with
|
|
||||||
: System.Serialization.Formatters.Binary.BinaryFormatter
|
|
||||||
: and then encoded with base64 encoding.
|
|
||||||
|
|
||||||
mimetype: application/x-microsoft.net.object.soap.base64
|
|
||||||
value : The object must be serialized with
|
|
||||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
|
||||||
: and then encoded with base64 encoding.
|
|
||||||
|
|
||||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
|
||||||
value : The object must be serialized into a byte array
|
|
||||||
: using a System.ComponentModel.TypeConverter
|
|
||||||
: and then encoded with base64 encoding.
|
|
||||||
-->
|
|
||||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
|
||||||
<xsd:element name="root" msdata:IsDataSet="true">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:choice maxOccurs="unbounded">
|
|
||||||
<xsd:element name="metadata">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:sequence>
|
|
||||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
|
||||||
</xsd:sequence>
|
|
||||||
<xsd:attribute name="name" type="xsd:string" />
|
|
||||||
<xsd:attribute name="type" type="xsd:string" />
|
|
||||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
<xsd:element name="assembly">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:attribute name="alias" type="xsd:string" />
|
|
||||||
<xsd:attribute name="name" type="xsd:string" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
<xsd:element name="data">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:sequence>
|
|
||||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
|
||||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
|
||||||
</xsd:sequence>
|
|
||||||
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
|
|
||||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
|
||||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
<xsd:element name="resheader">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:sequence>
|
|
||||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
|
||||||
</xsd:sequence>
|
|
||||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
</xsd:choice>
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
</xsd:schema>
|
|
||||||
<resheader name="resmimetype">
|
|
||||||
<value>text/microsoft-resx</value>
|
|
||||||
</resheader>
|
|
||||||
<resheader name="version">
|
|
||||||
<value>2.0</value>
|
|
||||||
</resheader>
|
|
||||||
<resheader name="reader">
|
|
||||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
|
||||||
</resheader>
|
|
||||||
<resheader name="writer">
|
|
||||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
|
||||||
</resheader>
|
|
||||||
</root>
|
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<RootNamespace>Pilz.Updating.GUIBase</RootNamespace>
|
<RootNamespace>Pilz.Updating.GUIBase</RootNamespace>
|
||||||
<TargetFrameworks>net6.0-windows;net8.0-windows</TargetFrameworks>
|
<TargetFrameworks>net8.0-windows</TargetFrameworks>
|
||||||
<DefaultItemExcludes>$(DefaultItemExcludes);$(ProjectDir)**\*.vb</DefaultItemExcludes>
|
<DefaultItemExcludes>$(DefaultItemExcludes);$(ProjectDir)**\*.vb</DefaultItemExcludes>
|
||||||
<LangVersion>latest</LangVersion>
|
<LangVersion>latest</LangVersion>
|
||||||
<AssemblyTitle>Pilz.Updating.GUIBase</AssemblyTitle>
|
<AssemblyTitle>Pilz.Updating.GUIBase</AssemblyTitle>
|
||||||
@@ -36,7 +36,6 @@
|
|||||||
<DefineConstants>TRACE;RelMono</DefineConstants>
|
<DefineConstants>TRACE;RelMono</DefineConstants>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
|
|
||||||
<Version>2.0.0</Version>
|
<Version>2.0.0</Version>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
@@ -56,10 +55,6 @@
|
|||||||
<Import Include="System.Threading.Tasks" />
|
<Import Include="System.Threading.Tasks" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Update="My Project\Application.Designer.cs">
|
|
||||||
<AutoGen>True</AutoGen>
|
|
||||||
<DependentUpon>Application.myapp</DependentUpon>
|
|
||||||
</Compile>
|
|
||||||
<Compile Update="Properties\Resources.Designer.cs">
|
<Compile Update="Properties\Resources.Designer.cs">
|
||||||
<AutoGen>True</AutoGen>
|
<AutoGen>True</AutoGen>
|
||||||
<DesignTime>True</DesignTime>
|
<DesignTime>True</DesignTime>
|
||||||
@@ -80,10 +75,6 @@
|
|||||||
</EmbeddedResource>
|
</EmbeddedResource>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include="My Project\Application.myapp">
|
|
||||||
<Generator>MyApplicationCodeGenerator</Generator>
|
|
||||||
<LastGenOutput>Application.Designer.cs</LastGenOutput>
|
|
||||||
</None>
|
|
||||||
<None Include="Properties\Settings.settings">
|
<None Include="Properties\Settings.settings">
|
||||||
<Generator>SettingsSingleFileGenerator</Generator>
|
<Generator>SettingsSingleFileGenerator</Generator>
|
||||||
<CustomToolNamespace>Pilz.Updating.GUIBase.My</CustomToolNamespace>
|
<CustomToolNamespace>Pilz.Updating.GUIBase.My</CustomToolNamespace>
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
using global::System;
|
using global::System;
|
||||||
using global::System.Reflection;
|
|
||||||
using global::System.Runtime.CompilerServices;
|
using global::System.Runtime.CompilerServices;
|
||||||
using global::System.Runtime.InteropServices;
|
using global::System.Runtime.InteropServices;
|
||||||
[assembly: ComVisible(false)]
|
[assembly: ComVisible(false)]
|
||||||
|
|||||||
@@ -1,14 +1,12 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFrameworks>net6.0-windows;net8.0-windows</TargetFrameworks>
|
<TargetFrameworks>net8.0-windows</TargetFrameworks>
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
|
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
|
|
||||||
<Version>2.0.0</Version>
|
<Version>2.0.0</Version>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
|
|||||||
@@ -1,173 +1,167 @@
|
|||||||
using System;
|
using Microsoft.VisualBasic.CompilerServices;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.IO;
|
|
||||||
using System.IO.Compression;
|
using System.IO.Compression;
|
||||||
using System.Linq;
|
|
||||||
using System.Reflection;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using Microsoft.VisualBasic.CompilerServices;
|
|
||||||
|
|
||||||
namespace Pilz.Updating.UpdateInstaller.Lib
|
namespace Pilz.Updating.UpdateInstaller.Lib;
|
||||||
|
|
||||||
|
public class UpdateInstaller
|
||||||
{
|
{
|
||||||
public class UpdateInstaller
|
// E v e n t s
|
||||||
|
|
||||||
|
public delegate void UpdateInstallerEventHandler(object sender, UpdateInstallerEventArgs e);
|
||||||
|
public delegate void UpdateInstallerStepEventHandler(object sender, UpdateInstallerStepEventArgs e);
|
||||||
|
public delegate void StatusChangesEventHandler(object sender, UpdateInstallerStatusChangedEventArgs e);
|
||||||
|
|
||||||
|
public event StatusChangesEventHandler StatusChanges;
|
||||||
|
public event UpdateInstallerStepEventHandler OnStep;
|
||||||
|
|
||||||
|
// F i e l d s
|
||||||
|
|
||||||
|
private string dataPath = string.Empty;
|
||||||
|
|
||||||
|
// P r o p e r t i e s
|
||||||
|
|
||||||
|
public UpdateInstallerConfig Configuration { get; private set; }
|
||||||
|
|
||||||
|
// C o n s t r c u t o r s
|
||||||
|
|
||||||
|
public UpdateInstaller(UpdateInstallerConfig config)
|
||||||
{
|
{
|
||||||
// E v e n t s
|
Configuration = config;
|
||||||
|
}
|
||||||
|
|
||||||
public delegate void UpdateInstallerEventHandler(object sender, UpdateInstallerEventArgs e);
|
// F e a t u r e s
|
||||||
public delegate void UpdateInstallerStepEventHandler(object sender, UpdateInstallerStepEventArgs e);
|
|
||||||
public delegate void StatusChangesEventHandler(object sender, UpdateInstallerStatusChangedEventArgs e);
|
|
||||||
|
|
||||||
public event StatusChangesEventHandler StatusChanges;
|
private void ChangeStep(UpdateInstallerStep step, UpdateInstallerStepState state)
|
||||||
public event UpdateInstallerStepEventHandler OnStep;
|
{
|
||||||
|
OnStep?.Invoke(this, new UpdateInstallerStepEventArgs(this, step, state));
|
||||||
|
}
|
||||||
|
|
||||||
// F i e l d s
|
private void ChangeStatus(UpdateInstallerStatus newStatus)
|
||||||
|
{
|
||||||
|
StatusChanges?.Invoke(this, new UpdateInstallerStatusChangedEventArgs(newStatus));
|
||||||
|
}
|
||||||
|
|
||||||
private string dataPath = string.Empty;
|
public void StartHostApplication()
|
||||||
|
{
|
||||||
// P r o p e r t i e s
|
if (!string.IsNullOrEmpty(Conversions.ToString(Configuration.RestartHostApplication)) && File.Exists(Configuration.HostApplicationProcessPath))
|
||||||
|
|
||||||
public UpdateInstallerConfig Configuration { get; private set; }
|
|
||||||
|
|
||||||
// C o n s t r c u t o r s
|
|
||||||
|
|
||||||
public UpdateInstaller(UpdateInstallerConfig config)
|
|
||||||
{
|
{
|
||||||
Configuration = config;
|
Process.Start(Configuration.HostApplicationProcessPath, Configuration.RestartHostApplicationArguments);
|
||||||
}
|
|
||||||
|
|
||||||
// F e a t u r e s
|
|
||||||
|
|
||||||
private void ChangeStep(UpdateInstallerStep step, UpdateInstallerStepState state)
|
|
||||||
{
|
|
||||||
OnStep?.Invoke(this, new UpdateInstallerStepEventArgs(this, step, state));
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ChangeStatus(UpdateInstallerStatus newStatus)
|
|
||||||
{
|
|
||||||
StatusChanges?.Invoke(this, new UpdateInstallerStatusChangedEventArgs(newStatus));
|
|
||||||
}
|
|
||||||
|
|
||||||
public void StartHostApplication()
|
|
||||||
{
|
|
||||||
if (!string.IsNullOrEmpty(Conversions.ToString(Configuration.RestartHostApplication)) && File.Exists(Configuration.HostApplicationProcessPath))
|
|
||||||
{
|
|
||||||
Process.Start(Configuration.HostApplicationProcessPath, Configuration.RestartHostApplicationArguments);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void InstallUpdate()
|
|
||||||
{
|
|
||||||
ChangeStep(UpdateInstallerStep.Startup, UpdateInstallerStepState.Default);
|
|
||||||
|
|
||||||
// Extract Package
|
|
||||||
ChangeStatus(UpdateInstallerStatus.Extracting);
|
|
||||||
ChangeStep(UpdateInstallerStep.ExtractPackage, UpdateInstallerStepState.PreEvent);
|
|
||||||
ExtractPackage();
|
|
||||||
ChangeStep(UpdateInstallerStep.ExtractPackage, UpdateInstallerStepState.PostEvent);
|
|
||||||
|
|
||||||
// Install Package
|
|
||||||
ChangeStatus(UpdateInstallerStatus.CopyingFiles);
|
|
||||||
ChangeStep(UpdateInstallerStep.CopyFiles, UpdateInstallerStepState.PreEvent);
|
|
||||||
CopyFiles();
|
|
||||||
ChangeStep(UpdateInstallerStep.CopyFiles, UpdateInstallerStepState.PostEvent);
|
|
||||||
|
|
||||||
// Delete Package
|
|
||||||
ChangeStatus(UpdateInstallerStatus.RemovingFiles);
|
|
||||||
ChangeStep(UpdateInstallerStep.DeletePackage, UpdateInstallerStepState.PreEvent);
|
|
||||||
DeletePackage();
|
|
||||||
ChangeStep(UpdateInstallerStep.DeletePackage, UpdateInstallerStepState.PostEvent);
|
|
||||||
|
|
||||||
// Finish
|
|
||||||
ChangeStatus(UpdateInstallerStatus.Done);
|
|
||||||
ChangeStep(UpdateInstallerStep.Finish, UpdateInstallerStepState.Default);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void WaitForHostApplication()
|
|
||||||
{
|
|
||||||
bool forcedKill = false;
|
|
||||||
bool enabled = true;
|
|
||||||
var stw = new Stopwatch();
|
|
||||||
stw.Start();
|
|
||||||
Process[] getProcesses() => Process.GetProcessesByName(Path.GetFileNameWithoutExtension(Configuration.HostApplicationProcessPath));
|
|
||||||
while (enabled)
|
|
||||||
{
|
|
||||||
if (getProcesses().Any())
|
|
||||||
{
|
|
||||||
if (stw.ElapsedMilliseconds >= Configuration.MillisecondsToWaitForHostApplicationToClose)
|
|
||||||
{
|
|
||||||
if (!forcedKill && Configuration.ForceClosingHostApplication)
|
|
||||||
{
|
|
||||||
foreach (Process p in getProcesses())
|
|
||||||
p.Kill();
|
|
||||||
stw.Reset();
|
|
||||||
forcedKill = true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
stw.Stop();
|
|
||||||
enabled = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
enabled = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ExtractPackage()
|
|
||||||
{
|
|
||||||
string packagePath = Configuration.PackagePath;
|
|
||||||
string zipPath = Path.Combine(packagePath, PackageFileNameDefinations.ZIP_PACKAGE_FILENAME);
|
|
||||||
dataPath = Path.Combine(packagePath, Path.GetFileNameWithoutExtension(PackageFileNameDefinations.ZIP_PACKAGE_FILENAME));
|
|
||||||
var dataPathDir = new DirectoryInfo(dataPath);
|
|
||||||
|
|
||||||
if (dataPathDir.Exists)
|
|
||||||
{
|
|
||||||
dataPathDir.Delete(true);
|
|
||||||
Task.Delay(100);
|
|
||||||
}
|
|
||||||
|
|
||||||
ZipFile.ExtractToDirectory(zipPath, dataPath);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void CopyFiles()
|
|
||||||
{
|
|
||||||
var sourceDir = new DirectoryInfo(Path.Combine(dataPath, PackageFileNameDefinations.ZIP_APP_DATA_FILES_DIRECTORY));
|
|
||||||
var destDir = new DirectoryInfo(Configuration.HostApplicationPath);
|
|
||||||
CopyFiles(sourceDir, destDir);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void CopyFiles(DirectoryInfo sourceDir, DirectoryInfo destinationDir)
|
|
||||||
{
|
|
||||||
if (!destinationDir.Exists)
|
|
||||||
{
|
|
||||||
destinationDir.Create();
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach (FileInfo sFile in sourceDir.EnumerateFiles("*", SearchOption.TopDirectoryOnly))
|
|
||||||
{
|
|
||||||
var dFile = new FileInfo(Path.Combine(destinationDir.FullName, sFile.Name));
|
|
||||||
try
|
|
||||||
{
|
|
||||||
sFile.CopyTo(dFile.FullName, true);
|
|
||||||
}
|
|
||||||
catch (Exception)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach (DirectoryInfo sDir in sourceDir.EnumerateDirectories("*", SearchOption.TopDirectoryOnly))
|
|
||||||
{
|
|
||||||
var dDir = destinationDir.CreateSubdirectory(sDir.Name);
|
|
||||||
CopyFiles(sDir, dDir);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void DeletePackage()
|
|
||||||
{
|
|
||||||
Directory.Delete(Configuration.PackagePath, true);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void InstallUpdate()
|
||||||
|
{
|
||||||
|
ChangeStep(UpdateInstallerStep.Startup, UpdateInstallerStepState.Default);
|
||||||
|
|
||||||
|
// Extract Package
|
||||||
|
ChangeStatus(UpdateInstallerStatus.Extracting);
|
||||||
|
ChangeStep(UpdateInstallerStep.ExtractPackage, UpdateInstallerStepState.PreEvent);
|
||||||
|
ExtractPackage();
|
||||||
|
ChangeStep(UpdateInstallerStep.ExtractPackage, UpdateInstallerStepState.PostEvent);
|
||||||
|
|
||||||
|
// Install Package
|
||||||
|
ChangeStatus(UpdateInstallerStatus.CopyingFiles);
|
||||||
|
ChangeStep(UpdateInstallerStep.CopyFiles, UpdateInstallerStepState.PreEvent);
|
||||||
|
CopyFiles();
|
||||||
|
ChangeStep(UpdateInstallerStep.CopyFiles, UpdateInstallerStepState.PostEvent);
|
||||||
|
|
||||||
|
// Delete Package
|
||||||
|
ChangeStatus(UpdateInstallerStatus.RemovingFiles);
|
||||||
|
ChangeStep(UpdateInstallerStep.DeletePackage, UpdateInstallerStepState.PreEvent);
|
||||||
|
DeletePackage();
|
||||||
|
ChangeStep(UpdateInstallerStep.DeletePackage, UpdateInstallerStepState.PostEvent);
|
||||||
|
|
||||||
|
// Finish
|
||||||
|
ChangeStatus(UpdateInstallerStatus.Done);
|
||||||
|
ChangeStep(UpdateInstallerStep.Finish, UpdateInstallerStepState.Default);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void WaitForHostApplication()
|
||||||
|
{
|
||||||
|
bool forcedKill = false;
|
||||||
|
bool enabled = true;
|
||||||
|
var stw = new Stopwatch();
|
||||||
|
stw.Start();
|
||||||
|
Process[] getProcesses() => Process.GetProcessesByName(Path.GetFileNameWithoutExtension(Configuration.HostApplicationProcessPath));
|
||||||
|
while (enabled)
|
||||||
|
{
|
||||||
|
if (getProcesses().Any())
|
||||||
|
{
|
||||||
|
if (stw.ElapsedMilliseconds >= Configuration.MillisecondsToWaitForHostApplicationToClose)
|
||||||
|
{
|
||||||
|
if (!forcedKill && Configuration.ForceClosingHostApplication)
|
||||||
|
{
|
||||||
|
foreach (Process p in getProcesses())
|
||||||
|
p.Kill();
|
||||||
|
stw.Reset();
|
||||||
|
forcedKill = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
stw.Stop();
|
||||||
|
enabled = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
enabled = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ExtractPackage()
|
||||||
|
{
|
||||||
|
string packagePath = Configuration.PackagePath;
|
||||||
|
string zipPath = Path.Combine(packagePath, PackageFileNameDefinations.ZIP_PACKAGE_FILENAME);
|
||||||
|
dataPath = Path.Combine(packagePath, Path.GetFileNameWithoutExtension(PackageFileNameDefinations.ZIP_PACKAGE_FILENAME));
|
||||||
|
var dataPathDir = new DirectoryInfo(dataPath);
|
||||||
|
|
||||||
|
if (dataPathDir.Exists)
|
||||||
|
{
|
||||||
|
dataPathDir.Delete(true);
|
||||||
|
Task.Delay(100);
|
||||||
|
}
|
||||||
|
|
||||||
|
ZipFile.ExtractToDirectory(zipPath, dataPath);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void CopyFiles()
|
||||||
|
{
|
||||||
|
var sourceDir = new DirectoryInfo(Path.Combine(dataPath, PackageFileNameDefinations.ZIP_APP_DATA_FILES_DIRECTORY));
|
||||||
|
var destDir = new DirectoryInfo(Configuration.HostApplicationPath);
|
||||||
|
CopyFiles(sourceDir, destDir);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void CopyFiles(DirectoryInfo sourceDir, DirectoryInfo destinationDir)
|
||||||
|
{
|
||||||
|
if (!destinationDir.Exists)
|
||||||
|
{
|
||||||
|
destinationDir.Create();
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (FileInfo sFile in sourceDir.EnumerateFiles("*", SearchOption.TopDirectoryOnly))
|
||||||
|
{
|
||||||
|
var dFile = new FileInfo(Path.Combine(destinationDir.FullName, sFile.Name));
|
||||||
|
try
|
||||||
|
{
|
||||||
|
sFile.CopyTo(dFile.FullName, true);
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (DirectoryInfo sDir in sourceDir.EnumerateDirectories("*", SearchOption.TopDirectoryOnly))
|
||||||
|
{
|
||||||
|
var dDir = destinationDir.CreateSubdirectory(sDir.Name);
|
||||||
|
CopyFiles(sDir, dDir);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void DeletePackage()
|
||||||
|
{
|
||||||
|
Directory.Delete(Configuration.PackagePath, true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,18 +1,11 @@
|
|||||||
using System;
|
namespace Pilz.Updating.UpdateInstaller.Lib;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace Pilz.Updating.UpdateInstaller.Lib
|
public class UpdateInstallerEventArgs : EventArgs
|
||||||
{
|
{
|
||||||
public class UpdateInstallerEventArgs : EventArgs
|
public UpdateInstaller UpdateInstaller { get; init; }
|
||||||
{
|
|
||||||
public UpdateInstaller UpdateInstaller { get; init; }
|
|
||||||
|
|
||||||
public UpdateInstallerEventArgs(UpdateInstaller updateInstaller)
|
public UpdateInstallerEventArgs(UpdateInstaller updateInstaller)
|
||||||
{
|
{
|
||||||
UpdateInstaller = updateInstaller;
|
UpdateInstaller = updateInstaller;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,12 +1,11 @@
|
|||||||
|
|
||||||
namespace Pilz.Updating.UpdateInstaller.Lib
|
namespace Pilz.Updating.UpdateInstaller.Lib;
|
||||||
|
|
||||||
|
public enum UpdateInstallerStatus
|
||||||
{
|
{
|
||||||
public enum UpdateInstallerStatus
|
Waiting,
|
||||||
{
|
Extracting,
|
||||||
Waiting,
|
CopyingFiles,
|
||||||
Extracting,
|
RemovingFiles,
|
||||||
CopyingFiles,
|
Done
|
||||||
RemovingFiles,
|
|
||||||
Done
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -1,14 +1,11 @@
|
|||||||
using System;
|
namespace Pilz.Updating.UpdateInstaller.Lib;
|
||||||
|
|
||||||
namespace Pilz.Updating.UpdateInstaller.Lib
|
public class UpdateInstallerStatusChangedEventArgs : EventArgs
|
||||||
{
|
{
|
||||||
public class UpdateInstallerStatusChangedEventArgs : EventArgs
|
public UpdateInstallerStatus NewStatus { get; private set; }
|
||||||
{
|
|
||||||
public UpdateInstallerStatus NewStatus { get; private set; }
|
|
||||||
|
|
||||||
public UpdateInstallerStatusChangedEventArgs(UpdateInstallerStatus newStatus) : base()
|
public UpdateInstallerStatusChangedEventArgs(UpdateInstallerStatus newStatus) : base()
|
||||||
{
|
{
|
||||||
NewStatus = newStatus;
|
NewStatus = newStatus;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,17 +1,10 @@
|
|||||||
using System;
|
namespace Pilz.Updating.UpdateInstaller.Lib;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace Pilz.Updating.UpdateInstaller.Lib
|
public enum UpdateInstallerStep
|
||||||
{
|
{
|
||||||
public enum UpdateInstallerStep
|
Startup,
|
||||||
{
|
ExtractPackage,
|
||||||
Startup,
|
CopyFiles,
|
||||||
ExtractPackage,
|
DeletePackage,
|
||||||
CopyFiles,
|
Finish
|
||||||
DeletePackage,
|
|
||||||
Finish
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,20 +1,13 @@
|
|||||||
using System;
|
namespace Pilz.Updating.UpdateInstaller.Lib;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace Pilz.Updating.UpdateInstaller.Lib
|
public class UpdateInstallerStepEventArgs : UpdateInstallerEventArgs
|
||||||
{
|
{
|
||||||
public class UpdateInstallerStepEventArgs : UpdateInstallerEventArgs
|
public UpdateInstallerStep Step { get; init; }
|
||||||
{
|
public UpdateInstallerStepState State { get; init; }
|
||||||
public UpdateInstallerStep Step { get; init; }
|
|
||||||
public UpdateInstallerStepState State { get; init; }
|
|
||||||
|
|
||||||
public UpdateInstallerStepEventArgs(UpdateInstaller updateInstaller, UpdateInstallerStep step, UpdateInstallerStepState state) : base(updateInstaller)
|
public UpdateInstallerStepEventArgs(UpdateInstaller updateInstaller, UpdateInstallerStep step, UpdateInstallerStepState state) : base(updateInstaller)
|
||||||
{
|
{
|
||||||
Step = step;
|
Step = step;
|
||||||
State = state;
|
State = state;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,15 +1,8 @@
|
|||||||
using System;
|
namespace Pilz.Updating.UpdateInstaller.Lib;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace Pilz.Updating.UpdateInstaller.Lib
|
public enum UpdateInstallerStepState
|
||||||
{
|
{
|
||||||
public enum UpdateInstallerStepState
|
Default,
|
||||||
{
|
PreEvent,
|
||||||
Default,
|
PostEvent
|
||||||
PreEvent,
|
|
||||||
PostEvent
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,36 +1,32 @@
|
|||||||
using System.IO;
|
using Pilz.Plugins;
|
||||||
using System.Reflection;
|
using System.IO;
|
||||||
using Pilz.Plugins;
|
|
||||||
using System.Configuration;
|
|
||||||
using Z.Reflection.Extensions;
|
|
||||||
|
|
||||||
namespace Pilz.Updating.UpdateInstaller
|
namespace Pilz.Updating.UpdateInstaller;
|
||||||
|
|
||||||
|
internal static class General
|
||||||
{
|
{
|
||||||
internal static class General
|
private static string p = null;
|
||||||
|
|
||||||
|
public static string MyAppPath
|
||||||
{
|
{
|
||||||
private static string p = null;
|
get
|
||||||
|
|
||||||
public static string MyAppPath
|
|
||||||
{
|
{
|
||||||
get
|
if (string.IsNullOrEmpty(p))
|
||||||
{
|
p = Path.GetDirectoryName(IO.Extensions.GetExecutablePath());
|
||||||
if (string.IsNullOrEmpty(p))
|
return p;
|
||||||
p = Path.GetDirectoryName(IO.Extensions.GetExecutablePath());
|
|
||||||
return p;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static void LoadAddons(Lib.UpdateInstaller installer)
|
public static void LoadAddons(Lib.UpdateInstaller installer)
|
||||||
|
{
|
||||||
|
var pluginsPath = Path.Combine(MyAppPath, "AddOns");
|
||||||
|
if (Directory.Exists(pluginsPath))
|
||||||
{
|
{
|
||||||
var pluginsPath = Path.Combine(MyAppPath, "AddOns");
|
foreach (var subdir in Directory.GetDirectories(pluginsPath, string.Empty, SearchOption.TopDirectoryOnly))
|
||||||
if (Directory.Exists(pluginsPath))
|
|
||||||
{
|
{
|
||||||
foreach (var subdir in Directory.GetDirectories(pluginsPath, string.Empty, SearchOption.TopDirectoryOnly))
|
var pluginPath = Path.Combine(subdir, Path.GetFileName(subdir) + ".dll");
|
||||||
{
|
if (File.Exists(pluginPath))
|
||||||
var pluginPath = Path.Combine(subdir, Path.GetFileName(subdir) + ".dll");
|
PluginManager.Instance.LoadPlugin(pluginPath, installer);
|
||||||
if (File.Exists(pluginPath))
|
|
||||||
PluginManager.Instance.LoadPlugin(pluginPath, installer);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,149 +1,147 @@
|
|||||||
using System;
|
using Pilz.Updating.UpdateInstaller.Lib;
|
||||||
|
using System;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Runtime.CompilerServices;
|
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using Telerik.WinControls;
|
using Telerik.WinControls;
|
||||||
using Telerik.WinControls.Themes;
|
using Telerik.WinControls.Themes;
|
||||||
using Pilz.Updating.UpdateInstaller.Lib;
|
|
||||||
|
|
||||||
namespace Pilz.Updating.UpdateInstaller
|
namespace Pilz.Updating.UpdateInstaller;
|
||||||
|
|
||||||
|
public partial class Main
|
||||||
{
|
{
|
||||||
public partial class Main
|
// C o n s t r u c t o r s
|
||||||
|
|
||||||
|
public Main()
|
||||||
{
|
{
|
||||||
// C o n s t r u c t o r s
|
// G u i
|
||||||
|
this.Shown += Main_Shown;
|
||||||
|
this.FormClosed += Main_FormClosed;
|
||||||
|
this.FormClosing += Main_FormClosing;
|
||||||
|
|
||||||
public Main()
|
// Get arguments
|
||||||
|
var args = Environment.GetCommandLineArgs().Skip(1).ToArray();
|
||||||
|
if (args.Length != 0)
|
||||||
{
|
{
|
||||||
// G u i
|
// Load config
|
||||||
this.Shown += Main_Shown;
|
installer = new Lib.UpdateInstaller(UpdateInstallerConfig.Parse(args[0]));
|
||||||
this.FormClosed += Main_FormClosed;
|
General.LoadAddons(installer);
|
||||||
this.FormClosing += Main_FormClosing;
|
|
||||||
|
|
||||||
// Get arguments
|
// Init Form
|
||||||
var args = My.MyProject.Application.CommandLineArgs.ToArray();
|
InitializeComponent();
|
||||||
if (args.Any())
|
|
||||||
{
|
|
||||||
// Load config
|
|
||||||
installer = new Lib.UpdateInstaller(UpdateInstallerConfig.Parse(args[0]));
|
|
||||||
General.LoadAddons(installer);
|
|
||||||
|
|
||||||
// Init Form
|
// Init Style
|
||||||
InitializeComponent();
|
RadThemeComponentBase themeToUse = installer.Configuration.UIDarkMode ? new FluentDarkTheme() : new FluentTheme();
|
||||||
|
ThemeResolutionService.ApplicationThemeName = themeToUse.ThemeName;
|
||||||
|
|
||||||
// Init Style
|
// Init Application Header Text
|
||||||
RadThemeComponentBase themeToUse = installer.Configuration.UIDarkMode ? new FluentDarkTheme() : new FluentTheme();
|
string header;
|
||||||
ThemeResolutionService.ApplicationThemeName = themeToUse.ThemeName;
|
if (!string.IsNullOrEmpty(installer.Configuration.ApplicationName))
|
||||||
|
header = string.Format(My.Resources.UpdateInstallerGuiLangRes.String_UpdatingApplicationX, installer.Configuration.ApplicationName);
|
||||||
|
else
|
||||||
|
header = My.Resources.UpdateInstallerGuiLangRes.String_UpdateIsRunning;
|
||||||
|
|
||||||
// Init Application Header Text
|
radLabel_Header.Text = $"<html><span style=\"font-size: 18pt; color: #b7472a\"><b>{header}</b></span></html>";
|
||||||
string header;
|
|
||||||
if (!string.IsNullOrEmpty(installer.Configuration.ApplicationName))
|
|
||||||
header = string.Format(My.Resources.UpdateInstallerGuiLangRes.String_UpdatingApplicationX, installer.Configuration.ApplicationName);
|
|
||||||
else
|
|
||||||
header = My.Resources.UpdateInstallerGuiLangRes.String_UpdateIsRunning;
|
|
||||||
|
|
||||||
radLabel_Header.Text = $"<html><span style=\"font-size: 18pt; color: #b7472a\"><b>{header}</b></span></html>";
|
|
||||||
}
|
|
||||||
|
|
||||||
if (installer is null)
|
|
||||||
Environment.Exit(0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// F i e l d s
|
if (installer is null)
|
||||||
|
Environment.Exit(0);
|
||||||
|
}
|
||||||
|
|
||||||
private bool allowClose = false;
|
// F i e l d s
|
||||||
private readonly Lib.UpdateInstaller installer;
|
|
||||||
|
|
||||||
// F e a t u r e s
|
private bool allowClose = false;
|
||||||
|
private readonly Lib.UpdateInstaller installer;
|
||||||
|
|
||||||
private void SetStatus(UpdateInstallerStatus newStatus)
|
// F e a t u r e s
|
||||||
|
|
||||||
|
private void SetStatus(UpdateInstallerStatus newStatus)
|
||||||
|
{
|
||||||
|
string newStatusText = string.Empty;
|
||||||
|
Image newStatusImage = null;
|
||||||
|
|
||||||
|
switch (newStatus)
|
||||||
{
|
{
|
||||||
string newStatusText = string.Empty;
|
case UpdateInstallerStatus.CopyingFiles:
|
||||||
Image newStatusImage = null;
|
newStatusText = My.Resources.UpdateInstallerGuiLangRes.Status_CopyingFiles;
|
||||||
|
break;
|
||||||
switch (newStatus)
|
case UpdateInstallerStatus.Done:
|
||||||
{
|
newStatusText = My.Resources.UpdateInstallerGuiLangRes.Status_Done;
|
||||||
case UpdateInstallerStatus.CopyingFiles:
|
break;
|
||||||
newStatusText = My.Resources.UpdateInstallerGuiLangRes.Status_CopyingFiles;
|
case UpdateInstallerStatus.Extracting:
|
||||||
break;
|
newStatusText = My.Resources.UpdateInstallerGuiLangRes.Status_Extracting;
|
||||||
case UpdateInstallerStatus.Done:
|
break;
|
||||||
newStatusText = My.Resources.UpdateInstallerGuiLangRes.Status_Done;
|
case UpdateInstallerStatus.RemovingFiles:
|
||||||
break;
|
newStatusText = My.Resources.UpdateInstallerGuiLangRes.Status_RemovingFiles;
|
||||||
case UpdateInstallerStatus.Extracting:
|
break;
|
||||||
newStatusText = My.Resources.UpdateInstallerGuiLangRes.Status_Extracting;
|
case UpdateInstallerStatus.Waiting:
|
||||||
break;
|
newStatusText = My.Resources.UpdateInstallerGuiLangRes.Status_Waiting;
|
||||||
case UpdateInstallerStatus.RemovingFiles:
|
break;
|
||||||
newStatusText = My.Resources.UpdateInstallerGuiLangRes.Status_RemovingFiles;
|
|
||||||
break;
|
|
||||||
case UpdateInstallerStatus.Waiting:
|
|
||||||
newStatusText = My.Resources.UpdateInstallerGuiLangRes.Status_Waiting;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (newStatus)
|
|
||||||
{
|
|
||||||
case UpdateInstallerStatus.CopyingFiles:
|
|
||||||
newStatusImage = MyIcons.icons8_copy_16px;
|
|
||||||
break;
|
|
||||||
case UpdateInstallerStatus.Extracting:
|
|
||||||
newStatusImage = MyIcons.icons8_open_archive_16px;
|
|
||||||
break;
|
|
||||||
case UpdateInstallerStatus.RemovingFiles:
|
|
||||||
newStatusImage = MyIcons.icons8_recycle_bin_16px;
|
|
||||||
break;
|
|
||||||
case UpdateInstallerStatus.Waiting:
|
|
||||||
newStatusImage = MyIcons.icons8_sand_timer_16px;
|
|
||||||
break;
|
|
||||||
case UpdateInstallerStatus.Done:
|
|
||||||
newStatusImage = MyIcons.icons8_checkmark_16px;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
radLabel_Status.Text = newStatusText;
|
|
||||||
radLabel_Status.Image = newStatusImage;
|
|
||||||
|
|
||||||
//if (newStatus == UpdateInstallerStatus.Done)
|
|
||||||
//{
|
|
||||||
// allowClose = true;
|
|
||||||
// Close();
|
|
||||||
//}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task WaitforHostApp()
|
switch (newStatus)
|
||||||
{
|
{
|
||||||
SetStatus(UpdateInstallerStatus.Waiting);
|
case UpdateInstallerStatus.CopyingFiles:
|
||||||
await Task.Run(() => installer.WaitForHostApplication());
|
newStatusImage = MyIcons.icons8_copy_16px;
|
||||||
|
break;
|
||||||
|
case UpdateInstallerStatus.Extracting:
|
||||||
|
newStatusImage = MyIcons.icons8_open_archive_16px;
|
||||||
|
break;
|
||||||
|
case UpdateInstallerStatus.RemovingFiles:
|
||||||
|
newStatusImage = MyIcons.icons8_recycle_bin_16px;
|
||||||
|
break;
|
||||||
|
case UpdateInstallerStatus.Waiting:
|
||||||
|
newStatusImage = MyIcons.icons8_sand_timer_16px;
|
||||||
|
break;
|
||||||
|
case UpdateInstallerStatus.Done:
|
||||||
|
newStatusImage = MyIcons.icons8_checkmark_16px;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
private async void ExecuteUpdate()
|
radLabel_Status.Text = newStatusText;
|
||||||
{
|
radLabel_Status.Image = newStatusImage;
|
||||||
await Task.Run(() => installer.InstallUpdate());
|
|
||||||
allowClose = true;
|
|
||||||
Close();
|
|
||||||
}
|
|
||||||
|
|
||||||
private async void Main_Shown(object sender, EventArgs e)
|
//if (newStatus == UpdateInstallerStatus.Done)
|
||||||
{
|
//{
|
||||||
radWaitingBar1.StartWaiting();
|
// allowClose = true;
|
||||||
await WaitforHostApp();
|
// Close();
|
||||||
ExecuteUpdate();
|
//}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Main_FormClosed(object sender, FormClosedEventArgs e)
|
private async Task WaitforHostApp()
|
||||||
{
|
{
|
||||||
installer.StartHostApplication();
|
SetStatus(UpdateInstallerStatus.Waiting);
|
||||||
}
|
await Task.Run(() => installer.WaitForHostApplication());
|
||||||
|
}
|
||||||
|
|
||||||
private void Main_FormClosing(object sender, FormClosingEventArgs e)
|
private async void ExecuteUpdate()
|
||||||
{
|
{
|
||||||
radWaitingBar1.StopWaiting();
|
await Task.Run(() => installer.InstallUpdate());
|
||||||
e.Cancel = !allowClose;
|
allowClose = true;
|
||||||
}
|
Close();
|
||||||
|
}
|
||||||
|
|
||||||
private void Installer_StatusChanges(object sender, UpdateInstallerStatusChangedEventArgs e)
|
private async void Main_Shown(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
base.Invoke(new Action(() => SetStatus(e.NewStatus)));
|
radWaitingBar1.StartWaiting();
|
||||||
}
|
await WaitforHostApp();
|
||||||
|
ExecuteUpdate();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Main_FormClosed(object sender, FormClosedEventArgs e)
|
||||||
|
{
|
||||||
|
installer.StartHostApplication();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Main_FormClosing(object sender, FormClosingEventArgs e)
|
||||||
|
{
|
||||||
|
radWaitingBar1.StopWaiting();
|
||||||
|
e.Cancel = !allowClose;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Installer_StatusChanges(object sender, UpdateInstallerStatusChangedEventArgs e)
|
||||||
|
{
|
||||||
|
base.Invoke(new Action(() => SetStatus(e.NewStatus)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,38 +0,0 @@
|
|||||||
// ------------------------------------------------------------------------------
|
|
||||||
// <auto-generated>
|
|
||||||
// Dieser Code wurde von einem Tool generiert.
|
|
||||||
// Laufzeitversion:4.0.30319.42000
|
|
||||||
//
|
|
||||||
// Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn
|
|
||||||
// der Code erneut generiert wird.
|
|
||||||
// </auto-generated>
|
|
||||||
// ------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
using System.Diagnostics;
|
|
||||||
|
|
||||||
namespace Pilz.Updating.UpdateInstaller.My
|
|
||||||
{
|
|
||||||
|
|
||||||
// HINWEIS: Diese Datei wird automatisch generiert und darf nicht direkt bearbeitet werden. Wenn Sie Änderungen vornehmen möchten
|
|
||||||
// oder in dieser Datei Buildfehler auftreten, wechseln Sie zum Projekt-Designer.
|
|
||||||
// (Wechseln Sie dazu zu den Projekteigenschaften, oder doppelklicken Sie auf den Knoten "Mein Projekt" im
|
|
||||||
// Projektmappen-Explorer). Nehmen Sie auf der Registerkarte "Anwendung" entsprechende Änderungen vor.
|
|
||||||
//
|
|
||||||
internal partial class MyApplication
|
|
||||||
{
|
|
||||||
[DebuggerStepThrough()]
|
|
||||||
public MyApplication() : base(Microsoft.VisualBasic.ApplicationServices.AuthenticationMode.Windows)
|
|
||||||
{
|
|
||||||
IsSingleInstance = false;
|
|
||||||
EnableVisualStyles = true;
|
|
||||||
SaveMySettingsOnExit = true;
|
|
||||||
ShutdownStyle = Microsoft.VisualBasic.ApplicationServices.ShutdownMode.AfterAllFormsClose;
|
|
||||||
}
|
|
||||||
|
|
||||||
[DebuggerStepThrough()]
|
|
||||||
protected override void OnCreateMainForm()
|
|
||||||
{
|
|
||||||
MainForm = MyProject.Forms.Main;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<MyApplicationData xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
|
|
||||||
<MySubMain>true</MySubMain>
|
|
||||||
<MainForm>Main</MainForm>
|
|
||||||
<SingleInstance>false</SingleInstance>
|
|
||||||
<ShutdownMode>1</ShutdownMode>
|
|
||||||
<EnableVisualStyles>true</EnableVisualStyles>
|
|
||||||
<AuthenticationMode>0</AuthenticationMode>
|
|
||||||
<SaveMySettingsOnExit>true</SaveMySettingsOnExit>
|
|
||||||
</MyApplicationData>
|
|
||||||
@@ -1,35 +0,0 @@
|
|||||||
using global::System;
|
|
||||||
using global::System.ComponentModel;
|
|
||||||
using global::System.Diagnostics;
|
|
||||||
|
|
||||||
namespace Pilz.Updating.UpdateInstaller.My
|
|
||||||
{
|
|
||||||
internal static partial class MyProject
|
|
||||||
{
|
|
||||||
internal partial class MyForms
|
|
||||||
{
|
|
||||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
|
||||||
public Main m_Main;
|
|
||||||
|
|
||||||
public Main Main
|
|
||||||
{
|
|
||||||
[DebuggerHidden]
|
|
||||||
get
|
|
||||||
{
|
|
||||||
m_Main = MyForms.Create__Instance__(m_Main);
|
|
||||||
return m_Main;
|
|
||||||
}
|
|
||||||
|
|
||||||
[DebuggerHidden]
|
|
||||||
set
|
|
||||||
{
|
|
||||||
if (value == m_Main)
|
|
||||||
return;
|
|
||||||
if (value is object)
|
|
||||||
throw new ArgumentException("Property can only be set to Nothing");
|
|
||||||
Dispose__Instance__(ref m_Main);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,305 +0,0 @@
|
|||||||
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
|
||||||
|
|
||||||
using System;
|
|
||||||
using System.Collections;
|
|
||||||
using System.Diagnostics;
|
|
||||||
using System.Windows.Forms;
|
|
||||||
using Microsoft.VisualBasic;
|
|
||||||
|
|
||||||
/* TODO ERROR: Skipped IfDirectiveTrivia *//* TODO ERROR: Skipped DisabledTextTrivia *//* TODO ERROR: Skipped EndIfDirectiveTrivia */
|
|
||||||
/* TODO ERROR: Skipped IfDirectiveTrivia */
|
|
||||||
/* TODO ERROR: Skipped DefineDirectiveTrivia *//* TODO ERROR: Skipped DefineDirectiveTrivia *//* TODO ERROR: Skipped DefineDirectiveTrivia *//* TODO ERROR: Skipped DefineDirectiveTrivia *//* TODO ERROR: Skipped DefineDirectiveTrivia */
|
|
||||||
/* TODO ERROR: Skipped ElifDirectiveTrivia *//* TODO ERROR: Skipped DisabledTextTrivia *//* TODO ERROR: Skipped ElifDirectiveTrivia *//* TODO ERROR: Skipped DisabledTextTrivia *//* TODO ERROR: Skipped ElifDirectiveTrivia *//* TODO ERROR: Skipped DisabledTextTrivia *//* TODO ERROR: Skipped ElifDirectiveTrivia *//* TODO ERROR: Skipped DisabledTextTrivia *//* TODO ERROR: Skipped ElifDirectiveTrivia *//* TODO ERROR: Skipped DisabledTextTrivia *//* TODO ERROR: Skipped ElifDirectiveTrivia *//* TODO ERROR: Skipped DisabledTextTrivia *//* TODO ERROR: Skipped ElifDirectiveTrivia *//* TODO ERROR: Skipped DisabledTextTrivia *//* TODO ERROR: Skipped EndIfDirectiveTrivia */
|
|
||||||
/* TODO ERROR: Skipped IfDirectiveTrivia */
|
|
||||||
namespace Pilz.Updating.UpdateInstaller.My
|
|
||||||
{
|
|
||||||
|
|
||||||
/* TODO ERROR: Skipped IfDirectiveTrivia */
|
|
||||||
[System.CodeDom.Compiler.GeneratedCode("MyTemplate", "11.0.0.0")]
|
|
||||||
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
|
|
||||||
|
|
||||||
/* TODO ERROR: Skipped IfDirectiveTrivia */
|
|
||||||
internal partial class MyApplication : Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase
|
|
||||||
{
|
|
||||||
/* TODO ERROR: Skipped IfDirectiveTrivia */
|
|
||||||
[STAThread()]
|
|
||||||
[DebuggerHidden()]
|
|
||||||
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Advanced)]
|
|
||||||
internal static void Main(string[] Args)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
Application.SetCompatibleTextRenderingDefault(UseCompatibleTextRendering);
|
|
||||||
}
|
|
||||||
finally
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
MyProject.Application.Run(Args);
|
|
||||||
}
|
|
||||||
/* TODO ERROR: Skipped EndIfDirectiveTrivia */
|
|
||||||
/* TODO ERROR: Skipped ElifDirectiveTrivia *//* TODO ERROR: Skipped DisabledTextTrivia *//* TODO ERROR: Skipped ElifDirectiveTrivia *//* TODO ERROR: Skipped DisabledTextTrivia *//* TODO ERROR: Skipped EndIfDirectiveTrivia */
|
|
||||||
}
|
|
||||||
|
|
||||||
/* TODO ERROR: Skipped EndIfDirectiveTrivia */
|
|
||||||
/* TODO ERROR: Skipped IfDirectiveTrivia */
|
|
||||||
[System.CodeDom.Compiler.GeneratedCode("MyTemplate", "11.0.0.0")]
|
|
||||||
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
|
|
||||||
|
|
||||||
/* TODO ERROR: Skipped IfDirectiveTrivia */
|
|
||||||
internal partial class MyComputer : Microsoft.VisualBasic.Devices.Computer
|
|
||||||
{
|
|
||||||
/* TODO ERROR: Skipped ElifDirectiveTrivia *//* TODO ERROR: Skipped DisabledTextTrivia *//* TODO ERROR: Skipped EndIfDirectiveTrivia */
|
|
||||||
[DebuggerHidden()]
|
|
||||||
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
|
|
||||||
public MyComputer() : base()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/* TODO ERROR: Skipped EndIfDirectiveTrivia */
|
|
||||||
[HideModuleName()]
|
|
||||||
[System.CodeDom.Compiler.GeneratedCode("MyTemplate", "11.0.0.0")]
|
|
||||||
internal static partial class MyProject
|
|
||||||
{
|
|
||||||
|
|
||||||
/* TODO ERROR: Skipped IfDirectiveTrivia */
|
|
||||||
[System.ComponentModel.Design.HelpKeyword("My.Computer")]
|
|
||||||
internal static MyComputer Computer
|
|
||||||
{
|
|
||||||
[DebuggerHidden()]
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return m_ComputerObjectProvider.GetInstance;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private readonly static ThreadSafeObjectProvider<MyComputer> m_ComputerObjectProvider = new ThreadSafeObjectProvider<MyComputer>();
|
|
||||||
/* TODO ERROR: Skipped EndIfDirectiveTrivia */
|
|
||||||
/* TODO ERROR: Skipped IfDirectiveTrivia */
|
|
||||||
[System.ComponentModel.Design.HelpKeyword("My.Application")]
|
|
||||||
internal static MyApplication Application
|
|
||||||
{
|
|
||||||
[DebuggerHidden()]
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return m_AppObjectProvider.GetInstance;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private readonly static ThreadSafeObjectProvider<MyApplication> m_AppObjectProvider = new ThreadSafeObjectProvider<MyApplication>();
|
|
||||||
/* TODO ERROR: Skipped EndIfDirectiveTrivia */
|
|
||||||
/* TODO ERROR: Skipped IfDirectiveTrivia */
|
|
||||||
[System.ComponentModel.Design.HelpKeyword("My.User")]
|
|
||||||
internal static Microsoft.VisualBasic.ApplicationServices.User User
|
|
||||||
{
|
|
||||||
[DebuggerHidden()]
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return m_UserObjectProvider.GetInstance;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private readonly static ThreadSafeObjectProvider<Microsoft.VisualBasic.ApplicationServices.User> m_UserObjectProvider = new ThreadSafeObjectProvider<Microsoft.VisualBasic.ApplicationServices.User>();
|
|
||||||
/* TODO ERROR: Skipped ElifDirectiveTrivia *//* TODO ERROR: Skipped DisabledTextTrivia *//* TODO ERROR: Skipped EndIfDirectiveTrivia */
|
|
||||||
/* TODO ERROR: Skipped IfDirectiveTrivia */
|
|
||||||
/* TODO ERROR: Skipped DefineDirectiveTrivia */
|
|
||||||
[System.ComponentModel.Design.HelpKeyword("My.Forms")]
|
|
||||||
internal static MyForms Forms
|
|
||||||
{
|
|
||||||
[DebuggerHidden()]
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return m_MyFormsObjectProvider.GetInstance;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
|
|
||||||
[MyGroupCollection("System.Windows.Forms.Form", "Create__Instance__", "Dispose__Instance__", "My.MyProject.Forms")]
|
|
||||||
internal sealed partial class MyForms
|
|
||||||
{
|
|
||||||
[DebuggerHidden()]
|
|
||||||
private static T Create__Instance__<T>(T Instance) where T : Form, new()
|
|
||||||
{
|
|
||||||
if (Instance is null || Instance.IsDisposed)
|
|
||||||
{
|
|
||||||
if (m_FormBeingCreated is object)
|
|
||||||
{
|
|
||||||
if (m_FormBeingCreated.ContainsKey(typeof(T)) == true)
|
|
||||||
{
|
|
||||||
throw new InvalidOperationException(Microsoft.VisualBasic.CompilerServices.Utils.GetResourceString("WinForms_RecursiveFormCreate"));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
m_FormBeingCreated = new Hashtable();
|
|
||||||
}
|
|
||||||
|
|
||||||
m_FormBeingCreated.Add(typeof(T), null);
|
|
||||||
try
|
|
||||||
{
|
|
||||||
return new T();
|
|
||||||
}
|
|
||||||
catch (System.Reflection.TargetInvocationException ex) when (ex.InnerException is object)
|
|
||||||
{
|
|
||||||
string BetterMessage = Microsoft.VisualBasic.CompilerServices.Utils.GetResourceString("WinForms_SeeInnerException", ex.InnerException.Message);
|
|
||||||
throw new InvalidOperationException(BetterMessage, ex.InnerException);
|
|
||||||
}
|
|
||||||
finally
|
|
||||||
{
|
|
||||||
m_FormBeingCreated.Remove(typeof(T));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return Instance;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
[DebuggerHidden()]
|
|
||||||
private void Dispose__Instance__<T>(ref T instance) where T : Form
|
|
||||||
{
|
|
||||||
instance.Dispose();
|
|
||||||
instance = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
[DebuggerHidden()]
|
|
||||||
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
|
|
||||||
public MyForms() : base()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
[ThreadStatic()]
|
|
||||||
private static Hashtable m_FormBeingCreated;
|
|
||||||
|
|
||||||
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
|
|
||||||
public override bool Equals(object o)
|
|
||||||
{
|
|
||||||
return base.Equals(o);
|
|
||||||
}
|
|
||||||
|
|
||||||
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
|
|
||||||
public override int GetHashCode()
|
|
||||||
{
|
|
||||||
return base.GetHashCode();
|
|
||||||
}
|
|
||||||
|
|
||||||
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
|
|
||||||
internal new Type GetType()
|
|
||||||
{
|
|
||||||
return typeof(MyForms);
|
|
||||||
}
|
|
||||||
|
|
||||||
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
|
|
||||||
public override string ToString()
|
|
||||||
{
|
|
||||||
return base.ToString();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static ThreadSafeObjectProvider<MyForms> m_MyFormsObjectProvider = new ThreadSafeObjectProvider<MyForms>();
|
|
||||||
|
|
||||||
/* TODO ERROR: Skipped EndIfDirectiveTrivia */
|
|
||||||
/* TODO ERROR: Skipped IfDirectiveTrivia */
|
|
||||||
[System.ComponentModel.Design.HelpKeyword("My.WebServices")]
|
|
||||||
internal static MyWebServices WebServices
|
|
||||||
{
|
|
||||||
[DebuggerHidden()]
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return m_MyWebServicesObjectProvider.GetInstance;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
|
|
||||||
[MyGroupCollection("System.Web.Services.Protocols.SoapHttpClientProtocol", "Create__Instance__", "Dispose__Instance__", "")]
|
|
||||||
internal sealed class MyWebServices
|
|
||||||
{
|
|
||||||
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
|
|
||||||
[DebuggerHidden()]
|
|
||||||
public override bool Equals(object o)
|
|
||||||
{
|
|
||||||
return base.Equals(o);
|
|
||||||
}
|
|
||||||
|
|
||||||
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
|
|
||||||
[DebuggerHidden()]
|
|
||||||
public override int GetHashCode()
|
|
||||||
{
|
|
||||||
return base.GetHashCode();
|
|
||||||
}
|
|
||||||
|
|
||||||
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
|
|
||||||
[DebuggerHidden()]
|
|
||||||
internal new Type GetType()
|
|
||||||
{
|
|
||||||
return typeof(MyWebServices);
|
|
||||||
}
|
|
||||||
|
|
||||||
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
|
|
||||||
[DebuggerHidden()]
|
|
||||||
public override string ToString()
|
|
||||||
{
|
|
||||||
return base.ToString();
|
|
||||||
}
|
|
||||||
|
|
||||||
[DebuggerHidden()]
|
|
||||||
private static T Create__Instance__<T>(T instance) where T : new()
|
|
||||||
{
|
|
||||||
if (instance == null)
|
|
||||||
{
|
|
||||||
return new T();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return instance;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
[DebuggerHidden()]
|
|
||||||
private void Dispose__Instance__<T>(ref T instance)
|
|
||||||
{
|
|
||||||
instance = default;
|
|
||||||
}
|
|
||||||
|
|
||||||
[DebuggerHidden()]
|
|
||||||
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
|
|
||||||
public MyWebServices() : base()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private readonly static ThreadSafeObjectProvider<MyWebServices> m_MyWebServicesObjectProvider = new ThreadSafeObjectProvider<MyWebServices>();
|
|
||||||
/* TODO ERROR: Skipped EndIfDirectiveTrivia */
|
|
||||||
/* TODO ERROR: Skipped IfDirectiveTrivia *//* TODO ERROR: Skipped DisabledTextTrivia *//* TODO ERROR: Skipped EndIfDirectiveTrivia */
|
|
||||||
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
|
|
||||||
[System.Runtime.InteropServices.ComVisible(false)]
|
|
||||||
internal sealed class ThreadSafeObjectProvider<T> where T : new()
|
|
||||||
{
|
|
||||||
internal T GetInstance
|
|
||||||
{
|
|
||||||
/* TODO ERROR: Skipped IfDirectiveTrivia *//* TODO ERROR: Skipped DisabledTextTrivia *//* TODO ERROR: Skipped ElseDirectiveTrivia */
|
|
||||||
[DebuggerHidden()]
|
|
||||||
get
|
|
||||||
{
|
|
||||||
if (m_ThreadStaticValue == null)
|
|
||||||
m_ThreadStaticValue = new T();
|
|
||||||
return m_ThreadStaticValue;
|
|
||||||
}
|
|
||||||
/* TODO ERROR: Skipped EndIfDirectiveTrivia */
|
|
||||||
}
|
|
||||||
|
|
||||||
[DebuggerHidden()]
|
|
||||||
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
|
|
||||||
public ThreadSafeObjectProvider() : base()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/* TODO ERROR: Skipped IfDirectiveTrivia *//* TODO ERROR: Skipped DisabledTextTrivia *//* TODO ERROR: Skipped ElseDirectiveTrivia */
|
|
||||||
[System.Runtime.CompilerServices.CompilerGenerated()]
|
|
||||||
[ThreadStatic()]
|
|
||||||
private static T m_ThreadStaticValue;
|
|
||||||
/* TODO ERROR: Skipped EndIfDirectiveTrivia */
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/* TODO ERROR: Skipped EndIfDirectiveTrivia */
|
|
||||||
@@ -1,253 +0,0 @@
|
|||||||
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
|
||||||
|
|
||||||
// See Compiler::LoadXmlSolutionExtension
|
|
||||||
using System.Collections;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Data;
|
|
||||||
using System.Diagnostics;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Xml.Linq;
|
|
||||||
using Microsoft.VisualBasic;
|
|
||||||
using Microsoft.VisualBasic.CompilerServices;
|
|
||||||
|
|
||||||
namespace Pilz.Updating.UpdateInstaller.My
|
|
||||||
{
|
|
||||||
[Embedded()]
|
|
||||||
[DebuggerNonUserCode()]
|
|
||||||
[System.Runtime.CompilerServices.CompilerGenerated()]
|
|
||||||
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
|
|
||||||
internal sealed class InternalXmlHelper
|
|
||||||
{
|
|
||||||
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
|
|
||||||
private InternalXmlHelper()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public static string get_Value(IEnumerable<XElement> source)
|
|
||||||
{
|
|
||||||
foreach (XElement item in source)
|
|
||||||
return item.Value;
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void set_Value(IEnumerable<XElement> source, string value)
|
|
||||||
{
|
|
||||||
foreach (XElement item in source)
|
|
||||||
{
|
|
||||||
item.Value = value;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static string get_AttributeValue(IEnumerable<XElement> source, XName name)
|
|
||||||
{
|
|
||||||
foreach (XElement item in source)
|
|
||||||
return Conversions.ToString(item.Attribute(name));
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void set_AttributeValue(IEnumerable<XElement> source, XName name, string value)
|
|
||||||
{
|
|
||||||
foreach (XElement item in source)
|
|
||||||
{
|
|
||||||
item.SetAttributeValue(name, value);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static string get_AttributeValue(XElement source, XName name)
|
|
||||||
{
|
|
||||||
return Conversions.ToString(source.Attribute(name));
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void set_AttributeValue(XElement source, XName name, string value)
|
|
||||||
{
|
|
||||||
source.SetAttributeValue(name, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
|
|
||||||
public static XAttribute CreateAttribute(XName name, object value)
|
|
||||||
{
|
|
||||||
if (value is null)
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
return new XAttribute(name, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
|
|
||||||
public static XAttribute CreateNamespaceAttribute(XName name, XNamespace ns)
|
|
||||||
{
|
|
||||||
var a = new XAttribute(name, ns.NamespaceName);
|
|
||||||
a.AddAnnotation(ns);
|
|
||||||
return a;
|
|
||||||
}
|
|
||||||
|
|
||||||
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
|
|
||||||
public static object RemoveNamespaceAttributes(string[] inScopePrefixes, XNamespace[] inScopeNs, List<XAttribute> attributes, object obj)
|
|
||||||
{
|
|
||||||
if (obj is object)
|
|
||||||
{
|
|
||||||
XElement elem = obj as XElement;
|
|
||||||
if (elem is object)
|
|
||||||
{
|
|
||||||
return RemoveNamespaceAttributes(inScopePrefixes, inScopeNs, attributes, elem);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
IEnumerable elems = obj as IEnumerable;
|
|
||||||
if (elems is object)
|
|
||||||
{
|
|
||||||
return RemoveNamespaceAttributes(inScopePrefixes, inScopeNs, attributes, elems);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return obj;
|
|
||||||
}
|
|
||||||
|
|
||||||
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
|
|
||||||
public static IEnumerable RemoveNamespaceAttributes(string[] inScopePrefixes, XNamespace[] inScopeNs, List<XAttribute> attributes, IEnumerable obj)
|
|
||||||
{
|
|
||||||
if (obj is object)
|
|
||||||
{
|
|
||||||
IEnumerable<XElement> elems = obj as IEnumerable<XElement>;
|
|
||||||
if (elems is object)
|
|
||||||
{
|
|
||||||
return elems.Select(new RemoveNamespaceAttributesClosure(inScopePrefixes, inScopeNs, attributes).ProcessXElement);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return obj.Cast<object>().Select(new RemoveNamespaceAttributesClosure(inScopePrefixes, inScopeNs, attributes).ProcessObject);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return obj;
|
|
||||||
}
|
|
||||||
|
|
||||||
[DebuggerNonUserCode()]
|
|
||||||
[System.Runtime.CompilerServices.CompilerGenerated()]
|
|
||||||
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
|
|
||||||
private sealed class RemoveNamespaceAttributesClosure
|
|
||||||
{
|
|
||||||
private readonly string[] m_inScopePrefixes;
|
|
||||||
private readonly XNamespace[] m_inScopeNs;
|
|
||||||
private readonly List<XAttribute> m_attributes;
|
|
||||||
|
|
||||||
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
|
|
||||||
internal RemoveNamespaceAttributesClosure(string[] inScopePrefixes, XNamespace[] inScopeNs, List<XAttribute> attributes)
|
|
||||||
{
|
|
||||||
m_inScopePrefixes = inScopePrefixes;
|
|
||||||
m_inScopeNs = inScopeNs;
|
|
||||||
m_attributes = attributes;
|
|
||||||
}
|
|
||||||
|
|
||||||
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
|
|
||||||
internal XElement ProcessXElement(XElement elem)
|
|
||||||
{
|
|
||||||
return RemoveNamespaceAttributes(m_inScopePrefixes, m_inScopeNs, m_attributes, elem);
|
|
||||||
}
|
|
||||||
|
|
||||||
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
|
|
||||||
internal object ProcessObject(object obj)
|
|
||||||
{
|
|
||||||
XElement elem = obj as XElement;
|
|
||||||
if (elem is object)
|
|
||||||
{
|
|
||||||
return RemoveNamespaceAttributes(m_inScopePrefixes, m_inScopeNs, m_attributes, elem);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return obj;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
|
|
||||||
public static XElement RemoveNamespaceAttributes(string[] inScopePrefixes, XNamespace[] inScopeNs, List<XAttribute> attributes, XElement e)
|
|
||||||
{
|
|
||||||
if (e is object)
|
|
||||||
{
|
|
||||||
var a = e.FirstAttribute;
|
|
||||||
while (a is object)
|
|
||||||
{
|
|
||||||
var nextA = a.NextAttribute;
|
|
||||||
if (a.IsNamespaceDeclaration)
|
|
||||||
{
|
|
||||||
var ns = a.Annotation<XNamespace>();
|
|
||||||
string prefix = a.Name.LocalName;
|
|
||||||
if (ns is object)
|
|
||||||
{
|
|
||||||
if (inScopePrefixes is object && inScopeNs is object)
|
|
||||||
{
|
|
||||||
int lastIndex = inScopePrefixes.Length - 1;
|
|
||||||
for (int i = 0, loopTo = lastIndex; i <= loopTo; i++)
|
|
||||||
{
|
|
||||||
string currentInScopePrefix = inScopePrefixes[i];
|
|
||||||
var currentInScopeNs = inScopeNs[i];
|
|
||||||
if (prefix.Equals(currentInScopePrefix))
|
|
||||||
{
|
|
||||||
if (ns == currentInScopeNs)
|
|
||||||
{
|
|
||||||
// prefix and namespace match. Remove the unneeded ns attribute
|
|
||||||
a.Remove();
|
|
||||||
}
|
|
||||||
|
|
||||||
// prefix is in scope but refers to something else. Leave the ns attribute.
|
|
||||||
a = null;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (a is object)
|
|
||||||
{
|
|
||||||
// Prefix is not in scope
|
|
||||||
// Now check whether it's going to be in scope because it is in the attributes list
|
|
||||||
|
|
||||||
if (attributes is object)
|
|
||||||
{
|
|
||||||
int lastIndex = attributes.Count - 1;
|
|
||||||
for (int i = 0, loopTo1 = lastIndex; i <= loopTo1; i++)
|
|
||||||
{
|
|
||||||
var currentA = attributes[i];
|
|
||||||
string currentInScopePrefix = currentA.Name.LocalName;
|
|
||||||
var currentInScopeNs = currentA.Annotation<XNamespace>();
|
|
||||||
if (currentInScopeNs is object)
|
|
||||||
{
|
|
||||||
if (prefix.Equals(currentInScopePrefix))
|
|
||||||
{
|
|
||||||
if (ns == currentInScopeNs)
|
|
||||||
{
|
|
||||||
// prefix and namespace match. Remove the unneeded ns attribute
|
|
||||||
a.Remove();
|
|
||||||
}
|
|
||||||
|
|
||||||
// prefix is in scope but refers to something else. Leave the ns attribute.
|
|
||||||
a = null;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (a is object)
|
|
||||||
{
|
|
||||||
// Prefix is definitely not in scope
|
|
||||||
a.Remove();
|
|
||||||
// namespace is not defined either. Add this attributes list
|
|
||||||
attributes.Add(a);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
a = nextA;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return e;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
|
||||||
|
|
||||||
using System;
|
|
||||||
|
|
||||||
namespace Microsoft.VisualBasic
|
|
||||||
{
|
|
||||||
[Embedded()]
|
|
||||||
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Module | AttributeTargets.Assembly, Inherited = false)]
|
|
||||||
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
|
|
||||||
[System.Runtime.CompilerServices.CompilerGenerated()]
|
|
||||||
internal sealed class Embedded : Attribute
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,120 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<root>
|
|
||||||
<!--
|
|
||||||
Microsoft ResX Schema
|
|
||||||
|
|
||||||
Version 2.0
|
|
||||||
|
|
||||||
The primary goals of this format is to allow a simple XML format
|
|
||||||
that is mostly human readable. The generation and parsing of the
|
|
||||||
various data types are done through the TypeConverter classes
|
|
||||||
associated with the data types.
|
|
||||||
|
|
||||||
Example:
|
|
||||||
|
|
||||||
... ado.net/XML headers & schema ...
|
|
||||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
|
||||||
<resheader name="version">2.0</resheader>
|
|
||||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
|
||||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
|
||||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
|
||||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
|
||||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
|
||||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
|
||||||
</data>
|
|
||||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
|
||||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
|
||||||
<comment>This is a comment</comment>
|
|
||||||
</data>
|
|
||||||
|
|
||||||
There are any number of "resheader" rows that contain simple
|
|
||||||
name/value pairs.
|
|
||||||
|
|
||||||
Each data row contains a name, and value. The row also contains a
|
|
||||||
type or mimetype. Type corresponds to a .NET class that support
|
|
||||||
text/value conversion through the TypeConverter architecture.
|
|
||||||
Classes that don't support this are serialized and stored with the
|
|
||||||
mimetype set.
|
|
||||||
|
|
||||||
The mimetype is used for serialized objects, and tells the
|
|
||||||
ResXResourceReader how to depersist the object. This is currently not
|
|
||||||
extensible. For a given mimetype the value must be set accordingly:
|
|
||||||
|
|
||||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
|
||||||
that the ResXResourceWriter will generate, however the reader can
|
|
||||||
read any of the formats listed below.
|
|
||||||
|
|
||||||
mimetype: application/x-microsoft.net.object.binary.base64
|
|
||||||
value : The object must be serialized with
|
|
||||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
|
||||||
: and then encoded with base64 encoding.
|
|
||||||
|
|
||||||
mimetype: application/x-microsoft.net.object.soap.base64
|
|
||||||
value : The object must be serialized with
|
|
||||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
|
||||||
: and then encoded with base64 encoding.
|
|
||||||
|
|
||||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
|
||||||
value : The object must be serialized into a byte array
|
|
||||||
: using a System.ComponentModel.TypeConverter
|
|
||||||
: and then encoded with base64 encoding.
|
|
||||||
-->
|
|
||||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
|
||||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
|
||||||
<xsd:element name="root" msdata:IsDataSet="true">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:choice maxOccurs="unbounded">
|
|
||||||
<xsd:element name="metadata">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:sequence>
|
|
||||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
|
||||||
</xsd:sequence>
|
|
||||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
|
||||||
<xsd:attribute name="type" type="xsd:string" />
|
|
||||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
|
||||||
<xsd:attribute ref="xml:space" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
<xsd:element name="assembly">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:attribute name="alias" type="xsd:string" />
|
|
||||||
<xsd:attribute name="name" type="xsd:string" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
<xsd:element name="data">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:sequence>
|
|
||||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
|
||||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
|
||||||
</xsd:sequence>
|
|
||||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
|
||||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
|
||||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
|
||||||
<xsd:attribute ref="xml:space" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
<xsd:element name="resheader">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:sequence>
|
|
||||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
|
||||||
</xsd:sequence>
|
|
||||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
</xsd:choice>
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
</xsd:schema>
|
|
||||||
<resheader name="resmimetype">
|
|
||||||
<value>text/microsoft-resx</value>
|
|
||||||
</resheader>
|
|
||||||
<resheader name="version">
|
|
||||||
<value>2.0</value>
|
|
||||||
</resheader>
|
|
||||||
<resheader name="reader">
|
|
||||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
|
||||||
</resheader>
|
|
||||||
<resheader name="writer">
|
|
||||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
|
||||||
</resheader>
|
|
||||||
</root>
|
|
||||||
@@ -19,7 +19,7 @@ namespace Pilz.Updating.UpdateInstaller {
|
|||||||
// -Klasse über ein Tool wie ResGen oder Visual Studio automatisch generiert.
|
// -Klasse über ein Tool wie ResGen oder Visual Studio automatisch generiert.
|
||||||
// Um einen Member hinzuzufügen oder zu entfernen, bearbeiten Sie die .ResX-Datei und führen dann ResGen
|
// Um einen Member hinzuzufügen oder zu entfernen, bearbeiten Sie die .ResX-Datei und führen dann ResGen
|
||||||
// mit der /str-Option erneut aus, oder Sie erstellen Ihr VS-Projekt neu.
|
// mit der /str-Option erneut aus, oder Sie erstellen Ihr VS-Projekt neu.
|
||||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")]
|
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
|
||||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||||
internal class MyIcons {
|
internal class MyIcons {
|
||||||
|
|||||||
@@ -1,60 +1,27 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<OutputType>WinExe</OutputType>
|
<OutputType>WinExe</OutputType>
|
||||||
<StartupObject>Pilz.Updating.UpdateInstaller.My.MyApplication</StartupObject>
|
|
||||||
<RootNamespace>Pilz.Updating.UpdateInstaller</RootNamespace>
|
|
||||||
<MyType>WindowsForms</MyType>
|
<MyType>WindowsForms</MyType>
|
||||||
<TargetFramework>net8.0-windows</TargetFramework>
|
<TargetFrameworks>net8.0-windows</TargetFrameworks>
|
||||||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
||||||
<DefaultItemExcludes>$(DefaultItemExcludes);$(ProjectDir)**\*.vb</DefaultItemExcludes>
|
<DefaultItemExcludes>$(DefaultItemExcludes);$(ProjectDir)**\*.vb</DefaultItemExcludes>
|
||||||
<LangVersion>latest</LangVersion>
|
<LangVersion>latest</LangVersion>
|
||||||
<AssemblyTitle>Pilz.Updating.UpdateInstaller</AssemblyTitle>
|
<AssemblyTitle>Pilz.Updating.UpdateInstaller</AssemblyTitle>
|
||||||
<Company>Pilzinsel64</Company>
|
<Company>Pilzinsel64</Company>
|
||||||
<Product>Pilz.Updating.UpdateInstaller</Product>
|
<Product>Pilz.Updating.UpdateInstaller</Product>
|
||||||
<Copyright>Copyright © Pilzinsel64 2019 - 2020</Copyright>
|
|
||||||
<DocumentationFile>Pilz.Updating.UpdateInstaller.xml</DocumentationFile>
|
<DocumentationFile>Pilz.Updating.UpdateInstaller.xml</DocumentationFile>
|
||||||
<DefineTrace>true</DefineTrace>
|
<DefineTrace>true</DefineTrace>
|
||||||
<NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022,CS1591</NoWarn>
|
<NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022,CS1591</NoWarn>
|
||||||
<ExtrasEnableWinFormsProjectSetup>true</ExtrasEnableWinFormsProjectSetup>
|
<ExtrasEnableWinFormsProjectSetup>true</ExtrasEnableWinFormsProjectSetup>
|
||||||
<UseWindowsForms>true</UseWindowsForms>
|
<UseWindowsForms>true</UseWindowsForms>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
|
||||||
<DefineDebug>true</DefineDebug>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
|
||||||
<DefineDebug>false</DefineDebug>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup>
|
|
||||||
<OptionExplicit>On</OptionExplicit>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup>
|
|
||||||
<OptionCompare>Binary</OptionCompare>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup>
|
|
||||||
<OptionStrict>Off</OptionStrict>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup>
|
|
||||||
<OptionInfer>On</OptionInfer>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup>
|
|
||||||
<ApplicationIcon>icons8_software_installer.ico</ApplicationIcon>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'RelMono|AnyCPU'">
|
|
||||||
<Optimize>true</Optimize>
|
|
||||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
|
||||||
<Prefer32Bit>true</Prefer32Bit>
|
|
||||||
<DefineConstants>TRACE;RelMono</DefineConstants>
|
|
||||||
</PropertyGroup>
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Microsoft.VisualBasic" Version="10.3.0" />
|
<PackageReference Include="Microsoft.VisualBasic" Version="10.3.0" />
|
||||||
<PackageReference Include="Pilz.IO" Version="2.0.0" />
|
<PackageReference Include="Pilz.IO" Version="2.0.0" />
|
||||||
<PackageReference Include="Pilz.Plugins" Version="2.0.0" />
|
<PackageReference Include="Pilz.Plugins" Version="2.1.9" />
|
||||||
<PackageReference Include="System.IO.Compression" Version="4.3.0" />
|
<PackageReference Include="System.IO.Compression" Version="4.3.0" />
|
||||||
<PackageReference Include="System.Data.DataSetExtensions" Version="4.5.0" />
|
<PackageReference Include="System.Data.DataSetExtensions" Version="4.5.0" />
|
||||||
<PackageReference Include="System.Net.Http" Version="4.3.4" />
|
<PackageReference Include="System.Net.Http" Version="4.3.4" />
|
||||||
<PackageReference Include="UI.for.WinForms.AllControls.Net60">
|
|
||||||
<Version>2023.1.117</Version>
|
|
||||||
</PackageReference>
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Import Include="Microsoft.VisualBasic" />
|
<Import Include="Microsoft.VisualBasic" />
|
||||||
@@ -76,10 +43,6 @@
|
|||||||
<DependentUpon>Main.cs</DependentUpon>
|
<DependentUpon>Main.cs</DependentUpon>
|
||||||
<SubType>Form</SubType>
|
<SubType>Form</SubType>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Update="My Project\Application.Designer.cs">
|
|
||||||
<AutoGen>True</AutoGen>
|
|
||||||
<DependentUpon>Application.myapp</DependentUpon>
|
|
||||||
</Compile>
|
|
||||||
<Compile Update="MyIcons.Designer.cs">
|
<Compile Update="MyIcons.Designer.cs">
|
||||||
<DesignTime>True</DesignTime>
|
<DesignTime>True</DesignTime>
|
||||||
<AutoGen>True</AutoGen>
|
<AutoGen>True</AutoGen>
|
||||||
@@ -132,10 +95,6 @@
|
|||||||
</EmbeddedResource>
|
</EmbeddedResource>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include="My Project\Application.myapp">
|
|
||||||
<Generator>MyApplicationCodeGenerator</Generator>
|
|
||||||
<LastGenOutput>Application.Designer.cs</LastGenOutput>
|
|
||||||
</None>
|
|
||||||
<None Include="Properties\Settings.settings">
|
<None Include="Properties\Settings.settings">
|
||||||
<Generator>SettingsSingleFileGenerator</Generator>
|
<Generator>SettingsSingleFileGenerator</Generator>
|
||||||
<CustomToolNamespace>Pilz.Updating.UpdateInstaller.My</CustomToolNamespace>
|
<CustomToolNamespace>Pilz.Updating.UpdateInstaller.My</CustomToolNamespace>
|
||||||
@@ -152,11 +111,8 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
||||||
|
<PackageReference Include="UI.for.WinForms.Common" Version="2024.2.514" />
|
||||||
|
<PackageReference Include="UI.for.WinForms.Themes" Version="2024.2.514" />
|
||||||
<PackageReference Include="Z.ExtensionMethods.WithNamespace" Version="2.1.1" />
|
<PackageReference Include="Z.ExtensionMethods.WithNamespace" Version="2.1.1" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
|
||||||
<Compile Remove="obj\RelMono\TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs" />
|
|
||||||
<Compile Remove="obj\RelMono\TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs" />
|
|
||||||
<Compile Remove="obj\RelMono\TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs" />
|
|
||||||
</ItemGroup>
|
|
||||||
</Project>
|
</Project>
|
||||||
14
Pilz.Updating.UpdateInstaller/Program.cs
Normal file
14
Pilz.Updating.UpdateInstaller/Program.cs
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
using System.Windows.Forms;
|
||||||
|
|
||||||
|
namespace Pilz.Updating.UpdateInstaller;
|
||||||
|
|
||||||
|
internal static class Program
|
||||||
|
{
|
||||||
|
internal static void Main(string[] args)
|
||||||
|
{
|
||||||
|
Application.EnableVisualStyles();
|
||||||
|
Application.SetCompatibleTextRenderingDefault(false);
|
||||||
|
Application.SetHighDpiMode(HighDpiMode.PerMonitorV2);
|
||||||
|
Application.Run(new Main());
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,5 +1,4 @@
|
|||||||
using global::System;
|
using global::System;
|
||||||
using global::System.Reflection;
|
|
||||||
using global::System.Runtime.InteropServices;
|
using global::System.Runtime.InteropServices;
|
||||||
[assembly: ComVisible(false)]
|
[assembly: ComVisible(false)]
|
||||||
|
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ namespace Pilz.Updating.UpdateInstaller.My.Resources {
|
|||||||
// -Klasse über ein Tool wie ResGen oder Visual Studio automatisch generiert.
|
// -Klasse über ein Tool wie ResGen oder Visual Studio automatisch generiert.
|
||||||
// Um einen Member hinzuzufügen oder zu entfernen, bearbeiten Sie die .ResX-Datei und führen dann ResGen
|
// Um einen Member hinzuzufügen oder zu entfernen, bearbeiten Sie die .ResX-Datei und führen dann ResGen
|
||||||
// mit der /str-Option erneut aus, oder Sie erstellen Ihr VS-Projekt neu.
|
// mit der /str-Option erneut aus, oder Sie erstellen Ihr VS-Projekt neu.
|
||||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")]
|
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
|
||||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||||
internal class Resources {
|
internal class Resources {
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ namespace Pilz.Updating.UpdateInstaller.My.Resources {
|
|||||||
// -Klasse über ein Tool wie ResGen oder Visual Studio automatisch generiert.
|
// -Klasse über ein Tool wie ResGen oder Visual Studio automatisch generiert.
|
||||||
// Um einen Member hinzuzufügen oder zu entfernen, bearbeiten Sie die .ResX-Datei und führen dann ResGen
|
// Um einen Member hinzuzufügen oder zu entfernen, bearbeiten Sie die .ResX-Datei und führen dann ResGen
|
||||||
// mit der /str-Option erneut aus, oder Sie erstellen Ihr VS-Projekt neu.
|
// mit der /str-Option erneut aus, oder Sie erstellen Ihr VS-Projekt neu.
|
||||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")]
|
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
|
||||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||||
internal class UpdateInstallerGuiLangRes {
|
internal class UpdateInstallerGuiLangRes {
|
||||||
|
|||||||
@@ -1,73 +1,72 @@
|
|||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using System;
|
using System;
|
||||||
|
|
||||||
namespace Pilz.Updating
|
namespace Pilz.Updating;
|
||||||
|
|
||||||
|
public class ApplicationVersion
|
||||||
{
|
{
|
||||||
public class ApplicationVersion
|
|
||||||
|
// P r o p e r t i e s
|
||||||
|
|
||||||
|
[JsonConverter(typeof(Newtonsoft.Json.Converters.VersionConverter))]
|
||||||
|
public Version Version { get; set; }
|
||||||
|
public int Build { get; set; }
|
||||||
|
[JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))]
|
||||||
|
public Channels Channel { get; set; }
|
||||||
|
|
||||||
|
// C o n s t r u c t o r s
|
||||||
|
|
||||||
|
public ApplicationVersion() : this(new Version("1.0.0.0"))
|
||||||
{
|
{
|
||||||
|
}
|
||||||
|
|
||||||
// P r o p e r t i e s
|
public ApplicationVersion(Version version) : this(version, 1, Channels.Stable)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
[JsonConverter(typeof(Newtonsoft.Json.Converters.VersionConverter))]
|
public ApplicationVersion(Version version, int build, Channels channel)
|
||||||
public Version Version { get; set; }
|
{
|
||||||
public int Build { get; set; }
|
Version = version;
|
||||||
[JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))]
|
Build = build;
|
||||||
public Channels Channel { get; set; }
|
Channel = channel;
|
||||||
|
}
|
||||||
|
|
||||||
// C o n s t r u c t o r s
|
// F e a t u r e s
|
||||||
|
|
||||||
public ApplicationVersion() : this(new Version("1.0.0.0"))
|
public override string ToString()
|
||||||
{
|
{
|
||||||
}
|
return $"{Version.ToString()} {Channel.ToString()} {Build}";
|
||||||
|
}
|
||||||
|
|
||||||
public ApplicationVersion(Version version) : this(version, 1, Channels.Stable)
|
// O p e r a t o r s
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public ApplicationVersion(Version version, int build, Channels channel)
|
public static bool operator >(ApplicationVersion a, ApplicationVersion b)
|
||||||
{
|
{
|
||||||
Version = version;
|
return a.Version > b.Version || a.Version == b.Version && (a.Channel < b.Channel || (a.Channel == b.Channel && a.Build > b.Build));
|
||||||
Build = build;
|
}
|
||||||
Channel = channel;
|
|
||||||
}
|
|
||||||
|
|
||||||
// F e a t u r e s
|
public static bool operator <(ApplicationVersion a, ApplicationVersion b)
|
||||||
|
{
|
||||||
|
return a.Version < b.Version || a.Version == b.Version && (a.Channel > b.Channel || (a.Channel == b.Channel && a.Build < b.Build));
|
||||||
|
}
|
||||||
|
|
||||||
public override string ToString()
|
public static bool operator ==(ApplicationVersion a, ApplicationVersion b)
|
||||||
{
|
{
|
||||||
return $"{Version.ToString()} {Channel.ToString()} {Build}";
|
return a.Version == b.Version && a.Channel == b.Channel && a.Build == b.Build;
|
||||||
}
|
}
|
||||||
|
|
||||||
// O p e r a t o r s
|
public static bool operator !=(ApplicationVersion a, ApplicationVersion b)
|
||||||
|
{
|
||||||
|
return a.Version != b.Version || a.Channel != b.Channel || a.Build != b.Build;
|
||||||
|
}
|
||||||
|
|
||||||
public static bool operator >(ApplicationVersion a, ApplicationVersion b)
|
public static bool operator >=(ApplicationVersion a, ApplicationVersion b)
|
||||||
{
|
{
|
||||||
return a.Version > b.Version || a.Version == b.Version && (a.Channel < b.Channel || (a.Channel == b.Channel && a.Build > b.Build));
|
return a == b || a > b;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool operator <(ApplicationVersion a, ApplicationVersion b)
|
public static bool operator <=(ApplicationVersion a, ApplicationVersion b)
|
||||||
{
|
{
|
||||||
return a.Version < b.Version || a.Version == b.Version && (a.Channel > b.Channel || (a.Channel == b.Channel && a.Build < b.Build));
|
return a == b || a < b;
|
||||||
}
|
|
||||||
|
|
||||||
public static bool operator ==(ApplicationVersion a, ApplicationVersion b)
|
|
||||||
{
|
|
||||||
return a.Version == b.Version && a.Channel == b.Channel && a.Build == b.Build;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static bool operator !=(ApplicationVersion a, ApplicationVersion b)
|
|
||||||
{
|
|
||||||
return a.Version != b.Version || a.Channel != b.Channel || a.Build != b.Build;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static bool operator >=(ApplicationVersion a, ApplicationVersion b)
|
|
||||||
{
|
|
||||||
return a == b || a > b;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static bool operator <=(ApplicationVersion a, ApplicationVersion b)
|
|
||||||
{
|
|
||||||
return a == b || a < b;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,11 +1,10 @@
|
|||||||
|
|
||||||
namespace Pilz.Updating
|
namespace Pilz.Updating;
|
||||||
|
|
||||||
|
public enum Channels
|
||||||
{
|
{
|
||||||
public enum Channels
|
Stable,
|
||||||
{
|
PreRelease,
|
||||||
Stable,
|
Beta,
|
||||||
PreRelease,
|
Alpha
|
||||||
Beta,
|
|
||||||
Alpha
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -1,24 +1,23 @@
|
|||||||
using System;
|
using global::System.IO;
|
||||||
using global::System.IO;
|
using System;
|
||||||
|
|
||||||
namespace Pilz.Updating
|
namespace Pilz.Updating;
|
||||||
|
|
||||||
|
internal static class MyPaths
|
||||||
{
|
{
|
||||||
internal static class MyPaths
|
private static string p = string.Empty;
|
||||||
|
|
||||||
|
public static string GetMyAppDataPath()
|
||||||
{
|
{
|
||||||
private static string p = string.Empty;
|
if (string.IsNullOrEmpty(p))
|
||||||
|
|
||||||
public static string GetMyAppDataPath()
|
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(p))
|
p = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "PilzUpdater");
|
||||||
|
if (!Directory.Exists(p))
|
||||||
{
|
{
|
||||||
p = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "PilzUpdater");
|
Directory.CreateDirectory(p);
|
||||||
if (!Directory.Exists(p))
|
|
||||||
{
|
|
||||||
Directory.CreateDirectory(p);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return p;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return p;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">
|
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<RootNamespace>Pilz.Updating</RootNamespace>
|
<RootNamespace>Pilz.Updating</RootNamespace>
|
||||||
<TargetFrameworks>net6.0-windows;net8.0-windows</TargetFrameworks>
|
<TargetFrameworks>net8.0-windows</TargetFrameworks>
|
||||||
<DefaultItemExcludes>$(DefaultItemExcludes);$(ProjectDir)**\*.vb</DefaultItemExcludes>
|
<DefaultItemExcludes>$(DefaultItemExcludes);$(ProjectDir)**\*.vb</DefaultItemExcludes>
|
||||||
<LangVersion>latest</LangVersion>
|
<LangVersion>latest</LangVersion>
|
||||||
<AssemblyTitle>Pilz.Updating</AssemblyTitle>
|
<AssemblyTitle>Pilz.Updating</AssemblyTitle>
|
||||||
@@ -11,7 +11,6 @@
|
|||||||
<DocumentationFile>Pilz.Updating.xml</DocumentationFile>
|
<DocumentationFile>Pilz.Updating.xml</DocumentationFile>
|
||||||
<DefineTrace>true</DefineTrace>
|
<DefineTrace>true</DefineTrace>
|
||||||
<NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022,CS1591,CS0660,CS0661</NoWarn>
|
<NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022,CS1591,CS0660,CS0661</NoWarn>
|
||||||
<UseWindowsForms>true</UseWindowsForms>
|
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||||
<DefineDebug>true</DefineDebug>
|
<DefineDebug>true</DefineDebug>
|
||||||
@@ -37,7 +36,6 @@
|
|||||||
<DefineConstants>TRACE;RelMono</DefineConstants>
|
<DefineConstants>TRACE;RelMono</DefineConstants>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
|
|
||||||
<Version>2.0.0</Version>
|
<Version>2.0.0</Version>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
using global::System;
|
using global::System;
|
||||||
using global::System.Reflection;
|
|
||||||
using global::System.Runtime.CompilerServices;
|
using global::System.Runtime.CompilerServices;
|
||||||
using global::System.Runtime.InteropServices;
|
using global::System.Runtime.InteropServices;
|
||||||
[assembly: ComVisible(false)]
|
[assembly: ComVisible(false)]
|
||||||
|
|||||||
@@ -1,21 +1,20 @@
|
|||||||
using System.Collections.Generic;
|
using global::Newtonsoft.Json.Linq;
|
||||||
using global::Newtonsoft.Json.Linq;
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace Pilz.Updating
|
namespace Pilz.Updating;
|
||||||
|
|
||||||
|
public class UpdateInfo
|
||||||
{
|
{
|
||||||
public class UpdateInfo
|
public string UpdateInstallerLink { get; set; }
|
||||||
|
public List<UpdatePackageInfo> Packages { get; set; } = [];
|
||||||
|
|
||||||
|
public static UpdateInfo Parse(string str)
|
||||||
{
|
{
|
||||||
public string UpdateInstallerLink { get; set; }
|
return JObject.Parse(str).ToObject<UpdateInfo>();
|
||||||
public List<UpdatePackageInfo> Packages { get; set; } = new List<UpdatePackageInfo>();
|
}
|
||||||
|
|
||||||
public static UpdateInfo Parse(string str)
|
public override string ToString()
|
||||||
{
|
{
|
||||||
return JObject.Parse(str).ToObject<UpdateInfo>();
|
return JObject.FromObject(this).ToString();
|
||||||
}
|
|
||||||
|
|
||||||
public override string ToString()
|
|
||||||
{
|
|
||||||
return JObject.FromObject(this).ToString();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,31 +1,29 @@
|
|||||||
using System;
|
using global::Newtonsoft.Json.Linq;
|
||||||
using global::System.Drawing;
|
using System;
|
||||||
using global::Newtonsoft.Json.Linq;
|
|
||||||
|
|
||||||
namespace Pilz.Updating.UpdateInstaller
|
namespace Pilz.Updating.UpdateInstaller;
|
||||||
|
|
||||||
|
public class UpdateInstallerConfig
|
||||||
{
|
{
|
||||||
public class UpdateInstallerConfig
|
public string PackagePath { get; set; }
|
||||||
|
public bool RestartHostApplication { get; set; }
|
||||||
|
public string RestartHostApplicationArguments { get; set; }
|
||||||
|
public string ApplicationName { get; set; }
|
||||||
|
public string HostApplicationPath { get; set; }
|
||||||
|
public string HostApplicationProcessPath { get; set; }
|
||||||
|
public bool ForceClosingHostApplication { get; set; }
|
||||||
|
public uint MillisecondsToWaitForHostApplicationToClose { get; set; }
|
||||||
|
public bool UIDarkMode { get; set; }
|
||||||
|
public ApplicationVersion CurrentApplicationVersion { get; set; }
|
||||||
|
public ApplicationVersion NewApplicationVersion { get; set; }
|
||||||
|
|
||||||
|
public static UpdateInstallerConfig Parse(string str)
|
||||||
{
|
{
|
||||||
public string PackagePath { get; set; }
|
return JObject.Parse(System.Text.Encoding.Default.GetString(Convert.FromBase64String(str))).ToObject<UpdateInstallerConfig>();
|
||||||
public bool RestartHostApplication { get; set; }
|
}
|
||||||
public string RestartHostApplicationArguments { get; set; }
|
|
||||||
public string ApplicationName { get; set; }
|
|
||||||
public string HostApplicationPath { get; set; }
|
|
||||||
public string HostApplicationProcessPath { get; set; }
|
|
||||||
public bool ForceClosingHostApplication { get; set; }
|
|
||||||
public uint MillisecondsToWaitForHostApplicationToClose { get; set; }
|
|
||||||
public bool UIDarkMode { get; set; }
|
|
||||||
public ApplicationVersion CurrentApplicationVersion { get; set; }
|
|
||||||
public ApplicationVersion NewApplicationVersion { get; set; }
|
|
||||||
|
|
||||||
public static UpdateInstallerConfig Parse(string str)
|
public override string ToString()
|
||||||
{
|
{
|
||||||
return JObject.Parse(System.Text.Encoding.Default.GetString(Convert.FromBase64String(str))).ToObject<UpdateInstallerConfig>();
|
return Convert.ToBase64String(System.Text.Encoding.Default.GetBytes(JObject.FromObject(this).ToString()));
|
||||||
}
|
|
||||||
|
|
||||||
public override string ToString()
|
|
||||||
{
|
|
||||||
return Convert.ToBase64String(System.Text.Encoding.Default.GetBytes(JObject.FromObject(this).ToString()));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,16 +1,10 @@
|
|||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace Pilz.Updating
|
namespace Pilz.Updating;
|
||||||
|
|
||||||
|
public class UpdateNotes
|
||||||
{
|
{
|
||||||
public class UpdateNotes
|
public string Content { get; set; }
|
||||||
{
|
[JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))]
|
||||||
public string Content { get; set; }
|
public UpdateNotesContentType ContentType { get; set; } = UpdateNotesContentType.PlainText;
|
||||||
[JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))]
|
|
||||||
public UpdateNotesContentType ContentType { get; set; } = UpdateNotesContentType.PlainText;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,15 +1,8 @@
|
|||||||
using System;
|
namespace Pilz.Updating;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace Pilz.Updating
|
public enum UpdateNotesContentType
|
||||||
{
|
{
|
||||||
public enum UpdateNotesContentType
|
PlainText,
|
||||||
{
|
Markdown,
|
||||||
PlainText,
|
HTML
|
||||||
Markdown,
|
|
||||||
HTML
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,23 +1,22 @@
|
|||||||
|
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
namespace Pilz.Updating
|
namespace Pilz.Updating;
|
||||||
{
|
|
||||||
public class UpdatePackageInfo
|
|
||||||
{
|
|
||||||
public string Name { get; set; }
|
|
||||||
public ApplicationVersion Version { get; set; }
|
|
||||||
public UpdateNotes Notes { get; } = new UpdateNotes();
|
|
||||||
public string Packagelink { get; set; }
|
|
||||||
|
|
||||||
[JsonProperty]
|
public class UpdatePackageInfo
|
||||||
private string Changelog
|
{
|
||||||
|
public string Name { get; set; }
|
||||||
|
public ApplicationVersion Version { get; set; }
|
||||||
|
public UpdateNotes Notes { get; } = new UpdateNotes();
|
||||||
|
public string Packagelink { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty]
|
||||||
|
private string Changelog
|
||||||
|
{
|
||||||
|
set
|
||||||
{
|
{
|
||||||
set
|
Notes.Content = value;
|
||||||
{
|
Notes.ContentType = UpdateNotesContentType.PlainText;
|
||||||
Notes.Content = value;
|
|
||||||
Notes.ContentType = UpdateNotesContentType.PlainText;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,103 +0,0 @@
|
|||||||
|
|
||||||
|
|
||||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
||||||
|
|
||||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
|
||||||
<head>
|
|
||||||
<title>Telerik UI for WinForms Upgrade Wizard Log</title>
|
|
||||||
<style type="text/css">
|
|
||||||
body {
|
|
||||||
margin: 0;
|
|
||||||
padding: 0;
|
|
||||||
top: 0;
|
|
||||||
left: 0;
|
|
||||||
width: 100%;
|
|
||||||
background-color: #fff;
|
|
||||||
font: normal 12px Arial, sans-serif;
|
|
||||||
line-height: 1.5;
|
|
||||||
}
|
|
||||||
#header {
|
|
||||||
display: block;
|
|
||||||
margin: 0;
|
|
||||||
padding: 20px;
|
|
||||||
height: 60px;
|
|
||||||
min-width: 600px;
|
|
||||||
background: url('file:///c:/users/pilz/appdata/local/microsoft/visualstudio/17.0_5e953d86/extensions/x03qv30a.dul/Resources/T4Templates/UpgradeLog/Logo.png') no-repeat right 30px top 30px;
|
|
||||||
background-color: #0e0e0e;
|
|
||||||
color: #909090;
|
|
||||||
font: normal 10px Arial, sans-serif;
|
|
||||||
}
|
|
||||||
#header span {
|
|
||||||
display: block;
|
|
||||||
color: #fff;
|
|
||||||
font: normal 22px Arial, sans-serif;
|
|
||||||
}
|
|
||||||
#legend {
|
|
||||||
display: block;
|
|
||||||
height: 20px;
|
|
||||||
margin: 0;
|
|
||||||
padding: 0;
|
|
||||||
background-color: #0e0e0e;
|
|
||||||
font: normal 12px Arial, sans-serif;
|
|
||||||
}
|
|
||||||
#legend span {
|
|
||||||
display: block;
|
|
||||||
float: left;
|
|
||||||
height: 18px;
|
|
||||||
margin: 0;
|
|
||||||
padding: 2px 10px 0 10px;
|
|
||||||
background-color: #8e8e8e;
|
|
||||||
font: normal 12px Arial, sans-serif;
|
|
||||||
}
|
|
||||||
table#logTable {
|
|
||||||
border: 1px solid #999;
|
|
||||||
border-collapse: collapse;
|
|
||||||
}
|
|
||||||
table#logTable th, table#logTable td {
|
|
||||||
border: 1px solid #999;
|
|
||||||
padding: 5px 10px;
|
|
||||||
text-align: left;
|
|
||||||
}
|
|
||||||
table#logTable th {
|
|
||||||
border: 0;
|
|
||||||
padding: 5px 10px;
|
|
||||||
background-color: #8e8e8e;
|
|
||||||
height: 20px;
|
|
||||||
font: bold 14px Arial, sans-serif;
|
|
||||||
color: #fff;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
</head>
|
|
||||||
|
|
||||||
<body>
|
|
||||||
<div>
|
|
||||||
<table id="logTable" cellpadding="0px" cellspacing="0px">
|
|
||||||
<tbody>
|
|
||||||
<tr>
|
|
||||||
<td colspan="5" style="padding: 0;">
|
|
||||||
<div id="header">
|
|
||||||
Telerik UI for WinForms <span>Upgrade Wizard Log</span>
|
|
||||||
</div>
|
|
||||||
<div id="legend">
|
|
||||||
<span style="background-color: #0e0e0e; color: #fff;">Processed: 0</span>
|
|
||||||
<span style="background-color: green; color: #fff;">Succeeded: 0</span>
|
|
||||||
<span style="background-color: blue; color: #fff;">Info: 0</span>
|
|
||||||
<span style="background-color: gold; color: #fff;">Warnings: 0</span>
|
|
||||||
<span style="background-color: red; color: #fff;">Failed: 0</span>
|
|
||||||
</div>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<th> </th>
|
|
||||||
<th>Project</th>
|
|
||||||
<th>Title</th>
|
|
||||||
<th>Details</th>
|
|
||||||
<th>Result</th>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
</tr>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
Reference in New Issue
Block a user