Exemple #1
0
        private static int CompareTokenVersions(ObjectToken token1, ObjectToken token2, out bool pfDidCompare)
        {
            pfDidCompare = false;
            RegistryDataKey registryDataKey  = null;
            RegistryDataKey registryDataKey2 = null;

            registryDataKey  = token1.Attributes;
            registryDataKey2 = token2.Attributes;
            if (registryDataKey != null)
            {
                string value;
                registryDataKey.TryGetString("Vendor", out value);
                string value2;
                registryDataKey.TryGetString("ProductLine", out value2);
                string value3;
                registryDataKey.TryGetString("Version", out value3);
                string value4;
                registryDataKey.TryGetString("Language", out value4);
                if (registryDataKey2 != null)
                {
                    string value5;
                    registryDataKey2.TryGetString("Vendor", out value5);
                    string value6;
                    registryDataKey2.TryGetString("ProductLine", out value6);
                    string value7;
                    registryDataKey2.TryGetString("Version", out value7);
                    string value8;
                    registryDataKey2.TryGetString("Language", out value8);
                    if (((string.IsNullOrEmpty(value) && string.IsNullOrEmpty(value5)) || (!string.IsNullOrEmpty(value) && !string.IsNullOrEmpty(value5) && value == value5)) && ((string.IsNullOrEmpty(value2) && string.IsNullOrEmpty(value6)) || (!string.IsNullOrEmpty(value2) && !string.IsNullOrEmpty(value6) && value2 == value6)) && ((string.IsNullOrEmpty(value4) && string.IsNullOrEmpty(value8)) || (!string.IsNullOrEmpty(value4) && !string.IsNullOrEmpty(value8) && value4 == value8)))
                    {
                        pfDidCompare = true;
                        return(CompareVersions(value3, value7));
                    }
                    return(-1);
                }
                return(1);
            }
            return(-1);
        }