ConfigCreator: Signature Generator

This commit is contained in:
Jonathan Jenne 2021-06-11 15:43:04 +02:00
parent 089c554ec1
commit ebef306a72
9 changed files with 162 additions and 31 deletions

View File

@ -8,6 +8,7 @@
Public OutputPath As String = ""
Public TrackingLink As String = ""
Public ActiveDirectoryGroup As String = ""
Public ActiveDirectoryRoot As String = ""
End Class
End Class

View File

@ -47,6 +47,9 @@
<PropertyGroup>
<OptionInfer>On</OptionInfer>
</PropertyGroup>
<PropertyGroup>
<ApplicationIcon>mail.ico</ApplicationIcon>
</PropertyGroup>
<ItemGroup>
<Reference Include="DevExpress.Data.v19.2, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" />
<Reference Include="DevExpress.Printing.v19.2.Core, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" />
@ -154,5 +157,9 @@
<ItemGroup>
<None Include="Resources\defaultprinter1.svg" />
</ItemGroup>
<ItemGroup>
<Content Include="mail.ico" />
<None Include="Resources\save as.svg" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.VisualBasic.targets" />
</Project>

View File

@ -89,5 +89,15 @@ Namespace My.Resources
Return CType(obj,DevExpress.Utils.Svg.SvgImage)
End Get
End Property
'''<summary>
''' Sucht eine lokalisierte Ressource vom Typ DevExpress.Utils.Svg.SvgImage.
'''</summary>
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

View File

@ -121,10 +121,13 @@
<data name="defaultprinter" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\defaultprinter.svg;DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v19.2, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a</value>
</data>
<data name="3trafficlightsrimmed" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\3trafficlightsrimmed.svg;DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v19.2, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a</value>
</data>
<data name="defaultprinter1" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\defaultprinter1.svg;DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v19.2, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a</value>
</data>
<data name="3trafficlightsrimmed" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\3trafficlightsrimmed.svg;DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v19.2, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a</value>
</data>
<data name="save as" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\save as.svg;DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v19.2, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a</value>
</data>
</root>

View File

@ -0,0 +1,11 @@
<?xml version='1.0' encoding='UTF-8'?>
<svg x="0px" y="0px" viewBox="0 0 32 32" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" enable-background="new 0 0 32 32" xml:space="preserve" id="Layer_1">
<polygon points="28,10 12,10 12,30 32,30 32,14 " opacity="0.6" />
<rect x="14" y="10" width="12" height="8" rx="0" ry="0" fill="#FFFFFF" opacity="0.7" />
<rect x="22" y="10" width="2" height="6" rx="0" ry="0" opacity="0.6" />
<rect x="14" y="20" width="14" height="8" rx="0" ry="0" fill="#FFFFFF" />
<polygon points="16,2 0,2 0,22 20,22 20,6 " fill="#377AB5" />
<rect x="2" y="12" width="14" height="8" rx="0" ry="0" fill="#FFFFFF" />
<rect x="2" y="2" width="12" height="8" rx="0" ry="0" fill="#FFFFFF" opacity="0.8" />
<rect x="10" y="2" width="2" height="6" rx="0" ry="0" fill="#377AB5" />
</svg>

View File

@ -21,6 +21,7 @@ Partial Class frmStart
'Do not modify it using the code editor.
<System.Diagnostics.DebuggerStepThrough()>
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

View File

@ -117,4 +117,7 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="BehaviorManager1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
</root>

View File

@ -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

BIN
ConfigCreator/mail.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB