private static void AddToLockedStringCollection(
     Dictionary <string, Dictionary <string, StringCompareResult> > collection,
     string dllName,
     string resourceName,
     StringCompareResult result)
 {
     lock (_lockedStringCollectionLock)
     {
         if (collection.ContainsKey(dllName))
         {
             if (!collection[dllName].ContainsKey(resourceName))
             {
                 collection[dllName][resourceName] = result;
             }
         }
         else
         {
             collection[dllName] = new Dictionary <string, StringCompareResult> {
                 { resourceName, result }
             };
         }
     }
 }
        private static void CompareAllStrings(string firstDll, string secondDll, string lciCommentDirPath)
        {
            var      lciFilePath = Path.Combine(lciCommentDirPath, Path.GetFileName(firstDll) + ".lci");
            XElement lciFile     = null;

            if (File.Exists(lciFilePath))
            {
                lciFile = XElement.Load(lciFilePath);
            }
            else
            {
                Console.WriteLine($"WARNING: No LCI file found at {lciFilePath}");
            }

            var firstAssembly = Assembly.LoadFrom(firstDll);
            var firstAssemblyResourceFullNames = GetResourceFullNamesFromDll(firstAssembly);

            var secondAssembly = Assembly.LoadFrom(secondDll);
            var secondAssemblyResourceFullNames = GetResourceFullNamesFromDll(secondAssembly);

            var firstAssemblyName = Path.GetFileNameWithoutExtension(firstDll);

            Enum.TryParse <Locale>(Directory.GetParent(secondDll).Name, out var locale);

            foreach (var firstAssemblyResourceFullName in firstAssemblyResourceFullNames)
            {
                var firstResourceSetEnumerator = GetResourceEnumeratorFromAssembly(firstAssemblyResourceFullName, firstAssembly);

                while (firstResourceSetEnumerator.MoveNext())
                {
                    if (IsResourceAValidString(firstResourceSetEnumerator.Key, firstResourceSetEnumerator.Value))
                    {
                        if (IsResourceStringUriOrNonAlphabetical(firstResourceSetEnumerator.Key.ToString(), firstResourceSetEnumerator))
                        {
                            continue;
                        }

                        var lciEntries = GetLciEntries(lciFile, firstResourceSetEnumerator.Key.ToString());

                        if (lciEntries?.Any() == true)
                        {
                            var lciCommentAndValueTuple = GetLciCommentAndValueString(lciEntries);
                            var cmtString   = lciCommentAndValueTuple.Item1;
                            var valueString = lciCommentAndValueTuple.Item2;

                            if (cmtString.Contains("Locked"))
                            {
                                var compareResult = new LockedStringResult()
                                {
                                    ResourceName = firstResourceSetEnumerator.Key.ToString(),
                                    AssemblyName = firstAssemblyName,
                                    EnglishValue = firstResourceSetEnumerator.Value.ToString(),
                                    LockComment  = cmtString
                                };

                                AddToLockedStringCollection(
                                    _lockedStrings,
                                    firstAssemblyName,
                                    firstResourceSetEnumerator.Key.ToString(),
                                    compareResult);
                            }

                            if (IsStringResourceLocked(cmtString, valueString))
                            {
                                continue;
                            }
                        }

                        var secondResourceFullName = secondAssemblyResourceFullNames
                                                     .First(r => r.StartsWith(GetResourceNameFromFullName(firstAssemblyResourceFullName)));

                        var secondResource = GetResourceFromAssembly(
                            secondResourceFullName,
                            firstResourceSetEnumerator.Key.ToString(),
                            secondAssembly);

                        if (secondResource == null)
                        {
                            var compareResult = new StringCompareResult()
                            {
                                ResourceName = firstResourceSetEnumerator.Key.ToString(),
                                AssemblyName = firstAssemblyName,
                                Locale       = locale,
                            };

                            _missingLocalizedErrors.Enqueue(compareResult);
                        }
                        else if (!CompareStrings(firstResourceSetEnumerator.Value.ToString(), secondResource))
                        {
                            var compareResult = new MismatchedStringResult()
                            {
                                ResourceName   = firstResourceSetEnumerator.Key.ToString(),
                                AssemblyName   = firstAssemblyName,
                                Locale         = locale,
                                EnglishValue   = firstResourceSetEnumerator.Value.ToString(),
                                LocalizedValue = secondResource
                            };

                            _mismatchErrors.Enqueue(compareResult);
                        }
                        else if (secondResource.Equals(firstResourceSetEnumerator.Value.ToString()))
                        {
                            var compareResult = new IdenticalStringResult()
                            {
                                ResourceName   = firstResourceSetEnumerator.Key.ToString(),
                                AssemblyName   = firstAssemblyName,
                                Locale         = locale,
                                EnglishValue   = firstResourceSetEnumerator.Value.ToString(),
                                LocalizedValue = secondResource
                            };

                            _identicalLocalizedStrings.Enqueue(compareResult);

                            AddToIdenticalStringsDedupedCollection(
                                _identicalLocalizedStringDeduped,
                                firstAssemblyName,
                                firstResourceSetEnumerator.Key.ToString(),
                                locale.ToString());
                        }
                    }
                }
            }
        }