Esempio n. 1
0
        private static int Compare(DroneFirmwareVersion version1, DroneFirmwareVersion version2)
        {
            int[] version1Parts = version1.versionParts;
            int[] version2Parts = version2.versionParts;

            for (int i = 0; i < Math.Max(version1Parts.Length, version2Parts.Length); i++)
            {
                int version1Part = version1Parts.Length > i ? version1Parts[i] : -1;
                int version2Part = version2Parts.Length > i ? version2Parts[i] : -1;

                if (version1Part > version2Part)
                {
                    return(1);
                }
                else if (version2Part > version1Part)
                {
                    return(-1);
                }
            }

            return(0);
        }
        private static int Compare(DroneFirmwareVersion version1, DroneFirmwareVersion version2)
        {
            int[] version1Parts = version1.versionParts;
            int[] version2Parts = version2.versionParts;

            for (int i = 0; i < Math.Max(version1Parts.Length, version2Parts.Length); i++)
            {
                int version1Part = version1Parts.Length > i ? version1Parts[i] : -1;
                int version2Part = version2Parts.Length > i ? version2Parts[i] : -1;

                if (version1Part > version2Part)
                {
                    return 1;
                }
                else if (version2Part > version1Part)
                {
                    return -1;
                }
            }

            return 0;
        }
Esempio n. 3
0
        private SupportedFirmwareVersion GetFirmwareVersionToUse()
        {
            SupportedFirmwareVersion firmwareVersionToUse;
            if (droneConfig.UseSpecificFirmwareVersion)
            {
                firmwareVersionToUse = droneConfig.FirmwareVersion;
            }
            else
            {
                DroneFirmwareVersion droneVersion = new DroneFirmwareVersion(internalDroneConfiguration.GeneralConfiguration.SoftwareVersion);
                firmwareVersionToUse = droneVersion.GetSupportedFirmwareVersion();
            }

            return firmwareVersionToUse;
        }