private void createShortcut(ShortcutArgs e)
        {
            // ohne wdir, wird das aktuelle Arbeitsverzeichnis benutzt
            if (isNullOrWhitespace(e.WorkingDirectory))
            {
                e.WorkingDirectory = Environment.CurrentDirectory + "\\";
            }

            // ohne -n "{abs. Pfad + Name}" oder -d "{Name auf Desktop}", wird die Verknüpfung beim Ziel abgelegt mit dem Namen des Ziels + .lnk
            if (isNullOrWhitespace(e.LinkPath))
            {
                e.LinkPath = Path.Combine(e.WorkingDirectory, Path.GetFileNameWithoutExtension("" + e.TargetFileAssosiation));
            }
            var shortcutLocation = e.LinkPath.EndsWith(".lnk") ? e.LinkPath : (e.LinkPath + ".lnk");

            var shortcut = prepareShortcutClass(shortcutLocation);

            shortcut.Description      = e.Description;
            shortcut.TargetPath       = e.TargetFileAssosiation;
            shortcut.Arguments        = e.Arguments;
            shortcut.WindowStyle      = e.WindowStyleConstant;
            shortcut.WorkingDirectory = e.WorkingDirectory;
            try
            {
                // Keine Angabe => z.B. "[exe],0" oder File
                var shortcutIconLocation = isNullOrWhitespace(e.IconImageFilePath) ? (e.TargetFileAssosiation + ",0") : e.IconImageFilePath;
                Console.WriteLine($"Teste Icon '{shortcutIconLocation}'");
                e.IconImageFilePath   = shortcutIconLocation;
                shortcut.IconLocation = shortcutIconLocation;
            }
            catch (Exception exception)
            {
                Console.WriteLine(exception.Message);
                shortcut.IconLocation = null;
            }

            Console.WriteLine($"{{\r\n\t-n: \"{e.LinkPath}\",\r\n\t-w: \"{e.WorkingDirectory}\",\r\n\t-l: \"{e.TargetFileAssosiation}\",\r\n\t-param: \"{e.Arguments}\",\r\n\t-i: \"{e.IconImageFilePath}\",\r\n\t-desc: \"{e.Description}\"\r\n}}");
            onSaveShortcut(ref shortcut);

            // anlegen der lnk
            shortcut.Save();
        }
        private void run(string[] arguments)
        {
            // Lädt die eingebettete Ressource nach, ohne die das erstellen unter Windows nicht möglich wäre
            AppDomain.CurrentDomain.AssemblyResolve += (sender, args) => {
                var resourceName = new AssemblyName(args.Name).Name + ".dll";
                var resource     = Array.Find(GetType().Assembly.GetManifestResourceNames(), element => element.EndsWith(resourceName));

                Debug.WriteLine($"Search for dll: {resourceName}");

                using (var stream = Assembly.GetExecutingAssembly().GetManifestResourceStream(resource)) {
                    Debug.Assert(stream != null, "stream != null");
                    var assemblyData = new byte[stream.Length];
                    stream.Read(assemblyData, 0, assemblyData.Length);
                    return(Assembly.Load(assemblyData));
                }
            };

            Console.InputEncoding = Encoding.UTF8;
            Console.WriteLine("Parameter: " + string.Join(",", arguments));

            // P -help, /help, --help, -?, /?, --? oder gar keine Parameter
            // zeigt die Anleitung (Hilfe)

            var help = isParameterSet(arguments, "?", false);

            if (!help.IsSet)
            {
                help = isParameterSet(arguments, "help", false);
            }

            if (help.IsSet || arguments.Length == 0)
            {
                // show help
                Console.WriteLine(getHelpText());
                return;
            }

            // create

            var desktop = isParameterSet(arguments, "d", true, @"\.*");

            if (!desktop.IsSet)
            {
                desktop = isParameterSet(arguments, "desktop", true, @"\.*");
            }

            var name = isParameterSet(arguments, "n", true, @"\.*");

            if (!name.IsSet)
            {
                name = isParameterSet(arguments, "name", true, @"\.*");
            }

            var style = isParameterSet(arguments, "s", true, @"\d+");

            if (!style.IsSet)
            {
                style = isParameterSet(arguments, "style", true, @"\d+");
            }
            var styleInt = int.TryParse(style.Value, out int i) ? i : 0;

            var link = isParameterSet(arguments, "l", true, @"\.*");

            if (!link.IsSet)
            {
                link = isParameterSet(arguments, "link", true, @"\.*");
            }

            var param = isParameterSet(arguments, "p", true, @"\.*");

            if (!param.IsSet)
            {
                param = isParameterSet(arguments, "param", true, @"\.*");
            }

            var icon = isParameterSet(arguments, "i", true, @"\.*");

            if (!icon.IsSet)
            {
                icon = isParameterSet(arguments, "icon", true, @"\.*");
            }

            var workingDir = isParameterSet(arguments, "w", true, @"\.*");

            if (!workingDir.IsSet)
            {
                workingDir = isParameterSet(arguments, "wdir", true, @"\.*");
            }

            var desc = isParameterSet(arguments, "desc", true, @"\.*");

            var shortcut = new ShortcutArgs
            {
                Arguments             = param.Value,
                Description           = desc.Value ?? string.Empty,
                IconImageFilePath     = icon.Value ?? string.Empty,
                WindowStyleConstant   = styleInt,
                WorkingDirectory      = workingDir.Value ?? string.Empty,
                TargetFileAssosiation = link.Value ?? string.Empty
            };

            if (desktop.IsSet)
            {
                var linkName = name.IsSet ? name.Value : desktop.Value;
                shortcut.createOnDesktop(linkName);
            }
            else
            {
                shortcut.LinkPath = name.Value;
            }

            if (canShortcut(shortcut))
            {
                createShortcut(shortcut);
            }
            else
            {
                Console.WriteLine(MISSING_PARAMETERS);
            }
        }
 // ReSharper disable once UnusedMember.Global
 public static void CreateLink(ShortcutArgs args)
 {
     Main(args.ToArgs());
 }
 // absolutes Minimum an Parametern
 protected static bool canShortcut(ShortcutArgs shortcut)
 {
     return(!isNullOrWhitespace(shortcut.TargetFileAssosiation));
 }