This commit is contained in:
2022-10-16 08:45:22 +03:00
parent 7264e888e5
commit 7599819edb
20 changed files with 308 additions and 585 deletions

View File

@@ -1,50 +0,0 @@
namespace msoui.Forms;
partial class ExecuterForm
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose (bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent ()
{
this.SuspendLayout();
//
// ExecuterForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 21F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(496, 180);
this.ControlBox = false;
this.Font = new System.Drawing.Font("Segoe UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
this.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "ExecuterForm";
this.Text = "Установка обновлений";
this.ResumeLayout(false);
}
#endregion
}

View File

@@ -1,18 +0,0 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace msoui.Forms;
public partial class ExecuterForm: Form
{
public ExecuterForm ()
{
InitializeComponent();
}
}

View File

@@ -0,0 +1,124 @@
namespace msoui.Forms;
partial class InstallForm
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose (bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent ()
{
this.components = new System.ComponentModel.Container();
this.actionPanel = new System.Windows.Forms.Panel();
this.progressBar = new System.Windows.Forms.ProgressBar();
this.statusLabel = new System.Windows.Forms.Label();
this.logList = new System.Windows.Forms.ListBox();
this.process = new System.Diagnostics.Process();
this.startTimer = new System.Windows.Forms.Timer(this.components);
this.actionPanel.SuspendLayout();
this.SuspendLayout();
//
// actionPanel
//
this.actionPanel.Controls.Add(this.progressBar);
this.actionPanel.Controls.Add(this.statusLabel);
this.actionPanel.Dock = System.Windows.Forms.DockStyle.Top;
this.actionPanel.Location = new System.Drawing.Point(0, 0);
this.actionPanel.Name = "actionPanel";
this.actionPanel.Padding = new System.Windows.Forms.Padding(10);
this.actionPanel.Size = new System.Drawing.Size(496, 91);
this.actionPanel.TabIndex = 5;
//
// progressBar
//
this.progressBar.Dock = System.Windows.Forms.DockStyle.Fill;
this.progressBar.Location = new System.Drawing.Point(10, 59);
this.progressBar.Name = "progressBar";
this.progressBar.Size = new System.Drawing.Size(476, 22);
this.progressBar.TabIndex = 1;
//
// statusLabel
//
this.statusLabel.Dock = System.Windows.Forms.DockStyle.Top;
this.statusLabel.Location = new System.Drawing.Point(10, 10);
this.statusLabel.Name = "statusLabel";
this.statusLabel.Size = new System.Drawing.Size(476, 49);
this.statusLabel.TabIndex = 0;
this.statusLabel.Text = "&Начинаю установку...";
//
// logList
//
this.logList.Dock = System.Windows.Forms.DockStyle.Fill;
this.logList.FormattingEnabled = true;
this.logList.ItemHeight = 21;
this.logList.Location = new System.Drawing.Point(0, 0);
this.logList.Margin = new System.Windows.Forms.Padding(10);
this.logList.Name = "logList";
this.logList.Size = new System.Drawing.Size(496, 313);
this.logList.TabIndex = 4;
//
// process
//
this.process.StartInfo.Domain = "";
this.process.StartInfo.LoadUserProfile = false;
this.process.StartInfo.Password = null;
this.process.StartInfo.StandardErrorEncoding = null;
this.process.StartInfo.StandardInputEncoding = null;
this.process.StartInfo.StandardOutputEncoding = null;
this.process.StartInfo.UserName = "";
this.process.SynchronizingObject = this;
//
// startTimer
//
this.startTimer.Interval = 1000;
this.startTimer.Tick += new System.EventHandler(this.startTimer_Tick);
//
// InstallForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 21F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(496, 313);
this.ControlBox = false;
this.Controls.Add(this.actionPanel);
this.Controls.Add(this.logList);
this.Font = new System.Drawing.Font("Segoe UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
this.Margin = new System.Windows.Forms.Padding(4);
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "InstallForm";
this.Text = "Установка обновлений";
this.Load += new System.EventHandler(this.InstallForm_Load);
this.actionPanel.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
private Panel actionPanel;
private ProgressBar progressBar;
private Label statusLabel;
private ListBox logList;
private System.Diagnostics.Process process;
private System.Windows.Forms.Timer startTimer;
}

View File

@@ -0,0 +1,75 @@
namespace msoui.Forms;
public partial class InstallForm: Form
{
public InstallForm (List<string> fileList, string extractDir)
{
FileList = fileList;
ExtractDir = extractDir;
InitializeComponent();
}
public List<string> FileList { get; set; }
public string ExtractDir { get; set; }
private void LogIt(string message)
{
logList.Items.Add(message);
}
private void LogIt (string message, params object?[] args)
{
logList.Items.Add(string.Format(message, args));
}
public void StartProcess (string fileName)
{
process.StartInfo.FileName = fileName;
process.StartInfo.Arguments = "/q /norestart";
process.StartInfo.CreateNoWindow = false;
process.EnableRaisingEvents = true;
process.Exited += (_, _) => LogIt(@"[{0}] Процесс завершен с кодом {1}.", process.ExitTime, process.ExitCode);
process.Start();
process.WaitForExit();
}
public void InstallUpdates ()
{
LogIt("Начинаю установку...");
int updatesCount = FileList.Count;
LogIt("Выбрано {0} обновлений для установки...", updatesCount);
int count = 0;
foreach (string? file in FileList)
{
count++;
decimal percentDone = Math.Round((decimal)count / updatesCount * 100);
LogIt(@"Устанавливается файл {0} [{1} из {2}, {3}%]...", file, count, updatesCount, percentDone);
StartProcess($"{ExtractDir}{file}");
LogIt(@"Файл {0} установлен!", file);
}
MessageBox.Show(@"Набор обновлений успешно установлен!", @"Установка завершена", MessageBoxButtons.OK,
MessageBoxIcon.Asterisk);
DialogResult = DialogResult.OK;
}
private void startTimer_Tick (object sender, EventArgs e)
{
startTimer.Enabled = false;
InstallUpdates();
}
private void InstallForm_Load (object sender, EventArgs e)
{
startTimer.Enabled = true;
}
}

View File

@@ -57,4 +57,10 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="process.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<metadata name="startTimer.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>110, 17</value>
</metadata>
</root>

View File

@@ -28,6 +28,7 @@ sealed partial class MainForm
/// </summary>
private void InitializeComponent ()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MainForm));
this.contentPanel = new System.Windows.Forms.Panel();
this.viewButton = new System.Windows.Forms.Button();
this.bitsSelector64 = new System.Windows.Forms.RadioButton();
@@ -39,7 +40,6 @@ sealed partial class MainForm
this.buttonsPanel = new System.Windows.Forms.Panel();
this.exitButton = new System.Windows.Forms.Button();
this.installButton = new System.Windows.Forms.Button();
this.settingsButton = new System.Windows.Forms.Button();
this.dataFileDialog = new System.Windows.Forms.OpenFileDialog();
this.contentPanel.SuspendLayout();
this.buttonsPanel.SuspendLayout();
@@ -137,7 +137,6 @@ sealed partial class MainForm
//
this.buttonsPanel.Controls.Add(this.exitButton);
this.buttonsPanel.Controls.Add(this.installButton);
this.buttonsPanel.Controls.Add(this.settingsButton);
this.buttonsPanel.Dock = System.Windows.Forms.DockStyle.Bottom;
this.buttonsPanel.Location = new System.Drawing.Point(0, 214);
this.buttonsPanel.Name = "buttonsPanel";
@@ -164,15 +163,6 @@ sealed partial class MainForm
this.installButton.UseVisualStyleBackColor = true;
this.installButton.Click += new System.EventHandler(this.installButton_Click);
//
// settingsButton
//
this.settingsButton.Location = new System.Drawing.Point(12, 13);
this.settingsButton.Name = "settingsButton";
this.settingsButton.Size = new System.Drawing.Size(110, 33);
this.settingsButton.TabIndex = 0;
this.settingsButton.Text = "&Настройки";
this.settingsButton.UseVisualStyleBackColor = true;
//
// dataFileDialog
//
this.dataFileDialog.DefaultExt = "data";
@@ -189,6 +179,7 @@ sealed partial class MainForm
this.Controls.Add(this.contentPanel);
this.Font = new System.Drawing.Font("Segoe UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.Fixed3D;
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.Margin = new System.Windows.Forms.Padding(4);
this.MaximizeBox = false;
this.MinimizeBox = false;
@@ -216,6 +207,5 @@ sealed partial class MainForm
private Label titleLabel;
private Button exitButton;
private Button installButton;
private Button settingsButton;
private OpenFileDialog dataFileDialog;
}

View File

@@ -51,7 +51,7 @@ public sealed partial class MainForm: Form
unPackFrm.Dispose();
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
UpdatesListForm updatesListForm = new UpdatesListForm(updatesList);
UpdatesListForm updatesListForm = new(updatesList);
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><>
DialogResult ulDialogResult = updatesListForm.ShowDialog();
@@ -64,7 +64,20 @@ public sealed partial class MainForm: Form
return;
}
//
//<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><>
updatesListForm.Dispose();
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
InstallForm installForm = new (updatesList, TempWorkDir);
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><>
installForm.ShowDialog();
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><>
installForm.Dispose();
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD>
CleanThis(updatesList);
}
private void StartForm_Load (object sender, EventArgs e)

View File

@@ -60,4 +60,64 @@
<metadata name="dataFileDialog.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
AAABAAEAICAAAAEAGACoDAAAFgAAACgAAAAgAAAAQAAAAAEAGAAAAAAAAAAAAEgAAABIAAAAAAAAAAAA
AAD////V1dVLS0sICAgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHBwdHR0fR0dH////X19cPDw8AAAABAQEEBAQEBAQEBAQE
BAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQE
BAQBAQEAAAAMDAzR0dFRUVEAAABQUFDs7Oz/////////////////////////////////////////////
///////////////////////////////////////////////////u7u5XV1cAAABISEgPDw8AAADl5eX/
////////////////////////////////////////////////////////////////////////////////
///////////////////////u7u4BAQEHBwcEBAQAAAD7+/v/////////////////////////////////
//////////////////////////////////////////////////////////////////////////8EBAQA
AAAEBAQAAAD7+/v/////////////////////////////////////////////////////////////////
//////////////////////////////////////////8EBAQAAAAEBAQAAAD7+/v/////////////////
////////////////////////////////////////////////////////////////////////////////
//////////8EBAQAAAAEBAQAAAD7+/v////////////////////////////////////////////////+
/v7+/v7///////////////////////////////////////////////////8EBAQAAAAEBAQAAAD7+/v/
///////////////////////////////////////////p6ekwMDAqKirl5eX/////////////////////
//////////////////////////8EBAQAAAAEBAQAAAD7+/v/////////////////////////////////
///////p6ekrKysAAAAAAAAmJibl5eX///////////////////////////////////////////8EBAQA
AAAEBAQAAAD7+/v////////////////////////////////////p6ekrKysAAAAAAAAAAAAAAAAmJibl
5eX///////////////////////////////////////8EBAQAAAAEBAQAAAD7+/v/////////////////
///////////////p6ekrKysAAAAsLCwCAgIAAAAvLy8AAAAmJibl5eX/////////////////////////
//////////8EBAQAAAAEBAQAAAD7+/v////////////////////////////p6ekrKysAAAAsLCzp6ekE
BAQAAADp6ekyMjIAAAAmJibl5eX///////////////////////////////8EBAQAAAAEBAQAAAD7+/v/
///////////////////////p6ekrKysAAAAsLCzp6en///8EBAQAAAD7+/vt7e0yMjIAAAAmJibl5eX/
//////////////////////////8EBAQAAAAEBAQAAAD7+/v///////////////////////8zMzMAAAAs
LCzp6en///////8EBAQAAAD7+/v////t7e0yMjIAAAAqKir+/v7///////////////////////8EBAQA
AAAEBAQAAAD7+/v///////////////////////9BQUE0NDTp6en///////////8EBAQAAAD7+/v/////
///t7e06Ojo4ODj///////////////////////////8EBAQAAAAEBAQAAAD7+/v/////////////////
//////////////////////////////8EBAQAAAD7+/v/////////////////////////////////////
//////////8EBAQAAAAEBAQAAAD7+/v///////////////////////////////////////////////8E
BAQAAAD7+/v///////////////////////////////////////////////8EBAQAAAAEBAQAAAD7+/v/
//////////////////////////////////////////////8EBAQAAAD7+/v/////////////////////
//////////////////////////8EBAQAAAAEBAQAAAD7+/v/////////////////////////////////
//////////////8EBAQAAAD7+/v///////////////////////////////////////////////8EBAQA
AAAEBAQAAAD7+/v///////////////////////////////////////////////8EBAQAAAD7+/v/////
//////////////////////////////////////////8EBAQAAAAEBAQAAAD7+/v/////////////////
//////////////////////////////8EBAQAAAD7+/v/////////////////////////////////////
//////////8EBAQAAAAEBAQAAAD7+/v///////////////////////////////////////////////8E
BAQAAAD7+/v///////////////////////////////////////////////8EBAQAAAAEBAQAAAD7+/v/
//////////////////////////////////////////////9BQUE5OTn/////////////////////////
//////////////////////////8EBAQAAAAEBAQAAAD7+/v/////////////////////////////////
//////////////////////////////////////////////////////////////////////////8EBAQA
AAAEBAQAAAD7+/v/////////////////////////////////////////////////////////////////
//////////////////////////////////////////8EBAQAAAAEBAQAAAD7+/v/////////////////
////////////////////////////////////////////////////////////////////////////////
//////////8EBAQAAAAEBAQAAAD7+/v/////////////////////////////////////////////////
//////////////////////////////////////////////////////////8EBAQAAAAREREAAADj4+P/
////////////////////////////////////////////////////////////////////////////////
///////////////////////r6+sBAQEICAhVVVUAAABJSUni4uL7+/v7+/v7+/v7+/v7+/v7+/v7+/v7
+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/v7+/vl5eVQUFAAAABM
TEzc3NwTExMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQEBDW1tb////c3NxVVVUREREEBAQEBAQEBAQE
BAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQE
BAQQEBBRUVHY2Nj///8P///wIAAABEAAAAJAAAAAQAAAAUAAAAFAAAABQAAAAUAAAAFAAYABQAPAAUAE
oAFACJABQBCIAUAghAFAAIABQACAAUAAgAFAAIABQACAAUAAgAFAAIABQACAAUAAAAFAAAABQAAAAUAA
AAFAAAABQAAAAEAAAAI////8AAAAAA==
</value>
</data>
</root>

View File

@@ -78,7 +78,7 @@ public sealed partial class UnPackForm: Form
Application.DoEvents();
//Распаковываю файл
//entry.Extract($@"{unPackTo}{unPackFileName}");
entry.Extract($@"{Model.UnPackDir}{unPackFileName}");
//Добавляю в список файлов
if (File.Exists($@"{Model.UnPackDir}{unPackFileName}"))

View File

@@ -75,6 +75,7 @@ sealed partial class UpdatesListForm
this.installButton.TabIndex = 3;
this.installButton.Text = "&Установить >";
this.installButton.UseVisualStyleBackColor = true;
this.installButton.Click += new System.EventHandler(this.installButton_Click);
//
// cancelButton
//
@@ -84,7 +85,7 @@ sealed partial class UpdatesListForm
this.cancelButton.TabIndex = 4;
this.cancelButton.Text = "< &Отмена";
this.cancelButton.UseVisualStyleBackColor = true;
this.cancelButton.Click += new System.EventHandler(this.button2_Click);
this.cancelButton.Click += new System.EventHandler(this.cancelButton_Click);
//
// selectionStatus
//

View File

@@ -11,11 +11,6 @@ public sealed partial class UpdatesListForm: Form
private const string SelectionStatusLabel = "{0} выбрано из {1}";
private void button2_Click (object sender, EventArgs e)
{
DialogResult = DialogResult.Cancel;
}
private void selectAllButton_Click (object sender, EventArgs e)
{
for (int index = 0; index < updatesListBox.Items.Count; index++)
@@ -34,4 +29,20 @@ public sealed partial class UpdatesListForm: Form
{
selectionStatus.Text = string.Format(SelectionStatusLabel, updatesListBox.CheckedItems.Count, updatesListBox.Items.Count);
}
private void installButton_Click (object sender, EventArgs e)
{
UpdatesList.Clear();
foreach (object checkedItem in updatesListBox.CheckedItems)
{
if (checkedItem.ToString() != null)
UpdatesList.Add(checkedItem.ToString()!);
}
}
private void cancelButton_Click (object sender, EventArgs e)
{
DialogResult = DialogResult.Cancel;
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

View File

@@ -7,8 +7,14 @@
<UseWindowsForms>true</UseWindowsForms>
<ImplicitUsings>enable</ImplicitUsings>
<RootNamespace>msoui</RootNamespace>
<StartupObject>msoui.Program</StartupObject>
<ApplicationIcon>arrow-down-square.ico</ApplicationIcon>
</PropertyGroup>
<ItemGroup>
<Content Include="arrow-down-square.ico" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="ANBSoftware.ComponentsPack" Version="1.2022.723" />
<PackageReference Include="SevenZipExtractor" Version="1.0.17" />