Aggiornato componente gesitone update sw
This commit is contained in:
Vendored
+1
-1
@@ -7,7 +7,7 @@ pipeline {
|
||||
steps {
|
||||
/* calcolo numero versione... diverso x branch MASTER/DEVELOP */
|
||||
script {
|
||||
withEnv(['NEXT_BUILD_NUMBER=757']) {
|
||||
withEnv(['NEXT_BUILD_NUMBER=758']) {
|
||||
// env.versionNumber = VersionNumber(versionNumberString : '5.0.${BUILD_DATE_FORMATTED, "yyMM"}.${BUILDS_ALL_TIME}', projectStartDate : '2006-01-01', skipFailedBuilds: true)
|
||||
env.versionNumber = VersionNumber(versionNumberString : '5.0.${BUILD_DATE_FORMATTED, "yyMM"}.${BUILDS_ALL_TIME}', projectStartDate : '2006-01-01', skipFailedBuilds: true, overrideBuildsAllTime: '${NEXT_BUILD_NUMBER}')
|
||||
env.versionNumberBeta = VersionNumber(versionNumberString : '5.0.${BUILD_DATE_FORMATTED, "yyMM"}-beta.${BUILDS_ALL_TIME}', projectStartDate : '2006-01-01', skipFailedBuilds: true, overrideBuildsAllTime: '${NEXT_BUILD_NUMBER}')
|
||||
|
||||
+61
-22
@@ -4,6 +4,7 @@ using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Net.Http;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Xml;
|
||||
@@ -64,15 +65,33 @@ namespace SteamWare
|
||||
|
||||
#endregion Public Fields
|
||||
|
||||
#region Protected Constructors
|
||||
#region Public Constructors
|
||||
|
||||
/// <summary>
|
||||
/// Init classe
|
||||
/// </summary>
|
||||
protected UpdateMan()
|
||||
public UpdateMan()
|
||||
{ }
|
||||
|
||||
#endregion Protected Constructors
|
||||
/// <summary>
|
||||
/// Init classe
|
||||
/// </summary>
|
||||
/// <param name="user"></param>
|
||||
/// <param name="pwd"></param>
|
||||
public UpdateMan(string user, string pwd)
|
||||
{
|
||||
userName = user;
|
||||
passwd = pwd;
|
||||
}
|
||||
|
||||
#endregion Public Constructors
|
||||
|
||||
#region Protected Properties
|
||||
|
||||
protected string passwd { get; set; } = "";
|
||||
protected string userName { get; set; } = "";
|
||||
|
||||
#endregion Protected Properties
|
||||
|
||||
#region Public Methods
|
||||
|
||||
@@ -103,6 +122,11 @@ namespace SteamWare
|
||||
localLast = string.Format(@"{0}\{1}.zip", localRepo, packName);
|
||||
// scarica file e salva in directory locale...
|
||||
var client = new WebClient();
|
||||
bool doAuth = !string.IsNullOrEmpty($"{userName}{passwd}");
|
||||
if (doAuth)
|
||||
{
|
||||
client.Credentials = new System.Net.NetworkCredential(userName, passwd);
|
||||
}
|
||||
client.DownloadFile(updateData.DownloadURL, localFile);
|
||||
// ora lo copio come latest...
|
||||
File.Copy(localFile, localLast, true);
|
||||
@@ -139,6 +163,8 @@ namespace SteamWare
|
||||
/// <returns></returns>
|
||||
public UpdateInfoEventArgs getUpdateInfo(string remoteUrl)
|
||||
{
|
||||
bool doAuth = !string.IsNullOrEmpty($"{userName}{passwd}");
|
||||
|
||||
UpdateInfoEventArgs args = new UpdateInfoEventArgs();
|
||||
Version CurrentVersion;
|
||||
bool Mandatory;
|
||||
@@ -146,31 +172,44 @@ namespace SteamWare
|
||||
try
|
||||
{
|
||||
// recupero dati
|
||||
HttpWebRequest request = (HttpWebRequest)HttpWebRequest.CreateHttp(remoteUrl);
|
||||
HttpWebResponse remData = (HttpWebResponse)request.GetResponse();
|
||||
// converto in XML
|
||||
recXml.Load(remData.GetResponseStream());
|
||||
XmlNodeList recData = recXml.SelectNodes("item");
|
||||
if (recData != null)
|
||||
using (var http = new HttpClient())
|
||||
{
|
||||
foreach (XmlNode item in recData)
|
||||
if (doAuth)
|
||||
{
|
||||
XmlNode appCastVersion = item.SelectSingleNode("version");
|
||||
Version.TryParse(appCastVersion?.InnerText, out CurrentVersion);
|
||||
args.CurrentVersion = CurrentVersion;
|
||||
XmlNode appCastChangeLog = item.SelectSingleNode("changelog");
|
||||
args.ChangelogURL = appCastChangeLog?.InnerText;
|
||||
XmlNode appCastUrl = item.SelectSingleNode("url");
|
||||
args.DownloadURL = appCastUrl?.InnerText;
|
||||
XmlNode mandatory = item.SelectSingleNode("mandatory");
|
||||
Boolean.TryParse(mandatory?.InnerText, out Mandatory);
|
||||
args.Mandatory = Mandatory;
|
||||
args.IsUpdateAvailable = true;
|
||||
http.DefaultRequestHeaders.Accept.Clear();
|
||||
var byteArray = System.Text.ASCIIEncoding.UTF8.GetBytes($"{userName}:{passwd}");
|
||||
http.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Basic", Convert.ToBase64String(byteArray));
|
||||
}
|
||||
// url da chiamare
|
||||
http.BaseAddress = new Uri(remoteUrl);
|
||||
// lettura
|
||||
var data = http.GetAsync(remoteUrl).Result;
|
||||
var myReader = data.Content.ReadAsStreamAsync();
|
||||
recXml.Load(myReader.Result);
|
||||
|
||||
XmlNodeList recData = recXml.SelectNodes("item");
|
||||
if (recData != null)
|
||||
{
|
||||
foreach (XmlNode item in recData)
|
||||
{
|
||||
XmlNode appCastVersion = item.SelectSingleNode("version");
|
||||
Version.TryParse(appCastVersion?.InnerText, out CurrentVersion);
|
||||
args.CurrentVersion = CurrentVersion;
|
||||
XmlNode appCastChangeLog = item.SelectSingleNode("changelog");
|
||||
args.ChangelogURL = appCastChangeLog?.InnerText;
|
||||
XmlNode appCastUrl = item.SelectSingleNode("url");
|
||||
args.DownloadURL = appCastUrl?.InnerText;
|
||||
XmlNode mandatory = item.SelectSingleNode("mandatory");
|
||||
Boolean.TryParse(mandatory?.InnerText, out Mandatory);
|
||||
args.Mandatory = Mandatory;
|
||||
args.IsUpdateAvailable = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch
|
||||
catch (Exception exc)
|
||||
{
|
||||
Console.WriteLine($"Eccezione in getUpdateInfo:{Environment.NewLine}{exc}");
|
||||
// metto versione = 0 + errore...
|
||||
args.IsUpdateAvailable = false;
|
||||
args.CurrentVersion = new Version("0.0.0.0");
|
||||
|
||||
Generated
+132
-9
@@ -49,6 +49,7 @@
|
||||
this.tabPage1 = new System.Windows.Forms.TabPage();
|
||||
this.tabPage2 = new System.Windows.Forms.TabPage();
|
||||
this.tabPage3 = new System.Windows.Forms.TabPage();
|
||||
this.btnResetAppConf = new System.Windows.Forms.Button();
|
||||
this.lblTestLogger = new System.Windows.Forms.Label();
|
||||
this.chkTestLogger = new System.Windows.Forms.CheckBox();
|
||||
this.btnResetCdv = new System.Windows.Forms.Button();
|
||||
@@ -81,7 +82,16 @@
|
||||
this.lblQueueRead = new System.Windows.Forms.Label();
|
||||
this.clockTimer = new System.Windows.Forms.Timer(this.components);
|
||||
this.LogTimer = new System.Windows.Forms.Timer(this.components);
|
||||
this.btnResetAppConf = new System.Windows.Forms.Button();
|
||||
this.tabPage7 = new System.Windows.Forms.TabPage();
|
||||
this.label9 = new System.Windows.Forms.Label();
|
||||
this.txtUser = new System.Windows.Forms.TextBox();
|
||||
this.txtPass = new System.Windows.Forms.TextBox();
|
||||
this.label10 = new System.Windows.Forms.Label();
|
||||
this.txtRemoteUrl = new System.Windows.Forms.TextBox();
|
||||
this.label11 = new System.Windows.Forms.Label();
|
||||
this.btnReadUpdMan = new System.Windows.Forms.Button();
|
||||
this.lblOutUpdMan = new System.Windows.Forms.Label();
|
||||
this.btnDownload = new System.Windows.Forms.Button();
|
||||
this.groupBox1.SuspendLayout();
|
||||
this.tabControl1.SuspendLayout();
|
||||
this.tabPage1.SuspendLayout();
|
||||
@@ -94,6 +104,7 @@
|
||||
this.groupBox3.SuspendLayout();
|
||||
this.grpPublisher.SuspendLayout();
|
||||
this.groupBox2.SuspendLayout();
|
||||
this.tabPage7.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// groupBox1
|
||||
@@ -266,6 +277,7 @@
|
||||
this.tabControl1.Controls.Add(this.tabPage4);
|
||||
this.tabControl1.Controls.Add(this.tabPage5);
|
||||
this.tabControl1.Controls.Add(this.tabPage6);
|
||||
this.tabControl1.Controls.Add(this.tabPage7);
|
||||
this.tabControl1.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.tabControl1.Location = new System.Drawing.Point(0, 0);
|
||||
this.tabControl1.Name = "tabControl1";
|
||||
@@ -314,6 +326,16 @@
|
||||
this.tabPage3.Text = "Redis test";
|
||||
this.tabPage3.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// btnResetAppConf
|
||||
//
|
||||
this.btnResetAppConf.Location = new System.Drawing.Point(576, 13);
|
||||
this.btnResetAppConf.Name = "btnResetAppConf";
|
||||
this.btnResetAppConf.Size = new System.Drawing.Size(114, 23);
|
||||
this.btnResetAppConf.TabIndex = 16;
|
||||
this.btnResetAppConf.Text = "ResetAppConf";
|
||||
this.btnResetAppConf.UseVisualStyleBackColor = true;
|
||||
this.btnResetAppConf.Click += new System.EventHandler(this.btnResetAppConf_Click);
|
||||
//
|
||||
// lblTestLogger
|
||||
//
|
||||
this.lblTestLogger.AutoSize = true;
|
||||
@@ -656,15 +678,104 @@
|
||||
this.LogTimer.Interval = 10;
|
||||
this.LogTimer.Tick += new System.EventHandler(this.LogTimer_Tick);
|
||||
//
|
||||
// btnResetAppConf
|
||||
// tabPage7
|
||||
//
|
||||
this.btnResetAppConf.Location = new System.Drawing.Point(576, 13);
|
||||
this.btnResetAppConf.Name = "btnResetAppConf";
|
||||
this.btnResetAppConf.Size = new System.Drawing.Size(114, 23);
|
||||
this.btnResetAppConf.TabIndex = 16;
|
||||
this.btnResetAppConf.Text = "ResetAppConf";
|
||||
this.btnResetAppConf.UseVisualStyleBackColor = true;
|
||||
this.btnResetAppConf.Click += new System.EventHandler(this.btnResetAppConf_Click);
|
||||
this.tabPage7.Controls.Add(this.btnDownload);
|
||||
this.tabPage7.Controls.Add(this.lblOutUpdMan);
|
||||
this.tabPage7.Controls.Add(this.btnReadUpdMan);
|
||||
this.tabPage7.Controls.Add(this.txtRemoteUrl);
|
||||
this.tabPage7.Controls.Add(this.label11);
|
||||
this.tabPage7.Controls.Add(this.txtPass);
|
||||
this.tabPage7.Controls.Add(this.label10);
|
||||
this.tabPage7.Controls.Add(this.txtUser);
|
||||
this.tabPage7.Controls.Add(this.label9);
|
||||
this.tabPage7.Location = new System.Drawing.Point(4, 22);
|
||||
this.tabPage7.Name = "tabPage7";
|
||||
this.tabPage7.Padding = new System.Windows.Forms.Padding(3);
|
||||
this.tabPage7.Size = new System.Drawing.Size(768, 353);
|
||||
this.tabPage7.TabIndex = 6;
|
||||
this.tabPage7.Text = "Update Man";
|
||||
this.tabPage7.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// label9
|
||||
//
|
||||
this.label9.AutoSize = true;
|
||||
this.label9.Location = new System.Drawing.Point(19, 20);
|
||||
this.label9.Name = "label9";
|
||||
this.label9.Size = new System.Drawing.Size(29, 13);
|
||||
this.label9.TabIndex = 0;
|
||||
this.label9.Text = "User";
|
||||
//
|
||||
// txtUser
|
||||
//
|
||||
this.txtUser.Location = new System.Drawing.Point(60, 17);
|
||||
this.txtUser.Name = "txtUser";
|
||||
this.txtUser.Size = new System.Drawing.Size(100, 20);
|
||||
this.txtUser.TabIndex = 1;
|
||||
this.txtUser.Text = "SWDownloader";
|
||||
//
|
||||
// txtPass
|
||||
//
|
||||
this.txtPass.Location = new System.Drawing.Point(209, 17);
|
||||
this.txtPass.Name = "txtPass";
|
||||
this.txtPass.Size = new System.Drawing.Size(100, 20);
|
||||
this.txtPass.TabIndex = 3;
|
||||
this.txtPass.Text = "viaD@nte16";
|
||||
//
|
||||
// label10
|
||||
//
|
||||
this.label10.AutoSize = true;
|
||||
this.label10.Location = new System.Drawing.Point(168, 20);
|
||||
this.label10.Name = "label10";
|
||||
this.label10.Size = new System.Drawing.Size(30, 13);
|
||||
this.label10.TabIndex = 2;
|
||||
this.label10.Text = "Pass";
|
||||
//
|
||||
// txtRemoteUrl
|
||||
//
|
||||
this.txtRemoteUrl.Location = new System.Drawing.Point(60, 43);
|
||||
this.txtRemoteUrl.Name = "txtRemoteUrl";
|
||||
this.txtRemoteUrl.Size = new System.Drawing.Size(611, 20);
|
||||
this.txtRemoteUrl.TabIndex = 5;
|
||||
this.txtRemoteUrl.Text = "http://nexus.steamware.net/repository/SWS/MP-STATS/unstable/0/manifest.xml";
|
||||
//
|
||||
// label11
|
||||
//
|
||||
this.label11.AutoSize = true;
|
||||
this.label11.Location = new System.Drawing.Point(19, 46);
|
||||
this.label11.Name = "label11";
|
||||
this.label11.Size = new System.Drawing.Size(20, 13);
|
||||
this.label11.TabIndex = 4;
|
||||
this.label11.Text = "Url";
|
||||
//
|
||||
// btnReadUpdMan
|
||||
//
|
||||
this.btnReadUpdMan.Location = new System.Drawing.Point(315, 15);
|
||||
this.btnReadUpdMan.Name = "btnReadUpdMan";
|
||||
this.btnReadUpdMan.Size = new System.Drawing.Size(175, 23);
|
||||
this.btnReadUpdMan.TabIndex = 6;
|
||||
this.btnReadUpdMan.Text = "Retrieve Info";
|
||||
this.btnReadUpdMan.UseVisualStyleBackColor = true;
|
||||
this.btnReadUpdMan.Click += new System.EventHandler(this.btnReadUpdMan_Click);
|
||||
//
|
||||
// lblOutUpdMan
|
||||
//
|
||||
this.lblOutUpdMan.AutoSize = true;
|
||||
this.lblOutUpdMan.Location = new System.Drawing.Point(19, 76);
|
||||
this.lblOutUpdMan.Name = "lblOutUpdMan";
|
||||
this.lblOutUpdMan.Size = new System.Drawing.Size(16, 13);
|
||||
this.lblOutUpdMan.TabIndex = 7;
|
||||
this.lblOutUpdMan.Text = "---";
|
||||
//
|
||||
// btnDownload
|
||||
//
|
||||
this.btnDownload.Location = new System.Drawing.Point(496, 15);
|
||||
this.btnDownload.Name = "btnDownload";
|
||||
this.btnDownload.Size = new System.Drawing.Size(175, 23);
|
||||
this.btnDownload.TabIndex = 8;
|
||||
this.btnDownload.Text = "Download latest";
|
||||
this.btnDownload.UseVisualStyleBackColor = true;
|
||||
this.btnDownload.Click += new System.EventHandler(this.btnDownload_Click);
|
||||
//
|
||||
// MainForm
|
||||
//
|
||||
@@ -697,6 +808,8 @@
|
||||
this.grpPublisher.PerformLayout();
|
||||
this.groupBox2.ResumeLayout(false);
|
||||
this.groupBox2.PerformLayout();
|
||||
this.tabPage7.ResumeLayout(false);
|
||||
this.tabPage7.PerformLayout();
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
@@ -757,6 +870,16 @@
|
||||
private System.Windows.Forms.CheckBox chkTestLogger;
|
||||
private System.Windows.Forms.Timer LogTimer;
|
||||
private System.Windows.Forms.Button btnResetAppConf;
|
||||
private System.Windows.Forms.TabPage tabPage7;
|
||||
private System.Windows.Forms.TextBox txtPass;
|
||||
private System.Windows.Forms.Label label10;
|
||||
private System.Windows.Forms.TextBox txtUser;
|
||||
private System.Windows.Forms.Label label9;
|
||||
private System.Windows.Forms.TextBox txtRemoteUrl;
|
||||
private System.Windows.Forms.Label label11;
|
||||
private System.Windows.Forms.Label lblOutUpdMan;
|
||||
private System.Windows.Forms.Button btnReadUpdMan;
|
||||
private System.Windows.Forms.Button btnDownload;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -61,6 +61,21 @@ namespace TestBench
|
||||
}
|
||||
}
|
||||
|
||||
private void btnDownload_Click(object sender, EventArgs e)
|
||||
{
|
||||
var currUpdMan = new UpdateMan(txtUser.Text.Trim(), txtPass.Text.Trim());
|
||||
currUpdMan.downloadLatest(txtRemoteUrl.Text.Trim(), "c:\\Temp", "MP-STATS");
|
||||
}
|
||||
|
||||
private void btnReadUpdMan_Click(object sender, EventArgs e)
|
||||
{
|
||||
// recupero i dati dall'URL
|
||||
var currUpdMan = new UpdateMan(txtUser.Text.Trim(), txtPass.Text.Trim());
|
||||
// popolo la label
|
||||
var updInfo = currUpdMan.getUpdateInfo(txtRemoteUrl.Text.Trim());
|
||||
lblOutUpdMan.Text = $"Vers: {updInfo.CurrentVersion} | URL: {updInfo.DownloadURL}";
|
||||
}
|
||||
|
||||
private void btnResetAppConf_Click(object sender, EventArgs e)
|
||||
{
|
||||
memLayer.ML.resetAppConf();
|
||||
|
||||
Reference in New Issue
Block a user