예제 #1
0
        public static AndroidVersion GetAndroidVersion(string apiLevel)
        {
            if (string.IsNullOrEmpty(apiLevel))
            {
                return(null);
            }

            return(AndroidVersionList.GetVersionList().AndroidVersions().FirstOrDefault(api => api.APILevel == apiLevel));
        }
예제 #2
0
        public static AndroidVersion GetRandomAndriodVersion()
        {
TryLabel:
            var randomDeviceIndex = Rnd.Next(0, AndroidVersionList.GetVersionList().AndroidVersions().Count);
            var androidVersion = AndroidVersionList.GetVersionList().AndroidVersions().ElementAt(randomDeviceIndex);

            if (LastAndriodVersion != null)
            {
                if (androidVersion.APILevel == LastAndriodVersion.APILevel)
                {
                    goto TryLabel;
                }
            }
            LastAndriodVersion = androidVersion;
            return(androidVersion);
        }
예제 #3
0
        public static AndroidVersion FromString(string versionString)
        {
            var version = new Version(versionString);

            foreach (var androidVersion in AndroidVersionList.GetVersionList().AndroidVersions())
            {
                if (version.CompareTo(new Version(androidVersion.VersionNumber)) == 0 ||
                    version.CompareTo(new Version(androidVersion.VersionNumber)) > 0 &&
                    androidVersion != AndroidVersionList.GetVersionList().AndroidVersions().Last() &&
                    version.CompareTo(new Version(AndroidVersionList.GetVersionList().AndroidVersions()[AndroidVersionList.GetVersionList().AndroidVersions().IndexOf(androidVersion) + 1]
                                                  .VersionNumber)) < 0)
                {
                    return(androidVersion);
                }
            }
            return(null);
        }