File size: 637 Bytes
fab29d7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
using System;
using System.Reflection;
using VersOne.Epub.Schema;

namespace VersOne.Epub.Internal
{
    internal static class VersionUtils
    {
        public static string GetVersionString(EpubVersion epubVersion)
        {
            Type epubVersionType = typeof(EpubVersion);
            FieldInfo fieldInfo = epubVersionType.GetRuntimeField(epubVersion.ToString());
            if (fieldInfo != null)
            {
                return fieldInfo.GetCustomAttribute<VersionStringAttribute>().Version;
            }
            else
            {
                return epubVersion.ToString();
            }
        }
    }
}