You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

44 lines
1.9 KiB

  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. namespace IPA.Loader
  7. {
  8. /// <summary>
  9. /// Indicates that a plugin cannot be disabled at runtime. Generally not considered an error, however.
  10. /// </summary>
  11. [Serializable]
  12. public class CannotRuntimeDisableException : Exception
  13. {
  14. /// <summary>
  15. /// The plugin that cannot be disabled at runtime.
  16. /// </summary>
  17. public PluginMetadata Plugin { get; }
  18. /// <summary>
  19. /// Creates an exception for the given plugin metadata.
  20. /// </summary>
  21. /// <param name="plugin">the plugin that cannot be disabled</param>
  22. public CannotRuntimeDisableException(PluginMetadata plugin) : base($"Cannot runtime disable plugin \"{plugin.Name}\" ({plugin.Id})")
  23. => Plugin = plugin;
  24. /// <summary>
  25. /// Creats an exception with the given plugin metadata and message information.
  26. /// </summary>
  27. /// <param name="plugin">the plugin that cannot be disabled</param>
  28. /// <param name="message">the message to associate with it</param>
  29. public CannotRuntimeDisableException(PluginMetadata plugin, string message) : base($"{message} \"{plugin.Name}\" ({plugin.Id})")
  30. => Plugin = plugin;
  31. /// <summary>
  32. /// Creates an exception from a serialization context. Not currently implemented.
  33. /// </summary>
  34. /// <param name="serializationInfo"></param>
  35. /// <param name="streamingContext"></param>
  36. /// <exception cref="NotImplementedException"></exception>
  37. protected CannotRuntimeDisableException(System.Runtime.Serialization.SerializationInfo serializationInfo, System.Runtime.Serialization.StreamingContext streamingContext)
  38. {
  39. throw new NotImplementedException();
  40. }
  41. }
  42. }