diff --git a/MicroWin/AppState.cs b/MicroWin/AppState.cs index e582d70..dd39cd5 100755 --- a/MicroWin/AppState.cs +++ b/MicroWin/AppState.cs @@ -18,6 +18,7 @@ public static class AppState /// public static bool EncodeWithB64 { get; set; } = true; public static bool AddReportingToolShortcut { get; set; } = true; + public static bool UseMSAccount { get; set; } = true; public static bool CopyUnattendToFileSystem { get; set; } public static DriverExportMode DriverExportMode { get; set; } = DriverExportMode.NoExport; public static bool UseUEFICA23Bins { get; set; } = true; diff --git a/MicroWin/MainForm.Designer.cs b/MicroWin/MainForm.Designer.cs index a5eebc2..a58760f 100755 --- a/MicroWin/MainForm.Designer.cs +++ b/MicroWin/MainForm.Designer.cs @@ -31,8 +31,11 @@ private void InitializeComponent() System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MainForm)); ButtonPanel = new Panel(); TableLayoutPanel1 = new TableLayoutPanel(); + TableLayoutPanel2 = new TableLayoutPanel(); Back_Button = new Button(); Next_Button = new Button(); + MSAcc_Button = new Button(); + Setup_Button = new Button(); Cancel_Button = new Button(); About_Button = new Button(); PageContainerPanel = new Panel(); @@ -110,6 +113,7 @@ private void InitializeComponent() isoSaverSFD = new SaveFileDialog(); ButtonPanel.SuspendLayout(); TableLayoutPanel1.SuspendLayout(); + TableLayoutPanel2.SuspendLayout(); PageContainerPanel.SuspendLayout(); IsoSettingsPage.SuspendLayout(); IsoChooserPage.SuspendLayout(); @@ -132,7 +136,7 @@ private void InitializeComponent() // ButtonPanel // ButtonPanel.Controls.Add(TableLayoutPanel1); - ButtonPanel.Controls.Add(About_Button); + ButtonPanel.Controls.Add(TableLayoutPanel2); ButtonPanel.Dock = DockStyle.Bottom; ButtonPanel.Location = new Point(0, 521); ButtonPanel.Name = "ButtonPanel"; @@ -156,6 +160,23 @@ private void InitializeComponent() TableLayoutPanel1.Size = new Size(219, 29); TableLayoutPanel1.TabIndex = 1; // + // TableLayoutPanel2 + // + TableLayoutPanel2.Anchor = AnchorStyles.Bottom | AnchorStyles.Left; + TableLayoutPanel2.ColumnCount = 3; + TableLayoutPanel2.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 25F)); + TableLayoutPanel2.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 25F)); + TableLayoutPanel2.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 25F)); + TableLayoutPanel2.Controls.Add(About_Button, 0, 0); + TableLayoutPanel2.Controls.Add(MSAcc_Button, 1, 0); + TableLayoutPanel2.Controls.Add(Setup_Button, 2, 0); + TableLayoutPanel2.Location = new Point(12, 6); + TableLayoutPanel2.Name = "TableLayoutPanel2"; + TableLayoutPanel2.RowCount = 1; + TableLayoutPanel2.RowStyles.Add(new RowStyle(SizeType.Percent, 100F)); + TableLayoutPanel2.Size = new Size(500, 29); + TableLayoutPanel2.TabIndex = 1; + // // Back_Button // Back_Button.Anchor = AnchorStyles.None; @@ -195,7 +216,7 @@ private void InitializeComponent() // // About_Button // - About_Button.Anchor = AnchorStyles.Bottom | AnchorStyles.Left; + About_Button.Anchor = AnchorStyles.None; About_Button.DialogResult = DialogResult.Cancel; About_Button.FlatStyle = FlatStyle.System; About_Button.Location = new Point(12, 9); @@ -205,6 +226,32 @@ private void InitializeComponent() About_Button.Text = "About"; About_Button.Click += About_Button_Click; // + // MSAcc_Button + // + MSAcc_Button.Anchor = AnchorStyles.None; + MSAcc_Button.DialogResult = DialogResult.Cancel; + MSAcc_Button.FlatStyle = FlatStyle.System; + MSAcc_Button.Location = new Point(85, 9); + MSAcc_Button.Name = "MSAcc_Button"; + MSAcc_Button.Size = new Size(130, 23); + MSAcc_Button.TabIndex = 1; + MSAcc_Button.Text = "Use Microsoft Account"; + MSAcc_Button.Click += MSAcc_Button_Click; + MSAcc_Button.Visible = false; + // + // Setup_Button + // + Setup_Button.Anchor = AnchorStyles.None; + Setup_Button.DialogResult = DialogResult.Cancel; + Setup_Button.FlatStyle = FlatStyle.System; + Setup_Button.Location = new Point(224, 9); + Setup_Button.Name = "Setup_Button"; + Setup_Button.Size = new Size(140, 23); + Setup_Button.TabIndex = 1; + Setup_Button.Text = "Add Users During Setup"; + Setup_Button.Click += Setup_Button_Click; + Setup_Button.Visible = false; + // // PageContainerPanel // PageContainerPanel.Controls.Add(IsoSettingsPage); @@ -1028,6 +1075,7 @@ private void InitializeComponent() SizeChanged += MainForm_SizeChanged; ButtonPanel.ResumeLayout(false); TableLayoutPanel1.ResumeLayout(false); + tableLayoutPanel2.ResumeLayout(false); PageContainerPanel.ResumeLayout(false); IsoSettingsPage.ResumeLayout(false); IsoSettingsPage.PerformLayout(); @@ -1064,6 +1112,7 @@ private void InitializeComponent() internal System.Windows.Forms.Panel ButtonPanel; internal System.Windows.Forms.TableLayoutPanel TableLayoutPanel1; + internal System.Windows.Forms.TableLayoutPanel TableLayoutPanel2; internal System.Windows.Forms.Button Back_Button; internal System.Windows.Forms.Button Next_Button; internal System.Windows.Forms.Button Cancel_Button; @@ -1139,6 +1188,8 @@ private void InitializeComponent() private System.Windows.Forms.LinkLabel lnkUseNtLite; private System.Windows.Forms.LinkLabel lnkUseDT; internal Button About_Button; + internal Button MSAcc_Button; + internal Button Setup_Button; internal Label lblFileStatus; private CheckBox UEFICA23CB; } diff --git a/MicroWin/MainForm.cs b/MicroWin/MainForm.cs index 6d8b729..080f5b2 100755 --- a/MicroWin/MainForm.cs +++ b/MicroWin/MainForm.cs @@ -120,6 +120,9 @@ private void ChangePage(WizardPage.Page newPage) Back_Button.Enabled = !(newPage == WizardPage.Page.WelcomePage) && !(newPage == WizardPage.Page.FinishPage); ButtonPanel.Visible = !(newPage == WizardPage.Page.IsoCreationPage); + MSAcc_Button.Visible = (newPage != WizardPage.Page.UserAccountsPage); + Setup_Button.Visible = (newPage != WizardPage.Page.UserAccountsPage); + Next_Button.Text = newPage == WizardPage.Page.FinishPage ? "Close" : "Next"; if (CurrentWizardPage.wizardPage == WizardPage.Page.IsoCreationPage) @@ -228,6 +231,17 @@ private void Back_Button_Click(object sender, EventArgs e) ChangePage(CurrentWizardPage.wizardPage - 1); } + private void MSAcc_Button_Click(object sender, EventArgs e) + { + // TODO: Implement use of MS Account + } + + + private void Setup_Button_Click(object sender, EventArgs e) + { + // TODO: Implement use of Setup to make accounts + } + private void isoPickerBtn_Click(object sender, EventArgs e) { @@ -420,7 +434,7 @@ private void usrPasswordRevealCB_CheckedChanged(object sender, EventArgs e) } catch { - // don't play this easter egg + // Don't play this easter egg } } usrPasswordTB.PasswordChar = usrPasswordRevealCB.Checked ? '\0' : '*'; diff --git a/MicroWin/functions/dism/UnattendGenerator.cs b/MicroWin/functions/dism/UnattendGenerator.cs index 7c20591..5ec2a68 100755 --- a/MicroWin/functions/dism/UnattendGenerator.cs +++ b/MicroWin/functions/dism/UnattendGenerator.cs @@ -90,10 +90,10 @@ public static void CreateUnattend(string destinationPath, Version? sourceVersion xml.AppendLine(" "); xml.AppendLine(" "); xml.AppendLine(" "); - xml.AppendLine(" "); - xml.AppendLine(" "); - foreach (var user in AppState.UserAccounts) + if (AppState.UserAccounts.Count > 0) { + xml.AppendLine(" "); + xml.AppendLine(" "); xml.AppendLine(" "); xml.AppendLine($" "); // Determine if we need to encode the password with base64. If we need to, we must append @@ -118,17 +118,23 @@ public static void CreateUnattend(string destinationPath, Version? sourceVersion xml.AppendLine($" {user.Name}"); xml.AppendLine($" {(user.Role == "Administrator" ? "Administrators" : "Users")}"); xml.AppendLine(" "); + xml.AppendLine(" "); + xml.AppendLine(" "); } - xml.AppendLine(" "); - xml.AppendLine(" "); xml.AppendLine(" "); xml.AppendLine(" true"); xml.AppendLine(" true"); xml.AppendLine(" true"); - xml.AppendLine(" true"); + if (AppState.UseMSAccount == true) + { + xml.AppendLine(" false"); + } + else + { + xml.AppendLine(" true"); + } xml.AppendLine(" true"); xml.AppendLine(" true"); - xml.AppendLine(" Work"); xml.AppendLine(" 3"); xml.AppendLine(" "); xml.AppendLine(" ");