diff --git a/ConfigCreator/Config.vb b/ConfigCreator/Config.vb index df1ba07c..bacbb3e1 100644 --- a/ConfigCreator/Config.vb +++ b/ConfigCreator/Config.vb @@ -8,6 +8,7 @@ Public OutputPath As String = "" Public TrackingLink As String = "" Public ActiveDirectoryGroup As String = "" + Public ActiveDirectoryRoot As String = "" End Class End Class diff --git a/ConfigCreator/MonoRepoUtils.vbproj b/ConfigCreator/MonoRepoUtils.vbproj index 05d766db..925add12 100644 --- a/ConfigCreator/MonoRepoUtils.vbproj +++ b/ConfigCreator/MonoRepoUtils.vbproj @@ -47,6 +47,9 @@ On + + mail.ico + @@ -154,5 +157,9 @@ + + + + \ No newline at end of file diff --git a/ConfigCreator/My Project/Resources.Designer.vb b/ConfigCreator/My Project/Resources.Designer.vb index e8e5847e..06c64bc1 100644 --- a/ConfigCreator/My Project/Resources.Designer.vb +++ b/ConfigCreator/My Project/Resources.Designer.vb @@ -89,5 +89,15 @@ Namespace My.Resources Return CType(obj,DevExpress.Utils.Svg.SvgImage) End Get End Property + + ''' + ''' Sucht eine lokalisierte Ressource vom Typ DevExpress.Utils.Svg.SvgImage. + ''' + Friend ReadOnly Property save_as() As DevExpress.Utils.Svg.SvgImage + Get + Dim obj As Object = ResourceManager.GetObject("save as", resourceCulture) + Return CType(obj,DevExpress.Utils.Svg.SvgImage) + End Get + End Property End Module End Namespace diff --git a/ConfigCreator/My Project/Resources.resx b/ConfigCreator/My Project/Resources.resx index 0ac49a57..946484ad 100644 --- a/ConfigCreator/My Project/Resources.resx +++ b/ConfigCreator/My Project/Resources.resx @@ -121,10 +121,13 @@ ..\Resources\defaultprinter.svg;DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v19.2, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a - - ..\Resources\3trafficlightsrimmed.svg;DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v19.2, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a - ..\Resources\defaultprinter1.svg;DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v19.2, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a + + ..\Resources\3trafficlightsrimmed.svg;DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v19.2, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a + + + ..\Resources\save as.svg;DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v19.2, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a + \ No newline at end of file diff --git a/ConfigCreator/Resources/save as.svg b/ConfigCreator/Resources/save as.svg new file mode 100644 index 00000000..7aa83987 --- /dev/null +++ b/ConfigCreator/Resources/save as.svg @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/ConfigCreator/frmStart.Designer.vb b/ConfigCreator/frmStart.Designer.vb index 595e80da..32bb1a9b 100644 --- a/ConfigCreator/frmStart.Designer.vb +++ b/ConfigCreator/frmStart.Designer.vb @@ -21,6 +21,7 @@ Partial Class frmStart 'Do not modify it using the code editor. Private Sub InitializeComponent() + Me.components = New System.ComponentModel.Container() Me.ComboBoxEdit1 = New DevExpress.XtraEditors.ComboBoxEdit() Me.LayoutControl1 = New DevExpress.XtraLayout.LayoutControl() Me.MemoEdit1 = New DevExpress.XtraEditors.MemoEdit() @@ -31,19 +32,21 @@ Partial Class frmStart Me.LayoutControlItem3 = New DevExpress.XtraLayout.LayoutControlItem() Me.FluentDesignFormContainer1 = New DevExpress.XtraBars.FluentDesignSystem.FluentDesignFormContainer() Me.XtraTabControl1 = New DevExpress.XtraTab.XtraTabControl() - Me.XtraTabPage1 = New DevExpress.XtraTab.XtraTabPage() Me.XtraTabPage2 = New DevExpress.XtraTab.XtraTabPage() Me.LayoutControl2 = New DevExpress.XtraLayout.LayoutControl() Me.txxTemplate = New DevExpress.XtraEditors.MemoEdit() Me.RibbonControl1 = New DevExpress.XtraBars.Ribbon.RibbonControl() Me.BarButtonItem1 = New DevExpress.XtraBars.BarButtonItem() + Me.BarButtonItem2 = New DevExpress.XtraBars.BarButtonItem() Me.RibbonPage1 = New DevExpress.XtraBars.Ribbon.RibbonPage() + Me.RibbonPageGroup1 = New DevExpress.XtraBars.Ribbon.RibbonPageGroup() Me.RibbonStatusBar1 = New DevExpress.XtraBars.Ribbon.RibbonStatusBar() Me.txtBannerUrl = New DevExpress.XtraEditors.TextEdit() Me.txtTrackingUrl = New DevExpress.XtraEditors.TextEdit() Me.txtOutputPath = New DevExpress.XtraEditors.TextEdit() Me.txtADGroup = New DevExpress.XtraEditors.TextEdit() Me.SimpleButton2 = New DevExpress.XtraEditors.SimpleButton() + Me.txtADRoot = New DevExpress.XtraEditors.TextEdit() Me.LayoutControlGroup1 = New DevExpress.XtraLayout.LayoutControlGroup() Me.LayoutControlItem4 = New DevExpress.XtraLayout.LayoutControlItem() Me.LayoutControlItem5 = New DevExpress.XtraLayout.LayoutControlItem() @@ -51,7 +54,10 @@ Partial Class frmStart Me.LayoutControlItem8 = New DevExpress.XtraLayout.LayoutControlItem() Me.LayoutControlItem7 = New DevExpress.XtraLayout.LayoutControlItem() Me.LayoutControlItem9 = New DevExpress.XtraLayout.LayoutControlItem() + Me.LayoutControlItem10 = New DevExpress.XtraLayout.LayoutControlItem() + Me.XtraTabPage1 = New DevExpress.XtraTab.XtraTabPage() Me.RibbonPage2 = New DevExpress.XtraBars.Ribbon.RibbonPage() + Me.BehaviorManager1 = New DevExpress.Utils.Behaviors.BehaviorManager(Me.components) CType(Me.ComboBoxEdit1.Properties, System.ComponentModel.ISupportInitialize).BeginInit() CType(Me.LayoutControl1, System.ComponentModel.ISupportInitialize).BeginInit() Me.LayoutControl1.SuspendLayout() @@ -63,7 +69,6 @@ Partial Class frmStart Me.FluentDesignFormContainer1.SuspendLayout() CType(Me.XtraTabControl1, System.ComponentModel.ISupportInitialize).BeginInit() Me.XtraTabControl1.SuspendLayout() - Me.XtraTabPage1.SuspendLayout() Me.XtraTabPage2.SuspendLayout() CType(Me.LayoutControl2, System.ComponentModel.ISupportInitialize).BeginInit() Me.LayoutControl2.SuspendLayout() @@ -73,6 +78,7 @@ Partial Class frmStart CType(Me.txtTrackingUrl.Properties, System.ComponentModel.ISupportInitialize).BeginInit() CType(Me.txtOutputPath.Properties, System.ComponentModel.ISupportInitialize).BeginInit() CType(Me.txtADGroup.Properties, System.ComponentModel.ISupportInitialize).BeginInit() + CType(Me.txtADRoot.Properties, System.ComponentModel.ISupportInitialize).BeginInit() CType(Me.LayoutControlGroup1, System.ComponentModel.ISupportInitialize).BeginInit() CType(Me.LayoutControlItem4, System.ComponentModel.ISupportInitialize).BeginInit() CType(Me.LayoutControlItem5, System.ComponentModel.ISupportInitialize).BeginInit() @@ -80,6 +86,9 @@ Partial Class frmStart CType(Me.LayoutControlItem8, System.ComponentModel.ISupportInitialize).BeginInit() CType(Me.LayoutControlItem7, System.ComponentModel.ISupportInitialize).BeginInit() CType(Me.LayoutControlItem9, System.ComponentModel.ISupportInitialize).BeginInit() + CType(Me.LayoutControlItem10, System.ComponentModel.ISupportInitialize).BeginInit() + Me.XtraTabPage1.SuspendLayout() + CType(Me.BehaviorManager1, System.ComponentModel.ISupportInitialize).BeginInit() Me.SuspendLayout() ' 'ComboBoxEdit1 @@ -178,17 +187,10 @@ Partial Class frmStart Me.XtraTabControl1.Dock = System.Windows.Forms.DockStyle.Fill Me.XtraTabControl1.Location = New System.Drawing.Point(0, 0) Me.XtraTabControl1.Name = "XtraTabControl1" - Me.XtraTabControl1.SelectedTabPage = Me.XtraTabPage1 + Me.XtraTabControl1.SelectedTabPage = Me.XtraTabPage2 Me.XtraTabControl1.Size = New System.Drawing.Size(1101, 414) Me.XtraTabControl1.TabIndex = 0 - Me.XtraTabControl1.TabPages.AddRange(New DevExpress.XtraTab.XtraTabPage() {Me.XtraTabPage1, Me.XtraTabPage2}) - ' - 'XtraTabPage1 - ' - Me.XtraTabPage1.Controls.Add(Me.LayoutControl1) - Me.XtraTabPage1.Name = "XtraTabPage1" - Me.XtraTabPage1.Size = New System.Drawing.Size(1099, 391) - Me.XtraTabPage1.Text = "ConfigCreator" + Me.XtraTabControl1.TabPages.AddRange(New DevExpress.XtraTab.XtraTabPage() {Me.XtraTabPage2, Me.XtraTabPage1}) ' 'XtraTabPage2 ' @@ -205,6 +207,7 @@ Partial Class frmStart Me.LayoutControl2.Controls.Add(Me.txtOutputPath) Me.LayoutControl2.Controls.Add(Me.txtADGroup) Me.LayoutControl2.Controls.Add(Me.SimpleButton2) + Me.LayoutControl2.Controls.Add(Me.txtADRoot) Me.LayoutControl2.Dock = System.Windows.Forms.DockStyle.Fill Me.LayoutControl2.Location = New System.Drawing.Point(0, 0) Me.LayoutControl2.Name = "LayoutControl2" @@ -215,19 +218,21 @@ Partial Class frmStart ' 'txxTemplate ' - Me.txxTemplate.Location = New System.Drawing.Point(135, 126) + Me.txxTemplate.Location = New System.Drawing.Point(135, 140) Me.txxTemplate.MenuManager = Me.RibbonControl1 Me.txxTemplate.Name = "txxTemplate" - Me.txxTemplate.Size = New System.Drawing.Size(944, 245) + Me.txxTemplate.Properties.Appearance.Font = New System.Drawing.Font("Consolas", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) + Me.txxTemplate.Properties.Appearance.Options.UseFont = True + Me.txxTemplate.Size = New System.Drawing.Size(944, 231) Me.txxTemplate.StyleController = Me.LayoutControl2 Me.txxTemplate.TabIndex = 4 ' 'RibbonControl1 ' Me.RibbonControl1.ExpandCollapseItem.Id = 0 - Me.RibbonControl1.Items.AddRange(New DevExpress.XtraBars.BarItem() {Me.RibbonControl1.ExpandCollapseItem, Me.RibbonControl1.SearchEditItem, Me.BarButtonItem1}) + Me.RibbonControl1.Items.AddRange(New DevExpress.XtraBars.BarItem() {Me.RibbonControl1.ExpandCollapseItem, Me.RibbonControl1.SearchEditItem, Me.BarButtonItem1, Me.BarButtonItem2}) Me.RibbonControl1.Location = New System.Drawing.Point(0, 0) - Me.RibbonControl1.MaxItemId = 2 + Me.RibbonControl1.MaxItemId = 4 Me.RibbonControl1.Name = "RibbonControl1" Me.RibbonControl1.Pages.AddRange(New DevExpress.XtraBars.Ribbon.RibbonPage() {Me.RibbonPage1}) Me.RibbonControl1.Size = New System.Drawing.Size(1101, 159) @@ -240,11 +245,25 @@ Partial Class frmStart Me.BarButtonItem1.ImageOptions.SvgImage = Global.DigitalData.GUIs.MonoRepoUtils.My.Resources.Resources.defaultprinter Me.BarButtonItem1.Name = "BarButtonItem1" ' + 'BarButtonItem2 + ' + Me.BarButtonItem2.Caption = "Speichern" + Me.BarButtonItem2.Id = 3 + Me.BarButtonItem2.ImageOptions.SvgImage = Global.DigitalData.GUIs.MonoRepoUtils.My.Resources.Resources.save_as + Me.BarButtonItem2.Name = "BarButtonItem2" + ' 'RibbonPage1 ' + Me.RibbonPage1.Groups.AddRange(New DevExpress.XtraBars.Ribbon.RibbonPageGroup() {Me.RibbonPageGroup1}) Me.RibbonPage1.Name = "RibbonPage1" Me.RibbonPage1.Text = "RibbonPage1" ' + 'RibbonPageGroup1 + ' + Me.RibbonPageGroup1.ItemLinks.Add(Me.BarButtonItem2) + Me.RibbonPageGroup1.Name = "RibbonPageGroup1" + Me.RibbonPageGroup1.Text = "Email Einstellungen" + ' 'RibbonStatusBar1 ' Me.RibbonStatusBar1.Location = New System.Drawing.Point(0, 573) @@ -300,11 +319,20 @@ Partial Class frmStart Me.SimpleButton2.TabIndex = 9 Me.SimpleButton2.Text = "Generate!" ' + 'txtADRoot + ' + Me.txtADRoot.Location = New System.Drawing.Point(135, 100) + Me.txtADRoot.MenuManager = Me.RibbonControl1 + Me.txtADRoot.Name = "txtADRoot" + Me.txtADRoot.Size = New System.Drawing.Size(361, 20) + Me.txtADRoot.StyleController = Me.LayoutControl2 + Me.txtADRoot.TabIndex = 10 + ' 'LayoutControlGroup1 ' Me.LayoutControlGroup1.EnableIndentsWithoutBorders = DevExpress.Utils.DefaultBoolean.[True] Me.LayoutControlGroup1.GroupBordersVisible = False - Me.LayoutControlGroup1.Items.AddRange(New DevExpress.XtraLayout.BaseLayoutItem() {Me.LayoutControlItem4, Me.LayoutControlItem5, Me.LayoutControlItem6, Me.LayoutControlItem8, Me.LayoutControlItem7, Me.LayoutControlItem9}) + Me.LayoutControlGroup1.Items.AddRange(New DevExpress.XtraLayout.BaseLayoutItem() {Me.LayoutControlItem4, Me.LayoutControlItem5, Me.LayoutControlItem6, Me.LayoutControlItem8, Me.LayoutControlItem7, Me.LayoutControlItem9, Me.LayoutControlItem10}) Me.LayoutControlGroup1.Name = "LayoutControlGroup1" Me.LayoutControlGroup1.Size = New System.Drawing.Size(1099, 391) Me.LayoutControlGroup1.TextVisible = False @@ -312,10 +340,10 @@ Partial Class frmStart 'LayoutControlItem4 ' Me.LayoutControlItem4.Control = Me.txxTemplate - Me.LayoutControlItem4.Location = New System.Drawing.Point(0, 106) + Me.LayoutControlItem4.Location = New System.Drawing.Point(0, 120) Me.LayoutControlItem4.Name = "LayoutControlItem4" Me.LayoutControlItem4.Padding = New DevExpress.XtraLayout.Utils.Padding(10, 10, 10, 10) - Me.LayoutControlItem4.Size = New System.Drawing.Size(1079, 265) + Me.LayoutControlItem4.Size = New System.Drawing.Size(1079, 251) Me.LayoutControlItem4.Text = "HTML Template" Me.LayoutControlItem4.TextSize = New System.Drawing.Size(112, 13) ' @@ -345,7 +373,7 @@ Partial Class frmStart Me.LayoutControlItem8.Location = New System.Drawing.Point(0, 40) Me.LayoutControlItem8.Name = "LayoutControlItem8" Me.LayoutControlItem8.Padding = New DevExpress.XtraLayout.Utils.Padding(10, 10, 10, 10) - Me.LayoutControlItem8.Size = New System.Drawing.Size(496, 66) + Me.LayoutControlItem8.Size = New System.Drawing.Size(496, 40) Me.LayoutControlItem8.Text = "ActiveDirectory Group" Me.LayoutControlItem8.TextSize = New System.Drawing.Size(112, 13) ' @@ -364,10 +392,27 @@ Partial Class frmStart Me.LayoutControlItem9.Control = Me.SimpleButton2 Me.LayoutControlItem9.Location = New System.Drawing.Point(496, 80) Me.LayoutControlItem9.Name = "LayoutControlItem9" - Me.LayoutControlItem9.Size = New System.Drawing.Size(583, 26) + Me.LayoutControlItem9.Size = New System.Drawing.Size(583, 40) Me.LayoutControlItem9.TextSize = New System.Drawing.Size(0, 0) Me.LayoutControlItem9.TextVisible = False ' + 'LayoutControlItem10 + ' + Me.LayoutControlItem10.Control = Me.txtADRoot + Me.LayoutControlItem10.Location = New System.Drawing.Point(0, 80) + Me.LayoutControlItem10.Name = "LayoutControlItem10" + Me.LayoutControlItem10.Padding = New DevExpress.XtraLayout.Utils.Padding(10, 10, 10, 10) + Me.LayoutControlItem10.Size = New System.Drawing.Size(496, 40) + Me.LayoutControlItem10.Text = "Active Directory Root" + Me.LayoutControlItem10.TextSize = New System.Drawing.Size(112, 13) + ' + 'XtraTabPage1 + ' + Me.XtraTabPage1.Controls.Add(Me.LayoutControl1) + Me.XtraTabPage1.Name = "XtraTabPage1" + Me.XtraTabPage1.Size = New System.Drawing.Size(1099, 391) + Me.XtraTabPage1.Text = "ConfigCreator" + ' 'RibbonPage2 ' Me.RibbonPage2.Name = "RibbonPage2" @@ -397,7 +442,6 @@ Partial Class frmStart Me.FluentDesignFormContainer1.ResumeLayout(False) CType(Me.XtraTabControl1, System.ComponentModel.ISupportInitialize).EndInit() Me.XtraTabControl1.ResumeLayout(False) - Me.XtraTabPage1.ResumeLayout(False) Me.XtraTabPage2.ResumeLayout(False) CType(Me.LayoutControl2, System.ComponentModel.ISupportInitialize).EndInit() Me.LayoutControl2.ResumeLayout(False) @@ -407,6 +451,7 @@ Partial Class frmStart CType(Me.txtTrackingUrl.Properties, System.ComponentModel.ISupportInitialize).EndInit() CType(Me.txtOutputPath.Properties, System.ComponentModel.ISupportInitialize).EndInit() CType(Me.txtADGroup.Properties, System.ComponentModel.ISupportInitialize).EndInit() + CType(Me.txtADRoot.Properties, System.ComponentModel.ISupportInitialize).EndInit() CType(Me.LayoutControlGroup1, System.ComponentModel.ISupportInitialize).EndInit() CType(Me.LayoutControlItem4, System.ComponentModel.ISupportInitialize).EndInit() CType(Me.LayoutControlItem5, System.ComponentModel.ISupportInitialize).EndInit() @@ -414,6 +459,9 @@ Partial Class frmStart CType(Me.LayoutControlItem8, System.ComponentModel.ISupportInitialize).EndInit() CType(Me.LayoutControlItem7, System.ComponentModel.ISupportInitialize).EndInit() CType(Me.LayoutControlItem9, System.ComponentModel.ISupportInitialize).EndInit() + CType(Me.LayoutControlItem10, System.ComponentModel.ISupportInitialize).EndInit() + Me.XtraTabPage1.ResumeLayout(False) + CType(Me.BehaviorManager1, System.ComponentModel.ISupportInitialize).EndInit() Me.ResumeLayout(False) Me.PerformLayout() @@ -450,4 +498,9 @@ Partial Class frmStart Friend WithEvents BarButtonItem1 As DevExpress.XtraBars.BarButtonItem Friend WithEvents SimpleButton2 As SimpleButton Friend WithEvents LayoutControlItem9 As DevExpress.XtraLayout.LayoutControlItem + Friend WithEvents txtADRoot As TextEdit + Friend WithEvents LayoutControlItem10 As DevExpress.XtraLayout.LayoutControlItem + Friend WithEvents BehaviorManager1 As DevExpress.Utils.Behaviors.BehaviorManager + Friend WithEvents BarButtonItem2 As DevExpress.XtraBars.BarButtonItem + Friend WithEvents RibbonPageGroup1 As DevExpress.XtraBars.Ribbon.RibbonPageGroup End Class diff --git a/ConfigCreator/frmStart.resx b/ConfigCreator/frmStart.resx index 1af7de15..c8b29d94 100644 --- a/ConfigCreator/frmStart.resx +++ b/ConfigCreator/frmStart.resx @@ -117,4 +117,7 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + 17, 17 + \ No newline at end of file diff --git a/ConfigCreator/frmStart.vb b/ConfigCreator/frmStart.vb index 27859cb1..cf5bcfcc 100644 --- a/ConfigCreator/frmStart.vb +++ b/ConfigCreator/frmStart.vb @@ -3,6 +3,7 @@ Imports System.Xml.Serialization Imports DigitalData.Modules.Config Imports DigitalData.Modules.Logging Imports DigitalData.Modules.Interfaces +Imports DigitalData.GUIs.MonoRepoUtils.Config Public Class frmStart Private Const ZUGFERD_SERVICE = "ZUGFERD_SERVICE" @@ -14,22 +15,20 @@ Public Class frmStart Private LogConfig As LogConfig Private Config As ConfigManager(Of Config) - Private ActiveDir As ActiveDirectoryInterface - Private Sub frmStart_Load(sender As Object, e As EventArgs) Handles MyBase.Load ComboBoxEdit1.Properties.Items.Clear() ComboBoxEdit1.Properties.Items.AddRange(Configs) - LogConfig = New LogConfig(LogConfig.PathType.Temp, Nothing, Nothing, "Digital Data", "Monorepo Utils") + LogConfig = New LogConfig(LogConfig.PathType.CustomPath, Application.StartupPath, Nothing, "Digital Data", "Monorepo Utils") Config = New ConfigManager(Of Config)(LogConfig, Application.CommonAppDataPath) - ActiveDir = New ActiveDirectoryInterface(LogConfig) txxTemplate.Text = Config.Config.EmailTemplate.BaseHtml txtBannerUrl.Text = Config.Config.EmailTemplate.BannerUrl txtTrackingUrl.Text = Config.Config.EmailTemplate.TrackingLink txtOutputPath.Text = Config.Config.EmailTemplate.OutputPath txtADGroup.Text = Config.Config.EmailTemplate.ActiveDirectoryGroup + txtADRoot.Text = Config.Config.EmailTemplate.ActiveDirectoryRoot End Sub Private Sub SimpleButton1_Click(sender As Object, e As EventArgs) Handles SimpleButton1.Click @@ -58,16 +57,60 @@ Public Class frmStart End Function Private Sub frmStart_FormClosing(sender As Object, e As FormClosingEventArgs) Handles MyBase.FormClosing + SaveSettings() + End Sub + + Private Sub SimpleButton2_Click(sender As Object, e As EventArgs) Handles SimpleButton2.Click + Dim ActiveDir = New ActiveDirectoryInterface(LogConfig, Config.Config.EmailTemplate.ActiveDirectoryRoot) + Dim oCustomAttributes As New List(Of AttributeMapping) From { + New AttributeMapping With {.AttributeName = "title", .FirebirdSyskey = "", .MSSQLColumn = ""} + } + Dim oUsers = ActiveDir.ListUsers(Config.Config.EmailTemplate.ActiveDirectoryGroup, oCustomAttributes) + MsgBox(oUsers.Count & " users found.", MsgBoxStyle.Information, "Yo") + + Try + For Each oUser As ADUser In oUsers + Dim oHtml As String = GenerateSignatureFileFromTemplate(oUser, Config.Config.EmailTemplate) + Dim oOutputPath = Config.Config.EmailTemplate.OutputPath + Dim oFilePath As String = Path.Combine(oOutputPath, $"Signatur-{oUser.samAccountName}.html") + + If Not Directory.Exists(oOutputPath) Then + Directory.CreateDirectory(oOutputPath) + End If + + If File.Exists(oFilePath) Then + File.Copy(oFilePath, oFilePath & "." & Now.ToString("yyyy-MM-dd")) + End If + + File.WriteAllText(oFilePath, oHtml) + Next + Catch ex As Exception + MsgBox(ex.Message, MsgBoxStyle.Exclamation, "Signature Generator") + End Try + End Sub + + Private Function GenerateSignatureFileFromTemplate(User As ADUser, EmailTemplateConfig As EmailTemplateConfig) + Dim oJobTitle = User.CustomAttributes.Where(Function(a) a.Name = "title").Single().Value + + Return EmailTemplateConfig.BaseHtml. + Replace("__FULL_NAME__", $"{User.GivenName} {User.Surname}"). + Replace("__JOB_TITLE__", oJobTitle). + Replace("__MAIL_ADDRESS__", User.Email). + Replace("__BANNER_URL__", EmailTemplateConfig.BannerUrl). + Replace("__TRACKER_URL__", EmailTemplateConfig.TrackingLink) + End Function + + Private Sub SaveSettings() Config.Config.EmailTemplate.BaseHtml = txxTemplate.Text Config.Config.EmailTemplate.BannerUrl = txtBannerUrl.Text Config.Config.EmailTemplate.TrackingLink = txtTrackingUrl.Text Config.Config.EmailTemplate.OutputPath = txtOutputPath.Text Config.Config.EmailTemplate.ActiveDirectoryGroup = txtADGroup.Text + Config.Config.EmailTemplate.ActiveDirectoryRoot = txtADRoot.Text Config.Save() End Sub - Private Sub SimpleButton2_Click(sender As Object, e As EventArgs) Handles SimpleButton2.Click - Dim oUsers = ActiveDir.ListUsers(Config.Config.EmailTemplate.ActiveDirectoryGroup) - MsgBox(oUsers.Count & " found.", MsgBoxStyle.Information, "Yo") + Private Sub BarButtonItem2_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BarButtonItem2.ItemClick + SaveSettings() End Sub End Class \ No newline at end of file diff --git a/ConfigCreator/mail.ico b/ConfigCreator/mail.ico new file mode 100644 index 00000000..ada36d34 Binary files /dev/null and b/ConfigCreator/mail.ico differ