~ubuntu-branches/ubuntu/trusty/monodevelop/trusty-proposed

« back to all changes in this revision

Viewing changes to src/core/MonoDevelop.Core/MonoDevelop.Projects.Policies/PolicySet.cs

  • Committer: Package Import Robot
  • Author(s): Jo Shields
  • Date: 2013-05-12 09:46:03 UTC
  • mto: This revision was merged to the branch mainline in revision 29.
  • Revision ID: package-import@ubuntu.com-20130512094603-mad323bzcxvmcam0
Tags: upstream-4.0.5+dfsg
ImportĀ upstreamĀ versionĀ 4.0.5+dfsg

Show diffs side-by-side

added added

removed removed

Lines of Context:
89
89
                public string Name { get; set; }
90
90
                public string Id { get; private set; }
91
91
                
92
 
                internal void AddSerializedPolicies (StreamReader reader)
 
92
                internal PolicyKey[] AddSerializedPolicies (StreamReader reader)
93
93
                {
94
94
                        if (policies == null)
95
95
                                policies = new PolicyDictionary ();
 
96
                        var keys = new List<PolicyKey> ();
96
97
                        foreach (ScopedPolicy policyPair in PolicyService.RawDeserializeXml (reader)) {
97
98
                                PolicyKey key = new PolicyKey (policyPair.PolicyType, policyPair.Scope);
98
99
                                if (policies.ContainsKey (key))
99
100
                                        throw new InvalidOperationException ("Cannot add second policy of type '" +  
100
101
                                                                             key.ToString () + "' to policy set '" + Id + "'");
 
102
                                keys.Add (key);
101
103
                                policies[key] = policyPair.Policy;
102
104
                                if (!policyPair.SupportsDiffSerialize)
103
105
                                        externalPolicies.Add (key);
104
106
                        }
105
 
                }
106
 
                
107
 
                internal void RemoveSerializedPolicies (StreamReader reader)
108
 
                {
109
 
                        if (policies == null)
110
 
                                return;
111
 
                        // NOTE: this could be more efficient if it just got the types instead of a 
112
 
                        // full deserialisation
113
 
                        foreach (ScopedPolicy policyPair in PolicyService.RawDeserializeXml (reader))
114
 
                                policies.Remove (new PolicyKey (policyPair.PolicyType, policyPair.Scope));
 
107
                        return keys.ToArray ();
115
108
                }
116
109
                
117
110
                internal bool SupportsDiffSerialize (ScopedPolicy pol)