コード例 #1
0
        public void PopulateSyncObjectData()
        {
            this.SyncObjectData = string.Empty;
            SortedDictionary <string, object> sortedDictionary = new SortedDictionary <string, object>();

            foreach (PropertyDefinition propertyDefinition in this.MySyncObject.Schema.AllProperties)
            {
                SyncPropertyDefinition syncPropertyDefinition = propertyDefinition as SyncPropertyDefinition;
                if (syncPropertyDefinition != null && this.MySyncObject.IsPropertyPresent(syncPropertyDefinition))
                {
                    object        obj          = this.MySyncObject[syncPropertyDefinition];
                    ISyncProperty syncProperty = obj as ISyncProperty;
                    if (syncProperty != null)
                    {
                        if (!syncProperty.HasValue)
                        {
                            continue;
                        }
                        obj = syncProperty.GetValue();
                    }
                    if (obj != null)
                    {
                        if (SuppressingPiiContext.NeedPiiSuppression)
                        {
                            obj = SuppressingPiiProperty.TryRedact(syncPropertyDefinition, obj, null);
                        }
                        IList list = obj as IList;
                        if (list != null)
                        {
                            StringBuilder stringBuilder = new StringBuilder();
                            stringBuilder.Append("(");
                            for (int i = 0; i < list.Count; i++)
                            {
                                if (i == 0)
                                {
                                    stringBuilder.Append(list[i].ToString());
                                }
                                else
                                {
                                    stringBuilder.AppendFormat(",{0}", list[i].ToString());
                                }
                            }
                            stringBuilder.Append(")");
                            obj = stringBuilder.ToString();
                        }
                        sortedDictionary[propertyDefinition.Name] = obj;
                    }
                }
            }
            StringBuilder stringBuilder2 = new StringBuilder();

            foreach (string text in sortedDictionary.Keys)
            {
                object obj2 = sortedDictionary[text];
                stringBuilder2.AppendFormat("[{0}]:{1}\r\n", text, obj2.ToString());
            }
            this.SyncObjectData = stringBuilder2.ToString();
        }
コード例 #2
0
        internal GenericSyncPropertyFactory()
        {
            this.defaultValueSingle = SyncProperty <T> .NoChange;
            ISyncProperty syncProperty;

            if (!(typeof(T) == typeof(ProxyAddress)))
            {
                ISyncProperty noChange = SyncProperty <MultiValuedProperty <T> > .NoChange;
                syncProperty = noChange;
            }
            else
            {
                syncProperty = SyncProperty <ProxyAddressCollection> .NoChange;
            }
            this.defaultValueMVP = syncProperty;
        }