コード例 #1
0
ファイル: Event.cs プロジェクト: Sage-of-Mirrors/Faura
        private Enum[] LoadVersionEnums(string filePath, bool isTxt, string cmdVersion, out string version)
        {
            version = cmdVersion;

            // If the input is a txt file, we'll get the version from the file itself
            if (isTxt)
            {
                using (FileStream file = new FileStream(filePath, FileMode.Open, FileAccess.Read))
                {
                    StreamReader rdr = new StreamReader(file);

                    string versionComment = rdr.ReadLine();
                    while (!versionComment.ToLower().Contains("# version"))
                    {
                        if (rdr.EndOfStream)
                        {
                            throw new Exception($"File \"{ filePath }\" did not contain a version comment (#version)!");
                        }

                        versionComment = rdr.ReadLine();
                    }

                    version = versionComment.Split(' ')[2].ToLower();
                }
            }

            return(EnumLoader.GetEnumsFromVersion(version));
        }
コード例 #2
0
 public ConfirmDialog(AlertLevel alertLevel, string message)
 {
     InitializeComponent();
     DialogTitle = EnumLoader.GetEnumDesc(typeof(AlertLevel), alertLevel.ToString());
     Message     = message;
     DataContext = this;
 }