This commit is contained in:
Alexander 2022-10-15 16:14:26 +03:00
parent 56b671b7bc
commit 7264e888e5
18 changed files with 1102 additions and 2 deletions

View File

@ -1,10 +1,12 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.31424.327
# 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}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@ -15,6 +17,10 @@ Global
{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
{E86E8BBF-8830-4259-9DEE-6F3EFC284443}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

2
MSOUI.sln.DotSettings Normal file
View File

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

@ -0,0 +1,17 @@
namespace msoui.Enums;
/// <summary>
/// Перечисление разрядности
/// </summary>
public enum EBits
{
/// <summary>
/// 32-разрядная версия
/// </summary>
Bit32 = 0,
/// <summary>
/// 64-разрядная версия
/// </summary>
Bit64 = 1
}

View File

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

@ -0,0 +1,18 @@
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,60 @@
<root>
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

221
msou_installer/Forms/MainForm.Designer.cs generated Normal file
View File

@ -0,0 +1,221 @@
namespace msoui.Forms;
sealed partial class MainForm
{
/// <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.contentPanel = new System.Windows.Forms.Panel();
this.viewButton = new System.Windows.Forms.Button();
this.bitsSelector64 = new System.Windows.Forms.RadioButton();
this.bitsSelector32 = new System.Windows.Forms.RadioButton();
this.dataFileSelector = new System.Windows.Forms.TextBox();
this.bitsSelectorLabel = new System.Windows.Forms.Label();
this.dataFileLabel = new System.Windows.Forms.Label();
this.titleLabel = new System.Windows.Forms.Label();
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();
this.SuspendLayout();
//
// contentPanel
//
this.contentPanel.Controls.Add(this.viewButton);
this.contentPanel.Controls.Add(this.bitsSelector64);
this.contentPanel.Controls.Add(this.bitsSelector32);
this.contentPanel.Controls.Add(this.dataFileSelector);
this.contentPanel.Controls.Add(this.bitsSelectorLabel);
this.contentPanel.Controls.Add(this.dataFileLabel);
this.contentPanel.Controls.Add(this.titleLabel);
this.contentPanel.Dock = System.Windows.Forms.DockStyle.Fill;
this.contentPanel.Location = new System.Drawing.Point(0, 0);
this.contentPanel.Name = "contentPanel";
this.contentPanel.Size = new System.Drawing.Size(684, 275);
this.contentPanel.TabIndex = 0;
//
// viewButton
//
this.viewButton.Location = new System.Drawing.Point(574, 59);
this.viewButton.Name = "viewButton";
this.viewButton.Size = new System.Drawing.Size(96, 29);
this.viewButton.TabIndex = 6;
this.viewButton.Text = "&Обзор";
this.viewButton.UseVisualStyleBackColor = true;
this.viewButton.Click += new System.EventHandler(this.viewButton_Click);
//
// bitsSelector64
//
this.bitsSelector64.AutoSize = true;
this.bitsSelector64.Cursor = System.Windows.Forms.Cursors.Hand;
this.bitsSelector64.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.bitsSelector64.Location = new System.Drawing.Point(32, 173);
this.bitsSelector64.Name = "bitsSelector64";
this.bitsSelector64.Size = new System.Drawing.Size(179, 25);
this.bitsSelector64.TabIndex = 5;
this.bitsSelector64.Text = "&64-разрядная версия";
this.bitsSelector64.UseVisualStyleBackColor = true;
//
// bitsSelector32
//
this.bitsSelector32.AutoSize = true;
this.bitsSelector32.Checked = true;
this.bitsSelector32.Cursor = System.Windows.Forms.Cursors.Hand;
this.bitsSelector32.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.bitsSelector32.Location = new System.Drawing.Point(32, 142);
this.bitsSelector32.Name = "bitsSelector32";
this.bitsSelector32.Size = new System.Drawing.Size(179, 25);
this.bitsSelector32.TabIndex = 4;
this.bitsSelector32.TabStop = true;
this.bitsSelector32.Text = "&32-разрядная версия";
this.bitsSelector32.UseVisualStyleBackColor = true;
//
// dataFileSelector
//
this.dataFileSelector.Location = new System.Drawing.Point(12, 59);
this.dataFileSelector.Name = "dataFileSelector";
this.dataFileSelector.Size = new System.Drawing.Size(556, 29);
this.dataFileSelector.TabIndex = 3;
//
// bitsSelectorLabel
//
this.bitsSelectorLabel.AutoSize = true;
this.bitsSelectorLabel.Location = new System.Drawing.Point(12, 107);
this.bitsSelectorLabel.Name = "bitsSelectorLabel";
this.bitsSelectorLabel.Size = new System.Drawing.Size(454, 21);
this.bitsSelectorLabel.TabIndex = 2;
this.bitsSelectorLabel.Text = "&Выберете разрядность установленной версии MS Office 2016:";
//
// dataFileLabel
//
this.dataFileLabel.AutoSize = true;
this.dataFileLabel.Location = new System.Drawing.Point(12, 35);
this.dataFileLabel.Name = "dataFileLabel";
this.dataFileLabel.Size = new System.Drawing.Size(270, 21);
this.dataFileLabel.TabIndex = 1;
this.dataFileLabel.Text = "&Выберете файл данных обновлений:";
this.dataFileLabel.TextAlign = System.Drawing.ContentAlignment.TopCenter;
//
// titleLabel
//
this.titleLabel.Dock = System.Windows.Forms.DockStyle.Top;
this.titleLabel.Location = new System.Drawing.Point(0, 0);
this.titleLabel.Margin = new System.Windows.Forms.Padding(5);
this.titleLabel.Name = "titleLabel";
this.titleLabel.Size = new System.Drawing.Size(684, 30);
this.titleLabel.TabIndex = 0;
this.titleLabel.Text = "Добро пожаловать в Мастер установки обновлений для Microsoft Office 2016!";
this.titleLabel.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// buttonsPanel
//
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";
this.buttonsPanel.Size = new System.Drawing.Size(684, 61);
this.buttonsPanel.TabIndex = 1;
//
// exitButton
//
this.exitButton.Location = new System.Drawing.Point(560, 13);
this.exitButton.Name = "exitButton";
this.exitButton.Size = new System.Drawing.Size(110, 33);
this.exitButton.TabIndex = 2;
this.exitButton.Text = "В&ыход";
this.exitButton.UseVisualStyleBackColor = true;
this.exitButton.Click += new System.EventHandler(this.exitButton_Click);
//
// installButton
//
this.installButton.Location = new System.Drawing.Point(444, 13);
this.installButton.Name = "installButton";
this.installButton.Size = new System.Drawing.Size(110, 33);
this.installButton.TabIndex = 1;
this.installButton.Text = "&Установить";
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";
this.dataFileDialog.Filter = "Файл данных обновлений|*.data";
this.dataFileDialog.Title = "Выберете файл данных обновлений";
//
// MainForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 21F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(684, 275);
this.ControlBox = false;
this.Controls.Add(this.buttonsPanel);
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.Margin = new System.Windows.Forms.Padding(4);
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "MainForm";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "Установка обновлений для Microsoft Office 2016";
this.Load += new System.EventHandler(this.StartForm_Load);
this.contentPanel.ResumeLayout(false);
this.contentPanel.PerformLayout();
this.buttonsPanel.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
private Panel contentPanel;
private Panel buttonsPanel;
private Button viewButton;
private RadioButton bitsSelector64;
private RadioButton bitsSelector32;
private TextBox dataFileSelector;
private Label bitsSelectorLabel;
private Label dataFileLabel;
private Label titleLabel;
private Button exitButton;
private Button installButton;
private Button settingsButton;
private OpenFileDialog dataFileDialog;
}

View File

@ -0,0 +1,90 @@
using anbs_cp;
using msoui.Enums;
using msoui.Models;
namespace msoui.Forms;
public sealed partial class MainForm: Form
{
public MainForm ()
{
TempWorkDir = $@"{LikeDelphi.IncludeTrailingBackslash(Path.GetTempPath())}msoui\";
InitializeComponent();
}
public string TempWorkDir { get; set; }
private void viewButton_Click (object sender, EventArgs e)
{
if (dataFileDialog.ShowDialog() == DialogResult.OK)
dataFileSelector.Text = dataFileDialog.FileName;
}
private void exitButton_Click (object sender, EventArgs e)
{
Application.Exit();
}
private void installButton_Click (object sender, EventArgs e)
{
//Ïðîâåðÿþ âõîäíûå ïàðàìåòðû
if (string.IsNullOrWhiteSpace(dataFileSelector.Text) || !File.Exists(dataFileSelector.Text))
{
MessageBox.Show($@"Ôàéë {dataFileSelector.Text} íå ñóùåñòâóåò!", @"Îøèáêà!", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
//Ñîçäàþ ìîäåëü ðàñïàêîâêè
UnPackModel model = new(dataFileSelector.Text, bitsSelector64.Checked ? EBits.Bit64 : EBits.Bit32, TempWorkDir);
//Ñîçäàþ ôîðìó ðàñïàêîâêè
UnPackForm unPackFrm = new(model);
//Ïîêàçûâàþ å¸
unPackFrm.ShowDialog();
//Ïîëó÷àþ ñïèñîê ôàéëîâ-îáíîâëåíèé
List<string> updatesList = unPackFrm.FileList;
//Îñâîáîæäàþ å¸
unPackFrm.Dispose();
//Ñîçäàþ ôîðìó ñïèñêà îáíîâëåíèé
UpdatesListForm updatesListForm = new UpdatesListForm(updatesList);
//Ïîêàçûâàþ å¸
DialogResult ulDialogResult = updatesListForm.ShowDialog();
//Åñëè ðåçóëüòàò -- îòìåíà
if (ulDialogResult == DialogResult.Cancel)
{
//Òî î÷èùàåì âñ¸ è âûõîäèì ê ãëàâíîìó îêíó
CleanThis(updatesList);
return;
}
//
}
private void StartForm_Load (object sender, EventArgs e)
{
if (!string.IsNullOrWhiteSpace(dataFileSelector.Text) || !File.Exists(dataFileSelector.Text))
return;
string dataFileSeek = $"{Application.StartupPath}\\msou.data";
if (File.Exists(dataFileSeek))
dataFileSelector.Text = dataFileSeek;
}
private void CleanThis(List<string> fileList)
{
//Î÷èùàþ ôàéëû
foreach (string file in fileList)
File.Delete(file);
//Óäàëÿþ âðåìåííóþ ïàïêó
Directory.Delete(TempWorkDir, true);
}
}

View File

@ -0,0 +1,63 @@
<root>
<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>
<metadata name="dataFileDialog.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
</root>

View File

@ -0,0 +1,92 @@
namespace msoui.Forms;
sealed partial class UnPackForm
{
/// <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.waitLabel = new System.Windows.Forms.Label();
this.progressBar = new System.Windows.Forms.ProgressBar();
this.startTimer = new System.Windows.Forms.Timer(this.components);
this.SuspendLayout();
//
// waitLabel
//
this.waitLabel.AccessibleRole = System.Windows.Forms.AccessibleRole.Indicator;
this.waitLabel.AutoEllipsis = true;
this.waitLabel.Dock = System.Windows.Forms.DockStyle.Top;
this.waitLabel.Location = new System.Drawing.Point(0, 0);
this.waitLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.waitLabel.Name = "waitLabel";
this.waitLabel.Size = new System.Drawing.Size(530, 45);
this.waitLabel.TabIndex = 0;
this.waitLabel.Text = "&Открытие файла данных...";
this.waitLabel.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
this.waitLabel.UseCompatibleTextRendering = true;
//
// progressBar
//
this.progressBar.Dock = System.Windows.Forms.DockStyle.Fill;
this.progressBar.Location = new System.Drawing.Point(0, 45);
this.progressBar.Margin = new System.Windows.Forms.Padding(10);
this.progressBar.Name = "progressBar";
this.progressBar.Size = new System.Drawing.Size(530, 20);
this.progressBar.Style = System.Windows.Forms.ProgressBarStyle.Continuous;
this.progressBar.TabIndex = 1;
//
// startTimer
//
this.startTimer.Interval = 1000;
this.startTimer.Tick += new System.EventHandler(this.startTimer_Tick);
//
// UnPackForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 21F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(530, 65);
this.ControlBox = false;
this.Controls.Add(this.progressBar);
this.Controls.Add(this.waitLabel);
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.Margin = new System.Windows.Forms.Padding(4);
this.MaximizeBox = false;
this.Name = "UnPackForm";
this.ShowInTaskbar = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "Пожалуйста, подождите. Идёт распаковка файла данных обновлений...";
this.Load += new System.EventHandler(this.UnPackForm_Load);
this.ResumeLayout(false);
}
#endregion
private Label waitLabel;
private ProgressBar progressBar;
private System.Windows.Forms.Timer startTimer;
}

View File

@ -0,0 +1,105 @@
using msoui.Enums;
using msoui.Models;
using SevenZipExtractor;
namespace msoui.Forms;
public sealed partial class UnPackForm: Form
{
public UnPackForm (UnPackModel model)
{
Model = model;
FileList = new();
InitializeComponent();
}
private const string MessageUnPackFile = "Распаковывается файл {0}...";
public UnPackModel Model { get; set; }
public List<string> FileList { get; set; }
private void UnPackThis()
{
//Создаю папку
Directory.CreateDirectory(Model.UnPackDir);
//Папка, которая отсеивается
string unFolderName = Model.Bits == EBits.Bit32 ? "x64" : "x32";
//Открываю архив
using ArchiveFile archiveFile = new(Model.DataFile);
//Создаю список на извлечение
List<Entry> extractList = new();
//Обхожу список и отсеиваю ненужные
foreach (Entry entry in archiveFile.Entries)
{
//Если папка
if (entry.IsFolder)
{
//то проверяем нужную разрядность
if (entry.FileName != unFolderName)
//если да, то добавляем в список для извлечения
extractList.Add(entry);
}
else
{
//если это файл, то проверяем на нахождение в нужной папке
if (entry.FileName[..3] == unFolderName)
continue;
//и добавляем в список, если нужной
extractList.Add(entry);
}
}
//Устанавливаю максимальное значение индикатора прогресса
progressBar.Maximum = extractList.Count;
//Извлекаю архив
foreach (Entry entry in extractList)
{
//Формирую имя файла назначения
string unPackFileName;
try
{
unPackFileName = entry.FileName[4..];
}
catch (Exception)
{
unPackFileName = "UnNamed";
}
//Вывожу сообщение
waitLabel.Text = string.Format(MessageUnPackFile, unPackFileName);
Application.DoEvents();
//Распаковываю файл
//entry.Extract($@"{unPackTo}{unPackFileName}");
//Добавляю в список файлов
if (File.Exists($@"{Model.UnPackDir}{unPackFileName}"))
FileList.Add(unPackFileName);
//Добавляю деление в индикатор прогресса
progressBar.Value++;
}
//Выхожу
DialogResult = DialogResult.OK;
}
private void startTimer_Tick (object sender, EventArgs e)
{
startTimer.Enabled = false;
UnPackThis();
}
private void UnPackForm_Load (object sender, EventArgs e)
{
startTimer.Enabled = true;
}
}

View File

@ -0,0 +1,63 @@
<root>
<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>
<metadata name="startTimer.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
</root>

View File

@ -0,0 +1,140 @@
namespace msoui.Forms;
sealed partial class UpdatesListForm
{
/// <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.updatesListBox = new System.Windows.Forms.CheckedListBox();
this.introLabel = new System.Windows.Forms.Label();
this.selectAllButton = new System.Windows.Forms.Button();
this.installButton = new System.Windows.Forms.Button();
this.cancelButton = new System.Windows.Forms.Button();
this.selectionStatus = new System.Windows.Forms.Label();
this.checkedUpdateTimer = new System.Windows.Forms.Timer(this.components);
this.SuspendLayout();
//
// updatesListBox
//
this.updatesListBox.FormattingEnabled = true;
this.updatesListBox.Location = new System.Drawing.Point(17, 41);
this.updatesListBox.Margin = new System.Windows.Forms.Padding(4);
this.updatesListBox.Name = "updatesListBox";
this.updatesListBox.Size = new System.Drawing.Size(607, 412);
this.updatesListBox.TabIndex = 0;
//
// introLabel
//
this.introLabel.Location = new System.Drawing.Point(15, 9);
this.introLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.introLabel.Name = "introLabel";
this.introLabel.Size = new System.Drawing.Size(421, 21);
this.introLabel.TabIndex = 1;
this.introLabel.Text = "&Выберете доступные обновленияиз списка:";
this.introLabel.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// selectAllButton
//
this.selectAllButton.Location = new System.Drawing.Point(496, 4);
this.selectAllButton.Name = "selectAllButton";
this.selectAllButton.Size = new System.Drawing.Size(128, 30);
this.selectAllButton.TabIndex = 2;
this.selectAllButton.Text = "Выбрать &всё";
this.selectAllButton.UseVisualStyleBackColor = true;
this.selectAllButton.Click += new System.EventHandler(this.selectAllButton_Click);
//
// installButton
//
this.installButton.Location = new System.Drawing.Point(496, 467);
this.installButton.Name = "installButton";
this.installButton.Size = new System.Drawing.Size(128, 41);
this.installButton.TabIndex = 3;
this.installButton.Text = "&Установить >";
this.installButton.UseVisualStyleBackColor = true;
//
// cancelButton
//
this.cancelButton.Location = new System.Drawing.Point(362, 467);
this.cancelButton.Name = "cancelButton";
this.cancelButton.Size = new System.Drawing.Size(128, 41);
this.cancelButton.TabIndex = 4;
this.cancelButton.Text = "< &Отмена";
this.cancelButton.UseVisualStyleBackColor = true;
this.cancelButton.Click += new System.EventHandler(this.button2_Click);
//
// selectionStatus
//
this.selectionStatus.AutoSize = true;
this.selectionStatus.Font = new System.Drawing.Font("Segoe UI", 11.25F, System.Drawing.FontStyle.Italic, System.Drawing.GraphicsUnit.Point);
this.selectionStatus.Location = new System.Drawing.Point(17, 457);
this.selectionStatus.Name = "selectionStatus";
this.selectionStatus.Size = new System.Drawing.Size(110, 20);
this.selectionStatus.TabIndex = 5;
this.selectionStatus.Text = "0 из 0 выбрано";
this.selectionStatus.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// checkedUpdateTimer
//
this.checkedUpdateTimer.Enabled = true;
this.checkedUpdateTimer.Tick += new System.EventHandler(this.checkedUpdateTimer_Tick);
//
// UpdatesListForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 21F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(637, 512);
this.ControlBox = false;
this.Controls.Add(this.selectionStatus);
this.Controls.Add(this.cancelButton);
this.Controls.Add(this.installButton);
this.Controls.Add(this.selectAllButton);
this.Controls.Add(this.introLabel);
this.Controls.Add(this.updatesListBox);
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 = "UpdatesListForm";
this.ShowInTaskbar = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "Список доступных обновлений";
this.Load += new System.EventHandler(this.UpdatesListForm_Load);
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private CheckedListBox updatesListBox;
private Label introLabel;
private Button selectAllButton;
private Button installButton;
private Button cancelButton;
private Label selectionStatus;
private System.Windows.Forms.Timer checkedUpdateTimer;
}

View File

@ -0,0 +1,37 @@
namespace msoui.Forms;
public sealed partial class UpdatesListForm: Form
{
public UpdatesListForm (List<string> updatesList)
{
UpdatesList = updatesList;
InitializeComponent();
}
public List<string> UpdatesList { get; set; }
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++)
updatesListBox.SetItemCheckState(index, CheckState.Checked);
}
private void UpdatesListForm_Load (object sender, EventArgs e)
{
updatesListBox.Items.Clear();
foreach (string item in UpdatesList)
updatesListBox.Items.Add(item, CheckState.Checked);
}
private void checkedUpdateTimer_Tick (object sender, EventArgs e)
{
selectionStatus.Text = string.Format(SelectionStatusLabel, updatesListBox.CheckedItems.Count, updatesListBox.Items.Count);
}
}

View File

@ -0,0 +1,63 @@
<root>
<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>
<metadata name="checkedUpdateTimer.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
</root>

View File

@ -0,0 +1,38 @@
using msoui.Enums;
namespace msoui.Models;
/// <summary>
/// Модель для распаковки
/// </summary>
public class UnPackModel
{
public UnPackModel(string dataFile, EBits bits, string unPackDir)
{
DataFile = dataFile;
Bits = bits;
UnPackDir = unPackDir;
}
public UnPackModel ()
{
DataFile = "";
Bits = EBits.Bit32;
UnPackDir = @".\";
}
/// <summary>
/// Файл-данных обновлений
/// </summary>
public string DataFile { get; set; }
/// <summary>
/// Разрядность MS Office 2016
/// </summary>
public EBits Bits { get; set; }
/// <summary>
/// Каталог распаковки
/// </summary>
public string UnPackDir { get; set; }
}

18
msou_installer/Program.cs Normal file
View File

@ -0,0 +1,18 @@
using msoui.Forms;
namespace msoui;
internal static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main ()
{
// To customize application configuration such as set high DPI settings or default font,
// see https://aka.ms/applicationconfiguration.
ApplicationConfiguration.Initialize();
Application.Run(new MainForm());
}
}

View File

@ -0,0 +1,17 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net6.0-windows</TargetFramework>
<Nullable>enable</Nullable>
<UseWindowsForms>true</UseWindowsForms>
<ImplicitUsings>enable</ImplicitUsings>
<RootNamespace>msoui</RootNamespace>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="ANBSoftware.ComponentsPack" Version="1.2022.723" />
<PackageReference Include="SevenZipExtractor" Version="1.0.17" />
</ItemGroup>
</Project>