This commit is contained in:
Stephan Maier
2024-08-27 08:10:27 +02:00
parent eb5c2fa502
commit 647f938eee
617 changed files with 73086 additions and 7137 deletions

View File

@@ -0,0 +1,364 @@
using Microsoft.Win32;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Threading;
using System.Windows;
using static FSI.BT.Tools.Global.Settings.Cmd;
using static FSI.BT.Tools.Global.Settings.Exe;
namespace FSI.BT.Tools.Global.Commands
{
/// <summary>
/// Shows the main window.
/// </summary>
public class CmdCommand : CommandBase<CmdCommand>
{
public override void Execute(object parameter)
{
if (parameter is not string)
{
Global.Vars.Log.Error("Parameter ist kein String");
return;
}
var cmds = Vars.GlobalSettings.Cmds.ToList();
ICmd selectedCmd = null;
switch ((string)parameter)
{
case "DarkMode":
RegistryKey key = Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\Windows\CurrentVersion\Themes\Personalize", true);
if (key.GetValue("AppsUseLightTheme") != null)
{
if (Convert.ToInt32(key.GetValue("AppsUseLightTheme")) == 0)
key.SetValue("AppsUseLightTheme", 1); //sets 'someData' in 'someValue'
else
key.SetValue("AppsUseLightTheme", 0); //sets 'someData' in 'someValue'
key.Close();
}
return;
case "Epl.Prj":
Lib.Guis.Prj.Mgt.FrmMain frmMainEplPrj = new()
{
ShowPdf = false,
CloseAtLostFocus = true,
WindowStartupLocation = WindowStartupLocation.CenterScreen,
Path = Helpers.GetFolderByName.Get(Vars.GlobalSettings.Folders, "EplPrj").path,
EplExe = GetExeByCmdName("Epl").ExePath,
};
frmMainEplPrj.Show();
return;
case "Epl.Pdf":
Lib.Guis.Prj.Mgt.FrmMain frmMainEplPdf = new()
{
ShowPdf = true,
CloseAtLostFocus = true,
WindowStartupLocation = WindowStartupLocation.CenterScreen,
Path = Helpers.GetFolderByName.Get(Vars.GlobalSettings.Folders, "EplPdf").path
};
frmMainEplPdf.Show();
return;
case "Epl.PdfMgt":
Lib.Guis.Pdf.Mgt.FrmMain frmMainEplPdfMgt = new()
{
CloseAtLostFocus = true
};
frmMainEplPdfMgt.Show();
return;
case "DeEncrypt":
Lib.Guis.DeEncryptMessage.FrmMain frmMainDeEnCrypt = new()
{
Password = AppDomain.CurrentDomain.FriendlyName,
CloseAtLostFocus = true,
WindowStartupLocation = WindowStartupLocation.CenterScreen,
};
frmMainDeEnCrypt.Show();
return;
case "StarterCsvExporter":
Lib.Guis.SieStarterCsvExporter.FrmMain frmMain = new();
frmMain.Show();
return;
case "Folder":
Lib.Guis.Folder.Mgt.FrmMain frmFolderMgtMain = new()
{
CloseAtLostFocus = true,
Data = Global.Vars.GlobalSettings.Folders
};
frmFolderMgtMain.Show();
return;
//case "TxtToClip":
// Lib.Guis.TxtToClip.Mgt.FrmMain frmTxtToClipMain = new()
// {
// CloseAtLostFocus = true,
// InputData = Global.AppSettings.TxtToClip
// };
// frmTxtToClipMain.Show();
// return;
case "Rdp.Mgt":
Lib.Guis.Rdp.Mgt.FrmMain frmRdpMain = new()
{
CloseAtLostFocus = true,
InputData = Global.Vars.GlobalSettings.Rdps,
Exe = GetExeByCmdName("Rdp").ExePath,
FrmTitle = "Remotedesktopverbindungen",
};
frmRdpMain.Show();
break;
case "WebRadio":
//Lib.Guis.WebRadio.FrmMain frmWebRadio = new()
//{
// CloseAtLostFocus = false,
// InputData = Global.AppSettings.WebRadioUrls,
//};
//frmWebRadio.Show();
break;
default:
foreach (ICmd cmd in cmds)
{
if (String.Equals(parameter.ToString(), cmd.Cmd))
selectedCmd = cmd;
}
break;
}
if (selectedCmd == null)
return;
OpenExe(selectedCmd);
OpenUrl(selectedCmd);
}
public override bool CanExecute(object parameter)
{
if (parameter == null)
return false;
var cmds = Global.Vars.GlobalSettings.Cmds.ToList();
ICmd selectedCmd = null;
switch ((string)parameter)
{
case "DarkMode":
return Vars.AdminRights;
case "Epl.Prj":
return true;
case "Epl.Pdf":
return true;
case "Epl.PdfMgt":
return Vars.AdminRights;
case "DeEncrypt":
return Vars.AdminRights;
case "StarterCsvExporter":
return Vars.AdminRights;
case "Folder":
return Vars.GlobalSettings.Folders != null;
//case "TxtToClip":
// return Vars.GlobalSettings.TxtToClip != null;
case "Rdp.Mgt":
return Vars.GlobalSettings.Rdps != null;
case "WebRadio":
return false;// Global.AppSettings.WebRadioUrls != null;
default:
foreach (ICmd cmd in cmds)
{
if (String.Equals(parameter.ToString(), cmd.Cmd))
selectedCmd = cmd;
}
break;
}
if (selectedCmd == null)
return false;
foreach (var file in selectedCmd.Exe.ToList())
{
if (File.Exists(Environment.ExpandEnvironmentVariables(file.ExePath.Trim())))
return true;
else if (File.Exists(Path.Combine(Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location), file.ExePath.Trim())))
return true;
}
foreach (var url in selectedCmd.Urls)
{
if (url != String.Empty)
return true;
}
return false;
}
private static void OpenExe(ICmd selectedCmd)
{
IExe selectedFile = GetApp(selectedCmd.Exe);
if (selectedFile == null)
return;
if (selectedFile.ExePath == String.Empty)
return;
if (ProgramIsRunning(selectedFile.ExePath))
{
ProgramToFront(selectedFile.ExePath);
Vars.Log.Info("Anwendung \"{0}\" wurde in den Vordergrund gebracht", selectedFile.ExePath);
}
else
{
var selectedFileExePath = string.Empty;
if (File.Exists(Environment.ExpandEnvironmentVariables(selectedFile.ExePath.Trim())))
selectedFileExePath = Environment.ExpandEnvironmentVariables(selectedFile.ExePath.Trim());
if (File.Exists(Path.Combine(Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location), selectedFile.ExePath.Trim())))
selectedFileExePath = Path.Combine(Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location), selectedFile.ExePath.Trim());
var abc = Path.Combine(Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location), selectedFileExePath.Trim());
Process process = new();
process.StartInfo.FileName = selectedFileExePath;
process.StartInfo.WorkingDirectory = selectedFile.Path ?? Path.GetDirectoryName(selectedFileExePath);
process.StartInfo.Arguments = selectedFile.Arguments ?? string.Empty;
try
{
process.Start();
Vars.Log.Info("Anwendung \"{0}\" wurde gestartet", selectedFile.ExePath);
}
catch (System.ComponentModel.Win32Exception ex) when (ex.NativeErrorCode == 740)
{
try
{
process.StartInfo.UseShellExecute = true;
process.StartInfo.Verb = "runas";
process.Start();
Vars.Log.Info("Anwendung \"{0}\" wurde als Admin gestartet", selectedFile.ExePath);
}
catch (Exception ex2)
{
Vars.Log.Info("Anwendung konnte durch folgenden Fehler \"{0}\" nicht gestartet werden.", ex2.Message);
}
}
}
}
private static void OpenUrl(ICmd selectedCmd)
{
foreach (var url in selectedCmd.Urls)
{
if (url == String.Empty)
return;
Process.Start(new ProcessStartInfo(url.Replace("&", "^&")) { UseShellExecute = true });
Vars.Log.Info("Link \"{0}\" wurde geföffnet.", url.Replace("&", "^&"));
Thread.Sleep(100);
}
}
private static IExe GetExeByCmdName(string cmdName)
{
foreach (var cmd in Vars.GlobalSettings.Cmds)
{
if (string.Equals(cmd.Cmd, cmdName, StringComparison.InvariantCultureIgnoreCase))
return GetApp(cmd.Exe);
}
return null;
}
private static bool ProgramIsRunning(string FullPath)
{
string FilePath = Path.GetDirectoryName(FullPath);
string FileName = Path.GetFileNameWithoutExtension(FullPath).ToLower();
bool isRunning = false;
Process[] pList = Process.GetProcessesByName(FileName);
foreach (Process p in pList)
{
if (p.MainModule.FileName.StartsWith(FilePath, StringComparison.InvariantCultureIgnoreCase))
{
isRunning = true;
break;
}
}
return isRunning;
}
private static IExe GetApp(IEnumerable<IExe> files)
{
if (files.ToList().Count == 0)
return null;
var selectedFile = files.ToList()[0];
foreach (var file in files.ToList())
{
if (File.Exists(Environment.ExpandEnvironmentVariables(file.ExePath.Trim())))
selectedFile = (IExe)file;
else
continue;
}
return selectedFile;
}
[System.Runtime.InteropServices.DllImport("User32.dll")]
private static extern bool SetForegroundWindow(IntPtr handle);
[System.Runtime.InteropServices.DllImport("User32.dll")]
private static extern bool ShowWindow(IntPtr handle, int nCmdShow);
[System.Runtime.InteropServices.DllImport("User32.dll")]
private static extern bool IsIconic(IntPtr handle);
private static void ProgramToFront(string FullPath)
{
string FilePath = Path.GetDirectoryName(FullPath);
string FileName = Path.GetFileNameWithoutExtension(FullPath).ToLower();
Process[] pList = Process.GetProcessesByName(FileName);
foreach (Process p in pList)
{
if (p.MainModule.FileName.StartsWith(FilePath, StringComparison.InvariantCultureIgnoreCase))
{
IntPtr handle = p.MainWindowHandle;
if (IsIconic(handle))
ShowWindow(handle, 9);
SetForegroundWindow(handle);
break;
}
}
}
}
}

View File

@@ -0,0 +1,153 @@
using System;
using System.ComponentModel;
using System.Windows;
using System.Windows.Input;
using System.Windows.Markup;
using System.Windows.Media;
//using Hardcodet.Wpf.TaskbarNotification;
namespace FSI.BT.Tools.Global.Commands
{
/// <summary>
/// Basic implementation of the <see cref="ICommand"/>
/// interface, which is also accessible as a markup
/// extension.
/// </summary>
public abstract class CommandBase<T> : MarkupExtension, ICommand
where T : class, ICommand, new()
{
/// <summary>
/// A singleton instance.
/// </summary>
private static T command;
/// <summary>
/// Gets a shared command instance.
/// </summary>
public override object ProvideValue(IServiceProvider serviceProvider)
{
if (command == null) command = new T();
return command;
}
/// <summary>
/// Fires when changes occur that affect whether
/// or not the command should execute.
/// </summary>
public event EventHandler CanExecuteChanged
{
add { CommandManager.RequerySuggested += value; }
remove { CommandManager.RequerySuggested -= value; }
}
/// <summary>
/// Defines the method to be called when the command is invoked.
/// </summary>
/// <param name="parameter">Data used by the command.
/// If the command does not require data to be passed,
/// this object can be set to null.
/// </param>
public abstract void Execute(object parameter);
/// <summary>
/// Defines the method that determines whether the command
/// can execute in its current state.
/// </summary>
/// <returns>
/// This default implementation always returns true.
/// </returns>
/// <param name="parameter">Data used by the command.
/// If the command does not require data to be passed,
/// this object can be set to null.
/// </param>
public virtual bool CanExecute(object parameter)
{
return !IsDesignMode;
}
public static bool IsDesignMode
{
get
{
return (bool)
DependencyPropertyDescriptor.FromProperty(DesignerProperties.IsInDesignModeProperty,
typeof(FrameworkElement))
.Metadata.DefaultValue;
}
}
///// <summary>
///// Resolves the window that owns the TaskbarIcon class.
///// </summary>
///// <param name="commandParameter"></param>
///// <returns>Window</returns>
//protected Window GetTaskbarWindow(object commandParameter)
//{
// if (IsDesignMode)
// return null;
// // get the showcase window off the taskbar icon
// var tb = commandParameter as TaskbarIcon;
// return tb == null ? null : TryFindParent<Window>(tb);
//}
#region TryFindParent helper
/// <summary>
/// Finds a parent of a given item on the visual tree.
/// </summary>
/// <typeparam name="TParent">The type of the queried item.</typeparam>
/// <param name="child">A direct or indirect child of the
/// queried item.</param>
/// <returns>The first parent item that matches the submitted
/// type parameter. If not matching item can be found, a null
/// reference is being returned.</returns>
public static TParent TryFindParent<TParent>(DependencyObject child) where TParent : DependencyObject
{
//get parent item
DependencyObject parentObject = GetParentObject(child);
//we've reached the end of the tree
if (parentObject == null) return null;
//check if the parent matches the type we're looking for
if (parentObject is TParent parent)
{
return parent;
}
//use recursion to proceed with next level
return TryFindParent<TParent>(parentObject);
}
/// <summary>
/// This method is an alternative to WPF's
/// <see cref="VisualTreeHelper.GetParent"/> method, which also
/// supports content elements. Keep in mind that for content element,
/// this method falls back to the logical tree of the element!
/// </summary>
/// <param name="child">The item to be processed.</param>
/// <returns>The submitted item's parent, if available. Otherwise
/// null.</returns>
public static DependencyObject GetParentObject(DependencyObject child)
{
if (child == null) return null;
if (child is ContentElement contentElement)
{
DependencyObject parent = ContentOperations.GetParent(contentElement);
if (parent != null) return parent;
FrameworkContentElement fce = contentElement as FrameworkContentElement;
return fce?.Parent;
}
//if it's not a ContentElement, rely on VisualTreeHelper
return VisualTreeHelper.GetParent(child);
}
#endregion
}
}

View File

@@ -0,0 +1,21 @@
using System.Windows;
namespace FSI.BT.Tools.Global.Commands
{
/// <summary>
/// Shows the main window.
/// </summary>
public class ExitCommand : CommandBase<ExitCommand>
{
public override void Execute(object parameter)
{
Vars.Log.Info("Anwendung wurde beendet!");
Application.Current.Shutdown();
}
public override bool CanExecute(object parameter)
{
return true;
}
}
}

View File

@@ -0,0 +1,37 @@
using System.Windows;
namespace FSI.BT.Tools.Global.Commands
{
/// <summary>
/// Shows the main window.
/// </summary>
public class LoginCommand : CommandBase<LoginCommand>
{
public override void Execute(object parameter)
{
Lib.Guis.AutoPw.FrmMain frmMain = new Lib.Guis.AutoPw.FrmMain()
{
CloseAtLostFocus = false,
WindowStartupLocation = WindowStartupLocation.CenterScreen,
};
frmMain.ShowDialog();
Global.Vars.UserRights =
Vars.AdminRights = frmMain.PwOk;
if (frmMain.PwOk)
{
Vars.Log.Info("Admin-Passowrt wurde korrekt eingegben.");
}
else
{
Vars.Log.Info("Anmeldung wurde vom Benutzer abgebrochen.");
}
}
public override bool CanExecute(object parameter)
{
return true;
}
}
}

View File

@@ -0,0 +1,24 @@
namespace FSI.BT.Tools.Global.Commands
{
/// <summary>
/// Shows the main window.
/// </summary>
public class ProcessCommand : CommandBase<ProcessCommand>
{
public override void Execute(object parameter)
{
RadialMenu.UserInterface.FrmProcesses frm = new RadialMenu.UserInterface.FrmProcesses()
{
WinCC = Vars.WinCC
};
frm.Iba = Vars.Iba;
frm.ShowDialog();
}
public override bool CanExecute(object parameter)
{
return Vars.AdminRights;
}
}
}

View File

@@ -0,0 +1,68 @@
// <copyright file="BringWindowToTop.cs" company="PlaceholderCompany">
// Copyright (c) PlaceholderCompany. All rights reserved.
// </copyright>
namespace FSI.BT.Tools.Global.DllImports
{
using System;
using System.Runtime.InteropServices;
/// <summary>
/// wraps the methodcalls to native windows dll's.
/// </summary>
public static partial class NativeMethods
{
private const int SwRestore = 9;
public static void ForceForegroundWindow(IntPtr hWnd)
{
uint foreThread = GetWindowThreadProcessId(GetForegroundWindow(), IntPtr.Zero);
uint appThread = GetCurrentThreadId();
const int SW_SHOW = 5;
int cmdShow = SW_SHOW;
if (IsIconic(hWnd))
{
cmdShow = SwRestore;
}
if (foreThread != appThread)
{
AttachThreadInput(foreThread, appThread, true);
BringWindowToTop(hWnd);
ShowWindow(hWnd, cmdShow);
AttachThreadInput(foreThread, appThread, false);
}
else
{
BringWindowToTop(hWnd);
ShowWindow(hWnd, cmdShow);
}
}
[DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Unicode)]
[DefaultDllImportSearchPaths(DllImportSearchPath.UserDirectories)]
private static extern bool IsIconic(IntPtr hWnd);
[DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Unicode)]
[DefaultDllImportSearchPaths(DllImportSearchPath.UserDirectories)]
private static extern IntPtr GetForegroundWindow();
[DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Unicode)]
[DefaultDllImportSearchPaths(DllImportSearchPath.UserDirectories)]
private static extern uint GetWindowThreadProcessId(IntPtr hWnd, IntPtr processId);
[DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Unicode)]
[DefaultDllImportSearchPaths(DllImportSearchPath.UserDirectories)]
private static extern uint GetCurrentThreadId();
[DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Unicode)]
[DefaultDllImportSearchPaths(DllImportSearchPath.UserDirectories)]
private static extern bool AttachThreadInput(uint idAttach, uint idAttachTo, bool fAttach);
[DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Unicode)]
[DefaultDllImportSearchPaths(DllImportSearchPath.UserDirectories)]
private static extern bool BringWindowToTop(IntPtr hWnd);
}
}

View File

@@ -0,0 +1,25 @@
// <copyright file="CreatePopupMenu.cs" company="PlaceholderCompany">
// Copyright (c) PlaceholderCompany. All rights reserved.
// </copyright>
namespace FSI.BT.Tools.Global.DllImports
{
using System;
using System.Runtime.InteropServices;
/// <summary>
/// wraps the methodcalls to native windows dll's.
/// </summary>
public static partial class NativeMethods
{
public static IntPtr User32CreatePopupMenu()
{
return CreatePopupMenu();
}
// The CreatePopupMenu function creates a drop-down menu, submenu, or shortcut menu. The menu is initially empty. You can insert or append menu items by using the InsertMenuItem function. You can also use the InsertMenu function to insert menu items and the AppendMenu function to append menu items.
[DllImport("user32", SetLastError = true, CharSet = CharSet.Unicode)]
[DefaultDllImportSearchPaths(DllImportSearchPath.UserDirectories)]
private static extern IntPtr CreatePopupMenu();
}
}

View File

@@ -0,0 +1,40 @@
// <copyright file="CreateRoundRectRgn.cs" company="PlaceholderCompany">
// Copyright (c) PlaceholderCompany. All rights reserved.
// </copyright>
namespace FSI.BT.Tools.Global.DllImports
{
using System;
using System.Runtime.InteropServices;
/// <summary>
/// wraps the methodcalls to native windows dll's.
/// </summary>
public static partial class NativeMethods
{
public static bool GetRegionRoundCorners(int width, int height, int widthEllipse, int heightEllipse, out System.Drawing.Region region)
{
bool success = false;
region = null;
IntPtr handle = CreateRoundRectRgn(0, 0, width, height, widthEllipse, heightEllipse);
if (handle != IntPtr.Zero)
{
region = System.Drawing.Region.FromHrgn(handle);
_ = DeleteObject(handle);
success = true;
}
return success;
}
[DllImport("Gdi32.dll", EntryPoint = "CreateRoundRectRgn", SetLastError = true, CharSet = CharSet.Unicode)]
private static extern IntPtr CreateRoundRectRgn(
int nLeftRect, // x-coordinate of upper-left corner
int nTopRect, // y-coordinate of upper-left corner
int nRightRect, // x-coordinate of lower-right corner
int nBottomRect, // y-coordinate of lower-right corner
int nWidthEllipse, // width of ellipse
int nHeightEllipse); // height of ellipse
}
}

View File

@@ -0,0 +1,19 @@
// <copyright file="DeleteObject.cs" company="PlaceholderCompany">
// Copyright (c) PlaceholderCompany. All rights reserved.
// </copyright>
namespace FSI.BT.Tools.Global.DllImports
{
using System;
using System.Runtime.InteropServices;
/// <summary>
/// wraps the methodcalls to native windows dll's.
/// </summary>
public static partial class NativeMethods
{
[DllImport("gdi32.dll", SetLastError = true, CharSet = CharSet.Unicode)]
[DefaultDllImportSearchPaths(DllImportSearchPath.UserDirectories)]
private static extern int DeleteObject(IntPtr hIcon);
}
}

View File

@@ -0,0 +1,24 @@
// <copyright file="DestroyIcon.cs" company="PlaceholderCompany">
// Copyright (c) PlaceholderCompany. All rights reserved.
// </copyright>
namespace FSI.BT.Tools.Global.DllImports
{
using System;
using System.Runtime.InteropServices;
/// <summary>
/// wraps the methodcalls to native windows dll's.
/// </summary>
public static partial class NativeMethods
{
public static void User32DestroyIcon(IntPtr hIcon)
{
_ = DestroyIcon(hIcon);
}
[DllImport("User32.dll", SetLastError = true, CharSet = CharSet.Unicode)]
[DefaultDllImportSearchPaths(DllImportSearchPath.UserDirectories)]
private static extern int DestroyIcon(IntPtr hIcon);
}
}

View File

@@ -0,0 +1,25 @@
// <copyright file="DestroyMenu.cs" company="PlaceholderCompany">
// Copyright (c) PlaceholderCompany. All rights reserved.
// </copyright>
namespace FSI.BT.Tools.Global.DllImports
{
using System;
using System.Runtime.InteropServices;
/// <summary>
/// wraps the methodcalls to native windows dll's.
/// </summary>
public static partial class NativeMethods
{
public static bool User32DestroyMenu(IntPtr hMenu)
{
return DestroyMenu(hMenu);
}
// The DestroyMenu function destroys the specified menu and frees any memory that the menu occupies.
[DllImport("user32", SetLastError = true, CharSet = CharSet.Unicode)]
[DefaultDllImportSearchPaths(DllImportSearchPath.UserDirectories)]
private static extern bool DestroyMenu(IntPtr hMenu);
}
}

View File

@@ -0,0 +1,24 @@
// <copyright file="FindExecuteable.cs" company="PlaceholderCompany">
// Copyright (c) PlaceholderCompany. All rights reserved.
// </copyright>
namespace FSI.BT.Tools.Global.DllImports
{
using System.Runtime.InteropServices;
using System.Text;
/// <summary>
/// wraps the methodcalls to native windows dll's.
/// </summary>
public static partial class NativeMethods
{
public static void Shell32FindExecutable(string lpFile, string lpDirectory, [Out] StringBuilder lpResult)
{
_ = FindExecutable(lpFile, lpDirectory, lpResult);
}
[DllImport("shell32.dll", SetLastError = true, CharSet = CharSet.Unicode)]
[DefaultDllImportSearchPaths(DllImportSearchPath.UserDirectories)]
private static extern int FindExecutable(string lpFile, string lpDirectory, [Out] StringBuilder lpResult);
}
}

View File

@@ -0,0 +1,24 @@
// <copyright file="FindWindow.cs" company="PlaceholderCompany">
// Copyright (c) PlaceholderCompany. All rights reserved.
// </copyright>
namespace FSI.BT.Tools.Global.DllImports
{
using System;
using System.Runtime.InteropServices;
/// <summary>
/// wraps the methodcalls to native windows dll's.
/// </summary>
public static partial class NativeMethods
{
public static IntPtr User32FindWindow(string lpClassName, string lpWindowName)
{
return FindWindow(lpClassName, lpWindowName);
}
[DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Unicode)]
[DefaultDllImportSearchPaths(DllImportSearchPath.UserDirectories)]
private static extern IntPtr FindWindow(string lpClassName, string lpWindowName);
}
}

View File

@@ -0,0 +1,39 @@
// <copyright file="GetIcon.cs" company="PlaceholderCompany">
// Copyright (c) PlaceholderCompany. All rights reserved.
// </copyright>
namespace FSI.BT.Tools.Global.DllImports
{
using System;
using System.Runtime.InteropServices;
/// <summary>
/// wraps the methodcalls to native windows dll's.
/// </summary>
public static partial class NativeMethods
{
public const uint ShgfiIcon = 0x000000100; // get icon
public const uint ShgfiSYSICONINDEX = 0x000004000; // get system icon index
public const uint ShgfiLINKOVERLAY = 0x000008000; // put a link overlay on icon
public const uint ShgfiLARGEICON = 0x000000000; // get large icon
public const uint ShgfiSMALLICON = 0x000000001; // get small icon
public const uint ShgfiOPENICON = 0x000000002; // get open icon
public const uint FileAttributeDirectory = 0x00000010;
public const uint FileAttributeNormal = 0x00000080;
public const int IldTransparent = 0x00000001;
/// <summary>
/// comctl32 ImageList_GetIcon(IntPtr himl, int i, int flags).
/// </summary>
/// <param name="himl">himl.</param>
/// <param name="i">i.</param>
/// <param name="flags">flags.</param>
/// <returns>IntPtr.</returns>
[DllImport("comctl32", SetLastError = true, CharSet = CharSet.Unicode)]
[DefaultDllImportSearchPaths(DllImportSearchPath.UserDirectories)]
internal static extern IntPtr ImageList_GetIcon(
IntPtr himl,
int i,
int flags);
}
}

View File

@@ -0,0 +1,26 @@
// <copyright file="IsTouchEnabled.cs" company="PlaceholderCompany">
// Copyright (c) PlaceholderCompany. All rights reserved.
// </copyright>
namespace FSI.BT.Tools.Global.DllImports
{
using System.Runtime.InteropServices;
/// <summary>
/// wraps the methodcalls to native windows dll's.
/// </summary>
public static partial class NativeMethods
{
public static bool IsTouchEnabled()
{
const int MAXTOUCHES_INDEX = 95;
int maxTouches = GetSystemMetrics(MAXTOUCHES_INDEX);
return maxTouches > 0;
}
[DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Unicode)]
[DefaultDllImportSearchPaths(DllImportSearchPath.UserDirectories)]
private static extern int GetSystemMetrics(int nIndex);
}
}

View File

@@ -0,0 +1,54 @@
// <copyright file="RegisterHotKey.cs" company="PlaceholderCompany">
// Copyright (c) PlaceholderCompany. All rights reserved.
// </copyright>
namespace FSI.BT.Tools.Global.DllImports
{
using System;
using System.Runtime.InteropServices;
using System.Text;
/// <summary>
/// wraps the methodcalls to native windows dll's.
/// </summary>
public static partial class NativeMethods
{
public static bool User32RegisterHotKey(IntPtr hWnd, int id, uint fsModifiers, uint vk)
{
return RegisterHotKey(hWnd, id, fsModifiers, vk);
}
public static bool User32UnregisterHotKey(IntPtr hWnd, int id)
{
return UnregisterHotKey(hWnd, id);
}
public static uint User32MapVirtualKey(uint uCode, uint uMapType)
{
return MapVirtualKey(uCode, uMapType);
}
public static int User32GetKeyNameText(uint lParam, [Out] StringBuilder lpString, int nSize)
{
return GetKeyNameText(lParam, lpString, nSize);
}
[DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Unicode)]
[DefaultDllImportSearchPaths(DllImportSearchPath.UserDirectories)]
[return: MarshalAs(UnmanagedType.Bool)]
private static extern bool RegisterHotKey(IntPtr hWnd, int id, uint fsModifiers, uint virtualKeyCode);
[DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Unicode)]
[return: MarshalAs(UnmanagedType.Bool)]
[DefaultDllImportSearchPaths(DllImportSearchPath.UserDirectories)]
private static extern bool UnregisterHotKey(IntPtr hWnd, int id);
[DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Unicode)]
[DefaultDllImportSearchPaths(DllImportSearchPath.UserDirectories)]
private static extern uint MapVirtualKey(uint uCode, uint uMapType);
[DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Unicode)]
[DefaultDllImportSearchPaths(DllImportSearchPath.UserDirectories)]
private static extern int GetKeyNameText(uint lParam, [Out] StringBuilder lpString, int nSize);
}
}

View File

@@ -0,0 +1,73 @@
// <copyright file="SHAppBarMessage.cs" company="PlaceholderCompany">
// Copyright (c) PlaceholderCompany. All rights reserved.
// </copyright>
namespace FSI.BT.Tools.Global.DllImports
{
using System;
using System.Runtime.InteropServices;
/// <summary>
/// wraps the methodcalls to native windows dll's.
/// </summary>
public static partial class NativeMethods
{
internal enum ABM : uint
{
New = 0x00000000,
Remove = 0x00000001,
QueryPos = 0x00000002,
SetPos = 0x00000003,
GetState = 0x00000004,
GetTaskbarPos = 0x00000005,
Activate = 0x00000006,
GetAutoHideBar = 0x00000007,
SetAutoHideBar = 0x00000008,
WindowPosChanged = 0x00000009,
SetState = 0x0000000A,
}
internal enum ABE : uint
{
Left = 0,
Top = 1,
Right = 2,
Bottom = 3,
}
internal static IntPtr Shell32SHAppBarMessage(ABM dwMessage, [In] ref APPBARDATA pData)
{
return SHAppBarMessage(dwMessage, ref pData);
}
[DllImport("shell32.dll", SetLastError = true, CharSet = CharSet.Unicode)]
[DefaultDllImportSearchPaths(DllImportSearchPath.UserDirectories)]
private static extern IntPtr SHAppBarMessage(ABM dwMessage, [In] ref APPBARDATA pData);
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
internal struct APPBARDATA
{
public uint cbSize;
public IntPtr hWnd;
public uint uCallbackMessage;
public ABE uEdge;
public RECT rc;
public int lParam;
}
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
internal struct RECT
{
public int left;
public int top;
public int right;
public int bottom;
}
internal static class ABS
{
public const int Autohide = 0x0000001;
public const int AlwaysOnTop = 0x0000002;
}
}
}

View File

@@ -0,0 +1,25 @@
// <copyright file="SHGetDesktopFolder.cs" company="PlaceholderCompany">
// Copyright (c) PlaceholderCompany. All rights reserved.
// </copyright>
namespace FSI.BT.Tools.Global.DllImports
{
using System;
using System.Runtime.InteropServices;
/// <summary>
/// wraps the methodcalls to native windows dll's.
/// </summary>
public static partial class NativeMethods
{
public static int Shell32SHGetDesktopFolder(out IntPtr ppshf)
{
return SHGetDesktopFolder(out ppshf);
}
// Retrieves the IShellFolder interface for the desktop folder, which is the root of the Shell's namespace.
[DllImport("shell32.dll", SetLastError = true, CharSet = CharSet.Unicode)]
[DefaultDllImportSearchPaths(DllImportSearchPath.UserDirectories)]
private static extern int SHGetDesktopFolder(out IntPtr ppshf);
}
}

View File

@@ -0,0 +1,55 @@
// <copyright file="SHGetFileInfo.cs" company="PlaceholderCompany">
// Copyright (c) PlaceholderCompany. All rights reserved.
// </copyright>
namespace FSI.BT.Tools.Global.DllImports
{
using System;
using System.Runtime.InteropServices;
/// <summary>
/// wraps the methodcalls to native windows dll's.
/// </summary>
public static partial class NativeMethods
{
private const int maxPath = 256;
internal static IntPtr Shell32SHGetFileInfo(
string pszPath,
uint dwFileAttributes,
ref SHFILEINFO psfi,
uint cbFileInfo,
uint uFlags)
{
return SHGetFileInfo(
pszPath,
dwFileAttributes,
ref psfi,
cbFileInfo,
uFlags);
}
[DllImport("Shell32.dll", SetLastError = true, CharSet = CharSet.Unicode)]
[DefaultDllImportSearchPaths(DllImportSearchPath.UserDirectories)]
private static extern IntPtr SHGetFileInfo(
string pszPath,
uint dwFileAttributes,
ref SHFILEINFO psfi,
uint cbFileInfo,
uint uFlags);
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
internal struct SHFILEINFO
{
public const int NAMESIZE = 80;
public IntPtr hIcon;
public int iIcon;
public uint dwAttributes;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = maxPath)]
public string szDisplayName;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = NAMESIZE)]
public string szTypeName;
}
}
}

View File

@@ -0,0 +1,25 @@
// <copyright file="SHGetFolderPath.cs" company="PlaceholderCompany">
// Copyright (c) PlaceholderCompany. All rights reserved.
// </copyright>
namespace FSI.BT.Tools.Global.DllImports
{
using System;
using System.Runtime.InteropServices;
using System.Text;
/// <summary>
/// wraps the methodcalls to native windows dll's.
/// </summary>
public static partial class NativeMethods
{
public static int ShfolderSHGetFolderPath(IntPtr hwndOwner, int nFolder, IntPtr hToken, int dwFlags, StringBuilder lpszPath)
{
return SHGetFolderPath(hwndOwner, nFolder, hToken, dwFlags, lpszPath);
}
[DllImport("shfolder.dll", SetLastError = true, CharSet = CharSet.Unicode)]
[DefaultDllImportSearchPaths(DllImportSearchPath.UserDirectories)]
private static extern int SHGetFolderPath(IntPtr hwndOwner, int nFolder, IntPtr hToken, int dwFlags, StringBuilder lpszPath);
}
}

View File

@@ -0,0 +1,46 @@
// <copyright file="ShowInactiveTopmost.cs" company="PlaceholderCompany">
// Copyright (c) PlaceholderCompany. All rights reserved.
// </copyright>
namespace FSI.BT.Tools.Global.DllImports
{
using System.Runtime.InteropServices;
using System.Windows.Forms;
/// <summary>
/// wraps the methodcalls to native windows dll's.
/// </summary>
public static partial class NativeMethods
{
private const int SW_SHOWNOACTIVATE = 4;
private const int HWND_TOPMOST = -1;
private const uint SWP_NOACTIVATE = 0x0010;
public static void User32ShowInactiveTopmost(Form form)
{
if (form != null)
{
_ = ShowWindow(form.Handle, SW_SHOWNOACTIVATE);
SetWindowPos(
form.Handle.ToInt32(),
HWND_TOPMOST,
form.Left,
form.Top,
form.Width,
form.Height,
SWP_NOACTIVATE);
}
}
[DllImport("user32.dll", EntryPoint = "SetWindowPos", SetLastError = true, CharSet = CharSet.Unicode)]
[DefaultDllImportSearchPaths(DllImportSearchPath.UserDirectories)]
private static extern bool SetWindowPos(
int hWnd, // Window handle
int hWndInsertAfter, // Placement-order handle
int X, // Horizontal position
int Y, // Vertical position
int cx, // Width
int cy, // Height
uint uFlags); // Window positioning flags
}
}

View File

@@ -0,0 +1,19 @@
// <copyright file="ShowWindow.cs" company="PlaceholderCompany">
// Copyright (c) PlaceholderCompany. All rights reserved.
// </copyright>
namespace FSI.BT.Tools.Global.DllImports
{
using System;
using System.Runtime.InteropServices;
/// <summary>
/// wraps the methodcalls to native windows dll's.
/// </summary>
public static partial class NativeMethods
{
[DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Unicode)]
[DefaultDllImportSearchPaths(DllImportSearchPath.UserDirectories)]
private static extern bool ShowWindow(IntPtr hWnd, int nCmdShow);
}
}

View File

@@ -0,0 +1,23 @@
// <copyright file="StrCmpLogicalW.cs" company="PlaceholderCompany">
// Copyright (c) PlaceholderCompany. All rights reserved.
// </copyright>
namespace FSI.BT.Tools.Global.DllImports
{
using System.Runtime.InteropServices;
/// <summary>
/// wraps the methodcalls to native windows dll's.
/// </summary>
public static partial class NativeMethods
{
public static int ShlwapiStrCmpLogicalW(string x, string y)
{
return StrCmpLogicalW(x, y);
}
[DllImport("shlwapi.dll", ExactSpelling = true, SetLastError = true, CharSet = CharSet.Unicode)]
[DefaultDllImportSearchPaths(DllImportSearchPath.UserDirectories)]
private static extern int StrCmpLogicalW(string x, string y);
}
}

View File

@@ -0,0 +1,26 @@
// <copyright file="StrRetToBuf.cs" company="PlaceholderCompany">
// Copyright (c) PlaceholderCompany. All rights reserved.
// </copyright>
namespace FSI.BT.Tools.Global.DllImports
{
using System;
using System.Runtime.InteropServices;
using System.Text;
/// <summary>
/// wraps the methodcalls to native windows dll's.
/// </summary>
public static partial class NativeMethods
{
public static int ShlwapiStrRetToBuf(IntPtr pstr, IntPtr pidl, StringBuilder pszBuf, int cchBuf)
{
return StrRetToBuf(pstr, pidl, pszBuf, cchBuf);
}
// Takes a STRRET structure returned by IShellFolder::GetDisplayNameOf, converts it to a string, and places the result in a buffer.
[DllImport("shlwapi.dll", EntryPoint = "StrRetToBuf", ExactSpelling = false, SetLastError = true, CharSet = CharSet.Unicode)]
[DefaultDllImportSearchPaths(DllImportSearchPath.UserDirectories)]
private static extern int StrRetToBuf(IntPtr pstr, IntPtr pidl, StringBuilder pszBuf, int cchBuf);
}
}

View File

@@ -0,0 +1,59 @@
// <copyright file="TrackPopupMenuEx.cs" company="PlaceholderCompany">
// Copyright (c) PlaceholderCompany. All rights reserved.
// </copyright>
namespace FSI.BT.Tools.Global.DllImports
{
using System;
using System.Runtime.InteropServices;
/// <summary>
/// wraps the methodcalls to native windows dll's.
/// </summary>
public static partial class NativeMethods
{
/// <summary>
/// Specifies how TrackPopupMenuEx positions the shortcut menu horizontally.
/// </summary>
[Flags]
internal enum TPM : uint
{
LEFTBUTTON = 0x0000, // LEFTALIGN = 0x0000, // TOPALIGN = 0x0000, // HORIZONTAL = 0x0000,
RIGHTBUTTON = 0x0002,
CENTERALIGN = 0x0004,
RIGHTALIGN = 0x0008,
VCENTERALIGN = 0x0010,
BOTTOMALIGN = 0x0020,
VERTICAL = 0x0040,
NONOTIFY = 0x0080,
RETURNCMD = 0x0100,
RECURSE = 0x0001,
HORPOSANIMATION = 0x0400,
HORNEGANIMATION = 0x0800,
VERPOSANIMATION = 0x1000,
VERNEGANIMATION = 0x2000,
NOANIMATION = 0x4000,
LAYOUTRTL = 0x8000,
}
/// <summary>
/// user32 TrackPopupMenuEx.
/// </summary>
/// <param name="hmenu">hmenu.</param>
/// <param name="flags">flags.</param>
/// <param name="x">x.</param>
/// <param name="y">y.</param>
/// <param name="hwnd">hwnd.</param>
/// <param name="lptpm">lptpm.</param>
/// <returns>uint.</returns>
internal static uint User32TrackPopupMenuEx(IntPtr hmenu, TPM flags, int x, int y, IntPtr hwnd, IntPtr lptpm)
{
return TrackPopupMenuEx(hmenu, flags, x, y, hwnd, lptpm);
}
// The TrackPopupMenuEx function displays a shortcut menu at the specified location and tracks the selection of items on the shortcut menu. The shortcut menu can appear anywhere on the screen.
[DllImport("user32.dll", ExactSpelling = true, SetLastError = true, CharSet = CharSet.Unicode)]
[DefaultDllImportSearchPaths(DllImportSearchPath.UserDirectories)]
private static extern uint TrackPopupMenuEx(IntPtr hmenu, TPM flags, int x, int y, IntPtr hwnd, IntPtr lptpm);
}
}

View File

@@ -0,0 +1,29 @@
using NLog;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace FSI.BT.Tools.Global
{
internal static class Vars
{
public static Logger Log = LogManager.GetCurrentClassLogger();
public static Global.Settings.Interface.IInterface GlobalSettings { get; set; }
public static RadialMenu.Settings.Interface.IInterface RadialMenuSettings { get; set; }
public static SystemTrayMenu.Settings.Interface.IInterface SystemTrayMenuSettings { get; set; }
public static TimeStampToClipboard.Settings.Interface.IInterface TimeStampSettings { get; set; }
public static bool UserRights { get; set; }
public static bool AdminRights { get; set; }
public static bool SuperAdminRights { get; set; }
public static Lib.Guis.IbaDirSync.ViewModel Iba { get; set; }
public static Lib.Guis.SieTiaWinCCMsgMgt.ViewModel WinCC { get; set; }
}
}

View File

@@ -0,0 +1,20 @@
using System.Collections.Generic;
namespace FSI.BT.Tools.Global.Helpers
{
internal class GetFolderByName
{
internal static (string path, string description) Get(IEnumerable<Settings.Folder.IFolder> folders, string name)
{
foreach (var folder in folders)
{
if (folder.Name.Equals(name))
{
return (folder.Path, folder.Description);
}
}
return (null, null);
}
}
}

View File

@@ -0,0 +1,46 @@
using System;
using System.Windows.Input;
namespace FSI.BT.Tools.Global.Helpers
{
public class RelayCommand : ICommand
{
private Action action;
private Func<bool> condition;
public event EventHandler CanExecuteChanged
{
add { CommandManager.RequerySuggested += value; }
remove { CommandManager.RequerySuggested -= value; }
}
public RelayCommand(Action action)
{
this.action = action;
condition = () => true;
}
public RelayCommand(Action action, bool condition)
{
this.action = action;
this.condition = () => condition;
}
public RelayCommand(Action action, Func<bool> condition)
{
this.action = action;
this.condition = condition;
}
public bool CanExecute(object parameter)
{
return condition.Invoke();
}
void ICommand.Execute(object parameter)
{
action.Invoke();
}
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 41 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 658 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 667 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 82 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 74 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 76 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 51 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 47 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 72 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 43 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 56 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 128 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

@@ -0,0 +1,552 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<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>
<data name="About SystemTrayMenu" xml:space="preserve">
<value>Über SystemTrayMenu</value>
</data>
<data name="OK" xml:space="preserve">
<value>OK</value>
</data>
<data name="App start" xml:space="preserve">
<value>App-Start</value>
</data>
<data name="Exit app" xml:space="preserve">
<value>App beenden</value>
</data>
<data name="Directory" xml:space="preserve">
<value>Verzeichnis</value>
</data>
<data name="Directory empty" xml:space="preserve">
<value>Verzeichnis leer</value>
</data>
<data name="Details" xml:space="preserve">
<value>Einzelheiten</value>
</data>
<data name="System Info" xml:space="preserve">
<value>Systeminformationen</value>
</data>
<data name="Directory inaccessible" xml:space="preserve">
<value>Verzeichnis unzugänglich</value>
</data>
<data name="Language" xml:space="preserve">
<value>Sprache</value>
</data>
<data name="Log File" xml:space="preserve">
<value>Logdatei</value>
</data>
<data name="Restart" xml:space="preserve">
<value>Neu starten</value>
</data>
<data name="Could not register the hot key." xml:space="preserve">
<value>Der Hotkey konnte nicht registriert werden.</value>
</data>
<data name="Abort" xml:space="preserve">
<value>Abbrechen</value>
</data>
<data name="General" xml:space="preserve">
<value>Allgemein</value>
</data>
<data name="Hotkey" xml:space="preserve">
<value>Hotkey</value>
</data>
<data name="Start with Windows" xml:space="preserve">
<value>Starte mit Windows</value>
</data>
<data name="Settings" xml:space="preserve">
<value>Einstellungen</value>
</data>
<data name="Frequently Asked Questions" xml:space="preserve">
<value>Häufig gestellte Fragen</value>
</data>
<data name="Read the FAQ and then choose a root directory for SystemTrayMenu." xml:space="preserve">
<value>Lesen Sie die FAQ und wählen Sie dann ein Stammverzeichnis für SystemTrayMenu.</value>
</data>
<data name="Select directory" xml:space="preserve">
<value>Verzeichnis auswählen</value>
</data>
<data name="Your root directory for the app does not exist or is empty! Change the root directory or put some files, directories or shortcuts into the root directory." xml:space="preserve">
<value>Ihr Stammverzeichnis für die App existiert nicht oder ist leer! Ändern Sie das Stammverzeichnis oder legen Sie einige Dateien, Verzeichnisse oder Verknüpfungen in das Stammverzeichnis.</value>
</data>
<data name="You have no access to the root directory of the app. Grant access to the directory or change the root directory." xml:space="preserve">
<value>Sie haben keinen Zugriff auf das Stammverzeichnis der App. Gewähren Sie Zugriff auf das Verzeichnis oder ändern Sie das Stammverzeichnis.</value>
</data>
<data name="Single click to open an element" xml:space="preserve">
<value>Klicken Sie einmal, um ein Element zu öffnen</value>
</data>
<data name="Color scheme dark always active" xml:space="preserve">
<value>Farbschema dunkel immer aktiv</value>
</data>
<data name="Advanced" xml:space="preserve">
<value>Fortschrittlich</value>
</data>
<data name="At mouse location" xml:space="preserve">
<value>An der Mausposition</value>
</data>
<data name="Changing directory" xml:space="preserve">
<value>Verzeichnis wechseln</value>
</data>
<data name="Click" xml:space="preserve">
<value>Klicken</value>
</data>
<data name="Customize" xml:space="preserve">
<value>Anpassen</value>
</data>
<data name="Default" xml:space="preserve">
<value>Standard</value>
</data>
<data name="If the focus is lost and the mouse is still on the menu" xml:space="preserve">
<value>Wenn der Fokus verloren geht und sich die Maus noch im Menü befindet</value>
</data>
<data name="Milliseconds until a menu opens when the mouse is on it" xml:space="preserve">
<value>Millisekunden, bis sich ein Menü öffnet, wenn die Maus darauf ist</value>
</data>
<data name="Milliseconds until the menu closes if the mouse then leaves the menu" xml:space="preserve">
<value>Millisekunden bis zum Schließen des Menüs, wenn die Maus anschließend das Menü verlässt</value>
</data>
<data name="Maximum menu width" xml:space="preserve">
<value>Maximale Menübreite</value>
</data>
<data name="Menu stays open" xml:space="preserve">
<value>Menü bleibt geöffnet</value>
</data>
<data name="Time until a menu opens" xml:space="preserve">
<value>Zeit bis sich ein Menü öffnet</value>
</data>
<data name="If an element was clicked" xml:space="preserve">
<value>Wenn ein Element angeklickt wurde</value>
</data>
<data name="Background" xml:space="preserve">
<value>Hintergrund</value>
</data>
<data name="Opened directory" xml:space="preserve">
<value>Geöffnetes Verzeichnis</value>
</data>
<data name="Border of opened directory" xml:space="preserve">
<value>Rahmen des geöffneten Verzeichnisses</value>
</data>
<data name="Search field" xml:space="preserve">
<value>Suchfeld</value>
</data>
<data name="Selected element" xml:space="preserve">
<value>Ausgewähltes Element</value>
</data>
<data name="Border of selected element" xml:space="preserve">
<value>Rahmen des ausgewählten Elements</value>
</data>
<data name="Relative directory" xml:space="preserve">
<value>Relatives Verzeichnis</value>
</data>
<data name="Save configuration file in application directory" xml:space="preserve">
<value>Konfigurationsdatei im Anwendungsverzeichnis speichern</value>
</data>
<data name="Configuration and log files" xml:space="preserve">
<value>Konfigurations- und Protokolldateien</value>
</data>
<data name="Open application directory" xml:space="preserve">
<value>Anwendungsverzeichnis öffnen</value>
</data>
<data name="Maximum menu height" xml:space="preserve">
<value>Maximale Menühöhe</value>
</data>
<data name="Arrow" xml:space="preserve">
<value>Pfeil</value>
</data>
<data name="Arrow when clicking" xml:space="preserve">
<value>Pfeil beim Klicken</value>
</data>
<data name="Arrow while mouse hovers over it" xml:space="preserve">
<value>Pfeil, während die Maus darüber schwebt</value>
</data>
<data name="Background of arrow when clicking" xml:space="preserve">
<value>Hintergrund des Pfeils beim Klicken</value>
</data>
<data name="Background of arrow while mouse hovers over it" xml:space="preserve">
<value>Hintergrund des Pfeils, während die Maus darüber schwebt</value>
</data>
<data name="Color scheme dark" xml:space="preserve">
<value>Farbschema dunkel</value>
</data>
<data name="Color scheme bright" xml:space="preserve">
<value>Farbschema hell</value>
</data>
<data name="App menu" xml:space="preserve">
<value>App-Menü</value>
</data>
<data name="Scrollbar" xml:space="preserve">
<value>Scrollleiste</value>
</data>
<data name="Slider" xml:space="preserve">
<value>Schieberegler</value>
</data>
<data name="Slider while dragging" xml:space="preserve">
<value>Schieberegler beim Ziehen</value>
</data>
<data name="Slider while mouse hovers over it 1" xml:space="preserve">
<value>Schieberegler, während die Maus darüber schwebt 1</value>
</data>
<data name="Slider while mouse hovers over it 2" xml:space="preserve">
<value>Schieberegler, während die Maus darüber schwebt 2</value>
</data>
<data name="Use icon from directory" xml:space="preserve">
<value>Verwenden Sie das Symbol aus dem Verzeichnis</value>
</data>
<data name="Sizes in percent" xml:space="preserve">
<value>Größen in Prozent</value>
</data>
<data name="Border of menu" xml:space="preserve">
<value>Rand des Menüs</value>
</data>
<data name="Icons" xml:space="preserve">
<value>Symbole</value>
</data>
<data name="Set by context menu " xml:space="preserve">
<value>Per Kontextmenü einstellen</value>
</data>
<data name="Set as directory" xml:space="preserve">
<value>Als Verzeichnis festlegen</value>
</data>
<data name="loading" xml:space="preserve">
<value>Wird geladen</value>
</data>
<data name="Problem with shortcut link" xml:space="preserve">
<value>Problem mit Shortcut-Link</value>
</data>
<data name="The item that this shortcut refers to has been changed or moved, so this shortcut will no longer work properly." xml:space="preserve">
<value>Das Element, auf das sich diese Verknüpfung bezieht, wurde geändert oder verschoben, sodass diese Verknüpfung nicht mehr ordnungsgemäß funktioniert.</value>
</data>
<data name="Open directory" xml:space="preserve">
<value>Verzeichnis öffnen</value>
</data>
<data name="Task Manager" xml:space="preserve">
<value>Taskmanager</value>
</data>
<data name="Deactivated" xml:space="preserve">
<value>Deaktiviert</value>
</data>
<data name="Activated" xml:space="preserve">
<value>Aktiviert</value>
</data>
<data name="Expert" xml:space="preserve">
<value>Experte</value>
</data>
<data name="If the focus is lost and the Enter key was pressed" xml:space="preserve">
<value>Wenn der Fokus verloren geht und die Eingabetaste gedrückt wurde</value>
</data>
<data name="Milliseconds until the menu closes if the menu is not reactivated" xml:space="preserve">
<value>Millisekunden bis zum Schließen des Menüs, wenn das Menü nicht erneut aktiviert wird</value>
</data>
<data name="Show in Taskbar" xml:space="preserve">
<value>In Taskleiste anzeigen</value>
</data>
<data name="Add directory" xml:space="preserve">
<value>Verzeichnis hinzufügen</value>
</data>
<data name="Add content of directory to root directory" xml:space="preserve">
<value>Inhalt des Verzeichnisses zum Stammverzeichnis hinzufügen</value>
</data>
<data name="Directory paths" xml:space="preserve">
<value>Verzeichnispfade</value>
</data>
<data name="Directories" xml:space="preserve">
<value>Verzeichnisse</value>
</data>
<data name="Recursive" xml:space="preserve">
<value>Rekursiv</value>
</data>
<data name="Remove directory" xml:space="preserve">
<value>Verzeichnis entfernen</value>
</data>
<data name="Only Files" xml:space="preserve">
<value>Nur Dateien</value>
</data>
<data name="Clear cache if more than this number of items" xml:space="preserve">
<value>Cache löschen, wenn mehr als diese Anzahl von Elementen vorhanden ist</value>
</data>
<data name="Add sample directory 'Start Menu'" xml:space="preserve">
<value>Beispielverzeichnis 'Startmenü' hinzufügen</value>
</data>
<data name="Row height" xml:space="preserve">
<value>Zeilenhöhe</value>
</data>
<data name="Round corners" xml:space="preserve">
<value>Runde Ecken</value>
</data>
<data name="Appearance" xml:space="preserve">
<value>Aussehen</value>
</data>
<data name="Bottom left" xml:space="preserve">
<value>Unten links</value>
</data>
<data name="Bottom right" xml:space="preserve">
<value>Unten rechts</value>
</data>
<data name="Main menu appears" xml:space="preserve">
<value>Hauptmenü erscheint</value>
</data>
<data name="Mouse location (above Taskbar icon)" xml:space="preserve">
<value>Mausposition (über dem Taskleistensymbol)</value>
</data>
<data name="Custom (drag it to the appropriate position)" xml:space="preserve">
<value>Benutzerdefiniert (an die entsprechende Position ziehen)</value>
</data>
<data name="element" xml:space="preserve">
<value>Element</value>
</data>
<data name="elements" xml:space="preserve">
<value>Elemente</value>
</data>
<data name="Generate drive shortcuts on startup" xml:space="preserve">
<value>Generieren Sie Laufwerksverknüpfungen beim Start</value>
</data>
<data name="Cache" xml:space="preserve">
<value>Zwischenspeicher</value>
</data>
<data name="Always show" xml:space="preserve">
<value>Immer anzeigen</value>
</data>
<data name="Hidden files and directories" xml:space="preserve">
<value>Versteckte Dateien und Verzeichnisse</value>
</data>
<data name="Never show" xml:space="preserve">
<value>Niemals zeigen</value>
</data>
<data name="Size and location" xml:space="preserve">
<value>Größe und Lage</value>
</data>
<data name="Use operating system settings" xml:space="preserve">
<value>Betriebssystemeinstellungen verwenden</value>
</data>
<data name="Show only as search result" xml:space="preserve">
<value>Nur als Suchergebnis anzeigen</value>
</data>
<data name="Single click to open a directory" xml:space="preserve">
<value>Klicken Sie einmal, um ein Verzeichnis zu öffnen</value>
</data>
<data name="Support Gamepad" xml:space="preserve">
<value>Gamepad unterstützen</value>
</data>
<data name="Next to the previous one" xml:space="preserve">
<value>Neben dem vorherigen</value>
</data>
<data name="Offset by pixels" xml:space="preserve">
<value>Pixelweise versetzt</value>
</data>
<data name="Overlapping" xml:space="preserve">
<value>Überlappend</value>
</data>
<data name="Sub menu appears" xml:space="preserve">
<value>Untermenü erscheint</value>
</data>
<data name="Icon size" xml:space="preserve">
<value>Symbolgröße</value>
</data>
<data name="Support SystemTrayMenu" xml:space="preserve">
<value>SystemTrayMenu unterstützen</value>
</data>
<data name="Fading" xml:space="preserve">
<value>Fading</value>
</data>
<data name="Send hotkey to other instance" xml:space="preserve">
<value>Hotkey an andere Instanz senden</value>
</data>
<data name="Sorted by date" xml:space="preserve">
<value>Sortiert nach Datum</value>
</data>
<data name="Sorted by name" xml:space="preserve">
<value>Sortiert nach Namen</value>
</data>
<data name="Sorting" xml:space="preserve">
<value>Sortierung</value>
</data>
<data name="Copy row element via drag and drop" xml:space="preserve">
<value>Zeilenelement per Drag and Drop kopieren</value>
</data>
<data name="Drag" xml:space="preserve">
<value>Ziehen</value>
</data>
<data name="Scroll via swipe" xml:space="preserve">
<value>Per Wischen scrollen</value>
</data>
<data name="Filter menu by file type e.g.: *.exe|*.dll" xml:space="preserve">
<value>Menü nach Dateityp filtern, z. B.: *.exe|*.dll</value>
</data>
<data name="Show count of elements" xml:space="preserve">
<value>Anzahl der Elemente anzeigen</value>
</data>
<data name="Show directory title at top" xml:space="preserve">
<value>Verzeichnistitel oben anzeigen</value>
</data>
<data name="Show function key 'Open Folder'" xml:space="preserve">
<value>Funktionstaste 'Ordner öffnen' anzeigen</value>
</data>
<data name="Show function key 'Pin menu'" xml:space="preserve">
<value>Funktionstaste 'Pin-Menü' anzeigen</value>
</data>
<data name="Show function key 'Settings'" xml:space="preserve">
<value>Funktionstaste 'Einstellungen' anzeigen</value>
</data>
<data name="Show function key 'Restart'" xml:space="preserve">
<value>Funktionstaste 'Neustart' anzeigen</value>
</data>
<data name="Show search bar" xml:space="preserve">
<value>Suchleiste anzeigen</value>
</data>
<data name="Saving log file in application directory" xml:space="preserve">
<value>Protokolldatei im Anwendungsverzeichnis speichern</value>
</data>
<data name="Show link overlay" xml:space="preserve">
<value>Link-Overlay anzeigen</value>
</data>
<data name="Directory of Internet Shortcut Icons" xml:space="preserve">
<value>Verzeichnis der Internet-Verknüpfungssymbole</value>
</data>
<data name="Sorted by type (folder or file) and date" xml:space="preserve">
<value>Sortiert nach Typ (Ordner oder Datei) und Datum</value>
</data>
<data name="Sorted by type (folder or file) and name" xml:space="preserve">
<value>Sortiert nach Typ (Ordner oder Datei) und Name</value>
</data>
<data name="Check for updates" xml:space="preserve">
<value>Auf Updates prüfen</value>
</data>
<data name="Go to download page" xml:space="preserve">
<value>Gehen Sie zur Download-Seite</value>
</data>
<data name="Latest available version:" xml:space="preserve">
<value>Neueste verfügbare Version:</value>
</data>
<data name="New version available!" xml:space="preserve">
<value>Neue Version verfügbar!</value>
</data>
<data name="You have the latest version of SystemTrayMenu!" xml:space="preserve">
<value>Sie haben die neueste Version von SystemTrayMenu!</value>
</data>
<data name="Application size" xml:space="preserve">
<value>Anwendungsgröße</value>
</data>
<data name="Optional Features" xml:space="preserve">
<value>Optionale Funktionen</value>
</data>
<data name="Resolve links to folders and show content" xml:space="preserve">
<value>Verknüpfungen zu Ordnern auflösen und Inhalte anzeigen</value>
</data>
<data name="Sorted by file extension and name" xml:space="preserve">
<value>Sortiert nach Dateiendung und Name</value>
</data>
</root>

View File

@@ -0,0 +1,552 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<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>
<data name="About SystemTrayMenu" xml:space="preserve">
<value>About SystemTrayMenu</value>
</data>
<data name="OK" xml:space="preserve">
<value>OK</value>
</data>
<data name="App start" xml:space="preserve">
<value>Autostart</value>
</data>
<data name="Exit app" xml:space="preserve">
<value>Exit app</value>
</data>
<data name="Directory" xml:space="preserve">
<value>Directory</value>
</data>
<data name="Directory empty" xml:space="preserve">
<value>Directory empty</value>
</data>
<data name="Details" xml:space="preserve">
<value>Details</value>
</data>
<data name="System Info" xml:space="preserve">
<value>System Info</value>
</data>
<data name="Directory inaccessible" xml:space="preserve">
<value>Directory inaccessible</value>
</data>
<data name="Language" xml:space="preserve">
<value>Language</value>
</data>
<data name="Log File" xml:space="preserve">
<value>Log File</value>
</data>
<data name="Restart" xml:space="preserve">
<value>Restart</value>
</data>
<data name="Could not register the hot key." xml:space="preserve">
<value>Could not register the hot key.</value>
</data>
<data name="Abort" xml:space="preserve">
<value>Cancel</value>
</data>
<data name="General" xml:space="preserve">
<value>General</value>
</data>
<data name="Hotkey" xml:space="preserve">
<value>Hotkey</value>
</data>
<data name="Start with Windows" xml:space="preserve">
<value>Start with Windows</value>
</data>
<data name="Settings" xml:space="preserve">
<value>Settings</value>
</data>
<data name="Frequently Asked Questions" xml:space="preserve">
<value>Frequently Asked Questions</value>
</data>
<data name="Read the FAQ and then choose a root directory for SystemTrayMenu." xml:space="preserve">
<value>Read the FAQ and then choose a root directory for SystemTrayMenu.</value>
</data>
<data name="Select directory" xml:space="preserve">
<value>Select directory</value>
</data>
<data name="Your root directory for the app does not exist or is empty! Change the root directory or put some files, directories or shortcuts into the root directory." xml:space="preserve">
<value>Your root directory for the app does not exist or is empty! Change the root directory or put some files, directories or shortcuts into the root directory.</value>
</data>
<data name="You have no access to the root directory of the app. Grant access to the directory or change the root directory." xml:space="preserve">
<value>You have no access to the root directory of the app. Grant access to the directory or change the root directory.</value>
</data>
<data name="Single click to open an element" xml:space="preserve">
<value>Single click to open an element</value>
</data>
<data name="Color scheme dark always active" xml:space="preserve">
<value>Color scheme dark always active</value>
</data>
<data name="Advanced" xml:space="preserve">
<value>Advanced</value>
</data>
<data name="At mouse location" xml:space="preserve">
<value>At mouse location</value>
</data>
<data name="Changing directory" xml:space="preserve">
<value>Change the directory</value>
</data>
<data name="Click" xml:space="preserve">
<value>Click</value>
</data>
<data name="Customize" xml:space="preserve">
<value>Customize</value>
</data>
<data name="Default" xml:space="preserve">
<value>Default</value>
</data>
<data name="If the focus is lost and the mouse is still on the menu" xml:space="preserve">
<value>If the focus is lost and the mouse is still on the menu</value>
</data>
<data name="Milliseconds until a menu opens when the mouse is on it" xml:space="preserve">
<value>Milliseconds until a menu opens when the mouse is on it</value>
</data>
<data name="Milliseconds until the menu closes if the mouse then leaves the menu" xml:space="preserve">
<value>Milliseconds until the menu closes if the mouse then leaves the menu</value>
</data>
<data name="Maximum menu width" xml:space="preserve">
<value>Maximum menu width</value>
</data>
<data name="Menu stays open" xml:space="preserve">
<value>Menu stays open</value>
</data>
<data name="Time until a menu opens" xml:space="preserve">
<value>Time until a menu opens</value>
</data>
<data name="If an element was clicked" xml:space="preserve">
<value>If an element was clicked</value>
</data>
<data name="Background" xml:space="preserve">
<value>Background</value>
</data>
<data name="Opened directory" xml:space="preserve">
<value>Opened directory</value>
</data>
<data name="Border of opened directory" xml:space="preserve">
<value>Border of opened directory</value>
</data>
<data name="Search field" xml:space="preserve">
<value>Search field</value>
</data>
<data name="Selected element" xml:space="preserve">
<value>Selected element</value>
</data>
<data name="Border of selected element" xml:space="preserve">
<value>Border of selected element</value>
</data>
<data name="Relative directory" xml:space="preserve">
<value>Relative directory</value>
</data>
<data name="Save configuration file in application directory" xml:space="preserve">
<value>Save configuration file in application directory</value>
</data>
<data name="Configuration and log files" xml:space="preserve">
<value>Configuration and log files</value>
</data>
<data name="Open application directory" xml:space="preserve">
<value>Open application directory</value>
</data>
<data name="Maximum menu height" xml:space="preserve">
<value>Maximum menu height</value>
</data>
<data name="Arrow" xml:space="preserve">
<value>Arrow</value>
</data>
<data name="Arrow when clicking" xml:space="preserve">
<value>Arrow when clicking</value>
</data>
<data name="Arrow while mouse hovers over it" xml:space="preserve">
<value>Arrow while mouse hovers over it</value>
</data>
<data name="Background of arrow when clicking" xml:space="preserve">
<value>Background of arrow when clicking</value>
</data>
<data name="Background of arrow while mouse hovers over it" xml:space="preserve">
<value>Background of arrow while mouse hovers over it</value>
</data>
<data name="Color scheme dark" xml:space="preserve">
<value>Color scheme dark</value>
</data>
<data name="Color scheme bright" xml:space="preserve">
<value>Color scheme bright</value>
</data>
<data name="App menu" xml:space="preserve">
<value>App menu</value>
</data>
<data name="Scrollbar" xml:space="preserve">
<value>Scrollbar</value>
</data>
<data name="Slider" xml:space="preserve">
<value>Slider</value>
</data>
<data name="Slider while dragging" xml:space="preserve">
<value>Slider while dragging</value>
</data>
<data name="Slider while mouse hovers over it 1" xml:space="preserve">
<value>Slider while mouse hovers over it 1</value>
</data>
<data name="Slider while mouse hovers over it 2" xml:space="preserve">
<value>Slider while mouse hovers over it 2</value>
</data>
<data name="Use icon from directory" xml:space="preserve">
<value>Use icon from directory</value>
</data>
<data name="Sizes in percent" xml:space="preserve">
<value>Sizes in percent</value>
</data>
<data name="Border of menu" xml:space="preserve">
<value>Border of menu</value>
</data>
<data name="Icons" xml:space="preserve">
<value>Icons</value>
</data>
<data name="Set by context menu " xml:space="preserve">
<value>Set by context menu </value>
</data>
<data name="Set as directory" xml:space="preserve">
<value>Set as directory</value>
</data>
<data name="loading" xml:space="preserve">
<value>loading</value>
</data>
<data name="Problem with shortcut link" xml:space="preserve">
<value>Problem with Shortcut</value>
</data>
<data name="The item that this shortcut refers to has been changed or moved, so this shortcut will no longer work properly." xml:space="preserve">
<value>The item that this shortcut refers to has been changed or moved, so this shortcut will no longer work properly.</value>
</data>
<data name="Open directory" xml:space="preserve">
<value>Open directory</value>
</data>
<data name="Task Manager" xml:space="preserve">
<value>Task Manager</value>
</data>
<data name="Deactivated" xml:space="preserve">
<value>Deactivated</value>
</data>
<data name="Activated" xml:space="preserve">
<value>Activated</value>
</data>
<data name="Expert" xml:space="preserve">
<value>Expert</value>
</data>
<data name="If the focus is lost and the Enter key was pressed" xml:space="preserve">
<value>If the focus is lost and the Enter key was pressed</value>
</data>
<data name="Milliseconds until the menu closes if the menu is not reactivated" xml:space="preserve">
<value>Milliseconds until the menu closes if the menu is not reactivated</value>
</data>
<data name="Show in Taskbar" xml:space="preserve">
<value>Show in Taskbar</value>
</data>
<data name="Add directory" xml:space="preserve">
<value>Add directory</value>
</data>
<data name="Add content of directory to root directory" xml:space="preserve">
<value>Add content of directory to root directory</value>
</data>
<data name="Directory paths" xml:space="preserve">
<value>Directory paths</value>
</data>
<data name="Directories" xml:space="preserve">
<value>Directories</value>
</data>
<data name="Recursive" xml:space="preserve">
<value>Recursive</value>
</data>
<data name="Remove directory" xml:space="preserve">
<value>Remove directory</value>
</data>
<data name="Only Files" xml:space="preserve">
<value>Only Files</value>
</data>
<data name="Clear cache if more than this number of items" xml:space="preserve">
<value>Clear cache if more than this number of items</value>
</data>
<data name="Add sample directory 'Start Menu'" xml:space="preserve">
<value>Add sample directory 'Start Menu'</value>
</data>
<data name="Row height" xml:space="preserve">
<value>Row height</value>
</data>
<data name="Round corners" xml:space="preserve">
<value>Round corners</value>
</data>
<data name="Appearance" xml:space="preserve">
<value>Appearance</value>
</data>
<data name="Bottom left" xml:space="preserve">
<value>Bottom left</value>
</data>
<data name="Bottom right" xml:space="preserve">
<value>Bottom right</value>
</data>
<data name="Main menu appears" xml:space="preserve">
<value>Main menu appears</value>
</data>
<data name="Mouse location (above Taskbar icon)" xml:space="preserve">
<value>Mouse location (above Taskbar icon)</value>
</data>
<data name="Custom (drag it to the appropriate position)" xml:space="preserve">
<value>Custom (drag it to the appropriate position)</value>
</data>
<data name="element" xml:space="preserve">
<value>item</value>
</data>
<data name="elements" xml:space="preserve">
<value>items</value>
</data>
<data name="Generate drive shortcuts on startup" xml:space="preserve">
<value>Generate shortcuts to drives</value>
</data>
<data name="Cache" xml:space="preserve">
<value>Cache</value>
</data>
<data name="Always show" xml:space="preserve">
<value>Always show</value>
</data>
<data name="Hidden files and directories" xml:space="preserve">
<value>Hidden files and directories</value>
</data>
<data name="Never show" xml:space="preserve">
<value>Never show</value>
</data>
<data name="Size and location" xml:space="preserve">
<value>Size and location</value>
</data>
<data name="Use operating system settings" xml:space="preserve">
<value>Use operating system settings</value>
</data>
<data name="Show only as search result" xml:space="preserve">
<value>Show only as search result</value>
</data>
<data name="Single click to open a directory" xml:space="preserve">
<value>Single click to open a directory</value>
</data>
<data name="Support Gamepad" xml:space="preserve">
<value>Support Gamepad</value>
</data>
<data name="Next to the previous one" xml:space="preserve">
<value>Next to the previous one</value>
</data>
<data name="Offset by pixels" xml:space="preserve">
<value>Offset by pixels</value>
</data>
<data name="Overlapping" xml:space="preserve">
<value>Overlapping</value>
</data>
<data name="Sub menu appears" xml:space="preserve">
<value>Sub menu appears</value>
</data>
<data name="Icon size" xml:space="preserve">
<value>Icon size</value>
</data>
<data name="Support SystemTrayMenu" xml:space="preserve">
<value>Support SystemTrayMenu</value>
</data>
<data name="Fading" xml:space="preserve">
<value>Fading</value>
</data>
<data name="Send hotkey to other instance" xml:space="preserve">
<value>Send hotkey to other instance</value>
</data>
<data name="Sorted by date" xml:space="preserve">
<value>Sorted by date</value>
</data>
<data name="Sorted by name" xml:space="preserve">
<value>Sorted by name</value>
</data>
<data name="Sorting" xml:space="preserve">
<value>Sorting</value>
</data>
<data name="Copy row element via drag and drop" xml:space="preserve">
<value>Copy row item via drag and drop</value>
</data>
<data name="Drag" xml:space="preserve">
<value>Drag</value>
</data>
<data name="Scroll via swipe" xml:space="preserve">
<value>Scroll via swipe</value>
</data>
<data name="Filter menu by file type e.g.: *.exe|*.dll" xml:space="preserve">
<value>Filter menu by file type e.g.: *.exe|*.dll</value>
</data>
<data name="Show count of elements" xml:space="preserve">
<value>Show number of items</value>
</data>
<data name="Show directory title at top" xml:space="preserve">
<value>Show directory title at top</value>
</data>
<data name="Show function key 'Open Folder'" xml:space="preserve">
<value>Show function key 'Open Folder'</value>
</data>
<data name="Show function key 'Pin menu'" xml:space="preserve">
<value>Show function key 'Pin menu'</value>
</data>
<data name="Show function key 'Settings'" xml:space="preserve">
<value>Show function key 'Settings'</value>
</data>
<data name="Show function key 'Restart'" xml:space="preserve">
<value>Show function key 'Restart'</value>
</data>
<data name="Show search bar" xml:space="preserve">
<value>Show search bar</value>
</data>
<data name="Saving log file in application directory" xml:space="preserve">
<value>Save log file in application directory</value>
</data>
<data name="Show link overlay" xml:space="preserve">
<value>Show link overlay</value>
</data>
<data name="Directory of Internet Shortcut Icons" xml:space="preserve">
<value>Directory of Internet Shortcut Icons</value>
</data>
<data name="Sorted by type (folder or file) and date" xml:space="preserve">
<value>Sorted by type (folder or file) and date</value>
</data>
<data name="Sorted by type (folder or file) and name" xml:space="preserve">
<value>Sorted by type (folder or file) and name</value>
</data>
<data name="Check for updates" xml:space="preserve">
<value>Check for updates</value>
</data>
<data name="Go to download page" xml:space="preserve">
<value>Go to download page</value>
</data>
<data name="Latest available version:" xml:space="preserve">
<value>Latest available version:</value>
</data>
<data name="New version available!" xml:space="preserve">
<value>New version available!</value>
</data>
<data name="You have the latest version of SystemTrayMenu!" xml:space="preserve">
<value>You have the latest version of SystemTrayMenu!</value>
</data>
<data name="Application size" xml:space="preserve">
<value>Application size</value>
</data>
<data name="Optional Features" xml:space="preserve">
<value>Optional Features</value>
</data>
<data name="Resolve links to folders and show content" xml:space="preserve">
<value>Resolve links to folders and show content</value>
</data>
<data name="Sorted by file extension and name" xml:space="preserve">
<value>Sorted by file extension and name</value>
</data>
</root>

View File

@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1">
<assemblyIdentity version="1.0.0.0" name="foo"/>
<application xmlns="urn:schemas-microsoft-com:asm.v3">
<windowsSettings>
<dpiAwareness xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">PerMonitor</dpiAwareness>
<dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true</dpiAware>
</windowsSettings>
</application>
</assembly>

View File

@@ -0,0 +1,20 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace FSI.BT.Tools.Global.Settings
{
public class Cmd
{
public interface ICmd
{
string Cmd { get; set; }
IEnumerable<Exe.IExe> Exe { get; }
IEnumerable<String> Urls { get; }
}
}
}

View File

@@ -0,0 +1,18 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace FSI.BT.Tools.Global.Settings
{
public class Exe
{
public interface IExe
{
string ExePath { get; set; }
string Path { get; set; }
string Arguments { get; set; }
}
}
}

View File

@@ -0,0 +1,13 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace FSI.BT.Tools.Global.Settings
{
public class Folder
{
public interface IFolder : Lib.Guis.Folder.Mgt.IInterface { }
}
}

View File

@@ -0,0 +1,37 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace FSI.BT.Tools.Global.Settings
{
public class Interface
{
public interface IInterface
{
string HotKey { get; set; }
IEnumerable<StringValue.IStringValue> Users { get; }
IEnumerable<StringValue.IStringValue> Admins { get; }
string SuperAdmin { get; }
StringValue.IStringValue Pw { get; set; }
StringValue.IStringValue TimeStampFormat { get; set; }
IEnumerable<Cmd.ICmd> Cmds { get; }
IEnumerable<Folder.IFolder> Folders { get; }
IEnumerable<RdpMgt.IRdp> Rdps { get; }
//IEnumerable<Lib.Guis.WebRadio.IInterface> WebRadioUrls { get; }
Lib.Guis.SieTiaWinCCMsgMgt.IInterface WinCC { get; set; }
Lib.Guis.IbaDirSync.IInterface IbaDirSync { get; set; }
}
}
}

View File

@@ -0,0 +1,16 @@
namespace FSI.BT.Tools.Global.Settings
{
public class StringValue
{
public interface IStringValue
{
string Value { get; set; }
}
public interface IStringValueCrypt
{
string Value { get; set; }
string ValueDeCrypt { get; set; }
}
}
}

View File

@@ -0,0 +1,13 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace FSI.BT.Tools.Global.Settings
{
public class RdpMgt
{
public interface IRdp : Lib.Guis.Rdp.Mgt.IInterface { }
}
}

Binary file not shown.

View File

@@ -0,0 +1,510 @@
namespace FSI.BT.Tools.Global.UserInterface
{
internal partial class AboutBox
{
/// <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()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(AboutBox));
this.buttonDetails = new System.Windows.Forms.Button();
this.ImagePictureBox = new System.Windows.Forms.PictureBox();
this.AppDateLabel = new System.Windows.Forms.Label();
this.buttonSystemInfo = new System.Windows.Forms.Button();
this.AppCopyrightLabel = new System.Windows.Forms.Label();
this.AppVersionLabel = new System.Windows.Forms.Label();
this.AppDescriptionLabel = new System.Windows.Forms.Label();
this.GroupBox1 = new System.Windows.Forms.GroupBox();
this.AppTitleLabel = new System.Windows.Forms.Label();
this.buttonOk = new System.Windows.Forms.Button();
this.MoreRichTextBox = new System.Windows.Forms.RichTextBox();
this.TabPanelDetails = new System.Windows.Forms.TabControl();
this.TabPageApplication = new System.Windows.Forms.TabPage();
this.AppInfoListView = new System.Windows.Forms.ListView();
this.colKey = new System.Windows.Forms.ColumnHeader();
this.colValue = new System.Windows.Forms.ColumnHeader();
this.TabPageAssemblies = new System.Windows.Forms.TabPage();
this.AssemblyInfoListView = new System.Windows.Forms.ListView();
this.colAssemblyName = new System.Windows.Forms.ColumnHeader();
this.colAssemblyVersion = new System.Windows.Forms.ColumnHeader();
this.colAssemblyBuilt = new System.Windows.Forms.ColumnHeader();
this.colAssemblyCodeBase = new System.Windows.Forms.ColumnHeader();
this.TabPageAssemblyDetails = new System.Windows.Forms.TabPage();
this.AssemblyDetailsListView = new System.Windows.Forms.ListView();
this.ColumnHeader1 = new System.Windows.Forms.ColumnHeader();
this.ColumnHeader2 = new System.Windows.Forms.ColumnHeader();
this.AssemblyNamesComboBox = new System.Windows.Forms.ComboBox();
this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
this.tableLayoutPanel4 = new System.Windows.Forms.TableLayoutPanel();
this.tableLayoutPanel2 = new System.Windows.Forms.TableLayoutPanel();
this.tableLayoutPanel3 = new System.Windows.Forms.TableLayoutPanel();
((System.ComponentModel.ISupportInitialize)(this.ImagePictureBox)).BeginInit();
this.TabPanelDetails.SuspendLayout();
this.TabPageApplication.SuspendLayout();
this.TabPageAssemblies.SuspendLayout();
this.TabPageAssemblyDetails.SuspendLayout();
this.tableLayoutPanel1.SuspendLayout();
this.tableLayoutPanel4.SuspendLayout();
this.tableLayoutPanel2.SuspendLayout();
this.tableLayoutPanel3.SuspendLayout();
this.SuspendLayout();
//
// buttonDetails
//
this.buttonDetails.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.buttonDetails.AutoSize = true;
this.buttonDetails.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
this.buttonDetails.Location = new System.Drawing.Point(88, 3);
this.buttonDetails.MinimumSize = new System.Drawing.Size(76, 23);
this.buttonDetails.Name = "buttonDetails";
this.buttonDetails.Size = new System.Drawing.Size(76, 25);
this.buttonDetails.TabIndex = 25;
this.buttonDetails.Text = "Details";
this.buttonDetails.Click += new System.EventHandler(this.DetailsButton_Click);
//
// ImagePictureBox
//
this.ImagePictureBox.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("ImagePictureBox.BackgroundImage")));
this.ImagePictureBox.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
this.ImagePictureBox.Location = new System.Drawing.Point(3, 3);
this.ImagePictureBox.Name = "ImagePictureBox";
this.ImagePictureBox.Size = new System.Drawing.Size(36, 36);
this.ImagePictureBox.TabIndex = 24;
this.ImagePictureBox.TabStop = false;
//
// AppDateLabel
//
this.AppDateLabel.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.AppDateLabel.AutoSize = true;
this.AppDateLabel.Location = new System.Drawing.Point(3, 82);
this.AppDateLabel.Margin = new System.Windows.Forms.Padding(3);
this.AppDateLabel.Name = "AppDateLabel";
this.AppDateLabel.Size = new System.Drawing.Size(383, 15);
this.AppDateLabel.TabIndex = 23;
this.AppDateLabel.Text = "Built on %builddate%";
//
// buttonSystemInfo
//
this.buttonSystemInfo.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.buttonSystemInfo.AutoSize = true;
this.buttonSystemInfo.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
this.buttonSystemInfo.Location = new System.Drawing.Point(3, 3);
this.buttonSystemInfo.MinimumSize = new System.Drawing.Size(76, 23);
this.buttonSystemInfo.Name = "buttonSystemInfo";
this.buttonSystemInfo.Size = new System.Drawing.Size(79, 25);
this.buttonSystemInfo.TabIndex = 22;
this.buttonSystemInfo.Text = "System Info";
this.buttonSystemInfo.Visible = false;
this.buttonSystemInfo.Click += new System.EventHandler(this.SysInfoButton_Click);
//
// AppCopyrightLabel
//
this.AppCopyrightLabel.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.AppCopyrightLabel.AutoSize = true;
this.AppCopyrightLabel.Location = new System.Drawing.Point(3, 103);
this.AppCopyrightLabel.Margin = new System.Windows.Forms.Padding(3);
this.AppCopyrightLabel.Name = "AppCopyrightLabel";
this.AppCopyrightLabel.Size = new System.Drawing.Size(383, 15);
this.AppCopyrightLabel.TabIndex = 21;
this.AppCopyrightLabel.Text = "Copyright © %year%, %company%";
//
// AppVersionLabel
//
this.AppVersionLabel.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.AppVersionLabel.AutoSize = true;
this.AppVersionLabel.Location = new System.Drawing.Point(3, 61);
this.AppVersionLabel.Margin = new System.Windows.Forms.Padding(3);
this.AppVersionLabel.Name = "AppVersionLabel";
this.AppVersionLabel.Size = new System.Drawing.Size(383, 15);
this.AppVersionLabel.TabIndex = 20;
this.AppVersionLabel.Text = "Version %version%";
//
// AppDescriptionLabel
//
this.AppDescriptionLabel.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.AppDescriptionLabel.AutoSize = true;
this.AppDescriptionLabel.Location = new System.Drawing.Point(3, 24);
this.AppDescriptionLabel.Margin = new System.Windows.Forms.Padding(3);
this.AppDescriptionLabel.Name = "AppDescriptionLabel";
this.AppDescriptionLabel.Size = new System.Drawing.Size(86, 15);
this.AppDescriptionLabel.TabIndex = 19;
this.AppDescriptionLabel.Text = "%description%";
//
// GroupBox1
//
this.GroupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.GroupBox1.Location = new System.Drawing.Point(3, 53);
this.GroupBox1.Name = "GroupBox1";
this.GroupBox1.Size = new System.Drawing.Size(383, 2);
this.GroupBox1.TabIndex = 18;
this.GroupBox1.TabStop = false;
this.GroupBox1.Text = "GroupBox1";
//
// AppTitleLabel
//
this.AppTitleLabel.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.AppTitleLabel.AutoSize = true;
this.AppTitleLabel.Location = new System.Drawing.Point(3, 3);
this.AppTitleLabel.Margin = new System.Windows.Forms.Padding(3);
this.AppTitleLabel.Name = "AppTitleLabel";
this.AppTitleLabel.Size = new System.Drawing.Size(86, 15);
this.AppTitleLabel.TabIndex = 17;
this.AppTitleLabel.Text = "%title%";
//
// buttonOk
//
this.buttonOk.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.buttonOk.AutoSize = true;
this.buttonOk.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
this.buttonOk.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.buttonOk.Location = new System.Drawing.Point(170, 3);
this.buttonOk.MinimumSize = new System.Drawing.Size(76, 23);
this.buttonOk.Name = "buttonOk";
this.buttonOk.Size = new System.Drawing.Size(76, 25);
this.buttonOk.TabIndex = 16;
this.buttonOk.Text = "OK";
//
// MoreRichTextBox
//
this.MoreRichTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.MoreRichTextBox.BackColor = System.Drawing.SystemColors.ControlLight;
this.MoreRichTextBox.Location = new System.Drawing.Point(3, 124);
this.MoreRichTextBox.Name = "MoreRichTextBox";
this.MoreRichTextBox.ReadOnly = true;
this.MoreRichTextBox.ScrollBars = System.Windows.Forms.RichTextBoxScrollBars.Vertical;
this.MoreRichTextBox.Size = new System.Drawing.Size(383, 122);
this.MoreRichTextBox.TabIndex = 26;
this.MoreRichTextBox.Text = "%product% is %copyright%, %trademark%";
this.MoreRichTextBox.LinkClicked += new System.Windows.Forms.LinkClickedEventHandler(this.MoreRichTextBox_LinkClicked);
//
// TabPanelDetails
//
this.TabPanelDetails.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.TabPanelDetails.Controls.Add(this.TabPageApplication);
this.TabPanelDetails.Controls.Add(this.TabPageAssemblies);
this.TabPanelDetails.Controls.Add(this.TabPageAssemblyDetails);
this.TabPanelDetails.Location = new System.Drawing.Point(3, 252);
this.TabPanelDetails.Name = "TabPanelDetails";
this.TabPanelDetails.SelectedIndex = 0;
this.TabPanelDetails.Size = new System.Drawing.Size(383, 149);
this.TabPanelDetails.TabIndex = 27;
this.TabPanelDetails.Visible = false;
this.TabPanelDetails.SelectedIndexChanged += new System.EventHandler(this.TabPanelDetails_SelectedIndexChanged);
//
// TabPageApplication
//
this.TabPageApplication.Controls.Add(this.AppInfoListView);
this.TabPageApplication.Location = new System.Drawing.Point(4, 24);
this.TabPageApplication.Name = "TabPageApplication";
this.TabPageApplication.Size = new System.Drawing.Size(375, 121);
this.TabPageApplication.TabIndex = 0;
this.TabPageApplication.Text = "Application";
//
// AppInfoListView
//
this.AppInfoListView.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
this.colKey,
this.colValue});
this.AppInfoListView.Dock = System.Windows.Forms.DockStyle.Fill;
this.AppInfoListView.FullRowSelect = true;
this.AppInfoListView.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.Nonclickable;
this.AppInfoListView.Location = new System.Drawing.Point(0, 0);
this.AppInfoListView.Name = "AppInfoListView";
this.AppInfoListView.Size = new System.Drawing.Size(375, 121);
this.AppInfoListView.TabIndex = 16;
this.AppInfoListView.UseCompatibleStateImageBehavior = false;
this.AppInfoListView.View = System.Windows.Forms.View.Details;
//
// colKey
//
this.colKey.Text = "Application Key";
this.colKey.Width = 120;
//
// colValue
//
this.colValue.Text = "Value";
this.colValue.Width = 700;
//
// TabPageAssemblies
//
this.TabPageAssemblies.Controls.Add(this.AssemblyInfoListView);
this.TabPageAssemblies.Location = new System.Drawing.Point(4, 24);
this.TabPageAssemblies.Name = "TabPageAssemblies";
this.TabPageAssemblies.Size = new System.Drawing.Size(375, 109);
this.TabPageAssemblies.TabIndex = 1;
this.TabPageAssemblies.Text = "Assemblies";
//
// AssemblyInfoListView
//
this.AssemblyInfoListView.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
this.colAssemblyName,
this.colAssemblyVersion,
this.colAssemblyBuilt,
this.colAssemblyCodeBase});
this.AssemblyInfoListView.Dock = System.Windows.Forms.DockStyle.Fill;
this.AssemblyInfoListView.FullRowSelect = true;
this.AssemblyInfoListView.Location = new System.Drawing.Point(0, 0);
this.AssemblyInfoListView.MultiSelect = false;
this.AssemblyInfoListView.Name = "AssemblyInfoListView";
this.AssemblyInfoListView.Size = new System.Drawing.Size(375, 109);
this.AssemblyInfoListView.Sorting = System.Windows.Forms.SortOrder.Ascending;
this.AssemblyInfoListView.TabIndex = 13;
this.AssemblyInfoListView.UseCompatibleStateImageBehavior = false;
this.AssemblyInfoListView.View = System.Windows.Forms.View.Details;
this.AssemblyInfoListView.ColumnClick += new System.Windows.Forms.ColumnClickEventHandler(this.AssemblyInfoListView_ColumnClick);
this.AssemblyInfoListView.DoubleClick += new System.EventHandler(this.AssemblyInfoListView_DoubleClick);
//
// colAssemblyName
//
this.colAssemblyName.Text = "Assembly";
this.colAssemblyName.Width = 123;
//
// colAssemblyVersion
//
this.colAssemblyVersion.Text = "Version";
this.colAssemblyVersion.Width = 100;
//
// colAssemblyBuilt
//
this.colAssemblyBuilt.Text = "Built";
this.colAssemblyBuilt.Width = 130;
//
// colAssemblyCodeBase
//
this.colAssemblyCodeBase.Text = "CodeBase";
this.colAssemblyCodeBase.Width = 750;
//
// TabPageAssemblyDetails
//
this.TabPageAssemblyDetails.Controls.Add(this.AssemblyDetailsListView);
this.TabPageAssemblyDetails.Controls.Add(this.AssemblyNamesComboBox);
this.TabPageAssemblyDetails.Location = new System.Drawing.Point(4, 24);
this.TabPageAssemblyDetails.Name = "TabPageAssemblyDetails";
this.TabPageAssemblyDetails.Size = new System.Drawing.Size(375, 109);
this.TabPageAssemblyDetails.TabIndex = 2;
this.TabPageAssemblyDetails.Text = "Assembly Details";
//
// AssemblyDetailsListView
//
this.AssemblyDetailsListView.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
this.ColumnHeader1,
this.ColumnHeader2});
this.AssemblyDetailsListView.Dock = System.Windows.Forms.DockStyle.Fill;
this.AssemblyDetailsListView.FullRowSelect = true;
this.AssemblyDetailsListView.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.Nonclickable;
this.AssemblyDetailsListView.Location = new System.Drawing.Point(0, 23);
this.AssemblyDetailsListView.Name = "AssemblyDetailsListView";
this.AssemblyDetailsListView.Size = new System.Drawing.Size(375, 86);
this.AssemblyDetailsListView.Sorting = System.Windows.Forms.SortOrder.Ascending;
this.AssemblyDetailsListView.TabIndex = 19;
this.AssemblyDetailsListView.UseCompatibleStateImageBehavior = false;
this.AssemblyDetailsListView.View = System.Windows.Forms.View.Details;
//
// ColumnHeader1
//
this.ColumnHeader1.Text = "Assembly Key";
this.ColumnHeader1.Width = 120;
//
// ColumnHeader2
//
this.ColumnHeader2.Text = "Value";
this.ColumnHeader2.Width = 700;
//
// AssemblyNamesComboBox
//
this.AssemblyNamesComboBox.Dock = System.Windows.Forms.DockStyle.Top;
this.AssemblyNamesComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.AssemblyNamesComboBox.Location = new System.Drawing.Point(0, 0);
this.AssemblyNamesComboBox.Name = "AssemblyNamesComboBox";
this.AssemblyNamesComboBox.Size = new System.Drawing.Size(375, 23);
this.AssemblyNamesComboBox.Sorted = true;
this.AssemblyNamesComboBox.TabIndex = 18;
this.AssemblyNamesComboBox.SelectedIndexChanged += new System.EventHandler(this.AssemblyNamesComboBox_SelectedIndexChanged);
//
// tableLayoutPanel1
//
this.tableLayoutPanel1.AutoSize = true;
this.tableLayoutPanel1.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
this.tableLayoutPanel1.ColumnCount = 1;
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.tableLayoutPanel1.Controls.Add(this.tableLayoutPanel4, 0, 8);
this.tableLayoutPanel1.Controls.Add(this.tableLayoutPanel2, 0, 0);
this.tableLayoutPanel1.Controls.Add(this.AppCopyrightLabel, 0, 4);
this.tableLayoutPanel1.Controls.Add(this.AppDateLabel, 0, 3);
this.tableLayoutPanel1.Controls.Add(this.GroupBox1, 0, 1);
this.tableLayoutPanel1.Controls.Add(this.TabPanelDetails, 0, 7);
this.tableLayoutPanel1.Controls.Add(this.MoreRichTextBox, 0, 6);
this.tableLayoutPanel1.Controls.Add(this.AppVersionLabel, 0, 2);
this.tableLayoutPanel1.Location = new System.Drawing.Point(9, 7);
this.tableLayoutPanel1.Margin = new System.Windows.Forms.Padding(2);
this.tableLayoutPanel1.Name = "tableLayoutPanel1";
this.tableLayoutPanel1.RowCount = 9;
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanel1.Size = new System.Drawing.Size(389, 439);
this.tableLayoutPanel1.TabIndex = 28;
//
// tableLayoutPanel4
//
this.tableLayoutPanel4.AutoSize = true;
this.tableLayoutPanel4.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
this.tableLayoutPanel4.ColumnCount = 3;
this.tableLayoutPanel4.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
this.tableLayoutPanel4.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
this.tableLayoutPanel4.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
this.tableLayoutPanel4.Controls.Add(this.buttonSystemInfo, 0, 0);
this.tableLayoutPanel4.Controls.Add(this.buttonDetails, 1, 0);
this.tableLayoutPanel4.Controls.Add(this.buttonOk, 2, 0);
this.tableLayoutPanel4.Location = new System.Drawing.Point(2, 406);
this.tableLayoutPanel4.Margin = new System.Windows.Forms.Padding(2);
this.tableLayoutPanel4.Name = "tableLayoutPanel4";
this.tableLayoutPanel4.RowCount = 1;
this.tableLayoutPanel4.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanel4.Size = new System.Drawing.Size(249, 31);
this.tableLayoutPanel4.TabIndex = 29;
//
// tableLayoutPanel2
//
this.tableLayoutPanel2.AutoSize = true;
this.tableLayoutPanel2.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
this.tableLayoutPanel2.ColumnCount = 2;
this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 313F));
this.tableLayoutPanel2.Controls.Add(this.ImagePictureBox, 0, 0);
this.tableLayoutPanel2.Controls.Add(this.tableLayoutPanel3, 1, 0);
this.tableLayoutPanel2.Location = new System.Drawing.Point(2, 2);
this.tableLayoutPanel2.Margin = new System.Windows.Forms.Padding(2);
this.tableLayoutPanel2.Name = "tableLayoutPanel2";
this.tableLayoutPanel2.RowCount = 1;
this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanel2.Size = new System.Drawing.Size(355, 46);
this.tableLayoutPanel2.TabIndex = 29;
//
// tableLayoutPanel3
//
this.tableLayoutPanel3.AutoSize = true;
this.tableLayoutPanel3.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
this.tableLayoutPanel3.ColumnCount = 1;
this.tableLayoutPanel3.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
this.tableLayoutPanel3.Controls.Add(this.AppTitleLabel, 0, 0);
this.tableLayoutPanel3.Controls.Add(this.AppDescriptionLabel, 0, 1);
this.tableLayoutPanel3.Location = new System.Drawing.Point(44, 2);
this.tableLayoutPanel3.Margin = new System.Windows.Forms.Padding(2);
this.tableLayoutPanel3.Name = "tableLayoutPanel3";
this.tableLayoutPanel3.RowCount = 2;
this.tableLayoutPanel3.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanel3.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanel3.Size = new System.Drawing.Size(92, 42);
this.tableLayoutPanel3.TabIndex = 25;
//
// AboutBox
//
this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
this.AutoSize = true;
this.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
this.CancelButton = this.buttonOk;
this.ClientSize = new System.Drawing.Size(402, 492);
this.Controls.Add(this.tableLayoutPanel1);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "AboutBox";
this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "About %title%";
this.Load += new System.EventHandler(this.AboutBox_Load);
this.Paint += new System.Windows.Forms.PaintEventHandler(this.AboutBox_Paint);
((System.ComponentModel.ISupportInitialize)(this.ImagePictureBox)).EndInit();
this.TabPanelDetails.ResumeLayout(false);
this.TabPageApplication.ResumeLayout(false);
this.TabPageAssemblies.ResumeLayout(false);
this.TabPageAssemblyDetails.ResumeLayout(false);
this.tableLayoutPanel1.ResumeLayout(false);
this.tableLayoutPanel1.PerformLayout();
this.tableLayoutPanel4.ResumeLayout(false);
this.tableLayoutPanel4.PerformLayout();
this.tableLayoutPanel2.ResumeLayout(false);
this.tableLayoutPanel2.PerformLayout();
this.tableLayoutPanel3.ResumeLayout(false);
this.tableLayoutPanel3.PerformLayout();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Button buttonDetails;
private System.Windows.Forms.PictureBox ImagePictureBox;
private System.Windows.Forms.Label AppDateLabel;
private System.Windows.Forms.Button buttonSystemInfo;
private System.Windows.Forms.Label AppCopyrightLabel;
private System.Windows.Forms.Label AppVersionLabel;
private System.Windows.Forms.Label AppDescriptionLabel;
private System.Windows.Forms.GroupBox GroupBox1;
private System.Windows.Forms.Label AppTitleLabel;
private System.Windows.Forms.Button buttonOk;
internal System.Windows.Forms.RichTextBox MoreRichTextBox;
internal System.Windows.Forms.TabControl TabPanelDetails;
internal System.Windows.Forms.TabPage TabPageApplication;
internal System.Windows.Forms.ListView AppInfoListView;
internal System.Windows.Forms.ColumnHeader colKey;
internal System.Windows.Forms.ColumnHeader colValue;
internal System.Windows.Forms.TabPage TabPageAssemblies;
internal System.Windows.Forms.ListView AssemblyInfoListView;
internal System.Windows.Forms.ColumnHeader colAssemblyName;
internal System.Windows.Forms.ColumnHeader colAssemblyVersion;
internal System.Windows.Forms.ColumnHeader colAssemblyBuilt;
internal System.Windows.Forms.ColumnHeader colAssemblyCodeBase;
internal System.Windows.Forms.TabPage TabPageAssemblyDetails;
internal System.Windows.Forms.ListView AssemblyDetailsListView;
internal System.Windows.Forms.ColumnHeader ColumnHeader1;
internal System.Windows.Forms.ColumnHeader ColumnHeader2;
internal System.Windows.Forms.ComboBox AssemblyNamesComboBox;
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1;
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel2;
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel3;
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel4;
}
}

View File

@@ -0,0 +1,810 @@
// <copyright file="AboutBox.cs" company="PlaceholderCompany">
// Copyright (c) PlaceholderCompany. All rights reserved.
// </copyright>
namespace FSI.BT.Tools.Global.UserInterface
{
using System;
using System.Collections.Specialized;
using System.Drawing;
using System.Globalization;
using System.IO;
using System.Reflection;
using System.Text.RegularExpressions;
using System.Windows.Forms;
using Microsoft.Win32;
using FSI.BT.Tools.SystemTrayMenu.Utilities;
using FSI.BT.Tools.Global.Utilities;
/// <summary>
/// Generic, self-contained About Box dialog.
/// </summary>
/// <remarks>
/// Jeff Atwood
/// http://www.codinghorror.com
/// converted to C# by Scott Ferguson
/// http://www.forestmoon.com
/// .
/// </remarks>
internal partial class AboutBox : Form
{
private bool isPainted;
private string entryAssemblyName;
private string callingAssemblyName;
private string executingAssemblyName;
private NameValueCollection entryAssemblyAttribCollection;
public AboutBox()
{
InitializeComponent();
buttonOk.Text = Global.Utilities.Translator.GetText("OK");
buttonDetails.Text = Global.Utilities.Translator.GetText("Details");
buttonSystemInfo.Text = Global.Utilities.Translator.GetText("System Info");
Text = Global.Utilities.Translator.GetText("About FSI.BT.Tools");
}
// <summary>
// returns the entry assembly for the current application domain
// </summary>
// <remarks>
// This is usually read-only, but in some weird cases (Smart Client apps)
// you won't have an entry assembly, so you may want to set this manually.
// </remarks>
public Assembly AppEntryAssembly { get; set; }
// <summary>
// single line of text to show in the application title section of the about box dialog
// </summary>
// <remarks>
// defaults to "%title%"
// %title% = Assembly: AssemblyTitle
// </remarks>
public string AppTitle
{
get => AppTitleLabel.Text;
set => AppTitleLabel.Text = value;
}
// <summary>
// single line of text to show in the description section of the about box dialog
// </summary>
// <remarks>
// defaults to "%description%"
// %description% = Assembly: AssemblyDescription
// </remarks>
public string AppDescription
{
get => AppDescriptionLabel.Text;
set
{
if (string.IsNullOrEmpty(value))
{
AppDescriptionLabel.Visible = false;
}
else
{
AppDescriptionLabel.Visible = true;
AppDescriptionLabel.Text = value;
}
}
}
// <summary>
// single line of text to show in the version section of the about dialog
// </summary>
// <remarks>
// defaults to "Version %version%"
// %version% = Assembly: AssemblyVersion
// </remarks>
public string AppVersion
{
get => AppVersionLabel.Text;
set
{
if (string.IsNullOrEmpty(value))
{
AppVersionLabel.Visible = false;
}
else
{
AppVersionLabel.Visible = true;
AppVersionLabel.Text = value;
}
}
}
// <summary>
// single line of text to show in the copyright section of the about dialog
// </summary>
// <remarks>
// defaults to "Copyright © %year%, %company%"
// %company% = Assembly: AssemblyCompany
// %year% = current 4-digit year
// </remarks>
public string AppCopyright
{
get => AppCopyrightLabel.Text;
set
{
if (string.IsNullOrEmpty(value))
{
AppCopyrightLabel.Visible = false;
}
else
{
AppCopyrightLabel.Visible = true;
AppCopyrightLabel.Text = value;
}
}
}
// <summary>
// intended for the default 32x32 application icon to appear in the upper left of the about dialog
// </summary>
// <remarks>
// if you open this form using .ShowDialog(Owner), the icon can be derived from the owning form
// </remarks>
public Image AppImage
{
get => ImagePictureBox.Image;
set => ImagePictureBox.Image = value;
}
// <summary>
// multiple lines of miscellaneous text to show in rich text box
// </summary>
// <remarks>
// defaults to "%product% is %copyright%, %trademark%"
// %product% = Assembly: AssemblyProduct
// %copyright% = Assembly: AssemblyCopyright
// %trademark% = Assembly: AssemblyTrademark
// </remarks>
public string AppMoreInfo
{
get => MoreRichTextBox.Text;
set
{
if (string.IsNullOrEmpty(value))
{
MoreRichTextBox.Visible = false;
}
else
{
MoreRichTextBox.Visible = true;
MoreRichTextBox.Text = value;
}
}
}
// <summary>
// determines if the "Details" (advanced assembly details) button is shown
// </summary>
public bool AppDetailsButton
{
get => buttonDetails.Visible;
set => buttonDetails.Visible = value;
}
// <summary>
// exception-safe retrieval of LastWriteTime for this assembly.
// </summary>
// <returns>File.GetLastWriteTime, or DateTime.MaxValue if exception was encountered.</returns>
private static DateTime AssemblyLastWriteTime(Assembly a)
{
DateTime assemblyLastWriteTime = DateTime.MaxValue;
// Location property not available for dynamic assemblies
if (!a.IsDynamic)
{
if (!string.IsNullOrEmpty(a.Location))
{
assemblyLastWriteTime = File.GetLastWriteTime(a.Location);
}
}
return assemblyLastWriteTime;
}
// <summary>
// returns DateTime this Assembly was last built. Will attempt to calculate from build number, if possible.
// If not, the actual LastWriteTime on the assembly file will be returned.
// </summary>
// <param name="a">Assembly to get build date for</param>
// <param name="ForceFileDate">Don't attempt to use the build number to calculate the date</param>
// <returns>DateTime this assembly was last built</returns>
private static DateTime AssemblyBuildDate(Assembly a, bool forceFileDate)
{
Version assemblyVersion = a.GetName().Version;
DateTime dt;
if (forceFileDate)
{
dt = AssemblyLastWriteTime(a);
}
else
{
dt = DateTime.Parse("01/01/2000", CultureInfo.InvariantCulture).AddDays(assemblyVersion.Build).AddSeconds(assemblyVersion.Revision * 2);
#pragma warning disable CS0618
if (TimeZone.IsDaylightSavingTime(dt, TimeZone.CurrentTimeZone.GetDaylightChanges(dt.Year)))
#pragma warning restore CS0618
{
dt = dt.AddHours(1);
}
if (dt > DateTime.Now || assemblyVersion.Build < 730 || assemblyVersion.Revision == 0)
{
dt = AssemblyLastWriteTime(a);
}
}
return dt;
}
// <summary>
// returns string name / string value pair of all attribs
// for specified assembly
// </summary>
// <remarks>
// note that Assembly* values are pulled from AssemblyInfo file in project folder
//
// Trademark = AssemblyTrademark string
// Debuggable = true
// GUID = 7FDF68D5-8C6F-44C9-B391-117B5AFB5467
// CLSCompliant = true
// Product = AssemblyProduct string
// Copyright = AssemblyCopyright string
// Company = AssemblyCompany string
// Description = AssemblyDescription string
// Title = AssemblyTitle string
// </remarks>
private static NameValueCollection AssemblyAttribs(Assembly a)
{
string typeName;
string name;
string value;
NameValueCollection nvc = new();
Regex r = new(@"(\.Assembly|\.)(?<Name>[^.]*)Attribute$", RegexOptions.IgnoreCase);
foreach (object attrib in a.GetCustomAttributes(false))
{
typeName = attrib.GetType().ToString();
name = r.Match(typeName).Groups["Name"].ToString();
value = string.Empty;
switch (typeName)
{
case "System.CLSCompliantAttribute":
value = ((CLSCompliantAttribute)attrib).IsCompliant.ToString(CultureInfo.InvariantCulture); break;
case "System.Diagnostics.DebuggableAttribute":
value = ((System.Diagnostics.DebuggableAttribute)attrib).IsJITTrackingEnabled.ToString(CultureInfo.InvariantCulture); break;
case "System.Reflection.AssemblyCompanyAttribute":
value = ((AssemblyCompanyAttribute)attrib).Company.ToString(CultureInfo.InvariantCulture); break;
case "System.Reflection.AssemblyConfigurationAttribute":
value = ((AssemblyConfigurationAttribute)attrib).Configuration.ToString(CultureInfo.InvariantCulture); break;
case "System.Reflection.AssemblyCopyrightAttribute":
value = ((AssemblyCopyrightAttribute)attrib).Copyright.ToString(CultureInfo.InvariantCulture); break;
case "System.Reflection.AssemblyDefaultAliasAttribute":
value = ((AssemblyDefaultAliasAttribute)attrib).DefaultAlias.ToString(CultureInfo.InvariantCulture); break;
case "System.Reflection.AssemblyDelaySignAttribute":
value = ((AssemblyDelaySignAttribute)attrib).DelaySign.ToString(CultureInfo.InvariantCulture); break;
case "System.Reflection.AssemblyDescriptionAttribute":
value = ((AssemblyDescriptionAttribute)attrib).Description.ToString(CultureInfo.InvariantCulture); break;
case "System.Reflection.AssemblyInformationalVersionAttribute":
value = ((AssemblyInformationalVersionAttribute)attrib).InformationalVersion.ToString(CultureInfo.InvariantCulture); break;
case "System.Reflection.AssemblyKeyFileAttribute":
value = ((AssemblyKeyFileAttribute)attrib).KeyFile.ToString(CultureInfo.InvariantCulture); break;
case "System.Reflection.AssemblyProductAttribute":
value = ((AssemblyProductAttribute)attrib).Product.ToString(CultureInfo.InvariantCulture); break;
case "System.Reflection.AssemblyTrademarkAttribute":
value = ((AssemblyTrademarkAttribute)attrib).Trademark.ToString(CultureInfo.InvariantCulture); break;
case "System.Reflection.AssemblyTitleAttribute":
value = ((AssemblyTitleAttribute)attrib).Title.ToString(CultureInfo.InvariantCulture); break;
case "System.Resources.NeutralResourcesLanguageAttribute":
value = ((System.Resources.NeutralResourcesLanguageAttribute)attrib).CultureName.ToString(CultureInfo.InvariantCulture); break;
case "System.Resources.SatelliteContractVersionAttribute":
value = ((System.Resources.SatelliteContractVersionAttribute)attrib).Version.ToString(CultureInfo.InvariantCulture); break;
case "System.Runtime.InteropServices.ComCompatibleVersionAttribute":
{
System.Runtime.InteropServices.ComCompatibleVersionAttribute x;
x = (System.Runtime.InteropServices.ComCompatibleVersionAttribute)attrib;
value = x.MajorVersion + "." + x.MinorVersion + "." + x.RevisionNumber + "." + x.BuildNumber;
break;
}
case "System.Runtime.InteropServices.ComVisibleAttribute":
value = ((System.Runtime.InteropServices.ComVisibleAttribute)attrib).Value.ToString(CultureInfo.InvariantCulture); break;
case "System.Runtime.InteropServices.GuidAttribute":
value = ((System.Runtime.InteropServices.GuidAttribute)attrib).Value.ToString(CultureInfo.InvariantCulture); break;
case "System.Runtime.InteropServices.TypeLibVersionAttribute":
{
System.Runtime.InteropServices.TypeLibVersionAttribute x;
x = (System.Runtime.InteropServices.TypeLibVersionAttribute)attrib;
value = x.MajorVersion + "." + x.MinorVersion;
break;
}
case "System.Security.AllowPartiallyTrustedCallersAttribute":
value = "(Present)"; break;
default:
// debug.writeline("** unknown assembly attribute '" + TypeName + "'")
value = typeName; break;
}
if (nvc[name] == null)
{
nvc.Add(name, value);
}
}
// add some extra values that are not in the AssemblyInfo, but nice to have
// codebase
try
{
if (!a.IsDynamic)
{
nvc.Add("CodeBase", a.Location.Replace("file:///", string.Empty, StringComparison.InvariantCulture));
}
}
catch (NotSupportedException)
{
nvc.Add("CodeBase", "(not supported)");
}
// build date
DateTime dt = AssemblyBuildDate(a, false);
if (dt == DateTime.MaxValue)
{
nvc.Add("BuildDate", "(unknown)");
}
else
{
nvc.Add("BuildDate", dt.ToString("yyyy-MM-dd hh:mm tt", CultureInfo.InvariantCulture));
}
// location
try
{
if (!a.IsDynamic)
{
nvc.Add("Location", a.Location);
}
}
catch (NotSupportedException)
{
nvc.Add("Location", "(not supported)");
}
string version = "(unknown)";
AssemblyName assemblyName = a.GetName();
if (assemblyName.Version != null &&
(assemblyName.Version.Major != 0 || assemblyName.Version.Minor != 0))
{
if (!a.IsDynamic)
{
version = a.GetName().Version.ToString();
}
}
nvc.Add("Version", version);
if (!a.IsDynamic)
{
nvc.Add("FullName", a.FullName);
}
return nvc;
}
// <summary>
// reads an HKLM Windows Registry key value
// </summary>
private static string RegistryHklmValue(string keyName, string subKeyRef)
{
string strSysInfoPath = string.Empty;
try
{
RegistryKey rk = Registry.LocalMachine.OpenSubKey(keyName);
strSysInfoPath = (string)rk.GetValue(subKeyRef, string.Empty);
}
catch (Exception ex)
{
Log.Warn($"KeyName:'{keyName}' SubKeyRef:'{subKeyRef}'", ex);
}
return strSysInfoPath;
}
// <summary>
// populate a listview with the specified key and value strings
// </summary>
private static void Populate(ListView lvw, string key, string value)
{
if (!string.IsNullOrEmpty(value))
{
ListViewItem lvi = new()
{
Text = key,
};
lvi.SubItems.Add(value);
lvw.Items.Add(lvi);
}
}
// <summary>
// populate details for a single assembly
// </summary>
private static void PopulateAssemblyDetails(Assembly a, ListView lvw)
{
lvw.Items.Clear();
Populate(lvw, "Image Runtime Version", a.ImageRuntimeVersion);
NameValueCollection nvc = AssemblyAttribs(a);
foreach (string strKey in nvc)
{
Populate(lvw, strKey, nvc[strKey]);
}
}
// <summary>
// matches assembly by Assembly.GetName.Name; returns nothing if no match
// </summary>
private static Assembly MatchAssemblyByName(string assemblyName)
{
foreach (Assembly a in AppDomain.CurrentDomain.GetAssemblies())
{
if (a.GetName().Name == assemblyName)
{
return a;
}
}
return null;
}
private void TabPanelDetails_SelectedIndexChanged(object sender, EventArgs e)
{
if (TabPanelDetails.SelectedTab == TabPageAssemblyDetails)
{
AssemblyNamesComboBox.Focus();
}
}
// <summary>
// launch the MSInfo "system information" application (works on XP, 2003, and Vista)
// </summary>
private void ShowSysInfo()
{
string strSysInfoPath = RegistryHklmValue(@"SOFTWARE\Microsoft\Shared Tools Location", "MSINFO");
if (string.IsNullOrEmpty(strSysInfoPath))
{
strSysInfoPath = RegistryHklmValue(@"SOFTWARE\Microsoft\Shared Tools\MSINFO", "PATH");
}
if (string.IsNullOrEmpty(strSysInfoPath))
{
MessageBox.Show(
"System Information is unavailable at this time." +
Environment.NewLine + Environment.NewLine +
"(couldn't find path for Microsoft System Information Tool in the registry.)",
Text,
MessageBoxButtons.OK,
MessageBoxIcon.Warning);
return;
}
Log.ProcessStart(strSysInfoPath);
}
// <summary>
// populates the Application Information listview
// </summary>
private void PopulateAppInfo()
{
AppDomain d = AppDomain.CurrentDomain;
Populate(AppInfoListView, "Application Name", Assembly.GetEntryAssembly().GetName().Name);
Populate(AppInfoListView, "Application Base", d.SetupInformation.ApplicationBase);
Populate(AppInfoListView, "Friendly Name", d.FriendlyName);
Populate(AppInfoListView, " ", " ");
Populate(AppInfoListView, "Entry Assembly", entryAssemblyName);
Populate(AppInfoListView, "Executing Assembly", executingAssemblyName);
Populate(AppInfoListView, "Calling Assembly", callingAssemblyName);
}
// <summary>
// populate Assembly Information listview with ALL assemblies
// </summary>
private void PopulateAssemblies()
{
foreach (Assembly a in AppDomain.CurrentDomain.GetAssemblies())
{
PopulateAssemblySummary(a);
}
AssemblyNamesComboBox.SelectedIndex = AssemblyNamesComboBox.FindStringExact(entryAssemblyName);
}
// <summary>
// populate Assembly Information listview with summary view for a specific assembly
// </summary>
private void PopulateAssemblySummary(Assembly a)
{
NameValueCollection nvc = AssemblyAttribs(a);
string strAssemblyName = a.GetName().Name;
ListViewItem lvi = new()
{
Text = strAssemblyName,
Tag = strAssemblyName,
};
if (strAssemblyName == callingAssemblyName)
{
lvi.Text += " (calling)";
}
if (strAssemblyName == executingAssemblyName)
{
lvi.Text += " (executing)";
}
if (strAssemblyName == entryAssemblyName)
{
lvi.Text += " (entry)";
}
lvi.SubItems.Add(nvc["version"]);
lvi.SubItems.Add(nvc["builddate"]);
lvi.SubItems.Add(nvc["codebase"]);
AssemblyInfoListView.Items.Add(lvi);
AssemblyNamesComboBox.Items.Add(strAssemblyName);
}
// <summary>
// retrieves a cached value from the entry assembly attribute lookup collection
// </summary>
private string EntryAssemblyAttrib(string strName)
{
if (entryAssemblyAttribCollection[strName] == null)
{
return "<Assembly: Assembly" + strName + "(\"\")>";
}
else
{
return entryAssemblyAttribCollection[strName].ToString(CultureInfo.InvariantCulture);
}
}
// <summary>
// Populate all the form labels with tokenized text
// </summary>
private void PopulateLabels()
{
// get entry assembly attribs
entryAssemblyAttribCollection = AssemblyAttribs(AppEntryAssembly);
// set icon from parent, if present
if (Owner != null)
{
Icon = Owner.Icon;
ImagePictureBox.Image = Icon.ToBitmap();
}
// replace all labels and window title
Text = ReplaceTokens(Text);
AppTitleLabel.Text = ReplaceTokens(AppTitleLabel.Text);
if (AppDescriptionLabel.Visible)
{
AppDescriptionLabel.Text = ReplaceTokens(AppDescriptionLabel.Text);
}
if (AppCopyrightLabel.Visible)
{
AppCopyrightLabel.Text = ReplaceTokens(AppCopyrightLabel.Text);
}
if (AppVersionLabel.Visible)
{
AppVersionLabel.Text = ReplaceTokens(AppVersionLabel.Text);
}
if (AppDateLabel.Visible)
{
AppDateLabel.Text = ReplaceTokens(AppDateLabel.Text);
}
if (MoreRichTextBox.Visible)
{
MoreRichTextBox.Text = ReplaceTokens(MoreRichTextBox.Text);
}
}
// <summary>
// perform assemblyinfo to string replacements on labels
// </summary>
private string ReplaceTokens(string s)
{
s = s.Replace("%title%", EntryAssemblyAttrib("title"), StringComparison.InvariantCulture);
s = s.Replace("%copyright%", EntryAssemblyAttrib("copyright"), StringComparison.InvariantCulture);
s = s.Replace("%description%", EntryAssemblyAttrib("description"), StringComparison.InvariantCulture);
s = s.Replace("%company%", EntryAssemblyAttrib("company"), StringComparison.InvariantCulture);
s = s.Replace("%product%", EntryAssemblyAttrib("product"), StringComparison.InvariantCulture);
s = s.Replace("%trademark%", EntryAssemblyAttrib("trademark"), StringComparison.InvariantCulture);
s = s.Replace("%year%", DateTime.Now.Year.ToString(CultureInfo.InvariantCulture), StringComparison.InvariantCulture);
s = s.Replace("%version%", EntryAssemblyAttrib("version"), StringComparison.InvariantCulture);
s = s.Replace("%builddate%", EntryAssemblyAttrib("builddate"), StringComparison.InvariantCulture);
return s;
}
// <summary>
// things to do when form is loaded
// </summary>
private void AboutBox_Load(object sender, EventArgs e)
{
// if the user didn't provide an assembly, try to guess which one is the entry assembly
if (AppEntryAssembly == null)
{
AppEntryAssembly = Assembly.GetEntryAssembly();
}
if (AppEntryAssembly == null)
{
AppEntryAssembly = Assembly.GetExecutingAssembly();
}
executingAssemblyName = Assembly.GetExecutingAssembly().GetName().Name;
callingAssemblyName = Assembly.GetCallingAssembly().GetName().Name;
// for web hosted apps, GetEntryAssembly = nothing
entryAssemblyName = Assembly.GetEntryAssembly().GetName().Name;
TabPanelDetails.Visible = false;
if (!MoreRichTextBox.Visible)
{
Height -= MoreRichTextBox.Height;
}
}
// <summary>
// things to do when form is FIRST painted
// </summary>
private void AboutBox_Paint(object sender, PaintEventArgs e)
{
if (!isPainted)
{
isPainted = true;
Application.DoEvents();
Cursor.Current = Cursors.WaitCursor;
PopulateLabels();
Cursor.Current = Cursors.Default;
}
}
// <summary>
// expand about dialog to show additional advanced details
// </summary>
private void DetailsButton_Click(object sender, EventArgs e)
{
Cursor.Current = Cursors.WaitCursor;
buttonDetails.Visible = false;
SuspendLayout();
MaximizeBox = true;
FormBorderStyle = FormBorderStyle.Sizable;
TabPanelDetails.Dock = DockStyle.Fill;
tableLayoutPanel1.Dock = DockStyle.Fill;
AutoSize = false;
SizeGripStyle = SizeGripStyle.Show;
Size = new Size(580, Size.Height);
MoreRichTextBox.Visible = false;
TabPanelDetails.Visible = true;
buttonSystemInfo.Visible = true;
PopulateAssemblies();
PopulateAppInfo();
CenterToParent();
ResumeLayout();
Cursor.Current = Cursors.Default;
}
// <summary>
// for detailed system info, launch the external Microsoft system info app
// </summary>
private void SysInfoButton_Click(object sender, EventArgs e)
{
ShowSysInfo();
}
// <summary>
// if an assembly is double-clicked, go to the detail page for that assembly
// </summary>
private void AssemblyInfoListView_DoubleClick(object sender, EventArgs e)
{
string strAssemblyName;
if (AssemblyInfoListView.SelectedItems.Count > 0)
{
strAssemblyName = Convert.ToString(AssemblyInfoListView.SelectedItems[0].Tag, CultureInfo.InvariantCulture);
AssemblyNamesComboBox.SelectedIndex = AssemblyNamesComboBox.FindStringExact(strAssemblyName);
TabPanelDetails.SelectedTab = TabPageAssemblyDetails;
}
}
// <summary>
// if a new assembly is selected from the combo box, show details for that assembly
// </summary>
private void AssemblyNamesComboBox_SelectedIndexChanged(object sender, EventArgs e)
{
string strAssemblyName = Convert.ToString(AssemblyNamesComboBox.SelectedItem, CultureInfo.InvariantCulture);
PopulateAssemblyDetails(MatchAssemblyByName(strAssemblyName), AssemblyDetailsListView);
}
// <summary>
// sort the assembly list by column
// </summary>
private void AssemblyInfoListView_ColumnClick(object sender, ColumnClickEventArgs e)
{
int intTargetCol = e.Column + 1;
if (AssemblyInfoListView.Tag != null)
{
if (Math.Abs(Convert.ToInt32(AssemblyInfoListView.Tag, CultureInfo.InvariantCulture)) == intTargetCol)
{
intTargetCol = -Convert.ToInt32(AssemblyInfoListView.Tag, CultureInfo.InvariantCulture);
}
}
AssemblyInfoListView.Tag = intTargetCol;
AssemblyInfoListView.ListViewItemSorter = new ListViewItemComparer(intTargetCol, true);
}
// <summary>
// launch any http:// or mailto: links clicked in the body of the rich text box
// </summary>
private void MoreRichTextBox_LinkClicked(object sender, LinkClickedEventArgs e)
{
Log.ProcessStart(e.LinkText);
}
// <summary>
// things to do when the selected tab is changed
// </summary>
private class ListViewItemComparer : System.Collections.IComparer
{
private readonly int intCol;
private readonly bool isAscending = true;
public ListViewItemComparer()
{
intCol = 0;
isAscending = true;
}
public ListViewItemComparer(int column, bool ascending)
{
if (column < 0)
{
isAscending = false;
}
else
{
isAscending = ascending;
}
intCol = Math.Abs(column) - 1;
}
public int Compare(object x, object y)
{
int intResult = string.Compare(
((ListViewItem)x).SubItems[intCol].Text,
((ListViewItem)y).SubItems[intCol].Text,
StringComparison.Ordinal);
if (isAscending)
{
return intResult;
}
else
{
return -intResult;
}
}
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,170 @@
// <copyright file="FolderDialog.cs" company="PlaceholderCompany">
// Copyright (c) PlaceholderCompany. All rights reserved.
// </copyright>
namespace FSI.BT.Tools.Global.UserInterface.FolderBrowseDialog
{
using System;
using System.IO;
using System.Runtime.InteropServices;
using System.Windows.Forms;
using FSI.BT.Tools.Global.Utilities;
using FSI.BT.Tools.SystemTrayMenu.Utilities;
public class FolderDialog : IFolderDialog, IDisposable
{
private bool isDisposed;
~FolderDialog() // the finalizer
{
Dispose(false);
}
/// <summary>
/// Gets or sets /sets folder in which dialog will be open.
/// </summary>
public string InitialFolder { get; set; }
/// <summary>
/// Gets or sets /sets directory in which dialog will be open
/// if there is no recent directory available.
/// </summary>
public string DefaultFolder { get; set; }
/// <summary>
/// Gets or sets selected folder.
/// </summary>
public string Folder { get; set; }
public DialogResult ShowDialog()
{
return ShowDialog(owner: new WindowWrapper(IntPtr.Zero));
}
public DialogResult ShowDialog(IWin32Window owner)
{
if (Environment.OSVersion.Version.Major >= 6)
{
return ShowVistaDialog(owner);
}
else
{
return ShowLegacyDialog(owner);
}
}
public DialogResult ShowVistaDialog(IWin32Window owner)
{
NativeMethods.IFileDialog frm = (NativeMethods.IFileDialog)new NativeMethods.FileOpenDialogRCW();
frm.GetOptions(out uint options);
options |= NativeMethods.FOS_PICKFOLDERS |
NativeMethods.FOS_FORCEFILESYSTEM |
NativeMethods.FOS_NOVALIDATE |
NativeMethods.FOS_NOTESTFILECREATE |
NativeMethods.FOS_DONTADDTORECENT;
frm.SetOptions(options);
if (InitialFolder != null)
{
Guid riid = new("43826D1E-E718-42EE-BC55-A1E261C37BFE"); // IShellItem
if (NativeMethods.SHCreateItemFromParsingName(
InitialFolder,
IntPtr.Zero,
ref riid,
out NativeMethods.IShellItem directoryShellItem) == NativeMethods.S_OK)
{
frm.SetFolder(directoryShellItem);
}
}
if (DefaultFolder != null)
{
Guid riid = new("43826D1E-E718-42EE-BC55-A1E261C37BFE"); // IShellItem
if (NativeMethods.SHCreateItemFromParsingName(
DefaultFolder,
IntPtr.Zero,
ref riid,
out NativeMethods.IShellItem directoryShellItem) == NativeMethods.S_OK)
{
frm.SetDefaultFolder(directoryShellItem);
}
}
if (owner != null && frm.Show(owner.Handle) == NativeMethods.S_OK)
{
try
{
if (frm.GetResult(out NativeMethods.IShellItem shellItem) == NativeMethods.S_OK)
{
if (shellItem.GetDisplayName(
NativeMethods.SIGDN_FILESYSPATH,
out IntPtr pszString) == NativeMethods.S_OK)
{
if (pszString != IntPtr.Zero)
{
try
{
Folder = Marshal.PtrToStringAuto(pszString);
return DialogResult.OK;
}
finally
{
Marshal.FreeCoTaskMem(pszString);
}
}
}
}
}
catch (Exception ex)
{
Log.Warn("Folder Dialog failed", ex);
}
}
return DialogResult.Cancel;
}
public DialogResult ShowLegacyDialog(IWin32Window owner)
{
using SaveFileDialog frm = new()
{
CheckFileExists = false,
CheckPathExists = true,
CreatePrompt = false,
Filter = "|" + Guid.Empty.ToString(),
FileName = "any",
};
if (InitialFolder != null)
{
frm.InitialDirectory = InitialFolder;
}
frm.OverwritePrompt = false;
frm.Title = Global.Utilities.Translator.GetText("Select directory");
frm.ValidateNames = false;
if (frm.ShowDialog(owner) == DialogResult.OK)
{
Folder = Path.GetDirectoryName(frm.FileName);
return DialogResult.OK;
}
else
{
return DialogResult.Cancel;
}
}
public void Dispose()
{
Dispose(true);
GC.SuppressFinalize(this);
}
protected virtual void Dispose(bool disposing)
{
if (!isDisposed)
{
}
isDisposed = true;
}
}
}

View File

@@ -0,0 +1,27 @@
// <copyright file="IFolderDialog.cs" company="PlaceholderCompany">
// Copyright (c) PlaceholderCompany. All rights reserved.
// </copyright>
namespace FSI.BT.Tools.Global.UserInterface.FolderBrowseDialog
{
using System.Windows.Forms;
public interface IFolderDialog
{
string InitialFolder { get; set; }
string DefaultFolder { get; set; }
string Folder { get; set; }
DialogResult ShowDialog();
DialogResult ShowDialog(IWin32Window owner);
DialogResult ShowVistaDialog(IWin32Window owner);
DialogResult ShowLegacyDialog(IWin32Window owner);
void Dispose();
}
}

View File

@@ -0,0 +1,146 @@
// <copyright file="NativeMethods.cs" company="PlaceholderCompany">
// Copyright (c) PlaceholderCompany. All rights reserved.
// </copyright>
namespace FSI.BT.Tools.Global.UserInterface.FolderBrowseDialog
{
using System;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
internal static class NativeMethods
{
public const uint FOS_PICKFOLDERS = 0x00000020;
public const uint FOS_FORCEFILESYSTEM = 0x00000040;
public const uint FOS_NOVALIDATE = 0x00000100;
public const uint FOS_NOTESTFILECREATE = 0x00010000;
public const uint FOS_DONTADDTORECENT = 0x02000000;
public const uint S_OK = 0x0000;
public const uint SIGDN_FILESYSPATH = 0x80058000;
[ComImport]
[Guid("42F85136-DB7E-439C-85F1-E4075D135FC8")]
[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
internal interface IFileDialog
{
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
[PreserveSig]
uint Show([In, Optional] IntPtr hwndOwner);
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
uint SetFileTypes([In] uint cFileTypes, [In, MarshalAs(UnmanagedType.LPArray)] IntPtr rgFilterSpec);
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
uint SetFileTypeIndex([In] uint iFileType);
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
uint GetFileTypeIndex(out uint piFileType);
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
uint Advise(
[In, MarshalAs(UnmanagedType.Interface)] IntPtr pfde,
out uint pdwCookie);
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
uint Unadvise([In] uint dwCookie);
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
uint SetOptions([In] uint fos);
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
uint GetOptions(out uint fos);
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
void SetDefaultFolder([In, MarshalAs(UnmanagedType.Interface)] IShellItem psi);
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
uint SetFolder([In, MarshalAs(UnmanagedType.Interface)] IShellItem psi);
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
uint GetFolder([MarshalAs(UnmanagedType.Interface)] out IShellItem ppsi);
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
uint GetCurrentSelection([MarshalAs(UnmanagedType.Interface)] out IShellItem ppsi);
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
uint SetFileName([In, MarshalAs(UnmanagedType.LPWStr)] string pszName);
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
uint GetFileName([MarshalAs(UnmanagedType.LPWStr)] out string pszName);
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
uint SetTitle([In, MarshalAs(UnmanagedType.LPWStr)] string pszTitle);
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
uint SetOkButtonLabel([In, MarshalAs(UnmanagedType.LPWStr)] string pszText);
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
uint SetFileNameLabel([In, MarshalAs(UnmanagedType.LPWStr)] string pszLabel);
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
uint GetResult([MarshalAs(UnmanagedType.Interface)] out IShellItem ppsi);
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
uint AddPlace([In, MarshalAs(UnmanagedType.Interface)] IShellItem psi, uint fdap);
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
uint SetDefaultExtension([In, MarshalAs(UnmanagedType.LPWStr)]
string pszDefaultExtension);
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
uint Close([MarshalAs(UnmanagedType.Error)] uint hr);
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
uint SetClientGuid([In] ref Guid guid);
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
uint ClearClientData();
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
uint SetFilter([MarshalAs(UnmanagedType.Interface)] IntPtr pFilter);
}
[ComImport]
[Guid("43826D1E-E718-42EE-BC55-A1E261C37BFE")]
[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
internal interface IShellItem
{
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
uint BindToHandler(
[In] IntPtr pbc,
[In] ref Guid rbhid,
[In] ref Guid riid,
[Out, MarshalAs(UnmanagedType.Interface)] out IntPtr ppvOut);
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
uint GetParent([MarshalAs(UnmanagedType.Interface)] out IShellItem ppsi);
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
uint GetDisplayName([In] uint sigdnName, out IntPtr ppszName);
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
uint GetAttributes([In] uint sfgaoMask, out uint psfgaoAttribs);
[MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
uint Compare([In, MarshalAs(UnmanagedType.Interface)] IShellItem psi, [In] uint hint, out int piOrder);
}
[DllImport("shell32.dll", SetLastError = true, CharSet = CharSet.Unicode)]
[DefaultDllImportSearchPaths(DllImportSearchPath.UserDirectories)]
internal static extern int SHCreateItemFromParsingName(
[MarshalAs(UnmanagedType.LPWStr)] string pszPath,
IntPtr pbc,
ref Guid riid,
[MarshalAs(UnmanagedType.Interface)] out IShellItem ppv);
[ComImport]
[ClassInterface(ClassInterfaceType.None)]
[TypeLibType(TypeLibTypeFlags.FCanCreate)]
[Guid("DC1C5A9C-E88A-4DDE-A5A1-60F82A20AEF7")]
internal class FileOpenDialogRCW
{
}
}
}

View File

@@ -0,0 +1,25 @@
// <copyright file="WindowWrapper.cs" company="PlaceholderCompany">
// Copyright (c) PlaceholderCompany. All rights reserved.
// </copyright>
namespace FSI.BT.Tools.Global.UserInterface.FolderBrowseDialog
{
using System;
public class WindowWrapper : System.Windows.Forms.IWin32Window
{
/// <summary>
/// Initializes a new instance of the <see cref="WindowWrapper"/> class.
/// </summary>
/// <param name="handle">Handle to wrap.</param>
public WindowWrapper(IntPtr handle)
{
Handle = handle;
}
/// <summary>
/// Gets original ptr.
/// </summary>
public IntPtr Handle { get; }
}
}

View File

@@ -0,0 +1,32 @@
// <copyright file="EventDelay.cs" company="PlaceholderCompany">
// Copyright (c) PlaceholderCompany. All rights reserved.
// </copyright>
namespace FSI.BT.Tools.Global.UserInterface.HotkeyTextboxControl
{
using System;
public class EventDelay
{
private readonly long waitTime;
private long lastCheck;
public EventDelay(long ticks)
{
waitTime = ticks;
}
public bool Check()
{
#pragma warning disable CA2002
lock (this)
#pragma warning restore CA2002
{
long now = DateTime.Now.Ticks;
bool isPassed = now - lastCheck > waitTime;
lastCheck = now;
return isPassed;
}
}
}
}

View File

@@ -0,0 +1,604 @@
// <copyright file="HotkeyControl.cs" company="PlaceholderCompany">
// Copyright (c) PlaceholderCompany. All rights reserved.
// </copyright>
namespace FSI.BT.Tools.Global.UserInterface.HotkeyTextboxControl
{
using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
using FSI.BT.Tools.Global.DllImports;
using FSI.BT.Tools.Global.Utilities;
using FSI.BT.Tools.SystemTrayMenu.Utilities;
/// <summary>
/// A simple control that allows the user to select pretty much any valid hotkey combination
/// See: http://www.codeproject.com/KB/buttons/hotkeycontrol.aspx
/// But is modified to fit in Greenshot, and have localized support.
/// modfied to fit SystemTrayMenu.
/// </summary>
public sealed class HotkeyControl : TextBox
{
private static readonly bool IsWindows7OrOlder = Environment.OSVersion.Version.Major >= 6 && Environment.OSVersion.Version.Minor >= 1;
private static readonly IntPtr HotkeyHwnd = (IntPtr)0x0000000000000000;
// Holds the list of hotkeys
private static readonly IDictionary<int, HotKeyHandler> KeyHandlers = new Dictionary<int, HotKeyHandler>();
private static int hotKeyCounter = 1;
// ArrayLists used to enforce the use of proper modifiers.
// Shift+A isn't a valid hotkey, for instance, as it would screw up when the user is typing.
private readonly IList<int> needNonShiftModifier = new List<int>();
private readonly IList<int> needNonAltGrModifier = new List<int>();
private readonly ContextMenuStrip dummy = new();
// These variables store the current hotkey and modifier(s)
private Keys hotkey = Keys.None;
private Keys modifiers = Keys.None;
/// <summary>
/// Initializes a new instance of the <see cref="HotkeyControl"/> class.
/// </summary>
public HotkeyControl()
{
ContextMenuStrip = dummy; // Disable right-clicking
Text = string.Empty;
// Handle events that occurs when keys are pressed
KeyPress += HotkeyControl_KeyPress;
KeyUp += HotkeyControl_KeyUp;
KeyDown += HotkeyControl_KeyDown;
PopulateModifierLists();
}
public delegate void HotKeyHandler();
private enum Modifiers
{
NONE = 0,
ALT = 1,
CTRL = 2,
SHIFT = 4,
WIN = 8,
NOREPEAT = 0x4000,
}
private enum MapType : uint
{
MAPVK_VK_TO_VSC = 0, // The uCode parameter is a virtual-key code and is translated into a scan code. If it is a virtual-key code that does not distinguish between left- and right-hand keys, the left-hand scan code is returned. If there is no translation, the function returns 0.
MAPVK_VSC_TO_VK = 1, // The uCode parameter is a scan code and is translated into a virtual-key code that does not distinguish between left- and right-hand keys. If there is no translation, the function returns 0.
MAPVK_VK_TO_CHAR = 2, // The uCode parameter is a virtual-key code and is translated into an unshifted character value in the low order word of the return value. Dead keys (diacritics) are indicated by setting the top bit of the return value. If there is no translation, the function returns 0.
MAPVK_VSC_TO_VK_EX = 3, // The uCode parameter is a scan code and is translated into a virtual-key code that distinguishes between left- and right-hand keys. If there is no translation, the function returns 0.
MAPVK_VK_TO_VSC_EX = 4, // The uCode parameter is a virtual-key code and is translated into a scan code. If it is a virtual-key code that does not distinguish between left- and right-hand keys, the left-hand scan code is returned. If the scan code is an extended scan code, the high byte of the uCode value can contain either 0xe0 or 0xe1 to specify the extended scan code. If there is no translation, the function returns 0.
}
/// <summary>
/// Gets or sets used to make sure that there is no right-click menu available.
/// </summary>
public override ContextMenuStrip ContextMenuStrip
{
get => dummy;
set => base.ContextMenuStrip = dummy;
}
/// <summary>
/// Gets or sets a value indicating whether forces the control to be non-multiline.
/// </summary>
public override bool Multiline
{
get => base.Multiline;
set => base.Multiline = false;
}
/// <summary>
/// Gets or sets used to get/set the hotkey (e.g. Keys.A).
/// </summary>
public Keys Hotkey
{
get => hotkey;
set
{
hotkey = value;
Redraw(true);
}
}
/// <summary>
/// Gets or sets used to get/set the modifier keys (e.g. Keys.Alt | Keys.Control).
/// </summary>
public Keys HotkeyModifiers
{
get => modifiers;
set
{
modifiers = value;
Redraw(true);
}
}
public static string HotkeyToString(Keys modifierKeyCode, Keys virtualKeyCode)
{
return HotkeyModifiersToString(modifierKeyCode) + virtualKeyCode;
}
public static string HotkeyModifiersToString(Keys modifierKeyCode)
{
StringBuilder hotkeyString = new();
if ((modifierKeyCode & Keys.Alt) > 0)
{
hotkeyString.Append("Alt").Append(" + ");
}
if ((modifierKeyCode & Keys.Control) > 0)
{
hotkeyString.Append("Ctrl").Append(" + ");
}
if ((modifierKeyCode & Keys.Shift) > 0)
{
hotkeyString.Append("Shift").Append(" + ");
}
if (modifierKeyCode == Keys.LWin || modifierKeyCode == Keys.RWin)
{
hotkeyString.Append("Win").Append(" + ");
}
return hotkeyString.ToString();
}
public static string HotkeyToLocalizedString(Keys modifierKeyCode, Keys virtualKeyCode)
{
return HotkeyModifiersToLocalizedString(modifierKeyCode) + GetKeyName(virtualKeyCode);
}
public static string HotkeyModifiersToLocalizedString(Keys modifierKeyCode)
{
StringBuilder hotkeyString = new();
if ((modifierKeyCode & Keys.Alt) > 0)
{
hotkeyString.Append(GetKeyName(Keys.Alt)).Append(" + ");
}
if ((modifierKeyCode & Keys.Control) > 0)
{
hotkeyString.Append(GetKeyName(Keys.Control)).Append(" + ");
}
if ((modifierKeyCode & Keys.Shift) > 0)
{
hotkeyString.Append(GetKeyName(Keys.Shift)).Append(" + ");
}
if (modifierKeyCode == Keys.LWin || modifierKeyCode == Keys.RWin)
{
hotkeyString.Append("Win").Append(" + ");
}
return hotkeyString.ToString();
}
public static Keys HotkeyModifiersFromString(string modifiersString)
{
Keys modifiers = Keys.None;
if (!string.IsNullOrEmpty(modifiersString))
{
if (modifiersString.ToUpperInvariant().Contains("ALT+", StringComparison.InvariantCulture))
{
modifiers |= Keys.Alt;
}
if (modifiersString.ToUpperInvariant().Contains("CTRL+", StringComparison.InvariantCulture) ||
modifiersString.ToUpperInvariant().Contains("STRG+", StringComparison.InvariantCulture))
{
modifiers |= Keys.Control;
}
if (modifiersString.ToUpperInvariant().Contains("SHIFT+", StringComparison.InvariantCulture))
{
modifiers |= Keys.Shift;
}
if (modifiersString.ToUpperInvariant().Contains("WIN+", StringComparison.InvariantCulture))
{
modifiers |= Keys.LWin;
}
}
return modifiers;
}
public static Keys HotkeyFromString(string hotkey)
{
Keys key = Keys.None;
if (!string.IsNullOrEmpty(hotkey))
{
if (hotkey.LastIndexOf('+') > 0)
{
hotkey = hotkey.Remove(0, hotkey.LastIndexOf('+') + 1).Trim();
}
try
{
hotkey = hotkey.
Replace("PgDn", "PageDown", StringComparison.InvariantCulture).
Replace("PgUp", "PageUp", StringComparison.InvariantCulture);
key = (Keys)Enum.Parse(typeof(Keys), hotkey);
}
catch (ArgumentException ex)
{
Log.Warn($"{hotkey} can not be parsed", ex);
}
}
return key;
}
/// <summary>
/// Register a hotkey.
/// </summary>
/// <param name="modifierKeyCode">The modifier, e.g.: Modifiers.CTRL, Modifiers.NONE or Modifiers.ALT .</param>
/// <param name="virtualKeyCode">The virtual key code.</param>
/// <param name="handler">A HotKeyHandler, this will be called to handle the hotkey press.</param>
/// <returns>the hotkey number, -1 if failed.</returns>
public static int RegisterHotKey(Keys modifierKeyCode, Keys virtualKeyCode, HotKeyHandler handler)
{
if (virtualKeyCode == Keys.None)
{
return 0;
}
// Convert Modifiers to fit HKM_SETHOTKEY
uint modifiers = 0;
if ((modifierKeyCode & Keys.Alt) > 0)
{
modifiers |= (uint)Modifiers.ALT;
}
if ((modifierKeyCode & Keys.Control) > 0)
{
modifiers |= (uint)Modifiers.CTRL;
}
if ((modifierKeyCode & Keys.Shift) > 0)
{
modifiers |= (uint)Modifiers.SHIFT;
}
if (modifierKeyCode == Keys.LWin || modifierKeyCode == Keys.RWin)
{
modifiers |= (uint)Modifiers.WIN;
}
if (IsWindows7OrOlder)
{
modifiers |= (uint)Modifiers.NOREPEAT;
}
if (NativeMethods.User32RegisterHotKey(HotkeyHwnd, hotKeyCounter, modifiers, (uint)virtualKeyCode))
{
KeyHandlers.Add(hotKeyCounter, handler);
return hotKeyCounter++;
}
else
{
Log.Info($"Couldn't register hotkey modifier {modifierKeyCode} virtualKeyCode {virtualKeyCode}");
return -1;
}
}
public static void UnregisterHotkeys()
{
foreach (int hotkey in KeyHandlers.Keys)
{
NativeMethods.User32UnregisterHotKey(HotkeyHwnd, hotkey);
}
KeyHandlers.Clear();
}
public static string GetKeyName(Keys givenKey)
{
StringBuilder keyName = new();
const uint numpad = 55;
Keys virtualKey = givenKey;
string keyString = string.Empty;
// Make VC's to real keys
switch (virtualKey)
{
case Keys.Alt:
virtualKey = Keys.LMenu;
break;
case Keys.Control:
virtualKey = Keys.ControlKey;
break;
case Keys.Shift:
virtualKey = Keys.LShiftKey;
break;
case Keys.Multiply:
if (NativeMethods.User32GetKeyNameText(numpad << 16, keyName, 100) > 0)
{
keyString = keyName.ToString().Replace("*", string.Empty, StringComparison.InvariantCulture).Trim().ToLowerInvariant();
if (keyString.Contains('('))
{
return "* " + keyString;
}
keyString = keyString[..1].ToUpperInvariant() + keyString[1..].ToLowerInvariant();
}
return keyString + " *";
case Keys.Divide:
if (NativeMethods.User32GetKeyNameText(numpad << 16, keyName, 100) > 0)
{
keyString = keyName.ToString().Replace("*", string.Empty, StringComparison.InvariantCulture).Trim().ToLowerInvariant();
if (keyString.Contains('('))
{
return "/ " + keyString;
}
keyString = keyString[..1].ToUpperInvariant() + keyString[1..].ToLowerInvariant();
}
return keyString + " /";
}
uint scanCode = NativeMethods.User32MapVirtualKey((uint)virtualKey, (uint)MapType.MAPVK_VK_TO_VSC);
// because MapVirtualKey strips the extended bit for some keys
switch (virtualKey)
{
case Keys.Left:
case Keys.Up:
case Keys.Right:
case Keys.Down: // arrow keys
case Keys.Prior:
case Keys.Next: // page up and page down
case Keys.End:
case Keys.Home:
case Keys.Insert:
case Keys.Delete:
case Keys.NumLock:
scanCode |= 0x100; // set extended bit
break;
case Keys.PrintScreen: // PrintScreen
scanCode = 311;
break;
case Keys.Pause: // PrintScreen
scanCode = 69;
break;
}
scanCode |= 0x200;
if (NativeMethods.User32GetKeyNameText(scanCode << 16, keyName, 100) != 0)
{
string visibleName = keyName.ToString();
if (visibleName.Length > 1)
{
visibleName = visibleName[..1] + visibleName[1..].ToLowerInvariant();
}
return visibleName;
}
else
{
return givenKey.ToString();
}
}
/// <summary>
/// Clears the current hotkey and resets the TextBox.
/// </summary>
public void ResetHotkey()
{
hotkey = Keys.None;
modifiers = Keys.None;
Redraw();
}
/// <summary>
/// Used to get/set the hotkey (e.g. Keys.A).
/// </summary>
/// <param name="hotkey">hotkey.</param>
public void SetHotkey(string hotkey)
{
this.hotkey = HotkeyFromString(hotkey);
modifiers = HotkeyModifiersFromString(hotkey);
Redraw(true);
}
public override string ToString()
{
return HotkeyToString(HotkeyModifiers, Hotkey);
}
/// <summary>
/// Handles some misc keys, such as Ctrl+Delete and Shift+Insert.
/// </summary>
/// <param name="msg">msg.</param>
/// <param name="keyData">keyData.</param>
/// <returns>bool if handled.</returns>
protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
{
if (keyData == Keys.Delete || keyData == (Keys.Control | Keys.Delete))
{
ResetHotkey();
return true;
}
// Paste
if (keyData == (Keys.Shift | Keys.Insert))
{
return true; // Don't allow
}
// Allow the rest
return base.ProcessCmdKey(ref msg, keyData);
}
/// <summary>
/// Redraws the TextBox when necessary.
/// </summary>
/// <param name="bCalledProgramatically">Specifies whether this function was called by the Hotkey/HotkeyModifiers properties or by the user.</param>
private void Redraw(bool bCalledProgramatically = false)
{
// No hotkey set
if (hotkey == Keys.None)
{
Text = string.Empty;
return;
}
// Only validate input if it comes from the user
if (bCalledProgramatically == false)
{
// No modifier or shift only, AND a hotkey that needs another modifier
if ((modifiers == Keys.Shift || modifiers == Keys.None) && needNonShiftModifier.Contains((int)hotkey))
{
if (modifiers == Keys.None)
{
// Set Ctrl+Alt as the modifier unless Ctrl+Alt+<key> won't work...
if (needNonAltGrModifier.Contains((int)hotkey) == false)
{
modifiers = Keys.Alt | Keys.Control;
}
else
{
// ... in that case, use Shift+Alt instead.
modifiers = Keys.Alt | Keys.Shift;
}
}
else
{
// User pressed Shift and an invalid key (e.g. a letter or a number),
// that needs another set of modifier keys
hotkey = Keys.None;
Text = string.Empty;
return;
}
}
// Check all Ctrl+Alt keys
if ((modifiers == (Keys.Alt | Keys.Control)) && needNonAltGrModifier.Contains((int)hotkey))
{
// Ctrl+Alt+4 etc won't work; reset hotkey and tell the user
hotkey = Keys.None;
Text = string.Empty;
return;
}
}
// I have no idea why this is needed, but it is. Without this code, pressing only Ctrl
// will show up as "Control + ControlKey", etc.
if (hotkey == Keys.Menu /* Alt */ || hotkey == Keys.ShiftKey || hotkey == Keys.ControlKey)
{
hotkey = Keys.None;
}
Text = HotkeyToLocalizedString(modifiers, hotkey);
}
/// <summary>
/// Populates the ArrayLists specifying disallowed hotkeys
/// such as Shift+A, Ctrl+Alt+4 (would produce a dollar sign) etc.
/// </summary>
private void PopulateModifierLists()
{
// Shift + 0 - 9, A - Z
for (Keys k = Keys.D0; k <= Keys.Z; k++)
{
needNonShiftModifier.Add((int)k);
}
// Shift + Numpad keys
for (Keys k = Keys.NumPad0; k <= Keys.NumPad9; k++)
{
needNonShiftModifier.Add((int)k);
}
// Shift + Misc (,;<./ etc)
for (Keys k = Keys.Oem1; k <= Keys.OemBackslash; k++)
{
needNonShiftModifier.Add((int)k);
}
// Shift + Space, PgUp, PgDn, End, Home
for (Keys k = Keys.Space; k <= Keys.Home; k++)
{
needNonShiftModifier.Add((int)k);
}
// Misc keys that we can't loop through
needNonShiftModifier.Add((int)Keys.Insert);
needNonShiftModifier.Add((int)Keys.Help);
needNonShiftModifier.Add((int)Keys.Multiply);
needNonShiftModifier.Add((int)Keys.Add);
needNonShiftModifier.Add((int)Keys.Subtract);
needNonShiftModifier.Add((int)Keys.Divide);
needNonShiftModifier.Add((int)Keys.Decimal);
needNonShiftModifier.Add((int)Keys.Return);
needNonShiftModifier.Add((int)Keys.Escape);
needNonShiftModifier.Add((int)Keys.NumLock);
// Ctrl+Alt + 0 - 9
for (Keys k = Keys.D0; k <= Keys.D9; k++)
{
needNonAltGrModifier.Add((int)k);
}
}
/// <summary>
/// Fires when a key is pushed down. Here, we'll want to update the text in the box
/// to notify the user what combination is currently pressed.
/// </summary>
private void HotkeyControl_KeyDown(object sender, KeyEventArgs e)
{
// Clear the current hotkey
if (e.KeyCode == Keys.Back || e.KeyCode == Keys.Delete)
{
ResetHotkey();
}
else
{
modifiers = e.Modifiers;
hotkey = e.KeyCode;
Redraw();
}
}
/// <summary>
/// Fires when all keys are released. If the current hotkey isn't valid, reset it.
/// Otherwise, do nothing and keep the text and hotkey as it was.
/// </summary>
private void HotkeyControl_KeyUp(object sender, KeyEventArgs e)
{
// Somehow the PrintScreen only comes as a keyup, therefore we handle it here.
if (e.KeyCode == Keys.PrintScreen)
{
modifiers = e.Modifiers;
hotkey = e.KeyCode;
Redraw();
}
if (hotkey == Keys.None && ModifierKeys == Keys.None)
{
ResetHotkey();
}
}
/// <summary>
/// Prevents the letter/whatever entered to show up in the TextBox
/// Without this, a "A" key press would appear as "aControl, Alt + A".
/// </summary>
private void HotkeyControl_KeyPress(object sender, KeyPressEventArgs e)
{
e.Handled = true;
}
}
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,75 @@
<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="ColumnFolder.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="ColumnRecursiveLevel.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="ColumnOnlyFiles.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="colorDialog.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>42</value>
</metadata>
</root>

View File

@@ -0,0 +1,65 @@
using System;
using System.Collections.Generic;
using System.Linq;
using FSI.Lib.Helpers;
namespace FSI.BT.Tools.Global.Utilities
{
internal class Admin
{
public static bool CheckSuperAdminRight()
{
if (Vars.GlobalSettings.SuperAdmin == null)
{
return false;
}
System.Security.Principal.WindowsIdentity windowsIdentity = System.Security.Principal.WindowsIdentity.GetCurrent();
if (string.Equals(Lib.DeEncryptString.DeEncrypt.DecryptString(Lib.DeEncryptString.DeEncrypt.DecryptString(Vars.GlobalSettings.SuperAdmin, AppDomain.CurrentDomain.FriendlyName), AppDomain.CurrentDomain.FriendlyName), windowsIdentity.ShortName(), StringComparison.OrdinalIgnoreCase))
return true;
return false;
}
public static bool CheckAdminRight()
{
if (Vars.GlobalSettings.Admins == null)
{
return false;
}
List<Settings.StringValue.IStringValue> users = Vars.GlobalSettings.Admins.ToList();
System.Security.Principal.WindowsIdentity windowsIdentity = System.Security.Principal.WindowsIdentity.GetCurrent();
foreach (var user in users)
{
if (string.Equals(Lib.DeEncryptString.DeEncrypt.DecryptString(user.Value, AppDomain.CurrentDomain.FriendlyName), windowsIdentity.ShortName(), StringComparison.OrdinalIgnoreCase))
return true;
}
return false;
}
public static bool CheckUserRight()
{
if (Vars.GlobalSettings.Users == null)
{
return false;
}
List<Settings.StringValue.IStringValue> users = Vars.GlobalSettings.Users.ToList();
System.Security.Principal.WindowsIdentity windowsIdentity = System.Security.Principal.WindowsIdentity.GetCurrent();
foreach (var user in users)
{
if (string.Equals(Lib.DeEncryptString.DeEncrypt.DecryptString(user.Value, AppDomain.CurrentDomain.FriendlyName), windowsIdentity.ShortName(), StringComparison.OrdinalIgnoreCase))
return true;
}
return false;
}
}
}

View File

@@ -0,0 +1,70 @@
// <copyright file="AppRestart.cs" company="PlaceholderCompany">
// Copyright (c) PlaceholderCompany. All rights reserved.
// </copyright>
namespace FSI.BT.Tools.Global.Utilities
{
using System;
using System.ComponentModel;
using System.Diagnostics;
using System.Runtime.CompilerServices;
using System.Windows.Forms;
internal class AppRestart
{
public static event Action BeforeRestarting;
internal static void ByThreadException()
{
Restart(GetCurrentMethod());
}
internal static void ByAppContextMenu()
{
Restart(GetCurrentMethod());
}
internal static void ByConfigChange()
{
Restart(GetCurrentMethod());
}
internal static void ByMenuButton()
{
Restart(GetCurrentMethod());
}
private static void Restart(string reason)
{
BeforeRestarting?.Invoke();
Log.Info($"Restart by '{reason}'");
Log.Close();
using (Process p = new())
{
string fileName = System.Environment.ProcessPath;
p.StartInfo = new ProcessStartInfo(fileName);
try
{
p.Start();
}
catch (Win32Exception ex)
{
Log.Warn("Restart failed", ex);
}
}
Application.Exit();
}
[MethodImpl(MethodImplOptions.NoInlining)]
private static string GetCurrentMethod()
{
StackTrace st = new();
StackFrame sf = st.GetFrame(1);
return sf.GetMethod().Name;
}
}
}

View File

@@ -0,0 +1,24 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.IO.Compression;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
namespace FSI.BT.Tools.Global.Utilities
{
internal static class ExtractEmbeddedZip
{
internal static void Extract(string zipName, string destPath)
{
System.IO.Directory.CreateDirectory(destPath); // Erstellt alle fehlenden Verzeichnisse
using Stream _pluginZipResourceStream = Assembly.GetExecutingAssembly().GetManifestResourceStream(zipName);
using ZipArchive zip = new(_pluginZipResourceStream);
zip.ExtractToDirectory(destPath, true);
Vars.Log.Info("Externes Tool \"{0}\" wurde in das Verzeichnis \"{1}\" entpackt", zipName, destPath);
}
}
}

View File

@@ -0,0 +1,199 @@
// <copyright file="Log.cs" company="PlaceholderCompany">
// Copyright (c) PlaceholderCompany. All rights reserved.
// </copyright>
namespace FSI.BT.Tools.Global.Utilities
{
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Threading;
using System.Windows.Forms;
using Clearcove.Logging;
internal static class Log
{
private const string LogfileLastExtension = "_last";
private static readonly Logger LogValue = new(string.Empty);
private static readonly List<string> Warnings = new();
private static readonly List<string> Infos = new();
internal static void Initialize()
{
bool warnFailedToSaveLogFile = false;
Exception exceptionWarnFailedToSaveLogFile = new();
if (Global.Vars.SystemTrayMenuSettings.SaveLogFileInApplicationDirectory)
{
try
{
string fileNameToCheckWriteAccess = "CheckWriteAccess";
File.WriteAllText(fileNameToCheckWriteAccess, fileNameToCheckWriteAccess);
File.Delete(fileNameToCheckWriteAccess);
}
catch (Exception ex)
{
Global.Vars.SystemTrayMenuSettings.SaveLogFileInApplicationDirectory = false;
warnFailedToSaveLogFile = true;
exceptionWarnFailedToSaveLogFile = ex;
}
}
bool warnCanNotClearLogfile = false;
Exception exceptionWarnCanNotClearLogfile = new();
string fileNamePath = GetLogFilePath();
FileInfo fileInfo = new(fileNamePath);
string fileNamePathLast = string.Empty;
if (fileInfo.Exists && fileInfo.Length > 2000000)
{
fileNamePathLast = GetLogFilePath(LogfileLastExtension);
try
{
File.Delete(fileNamePathLast);
File.Move(fileNamePath, fileNamePathLast);
}
catch (Exception ex)
{
warnCanNotClearLogfile = true;
exceptionWarnCanNotClearLogfile = ex;
}
}
Logger.Start(fileInfo);
if (warnFailedToSaveLogFile)
{
Warn($"Failed to save log file in application folder {GetLogFilePath()}", exceptionWarnFailedToSaveLogFile);
}
if (warnCanNotClearLogfile)
{
Warn($"Can not clear logfile:'{fileNamePathLast}'", exceptionWarnCanNotClearLogfile);
}
}
internal static void Info(string message)
{
if (!Infos.Contains(message))
{
Infos.Add(message);
LogValue.Info(message);
}
}
internal static void Warn(string message, Exception ex)
{
string warning = $"{message} {ex.ToString().Replace(Environment.NewLine, " ", StringComparison.InvariantCulture)}";
if (!Warnings.Contains(warning))
{
Warnings.Add(warning);
LogValue.Warn(warning);
}
}
internal static void Error(string message, Exception ex)
{
LogValue.Error($"{message}{Environment.NewLine}" +
$"{ex}");
}
internal static string GetLogFilePath(string backup = "")
{
string logFilePath = string.Empty;
if (!Global.Vars.SystemTrayMenuSettings.SaveLogFileInApplicationDirectory)
{
logFilePath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), $"FSI.BT.Tools.SystemTrayMenu");
}
return Path.Combine(logFilePath, $"log-{Environment.MachineName}{backup}.txt");
}
internal static void OpenLogFile()
{
string lastLogfile = GetLogFilePath(LogfileLastExtension);
if (File.Exists(lastLogfile))
{
ProcessStart(lastLogfile);
}
ProcessStart(GetLogFilePath());
}
internal static void WriteApplicationRuns()
{
Assembly assembly = Assembly.GetExecutingAssembly();
LogValue.Info($"Application Start " +
assembly.ManifestModule.Name + " | " +
assembly.GetName().Version.ToString() + " | " +
$"ScalingFactor={Scaling.Factor}");
}
internal static void Close()
{
try
{
Logger.ShutDown();
}
catch (Exception ex)
{
Global.Vars.SystemTrayMenuSettings.SaveLogFileInApplicationDirectory = false;
Warn($"Failed to save log file in application folder {GetLogFilePath()}", ex);
}
}
internal static void ProcessStart(
string fileName,
string arguments = "",
bool doubleQuoteArg = false,
string workingDirectory = "",
bool createNoWindow = false,
string resolvedPath = "")
{
if (doubleQuoteArg && !string.IsNullOrEmpty(arguments))
{
arguments = "\"" + arguments + "\"";
}
try
{
using Process p = new()
{
StartInfo = new ProcessStartInfo(fileName)
{
FileName = fileName,
Arguments = arguments,
WorkingDirectory = workingDirectory,
CreateNoWindow = createNoWindow,
UseShellExecute = true,
},
};
p.Start();
}
catch (Win32Exception ex)
{
Warn($"fileName:'{fileName}' arguments:'{arguments}'", ex);
if ((ex.NativeErrorCode == 2 || ex.NativeErrorCode == 1223) &&
(string.IsNullOrEmpty(resolvedPath) || !File.Exists(resolvedPath)))
{
new Thread(ShowProblemWithShortcut).Start();
static void ShowProblemWithShortcut()
{
_ = MessageBox.Show(
Global.Utilities.Translator.GetText("The item that this shortcut refers to has been changed or moved, so this shortcut will no longer work properly."),
Global.Utilities.Translator.GetText("Problem with shortcut link"),
MessageBoxButtons.OK,
MessageBoxIcon.Warning);
}
}
}
catch (Exception ex)
{
Warn($"fileName:'{fileName}' arguments:'{arguments}'", ex);
}
}
}
}

View File

@@ -0,0 +1,31 @@
// <copyright file="Scaling.cs" company="PlaceholderCompany">
// Copyright (c) PlaceholderCompany. All rights reserved.
// </copyright>
namespace FSI.BT.Tools.Global.Utilities
{
using System;
using System.Drawing;
internal static class Scaling
{
public static float Factor { get; private set; } = 1;
public static float FactorByDpi { get; private set; } = 1;
public static void Initialize()
{
Factor = Global.Vars.SystemTrayMenuSettings.SizeInPercent / 100f;
}
public static int Scale(int width)
{
return (int)Math.Round(width * Factor, 0, MidpointRounding.AwayFromZero);
}
public static void CalculateFactorByDpi(Graphics graphics)
{
FactorByDpi = graphics.DpiX / 96;
}
}
}

View File

@@ -0,0 +1,36 @@
// <copyright file="Translator.cs" company="PlaceholderCompany">
// Copyright (c) PlaceholderCompany. All rights reserved.
// </copyright>
namespace FSI.BT.Tools.Global.Utilities
{
using System.Globalization;
using System.Resources;
using FSI.BT.Tools.SystemTrayMenu.UserInterface;
internal static class Translator
{
private static CultureInfo culture;
internal static void Initialize()
{
if (string.IsNullOrEmpty(
Vars.SystemTrayMenuSettings.CurrentCultureInfoName))
{
Vars.SystemTrayMenuSettings.CurrentCultureInfoName = "de";
//Global.Vars.SystemTrayMenuSettings.Save();
}
culture = CultureInfo.CreateSpecificCulture(
Vars.SystemTrayMenuSettings.CurrentCultureInfoName);
}
internal static string GetText(string id)
{
ResourceManager rm = new(
"FSI.BT.Tools.Global.Resources.Languages.lang",
typeof(Menu).Assembly);
return rm.GetString(id, culture);
}
}
}