Exemplo n.º 1
0
        public static ReleaseVersion FromSection(IConfigSection section)
        {
            Version ver;

            try
            {
                ver = new Version(section.SubSection);
            }
            catch (Exception e)
            {
                Debug.WriteLine(e);
                return(null);
            }

            var version = new ReleaseVersion
            {
                Version      = ver,
                ReleaseType  = ReleaseType.Major,
                DownloadPage = section.GetValue("DownloadPage")
            };

            Enum.TryParse(section.GetValue("ReleaseType"), true, out version.ReleaseType);

            return(version);
        }
Exemplo n.º 2
0
        public static ReleaseVersion?FromSection(IConfigSection section)
        {
            Version ver;

            try
            {
                ver = new Version(section.SubSection);
            }
            catch (Exception e)
            {
                Debug.WriteLine(e);
                return(null);
            }

            Enum.TryParse(section.GetValue("ReleaseType"), true, out ReleaseType releaseType);

            return(new ReleaseVersion(ver, releaseType, section.GetValue("DownloadPage")));
        }
Exemplo n.º 3
0
        public static bool GetValueAsBool(this IConfigSection section, string name, bool defaultValue)
        {
            bool result = defaultValue;

            if (section.HasValue(name))
            {
                string value = section.GetValue(name);
                bool.TryParse(value, out result);
            }

            return(result);
        }