diff --git a/Sharepoint/gui/spmover/Events.ps1 b/Sharepoint/gui/spmover/Events.ps1 index cfe172a..c14e15c 100644 Binary files a/Sharepoint/gui/spmover/Events.ps1 and b/Sharepoint/gui/spmover/Events.ps1 differ diff --git a/Sharepoint/gui/spmover/Functions.ps1 b/Sharepoint/gui/spmover/Functions.ps1 index 63b27ff..82e7427 100644 Binary files a/Sharepoint/gui/spmover/Functions.ps1 and b/Sharepoint/gui/spmover/Functions.ps1 differ diff --git a/Sharepoint/gui/spmover/exceptions.txt b/Sharepoint/gui/spmover/exceptions.txt new file mode 100644 index 0000000..cf10aca --- /dev/null +++ b/Sharepoint/gui/spmover/exceptions.txt @@ -0,0 +1,14 @@ +20240307 08:51:28: ForEach-Object: C:\Users\SebastienQUEROL\git.azuze.fr\ps-scripts\Sharepoint\gui\spmover\Functions.ps1:43:31 Line | 43 | $Xml.Attributes | ForEach-Object { | ~~~~~~~~~~~~~~~~ | Exception setting "Image": "Cannot convert the "System.Drawing.Bitmap" value of type "System.String" to type "System.Drawing.Image"." +20240307 09:27:01: New-Object: C:\Users\SebastienQUEROL\git.azuze.fr\ps-scripts\Sharepoint\gui\spmover\Functions.ps1:33:71 Line | 33 | … ) {$newControl = New-Object System.Windows.Forms.$($Xml.ToString())} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | Cannot find type [System.Windows.Forms.Image]: verify that the assembly containing this type is loaded. +20240307 09:28:50: New-Object: C:\Users\SebastienQUEROL\git.azuze.fr\ps-scripts\Sharepoint\gui\spmover\Functions.ps1:33:71 Line | 33 | … ) {$newControl = New-Object System.Windows.Forms.$($Xml.ToString())} | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | Cannot find type [System.Windows.Forms.Image]: verify that the assembly containing this type is loaded. +20240307 09:34:41: ForEach-Object: C:\Users\SebastienQUEROL\git.azuze.fr\ps-scripts\Sharepoint\gui\spmover\Functions.ps1:43:31 Line | 43 | $Xml.Attributes | ForEach-Object { | ~~~~~~~~~~~~~~~~ | Exception setting "Image": "Cannot convert the "System.Drawing.Bitmap" value of type "System.String" to type "System.Drawing.Image"." +20240307 09:34:53: ForEach-Object: C:\Users\SebastienQUEROL\git.azuze.fr\ps-scripts\Sharepoint\gui\spmover\Functions.ps1:43:31 Line | 43 | $Xml.Attributes | ForEach-Object { | ~~~~~~~~~~~~~~~~ | Exception setting "Image": "Cannot convert the "System.Drawing.Bitmap" value of type "System.String" to type "System.Drawing.Image"." +20240307 09:38:58: ForEach-Object: C:\Users\SebastienQUEROL\git.azuze.fr\ps-scripts\Sharepoint\gui\spmover\Functions.ps1:43:31 Line | 43 | $Xml.Attributes | ForEach-Object { | ~~~~~~~~~~~~~~~~ | Exception setting "Image": "Cannot convert the "System.Drawing.Bitmap" value of type "System.String" to type "System.Drawing.Image"." +20240307 09:40:53: ForEach-Object: C:\Users\SebastienQUEROL\git.azuze.fr\ps-scripts\Sharepoint\gui\spmover\Functions.ps1:43:31 Line | 43 | $Xml.Attributes | ForEach-Object { | ~~~~~~~~~~~~~~~~ | Exception setting "Image": "Cannot convert the "System.Drawing.Bitmap" value of type "System.String" to type "System.Drawing.Image"." +20240307 09:41:31: ForEach-Object: C:\Users\SebastienQUEROL\git.azuze.fr\ps-scripts\Sharepoint\gui\spmover\Functions.ps1:43:31 Line | 43 | $Xml.Attributes | ForEach-Object { | ~~~~~~~~~~~~~~~~ | Exception setting "Image": "Cannot convert the "System.Drawing.Image" value of type "System.String" to type "System.Drawing.Image"." +20240307 09:44:00: ForEach-Object: C:\Users\SebastienQUEROL\git.azuze.fr\ps-scripts\Sharepoint\gui\spmover\Functions.ps1:43:31 Line | 43 | $Xml.Attributes | ForEach-Object { | ~~~~~~~~~~~~~~~~ | Exception setting "Image": "Cannot convert the "System.Drawing.Bitmap" value of type "System.String" to type "System.Drawing.Image"." +20240307 09:44:41: ForEach-Object: C:\Users\SebastienQUEROL\git.azuze.fr\ps-scripts\Sharepoint\gui\spmover\Functions.ps1:43:31 Line | 43 | $Xml.Attributes | ForEach-Object { | ~~~~~~~~~~~~~~~~ | Exception setting "Image": "Cannot convert the "System.Drawing.Bitmap" value of type "System.String" to type "System.Drawing.Image"." +20240307 09:45:56: ForEach-Object: C:\Users\SebastienQUEROL\git.azuze.fr\ps-scripts\Sharepoint\gui\spmover\Functions.ps1:43:31 Line | 43 | $Xml.Attributes | ForEach-Object { | ~~~~~~~~~~~~~~~~ | Exception setting "Image": "Cannot convert the "System.Drawing.Bitmap" value of type "System.String" to type "System.Drawing.Image"." +20240307 09:47:04: ForEach-Object: C:\Users\SebastienQUEROL\git.azuze.fr\ps-scripts\Sharepoint\gui\spmover\Functions.ps1:43:31 Line | 43 | $Xml.Attributes | ForEach-Object { | ~~~~~~~~~~~~~~~~ | Exception setting "Image": "Cannot convert the "System.Drawing.Bitmap" value of type "System.String" to type "System.Drawing.Image"." +20240307 09:48:25: ForEach-Object: C:\Users\SebastienQUEROL\git.azuze.fr\ps-scripts\Sharepoint\gui\spmover\Functions.ps1:43:31 Line | 43 | $Xml.Attributes | ForEach-Object { | ~~~~~~~~~~~~~~~~ | Exception calling "Add" with "2" argument(s): "Item has already been added. Key in dictionary: 'lbl_byWho' Key being added: 'lbl_byWho'" +20240307 11:16:28: InvalidOperation: Line | 45 | $Script:refs['btn_Start'].Add_Click($eventSB['btn_Start'].Cli … | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | Cannot index into a null array. diff --git a/Sharepoint/gui/spmover/logo.png b/Sharepoint/gui/spmover/logo.png new file mode 100644 index 0000000..10e7b7d Binary files /dev/null and b/Sharepoint/gui/spmover/logo.png differ diff --git a/Sharepoint/gui/spmover/spmover1.ps1 b/Sharepoint/gui/spmover/spmover1.ps1 index c5dcc09..9073ff2 100644 --- a/Sharepoint/gui/spmover/spmover1.ps1 +++ b/Sharepoint/gui/spmover/spmover1.ps1 @@ -1,124 +1,165 @@ -<# - .NOTES - =========================================================================== - FileName: spmover1.ps1 - Author: SebastienQUEROL - Created On: 2024/03/07 - Last Updated: 2024/03/07 - Organization: - Version: v0.1 - =========================================================================== +################################################################################ +# +# Name : SharePoint Mover +# Version : 0.1 +# Author : +# Date : 07/03/2024 +# + # Generated with ConvertForm module version 2.0.0 +# PowerShell version 7.4.1 +# +# Invocation Line : Convert-Form -Path $Source -Destination $Destination -Encoding ascii -force +# Source : C:\Users\SebastienQUEROL\source\repos\sharepointmover-gui\Form1.Designer.cs +################################################################################ - .DESCRIPTION - - .DEPENDENCIES -#> - -# ScriptBlock to Execute in STA Runspace -$sbGUI = { - param($BaseDir) - - #region Environment Setup - - try { - Add-Type -AssemblyName System.Windows.Forms - Add-Type -AssemblyName System.Drawing - - - } catch {Update-ErrorLog -ErrorRecord $_ -Message "Exception encountered during Environment Setup."} - - #endregion Environment Setup - - #region Dot Sourcing of files - - $dotSourceDir = $BaseDir - - . "$($dotSourceDir)\Functions.ps1" - . "$($dotSourceDir)\Events.ps1" - - #endregion Dot Sourcing of files - - #region Form Initialization - - try { - ConvertFrom-WinFormsXML -Reference refs -Suppress -Xml @" -
-"@ - } catch {Update-ErrorLog -ErrorRecord $_ -Message "Exception encountered during Form Initialization."} - - #endregion Form Initialization - - #region Event Assignment - - try { - $Script:refs['btn_Start'].Add_Click($eventSB['btn_Start'].Click) - } catch {Update-ErrorLog -ErrorRecord $_ -Message "Exception encountered during Event Assignment."} - - #endregion Event Assignment - - #region Other Actions Before ShowDialog - - try { - Remove-Variable -Name eventSB - } catch {Update-ErrorLog -ErrorRecord $_ -Message "Exception encountered before ShowDialog."} - - #endregion Other Actions Before ShowDialog - - # Show the form - try {[void]$Script:refs['MainForm'].ShowDialog()} catch {Update-ErrorLog -ErrorRecord $_ -Message "Exception encountered unexpectedly at ShowDialog."} - - <# - #region Actions After Form Closed - - try { - - } catch {Update-ErrorLog -ErrorRecord $_ -Message "Exception encountered after Form close."} - - #endregion Actions After Form Closed - #> +function Get-ScriptDirectory +{ #Return the directory name of this script + $Invocation = (Get-Variable MyInvocation -Scope 1).Value + Split-Path $Invocation.MyCommand.Path } -#region Start Point of Execution +$ScriptPath = Get-ScriptDirectory - # Initialize STA Runspace -$rsGUI = [Management.Automation.Runspaces.RunspaceFactory]::CreateRunspace() -$rsGUI.ApartmentState = 'STA' -$rsGUI.ThreadOptions = 'ReuseThread' -$rsGUI.Open() +# Chargement des assemblies externes +Add-Type -AssemblyName System.Windows.Forms +Add-Type -AssemblyName System.Drawing - # Create the PSCommand, Load into Runspace, and BeginInvoke -$cmdGUI = [Management.Automation.PowerShell]::Create().AddScript($sbGUI).AddParameter('BaseDir',$PSScriptRoot) -$cmdGUI.RunSpace = $rsGUI -$handleGUI = $cmdGUI.BeginInvoke() +$FMain = New-Object System.Windows.Forms.Form - # Hide Console Window -Add-Type -Name Window -Namespace Console -MemberDefinition ' -[DllImport("Kernel32.dll")] -public static extern IntPtr GetConsoleWindow(); +$components = New-Object System.ComponentModel.Container +$menuStrip1 = New-Object System.Windows.Forms.MenuStrip +$Mconnexion = New-Object System.Windows.Forms.ToolStripMenuItem +$MConnexionSharepoint = New-Object System.Windows.Forms.ToolStripMenuItem +$Mquestion = New-Object System.Windows.Forms.ToolStripMenuItem +$MQuestionApropos = New-Object System.Windows.Forms.ToolStripMenuItem +$MQuestionWiki = New-Object System.Windows.Forms.ToolStripMenuItem +$Bgo = New-Object System.Windows.Forms.Button +$comboBox1 = New-Object System.Windows.Forms.ComboBox +$comboBox2 = New-Object System.Windows.Forms.ComboBox +$progressBar1 = New-Object System.Windows.Forms.ProgressBar +$sourceInfo = New-Object System.Windows.Forms.ToolTip($components) +$label1 = New-Object System.Windows.Forms.Label +$label2 = New-Object System.Windows.Forms.Label +# +# menuStrip1 +# +$menuStrip1.Items.AddRange(@( +$Mconnexion, +$Mquestion)) +$menuStrip1.Location = New-Object System.Drawing.Point(0, 0) +$menuStrip1.Name = "menuStrip1" +$menuStrip1.Size = New-Object System.Drawing.Size(800, 24) +$menuStrip1.TabIndex = 0 +$menuStrip1.Text = "menuStrip1" +# +# Mconnexion +# +$Mconnexion.DropDownItems.AddRange(@( +$MConnexionSharepoint)) +$Mconnexion.Name = "Mconnexion" +$Mconnexion.Size = New-Object System.Drawing.Size(77, 20) +$Mconnexion.Text = "Connexion" +# +# MConnexionSharepoint +# +$MConnexionSharepoint.CheckOnClick = $true +$MConnexionSharepoint.Name = "MConnexionSharepoint" +$MConnexionSharepoint.Size = New-Object System.Drawing.Size(131, 22) +$MConnexionSharepoint.Text = "Sharepoint" +# +# Mquestion +# +$Mquestion.DropDownItems.AddRange(@( +$MQuestionApropos, +$MQuestionWiki)) +$Mquestion.Name = "Mquestion" +$Mquestion.Size = New-Object System.Drawing.Size(24, 20) +$Mquestion.Text = "?" +# +# MQuestionApropos +# +$MQuestionApropos.Name = "MQuestionApropos" +$MQuestionApropos.Size = New-Object System.Drawing.Size(131, 22) +$MQuestionApropos.Text = "A propos..." +# +# MQuestionWiki +# +$MQuestionWiki.Name = "MQuestionWiki" +$MQuestionWiki.Size = New-Object System.Drawing.Size(131, 22) +$MQuestionWiki.Text = "Wiki" +# +# Bgo +# +$Bgo.ForeColor = [System.Drawing.Color]::White +$Bgo.Location = New-Object System.Drawing.Point(688, 155) +$Bgo.Name = "Bgo" +$Bgo.Size = New-Object System.Drawing.Size(75, 23) +$Bgo.TabIndex = 1 +$Bgo.Text = "GO" +$Bgo.UseVisualStyleBackColor = $true +# +# comboBox1 +# +$comboBox1.ForeColor = [System.Drawing.Color]::White +$comboBox1.FormattingEnabled = $true +$comboBox1.Location = New-Object System.Drawing.Point(27, 131) +$comboBox1.Name = "comboBox1" +$comboBox1.Size = New-Object System.Drawing.Size(587, 21) +$comboBox1.TabIndex = 2 +# +# comboBox2 +# +$comboBox2.ForeColor = [System.Drawing.Color]::White +$comboBox2.FormattingEnabled = $true +$comboBox2.Location = New-Object System.Drawing.Point(27, 182) +$comboBox2.Name = "comboBox2" +$comboBox2.Size = New-Object System.Drawing.Size(587, 21) +$comboBox2.TabIndex = 3 +# +# progressBar1 +# +$progressBar1.Location = New-Object System.Drawing.Point(12, 345) +$progressBar1.Name = "progressBar1" +$progressBar1.Size = New-Object System.Drawing.Size(776, 23) +$progressBar1.TabIndex = 4 +# +# label1 +# +$label1.AutoSize = $true +$label1.Location = New-Object System.Drawing.Point(27, 112) +$label1.Name = "label1" +$label1.Size = New-Object System.Drawing.Size(62, 13) +$label1.TabIndex = 5 +$label1.Text = "Site Source" +# +# label2 +# +$label2.AutoSize = $true +$label2.Location = New-Object System.Drawing.Point(27, 166) +$label2.Name = "label2" +$label2.Size = New-Object System.Drawing.Size(81, 13) +$label2.TabIndex = 6 +$label2.Text = "Site Destination" +# +# FMain +# +$FMain.BackColor = [System.Drawing.SystemColors]::ControlText +$FMain.ClientSize = New-Object System.Drawing.Size(800, 450) +$FMain.Controls.Add($label2) +$FMain.Controls.Add($label1) +$FMain.Controls.Add($progressBar1) +$FMain.Controls.Add($comboBox2) +$FMain.Controls.Add($comboBox1) +$FMain.Controls.Add($Bgo) +$FMain.Controls.Add($menuStrip1) +$FMain.ForeColor = [System.Drawing.Color]::Snow +$FMain.MainMenuStrip = $menuStrip1 +$FMain.Name = "FMain" +$FMain.Text = "SharePoint Mover GUI" -[DllImport("user32.dll")] -public static extern bool ShowWindow(IntPtr hWnd, Int32 nCmdShow); -' -[Console.Window]::ShowWindow([Console.Window]::GetConsoleWindow(), 0) - #Loop Until GUI Closure -while ( $handleGUI.IsCompleted -eq $false ) {Start-Sleep -Seconds 5} - # Dispose of GUI Runspace/Command -$cmdGUI.EndInvoke($handleGUI) -$cmdGUI.Dispose() -$rsGUI.Dispose() -Exit -#endregion Start Point of Execution +$FMain.ShowDialog()