当前位置: 首页>>代码示例>>C#>>正文


C# Specialized.NameValueCollection类代码示例

本文整理汇总了C#中System.Collections.Specialized.NameValueCollection的典型用法代码示例。如果您正苦于以下问题:C# System.Collections.Specialized.NameValueCollection类的具体用法?C# System.Collections.Specialized.NameValueCollection怎么用?C# System.Collections.Specialized.NameValueCollection使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


System.Collections.Specialized.NameValueCollection类属于命名空间,在下文中一共展示了System.Collections.Specialized.NameValueCollection类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Deserialize

 public void Deserialize(System.IO.TextReader rdr, Serializer serializer)
 {
     string name, value, rigthPart;
     var parameters = new System.Collections.Specialized.NameValueCollection();
     while (rdr.Property(out name, out value, out rigthPart, parameters) && !string.IsNullOrEmpty(name)) {
         switch (name.ToUpper()) {
             case "CLASS": Class = value.ToEnum<Classes>(); break;
             case "STATUS": Status = value.ToEnum<Statuses>(); break;
             case "UID": UID = value; break;
             case "ORGANIZER":
                 Organizer = new Contact();
                 Organizer.Deserialize(value, parameters);
                 break;
             case "CATEGORIES":
                 Categories = value.SplitEscaped().ToList();
                 break;
             case "DESCRIPTION": Description = value; break;
             case "SEQUENCE": Sequence = value.ToInt(); break;
             case "LAST-MODIFIED": LastModified = value.ToDateTime(); break;
             case "DTSTAMP": DTSTAMP = value.ToDateTime(); break;
             case "END": return;
             default:
                 Properties.Add(Tuple.Create(name, value, parameters));
                 break;
         }
     }
 }
开发者ID:ProximoSrl,项目名称:CalDav,代码行数:27,代码来源:JournalEntry.cs

示例2: ProcessRequest

        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "image/png";

            string prefFilter = context.Request["pref"] ?? "全て";
            string cityFilter = context.Request["city"] ?? "全て";
            string categoryFilter = context.Request["category"] ?? "全て";
            string productFilter = context.Request["product"] ?? "全て";
            string publishDayFilter = context.Request["publish"] ?? "全て";
            string pickDayFilter = context.Request["pick"] ?? "全て";
            string sortItem = context.Request["sort"] ?? "1";
            string widthString = context.Request["width"] ?? "";
            string heightString = context.Request["height"] ?? "";

            int width, height;
            if (Int32.TryParse(widthString, out width) == false) width = 600;
            if (Int32.TryParse(heightString, out height) == false) height = 300;
            width = Math.Min(1000, Math.Max(300, width));
            height = Math.Min(600, Math.Max(150, height));

            var list = Common.GetQuery(prefFilter, cityFilter, categoryFilter, productFilter, publishDayFilter, pickDayFilter, sortItem);
            var param = list.Item1.ToList().PrepareChartParam(width, height);

            using (var cl = new System.Net.WebClient())
            {
                var values = new System.Collections.Specialized.NameValueCollection();
                foreach (var item in param)
                {
                    values.Add(item.Substring(0, item.IndexOf('=')), item.Substring(item.IndexOf('=') + 1));
                }
                var resdata = cl.UploadValues("http://chart.googleapis.com/chart?chid=1", values);
                context.Response.OutputStream.Write(resdata, 0, resdata.Length);
            }
        }
开发者ID:udawtr,项目名称:yasaikensa,代码行数:34,代码来源:SearchChartImage.ashx.cs

示例3: Deserialize

		public void Deserialize(System.IO.TextReader rdr, Serializer serializer) {
			string name, value;
			var parameters = new System.Collections.Specialized.NameValueCollection();
			while (rdr.Property(out name, out value, parameters) && !string.IsNullOrEmpty(name)) {
				switch (name.ToUpper()) {
					case "UID": UID = value; break;
					case "ORGANIZER":
						Organizer = new Contact();
						Organizer.Deserialize(value, parameters);
						break;
					case "SEQUENCE": Sequence = value.ToInt(); break;
					case "LAST-MODIFIED": LastModified = value.ToDateTime(); break;
					case "DTSTART": LastModified = value.ToDateTime(); break;
					case "DTEND": LastModified = value.ToDateTime(); break;
					case "DTSTAMP": DTSTAMP = value.ToDateTime(); break;
					case "FREEBUSY":
						var parts = value.Split('/');
						Details.Add(new DateTimeRange {
							From = parts.FirstOrDefault().ToDateTime(),
							To = parts.ElementAtOrDefault(1).ToDateTime()
						});
						break;
					case "END": return;
					default:
						Properties.Add(Tuple.Create(name, value, parameters));
						break;
				}
			}
		}
开发者ID:hiblen,项目名称:CalDav,代码行数:29,代码来源:FreeBusy.cs

示例4: DataBuilderFactory

 static DataBuilderFactory()
 {
     _dataBuilders = new System.Collections.Specialized.NameValueCollection();
     _assemblies = new List<string>();
     _assemblies.Add(Xy.AppSetting.BinDir + "Xy.Web.dll");
     LoadControl(ControlFactory.GetConfig("Data"));
 }
开发者ID:BrookHuang,项目名称:XYFrame,代码行数:7,代码来源:DataBuilderFactory.cs

示例5: Api

        public static string Api(string Temperature,string Humidity)
        {
            string url = (string)Properties.Settings.Default["ApiAddress"];
            string resText = "";
            try {
                System.Net.WebClient wc = new System.Net.WebClient();
                System.Collections.Specialized.NameValueCollection ps =
                    new System.Collections.Specialized.NameValueCollection();

                ps.Add("MachineName", (string)Properties.Settings.Default["MachineName"]);
                ps.Add("Temperature", Temperature);
                ps.Add("Humidity", Humidity);

                byte[] ResData = wc.UploadValues(url, ps);
                wc.Dispose();
                resText = System.Text.Encoding.UTF8.GetString(ResData);
                if (resText != "OK")
                {
                    return "APIエラー";
                }
            }
            catch (Exception ex){
                return ex.ToString();
            }

            return null;
        }
开发者ID:ichirowo,项目名称:Room-temperature_IoT,代码行数:27,代码来源:WebAccess.cs

示例6: Initialize

        public override void Initialize(string name, System.Collections.Specialized.NameValueCollection config) {
            // Validate arguments
            if (config == null) throw new ArgumentNullException("config");
            if (string.IsNullOrEmpty(name)) name = "SimpleSqlProfileProvider";
            if (String.IsNullOrEmpty(config["description"])) {
                config.Remove("description");
                config.Add("description", "PAB simple SQL profile provider");
            }

            // Initialize base class
            base.Initialize(name, config);

            // Basic init
            this.configuration = config;
            this.applicationName = GetConfig("applicationName", "");

            // Initialize connection string
            ConnectionStringSettings ConnectionStringSettings = ConfigurationManager.ConnectionStrings[config["connectionStringName"]];
            if (ConnectionStringSettings == null || ConnectionStringSettings.ConnectionString.Trim() == "") throw new ProviderException("Connection string cannot be blank.");
            this.connectionString = ConnectionStringSettings.ConnectionString;

            // Initialize table name
            this.tableName = GetConfig("tableName", "Profiles");
            if (!IsValidDbObjectName(this.tableName)) throw new ProviderException("Table name contains illegal characters.");

            // Initialize key column name
            this.keyColumnName = GetConfig("keyColumnName", "UserName");
            if (!IsValidDbObjectName(this.keyColumnName)) throw new ProviderException("Key column name contains illegal characters.");

            // Initialize last update column name
            this.lastUpdateColumnName = GetConfig("lastUpdateColumnName", "LastUpdate");
            if (!IsValidDbObjectName(this.lastUpdateColumnName)) throw new ProviderException("Last update column name contains illegal characters.");
        }
开发者ID:ranade80,项目名称:Authorization-Samples,代码行数:33,代码来源:SimpleSqlProfileProvider.cs

示例7: UsernamePassword

        public void UsernamePassword(string clientId, string clientSecret, string username, string password, string tokenRequestEndpointUrl)
        {
            if (string.IsNullOrEmpty(clientId)) throw new ArgumentNullException("clientId");
            if (string.IsNullOrEmpty(clientSecret)) throw new ArgumentNullException("clientSecret");
            if (string.IsNullOrEmpty(username)) throw new ArgumentNullException("username");
            if (string.IsNullOrEmpty(password)) throw new ArgumentNullException("password");
            if (string.IsNullOrEmpty(tokenRequestEndpointUrl)) throw new ArgumentNullException("tokenRequestEndpointUrl");
            if (!Uri.IsWellFormedUriString(tokenRequestEndpointUrl, UriKind.Absolute)) throw new FormatException("tokenRequestEndpointUrl");

            var content = new System.Collections.Specialized.NameValueCollection
            {
                {"grant_type", "password"},
                {"client_id", clientId},
                {"client_secret", clientSecret},
                {"username", username},
                {"password", password}
            };

            AuthToken = new AuthToken();
            try
            {
                var responseBytes = WebClient.UploadValues(tokenRequestEndpointUrl, "POST", content);
                var responseBody = Encoding.UTF8.GetString(responseBytes);
                AuthToken = JsonConvert.DeserializeObject<AuthToken>(responseBody);
            }
            catch (Exception ex)
            {
                AuthToken.Errors = ex.Message;
            }
        }
开发者ID:harip,项目名称:SalesforceBulkApi,代码行数:30,代码来源:AuthenticationClient.cs

示例8: OnBeforePopup

 protected override bool OnBeforePopup(CefBrowser browser, CefFrame frame, string targetUrl, string targetFrameName, CefPopupFeatures popupFeatures, CefWindowInfo windowInfo, ref CefClient client, CefBrowserSettings settings, ref bool noJavascriptAccess)
 {
     bool res = false;
     if (!string.IsNullOrEmpty(targetUrl))
     {
         if (webBrowser.selfRequest != null)
         {
             CefRequest req = CefRequest.Create();
             req.FirstPartyForCookies = webBrowser.selfRequest.FirstPartyForCookies;
             req.Options = webBrowser.selfRequest.Options;
             /*CefPostData postData = CefPostData.Create();
             CefPostDataElement element = CefPostDataElement.Create();
             int index = targetUrl.IndexOf("?");
             string url = targetUrl.Substring(0, index);
             string data = targetUrl.Substring(index + 1);
             byte[] bytes = Encoding.UTF8.GetBytes(data);
             element.SetToBytes(bytes);
             postData.Add(element);
             */
             System.Collections.Specialized.NameValueCollection h = new System.Collections.Specialized.NameValueCollection();
             h.Add("Content-Type", "application/x-www-form-urlencoded");
             req.Set(targetUrl, webBrowser.selfRequest.Method, null, webBrowser.selfRequest.GetHeaderMap());
             webBrowser.selfRequest = req;
         }
         //webBrowser.selfRequest.Set(targetUrl, webBrowser.selfRequest.Method, webBrowser.selfRequest.PostData, webBrowser.selfRequest.GetHeaderMap());
         res = webBrowser.OnNewWindow(targetUrl);
         if (res)
             return res;
     }
     res = base.OnBeforePopup(browser, frame, targetUrl, targetFrameName, popupFeatures, windowInfo, ref client, settings, ref noJavascriptAccess);
     return res;
 }
开发者ID:lukeandshuo,项目名称:HydataBrowser,代码行数:32,代码来源:CwbLifeSpanHandler.cs

示例9: GetAssemblyEventMapping

        private System.Collections.Specialized.NameValueCollection GetAssemblyEventMapping(System.Reflection.Assembly assembly, Hl7Package package)
        {
            System.Collections.Specialized.NameValueCollection structures = new System.Collections.Specialized.NameValueCollection();
            using (System.IO.Stream inResource = assembly.GetManifestResourceStream(package.EventMappingResourceName))
            {
                if (inResource != null)
                {
                    using (System.IO.StreamReader sr = new System.IO.StreamReader(inResource))
                    {
                        string line = sr.ReadLine();
                        while (line != null)
                        {
                            if ((line.Length > 0) && ('#' != line[0]))
                            {
                                string[] lineElements = line.Split(' ', '\t');
                                structures.Add(lineElements[0], lineElements[1]);
                            }
                            line = sr.ReadLine();

                        }
                    }
                }
            }
            return structures;
        }
开发者ID:snosrap,项目名称:nhapi,代码行数:25,代码来源:EventMapper.cs

示例10: Process

		/// <summary>
		/// 
		/// </summary>
		/// <param name="userAgent"></param>
		/// <param name="initialCapabilities"></param>
		/// <returns></returns>
		public System.Web.Configuration.CapabilitiesResult Process(string userAgent, System.Collections.IDictionary initialCapabilities)
		{
			System.Collections.Specialized.NameValueCollection header;
			header = new System.Collections.Specialized.NameValueCollection(1);
			header.Add("User-Agent", userAgent);
			return Process(header, initialCapabilities);
		}
开发者ID:nlhepler,项目名称:mono,代码行数:13,代码来源:CapabilitiesBuild.cs

示例11: CreateControllerContext

        //private HtmlHelper CreateHelper()
        //{
        //    return new HtmlHelper(new ViewContext(ControllerContext, new DummyView(), new ViewDataDictionary(), new TempDataDictionary(), new StringWriter()), new CustomViewDataContainer());
        //}
        private static ControllerContext CreateControllerContext()
        {
            string host = "www.google.com";
            string proto = "http";
            string userIP = "127.0.0.1";

            var headers = new System.Collections.Specialized.NameValueCollection {
                                {"Host", host},
                                {"X-Forwarded-Proto", proto},
                                {"X-Forwarded-For", userIP}
                        };

            var httpRequest = Substitute.For<HttpRequestBase>();
            httpRequest.Url.Returns(new Uri(proto + "://" + host));
            httpRequest.Headers.Returns(headers);

            var httpContext = Substitute.For<HttpContextBase>();
            httpContext.Request.Returns(httpRequest);

            var controllerContext = new ControllerContext
            {
                HttpContext = httpContext
            };

            return controllerContext;
        }
开发者ID:noopman,项目名称:FunnelWeb,代码行数:30,代码来源:ControllerTests.cs

示例12: GetWebContent

 public string GetWebContent(string Url, string pagenum, string cat)
 {
     string strResult = "";
     try
     {
         WebClient WebClientObj = new WebClient();
         System.Collections.Specialized.NameValueCollection PostVars = new System.Collections.Specialized.NameValueCollection();
         PostVars.Add("Cat", cat);
         PostVars.Add("mnonly", "0");
         PostVars.Add("newproducts", "0");
         PostVars.Add("ColumnSort", "0");
         PostVars.Add("page", pagenum);
         PostVars.Add("stock", "0");
         PostVars.Add("pbfree", "0");
         PostVars.Add("rohs", "0");
         byte[] byRemoteInfo = WebClientObj.UploadValues(Url, "POST", PostVars);
         //StreamReader streamRead = new StreamReader(byRemoteInfo.ToString(), Encoding.Default);
         //FileStream fs = new FileStream(@"D:\\gethtml.txt", FileMode.Create);
         //BinaryWriter sr = new BinaryWriter(fs);
         //sr.Write(byRemoteInfo, 0, byRemoteInfo.Length);
         //sr.Close();
         //fs.Close();
         strResult = Encoding.Default.GetString(byRemoteInfo);
     }
     catch (Exception ex)
     {
         throw ex;
     }
     return strResult;
 }
开发者ID:hanhanlovehuhu,项目名称:-------,代码行数:30,代码来源:GetData.cs

示例13: UpdateDNSIP

        public bool UpdateDNSIP(string rec_id, string IP, string name, string service_mode, string ttl)
        {
            string url = "https://www.cloudflare.com/api_json.html";

            System.Net.WebClient wc = new System.Net.WebClient();
            //NameValueCollectionの作成
            System.Collections.Specialized.NameValueCollection ps = new System.Collections.Specialized.NameValueCollection();
            //送信するデータ(フィールド名と値の組み合わせ)を追加
            ps.Add("a", "rec_edit");
            ps.Add("tkn", KEY);
            ps.Add("id", rec_id);
            ps.Add("email", EMAIL);
            ps.Add("z", DOMAIN);
            ps.Add("type", "A");
            ps.Add("name", name);
            ps.Add("content", IP);
            ps.Add("service_mode", service_mode);
            ps.Add("ttl", ttl);

            //データを送信し、また受信する
            byte[] resData = wc.UploadValues(url, ps);
            wc.Dispose();
            string resText = System.Text.Encoding.UTF8.GetString(resData);
            Clipboard.SetText(resText);
            return false;
        }
开发者ID:SlaynationCoder,项目名称:CloudFlare-DNS-Updator,代码行数:26,代码来源:CFAPI.cs

示例14: ControlFactory

 static ControlFactory()
 {
     _controls = new System.Collections.Specialized.NameValueCollection();
     _assemblies = new List<string>();
     _config = new Dictionary<string, System.Xml.XmlNodeList>();
     LoadControl();
 }
开发者ID:BrookHuang,项目名称:XYFrame,代码行数:7,代码来源:ControlFactory.cs

示例15: Main

        static void Main(string[] args)
        {
            using (WebClient client = new WebClient())
            {
                System.Collections.Specialized.NameValueCollection reqparm = new System.Collections.Specialized.NameValueCollection();
                reqparm.Add("username", "Matija");
                reqparm.Add("passwd", "1234");
                byte[] bytes = client.UploadValues("http://ates-test.algebra.hr/iis/testSubmit.aspx", "POST", reqparm);
                string body = Encoding.UTF8.GetString(bytes);
                Console.WriteLine(body);

                WebHeaderCollection wcHeaderCollection = client.ResponseHeaders;
                Console.WriteLine("\nHeaders:\n");

                for (int i = 0; i < wcHeaderCollection.Count; i++)
                {
                    Console.WriteLine(wcHeaderCollection.GetKey(i) + " = " + wcHeaderCollection.Get(i));
                }
            }
            Console.WriteLine();

            using (WebClient client = new WebClient())
            {
                string reply = client.DownloadString(@"http://ates-test.algebra.hr/iis/testSubmit.aspx?username=Matija&passwd=1234");
                Console.WriteLine(reply);
                WebHeaderCollection wcHeaderCollection = client.ResponseHeaders;
                Console.WriteLine("\nHeaders:\n");

                for (int i = 0; i < wcHeaderCollection.Count; i++)
                {
                    Console.WriteLine(wcHeaderCollection.GetKey(i) + " = " + wcHeaderCollection.Get(i));
                }
                Console.ReadKey();
            }
        }
开发者ID:humra,项目名称:Practice,代码行数:35,代码来源:Program.cs


注:本文中的System.Collections.Specialized.NameValueCollection类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。