コード例 #1
0
        private void LoadSortedSet(SiteMapIntellisenseData data, Func <SiteMapIntellisenseData, SortedSet <string> > getSortedSet)
        {
            var thisSortedSet = getSortedSet(this);
            var dataSortedSet = getSortedSet(data);

            foreach (var value in thisSortedSet)
            {
                if (!thisSortedSet.Contains(value))
                {
                    thisSortedSet.Add(value);
                }
            }
        }
コード例 #2
0
        private static SiteMapIntellisenseData Get(Guid connectionId)
        {
            var filePath = GetFilePath(connectionId);

            SiteMapIntellisenseData result = null;

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

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

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

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

            return(result);
        }
コード例 #3
0
        private void MergeDataFromDisk(SiteMapIntellisenseData data)
        {
            if (data == null)
            {
                return;
            }

            CreateCollectionIfNeaded();

            LoadSortedSet(data, d => d.Urls);

            LoadSortedSet(data, d => d.ResourceIds);
            LoadSortedSet(data, d => d.DescriptionResourceIds);
            LoadSortedSet(data, d => d.ToolTipResourseIds);

            LoadSortedSet(data, d => d.Icons);

            LoadSortedSet(data, d => d.GetStartedPanePaths);
            LoadSortedSet(data, d => d.GetStartedPanePathOutlooks);
            LoadSortedSet(data, d => d.GetStartedPanePathAdmins);
            LoadSortedSet(data, d => d.GetStartedPanePathAdminOutlooks);

            LoadSortedSet(data, d => d.CheckExtensionProperties);

            foreach (var dashboardData in data.Dashboards.Values)
            {
                if (!this.Dashboards.ContainsKey(dashboardData.FormId.Value))
                {
                    this.Dashboards.TryAdd(dashboardData.FormId.Value, dashboardData);
                }
                else
                {
                    this.Dashboards[dashboardData.FormId.Value].MergeDataFromDisk(dashboardData);
                }
            }
        }