/// <summary> /// 解析要打开的Chrome数据(不含扩展数据) /// </summary> /// <param name="jsonText"></param> public void CaptureChromeFrm(string jsonText) { publicfunction.stopTimer(); WebFrmInfo playFrmInfo = ParseWebParam(jsonText); if (publicfunction.g_ChromeFrmList.Count > 0) { foreach (var webfrm in publicfunction.g_ChromeFrmList) { if (webfrm.Text == playFrmInfo.title) { webfrm.Close(); } } } newCaptureChromeFrm(playFrmInfo.url, playFrmInfo.LocationX, playFrmInfo.LocationY, playFrmInfo.SizeX, playFrmInfo.SizeY, playFrmInfo.title); }
/// <summary> /// 解析网页http字段信息 /// </summary> /// <param name="Command"></param> /// <returns></returns> public WebFrmInfo ParseWebParam(string Command) { string strstart = "\"url\":\""; int strlength = strstart.Length; string UrlString = Command.Substring(Command.IndexOf(strstart) + strlength, Command.IndexOf("\",\"LocationX\":") - Command.IndexOf(strstart) - strlength); strstart = "\"LocationX\":"; strlength = strstart.Length; string LocationX_String = Command.Substring(Command.IndexOf(strstart) + strlength, Command.IndexOf(",\"LocationY\":") - Command.IndexOf(strstart) - strlength); strstart = "\"LocationY\":"; strlength = strstart.Length; string LocationY_String = Command.Substring(Command.IndexOf(strstart) + strlength, Command.IndexOf(",\"SizeX\":") - Command.IndexOf(strstart) - strlength); strstart = "\"SizeX\":"; strlength = strstart.Length; string SizeX_String = Command.Substring(Command.IndexOf(strstart) + strlength, Command.IndexOf(",\"SizeY\":") - Command.IndexOf(strstart) - strlength); strstart = "\"SizeY\":"; strlength = strstart.Length; string SizeY_String = Command.Substring(Command.IndexOf(strstart) + strlength, Command.IndexOf(",\"title\":") - Command.IndexOf(strstart) - strlength); strstart = "\"title\":\""; strlength = strstart.Length; string title_String = Command.Substring(Command.IndexOf(strstart) + strlength).Replace("\"}", ""); WebFrmInfo webfrm = new WebFrmInfo { url = UrlString, LocationX = Int32.Parse(LocationX_String), LocationY = Int32.Parse(LocationY_String), SizeX = Int32.Parse(SizeX_String), SizeY = Int32.Parse(SizeY_String), title = title_String, extarData = string.Empty }; return(webfrm); }