示例#1
0
        public static void ProcessNewOptions(NewCmdLineOptions options)
        {
            try
            {
                var outPath = string.Empty;
                switch (options.Type)
                {
                case ItemType.DesktopTheme:
                    outPath = Themes.GenerateNewTheme(ApplicationMode.Desktop, options.Name);
                    break;

                case ItemType.FullscreenTheme:
                    outPath = Themes.GenerateNewTheme(ApplicationMode.Fullscreen, options.Name);
                    break;

                case ItemType.PowerShellScript:
                    outPath = Extensions.GenerateScriptExtension(ScriptLanguage.PowerShell, options.Name, options.OutDirectory);
                    break;

                case ItemType.IronPythonScript:
                    outPath = Extensions.GenerateScriptExtension(ScriptLanguage.IronPython, options.Name, options.OutDirectory);
                    break;

                case ItemType.GenericPlugin:
                    outPath = Extensions.GeneratePluginExtension(ExtensionType.GenericPlugin, options.Name, options.OutDirectory);
                    break;

                case ItemType.MetadataPlugin:
                    outPath = Extensions.GeneratePluginExtension(ExtensionType.MetadataProvider, options.Name, options.OutDirectory);
                    break;

                case ItemType.LibraryPlugin:
                    outPath = Extensions.GeneratePluginExtension(ExtensionType.GameLibrary, options.Name, options.OutDirectory);
                    break;

                default:
                    throw new NotSupportedException($"Uknown extension type {options.Type}.");
                }

                logger.Info($"Created new {options.Type} in \"{outPath}\"");
                logger.Info($"Don't forget to update manifest file with relevant information.");
            }
            catch (Exception e) when(!Debugger.IsAttached)
            {
                logger.Error(e, $"Failed to create new {options.Type}." + Environment.NewLine + e.Message);
            }
        }
示例#2
0
 public static void ProcessNewOptions(NewCmdLineOptions options)
 {
     if (options.Type == ItemType.Theme)
     {
         var mode = options.TargetType.Equals("desktop", StringComparison.OrdinalIgnoreCase) ? ApplicationMode.Desktop : ApplicationMode.Fullscreen;
         try
         {
             var path = GenerateNewTheme(mode, options.Name);
             logger.Info($"Created new theme in \"{path}\"");
             logger.Info($"Don't forget to update \"{ThemeManager.ThemeManifestFileName}\" with relevant information.");
         }
         catch (Exception e)
         {
             logger.Error(e, "Failed to create new theme." + Environment.NewLine + e.Message);
         }
     }
 }