OptionComponent.cs 368 B

12345678910111213141516171819
  1. using System;
  2. using CommandLine;
  3. namespace Model
  4. {
  5. [EntityEvent(EntityEventId.OptionComponent)]
  6. public class OptionComponent : Component
  7. {
  8. public Options Options { get; } = new Options();
  9. private void Awake(string[] args)
  10. {
  11. if (!Parser.Default.ParseArguments(args, this.Options))
  12. {
  13. throw new Exception($"命令行格式错误!");
  14. }
  15. }
  16. }
  17. }