private void MergeDataFromDisk(ConnectionWebResourceIntellisenseData data)
        {
            if (data == null)
            {
                return;
            }

            CreateCollectionIfNeaded();

            foreach (var webResourceData in data.WebResourcesAll.Values)
            {
                if (!this.WebResourcesAll.ContainsKey(webResourceData.Name))
                {
                    this.WebResourcesAll.TryAdd(webResourceData.Name, webResourceData);
                }
                else
                {
                    this.WebResourcesAll[webResourceData.Name].MergeDataFromDisk(webResourceData);
                }
            }
        }
        private static ConnectionWebResourceIntellisenseData Get(Guid connectionId)
        {
            var filePath = GetFilePath(connectionId);

            ConnectionWebResourceIntellisenseData result = null;

            if (File.Exists(filePath))
            {
                DataContractSerializer ser = new DataContractSerializer(typeof(ConnectionWebResourceIntellisenseData));

                using (Mutex mutex = new Mutex(false, FileOperations.GetMutexName(filePath)))
                {
                    try
                    {
                        mutex.WaitOne();

                        using (var sr = File.OpenRead(filePath))
                        {
                            result              = ser.ReadObject(sr) as ConnectionWebResourceIntellisenseData;
                            result.FilePath     = filePath;
                            result.ConnectionId = connectionId;
                        }
                    }
                    catch (Exception ex)
                    {
                        DTEHelper.WriteExceptionToLog(ex);

                        FileOperations.CreateBackUpFile(filePath, ex);
                    }
                    finally
                    {
                        mutex.ReleaseMutex();
                    }
                }
            }

            return(result);
        }