private StartupFileModel GetModelFromShortcut(string shortcutFileName) { var shortcutInfo = ShortcutUtils.ResolveShortcut(shortcutFileName); return(new StartupFileModel { FileDirectory = Path.GetDirectoryName(shortcutInfo.Path), FileName = Path.GetFileName(shortcutInfo.Path), Arguments = shortcutInfo.Arguments, Icon = Icon.ExtractAssociatedIcon(shortcutFileName), StartupType = StartupType.StartMenu, }); }
private string GetSteamFolder() { var rootPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData), "Spectrasonics", "STEAM"); if (Directory.Exists(rootPath)) { return(rootPath); } rootPath += ".lnk"; if (!ShortcutUtils.IsShortcut(rootPath)) { throw new IOException("Could not find the default STEAM folder or shortcut"); } return(ShortcutUtils.ResolveShortcut(rootPath)); }
private string GetPresetDirectory(string dataDirectoryName, string productName, bool userPresets) { dataDirectoryName = GetDataDirectory(dataDirectoryName); var shortCutDataDirectoryName = dataDirectoryName + ".lnk"; string dataDirectory; var isShortcut = false; try { isShortcut = ShortcutUtils.IsShortcut(shortCutDataDirectoryName); } catch (IOException e) { Logger.Error( $"Error while trying to resolve the shortcut {shortCutDataDirectoryName}: {e.GetType().FullName}: {e.Message}"); Logger.Debug(e.StackTrace); } if (isShortcut) { dataDirectory = ShortcutUtils.ResolveShortcut(shortCutDataDirectoryName); } else { dataDirectory = dataDirectoryName; } if (dataDirectory != null) { return(Path.Combine(dataDirectory, userPresets ? "UserPresets" : "Presets", productName)); } Logger.Error($"Unable to find the data directory because {dataDirectoryName} is not a directory and no " + $"shortcut {shortCutDataDirectoryName} exists."); return(null); }