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,46 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<StartupObject>MSOUI.Program</StartupObject>
<ApplicationManifest>app.manifest</ApplicationManifest>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
<DebugType>none</DebugType>
<DebugSymbols>false</DebugSymbols>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Compile Remove="mso_updates\**" />
<Compile Remove="releases\**" />
<EmbeddedResource Remove="mso_updates\**" />
<EmbeddedResource Remove="releases\**" />
<None Remove="mso_updates\**" />
<None Remove="releases\**" />
</ItemGroup>
<ItemGroup>
<Compile Update="Properties\Resources.Designer.cs">
<DesignTime>True</DesignTime>
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Update="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
</ItemGroup>
</Project>

View File

@ -3,9 +3,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.3.32929.385
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MSOUI", "MSOUI.csproj", "{B7E4991D-99A9-4189-BCD9-557E04CA4473}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "msou_installer", "msou_installer\msou_installer.csproj", "{E86E8BBF-8830-4259-9DEE-6F3EFC284443}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "msou_installer", "msou_installer\msou_installer.csproj", "{E86E8BBF-8830-4259-9DEE-6F3EFC284443}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@ -13,10 +11,6 @@ Global
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{B7E4991D-99A9-4189-BCD9-557E04CA4473}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B7E4991D-99A9-4189-BCD9-557E04CA4473}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B7E4991D-99A9-4189-BCD9-557E04CA4473}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B7E4991D-99A9-4189-BCD9-557E04CA4473}.Release|Any CPU.Build.0 = Release|Any CPU
{E86E8BBF-8830-4259-9DEE-6F3EFC284443}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E86E8BBF-8830-4259-9DEE-6F3EFC284443}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E86E8BBF-8830-4259-9DEE-6F3EFC284443}.Release|Any CPU.ActiveCfg = Release|Any CPU

View File

@ -1,2 +0,0 @@
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<s:Boolean x:Key="/Default/UserDictionary/Words/=msoui/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>

View File

@ -1,78 +0,0 @@
using System.Diagnostics;
using MSOUI.Properties;
namespace MSOUI;
internal static class Program
{
private static void Main ()
{
string folder = $"{Directory.GetCurrentDirectory()}\\mso_updates\\";
if (!Directory.Exists (folder))
{
Console.WriteLine(Resources.FolderNotExist, folder);
Console.ReadLine ();
return;
}
string Mask = "*.exe";
List<string> fileList = new();
ScanForFiles(ref fileList, folder, Mask);
Console.WriteLine(Resources.StartUpdateMessage);
string? isAcceptStr = Console.ReadLine();
if ((isAcceptStr ?? "n").ToLower() == "y")
InstallUpdates(ref fileList, folder);
Console.WriteLine(Resources.ProgramIsFinish);
Console.ReadLine();
}
public static void StartProcess (string fileName)
{
Process process = new();
process.StartInfo.FileName = fileName;
process.StartInfo.Arguments = "/q /norestart";
process.StartInfo.CreateNoWindow = false;
process.EnableRaisingEvents = true;
process.Exited += (_, _) => Console.WriteLine(Resources.ProcessWasFinishedWithCode, process.ExitTime, process.ExitCode);
process.Start();
process.WaitForExit();
}
public static void InstallUpdates (ref List<string> fileList, string folder)
{
Console.WriteLine(Resources.StartingUpdate);
int updatesCount = fileList.Count;
Console.WriteLine(Resources.UpdateCountMessage, updatesCount);
int count = 0;
foreach (string? file in fileList)
{
count++;
decimal percentDone = Math.Round((decimal)count / updatesCount * 100);
Console.WriteLine(Resources.UpdatingFile, file, count, updatesCount, percentDone);
StartProcess($"{folder}{file}");
Console.WriteLine(Resources.FileWasUpdated, file);
}
}
public static void ScanForFiles (ref List<string> fileList, string folder, string mask)
{
Console.WriteLine(Resources.SearchStarted);
Console.WriteLine($@" {folder}");
Console.WriteLine(Resources.ListOfFoundFiles);
foreach (string fFile in Directory.EnumerateFiles(folder, mask, SearchOption.AllDirectories))
{
try
{
FileInfo fInfo = new(fFile);
fileList.Add(fInfo.Name);
Console.WriteLine($@" {fInfo.Name}");
}
catch
{
// ignored
}
}
}
}

View File

@ -1,153 +0,0 @@
//------------------------------------------------------------------------------
// <auto-generated>
// Этот код создан программой.
// Исполняемая версия:4.0.30319.42000
//
// Изменения в этом файле могут привести к неправильной работе и будут потеряны в случае
// повторной генерации кода.
// </auto-generated>
//------------------------------------------------------------------------------
namespace MSOUI.Properties {
using System;
/// <summary>
/// Класс ресурса со строгой типизацией для поиска локализованных строк и т.д.
/// </summary>
// Этот класс создан автоматически классом StronglyTypedResourceBuilder
// с помощью такого средства, как ResGen или Visual Studio.
// Чтобы добавить или удалить член, измените файл .ResX и снова запустите ResGen
// с параметром /str или перестройте свой проект VS.
[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>
/// Возвращает кэшированный экземпляр ResourceManager, использованный этим классом.
/// </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("MSOUI.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// Перезаписывает свойство CurrentUICulture текущего потока для всех
/// обращений к ресурсу с помощью этого класса ресурса со строгой типизацией.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set {
resourceCulture = value;
}
}
/// <summary>
/// Ищет локализованную строку, похожую на Файл &quot;{0}&quot; установлен!.
/// </summary>
internal static string FileWasUpdated {
get {
return ResourceManager.GetString("FileWasUpdated", resourceCulture);
}
}
/// <summary>
/// Ищет локализованную строку, похожую на Директории «{0}» не существует!.
/// </summary>
internal static string FolderNotExist {
get {
return ResourceManager.GetString("FolderNotExist", resourceCulture);
}
}
/// <summary>
/// Ищет локализованную строку, похожую на СПИСОК НАЙДЕННЫХ ФАЙЛОВ:.
/// </summary>
internal static string ListOfFoundFiles {
get {
return ResourceManager.GetString("ListOfFoundFiles", resourceCulture);
}
}
/// <summary>
/// Ищет локализованную строку, похожую на [{0}] Процесс завершен с кодом {1}..
/// </summary>
internal static string ProcessWasFinishedWithCode {
get {
return ResourceManager.GetString("ProcessWasFinishedWithCode", resourceCulture);
}
}
/// <summary>
/// Ищет локализованную строку, похожую на Работа программы завершена. Нажмите &quot;Enter&quot; для выхода..
/// </summary>
internal static string ProgramIsFinish {
get {
return ResourceManager.GetString("ProgramIsFinish", resourceCulture);
}
}
/// <summary>
/// Ищет локализованную строку, похожую на Начинаю поиск исполняемых файлов в папке:.
/// </summary>
internal static string SearchStarted {
get {
return ResourceManager.GetString("SearchStarted", resourceCulture);
}
}
/// <summary>
/// Ищет локализованную строку, похожую на Начинаю установку....
/// </summary>
internal static string StartingUpdate {
get {
return ResourceManager.GetString("StartingUpdate", resourceCulture);
}
}
/// <summary>
/// Ищет локализованную строку, похожую на Приступить к установке обновлений? [Y, y - да, любая другая клавиша - нет].
/// </summary>
internal static string StartUpdateMessage {
get {
return ResourceManager.GetString("StartUpdateMessage", resourceCulture);
}
}
/// <summary>
/// Ищет локализованную строку, похожую на Выбрано {0} обновлений для установки....
/// </summary>
internal static string UpdateCountMessage {
get {
return ResourceManager.GetString("UpdateCountMessage", resourceCulture);
}
}
/// <summary>
/// Ищет локализованную строку, похожую на Устанавливается файл &quot;{0}&quot; [{1} из {2}, {3}%]....
/// </summary>
internal static string UpdatingFile {
get {
return ResourceManager.GetString("UpdatingFile", resourceCulture);
}
}
}
}

View File

@ -1,131 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 1.3
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">1.3</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1">this is my long string</data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
[base64 mime encoded serialized .NET Framework object]
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
[base64 mime encoded string representing a byte array form of the .NET Framework object]
</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="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>1.3</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.3500.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.3500.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="ProcessWasFinishedWithCode" xml:space="preserve">
<value>[{0}] Процесс завершен с кодом {1}.</value>
</data>
<data name="FolderNotExist" xml:space="preserve">
<value>Директории «{0}» не существует!</value>
</data>
<data name="StartUpdateMessage" xml:space="preserve">
<value>Приступить к установке обновлений? [Y, y - да, любая другая клавиша - нет]</value>
</data>
<data name="ProgramIsFinish" xml:space="preserve">
<value>Работа программы завершена. Нажмите "Enter" для выхода.</value>
</data>
<data name="StartingUpdate" xml:space="preserve">
<value>Начинаю установку...</value>
</data>
<data name="UpdateCountMessage" xml:space="preserve">
<value>Выбрано {0} обновлений для установки...</value>
</data>
<data name="UpdatingFile" xml:space="preserve">
<value>Устанавливается файл "{0}" [{1} из {2}, {3}%]...</value>
</data>
<data name="FileWasUpdated" xml:space="preserve">
<value>Файл "{0}" установлен!</value>
</data>
<data name="SearchStarted" xml:space="preserve">
<value>Начинаю поиск исполняемых файлов в папке:</value>
</data>
<data name="ListOfFoundFiles" xml:space="preserve">
<value>СПИСОК НАЙДЕННЫХ ФАЙЛОВ:</value>
</data>
</root>

View File

@ -1,79 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1">
<assemblyIdentity version="1.0.0.0" name="MyApplication.app"/>
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
<security>
<requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
<!-- Параметры манифеста UAC
Если вы хотите изменить уровень контроля учетных записей Windows, замените узел
requestedExecutionLevel на один из следующих.
<requestedExecutionLevel level="asInvoker" uiAccess="false" />
<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
<requestedExecutionLevel level="highestAvailable" uiAccess="false" />
При указании элемента requestedExecutionLevel будет отключена виртуализация файлов и реестра.
Удалите этот элемент, если виртуализация требуется приложению для обратной
совместимости.
-->
<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
</requestedPrivileges>
</security>
</trustInfo>
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
<application>
<!-- Список версий Windows, на которых это приложение было протестировано
и будет работать. Раскомментируйте соответствующие элементы, чтобы ОС Windows
автоматически выбрала наиболее совместимое окружение. -->
<!-- Windows Vista -->
<!--<supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}" />-->
<!-- Windows 7 -->
<!--<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}" />-->
<!-- Windows 8 -->
<!--<supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}" />-->
<!-- Windows 8.1 -->
<!--<supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}" />-->
<!-- Windows 10 -->
<!--<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}" />-->
</application>
</compatibility>
<!-- Указывает, что приложение поддерживает определение DPI и не будет автоматически масштабироваться Windows при более высоких
значениях DPI. Приложения Windows Presentation Foundation (WPF) по умолчанию поддерживают определение DPI, им не нужно
специально включать параметр для этого. Для приложений Windows Forms на платформе .NET Framework 4.6, для которых задан этот параметр, необходимо
также задать для "EnableWindowsFormsHighDpiAutoResizing" значение "true" в файле app.config.
При этом приложение начинает учитывать длинные пути. Дополнительные сведения см. на странице https://docs.microsoft.com/windows/win32/fileio/maximum-file-path-limitation.-->
<!--
<application xmlns="urn:schemas-microsoft-com:asm.v3">
<windowsSettings>
<dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true</dpiAware>
<longPathAware xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">true</longPathAware>
</windowsSettings>
</application>
-->
<!-- Включите темы для общих элементов управления и диалоговых окон Windows (Windows XP и более поздние версии) -->
<!--
<dependency>
<dependentAssembly>
<assemblyIdentity
type="win32"
name="Microsoft.Windows.Common-Controls"
version="6.0.0.0"
processorArchitecture="*"
publicKeyToken="6595b64144ccf1df"
language="*"
/>
</dependentAssembly>
</dependency>
-->
</assembly>

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();
//Ñîçäàþ ôîðìó ñïèñêà îáíîâëåíèé
UpdatesListForm updatesListForm = new UpdatesListForm(updatesList);
UpdatesListForm updatesListForm = new(updatesList);
//Ïîêàçûâàþ å¸
DialogResult ulDialogResult = updatesListForm.ShowDialog();
@ -64,7 +64,20 @@ public sealed partial class MainForm: Form
return;
}
//
//Îñâîáîæäàþ å¸
updatesListForm.Dispose();
//Ñîçäàþ ôîðìó ñïèñêà îáíîâëåíèé
InstallForm installForm = new (updatesList, TempWorkDir);
//Ïîêàçûâàþ å¸
installForm.ShowDialog();
//Îñâîáîæäàþ å¸
installForm.Dispose();
//Î÷èùàþ êýø
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" />