sync project paths & namespaces

This commit is contained in:
2023-09-22 19:06:20 +02:00
parent 750a3dabe3
commit d65f812684
53 changed files with 43 additions and 470 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 108 KiB

View File

@@ -0,0 +1,41 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
</startup>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-12.0.0.0" newVersion="12.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Interactive.Async" publicKeyToken="94bc3704cddfc263" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Collections.Immutable" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-1.2.5.0" newVersion="1.2.5.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Memory" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.1.1" newVersion="4.0.1.1" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Threading.Tasks.Extensions" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.2.0.1" newVersion="4.2.0.1" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.6.0" newVersion="4.0.6.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Linq.Async" publicKeyToken="94bc3704cddfc263" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.1.0.0" newVersion="4.1.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
<appSettings>
<add key="TelerikWinFormsThemeName" value="Fluent" />
</appSettings>
</configuration>

View File

@@ -0,0 +1,158 @@
using Discord;
using Discord.Rest;
using Discord.WebSocket;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using static Microsoft.VisualBasic.CompilerServices.LikeOperator;
namespace SM64RomManager.ProgressUpdater
{
public class DiscordMgr
{
public delegate void LoggedMsgEventHandler(object sender, string logmsg, bool isError);
public event EventHandler GotReady;
public event EventHandler HasDisconnected;
public event LoggedMsgEventHandler LoggedMsg;
private Settings settings;
private string ParamCounterName { get => settings.DiscordMsgParamCounter + "="; }
public DiscordSocketClient Client { get; private set; }
public bool IsReady { get; private set; } = false;
public DiscordMgr(Settings settings)
{
SetSettings(settings);
}
public void SetSettings(Settings settings)
{
this.settings = settings;
}
public async void Start()
{
if (settings.DiscordUploadEnabled && !string.IsNullOrEmpty(settings.DiscordBotToken))
{
var socketConfig = new DiscordSocketConfig();
socketConfig.RestClientProvider = Discord.Net.Rest.DefaultRestClientProvider.Create(useProxy: true);
socketConfig.WebSocketProvider = Discord.Net.WebSockets.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, settings.DiscordBotToken);
await Client.StartAsync();
}
else
LoggedMsg?.Invoke(this, "Disabled or Token invalid", true);
}
public async void Stop()
{
await Client.StopAsync();
await Client.LogoutAsync();
}
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;
}
public async void SetOnline()
{
await Client.SetStatusAsync(UserStatus.Online);
}
public async Task SendMessage()
{
var newVersion = new Version(settings.Version);
var guild = Client.GetGuild(settings.DiscordGuildID);
if (guild is object)
{
var channel = guild.GetTextChannel(settings.DiscordChannelID);
if (channel is object)
{
int newCounter = -1;
RestUserMessage msgToDelete = null;
// Delete last messages
var lastMsgs = await channel.GetMessagesAsync(10).ToArrayAsync();
foreach (var msgs in lastMsgs)
{
foreach (var msg in msgs)
{
if (newCounter == -1 && msg is RestUserMessage)
{
var umsg = (RestUserMessage)msg;
bool deleteMsg = false;
bool checkMsgString(string strMsg) =>
LikeString(strMsg, string.Format(settings.DiscordMsgBaseURL, newVersion.Major, newVersion.Minor, newVersion.Build, newVersion.Revision, "*"), Microsoft.VisualBasic.CompareMethod.Text);
int getNewCounter(string strUrl) =>
Convert.ToInt32(strUrl.Substring(strUrl.IndexOf(ParamCounterName) + ParamCounterName.Length));
foreach (var embed in umsg.Embeds)
{
if (!deleteMsg && !string.IsNullOrEmpty(embed.Image?.Url) && checkMsgString(embed.Image?.Url))
{
deleteMsg = true;
newCounter = getNewCounter(embed.Image?.Url);
}
}
if (!deleteMsg && !string.IsNullOrEmpty(umsg.Content) && checkMsgString(umsg.Content))
{
deleteMsg = true;
newCounter = getNewCounter(umsg.Content);
}
if (deleteMsg)
msgToDelete = umsg;
}
}
}
// Set new counter
newCounter += 1;
// Build embed
var embedBuilder = new EmbedBuilder();
embedBuilder.ImageUrl = string.Format(settings.DiscordMsgBaseURL, newVersion.Major, newVersion.Minor, newVersion.Build, newVersion.Revision, newCounter);
var newEmbed = embedBuilder.Build();
// Send Message
await channel.SendMessageAsync(embed: newEmbed);
// Delete old message
if (msgToDelete is object)
await msgToDelete.DeleteAsync();
}
}
}
}
}

View File

@@ -0,0 +1,226 @@
namespace SM64RomManager.ProgressUpdater
{
partial class DiscordSettingsDialog
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(DiscordSettingsDialog));
this.panel1 = new System.Windows.Forms.Panel();
this.radWaitingBar1 = new Telerik.WinControls.UI.RadWaitingBar();
this.radTreeView1 = new Telerik.WinControls.UI.RadTreeView();
this.dotsRingWaitingBarIndicatorElement1 = new Telerik.WinControls.UI.DotsRingWaitingBarIndicatorElement();
this.RadButton_LoadServersAndChannels = new Telerik.WinControls.UI.RadButton();
this.RadTextBoxControl_UrlExtraCounterParamName = new Telerik.WinControls.UI.RadTextBoxControl();
this.radLabel3 = new Telerik.WinControls.UI.RadLabel();
this.RadTextBoxControl_ImageBaseURL = new Telerik.WinControls.UI.RadTextBoxControl();
this.radLabel2 = new Telerik.WinControls.UI.RadLabel();
this.RadTextBoxControl_DiscordBotToken = new Telerik.WinControls.UI.RadTextBoxControl();
this.radLabel1 = new Telerik.WinControls.UI.RadLabel();
this.RadCheckBox_EnableDiscordUpload = new Telerik.WinControls.UI.RadCheckBox();
this.panel1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.radWaitingBar1)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.radTreeView1)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.RadButton_LoadServersAndChannels)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.RadTextBoxControl_UrlExtraCounterParamName)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.radLabel3)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.RadTextBoxControl_ImageBaseURL)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.radLabel2)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.RadTextBoxControl_DiscordBotToken)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.radLabel1)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.RadCheckBox_EnableDiscordUpload)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this)).BeginInit();
this.SuspendLayout();
//
// panel1
//
this.panel1.BackColor = System.Drawing.Color.Transparent;
this.panel1.Controls.Add(this.radWaitingBar1);
this.panel1.Controls.Add(this.radTreeView1);
this.panel1.Controls.Add(this.RadButton_LoadServersAndChannels);
this.panel1.Controls.Add(this.RadTextBoxControl_UrlExtraCounterParamName);
this.panel1.Controls.Add(this.radLabel3);
this.panel1.Controls.Add(this.RadTextBoxControl_ImageBaseURL);
this.panel1.Controls.Add(this.radLabel2);
this.panel1.Controls.Add(this.RadTextBoxControl_DiscordBotToken);
this.panel1.Controls.Add(this.radLabel1);
this.panel1.Controls.Add(this.RadCheckBox_EnableDiscordUpload);
this.panel1.Dock = System.Windows.Forms.DockStyle.Fill;
this.panel1.Location = new System.Drawing.Point(0, 0);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(511, 281);
this.panel1.TabIndex = 0;
//
// radWaitingBar1
//
this.radWaitingBar1.AssociatedControl = this.radTreeView1;
this.radWaitingBar1.Location = new System.Drawing.Point(127, 241);
this.radWaitingBar1.Name = "radWaitingBar1";
this.radWaitingBar1.Size = new System.Drawing.Size(70, 70);
this.radWaitingBar1.TabIndex = 9;
this.radWaitingBar1.Text = "radWaitingBar1";
this.radWaitingBar1.WaitingIndicators.Add(this.dotsRingWaitingBarIndicatorElement1);
this.radWaitingBar1.WaitingIndicatorSize = new System.Drawing.Size(100, 14);
this.radWaitingBar1.WaitingSpeed = 50;
this.radWaitingBar1.WaitingStyle = Telerik.WinControls.Enumerations.WaitingBarStyles.DotsRing;
this.radWaitingBar1.WaitingStarted += new System.EventHandler(this.RadWaitingBar1_WaitingStarted);
this.radWaitingBar1.WaitingStopped += new System.EventHandler(this.RadWaitingBar1_WaitingStopped);
//
// radTreeView1
//
this.radTreeView1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Right)));
this.radTreeView1.ItemHeight = 28;
this.radTreeView1.LineColor = System.Drawing.Color.FromArgb(((int)(((byte)(204)))), ((int)(((byte)(204)))), ((int)(((byte)(204)))));
this.radTreeView1.LineStyle = Telerik.WinControls.UI.TreeLineStyle.Solid;
this.radTreeView1.Location = new System.Drawing.Point(289, 34);
this.radTreeView1.Name = "radTreeView1";
this.radTreeView1.Size = new System.Drawing.Size(219, 244);
this.radTreeView1.TabIndex = 8;
this.radTreeView1.SelectedNodeChanged += new Telerik.WinControls.UI.RadTreeView.RadTreeViewEventHandler(this.RadTreeView1_SelectedNodeChanged);
//
// dotsRingWaitingBarIndicatorElement1
//
this.dotsRingWaitingBarIndicatorElement1.Name = "dotsRingWaitingBarIndicatorElement1";
//
// RadButton_LoadServersAndChannels
//
this.RadButton_LoadServersAndChannels.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.RadButton_LoadServersAndChannels.Location = new System.Drawing.Point(289, 4);
this.RadButton_LoadServersAndChannels.Name = "RadButton_LoadServersAndChannels";
this.RadButton_LoadServersAndChannels.Size = new System.Drawing.Size(219, 24);
this.RadButton_LoadServersAndChannels.TabIndex = 7;
this.RadButton_LoadServersAndChannels.Text = "Load Server and Channels";
this.RadButton_LoadServersAndChannels.Click += new System.EventHandler(this.ButtonX1_Click);
//
// RadTextBoxControl_UrlExtraCounterParamName
//
this.RadTextBoxControl_UrlExtraCounterParamName.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.RadTextBoxControl_UrlExtraCounterParamName.Location = new System.Drawing.Point(3, 155);
this.RadTextBoxControl_UrlExtraCounterParamName.Name = "RadTextBoxControl_UrlExtraCounterParamName";
this.RadTextBoxControl_UrlExtraCounterParamName.Size = new System.Drawing.Size(280, 22);
this.RadTextBoxControl_UrlExtraCounterParamName.TabIndex = 6;
this.RadTextBoxControl_UrlExtraCounterParamName.Click += new System.EventHandler(this.TextBoxX_UrlExtraCounterParam_TextChanged);
//
// radLabel3
//
this.radLabel3.Location = new System.Drawing.Point(3, 131);
this.radLabel3.Name = "radLabel3";
this.radLabel3.Size = new System.Drawing.Size(164, 18);
this.radLabel3.TabIndex = 5;
this.radLabel3.Text = "URL extra counter param name:";
//
// RadTextBoxControl_ImageBaseURL
//
this.RadTextBoxControl_ImageBaseURL.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.RadTextBoxControl_ImageBaseURL.Location = new System.Drawing.Point(3, 103);
this.RadTextBoxControl_ImageBaseURL.Name = "RadTextBoxControl_ImageBaseURL";
this.RadTextBoxControl_ImageBaseURL.Size = new System.Drawing.Size(280, 22);
this.RadTextBoxControl_ImageBaseURL.TabIndex = 4;
this.RadTextBoxControl_ImageBaseURL.Click += new System.EventHandler(this.TextBoxX_ImgBaseURL_TextChanged);
//
// radLabel2
//
this.radLabel2.Location = new System.Drawing.Point(3, 79);
this.radLabel2.Name = "radLabel2";
this.radLabel2.Size = new System.Drawing.Size(89, 18);
this.radLabel2.TabIndex = 3;
this.radLabel2.Text = "Image Base URL:";
//
// RadTextBoxControl_DiscordBotToken
//
this.RadTextBoxControl_DiscordBotToken.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.RadTextBoxControl_DiscordBotToken.Location = new System.Drawing.Point(3, 51);
this.RadTextBoxControl_DiscordBotToken.Name = "RadTextBoxControl_DiscordBotToken";
this.RadTextBoxControl_DiscordBotToken.Size = new System.Drawing.Size(280, 22);
this.RadTextBoxControl_DiscordBotToken.TabIndex = 2;
this.RadTextBoxControl_DiscordBotToken.Click += new System.EventHandler(this.TextBoxX_BotToken_TextChanged);
//
// radLabel1
//
this.radLabel1.Location = new System.Drawing.Point(3, 27);
this.radLabel1.Name = "radLabel1";
this.radLabel1.Size = new System.Drawing.Size(100, 18);
this.radLabel1.TabIndex = 1;
this.radLabel1.Text = "Discord Bot Token:";
//
// RadCheckBox_EnableDiscordUpload
//
this.RadCheckBox_EnableDiscordUpload.Location = new System.Drawing.Point(3, 3);
this.RadCheckBox_EnableDiscordUpload.Name = "RadCheckBox_EnableDiscordUpload";
this.RadCheckBox_EnableDiscordUpload.Size = new System.Drawing.Size(137, 18);
this.RadCheckBox_EnableDiscordUpload.TabIndex = 0;
this.RadCheckBox_EnableDiscordUpload.Text = "Enable Discord Upload";
this.RadCheckBox_EnableDiscordUpload.Click += new System.EventHandler(this.CheckBoxX_EnableDiscordUpload_CheckedChanged);
//
// DiscordSettingsDialog
//
this.ClientSize = new System.Drawing.Size(511, 281);
this.Controls.Add(this.panel1);
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.Name = "DiscordSettingsDialog";
//
//
//
this.RootElement.ApplyShapeToControl = true;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "Discord Settings";
this.panel1.ResumeLayout(false);
this.panel1.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.radWaitingBar1)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.radTreeView1)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.RadButton_LoadServersAndChannels)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.RadTextBoxControl_UrlExtraCounterParamName)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.radLabel3)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.RadTextBoxControl_ImageBaseURL)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.radLabel2)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.RadTextBoxControl_DiscordBotToken)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.radLabel1)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.RadCheckBox_EnableDiscordUpload)).EndInit();
((System.ComponentModel.ISupportInitialize)(this)).EndInit();
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.Panel panel1;
private Telerik.WinControls.UI.RadTreeView radTreeView1;
private Telerik.WinControls.UI.RadButton RadButton_LoadServersAndChannels;
private Telerik.WinControls.UI.RadTextBoxControl RadTextBoxControl_UrlExtraCounterParamName;
private Telerik.WinControls.UI.RadLabel radLabel3;
private Telerik.WinControls.UI.RadTextBoxControl RadTextBoxControl_ImageBaseURL;
private Telerik.WinControls.UI.RadLabel radLabel2;
private Telerik.WinControls.UI.RadTextBoxControl RadTextBoxControl_DiscordBotToken;
private Telerik.WinControls.UI.RadLabel radLabel1;
private Telerik.WinControls.UI.RadCheckBox RadCheckBox_EnableDiscordUpload;
private Telerik.WinControls.UI.RadWaitingBar radWaitingBar1;
private Telerik.WinControls.UI.DotsRingWaitingBarIndicatorElement dotsRingWaitingBarIndicatorElement1;
}
}

View File

@@ -0,0 +1,123 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using Telerik.WinControls;
using Telerik.WinControls.UI;
namespace SM64RomManager.ProgressUpdater
{
public partial class DiscordSettingsDialog : RadForm
{
private readonly Settings settings;
public DiscordSettingsDialog(Settings settings)
{
InitializeComponent();
this.settings = settings;
RadTextBoxControl_DiscordBotToken.Text = settings.DiscordBotToken;
RadTextBoxControl_ImageBaseURL.Text = settings.DiscordMsgBaseURL;
RadTextBoxControl_UrlExtraCounterParamName.Text = settings.DiscordMsgParamCounter;
RadCheckBox_EnableDiscordUpload.Checked = settings.DiscordUploadEnabled;
}
private void TextBoxX_BotToken_TextChanged(object sender, EventArgs e)
{
settings.DiscordBotToken = RadTextBoxControl_DiscordBotToken.Text.Trim();
}
private void TextBoxX_ImgBaseURL_TextChanged(object sender, EventArgs e)
{
settings.DiscordMsgBaseURL = RadTextBoxControl_ImageBaseURL.Text.Trim();
}
private void TextBoxX_UrlExtraCounterParam_TextChanged(object sender, EventArgs e)
{
settings.DiscordMsgParamCounter = RadTextBoxControl_UrlExtraCounterParamName.Text.Trim();
}
private void ButtonX1_Click(object sender, EventArgs e)
{
radWaitingBar1.StartWaiting();
RadButton_LoadServersAndChannels.Enabled = false;
var dmgr = new DiscordMgr(settings);
bool hasError = false;
dmgr.LoggedMsg += (ssender, msg, isError) => { if (hasError) hasError = true; };
dmgr.Start();
while (!dmgr.IsReady && !hasError)
{
Application.DoEvents();
}
if (hasError)
{
RadMessageBox.Show("Entwender deaktiviert oder Token ist falsch.", string.Empty, MessageBoxButtons.OK, RadMessageIcon.Error);
}
else
{
radTreeView1.BeginUpdate();
radTreeView1.Nodes.Clear();
foreach (var guild in dmgr.Client.Guilds)
{
var nGuild = new RadTreeNode()
{
Name = "g" + guild.Id,
Text = guild.Name,
Tag = guild.Id,
Expanded = true
};
foreach (var channel in guild.TextChannels)
{
var nChannel = new RadTreeNode()
{
Name = "c" + channel.Id,
Text = "#" + channel.Name,
Tag = channel.Id
};
nGuild.Nodes.Add(nChannel);
}
radTreeView1.Nodes.Add(nGuild);
}
radTreeView1.EndUpdate();
radTreeView1.Refresh();
dmgr.Stop();
}
radWaitingBar1.StopWaiting();
}
private void RadTreeView1_SelectedNodeChanged(object sender, RadTreeViewEventArgs e)
{
if (e.Node.Name.StartsWith("c"))
{
settings.DiscordChannelID = (ulong)e.Node.Tag;
settings.DiscordGuildID = (ulong)e.Node.Parent.Tag;
}
}
private void CheckBoxX_EnableDiscordUpload_CheckedChanged(object sender, EventArgs e)
{
settings.DiscordUploadEnabled = RadCheckBox_EnableDiscordUpload.Checked;
}
private void RadWaitingBar1_WaitingStarted(object sender, EventArgs e)
{
RadButton_LoadServersAndChannels.Enabled = false;
}
private void RadWaitingBar1_WaitingStopped(object sender, EventArgs e)
{
RadButton_LoadServersAndChannels.Enabled = true;
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,269 @@
using System;
using System.Diagnostics;
using System.Drawing;
using System.Runtime.CompilerServices;
using System.Windows.Forms;
using Microsoft.VisualBasic.CompilerServices;
namespace SM64RomManager.ProgressUpdater
{
[DesignerGenerated()]
public partial class Form1 : Telerik.WinControls.UI.RadForm
{
// Das Formular überschreibt den Löschvorgang, um die Komponentenliste zu bereinigen.
[DebuggerNonUserCode()]
protected override void Dispose(bool disposing)
{
try
{
if (disposing && components is object)
{
components.Dispose();
}
}
finally
{
base.Dispose(disposing);
}
}
// Wird vom Windows Form-Designer benötigt.
private System.ComponentModel.IContainer components = new System.ComponentModel.Container();
// Hinweis: Die folgende Prozedur ist für den Windows Form-Designer erforderlich.
// Das Bearbeiten ist mit dem Windows Form-Designer möglich.
// Das Bearbeiten mit dem Code-Editor ist nicht möglich.
[DebuggerStepThrough()]
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Form1));
this.Panel1 = new System.Windows.Forms.Panel();
this.RadButton_InvertImage = new Telerik.WinControls.UI.RadButton();
this.RadButton_PasteFromDocument = new Telerik.WinControls.UI.RadButton();
this.RadButton_PasteFromClipboard = new Telerik.WinControls.UI.RadButton();
this.Panel2 = new System.Windows.Forms.Panel();
this.RadButton_Upload = new Telerik.WinControls.UI.RadButton();
this.RadDropDownList_Version = new Telerik.WinControls.UI.RadDropDownList();
this.radLabel1 = new Telerik.WinControls.UI.RadLabel();
this.RadButton_DiscordSetup = new Telerik.WinControls.UI.RadButton();
this.RadButton_SetupWebDav = new Telerik.WinControls.UI.RadButton();
this.PictureBox1 = new System.Windows.Forms.PictureBox();
this.radWaitingBar1 = new Telerik.WinControls.UI.RadWaitingBar();
this.dotsRingWaitingBarIndicatorElement1 = new Telerik.WinControls.UI.DotsRingWaitingBarIndicatorElement();
this.Panel1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.RadButton_InvertImage)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.RadButton_PasteFromDocument)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.RadButton_PasteFromClipboard)).BeginInit();
this.Panel2.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.RadButton_Upload)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.RadDropDownList_Version)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.radLabel1)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.RadButton_DiscordSetup)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.RadButton_SetupWebDav)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.PictureBox1)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.radWaitingBar1)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this)).BeginInit();
this.SuspendLayout();
//
// Panel1
//
this.Panel1.BackColor = System.Drawing.Color.Transparent;
this.Panel1.Controls.Add(this.RadButton_InvertImage);
this.Panel1.Controls.Add(this.RadButton_PasteFromDocument);
this.Panel1.Controls.Add(this.RadButton_PasteFromClipboard);
this.Panel1.Controls.Add(this.Panel2);
this.Panel1.Controls.Add(this.PictureBox1);
this.Panel1.Dock = System.Windows.Forms.DockStyle.Fill;
this.Panel1.Location = new System.Drawing.Point(0, 0);
this.Panel1.Name = "Panel1";
this.Panel1.Size = new System.Drawing.Size(694, 508);
this.Panel1.TabIndex = 0;
//
// RadButton_InvertImage
//
this.RadButton_InvertImage.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.RadButton_InvertImage.Location = new System.Drawing.Point(563, 33);
this.RadButton_InvertImage.Name = "RadButton_InvertImage";
this.RadButton_InvertImage.Size = new System.Drawing.Size(128, 24);
this.RadButton_InvertImage.TabIndex = 22;
this.RadButton_InvertImage.Text = "Invert Image";
this.RadButton_InvertImage.Click += new System.EventHandler(this.buttonX1_Click_1);
//
// RadButton_PasteFromDocument
//
this.RadButton_PasteFromDocument.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.RadButton_PasteFromDocument.Location = new System.Drawing.Point(429, 3);
this.RadButton_PasteFromDocument.Name = "RadButton_PasteFromDocument";
this.RadButton_PasteFromDocument.Size = new System.Drawing.Size(128, 24);
this.RadButton_PasteFromDocument.TabIndex = 1;
this.RadButton_PasteFromDocument.Text = "Paste from Document";
this.RadButton_PasteFromDocument.Click += new System.EventHandler(this.ButtonX_PasteDocument_Click);
//
// RadButton_PasteFromClipboard
//
this.RadButton_PasteFromClipboard.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.RadButton_PasteFromClipboard.Location = new System.Drawing.Point(563, 3);
this.RadButton_PasteFromClipboard.Name = "RadButton_PasteFromClipboard";
this.RadButton_PasteFromClipboard.Size = new System.Drawing.Size(128, 24);
this.RadButton_PasteFromClipboard.TabIndex = 21;
this.RadButton_PasteFromClipboard.Text = "Paste from Clipboard";
this.RadButton_PasteFromClipboard.Click += new System.EventHandler(this.ButtonX1_Click);
//
// Panel2
//
this.Panel2.Controls.Add(this.RadButton_Upload);
this.Panel2.Controls.Add(this.RadDropDownList_Version);
this.Panel2.Controls.Add(this.radLabel1);
this.Panel2.Controls.Add(this.RadButton_DiscordSetup);
this.Panel2.Controls.Add(this.RadButton_SetupWebDav);
this.Panel2.Dock = System.Windows.Forms.DockStyle.Left;
this.Panel2.Location = new System.Drawing.Point(0, 0);
this.Panel2.Name = "Panel2";
this.Panel2.Size = new System.Drawing.Size(200, 508);
this.Panel2.TabIndex = 1;
//
// RadButton_Upload
//
this.RadButton_Upload.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.RadButton_Upload.Location = new System.Drawing.Point(3, 457);
this.RadButton_Upload.Name = "RadButton_Upload";
this.RadButton_Upload.Size = new System.Drawing.Size(194, 48);
this.RadButton_Upload.TabIndex = 18;
this.RadButton_Upload.Text = "Upload";
this.RadButton_Upload.Click += new System.EventHandler(this.ButtonX_Upload_Click);
//
// RadDropDownList_Version
//
this.RadDropDownList_Version.DropDownAnimationEnabled = true;
this.RadDropDownList_Version.Location = new System.Drawing.Point(3, 87);
this.RadDropDownList_Version.Name = "RadDropDownList_Version";
this.RadDropDownList_Version.NullText = "e.g. 1.2.0.0";
this.RadDropDownList_Version.Size = new System.Drawing.Size(194, 24);
this.RadDropDownList_Version.TabIndex = 19;
//
// radLabel1
//
this.radLabel1.Location = new System.Drawing.Point(3, 63);
this.radLabel1.Name = "radLabel1";
this.radLabel1.Size = new System.Drawing.Size(46, 18);
this.radLabel1.TabIndex = 18;
this.radLabel1.Text = "Version:";
//
// RadButton_DiscordSetup
//
this.RadButton_DiscordSetup.Location = new System.Drawing.Point(3, 33);
this.RadButton_DiscordSetup.Name = "RadButton_DiscordSetup";
this.RadButton_DiscordSetup.Size = new System.Drawing.Size(194, 24);
this.RadButton_DiscordSetup.TabIndex = 17;
this.RadButton_DiscordSetup.Text = "Setup Discord Bot";
this.RadButton_DiscordSetup.Click += new System.EventHandler(this.ButtonX_DiscordSetup_Click);
//
// RadButton_SetupWebDav
//
this.RadButton_SetupWebDav.Location = new System.Drawing.Point(3, 3);
this.RadButton_SetupWebDav.Name = "RadButton_SetupWebDav";
this.RadButton_SetupWebDav.Size = new System.Drawing.Size(194, 24);
this.RadButton_SetupWebDav.TabIndex = 16;
this.RadButton_SetupWebDav.Text = "Setup WebDav Client";
this.RadButton_SetupWebDav.Click += new System.EventHandler(this.ButtonX_SetupWebDav_Click);
//
// PictureBox1
//
this.PictureBox1.Dock = System.Windows.Forms.DockStyle.Fill;
this.PictureBox1.Location = new System.Drawing.Point(0, 0);
this.PictureBox1.Name = "PictureBox1";
this.PictureBox1.Size = new System.Drawing.Size(694, 508);
this.PictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
this.PictureBox1.TabIndex = 0;
this.PictureBox1.TabStop = false;
//
// radWaitingBar1
//
this.radWaitingBar1.AssociatedControl = this.RadButton_Upload;
this.radWaitingBar1.Location = new System.Drawing.Point(29, -23);
this.radWaitingBar1.Name = "radWaitingBar1";
this.radWaitingBar1.Size = new System.Drawing.Size(70, 70);
this.radWaitingBar1.TabIndex = 21;
this.radWaitingBar1.WaitingIndicators.Add(this.dotsRingWaitingBarIndicatorElement1);
this.radWaitingBar1.WaitingIndicatorSize = new System.Drawing.Size(100, 14);
this.radWaitingBar1.WaitingSpeed = 50;
this.radWaitingBar1.WaitingStyle = Telerik.WinControls.Enumerations.WaitingBarStyles.DotsRing;
((Telerik.WinControls.UI.RadWaitingBarElement)(radWaitingBar1.GetChildAt(0))).WaitingIndicatorSize = new System.Drawing.Size(100, 14);
((Telerik.WinControls.UI.RadWaitingBarElement)(radWaitingBar1.GetChildAt(0))).WaitingSpeed = 50;
((Telerik.WinControls.UI.WaitingBarContentElement)(radWaitingBar1.GetChildAt(0).GetChildAt(0))).WaitingStyle = Telerik.WinControls.Enumerations.WaitingBarStyles.DotsRing;
((Telerik.WinControls.UI.WaitingBarSeparatorElement)(radWaitingBar1.GetChildAt(0).GetChildAt(0).GetChildAt(0))).ProgressOrientation = Telerik.WinControls.ProgressOrientation.Right;
((Telerik.WinControls.UI.WaitingBarSeparatorElement)(radWaitingBar1.GetChildAt(0).GetChildAt(0).GetChildAt(0))).Dash = false;
//
// dotsRingWaitingBarIndicatorElement1
//
this.dotsRingWaitingBarIndicatorElement1.AutoSizeMode = Telerik.WinControls.RadAutoSizeMode.Auto;
this.dotsRingWaitingBarIndicatorElement1.FitToSizeMode = Telerik.WinControls.RadFitToSizeMode.FitToParentBounds;
this.dotsRingWaitingBarIndicatorElement1.Name = "dotsRingWaitingBarIndicatorElement1";
//
// Form1
//
this.AutoScaleBaseSize = new System.Drawing.Size(7, 15);
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(694, 508);
this.Controls.Add(this.Panel1);
this.Font = new System.Drawing.Font("Segoe UI", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
this.ForeColor = System.Drawing.Color.Black;
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.Name = "Form1";
//
//
//
this.RootElement.ApplyShapeToControl = true;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "SM64RM Progress Updater";
this.Load += new System.EventHandler(this.Form1_Load);
this.Panel1.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.RadButton_InvertImage)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.RadButton_PasteFromDocument)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.RadButton_PasteFromClipboard)).EndInit();
this.Panel2.ResumeLayout(false);
this.Panel2.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.RadButton_Upload)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.RadDropDownList_Version)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.radLabel1)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.RadButton_DiscordSetup)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.RadButton_SetupWebDav)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.PictureBox1)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.radWaitingBar1)).EndInit();
((System.ComponentModel.ISupportInitialize)(this)).EndInit();
this.ResumeLayout(false);
}
private Panel Panel1;
private PictureBox PictureBox1;
private Panel Panel2;
private Telerik.WinControls.UI.RadButton RadButton_SetupWebDav;
private Telerik.WinControls.UI.RadDropDownList RadDropDownList_Version;
private Telerik.WinControls.UI.RadLabel radLabel1;
private Telerik.WinControls.UI.RadButton RadButton_DiscordSetup;
private Telerik.WinControls.UI.RadButton RadButton_Upload;
private Telerik.WinControls.UI.RadButton RadButton_InvertImage;
private Telerik.WinControls.UI.RadButton RadButton_PasteFromDocument;
private Telerik.WinControls.UI.RadButton RadButton_PasteFromClipboard;
private Telerik.WinControls.UI.RadWaitingBar radWaitingBar1;
private Telerik.WinControls.UI.DotsRingWaitingBarIndicatorElement dotsRingWaitingBarIndicatorElement1;
}
}

View File

@@ -0,0 +1,214 @@
using System;
using global::System.IO;
using global::System.Net;
using System.Threading.Tasks;
using System.Windows.Forms;
using global::Newtonsoft.Json.Linq;
using global::WebDav;
using System.Drawing;
using Telerik.WinControls.UI;
using Telerik.WinControls;
namespace SM64RomManager.ProgressUpdater
{
public partial class Form1
{
// C o n s t a n t s
private const string TEMP_DIR_FOLDER_NAME = "SM64RM Progress Updater";
private const string TEMP_CONF_FILE_NAME = "config.dat";
// F i e l d s
private readonly drsPwEnc.drsPwEnc crypter = new drsPwEnc.drsPwEnc();
private Settings settings = new Settings();
private WebDavMgr wdmgr = null;
private DiscordMgr dmgr = null;
private string upcommingVersions = string.Empty;
// C o n s t r u c t o r
public Form1()
{
this.Load += Form1_Load;
this.FormClosing += Form1_FormClosing;
InitializeComponent();
}
// F e a t u r e s
private void PasteFromClipboard()
{
if (Clipboard.ContainsImage())
{
PictureBox1.Image = Clipboard.GetImage();
}
}
private DirectoryInfo GetTempDirPath()
{
return new DirectoryInfo(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), TEMP_DIR_FOLDER_NAME));
}
private void LoadTextBoxes()
{
RadDropDownList_Version.Text = settings.Version;
}
private void SaveConfig()
{
var obj = JObject.FromObject(settings);
var dir = GetTempDirPath();
string confFile = Path.Combine(dir.FullName, TEMP_CONF_FILE_NAME);
if (!dir.Exists)
{
dir.Create();
}
string raw = crypter.EncryptData(obj.ToString());
File.WriteAllText(confFile, raw);
}
private void LoadConfig()
{
var dir = GetTempDirPath();
string confFile = Path.Combine(dir.FullName, TEMP_CONF_FILE_NAME);
if (File.Exists(confFile))
{
string raw = File.ReadAllText(confFile);
var obj = JObject.Parse(crypter.DecryptData(raw));
settings = obj.ToObject<Settings>();
LoadTextBoxes();
LoadWebDavMgr();
LoadDiscordMgr();
}
}
private void LoadDiscordMgr()
{
if (dmgr is object && dmgr.IsReady)
dmgr.Stop();
dmgr = new DiscordMgr(settings);
dmgr.GotReady += (_, __) => RadButton_DiscordSetup.Enabled = true;
dmgr.Start();
}
private Task LoadWebDavMgr()
{
RadButton_Upload.Enabled = false;
return Task.Run(() =>
{
wdmgr = new WebDavMgr(settings);
if (wdmgr.Connect())
{
Invoke(new Action(() => RadButton_Upload.Enabled = true));
LoadUsedVersions();
}
});
}
private async void LoadUsedVersions()
{
Invoke(new Action(() => RadDropDownList_Version.Items.Clear()));
foreach (var version in await wdmgr.GetUsedVersions())
Invoke(new Action(() => RadDropDownList_Version.Items.Add(version.ToString())));
}
private void InvertImage()
{
Bitmap pic = new Bitmap(PictureBox1.Image);
for (int y = 0; y < pic.Height; y++)
{
for (int x = 0; x < pic.Width; x++)
{
Color inv = pic.GetPixel(x, y);
inv = Color.FromArgb(255, 255 - inv.R, 255 - inv.G, 255 - inv.B);
pic.SetPixel(x, y, inv);
}
}
PictureBox1.Image = pic;
}
// G u i
private void ButtonX1_Click(object sender, EventArgs e)
{
PasteFromClipboard();
}
private async void ButtonX_Upload_Click(object sender, EventArgs e)
{
RadButton_Upload.Image = null;
if (settings.DiscordUploadEnabled && !dmgr.IsReady)
{
RadMessageBox.Show(this, "Discord ist noch nicht bereit!", string.Empty, MessageBoxButtons.OK, RadMessageIcon.Error);
}
else
{
Enabled = false;
radWaitingBar1.StartWaiting();
if (await wdmgr.UploadImage(PictureBox1.Image))
{
if (dmgr is object && dmgr.IsReady)
await dmgr.SendMessage();
RadButton_Upload.Image = MySymbols.icons8_ok_32px_4;
}
else
{
RadMessageBox.Show(this, "Fehler beim Hochladen!", string.Empty, MessageBoxButtons.OK, RadMessageIcon.Error);
}
radWaitingBar1.StopWaiting();
Enabled = true;
}
}
private void Form1_Load(object sender, EventArgs e)
{
LoadConfig();
PasteFromClipboard();
}
private void Form1_FormClosing(object sender, FormClosingEventArgs e)
{
if (dmgr is object && dmgr.IsReady)
dmgr.Stop();
SaveConfig();
}
private void TextBoxX_Version_TextChanged(object sender, EventArgs e)
{
settings.Version = RadDropDownList_Version.Text.Trim();
}
private void ButtonX_DiscordSetup_Click(object sender, EventArgs e)
{
var frm = new DiscordSettingsDialog(settings);
frm.ShowDialog();
LoadDiscordMgr();
}
private void ButtonX_SetupWebDav_Click(object sender, EventArgs e)
{
var frm = new WebDavSettingsDialog(settings);
frm.ShowDialog();
LoadWebDavMgr();
}
private void ButtonX_PasteDocument_Click(object sender, EventArgs e)
{
var frm = new PasteFromDocument(settings);
if (frm.ShowDialog(this) == DialogResult.OK)
PictureBox1.Image = frm.DocumentImage;
}
private void buttonX1_Click_1(object sender, EventArgs e)
{
InvertImage();
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,85 @@
using Markdig;
using Markdig.Syntax;
using Markdig.Syntax.Inlines;
using static Microsoft.VisualBasic.CompilerServices.LikeOperator;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using Microsoft.VisualBasic;
using Telerik.WinControls.UI;
namespace SM64RomManager.ProgressUpdater
{
class MarkdownHelper
{
public static MarkdownDocument GetDocument(string md)
{
return Markdown.Parse(md);
}
public static string GetPart(string md, Block startBlock, Block endBlock)
{
var mdNew = md;
if (endBlock.Span.End + 1 < mdNew.Length)
mdNew = mdNew.Remove(endBlock.Span.End + 1);
if (startBlock.Span.Start > 0)
mdNew = mdNew.Substring(startBlock.Span.Start);
return mdNew;
}
public static Image GetAsImage(string md)
{
var html = Markdown.ToHtml(md);
var img = TheArtOfDev.HtmlRenderer.WinForms.HtmlRender.RenderToImage(html, 500);
return img;
}
public static IReadOnlyDictionary<string, string> SplitToVersions(string md)
{
var versions = new Dictionary<string, string>();
var mdDoc = Markdown.Parse(md);
var currentVersionText = string.Empty;
Block startBlock = null;
Block endBlock = null;
void addDocument()
{
if (startBlock is object && endBlock is object)
{
var mdNew = GetPart(md, startBlock, endBlock);
versions.Add(currentVersionText, mdNew);
startBlock = endBlock = null;
currentVersionText = string.Empty;
}
}
foreach (var block in mdDoc)
{
if (block is HeadingBlock)
{
var hblock = (HeadingBlock)block;
var content = (hblock.Inline.FirstOrDefault() as LiteralInline).Content.ToString();
if (!string.IsNullOrEmpty(content) && LikeString(content, "Version *", CompareMethod.Text))
{
addDocument();
startBlock = hblock;
currentVersionText = content;
}
}
else if (block is ThematicBreakBlock)
addDocument();
endBlock = block;
}
addDocument();
return versions;
}
}
}

View File

@@ -0,0 +1,38 @@
// ------------------------------------------------------------------------------
// <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>
// ------------------------------------------------------------------------------
using System.Diagnostics;
namespace SM64RomManager.ProgressUpdater.My
{
// NOTE: This file is auto-generated; do not modify it directly. To make changes,
// or if you encounter build errors in this file, go to the Project Designer
// (go to Project Properties or double-click the My Project node in
// Solution Explorer), and make changes on the Application tab.
//
internal partial class MyApplication
{
[DebuggerStepThrough()]
public MyApplication() : base(Microsoft.VisualBasic.ApplicationServices.AuthenticationMode.Windows)
{
IsSingleInstance = false;
EnableVisualStyles = true;
SaveMySettingsOnExit = true;
ShutdownStyle = Microsoft.VisualBasic.ApplicationServices.ShutdownMode.AfterMainFormCloses;
}
[DebuggerStepThrough()]
protected override void OnCreateMainForm()
{
MainForm = MyProject.Forms.Form1;
}
}
}

View File

@@ -0,0 +1,11 @@
<?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>

View File

@@ -0,0 +1,35 @@
using global::System;
using global::System.ComponentModel;
using global::System.Diagnostics;
namespace SM64RomManager.ProgressUpdater.My
{
internal static partial class MyProject
{
internal partial class MyForms
{
[EditorBrowsable(EditorBrowsableState.Never)]
public Form1 m_Form1;
public Form1 Form1
{
[DebuggerHidden]
get
{
m_Form1 = MyForms.Create__Instance__(m_Form1);
return m_Form1;
}
[DebuggerHidden]
set
{
if (value == m_Form1)
return;
if (value is object)
throw new ArgumentException("Property can only be set to Nothing");
Dispose__Instance__(ref m_Form1);
}
}
}
}
}

View File

@@ -0,0 +1,305 @@
// 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 SM64RomManager.ProgressUpdater.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 */

View File

@@ -0,0 +1,253 @@
// 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 SM64RomManager.ProgressUpdater.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;
}
}
}

View File

@@ -0,0 +1,14 @@
// 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
{
}
}

View File

@@ -0,0 +1,33 @@
// ------------------------------------------------------------------------------
// <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>
// ------------------------------------------------------------------------------
using Microsoft.VisualBasic.ApplicationServices;
using System.Collections.ObjectModel;
using System.Diagnostics;
using System.Drawing;
using System.Windows.Forms;
namespace SM64RomManager.ProgressUpdater.My
{
// NOTE: This file is auto-generated; do not modify it directly. To make changes,
// or if you encounter build errors in this file, go to the Project Designer
// (go to Project Properties or double-click the My Project node in
// Solution Explorer), and make changes on the Application tab.
//
internal partial class MyApplication
{
protected override bool OnInitialize(ReadOnlyCollection<string> commandLineArgs)
{
Application.SetDefaultFont(new Font(Control.DefaultFont.FontFamily, 8.25f));
return base.OnInitialize(commandLineArgs);
}
}
}

View File

@@ -0,0 +1,73 @@
//------------------------------------------------------------------------------
// <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>
//------------------------------------------------------------------------------
namespace SM64RomManager.ProgressUpdater {
using System;
/// <summary>
/// Eine stark typisierte Ressourcenklasse zum Suchen von lokalisierten Zeichenfolgen usw.
/// </summary>
// Diese Klasse wurde von der StronglyTypedResourceBuilder 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
// mit der /str-Option erneut aus, oder Sie erstellen Ihr VS-Projekt neu.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class MySymbols {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal MySymbols() {
}
/// <summary>
/// Gibt die zwischengespeicherte ResourceManager-Instanz zurück, die von dieser Klasse verwendet wird.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("SM64RomManager.ProgressUpdater.MySymbols", typeof(MySymbols).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// Überschreibt die CurrentUICulture-Eigenschaft des aktuellen Threads für alle
/// Ressourcenzuordnungen, die diese stark typisierte Ressourcenklasse verwenden.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set {
resourceCulture = value;
}
}
/// <summary>
/// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap icons8_ok_32px_4 {
get {
object obj = ResourceManager.GetObject("icons8_ok_32px_4", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
}
}

View File

@@ -0,0 +1,124 @@
<?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>
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="icons8_ok_32px_4" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>Resources\icons8_ok_32px_4.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
</root>

View File

@@ -0,0 +1,137 @@
namespace SM64RomManager.ProgressUpdater
{
partial class PasteFromDocument
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(PasteFromDocument));
this.RadButton_Paste = new Telerik.WinControls.UI.RadButton();
this.RadButton_Cancel = new Telerik.WinControls.UI.RadButton();
this.radTextBoxControl1 = new Telerik.WinControls.UI.RadTextBoxControl();
this.panel1 = new System.Windows.Forms.Panel();
this.RadListControl_Paragraph = new Telerik.WinControls.UI.RadListControl();
((System.ComponentModel.ISupportInitialize)(this.RadButton_Paste)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.RadButton_Cancel)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.radTextBoxControl1)).BeginInit();
this.panel1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.RadListControl_Paragraph)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this)).BeginInit();
this.SuspendLayout();
//
// RadButton_Paste
//
this.RadButton_Paste.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.RadButton_Paste.Location = new System.Drawing.Point(205, 286);
this.RadButton_Paste.Name = "RadButton_Paste";
this.RadButton_Paste.Size = new System.Drawing.Size(110, 24);
this.RadButton_Paste.TabIndex = 0;
this.RadButton_Paste.Text = "Paste";
this.RadButton_Paste.Click += new System.EventHandler(this.ButtonX_Paste_Click);
//
// RadButton_Cancel
//
this.RadButton_Cancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.RadButton_Cancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.RadButton_Cancel.Location = new System.Drawing.Point(321, 286);
this.RadButton_Cancel.Name = "RadButton_Cancel";
this.RadButton_Cancel.Size = new System.Drawing.Size(110, 24);
this.RadButton_Cancel.TabIndex = 1;
this.RadButton_Cancel.Text = "Cancel";
//
// radTextBoxControl1
//
this.radTextBoxControl1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.radTextBoxControl1.Location = new System.Drawing.Point(3, 3);
this.radTextBoxControl1.Name = "radTextBoxControl1";
this.radTextBoxControl1.NullText = "Document URL";
this.radTextBoxControl1.Size = new System.Drawing.Size(428, 22);
this.radTextBoxControl1.TabIndex = 2;
this.radTextBoxControl1.TextChanged += new System.EventHandler(this.textBoxX1_TextChanged);
//
// panel1
//
this.panel1.BackColor = System.Drawing.Color.Transparent;
this.panel1.Controls.Add(this.RadListControl_Paragraph);
this.panel1.Controls.Add(this.RadButton_Cancel);
this.panel1.Controls.Add(this.radTextBoxControl1);
this.panel1.Controls.Add(this.RadButton_Paste);
this.panel1.Dock = System.Windows.Forms.DockStyle.Fill;
this.panel1.Location = new System.Drawing.Point(0, 0);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(434, 313);
this.panel1.TabIndex = 4;
//
// RadListControl_Paragraph
//
this.RadListControl_Paragraph.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.RadListControl_Paragraph.ItemHeight = 24;
this.RadListControl_Paragraph.Location = new System.Drawing.Point(3, 31);
this.RadListControl_Paragraph.Name = "RadListControl_Paragraph";
this.RadListControl_Paragraph.Size = new System.Drawing.Size(428, 249);
this.RadListControl_Paragraph.TabIndex = 4;
//
// PasteFromDocument
//
this.AcceptButton = this.RadButton_Paste;
this.AutoScaleBaseSize = new System.Drawing.Size(7, 15);
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.CancelButton = this.RadButton_Cancel;
this.ClientSize = new System.Drawing.Size(434, 313);
this.Controls.Add(this.panel1);
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.MaximizeBox = false;
this.Name = "PasteFromDocument";
//
//
//
this.RootElement.ApplyShapeToControl = true;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "Paste From Document";
this.Load += new System.EventHandler(this.PasteFromDocument_Load);
((System.ComponentModel.ISupportInitialize)(this.RadButton_Paste)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.RadButton_Cancel)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.radTextBoxControl1)).EndInit();
this.panel1.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.RadListControl_Paragraph)).EndInit();
((System.ComponentModel.ISupportInitialize)(this)).EndInit();
this.ResumeLayout(false);
}
#endregion
private Telerik.WinControls.UI.RadButton RadButton_Paste;
private Telerik.WinControls.UI.RadButton RadButton_Cancel;
private Telerik.WinControls.UI.RadTextBoxControl radTextBoxControl1;
private System.Windows.Forms.Panel panel1;
private Telerik.WinControls.UI.RadListControl RadListControl_Paragraph;
}
}

View File

@@ -0,0 +1,93 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Telerik.WinControls.UI;
namespace SM64RomManager.ProgressUpdater
{
public partial class PasteFromDocument : RadForm
{
private Settings settings;
public Image DocumentImage { get; private set; }
public PasteFromDocument(Settings settings)
{
this.settings = settings;
InitializeComponent();
}
private void ButtonX_Paste_Click(object sender, EventArgs e)
{
RadListDataItem selectedItem = null;
foreach (RadListDataItem item in RadListControl_Paragraph.Items)
{
if (selectedItem == null && item.Selected)
selectedItem = item;
}
if (selectedItem?.Tag is object)
{
var md = (string)selectedItem.Tag;
DocumentImage = MarkdownHelper.GetAsImage(md);
DialogResult = DialogResult.OK;
}
}
private async void textBoxX1_TextChanged(object sender, EventArgs e)
{
var url = radTextBoxControl1.Text.Trim();
settings.UpcommingVersionsDownloadURL = url;
if (!string.IsNullOrEmpty(url))
await GetNewItems(url);
}
private async Task GetNewItems(string url)
{
var mdDocStr = await DownloadString(url);
if (!string.IsNullOrEmpty(mdDocStr))
{
RadListControl_Paragraph.BeginUpdate();
RadListControl_Paragraph.Items.Clear();
foreach (var kvp in MarkdownHelper.SplitToVersions(mdDocStr))
{
var item = new RadListDataItem
{
Text = kvp.Key,
Tag = kvp.Value
};
RadListControl_Paragraph.Items.Add(item);
}
RadListControl_Paragraph.EndUpdate();
RadListControl_Paragraph.Refresh();
if (RadListControl_Paragraph.Items.Any())
RadListControl_Paragraph.Items[0].Selected = true;
}
}
private static async Task<string> DownloadString(string url)
{
var wc = new HttpClient();
var res = await wc.GetStringAsync(url);
wc.Dispose();
return res;
}
private void PasteFromDocument_Load(object sender, EventArgs e)
{
radTextBoxControl1.Text = settings.UpcommingVersionsDownloadURL;
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,8 @@
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("49e87695-c8fa-48b9-9e27-bfbb44534ce4")]

View File

@@ -0,0 +1,63 @@
//------------------------------------------------------------------------------
// <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>
//------------------------------------------------------------------------------
namespace SM64RomManager.ProgressUpdater.My.Resources {
using System;
/// <summary>
/// Eine stark typisierte Ressourcenklasse zum Suchen von lokalisierten Zeichenfolgen usw.
/// </summary>
// Diese Klasse wurde von der StronglyTypedResourceBuilder 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
// mit der /str-Option erneut aus, oder Sie erstellen Ihr VS-Projekt neu.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources() {
}
/// <summary>
/// Gibt die zwischengespeicherte ResourceManager-Instanz zurück, die von dieser Klasse verwendet wird.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("SM64RomManager.ProgressUpdater.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// Überschreibt die CurrentUICulture-Eigenschaft des aktuellen Threads für alle
/// Ressourcenzuordnungen, die diese stark typisierte Ressourcenklasse verwenden.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set {
resourceCulture = value;
}
}
}
}

View File

@@ -0,0 +1,117 @@
<?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>

View File

@@ -0,0 +1,26 @@
//------------------------------------------------------------------------------
// <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>
//------------------------------------------------------------------------------
namespace SM64RomManager.ProgressUpdater.My {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.9.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
public static Settings Default {
get {
return defaultInstance;
}
}
}
}

View File

@@ -0,0 +1,7 @@
<?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>

Binary file not shown.

After

Width:  |  Height:  |  Size: 1022 B

View File

@@ -0,0 +1,204 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>WinExe</OutputType>
<StartupObject>SM64RomManager.ProgressUpdater.My.MyApplication</StartupObject>
<RootNamespace>SM64RomManager.ProgressUpdater</RootNamespace>
<AssemblyName>SM64RM ProgressUpdater</AssemblyName>
<MyType>WindowsForms</MyType>
<TargetFramework>net6.0-windows</TargetFramework>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<DefaultItemExcludes>$(DefaultItemExcludes);$(ProjectDir)**\*.vb</DefaultItemExcludes>
<LangVersion>latest</LangVersion>
<AssemblyTitle>SM64 ROM Manager.ProgressUpdater</AssemblyTitle>
<Product>SM64 ROM Manager.ProgressUpdater</Product>
<Copyright>Copyright © Pilzinsel64 2019 - 2022</Copyright>
<DocumentationFile>SM64RM ProgressUpdater.xml</DocumentationFile>
<DefineTrace>true</DefineTrace>
<NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022,CS1591</NoWarn>
<ExtrasEnableWinFormsProjectSetup>true</ExtrasEnableWinFormsProjectSetup>
<UseWindowsForms>true</UseWindowsForms>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DefineDebug>true</DefineDebug>
<PlatformTarget>AnyCPU</PlatformTarget>
</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>1443729764_forest_mushroom.ico</ApplicationIcon>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="HtmlRenderer.Core" Version="1.5.0.6" />
<PackageReference Include="Microsoft.CSharp" Version="4.7.0" />
<PackageReference Include="Microsoft.Toolkit.Uwp.Notifications" Version="7.1.3" />
<PackageReference Include="Microsoft.VisualBasic" Version="10.3.0" />
<PackageReference Include="System.ComponentModel.Composition" Version="7.0.0" />
<PackageReference Include="System.Data.DataSetExtensions" Version="4.5.0" />
<PackageReference Include="UI.for.WinForms.AllControls.Net60">
<Version>2023.2.718</Version>
</PackageReference>
</ItemGroup>
<ItemGroup>
<Reference Include="drsPwEnc">
<HintPath>..\Shared Libs\drsPwEnc.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Import Include="Microsoft.VisualBasic" />
<Import Include="System" />
<Import Include="System.Collections" />
<Import Include="System.Collections.Generic" />
<Import Include="System.Data" />
<Import Include="System.Drawing" />
<Import Include="System.Diagnostics" />
<Import Include="System.Windows.Forms" />
<Import Include="System.Linq" />
<Import Include="System.Xml.Linq" />
<Import Include="System.Threading.Tasks" />
</ItemGroup>
<ItemGroup>
<Compile Update="MyApplication.cs">
<AutoGen>True</AutoGen>
</Compile>
<Compile Update="DiscordSettingsDialog.cs" />
<Compile Update="DiscordSettingsDialog.Designer.cs">
<DependentUpon>DiscordSettingsDialog.cs</DependentUpon>
</Compile>
<Compile Update="Form1.cs" />
<Compile Update="Form1.Designer.cs">
<DependentUpon>Form1.cs</DependentUpon>
<SubType>Form</SubType>
</Compile>
<Compile Update="MySymbols.Designer.cs">
<DesignTime>True</DesignTime>
<AutoGen>True</AutoGen>
<DependentUpon>MySymbols.resx</DependentUpon>
</Compile>
<Compile Update="PasteFromDocument.cs" />
<Compile Update="PasteFromDocument.Designer.cs">
<DependentUpon>PasteFromDocument.cs</DependentUpon>
</Compile>
<Compile Update="My Project\Application.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Application.myapp</DependentUpon>
</Compile>
<Compile Update="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<Compile Update="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
<Compile Update="WebDavSettingsDialog.cs" />
<Compile Update="WebDavSettingsDialog.Designer.cs">
<DependentUpon>WebDavSettingsDialog.cs</DependentUpon>
</Compile>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Update="DiscordSettingsDialog.resx">
<DependentUpon>DiscordSettingsDialog.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Update="Form1.resx">
<DependentUpon>Form1.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Update="MySymbols.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>MySymbols.Designer.cs</LastGenOutput>
</EmbeddedResource>
<EmbeddedResource Update="PasteFromDocument.resx">
<DependentUpon>PasteFromDocument.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Update="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
<CustomToolNamespace>namespace SM64RomManager.ProgressUpdater.My.Resources</CustomToolNamespace>
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Update="WebDavSettingsDialog.resx">
<DependentUpon>WebDavSettingsDialog.cs</DependentUpon>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<None Include="My Project\Application.myapp">
<Generator>MyApplicationCodeGenerator</Generator>
<LastGenOutput>Application.Designer.cs</LastGenOutput>
</None>
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<CustomToolNamespace>namespace SM64RomManager.ProgressUpdater.My</CustomToolNamespace>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
</ItemGroup>
<ItemGroup>
<Content Include="1443729764_forest_mushroom.ico" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Discord.Net" Version="3.12.0" />
<PackageReference Include="Markdig" Version="0.33.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="7.0.0" />
<PackageReference Include="Microsoft.NETCore.Platforms" Version="7.0.4" />
<PackageReference Include="Microsoft.Win32.Primitives" Version="4.3.0" />
<PackageReference Include="NETStandard.Library" Version="2.0.3" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="System.AppContext" Version="4.3.0" />
<PackageReference Include="System.Collections" Version="4.3.0" />
<PackageReference Include="System.Collections.Concurrent" Version="4.3.0" />
<PackageReference Include="System.Collections.Immutable" Version="7.0.0" />
<PackageReference Include="System.ComponentModel" Version="4.3.0" />
<PackageReference Include="System.Console" Version="4.3.1" />
<PackageReference Include="System.Diagnostics.Debug" Version="4.3.0" />
<PackageReference Include="System.Diagnostics.DiagnosticSource" Version="7.0.2" />
<PackageReference Include="System.Diagnostics.Tools" Version="4.3.0" />
<PackageReference Include="System.Diagnostics.Tracing" Version="4.3.0" />
<PackageReference Include="System.Globalization" Version="4.3.0" />
<PackageReference Include="System.Globalization.Calendars" Version="4.3.0" />
<PackageReference Include="System.Interactive.Async" Version="6.0.1" />
<PackageReference Include="System.IO.Compression" Version="4.3.0" />
<PackageReference Include="System.IO.Compression.ZipFile" Version="4.3.0" />
<PackageReference Include="System.IO.FileSystem" Version="4.3.0" />
<PackageReference Include="System.Linq" Version="4.3.0" />
<PackageReference Include="System.Linq.Expressions" Version="4.3.0" />
<PackageReference Include="System.Net.Http" Version="4.3.4" />
<PackageReference Include="System.Net.Primitives" Version="4.3.1" />
<PackageReference Include="System.Net.Sockets" Version="4.3.0" />
<PackageReference Include="System.ObjectModel" Version="4.3.0" />
<PackageReference Include="System.Reflection" Version="4.3.0" />
<PackageReference Include="System.Reflection.Extensions" Version="4.3.0" />
<PackageReference Include="System.Reflection.Primitives" Version="4.3.0" />
<PackageReference Include="System.Resources.ResourceManager" Version="4.3.0" />
<PackageReference Include="System.Runtime" Version="4.3.1" />
<PackageReference Include="System.Runtime.CompilerServices.Unsafe" Version="6.0.0" />
<PackageReference Include="System.Runtime.Extensions" Version="4.3.1" />
<PackageReference Include="System.Runtime.Handles" Version="4.3.0" />
<PackageReference Include="System.Runtime.InteropServices" Version="4.3.0" />
<PackageReference Include="System.Runtime.InteropServices.RuntimeInformation" Version="4.3.0" />
<PackageReference Include="System.Runtime.Numerics" Version="4.3.0" />
<PackageReference Include="System.Security.Cryptography.Algorithms" Version="4.3.1" />
<PackageReference Include="System.Security.Cryptography.X509Certificates" Version="4.3.2" />
<PackageReference Include="System.Text.Encoding" Version="4.3.0" />
<PackageReference Include="System.Text.Encoding.Extensions" Version="4.3.0" />
<PackageReference Include="System.Text.RegularExpressions" Version="4.3.1" />
<PackageReference Include="System.Threading" Version="4.3.0" />
<PackageReference Include="System.Threading.Tasks" Version="4.3.0" />
<PackageReference Include="System.Threading.Timer" Version="4.3.0" />
<PackageReference Include="System.Xml.ReaderWriter" Version="4.3.1" />
<PackageReference Include="System.Xml.XDocument" Version="4.3.0" />
<PackageReference Include="WebDav.Client" Version="2.8.0" />
</ItemGroup>
</Project>

View File

@@ -0,0 +1,25 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SM64RomManager.ProgressUpdater
{
public class Settings
{
public string WebDavUri { get; set; } = string.Empty;
public string WebDavUsr { get; set; } = string.Empty;
public string WebDavPwd { get; set; } = string.Empty;
public string ProxyUsr { get; set; } = string.Empty;
public string ProxyPwd { get; set; } = string.Empty;
public string Version { get; set; } = string.Empty;
public bool DiscordUploadEnabled { get; set; } = false;
public string DiscordBotToken { get; set; } = default;
public ulong DiscordGuildID { get; set; } = default;
public ulong DiscordChannelID { get; set; } = default;
public string DiscordMsgBaseURL { get; set; } = string.Empty;
public string DiscordMsgParamCounter { get; set; } = string.Empty;
public string UpcommingVersionsDownloadURL { get; set; } = string.Empty;
}
}

View File

@@ -0,0 +1,123 @@
using Microsoft.VisualBasic;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Net;
using System.Text;
using System.Threading.Tasks;
using WebDav;
using static Microsoft.VisualBasic.CompilerServices.LikeOperator;
namespace SM64RomManager.ProgressUpdater
{
public class WebDavMgr
{
private Settings settings;
private WebDavClient client = null;
public bool IsConnected { get; private set; } = false;
public WebDavMgr(Settings settings)
{
this.settings = settings;
}
public bool Connect()
{
bool result = false;
if (!IsConnected)
{
if (!string.IsNullOrEmpty(settings.WebDavUri))
{
// Set web proxy
if (!string.IsNullOrEmpty(settings.ProxyUsr) || !string.IsNullOrEmpty(settings.ProxyPwd))
{
WebRequest.DefaultWebProxy.Credentials = new NetworkCredential(settings.ProxyUsr, settings.ProxyPwd);
}
// Create client params
var clientparams = new WebDavClientParams()
{
BaseAddress = new Uri(settings.WebDavUri),
Credentials = new NetworkCredential(settings.WebDavUsr.Trim(), settings.WebDavPwd),
UseProxy = false
};
// Create client
client = new WebDavClient(clientparams);
result = true;
IsConnected = true;
}
}
return result;
}
public async Task<bool> UploadImage(Image img)
{
bool result;
if (string.IsNullOrEmpty(settings.Version) || !Version.TryParse(settings.Version, out Version version))
result = false;
else
{
// Save image to memory
var msImage = new MemoryStream();
img.Save(msImage, System.Drawing.Imaging.ImageFormat.Png);
msImage.Position = 0;
// Upload image
try
{
var res = await client.PutFile($"{settings.Version}.png", msImage);
result = res.IsSuccessful;
}
catch (Exception)
{
result = false;
}
finally
{
msImage.Close();
}
result = true;
}
return result;
}
public async Task<IEnumerable<Version>> GetUsedVersions()
{
var versions = new List<Version>();
var response = await client.Propfind(string.Empty);
if (response.IsSuccessful)
{
foreach (var resource in response.Resources)
{
string displayName = Path.GetFileNameWithoutExtension(resource.Uri);
if (!string.IsNullOrEmpty(displayName) && LikeString(displayName, "*.*.*.*", CompareMethod.Text))
{
if (Version.TryParse(displayName, out Version version))
versions.Add(version);
}
}
}
return versions;
}
public async Task<string> GetUpcommingVersions()
{
var wc = new WebClient();
var res = await wc.DownloadStringTaskAsync(settings.UpcommingVersionsDownloadURL);
wc.Dispose();
return res;
}
}
}

View File

@@ -0,0 +1,101 @@
namespace SM64RomManager.ProgressUpdater
{
partial class WebDavSettingsDialog
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(WebDavSettingsDialog));
this.radDataLayout1 = new Telerik.WinControls.UI.RadDataLayout();
this.radPropertyGrid1 = new Telerik.WinControls.UI.RadPropertyGrid();
((System.ComponentModel.ISupportInitialize)(this.radDataLayout1)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.radDataLayout1.LayoutControl)).BeginInit();
this.radDataLayout1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.radPropertyGrid1)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this)).BeginInit();
this.SuspendLayout();
//
// radDataLayout1
//
this.radDataLayout1.BackColor = System.Drawing.Color.Transparent;
this.radDataLayout1.Dock = System.Windows.Forms.DockStyle.Fill;
//
// radDataLayout1.LayoutControl
//
this.radDataLayout1.LayoutControl.BackColor = System.Drawing.Color.Transparent;
this.radDataLayout1.LayoutControl.Dock = System.Windows.Forms.DockStyle.Fill;
this.radDataLayout1.LayoutControl.DrawBorder = false;
this.radDataLayout1.LayoutControl.Location = new System.Drawing.Point(0, 0);
this.radDataLayout1.LayoutControl.Name = "LayoutControl";
this.radDataLayout1.LayoutControl.Size = new System.Drawing.Size(584, 132);
this.radDataLayout1.LayoutControl.TabIndex = 0;
this.radDataLayout1.Location = new System.Drawing.Point(0, 0);
this.radDataLayout1.Name = "radDataLayout1";
this.radDataLayout1.Size = new System.Drawing.Size(584, 132);
this.radDataLayout1.TabIndex = 0;
this.radDataLayout1.EditorInitializing += new Telerik.WinControls.UI.EditorInitializingEventHandler(this.RadDataLayout1_EditorInitializing);
//
// radPropertyGrid1
//
this.radPropertyGrid1.ItemHeight = 28;
this.radPropertyGrid1.ItemIndent = 28;
this.radPropertyGrid1.Location = new System.Drawing.Point(292, 0);
this.radPropertyGrid1.Name = "radPropertyGrid1";
this.radPropertyGrid1.Size = new System.Drawing.Size(280, 300);
this.radPropertyGrid1.TabIndex = 1;
this.radPropertyGrid1.Visible = false;
//
// WebDavSettingsDialog
//
this.AutoScaleBaseSize = new System.Drawing.Size(7, 15);
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(584, 132);
this.Controls.Add(this.radDataLayout1);
this.Controls.Add(this.radPropertyGrid1);
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.Name = "WebDavSettingsDialog";
//
//
//
this.RootElement.ApplyShapeToControl = true;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "WebDav Settings";
((System.ComponentModel.ISupportInitialize)(this.radDataLayout1.LayoutControl)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.radDataLayout1)).EndInit();
this.radDataLayout1.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.radPropertyGrid1)).EndInit();
((System.ComponentModel.ISupportInitialize)(this)).EndInit();
this.ResumeLayout(false);
}
#endregion
private Telerik.WinControls.UI.RadDataLayout radDataLayout1;
private Telerik.WinControls.UI.RadPropertyGrid radPropertyGrid1;
}
}

View File

@@ -0,0 +1,100 @@
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;
namespace SM64RomManager.ProgressUpdater
{
public partial class WebDavSettingsDialog : RadForm
{
private readonly Settings settings;
private readonly Dictionary<string, string> propNameLabel = new Dictionary<string, string>();
private readonly List<string> propNameChar = new List<string>();
public WebDavSettingsDialog(Settings settings)
{
this.settings = settings;
InitializeComponent();
SetupPropDics();
radDataLayout1.ItemInitializing += RadDataLayout1_ItemInitializing;
radDataLayout1.DataSource = settings;
#region "Example-Methods for RadPropertyGrid"
//radPropertyGrid1.CreateItemElement += RadPropertyGrid1_CreateItemElement;
//radPropertyGrid1.EditorInitialized += RadPropertyGrid1_EditorInitialized;
//radPropertyGrid1.PropertyGridElement.PropertyTableElement.ListSource.CollectionChanged += ListSource_CollectionChanged;
//radPropertyGrid1.SelectedObjectChanging += PropertyTableElement_SelectedObjectChanging;
//radPropertyGrid1.SelectedObjectChanged += PropertyTableElement_SelectedObjectChanged;
//radPropertyGrid1.SelectedObject = settings;
#endregion
}
#region "Example-Methods for RadPropertyGrid"
//private void PropertyTableElement_SelectedObjectChanging(object sender, PropertyGridSelectedObjectChangingEventArgs e)
//{
//}
//private void ListSource_CollectionChanged(object sender, Telerik.WinControls.Data.NotifyCollectionChangedEventArgs e)
//{
//}
//private void PropertyTableElement_SelectedObjectChanged(object sender, PropertyGridSelectedObjectChangedEventArgs e)
//{
//}
//private void RadPropertyGrid1_EditorInitialized(object sender, PropertyGridItemEditorInitializedEventArgs e)
//{
//}
//private void RadPropertyGrid1_CreateItemElement(object sender, CreatePropertyGridItemElementEventArgs e)
//{
// if (propNameLabel.ContainsKey(e.Item.Name))
// e.Item.Label = propNameLabel[e.Item.Name];
// else
// {
// ((PropertyGridItem)e.Item).Visible = false;
// //((PropertyGridItem)e.Item).Enabled = false;
// }
//}
#endregion
private void SetupPropDics()
{
propNameLabel.Clear();
propNameLabel.Add(nameof(Settings.WebDavUri), "WebDav URL:");
propNameLabel.Add(nameof(Settings.WebDavUsr), "WebDav User:");
propNameLabel.Add(nameof(Settings.WebDavPwd), "WebDav Password:");
propNameLabel.Add(nameof(Settings.ProxyUsr), "Proxy User:");
propNameLabel.Add(nameof(Settings.ProxyPwd), "Proxy Password:");
propNameChar.Clear();
propNameChar.Add(nameof(Settings.WebDavPwd));
propNameChar.Add(nameof(Settings.ProxyPwd));
}
private void RadDataLayout1_EditorInitializing(object sender, EditorInitializingEventArgs e)
{
if (!propNameLabel.ContainsKey(e.Property.Name))
e.Cancel = true;
else if (propNameChar.Contains(e.Property.Name) && e.EditorType == typeof(RadTextBox))
((RadTextBox)e.Editor).UseSystemPasswordChar = true;
}
private void RadDataLayout1_ItemInitializing(object sender, DataLayoutItemInitializingEventArgs e)
{
if (propNameLabel.ContainsKey(e.Item.AccessibleName))
e.Item.Text = propNameLabel[e.Item.AccessibleName];
}
}
}

File diff suppressed because it is too large Load Diff