Exemplo n.º 1
0
        private void Classify(ref UIRoot uiRoot)
        {
            if (uiRoot == null)
            {
                return;
            }
            classifier.SetRoot(uiRoot);
            panels.Clear();
            foreach (Object o in Object.FindObjectsOfType(typeof(UIPanel)))
            {
                panels.Add(((UIPanel)o).gameObject);
            }

            dups.Clear();
            foreach (UIWidgetClassifier.WidgetType widgetType in EnumUtil.Values <UIWidgetClassifier.WidgetType>())
            {
                MultiMap <string, DupEntry> slot = new MultiMap <string, DupEntry>();
                dups[widgetType] = slot;
                foreach (GameObject o in classifier.GetWidgets(widgetType))
                {
                    if (widgetType == UIWidgetClassifier.WidgetType.Label)
                    {
                        UILabel labelScript = o.GetComponentInChildren <UILabel>();
                        if (labelScript != null)
                        {
                            string name = labelScript.text;
                            slot.Add(o.name, new DupEntry(o, name));
                        }
                    }
                    else if (widgetType == UIWidgetClassifier.WidgetType.Button)
                    {
                        UILabel labelScript = o.GetComponentInChildren <UILabel>();
                        if (labelScript != null)
                        {
                            string name = labelScript.text;
                            slot.Add(o.name, new DupEntry(o, name));
                        }
                    }
                    else if (widgetType == UIWidgetClassifier.WidgetType.Input)
                    {
                        UILabel labelScript = o.GetComponentInChildren <UILabel>();
                        if (labelScript != null)
                        {
                            string name = labelScript.text;
                            slot.Add(o.name, new DupEntry(o, name));
                        }
                    }
                    else if (widgetType == UIWidgetClassifier.WidgetType.Slider)
                    {
                        slot.Add(o.name, new DupEntry(o, o.name));
                    }
                    else if (widgetType == UIWidgetClassifier.WidgetType.ProgressBar)
                    {
                        slot.Add(o.name, new DupEntry(o, o.name));
                    }
                }
            }

            RemoveSingle();
        }
        public static MultiMap<string> CreateMap()
        {
            _Log.Trace("Started");

            MultiMap<string> MultiMap = new MultiMap<string>();
            try
            {
                List<DLSSEListener.SSEListenerData> SSEListenerList = SSEListener.Retrieve();
                _Log.Debug(LogHelper.Get("SSEListenerList:=", new { SSEListenerList = SSEListenerList }));

                foreach (DLSSEListener.SSEListenerData url in SSEListenerList)
                {   //add orgid and shortcode values for same url key
                    MultiMap.Add(url.Url, url.OrgId);
                    MultiMap.Add(url.Url, url.ShortCode);
                }
            }
            catch (Exception ex)
            {
                _Log.Error(ex.Message, ex);
                throw ex;
            }

            _Log.Debug(LogHelper.Get("Final MultiMap Created:=", new { MultiMap = MultiMap }));
            return MultiMap;
        }
        public async Task <Bundle> CreateSubscriptionsWithAddOns(IEnumerable <Subscription> subscriptions, RequestOptions inputOptions, DateTime?requestedDate = null, int?timeoutSec = null)
        {
            foreach (var subscription in subscriptions)
            {
                ValidateSubscription(subscription);
            }

            var queryParams = new MultiMap <string>().Create(inputOptions.QueryParams);

            if (timeoutSec.HasValue && timeoutSec.Value > 0)
            {
                queryParams.Add(Configuration.QUERY_CALL_COMPLETION, "true");
                queryParams.Add(Configuration.QUERY_CALL_TIMEOUT, timeoutSec.Value.ToString());
            }

            if (requestedDate.HasValue)
            {
                queryParams.Add(Configuration.QUERY_REQUESTED_DT, requestedDate.Value.ToDateString());
            }

            // var httpTimeout = Math.Max(Configuration.DEFAULT_HTTP_TIMEOUT_SEC, timeoutSec ?? 0);
            var uri            = Configuration.SUBSCRIPTIONS_PATH + "/" + Configuration.CREATEENTITLEMENTS_WITHADDONS;
            var followLocation = inputOptions.FollowLocation ?? true;
            var requestOptions = inputOptions.Extend().WithQueryParams(queryParams).WithFollowLocation(followLocation).Build();

            return(await _client.Post <Bundle>(uri, subscriptions, requestOptions));
        }
        public async Task <Subscription> CreateSubscription(Subscription subscription, RequestOptions inputOptions, DateTime?requestedDate = null, bool?isMigrated = null)
        {
            ValidateSubscription(subscription);

            // var httpTimeout = Configuration.DEFAULT_HTTP_TIMEOUT_SEC;
            var followLocation = inputOptions.FollowLocation ?? true;

            var queryParams = new MultiMap <string>().Create(inputOptions.QueryParams);

            // if (timeoutSec.HasValue)
            // {
            //     queryParams.Add(Configuration.QUERY_CALL_COMPLETION, timeoutSec.Value > 0 ? "true" : "false");
            //     queryParams.Add(Configuration.QUERY_CALL_TIMEOUT, timeoutSec.Value.ToString());
            //     timeoutSec = timeoutSec.Value;
            // }
            if (requestedDate.HasValue)
            {
                queryParams.Add(Configuration.QUERY_REQUESTED_DT, requestedDate.Value.ToShortDateString());
            }

            if (isMigrated.HasValue)
            {
                queryParams.Add(Configuration.QUERY_MIGRATED, isMigrated.ToString());
            }

            var requestOptions = inputOptions.Extend().WithQueryParams(queryParams).WithFollowLocation(followLocation).Build();

            // return client.Post<Subscription>(Configuration.SUBSCRIPTIONS_PATH, subscription, requestOptions, httpTimeout);
            return(await _client.Post <Subscription>(Configuration.SUBSCRIPTIONS_PATH, subscription, requestOptions));
        }
        public async Task <Subscription> UpdateSubscription(Subscription subscription, RequestOptions inputOptions, BillingActionPolicy?billingPolicy = null, DateTime?requestedDate = null, bool?isMigrated = null)
        {
            if (subscription.SubscriptionId.Equals(Guid.Empty))
            {
                throw new ArgumentException("Subscription#subscriptionId cannot be empty");
            }

            ValidateSubscription(subscription, false);

            var uri         = Configuration.SUBSCRIPTIONS_PATH + "/" + subscription.SubscriptionId;
            var queryParams = new MultiMap <string>().Create(inputOptions.QueryParams);

            // if (timeoutSec.HasValue)
            // {
            //     queryParams.Add(Configuration.QUERY_CALL_COMPLETION, timeoutSec.Value > 0 ? "true" : "false");
            //     queryParams.Add(Configuration.QUERY_CALL_TIMEOUT, timeoutSec.Value.ToString());
            //     timeoutSec = timeoutSec.Value;
            // }
            if (requestedDate.HasValue)
            {
                queryParams.Add(Configuration.QUERY_REQUESTED_DT, requestedDate.Value.ToShortDateString());
            }

            if (billingPolicy.HasValue)
            {
                queryParams.Add(Configuration.QUERY_BILLING_POLICY, billingPolicy.ToString());
            }

            var requestOptions = inputOptions.Extend().WithQueryParams(queryParams).Build();

            return(await _client.Put <Subscription>(uri, subscription, requestOptions));
        }
Exemplo n.º 6
0
        private async Task <IEnumerable <InvoiceItem> > CreateExternalCharges(Guid accountId, IEnumerable <InvoiceItem> externalCharges, DateTime?requestedDate, bool autoPay, bool autoCommit, string paymentExternalKey, string transactionExternalKey, RequestOptions inputOptions)
        {
            var uri = Configuration.INVOICES_PATH + "/" + Configuration.CHARGES + "/" + accountId;

            var queryParams = new MultiMap <string>();

            if (requestedDate.HasValue)
            {
                queryParams.Add(Configuration.QUERY_REQUESTED_DT, requestedDate.Value.ToDateString());
            }

            queryParams.Add(Configuration.QUERY_PAY_INVOICE, autoPay.ToString());
            queryParams.Add(Configuration.QUERY_AUTO_COMMIT, autoCommit.ToString());

            if (!string.IsNullOrEmpty(paymentExternalKey))
            {
                queryParams.Add(Configuration.QUERY_PAYMENT_EXT_KEY, paymentExternalKey);
            }

            if (!string.IsNullOrEmpty(transactionExternalKey))
            {
                queryParams.Add(Configuration.QUERY_TRANSACTION_EXT_KEY, transactionExternalKey);
            }

            var requestOptions = inputOptions.Extend().WithQueryParams(queryParams).Build();

            return(await _client.Post <List <InvoiceItem> >(uri, externalCharges, requestOptions));
        }
Exemplo n.º 7
0
        public void ExampleTest()
        {
            _multiMap.Add("a", "a");
            _multiMap.Add("a", "b");
            _multiMap.Add("a", "c");

            var set = _multiMap.Get("a");

            set.Size.Should().Be(3);
            set.Get("a").Should().NotBeNull();
            set.Get("b").Should().NotBeNull();
            set.Get("c").Should().NotBeNull();

            _multiMap.Delete("a", "b");

            set = _multiMap.Get("a");
            set.Size.Should().Be(2);
            set.Get("a").Should().NotBeNull();
            set.Get("b").Should().BeNull();
            set.Get("c").Should().NotBeNull();

            _multiMap.DeleteAll("a");

            _multiMap.Get("a").Should().BeNull();
        }
        public void Add_AddsItemToCorrectCollection()
        {
            var map = new MultiMap<int, string>();
            map.Add(1, "1");
            map.Add(42, "42");

            Assert.IsTrue(map[1].SequenceEqual(new[] { "1"} ));
            Assert.IsTrue(map[42].SequenceEqual(new[] { "42" }));
        }
Exemplo n.º 9
0
 public void SetUp()
 {
     _mmp = new MultiMap <string, int>();
     _mmp.Add("Odd", 1);
     _mmp.Add("Odd", 3);
     _mmp.Add("Eve", 4);
     _mmp.Add("Eve", 8);
     _mmp.Add("Eve", 6);
 }
Exemplo n.º 10
0
 public void SetUp()
 {
     _mmp = new MultiMap<string, int>();
     _mmp.Add("Odd", 1);
     _mmp.Add("Odd", 3);
     _mmp.Add("Eve", 4);
     _mmp.Add("Eve", 8);
     _mmp.Add("Eve", 6);
 }
        public async Task DeletePaymentMethod(Guid paymentMethodId, RequestOptions inputOptions, bool deleteDefault = false, bool forceDeleteDefault = false)
        {
            var uri         = Configuration.PAYMENT_METHODS_PATH + "/" + paymentMethodId;
            var queryParams = new MultiMap <string>().Create(inputOptions.QueryParams);

            queryParams.Add(Configuration.QUERY_DELETE_DEFAULT_PM_WITH_AUTO_PAY_OFF, deleteDefault.ToString());
            queryParams.Add(Configuration.QUERY_FORCE_DEFAULT_PM_DELETION, forceDeleteDefault.ToString());
            var requestOptions = inputOptions.Extend().WithQueryParams(queryParams).Build();
            await _client.Delete(uri, requestOptions);
        }
Exemplo n.º 12
0
        public DynamicType DefineNestedType(string name, TypeAttributes attr, Type parentType, int typeSize)
        {
            TypeBuilder typeBuilder = builder.DefineNestedType(name, attr, parentType, typeSize);

            members.Add(name, typeBuilder);

            DynamicType type = new DynamicType(typeBuilder, module);

            return(type);
        }
Exemplo n.º 13
0
        static void Main(string[] args)
        {
            //new CodeGeneratorTest().TestMethod();
            //// Allow user to see the output:
            //Console.ReadLine();
            MultiMap <String> mmap = new MultiMap <String>();

            mmap.Add("A", "B");
            mmap.Add("A", "C");
        }
Exemplo n.º 14
0
        public void TestRemoveValueOnce()
        {
            MultiMap <int, int> m = new MultiMap <int, int>();

            m.Add(1, 1);
            m.Add(1, 2);
            m.Add(1, 2);
            m.removeValue(1, 2, true);
            Assert.AreEqual(m.dictionary[1][0], 1);
            Assert.AreEqual(m.dictionary[1].Count, 2);
        }
Exemplo n.º 15
0
        public virtual void Initialize(Func <IEnumerable <Annotation> > allAnnotationsFunction, IProgress progress)
        {
            var annotationsThatBelongInIndex = from a in allAnnotationsFunction()
                                               where _includeIndexPredicate(a)
                                               select a;

            foreach (var annotation in annotationsThatBelongInIndex)
            {
                _keyToObjectsMap.Add(_keyMakingFunction(annotation), annotation);
            }
        }
        // PAYMENT METHODS
        public async Task <PaymentMethod> GetPaymentMethod(Guid paymentMethodId, RequestOptions inputOptions, bool withPluginInfo = false, AuditLevel auditLevel = DefaultAuditLevel)
        {
            var uri = Configuration.PAYMENT_METHODS_PATH + "/" + paymentMethodId;

            var queryParams = new MultiMap <string>().Create(inputOptions.QueryParams);

            queryParams.Add(Configuration.QUERY_WITH_PLUGIN_INFO, withPluginInfo.ToString());
            queryParams.Add(Configuration.QUERY_AUDIT, auditLevel.ToString());
            var requestOptions = inputOptions.Extend().WithQueryParams(queryParams).Build();

            return(await _client.Get <PaymentMethod>(uri, requestOptions));
        }
        public async Task <Account> GetAccount(string externalKey, RequestOptions inputOptions, bool withBalance = false, bool withCba = false)
        {
            var uri         = Configuration.ACCOUNTS_PATH;
            var queryParams = new MultiMap <string>().Create(inputOptions.QueryParams);

            queryParams.Add(Configuration.QUERY_EXTERNAL_KEY, externalKey);
            queryParams.Add(Configuration.QUERY_ACCOUNT_WITH_BALANCE, withBalance ? "true" : "false");
            queryParams.Add(Configuration.QUERY_ACCOUNT_WITH_BALANCE_AND_CBA, withCba ? "true" : "false");
            var requestOptions = inputOptions.Extend().WithQueryParams(queryParams).Build();

            return(await _client.Get <Account>(uri, requestOptions));
        }
        // BUNDLES
        public async Task <Bundles> GetBundles(RequestOptions inputOptions, long offset = 0L, long limit = 100L, AuditLevel auditLevel = DefaultAuditLevel)
        {
            var uri         = Configuration.BUNDLES_PATH + "/" + Configuration.PAGINATION;
            var queryParams = new MultiMap <string>().Create(inputOptions.QueryParams);

            queryParams.Add(Configuration.QUERY_SEARCH_OFFSET, offset.ToString());
            queryParams.Add(Configuration.QUERY_SEARCH_LIMIT, limit.ToString());
            queryParams.Add(Configuration.QUERY_AUDIT, auditLevel.ToString());
            var requestOptions = inputOptions.Extend().WithQueryParams(queryParams).Build();

            return(await _client.Get <Bundles>(uri, requestOptions));
        }
Exemplo n.º 19
0
        // INVOICE
        public async Task <Invoice> CreateInvoice(Guid accountId, DateTime futureDate, RequestOptions inputOptions)
        {
            var followLocation = inputOptions.FollowLocation ?? true;

            var queryParams = new MultiMap <string>().Create(inputOptions.QueryParams);

            queryParams.Add(Configuration.QUERY_ACCOUNT_ID, accountId.ToString());
            queryParams.Add(Configuration.QUERY_TARGET_DATE, futureDate.ToDateString());

            var requestOptions = inputOptions.Extend().WithFollowLocation(followLocation).WithQueryParams(queryParams).Build();

            return(await _client.Post <Invoice>(Configuration.INVOICES_PATH, null, requestOptions));
        }
        public async Task <PaymentMethods> GetPaymentMethodsForAccount(Guid accountId, RequestOptions inputOptions, Dictionary <string, string> pluginProperties = null, bool withPluginInfo = false, AuditLevel auditLevel = DefaultAuditLevel)
        {
            var uri = Configuration.ACCOUNTS_PATH + "/" + accountId + "/" + Configuration.PAYMENT_METHODS;

            var queryParams = new MultiMap <string>().Create(inputOptions.QueryParams);

            queryParams.Add(Configuration.QUERY_WITH_PLUGIN_INFO, withPluginInfo.ToString());
            queryParams.Add(Configuration.QUERY_AUDIT, auditLevel.ToString());
            StorePluginPropertiesAsParams(pluginProperties, ref queryParams);
            var requestOptions = inputOptions.Extend().WithQueryParams(queryParams).Build();

            return(await _client.Get <PaymentMethods>(uri, requestOptions));
        }
Exemplo n.º 21
0
        public void TestRemoveValueEverywhere()
        {
            MultiMap <int, int> m = new MultiMap <int, int>();

            m.Add(1, 1);
            m.Add(1, 2);
            m.Add(1, 2);
            m.Add(2, 2);
            m.removeValue(2);
            Assert.AreEqual(m.dictionary[1][0], 1);
            Assert.AreEqual(m.dictionary.ContainsKey(2), false);
            Assert.AreEqual(m.dictionary[1].Count, 1);
        }
Exemplo n.º 22
0
        public void TestRemoveValueAllAtKey()
        {
            MultiMap <int, int> m = new MultiMap <int, int>();

            m.Add(1, 1);
            m.Add(1, 2);
            m.Add(1, 2);
            m.Add(2, 2);
            m.removeValue(1, 2, false);
            Assert.AreEqual(m.dictionary[1][0], 1);
            Assert.AreEqual(m.dictionary[2][0], 2);
            Assert.AreEqual(m.dictionary[1].Count, 1);
        }
Exemplo n.º 23
0
        private async Task <Invoice> GetInvoiceByIdOrNumber(string invoiceIdOrNumber, RequestOptions inputOptions, bool withItems = false, bool withChildrenItems = false, AuditLevel auditLevel = DefaultAuditLevel)
        {
            var uri = Configuration.INVOICES_PATH + "/" + invoiceIdOrNumber;

            var queryParams = new MultiMap <string>().Create(inputOptions.QueryParams);

            queryParams.Add(Configuration.QUERY_INVOICE_WITH_ITEMS, withItems.ToString());
            queryParams.Add(Configuration.QUERY_INVOICE_WITH_CHILDREN_ITEMS, withChildrenItems.ToString());
            queryParams.Add(Configuration.QUERY_AUDIT, auditLevel.ToString());

            var requestOptions = inputOptions.Extend().WithQueryParams(queryParams).Build();

            return(await _client.Get <Invoice>(uri, requestOptions));
        }
        public async Task <Accounts> GetAccounts(long offset, long limit, RequestOptions inputOptions, AuditLevel auditLevel = AuditLevel.NONE)
        {
            var uri = Configuration.ACCOUNTS_PATH + "/" + Configuration.PAGINATION;

            var queryParams = new MultiMap <string>().Create(inputOptions.QueryParams);

            queryParams.Add(Configuration.QUERY_SEARCH_OFFSET, offset.ToString());
            queryParams.Add(Configuration.QUERY_SEARCH_LIMIT, limit.ToString());
            queryParams.Add(Configuration.QUERY_AUDIT, auditLevel.ToString());

            var requestOptions = inputOptions.Extend().WithQueryParams(queryParams).Build();

            return(await _client.Get <Accounts>(uri, requestOptions));
        }
Exemplo n.º 25
0
        public async Task <Invoices> GetInvoicesForAccount(Guid accountId, RequestOptions inputOptions, bool withItems = false, bool unpaidOnly = false, bool includeMigrationInvoices = false, AuditLevel auditLevel = DefaultAuditLevel)
        {
            var uri = Configuration.ACCOUNTS_PATH + "/" + accountId + "/" + Configuration.INVOICES;

            var queryParams = new MultiMap <string>().Create(inputOptions.QueryParams);

            queryParams.Add(Configuration.QUERY_INVOICE_WITH_ITEMS, withItems.ToString());
            queryParams.Add(Configuration.QUERY_UNPAID_INVOICES_ONLY, unpaidOnly.ToString());
            queryParams.Add(Configuration.QUERY_WITH_MIGRATION_INVOICES, includeMigrationInvoices.ToString());
            queryParams.Add(Configuration.QUERY_AUDIT, auditLevel.ToString());

            var requestOptions = inputOptions.Extend().WithQueryParams(queryParams).Build();

            return(await _client.Get <Invoices>(uri, requestOptions));
        }
Exemplo n.º 26
0
        private async Task <Invoices> SearchInvoices(string key, long offset, long limit, AuditLevel auditLevel, RequestOptions inputOptions)
        {
            var utf = Encoding.UTF8.GetBytes(key);
            var uri = Configuration.INVOICES_PATH + "/" + Configuration.SEARCH + "/" + Encoding.UTF8.GetString(utf);

            var queryParams = new MultiMap <string>().Create(inputOptions.QueryParams);

            queryParams.Add(Configuration.QUERY_SEARCH_OFFSET, offset.ToString());
            queryParams.Add(Configuration.QUERY_SEARCH_LIMIT, limit.ToString());
            queryParams.Add(Configuration.QUERY_AUDIT, auditLevel.ToString());

            var requestOptions = inputOptions.Extend().WithQueryParams(queryParams).Build();

            return(await _client.Get <Invoices>(uri, requestOptions));
        }
Exemplo n.º 27
0
        public async Task <Invoices> GetInvoices(bool withItems, long offset, long limit, RequestOptions inputOptions, AuditLevel auditLevel = AuditLevel.NONE)
        {
            var uri = Configuration.INVOICES_PATH + "/" + Configuration.PAGINATION;

            var queryParams = new MultiMap <string>().Create(inputOptions.QueryParams);

            queryParams.Add(Configuration.QUERY_SEARCH_OFFSET, offset.ToString());
            queryParams.Add(Configuration.QUERY_SEARCH_LIMIT, limit.ToString());
            queryParams.Add(Configuration.QUERY_INVOICE_WITH_ITEMS, withItems.ToString());
            queryParams.Add(Configuration.QUERY_AUDIT, auditLevel.ToString());

            var requestOptions = inputOptions.Extend().WithQueryParams(queryParams).Build();

            return(await _client.Get <Invoices>(uri, requestOptions));
        }
Exemplo n.º 28
0
        /// <summary>
        /// 요소의 속성 값을 인덱싱합니다.
        /// </summary>
        private static void AddToIndex(T item, string propertyName, MultiMap <int, T> index)
        {
            if (Equals(item, null))
            {
                return;
            }

            object propertyValue = Accessor.GetPropertyValue(item, propertyName);

            if (IsDebugEnabled)
            {
                log.Debug("해당 요소[{0}] 의 속성 [{1}] 의 값은 [{2}] 입니다.", item, propertyName, propertyValue);
            }

            if (propertyValue != null)
            {
                var hash = propertyValue.GetHashCode();
                if (index.ContainsKey(hash))
                {
                    index[hash].Add(item);
                }
                else
                {
                    //List<T> newList = new List<T> {item};
                    //index.Add(hash, newList);
                    index.Add(hash, item);
                }
            }
        }
        // PRICE LIST
        public async Task <PriceList> GetPriceListFromSubscription(Guid subscriptionId, RequestOptions inputOptions, DateTime?requestedDate = null)
        {
            var uri = Configuration.CATALOG_PATH + "/" + Configuration.PRICELIST;

            var queryParams = new MultiMap <string>().Create(inputOptions.QueryParams);

            queryParams.Add(Configuration.QUERY_SUBSCRIPTION_ID, subscriptionId.ToString());
            if (requestedDate.HasValue)
            {
                queryParams.Add(Configuration.QUERY_REQUESTED_DT, requestedDate.Value.ToDateString());
            }

            var requestOptions = inputOptions.Extend().WithQueryParams(queryParams).Build();

            return(await _client.Get <PriceList>(uri, requestOptions));
        }
Exemplo n.º 30
0
 //计时器,多线程执行全选宏操作
 private void timer1_Tick(object sender, EventArgs e)
 {
     try
     {
         if (((Timer)sender).Tag.ToString() == "全选")
         {
             timer1.Stop();
             ObjectsInView = NXFun.GetSelectObjects();
             NXFun.RemoveAllSelect();
             timer1.Interval = 1000;
             timer1.Tag      = "取消全选";
             timer1.Start();
         }
         else if (((Timer)sender).Tag.ToString() == "取消全选")
         {
             timer1.Stop();
             //遍历尺寸
             List <NXOpen.Annotations.Dimension> dims = NXFun.GetDimensionInCurrentView(ObjectsInView);
             List <NXOpen.Annotations.BaseFcf>   fcfs = NXFun.GetBaseFcfInCurrentView(ObjectsInView);
             LabelDimMap.Clear();
             foreach (NXOpen.Annotations.Dimension dim in dims)
             {
                 DimInfor diminfor = NXFun.GetDimInfor(dim);
                 //存入Dictionary
                 LabelDimMap.Add(diminfor.id, diminfor);
             }
             LabelFcfMap.Clear();
             foreach (NXOpen.Annotations.BaseFcf fcf in fcfs)
             {
                 DimInfor diminfor = NXFun.GetFcfInfor(fcf);
                 LabelFcfMap.Add(diminfor.id, diminfor);
             }
             //转存到  LabelDimList
             LabelDimList.Clear();
             foreach (int k in LabelDimMap.Keys)
             {
                 foreach (DimInfor diminfor in LabelDimMap[k])
                 {
                     LabelDimList.Add(diminfor);
                 }
             }
             //转存到  LabelFcfList
             LabelFcfList.Clear();
             foreach (int k in LabelFcfMap.Keys)
             {
                 foreach (DimInfor diminfor in LabelFcfMap[k])
                 {
                     LabelFcfList.Add(diminfor);
                 }
             }
             //刷新显示
             RefreshDisplay();
             SetStatusLabel("查询结束!", 2);
         }
     }
     catch (System.Exception ex)
     {
         NXFun.MessageBox(ex.Message);
     }
 }
Exemplo n.º 31
0
        public int AddWpt(Waypoint item)
        {
            int index = graph.AddNode(item);

            searchHelper.Add(item.ID, index);
            return(index);
        }
Exemplo n.º 32
0
 public void addInterest(String messageName, Entity e)
 {
     if (myMessageInterestMap.ContainsKey(messageName) == false)
     {
         myMessageInterestMap.Add(messageName, e);
         myEntityManager.addEventInterest(messageName);
     }
     else
     {
         //already added the event listener
         if (myMessageInterestMap[messageName].Contains(e) == false)
         {
             myMessageInterestMap.Add(messageName, e);
         }
     }
 }
        private void LoadMetaData(object sender, RoutedEventArgs e)
        {
            //load images for comparison
            MultiMap<string, string> fileNamesToLocalPaths =
                new MultiMap<string, string>(StringComparer.CurrentCultureIgnoreCase);

            List<string> localPaths = Directory.GetFiles(Configuration.ImagesFolder,
                                                      "*.*", SearchOption.AllDirectories).ToList();

            localPaths.AddRange(Directory.GetFiles(Configuration.CameraFolder,
                                                      "*.*", SearchOption.AllDirectories));

            foreach (string path in localPaths)
            {
                string fileName = System.IO.Path.GetFileName(path);
                fileNamesToLocalPaths.Add(fileName, path);
            }

            foreach (SynergyRowObject sro in rowObjects)
            {
                sro.FileName = System.IO.Path.GetFileName(sro.DevicePath);

                int count = 0;

                if (fileNamesToLocalPaths.ContainsKey(sro.FileName))
                {
                    count = fileNamesToLocalPaths[sro.FileName].Count;
                }

                sro.FileNameMatchCount = count;
            }
        }
        private static void FindSparseLocations(int M, int N, float[,] V, out MultiMap <int, int> M_sparse, out MultiMap <int, int> N_sparse)
        {
            Logging.Info("+Finding sparse locations");

            M_sparse = new MultiMap <int, int>(false);
            N_sparse = new MultiMap <int, int>(false);

            int count = 0;

            for (int m = 0; m < M; ++m)
            {
                for (int n = 0; n < N; ++n)
                {
                    if (V[m, n] > 0)
                    {
                        ++count;
                        M_sparse.Add(m, n);
                        N_sparse.Add(n, m);
                    }
                }
            }

            Logging.Info("The matrix has sparseness of {0}", count / (double)(M * N));
            Logging.Info("-Finding sparse locations");
        }
Exemplo n.º 35
0
 public void Enumerate_KeyHasMultiple_ReturnsBoth()
 {
     MultiMap<string, string> m = new MultiMap<string, string>();
     m.Add("fruit","apple");
     m.Add("vegetable","broccoli");
     m.Add("fruit", "orange");
     var returned = new List<KeyValuePair<string, string>>();
     foreach (var pair in m)
     {
         returned.Add(pair);
     }
     Assert.AreEqual(3, returned.Count);
     Assert.AreEqual("apple", returned[0].Value);
     Assert.AreEqual("orange", returned[1].Value);
     Assert.AreEqual("broccoli", returned[2].Value);
     Assert.AreEqual("fruit", returned[0].Key);
     Assert.AreEqual("fruit", returned[1].Key);
     Assert.AreEqual("vegetable", returned[2].Key);
 }
Exemplo n.º 36
0
 private static MultiMap<string> _getEventConnectionsMap(IEnumerable<Connection> internalBuffers)
 {
     MultiMap<string> eventConnectionsMap = new MultiMap<string>();
     foreach (Connection connection in internalBuffers.Where(conn => conn.Type == ConnectionType.Event))
     {
         eventConnectionsMap.Add(connection.Destination, connection.Source);
     }
     return eventConnectionsMap;
 }
Exemplo n.º 37
0
        private MultiMap<string, string> GetRemoteRevisions(int offset, int quantity)
        {
            const int totalNumOfAttempts = 2;
            for (int attempt = 1; attempt <= totalNumOfAttempts; attempt++)
            {
                if (_progress.CancelRequested)
                {
                    throw new UserCancelledException();
                }
                try
                {
                    var response = _apiServer.Execute("getRevisions", new HgResumeApiParameters
                                                                          {
                                                                              RepoId = _apiServer.ProjectId,
                                                                              StartOfWindow = offset,
                                                                              Quantity = quantity
                                                                          },
                                                                          TimeoutInSeconds);
                    _progress.WriteVerbose("API URL: {0}", _apiServer.Url);
                    // API returns either 200 OK or 400 Bad Request
                    // HgR status can be: SUCCESS (200), FAIL (400) or UNKNOWNID (400)

                    if (response != null) // null means server timed out
                    {
                        if (response.HttpStatus == HttpStatusCode.ServiceUnavailable && response.Content.Length > 0)
                        {
                            var msg = String.Format("Server temporarily unavailable: {0}",
                            Encoding.UTF8.GetString(response.Content));
                            _progress.WriteError(msg);
                            return new MultiMap<string, string>();
                        }
                        if (response.HttpStatus == HttpStatusCode.OK && response.Content.Length > 0)
                        {
                            //The expected response from API version 3 follows the format of
                            //revisionhash:branch|revisionhash:branch|...
                            var revString = Encoding.UTF8.GetString(response.Content);
                            var pairs = revString.Split('|').ToList();
                            var revisions = new MultiMap<string, string>();
                            foreach (var pair in pairs)
                            {
                                var hashRevCombo = pair.Split(':');
                                if(hashRevCombo.Length < 2)
                                {
                                    throw new HgResumeOperationFailed("Failed to get remote revisions. Server/Client API format mismatch.");
                                }
                                revisions.Add(hashRevCombo[1], hashRevCombo[0]);
                            }
                            return revisions;
                        }
                        if (response.HttpStatus == HttpStatusCode.OK && response.Content.Length == 0)
                        {
                            //There were no more revisions in the range requested [edge case]
                            return new MultiMap<string, string>();
                        }
                        if (response.HttpStatus == HttpStatusCode.BadRequest && response.ResumableResponse.Status == "UNKNOWNID")
                        {
                            _progress.WriteWarning("The remote server {0} does not have repoId '{1}'", _targetLabel, _apiServer.ProjectId);
                        }
                        throw new HgResumeOperationFailed(String.Format("Failed to get remote revisions for {0}", _apiServer.ProjectId));
                    }
                    if (attempt < totalNumOfAttempts)
                    {
                        _progress.WriteWarning("Unable to contact server.  Retrying... ({0} of {1} attempts).", attempt + 1, totalNumOfAttempts);
                    }
                    else
                    {
                        _progress.WriteWarning("Failed to contact server.");
                        throw new HgResumeOperationFailed(String.Format("Failed to get remote revisions for {0}", _apiServer.ProjectId));
                    }
                }
                catch (WebException e)
                {
                    _progress.WriteError(e.Message);
                }
            }
            throw new HgResumeOperationFailed(String.Format("Failed to get remote revisions for {0}", _apiServer.ProjectId));
        }
Exemplo n.º 38
0
        private static void HandleCharStartingPattern(Dictionary<char, SearchState> mapEvolvedStates, MultiMap<char, string> mapCompletedPatterns, string sPat, char c)
        {
            if (!mapEvolvedStates.ContainsKey(c))
            {
                mapEvolvedStates.Add(c, new SearchState());
            }

            mapEvolvedStates[c].AddPatternState(new PatternState(sPat));
            if (sPat.Length == 1)
                mapCompletedPatterns.Add(c, sPat);
        }
Exemplo n.º 39
0
        //刷新显示图纸
        public void RefreshSheet()
        {
            bieluandong = true;
            SheetList.Clear();
            //得到所有prt
            List<S_Model> ModelList = XML3DPPM.GetModelList(XmlFile);
            //得到所有DrawingSheet
            foreach (S_Model model in ModelList)
            {
                if (model.a == 0 && !string.IsNullOrEmpty(model.filename) && NXFun.isFileExist(ToFullPath(model.filename)))
                {
                    //后台打开模型
                    Part part = NXFun.OpenPrtQuiet(ToFullPath(model.filename));
                    //得到DrawingSheet信息
                    MultiMap<int, S_Sheet> SheetMap = new MultiMap<int, S_Sheet>();
                    foreach (NXOpen.Drawings.DrawingSheet ds in part.DrawingSheets)
                    {
                        S_Sheet s_sheet = NXFun.GetSheetInfor(ds);
                        s_sheet.a = model.b;
                        s_sheet.prtName = model.filename;
                        SheetMap.Add(s_sheet.index_num, s_sheet);
                    }
                    //按index_num排序
                    int num = 1;
                    S_Sheet temp;
                    foreach (int k in SheetMap.Keys)
                    {
                        foreach (S_Sheet s in SheetMap[k])
                        {
                            temp = s;
                            temp.index_num = num;
                            NXFun.SetStringAttr(NXFun.GetSheetByGuid(ToFullPath(model.filename), s.guid), "NUMBER", num.ToString());
                            SheetList.Add(temp);
                            num++;
                        }
                    }
                }
            }
            dgvChart.Rows.Clear();
            //显示到界面
            for (int i = 0; i < SheetList.Count; i++)
            {
                string name = "";
                if (SheetList[i].a == 0)
                {
                    name = "工艺";
                }
                else
                {
                    name = "工序" + XML3DPPM.GetIndexAttr(SheetList[i].a, "gongxuhao", XmlFile);
                }
                dgvChart.Rows.Add(name);
                dgvChart[1, i].Value = SheetList[i].prtName;
                dgvChart[2, i].Value = SheetList[i].Remark;
                dgvChart[3, i].Value = NXFun.string2bool(SheetList[i].IsPrint);
                dgvChart[4, i].Value = NXFun.string2bool(SheetList[i].IsChecked);
            }
            //得到当前显示的 Sheet 并高亮对应行
            //  highlight_row = -1;
            string guid = NXFun.OnShowSheetGuid;
            string prt = NXFun.WorkPrtName;

            int index = SheetList.FindIndex(delegate(S_Sheet s) { return s.guid == guid && s.prtName == prt; });
            if (index != -1)
            {
                for (int i = 0; i < dgvChart.RowCount; i++)
                {
                    dgvChart.Rows[i].DefaultCellStyle.BackColor = i == index ? Color.Yellow : Color.White;
                }
            }
            bieluandong = false;
            dgvChart.ClearSelection();
        }
Exemplo n.º 40
0
        private void MenuItemFindTopLevelFolder_Click(object sender, RoutedEventArgs e)
        {
            string uri = NineWorldsDeep.UI.Prompt.ForNwdUri();

            Parser.Parser p = new Parser.Parser();

            string nodeName = p.GetKeyNode(0, uri);

            MultiMap<string, NwdPortableDeviceObject> uriNodeToPdos =
                new MultiMap<string, NwdPortableDeviceObject>();

            var col = new NwdPortableDeviceCollection();

            try
            {
                col.Refresh();
            }
            catch (Exception ex)
            {
                Display.Exception(ex);
            }

            foreach (var device in col)
            {
                if (device.RootFolder != null)
                {
                    //device level
                    foreach (NwdPortableDeviceObject pdo
                        in device.RootFolder.Files)
                    {
                        //internal vs external storage level
                        if (pdo is NwdPortableDeviceFolder)
                        {
                            NwdPortableDeviceFolder folder =
                                (NwdPortableDeviceFolder)pdo;

                            folder.Refresh(device);

                            if (folder.Files != null)
                            {
                                foreach (NwdPortableDeviceObject pdoTopLevelFolderOrFile in folder.Files)
                                {
                                    //top level folder level

                                    if (pdoTopLevelFolderOrFile.Name.Equals(nodeName))
                                    {
                                        uriNodeToPdos.Add(nodeName, pdoTopLevelFolderOrFile);
                                    }
                                }
                            }
                        }
                    }
                }
            }

            MessageBox.Show("found " + uriNodeToPdos[nodeName].Count() + " matching nodes");
        }
Exemplo n.º 41
0
        private static void HandleCharEvolvingPattern(Dictionary<char, SearchState> mapEvolvedStates, MultiMap<char, string> mapCompletedPatterns, PatternState ps, char c)
        {
            if (ps.DotPos + 1 == ps.PatternString.Length)
            {
                mapCompletedPatterns.Add(c, ps.PatternString);
            }

            if (!mapEvolvedStates.ContainsKey(c))
                mapEvolvedStates.Add(c, new SearchState());

            mapEvolvedStates[c].AddPatternState(ps.NextStep());
        }
Exemplo n.º 42
0
        private void ProcessPdo(NwdPortableDevice device,
                                NwdPortableDeviceObject pdo,
                                ref NwdUri uri,
                                ref MultiMap<string, NwdPortableDeviceObject> found)
        {
            if (uri.HasNodeKeysInStack())
            {
                if (pdo is NwdPortableDeviceFolder)
                {
                    NwdPortableDeviceFolder nextFolder =
                        (NwdPortableDeviceFolder)pdo;

                    found.Add(uri.CurrentTraversalUri, pdo);

                    //uri has one level popped, pass the modified uri and
                    //the newly found folder to the next level of recursion
                    Retrieve(device, nextFolder, ref uri, ref found);
                }
                else
                {
                    //bad key (found name but not a folder and keystack isn't empty, so just return)

                    //do nothing
                }
            }
            else
            {
                //finished
                found.Add(uri.CurrentTraversalUri, pdo);
            }
        }
            public bool AddValue(string value, MultiMap<Argument, object> argumentValues,
                CommandLineErrorReporter reporter)
            {
                if (!AllowMultiple && argumentValues.ContainsKey(this))
                {
                    reporter(string.Format(Resources.CommandLineArgumentParser_Argument_DuplicateArgument, LongName));
                    return false;
                }

                object newValue;
                if (!ParseValue(ValueType, value, out newValue))
                {
                    reporter(string.Format(Resources.CommandLineArgumentParser_Argument_InvalidArgumentValue, LongName, value));
                    return false;
                }

                if (Unique && argumentValues.Contains(this, newValue))
                {
                    reporter(string.Format(Resources.CommandLineArgumentParser_Argument_DuplicateArgumentValueExpectedUnique, LongName, value));
                    return false;
                }

                argumentValues.Add(this, newValue);
                return true;
            }
Exemplo n.º 44
0
        private List<Revision> GetCommonBaseHashesWithRemoteRepo(bool useCache)
        {
            if (useCache && LastKnownCommonBases.Count > 0)
            {
                return LastKnownCommonBases;
            }
            int offset = 0;
            var localRevisions = new MultiMap<string, Revision>();
            foreach (var rev in  _repo.GetAllRevisions())
            {
                localRevisions.Add(rev.Branch, rev);
            }

            //The goal here is to to return the first common revision of each branch.
            var commonBases = new List<Revision>();
            var localBranches = new List<string>(localRevisions.Keys);
            while (commonBases.Count < localRevisions.Keys.Count())
            {
                var remoteRevisions = GetRemoteRevisions(offset, RevisionRequestQuantity);
                if (remoteRevisions.Keys.Count() == 1 && remoteRevisions[remoteRevisions.Keys.First()].First().Split(':')[0] == "0")
                {
                    // special case when remote repo is empty (initialized with no changesets)
                    return new List<Revision>();
                }
                var branchesMatched = new List<string>(); // track branches that we've already found a common revision for
                foreach (var branch in localBranches)
                {
                    var localList = localRevisions[branch];
                    var remoteList = remoteRevisions[branch];
                    foreach (var revision in remoteList)
                    {
                        var remoteRevision = revision; //copy to local for use in predicate
                        var commonRevision = localList.Find(localRev => localRev.Number.Hash == remoteRevision);
                        if (commonRevision != null)
                        {
                            commonBases.Add(commonRevision);
                            branchesMatched.Add(branch); // found a common revision for this branch
                            break;
                        }
                    }
                }
                localBranches.RemoveAll(branchesMatched.Contains); // stop looking for common revisions in branches we matched
                if(remoteRevisions.Count() < RevisionRequestQuantity)
                {
                    //we did not find a common revision for each branch, but we ran out of revisions from the repo
                    break;
                }
                offset += RevisionRequestQuantity;
            }

            // If we have found no common revisions at this point, the remote repo is unrelated
            if (commonBases.Count == 0)
            {
                return null;
            }

            LastKnownCommonBases = commonBases;
            return commonBases;
        }
        /// <summary>
        /// Creates a tree generator from a specified XML document.
        /// </summary>
        /// <param name="document">The XML document to parse.</param>
        /// <returns>A new tree generator.</returns>
        /// <exception cref="ArgumentException">If the XML document is not a valid tree specification.</exception>
        public static TreeGenerator CreateFromXml(XmlDocument document)
        {
            var generator = new TreeGenerator();
            string rootName = null;
            int levels = -1;
            int boneLevels = 3;
            var productions = new MultiMap<string, ProductionNodePair>();

            XmlNode root = document.SelectSingleNode("Tree");

            foreach (XmlNode child in root.ChildNodes)
            {
                switch (child.Name)
                {
                    case "Root":
                        rootName = XmlUtil.GetString(child, "ref");
                        break;

                    case "Levels":
                        levels = XmlUtil.GetInt(child, "value");
                        break;

                    case "BoneLevels":
                        boneLevels = XmlUtil.GetInt(child, "value");
                        break;

                    case "LeafAxis":
                        generator.LeafAxis = XmlUtil.GetVector3(child, "value");
                        generator.LeafAxis.Value.Normalize();
                        break;

                    case "Production":
                        string name = XmlUtil.GetString(child, "id");
                        productions.Add(name, new ProductionNodePair(new Production(), child));
                        break;

                    case "ConstrainUnderground":
                        generator.Constraints.Constaints.Add(
                            new ConstrainUndergroundBranches(XmlUtil.GetFloat(child, "lowerBound", 256.0f)));
                        break;

                    case "TextureHeight":
                        generator.TextureHeight = XmlUtil.GetFloat(child, "height");
                        generator.TextureHeightVariation = XmlUtil.GetFloat(child, "variation", 0.0f);
                        break;
                }
            }

            if (rootName == null)
                throw new ArgumentException("Root name must be specified.");

            // Now we have a map of names -> productions, so we can start parsing the the productions
            foreach (ProductionNodePair pn in productions.Values)
            {
                ParseInstructionsFromXml(pn.Node, pn.Production.Instructions, productions);
            }

            generator.Root = productions[rootName][0].Production;
            generator.MaxLevel = levels;
            generator.BoneLevels = boneLevels;

            return generator;
        }
Exemplo n.º 46
0
        private static IList<PluginData> TopologicalSortByDependencies(IList<PluginData> plugins)
        {
            Dictionary<string, PluginData> pluginsById = new Dictionary<string, PluginData>();
            Dictionary<PluginData, int> outgoingDependencyCounts = new Dictionary<PluginData, int>();
            MultiMap<PluginData, PluginData> incomingPluginDependencies = new MultiMap<PluginData, PluginData>();
            Queue<PluginData> isolatedPlugins = new Queue<PluginData>();

            foreach (PluginData plugin in plugins)
            {
                pluginsById[plugin.Plugin.PluginId] = plugin;
                outgoingDependencyCounts[plugin] = 0;
            }

            foreach (PluginData plugin in plugins)
            {
                foreach (Dependency dependency in plugin.Plugin.Dependencies)
                {
                    PluginData pluginDependency;
                    if (pluginsById.TryGetValue(dependency.PluginId, out pluginDependency))
                    {
                        incomingPluginDependencies.Add(pluginDependency, plugin);
                        outgoingDependencyCounts[plugin] += 1;
                    }
                }
            }

            foreach (var pair in outgoingDependencyCounts)
            {
                if (pair.Value == 0)
                    isolatedPlugins.Enqueue(pair.Key);
            }

            List<PluginData> result = new List<PluginData>(plugins.Count);

            while (isolatedPlugins.Count != 0)
            {
                PluginData plugin = isolatedPlugins.Dequeue();

                result.Add(plugin);

                foreach (PluginData incomingPluginDependency in incomingPluginDependencies[plugin])
                {
                    int newCount = outgoingDependencyCounts[incomingPluginDependency] -= 1;
                    if (newCount == 0)
                        isolatedPlugins.Enqueue(incomingPluginDependency);
                }
            }

            if (result.Count != plugins.Count)
            {
                StringBuilder message = new StringBuilder();
                message.Append("Could not topologically sort the following plugins either due to dependency cycles or duplicate dependencies: ");

                bool first = true;
                foreach (var pair in outgoingDependencyCounts)
                {
                    if (pair.Value != 0)
                    {
                        if (first)
                            first = false;
                        else
                            message.Append(", ");

                        message.Append("'").Append(pair.Key.Plugin.PluginId).Append("'");
                    }
                }

                message.Append(".");
                throw new RuntimeException(message.ToString());
            }

            return result;
        }
        private void SetCommandDependency(Dictionary<Test, ManagedTestCommand> commands,
            MultiMap<ManagedTestCommand, ManagedTestCommand> siblingDependencies,
            Test source, Test target)
        {
            if (source == target)
                throw new ModelException(String.Format("Test '{0}' has an invalid dependency on itself.", source.FullName));

            Stack<Test> sourceAncestors = CreateAncestorStack(source);
            Stack<Test> targetAncestors = CreateAncestorStack(target);

            Test sourceAncestor, targetAncestor;
            do
            {
                if (sourceAncestors.Count == 0)
                    throw new ModelException(String.Format("Test '{0}' has an invalid dependency on its own descendant '{1}'.",
                        source.FullName, target.FullName));
                if (targetAncestors.Count == 0)
                    throw new ModelException(String.Format("Test '{0}' has an invalid dependency on its own ancestor '{1}'.",
                        source.FullName, target.FullName));

                sourceAncestor = sourceAncestors.Pop();
                targetAncestor = targetAncestors.Pop();
            }
            while (sourceAncestor == targetAncestor);

            // In order to ensure that the dependency is evaluated in the right order,
            // the current sourceAncestor must be executed after the current targetAncestor.
            // So we create an edge from the sourceAncestor command to its sibling
            // targetAncestor command upon which it depends.
            siblingDependencies.Add(commands[sourceAncestor], commands[targetAncestor]);
        }
Exemplo n.º 48
0
        public void TestCase()
        {
            var map = new MultiMap<string,string>();
            {
                map.Add("key1", "value11");
                map.Add("key1", "value12");
                map.Add("key1", "value13");

                map.Add("key2", "value21");
                map.Add("key2", "value22");

                map.Add("key3", "value31");
            }

            Assert.AreEqual(3, map.Keys.Count);
            CollectionAssert.AreEqual(new []{ "key1", "key2", "key3" }, map.Keys);

            Assert.AreEqual(3, map.Values.Count);

            Assert.IsTrue(map.ContainsKey("key1"));
            Assert.IsTrue(map.ContainsKey("key2"));
            Assert.IsTrue(map.ContainsKey("key3"));

            Assert.IsTrue(map.ContainsValue("value11"));
            Assert.IsTrue(map.ContainsValue("value12"));
            Assert.IsTrue(map.ContainsValue("value13"));
            Assert.IsTrue(map.ContainsValue("value21"));
            Assert.IsTrue(map.ContainsValue("value22"));
            Assert.IsTrue(map.ContainsValue("value31"));

            Assert.AreEqual(3, map["key1"].Count);
            CollectionAssert.AreEqual(new []{ "value11", "value12", "value13" }, map["key1"]);

            Assert.AreEqual(2, map["key2"].Count);
            CollectionAssert.AreEqual(new []{ "value21", "value22" }, map["key2"]);

            Assert.AreEqual(1, map["key3"].Count);
            CollectionAssert.AreEqual(new []{ "value31" }, map["key3"]);

            using (var tmpfile = new TemporaryFile())
            {
                PersistenceHelper.SaveObj(map, tmpfile.FullName);
                var deserialized = PersistenceHelper.RestoreObj<MultiMap<string,string>>(tmpfile.FullName);

                Assert.AreEqual(3, deserialized.Keys.Count);
                CollectionAssert.AreEqual(new []{ "key1", "key2", "key3" }, deserialized.Keys);

                Assert.AreEqual(3, deserialized.Values.Count);

                Assert.IsTrue(deserialized.ContainsKey("key1"));
                Assert.IsTrue(deserialized.ContainsKey("key2"));
                Assert.IsTrue(deserialized.ContainsKey("key3"));

                Assert.IsTrue(deserialized.ContainsValue("value11"));
                Assert.IsTrue(deserialized.ContainsValue("value12"));
                Assert.IsTrue(deserialized.ContainsValue("value13"));
                Assert.IsTrue(deserialized.ContainsValue("value21"));
                Assert.IsTrue(deserialized.ContainsValue("value22"));
                Assert.IsTrue(deserialized.ContainsValue("value31"));
            }
        }