public ShortcutOptions(string Path, string ID, string Name, int Wait, string WorkingDirectory, string Save, string Icon, bool ShowCommandLine) { if (!string.IsNullOrEmpty(Path)) { this.ID = ID; this.Name = Name; this.Wait = Wait; this.Path = Path; this.WorkingDirectory = string.IsNullOrWhiteSpace(WorkingDirectory) ? Dir.GetDirectoryName(Dir.Combine(Environment.CurrentDirectory, Path)) : WorkingDirectory; Save = string.IsNullOrEmpty(Save) ? Dir.Combine(Environment.CurrentDirectory, Dir.GetFileNameWithoutExtension(Path)) : Save; this.Save = Dir.HasExtension(Save) ? Save : $"{Save}.lnk"; this.Icon = string.IsNullOrEmpty(Icon) ? $"{this.Path},0" : Icon; this.ShowCommandLine = ShowCommandLine; } }
public static bool HasExtension(string path) => MSIOP.HasExtension(path);