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


C# RequestInfo.ParseUrlEncoded方法代码示例

本文整理汇总了C#中RequestInfo.ParseUrlEncoded方法的典型用法代码示例。如果您正苦于以下问题:C# RequestInfo.ParseUrlEncoded方法的具体用法?C# RequestInfo.ParseUrlEncoded怎么用?C# RequestInfo.ParseUrlEncoded使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在RequestInfo的用法示例。


在下文中一共展示了RequestInfo.ParseUrlEncoded方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: StartServer


//.........这里部分代码省略.........
                                          ApplicationPath = string.Format("\"{0}\"", Path.GetFullPath(applicationPath).Trim('\"').TrimEnd('\\')),
                                          HostName = hostname,
                                          IPAddress = ipAddress.ToString(),
                                          IPMode = IPMode.Specific,
                                          PortMode = PortMode.Specific,
                                          VirtualPath = string.Format("\"{0}\"", virtualPath),
                                          TimeOut = timeOut,
                                          WaitForPort = waitForPort,
                                          Quiet = false,
                                          Headless = true
                                      }).ToString();

            _serverProcess = new Process();
            _serverProcess.StartInfo = new ProcessStartInfo
                                           {
                                               UseShellExecute = false,
                                               ErrorDialog = false,
                                               CreateNoWindow = true,
                                               RedirectStandardOutput = true,
                                               RedirectStandardInput = true,
                                               FileName = "CassiniDev-console.exe",
                                               Arguments = commandLine,
                                               WorkingDirectory = Environment.CurrentDirectory
                                           };

            // we are going to monitor each line of the output to handle events - really poor man's marshalling

            string line = null;

            _serverProcess.Start();
            _monitorThread = new Thread(() =>
                                            {
                                                _serverProcess.WaitForExit();
                                                // cleanup
                                                StopServer();

                                            });
            _monitorThread.Start();

            _outputThread = new Thread(() =>
                                           {
                                               // watch StandardOut for messages
                                               string l = _serverProcess.StandardOutput.ReadLine();
                                               while (l != null)
                                               {
                                                   Trace.WriteLine(l);
                                                   if (l.StartsWith("started:") || l.StartsWith("error:"))
                                                   {
                                                       line = l;
                                                   }

                                                   if (l.StartsWith("RequestComplete:RequestInfo:"))
                                                   {
                                                       // raise an event
                                                       var reqest = new RequestInfo();
                                                       string info = l.Substring("RequestComplete:".Length);
                                                       reqest.ParseUrlEncoded(info);
                                                       OnRequestComplete(new RequestEventArgs(reqest));
                                                   }
                                                   if (l.StartsWith("RequestBegin:RequestInfo:"))
                                                   {
                                                       // raise an event
                                                       var reqest = new RequestInfo();
                                                       string info = l.Substring("RequestBegin:".Length);
                                                       reqest.ParseUrlEncoded(info);
                                                       OnRequestBegin(new RequestEventArgs(reqest));
                                                   }

                                                   try
                                                   {
                                                       l = _serverProcess.StandardOutput.ReadLine();
                                                   }
                                                   catch (Exception ex)
                                                   {
                                                       Trace.WriteLine(ex.ToString());
                                                       break;
                                                   }
                                               }
                                           });
            _outputThread.Start();

            // use StandardInput to send the newline to stop the server when required
            _input = _serverProcess.StandardInput;

            // block until we get a signal
            while (line == null)
            {
                Thread.Sleep(10);
            }

            if (!line.StartsWith("started:"))
            {
                throw new Exception(string.Format("Could not start server: {0}", line));
            }

            // line is the root url
            _rootUrl = line.Substring(line.IndexOf(':') + 1).Trim();

            OnServerStarted(new ServerEventArgs(_rootUrl));
        }
开发者ID:Evolutionary-Networking-Designs,项目名称:CassiniDev,代码行数:101,代码来源:Fixture.cs


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