本文整理汇总了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));
}