/// <exception cref="ArgumentNullException">
        ///     Thrown when a null reference is passed to a method that does not accept it as a
        ///     valid argument.
        /// </exception>
        internal HttpRequestMessage GetTokenByPinRequest(string url, string pin, string clientId, string clientSecret)
        {
            if (string.IsNullOrWhiteSpace(url))
                throw new ArgumentNullException(nameof(url));

            if (string.IsNullOrWhiteSpace(pin))
                throw new ArgumentNullException(nameof(pin));

            if (string.IsNullOrWhiteSpace(clientId))
                throw new ArgumentNullException(nameof(clientId));

            if (string.IsNullOrWhiteSpace(clientSecret))
                throw new ArgumentNullException(nameof(clientSecret));

            var parameters = new Dictionary<string, string>
            {
                {"client_id", clientId},
                {"client_secret", clientSecret},
                {"grant_type", "pin"},
                {"pin", pin}
            };

            var request = new HttpRequestMessage(HttpMethod.Post, url)
            {
                Content = new FormUrlEncodedContent(parameters.ToArray())
            };

            return request;
        }
        /// <exception cref="ArgumentNullException"></exception>
        internal HttpRequestMessage CreateCommentRequest(string url, string comment, string imageId, string parentId)
        {
            if (string.IsNullOrEmpty(url))
                throw new ArgumentNullException(nameof(url));

            if (string.IsNullOrEmpty(comment))
                throw new ArgumentNullException(nameof(comment));

            if (string.IsNullOrEmpty(imageId))
                throw new ArgumentNullException(nameof(imageId));

            var parameters = new Dictionary<string, string>
            {
                {"image_id", imageId},
                {"comment", comment}
            };

            if (!string.IsNullOrWhiteSpace(parentId))
                parameters.Add("parent_id", parentId);

            var request = new HttpRequestMessage(HttpMethod.Post, url)
            {
                Content = new FormUrlEncodedContent(parameters.ToArray())
            };

            return request;
        }
        /// <exception cref="ArgumentNullException">
        ///     Thrown when a null reference is passed to a method that does not accept it as a
        ///     valid argument.
        /// </exception>
        internal HttpRequestMessage PublishToGalleryRequest(string url, string title,
            string topicId = null, bool? bypassTerms = null, bool? mature = null)
        {
            if (string.IsNullOrWhiteSpace(url))
                throw new ArgumentNullException(nameof(url));

            if (string.IsNullOrWhiteSpace(title))
                throw new ArgumentNullException(nameof(title));

            var parameters = new Dictionary<string, string> {{nameof(title), title}};

            if (topicId != null)
                parameters.Add("topic", topicId);

            if (bypassTerms != null)
                parameters.Add("terms", $"{bypassTerms}".ToLower());

            if (mature != null)
                parameters.Add(nameof(mature), $"{mature}".ToLower());

            var request = new HttpRequestMessage(HttpMethod.Post, url)
            {
                Content = new FormUrlEncodedContent(parameters.ToArray())
            };

            return request;
        }
Example #4
0
        static int GetGems(string[] stones)
        {
            var elements = new Dictionary<char, bool>();

            for (var j = 0; j < stones[0].Length; j++)
            {
                var c = stones[0][j];
                if (!elements.ContainsKey(stones[0][j]))
                {
                    elements.Add(c, true);
                }
            }

            for (var i = 1; i < stones.Length; i++)
            {
                var arr = elements.ToArray();

                for (var j = 0; j < arr.Length; j++)
                {
                    var c = arr[j].Key;
                    if (stones[i].IndexOf(c) == -1)
                    {
                        elements.Remove(c);
                    }
                }

            }

            return elements.Keys.Count();
        }
        internal HttpRequestMessage PublishRequest(string url, string title, string topic, bool? acceptTerms, bool? nsfw)
        {
            if (string.IsNullOrEmpty(url))
                throw new ArgumentNullException(nameof(url));

            if (string.IsNullOrEmpty(title))
                throw new ArgumentNullException(nameof(title));

            var parameters = new Dictionary<string, string>()
            {
                { "title", title }
            };

            if (!string.IsNullOrEmpty(topic))
                parameters.Add("topic", topic);

            if (acceptTerms != null)
                parameters.Add("terms", (bool)acceptTerms ? "1" : "0");

            if (nsfw != null)
                parameters.Add("mature", (bool)nsfw ? "1" : "0");

            var request = new HttpRequestMessage(HttpMethod.Post, url)
            {
                Content = new FormUrlEncodedContent(parameters.ToArray())
            };

            return request;
        }
        /// <exception cref="ArgumentNullException">
        ///     Thrown when a null reference is passed to a method that does not accept it as a
        ///     valid argument.
        /// </exception>
        internal HttpRequestMessage CreateAlbumRequest(string url,
            string title = null, string description = null,
            AlbumPrivacy? privacy = null, AlbumLayout? layout = null,
            string coverId = null, IEnumerable<string> imageIds = null)
        {
            if (string.IsNullOrWhiteSpace(url))
                throw new ArgumentNullException(nameof(url));

            var parameters = new Dictionary<string, string>();

            if (privacy != null)
                parameters.Add(nameof(privacy), $"{privacy}".ToLower());

            if (layout != null)
                parameters.Add(nameof(layout), $"{layout}".ToLower());

            if (coverId != null)
                parameters.Add("cover", coverId);

            if (title != null)
                parameters.Add(nameof(title), title);

            if (description != null)
                parameters.Add(nameof(description), description);

            if (imageIds != null)
                parameters.Add("ids", string.Join(",", imageIds));

            var request = new HttpRequestMessage(HttpMethod.Post, url)
            {
                Content = new FormUrlEncodedContent(parameters.ToArray())
            };

            return request;
        }
Example #7
0
		public static Script ParseScript(string s)
		{
			MemoryStream result = new MemoryStream();
			if(mapOpNames.Count == 0)
			{
				mapOpNames = new Dictionary<string, OpcodeType>(Op._OpcodeByName);
				foreach(var kv in mapOpNames.ToArray())
				{
					if(kv.Key.StartsWith("OP_", StringComparison.Ordinal))
					{
						var name = kv.Key.Substring(3, kv.Key.Length - 3);
						mapOpNames.AddOrReplace(name, kv.Value);
					}
				}
			}

			var words = s.Split(' ', '\t', '\n');

			foreach(string w in words)
			{
				if(w == "")
					continue;
				if(w.All(l => l.IsDigit()) ||
					(w.StartsWith("-") && w.Substring(1).All(l => l.IsDigit())))
				{

					// Number
					long n = long.Parse(w);
					Op.GetPushOp(new BigInteger(n)).WriteTo(result);
				}
				else if(w.StartsWith("0x") && HexEncoder.IsWellFormed(w.Substring(2)))
				{
					// Raw hex data, inserted NOT pushed onto stack:
					var raw = Encoders.Hex.DecodeData(w.Substring(2));
					result.Write(raw, 0, raw.Length);
				}
				else if(w.Length >= 2 && w.StartsWith("'") && w.EndsWith("'"))
				{
					// Single-quoted string, pushed as data. NOTE: this is poor-man's
					// parsing, spaces/tabs/newlines in single-quoted strings won't work.
					var b = TestUtils.ToBytes(w.Substring(1, w.Length - 2));
					Op.GetPushOp(b).WriteTo(result);
				}
				else if(mapOpNames.ContainsKey(w))
				{
					// opcode, e.g. OP_ADD or ADD:
					result.WriteByte((byte)mapOpNames[w]);
				}
				else
				{
					Assert.True(false, "Invalid test");
					return null;
				}
			}

			return new Script(result.ToArray());
		}
Example #8
0
        public RecognizedGesture(Dictionary<string, SimpleGesture[]> gestures)
        {
            if (gestures == null || gestures.Count < 1)
                throw new ArgumentNullException("gestures");

            Gesture = gestures.ToArray();

            Machines = (from g in Gesture select new KeyValuePair<string, RecognitionSequenceMachine>(g.Key, new RecognitionSequenceMachine(g.Value))).ToArray();
        }
        public void DictionaryExtensions_Unit_AsReadOnly_Optimal()
        {
            IDictionary<String, DateTime> dictionary = new Dictionary<String, DateTime>() {
                { "One", DateTime.Today.AddDays(-1) },
                { "Two", DateTime.Today },
                { "Three", DateTime.Today.AddDays(1) } };

            ReadOnlyDictionary<String, DateTime> actual = DictionaryExtensions.AsReadOnly(dictionary);
            CollectionAssert.AreEquivalent(dictionary.ToArray(pair => pair), actual.ToArray(pair => pair));
        }
		public MainMenuSource (Dictionary<string,Action> buttonDictionary)
		{
			TableCells = new List<UITableViewCell> ();
			ButtonArray = buttonDictionary.ToArray ();
			foreach (var buttonProperty in ButtonArray) {
				var cell = new UITableViewCell ();
				cell.TextLabel.Text = buttonProperty.Key;
				TableCells.Add (cell);
			}
		}
        internal HttpRequestMessage ReportCommentRequest(string url, ReportReason reason)
        {
            var parameters = new Dictionary<string, string>
            {
                {"reason", ((int) reason).ToString()}
            };

            var request = new HttpRequestMessage(HttpMethod.Post, url)
            {
                Content = new FormUrlEncodedContent(parameters.ToArray())
            };

            return request;
        }
        static void Main(string[] args)
        {
            Dictionary<string, string> dictionary = new Dictionary<string, string>();
            dictionary.Add("contacts[0].Name", "张三");
            dictionary.Add("contacts[0].PhoneNo", "123456789");
            dictionary.Add("contacts[0].EmailAddress", "[email protected]");
            dictionary.Add("contacts[1].Name", "李四");
            dictionary.Add("contacts[1].PhoneNo", "987654321");
            dictionary.Add("contacts[1].EmailAddress", "[email protected]");

            NameValuePairsValueProvider valueProvider = new NameValuePairsValueProvider(dictionary.ToArray(), null);

            //Prefix=""
            Console.WriteLine("Prefix: <Empty>");
            Console.WriteLine("{0,-14}{1}", "Key", "Value");
            IDictionary<string, string> keys = valueProvider.GetKeysFromPrefix(string.Empty);
            foreach (var item in keys)
            {
                Console.WriteLine("{0,-14}{1}", item.Key, item.Value);
            }

            //Prefix="contact"
            Console.WriteLine("\nPrefix: contact");
            Console.WriteLine("{0,-14}{1}", "Key", "Value");
            keys = valueProvider.GetKeysFromPrefix("contact");
            foreach (var item in keys)
            {
                Console.WriteLine("{0,-14}{1}", item.Key, item.Value);
            }

            //Prefix="contacts[0]"
            Console.WriteLine("\nPrefix: contacts[0]");
            Console.WriteLine("{0,-14}{1}", "Key", "Value");
            keys = valueProvider.GetKeysFromPrefix("contacts[0]");
            foreach (var item in keys)
            {
                Console.WriteLine("{0,-14}{1}", item.Key, item.Value);
            }

            //Prefix="contacts[1]"
            Console.WriteLine("\nPrefix: contacts[1]");
            Console.WriteLine("{0,-14}{1}", "Key", "Value");
            keys = valueProvider.GetKeysFromPrefix("contacts[1]");
            foreach (var item in keys)
            {
                Console.WriteLine("{0,-14}{1}", item.Key, item.Value);
            }
        }
        /// <exception cref="ArgumentNullException"></exception>
        /// <exception cref="ArgumentException"></exception>
        internal HttpRequestMessage UpdateAccountSettingsRequest(
            string url,
            string bio = null,
            bool? publicImages = null,
            bool? messagingEnabled = null,
            AlbumPrivacy? albumPrivacy = null,
            bool? acceptedGalleryTerms = null,
            string username = null,
            bool? showMature = null,
            bool? newsletterSubscribed = null)
        {
            if (string.IsNullOrEmpty(url))
                throw new ArgumentNullException(nameof(url));

            var parameters = new Dictionary<string, string>();

            if (publicImages != null)
                parameters.Add("public_images", $"{publicImages}".ToLower());

            if (messagingEnabled != null)
                parameters.Add("messaging_enabled", $"{messagingEnabled}".ToLower());

            if (albumPrivacy != null)
                parameters.Add("album_privacy", $"{albumPrivacy}".ToLower());

            if (acceptedGalleryTerms != null)
                parameters.Add("accepted_gallery_terms", $"{acceptedGalleryTerms}".ToLower());

            if (showMature != null)
                parameters.Add("show_mature", $"{showMature}".ToLower());

            if (newsletterSubscribed != null)
                parameters.Add("newsletter_subscribed", $"{newsletterSubscribed}".ToLower());

            if (!string.IsNullOrWhiteSpace(username))
                parameters.Add(nameof(username), username);

            if (!string.IsNullOrWhiteSpace(bio))
                parameters.Add(nameof(bio), bio);

            var request = new HttpRequestMessage(HttpMethod.Post, url)
            {
                Content = new FormUrlEncodedContent(parameters.ToArray())
            };

            return request;
        }
        internal HttpRequestMessage PostReportRequest(string url, Reporting reason)
        {
            if (string.IsNullOrEmpty(url))
                throw new ArgumentNullException(nameof(url));

            var parameters = new Dictionary<string, string>()
            {
                { "reason", ((int)reason).ToString() }
            };

            var request = new HttpRequestMessage(HttpMethod.Post, url)
            {
                Content = new FormUrlEncodedContent(parameters.ToArray())
            };

            return request;
        }
        public async Task HttpClient_PostAsync_ResponseContentAreEqual()
        {
            var fakeHttpMessageHandler = new FakeHttpMessageHandler();
            var fakeResponse = new HttpResponseMessage(HttpStatusCode.OK) {Content = new StringContent("post response")};

            fakeHttpMessageHandler.AddFakeResponse(new Uri("http://example.org/test"), fakeResponse);

            var httpClient = new HttpClient(fakeHttpMessageHandler);
            var parameters = new Dictionary<string, string> {{"Name", "bob"}};

            var content = new FormUrlEncodedContent(parameters.ToArray());

            var response = await httpClient.PostAsync("http://example.org/test", content);
            var stringResponse = await response.Content.ReadAsStringAsync();

            Assert.AreEqual("post response", stringResponse);
        }
        internal HttpRequestMessage CommentRequest(string url, string comment)
        {
            if (string.IsNullOrEmpty(url))
                throw new ArgumentNullException(nameof(url));

            var parameters = new Dictionary<string, string>()
            {
                { "comment", comment }
            };

            var request = new HttpRequestMessage(HttpMethod.Post, url)
            {
                Content = new FormUrlEncodedContent(parameters.ToArray())
            };

            return request;
        }
Example #17
0
        public Highscores()
        {
            InitializeComponent();
            dataGridView1.Columns.Add("Место", "Место");
            dataGridView1.Columns.Add("Ник", "Ник");
            dataGridView1.Columns.Add("Очки", "Очки");
             dataGridView1.Dock=DockStyle.Fill;
            dataGridView1.AllowUserToAddRows = false;
            Dictionary<string,object> dict = new Dictionary<string, object>();

            JavaScriptSerializer js = new JavaScriptSerializer();

            FileStream fs = new FileStream("highscores.txt",FileMode.OpenOrCreate);
            byte[] bytes = new byte[fs.Length];
             fs.Read(bytes,0,(int)fs.Length);
            string ttemp = Encoding.UTF8.GetString(bytes);
            fs.Close();
            dict = js.Deserialize<Dictionary<string, object>>(ttemp);
            List<KeyValuePair<string,object>> list =new List<KeyValuePair<string,object>>();
            list.AddRange(dict.ToArray());
            list.Sort((x, y) => ((int)x.Value > (int)y.Value)?-1:1);

            for (int i = 0; i < 10; i++)
            {

                DataGridViewRow row = new DataGridViewRow();

                row.Cells.Add(new DataGridViewTextBoxCell()
                {
                    Value = (i+1).ToString()
                });
                row.Cells.Add(new DataGridViewTextBoxCell()
                {
                    Value = list[i].Key
                });
                row.Cells.Add(new DataGridViewTextBoxCell()
                {
                    Value = list[i].Value
                });
                this.dataGridView1.Rows.Add(row);
            }
            dataGridView1.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells);
            dataGridView1.AutoResizeRows(DataGridViewAutoSizeRowsMode.AllCells);
        }
        /// <exception cref="ArgumentNullException">
        ///     Thrown when a null reference is passed to a method that does not accept it as a
        ///     valid argument.
        /// </exception>
        internal HttpRequestMessage AddFilteredOutGalleryTagRequest(string url, string tag)
        {
            if (string.IsNullOrWhiteSpace(url))
                throw new ArgumentNullException(nameof(url));

            if (string.IsNullOrWhiteSpace(tag))
                throw new ArgumentNullException(nameof(tag));

            var parameters = new Dictionary<string, string>
            {
                {nameof(tag), tag}
            };

            var request = new HttpRequestMessage(HttpMethod.Post, url)
            {
                Content = new FormUrlEncodedContent(parameters.ToArray())
            };

            return request;
        }
        /// <exception cref="ArgumentNullException">
        ///     Thrown when a null reference is passed to a method that does not accept it as a
        ///     valid argument.
        /// </exception>
        internal HttpRequestMessage AddCustomGalleryTagsRequest(string url, IEnumerable<string> tags)
        {
            if (string.IsNullOrWhiteSpace(url))
                throw new ArgumentNullException(nameof(url));

            if (tags == null)
                throw new ArgumentNullException(nameof(tags));

            var parameters = new Dictionary<string, string>
            {
                {nameof(tags), string.Join(",", tags)}
            };

            var request = new HttpRequestMessage(HttpMethod.Put, url)
            {
                Content = new FormUrlEncodedContent(parameters.ToArray())
            };

            return request;
        }
        private void T(
            string text,
            Dictionary<int, int> syntactic,
            Dictionary<int, int> semantic,
            Dictionary<int, int> expectedOutput)
        {
            Paths.SolutionDestinationFolder = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);

            var expectedArray = expectedOutput.ToArray();
            var result = TypeScriptSupport.PrepareRanges(
                syntactic.Select(p => new ClassifiedRange(text, p.Key, p.Value)).ToArray(),
                semantic.Select(p => new ClassifiedRange(text, p.Key, p.Value)).ToArray(),
                text);
            Assert.AreEqual(expectedOutput.Count, result.Length, "Lengths aren't same");
            for (int i = 0; i < expectedOutput.Count; i++)
            {
                Assert.AreEqual(expectedArray[i].Key, result[i].start);
                Assert.AreEqual(expectedArray[i].Value, result[i].length);
            }
        }
        /// <exception cref="ArgumentNullException">
        ///     Thrown when a null reference is passed to a method that does not accept it as a
        ///     valid argument.
        /// </exception>
        internal HttpRequestMessage MarkNotificationsViewedRequest(string url, IEnumerable<string> notificationIds)
        {
            if (string.IsNullOrWhiteSpace(url))
                throw new ArgumentNullException(nameof(url));

            if (notificationIds == null)
                throw new ArgumentNullException(nameof(notificationIds));

            var parameters = new Dictionary<string, string>
            {
                {"ids", string.Join(",", notificationIds)}
            };

            var request = new HttpRequestMessage(HttpMethod.Post, url)
            {
                Content = new FormUrlEncodedContent(parameters.ToArray())
            };

            return request;
        }
        internal HttpRequestMessage PostConversationMessageRequest(string url, string body)
        {
            if (string.IsNullOrEmpty(url))
                throw new ArgumentNullException(nameof(url));

            if (string.IsNullOrEmpty(body))
                throw new ArgumentNullException(nameof(body));

            var parameters = new Dictionary<string, string>()
            {
                { "body", body }
            };

            var request = new HttpRequestMessage(HttpMethod.Post, url)
            {
                Content = new FormUrlEncodedContent(parameters.ToArray())
            };

            return request;
        }
Example #23
0
        /// <exception cref="ArgumentNullException"></exception>
        internal HttpRequestMessage UpdateImageRequest(string url, string title = null, string description = null)
        {
            if (string.IsNullOrEmpty(url))
                throw new ArgumentNullException(nameof(url));

            var parameters = new Dictionary<string, string>();

            if (title != null)
                parameters.Add(nameof(title), title);

            if (description != null)
                parameters.Add(nameof(description), description);

            var request = new HttpRequestMessage(HttpMethod.Post, url)
            {
                Content = new FormUrlEncodedContent(parameters.ToArray())
            };

            return request;
        }
        /// <exception cref="ArgumentNullException">
        ///     Thrown when a null reference is passed to a method that does not accept it as a
        ///     valid argument.
        /// </exception>
        internal HttpRequestMessage AddAlbumImagesRequest(string url, IEnumerable<string> imageIds)
        {
            if (string.IsNullOrWhiteSpace(url))
                throw new ArgumentNullException(nameof(url));

            if (imageIds == null)
                throw new ArgumentNullException(nameof(imageIds));

            var parameters = new Dictionary<string, string>
            {
                {"ids", string.Join(",", imageIds)}
            };

            var request = new HttpRequestMessage(HttpMethod.Put, url)
            {
                Content = new FormUrlEncodedContent(parameters.ToArray())
            };

            return request;
        }
        internal HttpRequestMessage MarkAsReadRequest(string url, int[] ids)
        {
            if (string.IsNullOrEmpty(url))
                throw new ArgumentNullException(nameof(url));

            if (ids == null)
                throw new ArgumentNullException(nameof(ids));

            var parameters = new Dictionary<string, string>()
            {
                {"ids", string.Format(",", ids)}
            };

            var request = new HttpRequestMessage(HttpMethod.Post, url)
            {
                Content = new FormUrlEncodedContent(parameters.ToArray())
            };

            return request;
        }
        /// <exception cref="ArgumentNullException">
        ///     Thrown when a null reference is passed to a method that does not accept it as a
        ///     valid argument.
        /// </exception>
        internal HttpRequestMessage CreateMessageRequest(string url, string body)
        {
            if (string.IsNullOrWhiteSpace(url))
                throw new ArgumentNullException(nameof(url));

            if (string.IsNullOrWhiteSpace(body))
                throw new ArgumentNullException(nameof(body));

            var parameters = new Dictionary<string, string>
            {
                {nameof(body), body}
            };

            var request = new HttpRequestMessage(HttpMethod.Post, url)
            {
                Content = new FormUrlEncodedContent(parameters.ToArray())
            };

            return request;
        }
        public static Animation CreateAnimation()
        {
            var rng = new Random(12);

            var bigArraySize = 62;
            var ops = new List<Operation>();
            ops.Add(new Operation {Key = -1, Interval = new Interval(1, bigArraySize)});
            var remainingNumbers = Enumerable.Range(1, bigArraySize).ToList();

            var activeIntervals = new Dictionary<int, Interval>();
            activeIntervals[-1] = new Interval(1, bigArraySize);

            for (var i = 0; i < 50; i++) {
                if (activeIntervals.Count == 0) break;
                var rr = activeIntervals.ToArray();
                if (i < 4) { //} || rng.Next(5) == 0) {
                    var parent = activeIntervals[-1]; //rng.Next(activeIntervals.Count)].Value;
                    var rep = 0;
                    while (true) {
                        var v1 = rng.Next(parent.Length);
                        var v2 = rng.Next(parent.Length);
                        if (v1 == v2) continue;
                        rep += 1;
                        if (rep < 10 && (!remainingNumbers.Contains(v1) || !remainingNumbers.Contains(v2))) continue;
                        var offset = Math.Min(v2, v1);
                        var len = Math.Max(v2, v1) - offset + 1;
                        var x = new Interval(parent.Offset + offset, len/2);
                        ops.Add(new Operation {Key = i, Interval = x});
                        activeIntervals[i] = x;
                        break;
                    }
                } else {
                    var x = rng.Next(activeIntervals.Count);
                    var k = i == 4 ? -1 : rr[x].Key;
                    ops.Add(new Operation() {Key=k});
                    activeIntervals.Remove(k);
                }

            }
            return CreateAnimationOfOperations(new Interval(1 - 5, bigArraySize + 10), new Interval(1, bigArraySize), ops.ToArray());
        }
		ISemantic E(NewExpression nex)
		{
			// http://www.d-programming-language.org/expression.html#NewExpression
			ISemantic[] possibleTypes = null;

			if (nex.Type is IdentifierDeclaration)
				possibleTypes = TypeDeclarationResolver.Resolve((IdentifierDeclaration)nex.Type, ctxt, filterForTemplateArgs: false);
			else
				possibleTypes = TypeDeclarationResolver.Resolve(nex.Type, ctxt);
			
			var ctors = new Dictionary<DMethod, TemplateIntermediateType>();

			if (possibleTypes == null)
				return null;

			foreach (var t in possibleTypes)
			{
				var ct = DResolver.StripAliasSymbol(t as AbstractType) as TemplateIntermediateType;
				if (ct!=null && 
					!ct.Definition.ContainsAttribute(DTokens.Abstract))
					foreach (var ctor in GetConstructors(ct))
						ctors.Add(ctor, ct);
			}

			MemberSymbol finalCtor = null;

			var kvArray = ctors.ToArray();

			/*
			 * TODO: Determine argument types and filter out ctor overloads.
			 */

			if (kvArray.Length != 0)
				finalCtor = new MemberSymbol(kvArray[0].Key, kvArray[0].Value, nex);
			else if (possibleTypes.Length != 0)
				return AbstractType.Get(possibleTypes[0]);

			return finalCtor;
		}
        static void Main(string[] args)
        {
            Dictionary<string, string> dictionary = new Dictionary<string, string>();
            dictionary.Add("contact.Name", "张三");
            dictionary.Add("contact.PhoneNo", "123456789");
            dictionary.Add("contact.EmailAddress", "[email protected]");
            dictionary.Add("contact.Address.Province", "江苏");
            dictionary.Add("contact.Address.City", "苏州");
            dictionary.Add("contact.Address.District", "工业园区");
            dictionary.Add("contact.Address.Street", "星湖街328号");
            NameValuePairsValueProvider valueProvider = new NameValuePairsValueProvider(dictionary.ToArray(), null);

            //Prefix=""
            Console.WriteLine("Prefix: <Empty>");
            Console.WriteLine("{0,-14}{1}", "Key", "Value");
            IDictionary<string, string> keys = valueProvider.GetKeysFromPrefix(string.Empty);
            foreach (var item in keys)
            {
                Console.WriteLine("{0,-14}{1}", item.Key, item.Value);
            }

            //Prefix="contact"
            Console.WriteLine("\nPrefix: contact");
            Console.WriteLine("{0,-14}{1}", "Key", "Value");
            keys = valueProvider.GetKeysFromPrefix("contact");
            foreach (var item in keys)
            {
                Console.WriteLine("{0,-14}{1}", item.Key, item.Value);
            }

            //Prefix="contact.Address"
            Console.WriteLine("\nPrefix: contact.Address");
            Console.WriteLine("{0,-14}{1}", "Key", "Value");
            keys = valueProvider.GetKeysFromPrefix("contact.Address");
            foreach (var item in keys)
            {
                Console.WriteLine("{0,-14}{1}", item.Key, item.Value);
            }
        }
        public void Write(GitHubFlowArguments gitHubFlowConfiguration, Dictionary<string, string> variables, SemanticVersion nextBuildNumber)
        {
            if (string.IsNullOrEmpty(gitHubFlowConfiguration.ToFile)) return;

            var stringBuilder = new StringBuilder();
            stringBuilder.AppendLine("{");
            var variableList = variables.ToArray();
            for (var index = 0; index < variableList.Length; index++)
            {
                var variable = variableList[index];
                stringBuilder.AppendFormat("    \"{0}\": \"{1}\"{2}", variable.Key, variable.Value,
                    index < variableList.Length - 1 ? "," : string.Empty);
                stringBuilder.AppendLine();
            }

            stringBuilder.AppendLine("}");

            var directoryName = Path.GetDirectoryName(gitHubFlowConfiguration.ToFile);
            if (!Directory.Exists(directoryName))
                Directory.CreateDirectory(directoryName);
            File.WriteAllText(gitHubFlowConfiguration.ToFile, stringBuilder.ToString());
        }