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


C# Test.List.Add方法代码示例

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


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

示例1: getObjectResources

        public List<TaiNguyen> getObjectResources()
        {
            List<TaiNguyen> tainguyenLst = new List<TaiNguyen>();

            tainguyenLst.Add(LoaiTaiLieu_TaiLieu.I);
            return tainguyenLst;
        }
开发者ID:khanhdtn,项目名称:my-office-manager,代码行数:7,代码来源:PLPermissionRes.cs

示例2: GetList

        private static List<ImagesModel> GetList()
        {
            var list = new List<ImagesModel>();

            MysqlCon db = new MysqlCon();
            MySqlConnection conn = db.connect();

            MySqlCommand command = new MySqlCommand("select * from images where isdownload=0;", conn);
            MySqlDataReader reader = command.ExecuteReader();

            while (reader.Read())
            {
                list.Add(new ImagesModel { FileName = reader.GetString("filename"), Url = reader.GetString("img_url"), title = reader.GetString("title"), keyw = reader.GetString("keyw") });
            }

            reader.Close();
            db.disconnect(conn);

            return list;
        }
开发者ID:aserdaray,项目名称:Projects,代码行数:20,代码来源:Program.cs

示例3: GetnamespacestoLocalize

		public static string[] GetnamespacestoLocalize()
		{
			var namespacestoLocalize = new List<string>();
			var pathwayDirectory = PathwayPath.GetPathwayDir();
			if (pathwayDirectory == null || !Directory.Exists(pathwayDirectory))
				return new[] { "SIL.PublishingSolution" };
			foreach (var file in Directory.GetFiles(pathwayDirectory, "*.*").Where(f => Regex.IsMatch(f, @"^.+\.(dll|exe)$"))
				)
			{
				var fileInfo = new FileInfo(file);
				if ((fileInfo.Name == "PsTool.dll") || (fileInfo.Name.Contains("Convert")) ||
					(fileInfo.Name.Contains("Writer")) || (fileInfo.Name.Contains("Validator")))
				{
					using (var epubinstalleddirectory = File.OpenRead(Common.FromRegistry(fileInfo.FullName)))
					{

						var sAssembly = Assembly.LoadFrom(epubinstalleddirectory.Name);

						foreach (
							var stype in
								sAssembly.GetTypes()
									.Where(type => type.GetConstructors().Any(s => s.GetParameters().Length == 0)))
						{
							if (!namespacestoLocalize.Contains(stype.Namespace))
								namespacestoLocalize.Add(stype.Namespace);
						}

					}

				}
			}
			return namespacestoLocalize.Distinct().ToArray();
		}
开发者ID:neilmayhew,项目名称:pathway,代码行数:33,代码来源:Common.cs

示例4: button5_Click

        private void button5_Click(object sender, EventArgs e)
        {
            FileNames.Clear();
            sourceFolder = "c:\\temp";
            GetFilesFromFolder(sourceFolder);

            // Get files from Xml
            List<string> fileNamesXml = new List<string>();
            XmlNode returnValue = null;
            XmlDocument LoadedDoc = new XmlDocument();
            LoadedDoc.Load("c:\\FileLibrary.xml");
            const string xPath = "//FileLibrary";
            XmlElement root = LoadedDoc.DocumentElement;
            if (root != null)
            {
                returnValue = root.SelectSingleNode(xPath);
                foreach (XmlNode xmlNode in returnValue.ChildNodes)
                {
                    string path = xmlNode.Attributes.GetNamedItem("Path").Value;
                    fileNamesXml.Add(path);
                }
            }

            //Find missing files in xml 
            foreach (string file in FileNames)
            {
                if (!fileNamesXml.Contains(file))
                {
                    string newGuid = Guid.NewGuid().ToString();
                    //Add a File Node
                    XmlNode newNode = LoadedDoc.CreateNode("element", "File", "");
                    XmlAttribute xmlAttrib = LoadedDoc.CreateAttribute("Path");
                    xmlAttrib.Value = file;
                    newNode.Attributes.Append(xmlAttrib);

                    xmlAttrib = LoadedDoc.CreateAttribute("ComponentGuid");
                    xmlAttrib.Value = newGuid;
                    newNode.Attributes.Append(xmlAttrib);
                    root.LastChild.AppendChild(newNode);
                }
            }
            LoadedDoc.Save("c:\\FileLibrary.xml");
        }
开发者ID:neilmayhew,项目名称:pathway,代码行数:43,代码来源:FlexPluginTest.cs

示例5: twowaysAMI


//.........这里部分代码省略.........
            cb.check();
        }

        {
            ONDR i = new ONDR();
            Dictionary<string, string> iid = new Dictionary<string, string>();
            iid["a"] = "b";
            iid["b"] = "a";
            Dictionary<string, Dictionary<string, string>> id
                = new Dictionary<string, Dictionary<string, string>>();
            id["a"] = iid;
            id["b"] = iid;
            i["a"] = id;
            i["b"] = id;

            AMI_MyClass_opONDRI cb = new AMI_MyClass_opONDRI(i);
            p.opONDR_async(cb, i);
            cb.check();
        }

        {
            int[] ii = new int[] { 1, 2 };
            Dictionary<string, int[]> i = new Dictionary<string, int[]>();
            i["a"] = ii;
            i["b"] = ii;

            AMI_MyClass_opNDAISI cb = new AMI_MyClass_opNDAISI(i);
            p.opNDAIS_async(cb, i);
            cb.check();
        }

        {
            CIS ii = new CIS();
            ii.Add(1);
            ii.Add(2);
            Dictionary<string, CIS> i = new Dictionary<string, CIS>();
            i["a"] = ii;
            i["b"] = ii;

            AMI_MyClass_opNDCISI cb = new AMI_MyClass_opNDCISI(i);
            p.opNDCIS_async(cb, i);
            cb.check();
        }

        {
            List<int> ii = new List<int>();
            ii.Add(1);
            ii.Add(2);
            Dictionary<string, List<int>> i = new Dictionary<string, List<int>>();
            i["a"] = ii;
            i["b"] = ii;

            AMI_MyClass_opNDGISI cb = new AMI_MyClass_opNDGISI(i);
            p.opNDGIS_async(cb, i);
            cb.check();
        }

        {
            string[] ii = new string[] { "a", "b" };
            Dictionary<string, string[]> i = new Dictionary<string, string[]>();
            i["a"] = ii;
            i["b"] = ii;

            AMI_MyClass_opNDASSI cb = new AMI_MyClass_opNDASSI(i);
            p.opNDASS_async(cb, i);
            cb.check();
开发者ID:bholl,项目名称:zeroc-ice,代码行数:67,代码来源:TwowaysAMI.cs

示例6: Execute

        /// <summary>
        /// The first two calls handle the error redirect from MyMav asking for cookies. The rest basically emulate the post requests
        /// from MyMav and you can use FireBug in FireFox to analyze any of MyMavs request and see how these are put together. One thing to note
        /// is that the ICIS code is the most important part as it is how the MyMav ties your session together
        /// </summary>
        public void Execute()
        {
            string errorPage = "https://sis-cs-prod.uta.edu/psc/ACSPRD/EMPLOYEE/PSFT_ACS/c/COMMUNITY_ACCESS.CLASS_SEARCH.GBL?&";

            request = (HttpWebRequest)WebRequest.Create(errorPage);
            request.CookieContainer = cc;
            request.UserAgent = "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/535.2 (KHTML, like Gecko) Chrome/15.0.874.121 Safari/535.2";
            response = (HttpWebResponse)request.GetResponse();

            string searchPage = "https://sis-cs-prod.uta.edu/psc/ACSPRD/EMPLOYEE/PSFT_ACS/c/COMMUNITY_ACCESS.CLASS_SEARCH.GBL?&";
            request = (HttpWebRequest)WebRequest.Create(searchPage);
            request.CookieContainer = cc;
            request.UserAgent = "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/535.2 (KHTML, like Gecko) Chrome/15.0.874.121 Safari/535.2";
            response = (HttpWebResponse)request.GetResponse();
            using (StreamReader sr = new StreamReader(response.GetResponseStream()))
            {
                html = sr.ReadToEnd();
            }
            var document = new HtmlDocument();
            document.LoadHtml(html);

            var getSemesterList = "https://sis-cs-prod.uta.edu/psc/ACSPRD/EMPLOYEE/PSFT_ACS/c/COMMUNITY_ACCESS.CLASS_SEARCH.GBL";
            var getSemesterListParameters = new Dictionary<string, string>()
            {
                {"CLASS_SRCH_WRK2_STRM$273$", document.GetElementbyId("CLASS_SRCH_WRK2_STRM$273$").InnerText},
                {"FacetPath", document.GetElementbyId("FacetPath") != null ? document.GetElementbyId("FacetPath").GetAttributeValue("value","") : "None"},
                {"ICAJAX","1"},
                {"ACAPPCLSDATA",document.GetElementbyId("ICAPPCLSDATA") != null ? document.GetElementbyId("ICAPPCLSDATA").GetAttributeValue("value","") : ""},
                {"ICAction", "CLASS_SRCH_WRK2_STRM$273$$prompt"},
                {"ICActionPrompt", document.GetElementbyId("ICActionPrompt") != null ? document.GetElementbyId("ICActionPrompt").GetAttributeValue("value","") : "false"},
                {"ICAddCount", document.GetElementbyId("ICAddCount") != null ? document.GetElementbyId("ICAddCount").GetAttributeValue("value","") : ""},
                {"ICChanged", document.GetElementbyId("ICChanged") != null ? document.GetElementbyId("ICChanged").GetAttributeValue("value","") : "-1"},
                {"ICElementNum", document.GetElementbyId("ICElementNum") != null ? document.GetElementbyId("ICElementNum").GetAttributeValue("value","") : "0"},
                {"ICFind", document.GetElementbyId("ICFind") != null ?  document.GetElementbyId("ICFind").GetAttributeValue("value","") : ""},
                {"ICFocus", ""},
                {"ICNAVTYPEDROPDOWN", "0"},
                {"ICResubmit", document.GetElementbyId("ICResubmit")!= null ? document.GetElementbyId("ICResubmit").GetAttributeValue("value","") : "0"},
                {"ICSID", document.GetElementbyId("ICSID") != null ? document.GetElementbyId("ICSID").GetAttributeValue("value","") : ""},
                {"ICSaveWarningFilter",document.GetElementbyId("ICSaveWarningFilter") != null ? document.GetElementbyId("ICSaveWarningFilter").GetAttributeValue("value","") : "0"},
                {"ICStateNum",document.GetElementbyId("ICStateNum") != null ? document.GetElementbyId("ICStateNum").GetAttributeValue("value","") : ""},
                {"ICType", document.GetElementbyId("ICType") != null ? document.GetElementbyId("ICType").GetAttributeValue("value","") : "Panel"},
                {"ICXPos", document.GetElementbyId("ICXPos") != null ? document.GetElementbyId("ICXPos").GetAttributeValue("value","") : "0"},
                {"ICYPos", document.GetElementbyId("ICYPos") != null ? document.GetElementbyId("ICYPos").GetAttributeValue("value","") : "0"},
                {"ResponseToDiffFrame", document.GetElementbyId("ResponsetoDiffFrame") != null ? document.GetElementbyId("ResponsetoDiffFrame").GetAttributeValue("value","") : "-1"},
                {"TargetFrameName",document.GetElementbyId("TargetFrameName") != null ? document.GetElementbyId("TargetFrameName").GetAttributeValue("value","") : "None"},
            };

            foreach (var key in getSemesterListParameters.Keys)
            {
                sb.Append(key + "=" + getSemesterListParameters[key] + "&");
            }
            sb.Remove(sb.Length - 1, 1);

            request = (HttpWebRequest)WebRequest.Create(getSemesterList);
            request.Method = WebRequestMethods.Http.Post;
            request.UserAgent = "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/535.2 (KHTML, like Gecko) Chrome/15.0.874.121 Safari/535.2";
            request.AllowWriteStreamBuffering = true;
            request.ProtocolVersion = HttpVersion.Version11;
            request.AllowAutoRedirect = true;
            request.ContentType = "application/x-www-form-urlencoded";
            request.CookieContainer = cc;

            byteArray = Encoding.ASCII.GetBytes(sb.ToString());
            request.ContentLength = byteArray.Length;
            requestStream = request.GetRequestStream();
            requestStream.Write(byteArray, 0, byteArray.Length);
            requestStream.Close();

            response = (HttpWebResponse)request.GetResponse();

            html = "";
            using (StreamReader sr = new StreamReader(response.GetResponseStream()))
            {
                html = sr.ReadToEnd();
                var tempy = html;
            }
            document.LoadHtml(html);

            var semesterNodes = new List<string>();
            HtmlNode node = document.GetElementbyId("SEARCH_RESULT1");
            int i = 1;
            while (node != null)
            {
                semesterNodes.Add(node.InnerText);
                node = document.GetElementbyId("RESULT0$" + i);
                i++;
            }
            node = document.GetElementbyId("SEARCH_RESULTLAST");
            if (node != null)
                semesterNodes.Add(node.InnerText);
            if(!semesterNodes.Any())
            {
                getSemesterList = "https://sis-cs-prod.uta.edu/psc/ACSPRD/EMPLOYEE/PSFT_ACS/c/COMMUNITY_ACCESS.CLASS_SEARCH.GBL";
                getSemesterListParameters = new Dictionary<string, string>()
            {
//.........这里部分代码省略.........
开发者ID:christophereyes,项目名称:CSE-3310,代码行数:101,代码来源:DownloadCourseData.cs

示例7: twoways


//.........这里部分代码省略.........
            ONDR o;
            ONDR r;
            r = p.opONDR(i, out o);

            foreach(string key in i.Keys)
            {
                foreach(string s in i[key].Keys)
                {
                    test(Ice.CollectionComparer.Equals(i[key][s], o[key][s]));
                    test(Ice.CollectionComparer.Equals(i[key][s], r[key][s]));
                }
            }
        }

        {
            int[] ii = new int[] { 1, 2 };
            Dictionary<string, int[]> i = new Dictionary<string, int[]>();
            i["a"] = ii;
            i["b"] = ii;

            Dictionary<string, int[]> o;
            Dictionary<string, int[]> r;
            r = p.opNDAIS(i, out o);

            foreach(string key in i.Keys)
            {
                test(Ice.CollectionComparer.Equals(i[key], o[key]));
                test(Ice.CollectionComparer.Equals(i[key], r[key]));
            }
        }

        {
            CIS ii = new CIS();
            ii.Add(1);
            ii.Add(2);
            Dictionary<string, CIS> i = new Dictionary<string, CIS>();
            i["a"] = ii;
            i["b"] = ii;

            Dictionary<string, CIS> o;
            Dictionary<string, CIS> r;
            r = p.opNDCIS(i, out o);

            test(Ice.CollectionComparer.Equals(i, o));
            test(Ice.CollectionComparer.Equals(i, r));
        }

        {
            List<int> ii = new List<int>();
            ii.Add(1);
            ii.Add(2);
            Dictionary<string, List<int>> i = new Dictionary<string, List<int>>();
            i["a"] = ii;
            i["b"] = ii;

            Dictionary<string, List<int>> o;
            Dictionary<string, List<int>> r;
            r = p.opNDGIS(i, out o);

            foreach(string key in i.Keys)
            {
                test(Ice.CollectionComparer.Equals(i[key], o[key]));
                test(Ice.CollectionComparer.Equals(i[key], r[key]));
            }
        }
开发者ID:bholl,项目名称:zeroc-ice,代码行数:66,代码来源:Twoways.cs

示例8: allTests

    public static void allTests(Ice.Communicator communicator, int num)
    {
        List<ControllerPrx> proxies = new List<ControllerPrx>();
        List<ControllerPrx> indirectProxies = new List<ControllerPrx>();
        for(int i = 0; i < num; ++i)
        {
            string id = "controller" + i;
            proxies.Add(ControllerPrxHelper.uncheckedCast(communicator.stringToProxy(id)));
            indirectProxies.Add(ControllerPrxHelper.uncheckedCast(communicator.stringToProxy(id + "@control" + i)));
        }

        Console.Out.Write("testing indirect proxies... ");
        Console.Out.Flush();
        {
            foreach(ControllerPrx prx in indirectProxies)
            {
                prx.ice_ping();
            }
        }
        Console.Out.WriteLine("ok");

        Console.Out.Write("testing well-known proxies... ");
        Console.Out.Flush();
        {
            foreach(ControllerPrx prx in proxies)
            {
                prx.ice_ping();
            }
        }
        Console.Out.WriteLine("ok");

        Console.Out.Write("testing object adapter registration... ");
        Console.Out.Flush();
        {
            try
            {
                communicator.stringToProxy("object @ oa1").ice_ping();
            }
            catch(Ice.NoEndpointException)
            {
            }

            proxies[0].activateObjectAdapter("oa", "oa1", "");

            try
            {
                communicator.stringToProxy("object @ oa1").ice_ping();
            }
            catch(Ice.ObjectNotExistException)
            {
            }

            proxies[0].deactivateObjectAdapter("oa");

            try
            {
                communicator.stringToProxy("object @ oa1").ice_ping();
            }
            catch(Ice.NoEndpointException)
            {
            }
        }
        Console.Out.WriteLine("ok");

        Console.Out.Write("testing object adapter migration...");
        Console.Out.Flush();
        {
            proxies[0].activateObjectAdapter("oa", "oa1", "");
            proxies[0].addObject("oa", "object");
            communicator.stringToProxy("object @ oa1").ice_ping();
            proxies[0].removeObject("oa", "object");
            proxies[0].deactivateObjectAdapter("oa");

            proxies[1].activateObjectAdapter("oa", "oa1", "");
            proxies[1].addObject("oa", "object");
            communicator.stringToProxy("object @ oa1").ice_ping();
            proxies[1].removeObject("oa", "object");
            proxies[1].deactivateObjectAdapter("oa");
        }
        Console.Out.WriteLine("ok");

        Console.Out.Write("testing object migration...");
        Console.Out.Flush();
        {
            proxies[0].activateObjectAdapter("oa", "oa1", "");
            proxies[1].activateObjectAdapter("oa", "oa2", "");

            proxies[0].addObject("oa", "object");
            communicator.stringToProxy("object @ oa1").ice_ping();
            communicator.stringToProxy("object").ice_ping();
            proxies[0].removeObject("oa", "object");

            proxies[1].addObject("oa", "object");
            communicator.stringToProxy("object @ oa2").ice_ping();
            communicator.stringToProxy("object").ice_ping();
            proxies[1].removeObject("oa", "object");

            try
            {
                communicator.stringToProxy("object @ oa1").ice_ping();
//.........这里部分代码省略.........
开发者ID:externl,项目名称:ice,代码行数:101,代码来源:AllTests.cs

示例9: GetFontList

		public static string GetFontList(string xhtmlFileNameWithPath, string projectInputType, string finalOutput)
		{
			if (Path.GetFileName(xhtmlFileNameWithPath).IndexOf("Preserve") == 0)
			{
				xhtmlFileNameWithPath = xhtmlFileNameWithPath.Replace(Path.GetFileName(xhtmlFileNameWithPath),
																	  Path.GetFileName(xhtmlFileNameWithPath).Replace(
																		  "Preserve", ""));
			}
			string fontList = string.Empty;
			if (finalOutput == ".epub")
			{
				List<string> langCodeList = new List<string>();
				string[] epubFile = Directory.GetFiles(Path.GetDirectoryName(xhtmlFileNameWithPath), "*.epub");
				string epubFileName = epubFile[0];
				string extractFolder = Common.PathCombine(Path.GetDirectoryName(epubFileName), "Test");
				if (File.Exists(epubFileName))
				{
					ZipUtil.UnZipFiles(epubFileName, extractFolder, "", false);
					if (Directory.Exists(Common.PathCombine(extractFolder, "OEBPS")))
					{
						string[] ttfFiles = Directory.GetFiles(Common.PathCombine(extractFolder, "OEBPS"), "*.ttf");
						if (ttfFiles.Length > 0)
						{
							for (int i = 0; i < ttfFiles.Length; i++)
							{
								string filename = Path.GetFileNameWithoutExtension(ttfFiles[i]);
								if (filename.IndexOf('-') > 0)
								{
									filename = filename.Substring(0, filename.IndexOf('-'));
								}

								if (!langCodeList.Contains(filename))
								{
									langCodeList.Add(filename);
									fontList = fontList + filename;
									if (i < ttfFiles.Length - 1)
									{
										fontList = fontList + ";";
									}
								}
							}
						}
					}
				}

				if (Directory.Exists(extractFolder))
				{
					DirectoryInfo di = new DirectoryInfo(extractFolder);
					Common.CleanDirectory(di);
				}
			}
			else
			{
				List<string> langCodeList = new List<string>();
				XmlDocument xDoc = Common.DeclareXMLDocument(true);
				XmlNamespaceManager namespaceManager = new XmlNamespaceManager(xDoc.NameTable);
				namespaceManager.AddNamespace("xhtml", "http://www.w3.org/1999/xhtml");
				xDoc.Load(xhtmlFileNameWithPath);
				XmlNodeList fontNodeList = xDoc.GetElementsByTagName("meta");
				for (int i = 0; i < fontNodeList.Count; i++)
				{
					if (fontNodeList[i].Attributes["scheme"] == null)
						continue;

					string langScheme = fontNodeList[i].Attributes["scheme"].Value;
					string langContent = fontNodeList[i].Attributes["content"].Value;

					if (langScheme.ToLower().IndexOf("language to font") != 0)
						continue;

					if (!langCodeList.Contains(langContent))
					{
						langCodeList.Add(langContent);
						fontList = fontList + langContent;
						if (i < fontNodeList.Count - 1)
						{
							fontList = fontList + ";";
						}
					}
				}
			}
			return fontList;
		}
开发者ID:neilmayhew,项目名称:pathway,代码行数:83,代码来源:Common.cs

示例10: Execute

        /// <summary>
        /// The first two calls handle the error redirect from MyMav asking for cookies. The rest basically emulate the post requests
        /// from MyMav and you can use FireBug in FireFox to analyze any of MyMavs request and see how these are put together. One thing to note
        /// is that the ICIS code is the most important part as it is how the MyMav ties your session together
        /// </summary>
        public void Execute()
        {
            string errorPage = "https://sis-cs-prod.uta.edu/psc/ACSPRD/EMPLOYEE/PSFT_ACS/c/COMMUNITY_ACCESS.CLASS_SEARCH.GBL?&";

            request = (HttpWebRequest)WebRequest.Create(errorPage);
            request.CookieContainer = cc;
            request.UserAgent = "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/535.2 (KHTML, like Gecko) Chrome/15.0.874.121 Safari/535.2";
            try
            {
                response = (HttpWebResponse)request.GetResponse();
            }
            catch (Exception ex)
            {
                System.Threading.Thread.Sleep(10000);
                response = (HttpWebResponse)request.GetResponse();
            }
            string searchPage = "https://sis-cs-prod.uta.edu/psc/ACSPRD/EMPLOYEE/PSFT_ACS/c/COMMUNITY_ACCESS.CLASS_SEARCH.GBL?&";
            request = (HttpWebRequest)WebRequest.Create(searchPage);
            request.CookieContainer = cc;
            request.UserAgent = "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/535.2 (KHTML, like Gecko) Chrome/15.0.874.121 Safari/535.2";
            try
            {
                response = (HttpWebResponse)request.GetResponse();
            }
            catch (Exception ex)
            {
                System.Threading.Thread.Sleep(10000);
                response = (HttpWebResponse)request.GetResponse();
            }
            using (StreamReader sr = new StreamReader(response.GetResponseStream()))
            {
                html = sr.ReadToEnd();
            }
            var document = new HtmlDocument();
            document.LoadHtml(html);

            while (html.Contains("An error has occurred"))
            {
                request = (HttpWebRequest)WebRequest.Create(searchPage);
                request.CookieContainer = cc;
                request.UserAgent = "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/535.2 (KHTML, like Gecko) Chrome/15.0.874.121 Safari/535.2";
                try
                {
                    response = (HttpWebResponse)request.GetResponse();
                }
                catch (Exception ex)
                {
                    System.Threading.Thread.Sleep(10000);
                    response = (HttpWebResponse)request.GetResponse();
                }
                using (StreamReader sr = new StreamReader(response.GetResponseStream()))
                {
                    html = sr.ReadToEnd();
                }

            }
            document.LoadHtml(html);
            var getSemesterList = "https://sis-cs-prod.uta.edu/psc/ACSPRD/EMPLOYEE/PSFT_ACS/c/COMMUNITY_ACCESS.CLASS_SEARCH.GBL";
            var getSemesterListParameters = new Dictionary<string, string>()
            {
                {"CLASS_SRCH_WRK2_STRM$273$", document.GetElementbyId("CLASS_SRCH_WRK2_STRM$273$").InnerText},
                {"FacetPath", document.GetElementbyId("FacetPath") != null ? document.GetElementbyId("FacetPath").GetAttributeValue("value","") : "None"},
                {"ICAJAX","1"},
                {"ACAPPCLSDATA",document.GetElementbyId("ICAPPCLSDATA") != null ? document.GetElementbyId("ICAPPCLSDATA").GetAttributeValue("value","") : ""},
                {"ICAction", "CLASS_SRCH_WRK2_STRM$273$$prompt"},
                {"ICActionPrompt", document.GetElementbyId("ICActionPrompt") != null ? document.GetElementbyId("ICActionPrompt").GetAttributeValue("value","") : "false"},
                {"ICAddCount", document.GetElementbyId("ICAddCount") != null ? document.GetElementbyId("ICAddCount").GetAttributeValue("value","") : ""},
                {"ICChanged", document.GetElementbyId("ICChanged") != null ? document.GetElementbyId("ICChanged").GetAttributeValue("value","") : "-1"},
                {"ICElementNum", document.GetElementbyId("ICElementNum") != null ? document.GetElementbyId("ICElementNum").GetAttributeValue("value","") : "0"},
                {"ICFind", document.GetElementbyId("ICFind") != null ?  document.GetElementbyId("ICFind").GetAttributeValue("value","") : ""},
                {"ICFocus", ""},
                {"ICNAVTYPEDROPDOWN", "0"},
                {"ICResubmit", document.GetElementbyId("ICResubmit")!= null ? document.GetElementbyId("ICResubmit").GetAttributeValue("value","") : "0"},
                {"ICSID", document.GetElementbyId("ICSID") != null ? document.GetElementbyId("ICSID").GetAttributeValue("value","") : ""},
                {"ICSaveWarningFilter",document.GetElementbyId("ICSaveWarningFilter") != null ? document.GetElementbyId("ICSaveWarningFilter").GetAttributeValue("value","") : "0"},
                {"ICStateNum",document.GetElementbyId("ICStateNum") != null ? document.GetElementbyId("ICStateNum").GetAttributeValue("value","") : ""},
                {"ICType", document.GetElementbyId("ICType") != null ? document.GetElementbyId("ICType").GetAttributeValue("value","") : "Panel"},
                {"ICXPos", document.GetElementbyId("ICXPos") != null ? document.GetElementbyId("ICXPos").GetAttributeValue("value","") : "0"},
                {"ICYPos", document.GetElementbyId("ICYPos") != null ? document.GetElementbyId("ICYPos").GetAttributeValue("value","") : "0"},
                {"ResponseToDiffFrame", document.GetElementbyId("ResponsetoDiffFrame") != null ? document.GetElementbyId("ResponsetoDiffFrame").GetAttributeValue("value","") : "-1"},
                {"TargetFrameName",document.GetElementbyId("TargetFrameName") != null ? document.GetElementbyId("TargetFrameName").GetAttributeValue("value","") : "None"},
            };

            foreach (var key in getSemesterListParameters.Keys)
            {
                sb.Append(key + "=" + getSemesterListParameters[key] + "&");
            }
            sb.Remove(sb.Length - 1, 1);

            request = (HttpWebRequest)WebRequest.Create(getSemesterList);
            request.Method = WebRequestMethods.Http.Post;
            request.UserAgent = "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/535.2 (KHTML, like Gecko) Chrome/15.0.874.121 Safari/535.2";
            request.AllowWriteStreamBuffering = true;
            request.ProtocolVersion = HttpVersion.Version11;
            request.AllowAutoRedirect = true;
//.........这里部分代码省略.........
开发者ID:christophereyes,项目名称:CSE-3310,代码行数:101,代码来源:MyMavScreenshot.cs

示例11: twoways

    internal static void twoways(Ice.Communicator communicator, Test.MyClassPrx p)
    {
        {
            Dictionary<int, int> i = new Dictionary<int, int>();
            i[0] = 1;
            i[1] = 0;

            Dictionary<int, int> o;
            Dictionary<int, int> r;
            r = p.opNV(i, out o);

            test(Ice.CollectionComparer.Equals(i, o));
            test(Ice.CollectionComparer.Equals(i, r));
        }

        {
            Dictionary<string, string> i = new Dictionary<string, string>();
            i["a"] = "b";
            i["b"] = "a";

            Dictionary<string, string> o;
            Dictionary<string, string> r;
            r = p.opNR(i, out o);

            test(Ice.CollectionComparer.Equals(i, o));
            test(Ice.CollectionComparer.Equals(i, r));
        }

        {
            Dictionary<string, Dictionary<int, int>> i = new Dictionary<string, Dictionary<int, int>>();
            Dictionary<int, int> id = new Dictionary<int, int>();
            id[0] = 1;
            id[1] = 0;
            i["a"] = id;
            i["b"] = id;

            Dictionary<string, Dictionary<int, int>> o;
            Dictionary<string, Dictionary<int, int>> r;
            r = p.opNDV(i, out o);

            foreach(string key in i.Keys)
            {
                test(Ice.CollectionComparer.Equals(i[key], o[key]));
                test(Ice.CollectionComparer.Equals(i[key], r[key]));
            }
        }

        {
            Dictionary<string, Dictionary<string, string>> i = new Dictionary<string, Dictionary<string, string>>();
            Dictionary<string, string> id = new Dictionary<string, string>();
            id["a"] = "b";
            id["b"] = "a";
            i["a"] = id;
            i["b"] = id;

            Dictionary<string, Dictionary<string, string>> o;
            Dictionary<string, Dictionary<string, string>> r;
            r = p.opNDR(i, out o);

            foreach(string key in i.Keys)
            {
                test(Ice.CollectionComparer.Equals(i[key], o[key]));
                test(Ice.CollectionComparer.Equals(i[key], r[key]));
            }
        }

        {
            int[] ii = new int[] { 1, 2 };
            Dictionary<string, int[]> i = new Dictionary<string, int[]>();
            i["a"] = ii;
            i["b"] = ii;

            Dictionary<string, int[]> o;
            Dictionary<string, int[]> r;
            r = p.opNDAIS(i, out o);

            foreach(string key in i.Keys)
            {
                test(Ice.CollectionComparer.Equals(i[key], o[key]));
                test(Ice.CollectionComparer.Equals(i[key], r[key]));
            }
        }

        {
            List<int> ii = new List<int>();
            ii.Add(1);
            ii.Add(2);
            Dictionary<string, List<int>> i = new Dictionary<string, List<int>>();
            i["a"] = ii;
            i["b"] = ii;

            Dictionary<string, List<int>> o;
            Dictionary<string, List<int>> r;
            r = p.opNDGIS(i, out o);

            foreach(string key in i.Keys)
            {
                test(Ice.CollectionComparer.Equals(i[key], o[key]));
                test(Ice.CollectionComparer.Equals(i[key], r[key]));
            }
//.........这里部分代码省略.........
开发者ID:externl,项目名称:ice,代码行数:101,代码来源:Twoways.cs

示例12: ValidateCourses

        /// <summary>
        /// Accepts the data in comma delimited strings and exectues HttpRequests in parallel to get the data from MyMav. 
        /// Returns the current status (Open, Closed, Waitlisted) to via JSON.
        /// </summary>
        /// <param name="semester"></param>
        /// <param name="departments"></param>
        /// <param name="classNumbers"></param>
        /// <returns></returns>
        public JsonResult ValidateCourses(string semester = "2152", string departments = "CSE", string classNumbers = "21931")
        {
            try
            {
                Stopwatch watch = new Stopwatch();
                watch.Start();

                var semesterList = semester.Split(',');
                var classNumberList = classNumbers.Split(',');
                var departmentList = departments.Split(',');
                var searchResults = new List<ValidateCourses>();
                for (int i = 0; i < semesterList.Count(); i++)
                {
                    searchResults.Add(new ValidateCourses(semesterList[i], departmentList[i], classNumberList[i]));
                }

                Parallel.ForEach(searchResults, x => x.Execute());

                var results = new List<UTASearchResult>();
                foreach (var result in searchResults)
                {
                    results.Add(new UTASearchResult()
                    {
                        CourseId = result.number,
                        Department = result.department,
                        CourseName = result.courseName,
                        Semester = result.semester,
                        CourseResults = result.finalClasses

                    });
                }

                watch.Stop();
                return Json(new
                {
                    Success = true,
                    Results = results,
                    TimeTaken = watch.Elapsed.TotalSeconds,
                }, JsonRequestBehavior.AllowGet);
            }
            catch(Exception ex)
            {
                return Json(new
                {
                    Success = false,
                    Message = ex.InnerException,
                }, JsonRequestBehavior.AllowGet);
            }
        }
开发者ID:christophereyes,项目名称:CSE-3310,代码行数:57,代码来源:UTAController.cs

示例13: GetCourseInfo

        /// <summary>
        /// Gets the full course info from MyMav and returns it via JSON. Accepts comma delimited strings.
        /// </summary>
        /// <param name="semester"></param>
        /// <param name="department"></param>
        /// <param name="courseNumber"></param>
        /// <returns></returns>
        public JsonResult GetCourseInfo(string semester = "2152,2152,2152,2152", string department = "CSE,MATH,MATH,KORE", string courseNumber = "3302,1301,1302,1441")
        {
            try
            {
                Stopwatch watch = new Stopwatch();
                watch.Start();

                var semesterList = semester.Split(',');
                var departmentList = department.Split(',');
                var courseList = courseNumber.Split(',');
                var searchResults = new List<DownloadCourseData>();
                for (int i = 0; i < semesterList.Count(); i++)
                {
                    searchResults.Add(new DownloadCourseData(semesterList[i], departmentList[i], courseList[i]));
                }

                Parallel.ForEach(searchResults, x => x.Execute());

                var results = new List<UTASearchResult>();
                foreach (var result in searchResults)
                {
                    results.Add(new UTASearchResult()
                    {
                        CourseId = result.courseNumber,
                        CourseName = result.courseName,
                        Department = result.department,
                        Semester = result.semester,
                        CourseResults = result.finalClasses

                    });
                }

                watch.Stop();
                return Json(new
                {
                    Success = true,
                    Results = results,
                    TimeTaken = watch.Elapsed.TotalSeconds,
                }, JsonRequestBehavior.AllowGet);
            }
            catch (Exception ex)
            {
                return Json(new
                {
                    Success = false,
                    Message = ex.InnerException,
                }, JsonRequestBehavior.AllowGet);
            }
        }
开发者ID:christophereyes,项目名称:CSE-3310,代码行数:56,代码来源:UTAController.cs

示例14: twowaysAMI

    internal static void twowaysAMI(Ice.Communicator communicator, Test.MyClassPrx p)
    {
        {
            Dictionary<int, int> i = new Dictionary<int, int>();
            i[0] = 1;
            i[1] = 0;

            Callback cb = new Callback();
            p.begin_opNV(i, null, cb.opNVI, i);
            cb.check();
        }

        {
            Dictionary<string, string> i = new Dictionary<string, string>();
            i["a"] = "b";
            i["b"] = "a";

            Callback cb = new Callback();
            p.begin_opNR(i, null, cb.opNRI, i);
            cb.check();
        }

        {
            Dictionary<string, Dictionary<int, int>> i = new Dictionary<string, Dictionary<int, int>>();
            Dictionary<int, int> id = new Dictionary<int, int>();
            id[0] = 1;
            id[1] = 0;
            i["a"] = id;
            i["b"] = id;

            Callback cb = new Callback();
            p.begin_opNDV(i, null, cb.opNDVI, i);
            cb.check();
        }

        {
            Dictionary<string, Dictionary<string, string>> i = new Dictionary<string, Dictionary<string, string>>();
            Dictionary<string, string> id = new Dictionary<string, string>();
            id["a"] = "b";
            id["b"] = "a";
            i["a"] = id;
            i["b"] = id;

            Callback cb = new Callback();
            p.begin_opNDR(i, null, cb.opNDRI, i);
            cb.check();
        }

        {
            int[] ii = new int[] { 1, 2 };
            Dictionary<string, int[]> i = new Dictionary<string, int[]>();
            i["a"] = ii;
            i["b"] = ii;

            Callback cb = new Callback();
            p.begin_opNDAIS(i, null, cb.opNDAISI, i);
            cb.check();
        }

        {
            List<int> ii = new List<int>();
            ii.Add(1);
            ii.Add(2);
            Dictionary<string, List<int>> i = new Dictionary<string, List<int>>();
            i["a"] = ii;
            i["b"] = ii;

            Callback cb = new Callback();
            p.begin_opNDGIS(i, null, cb.opNDGISI, i);
            cb.check();
        }

        {
            string[] ii = new string[] { "a", "b" };
            Dictionary<string, string[]> i = new Dictionary<string, string[]>();
            i["a"] = ii;
            i["b"] = ii;

            Callback cb = new Callback();
            p.begin_opNDASS(i, null, cb.opNDASSI, i);
            cb.check();
        }

        {
            List<string> ii = new List<string>();
            ii.Add("a");
            ii.Add("b");
            Dictionary<string, List<string>> i = new Dictionary<string, List<string>>();
            i["a"] = ii;
            i["b"] = ii;

            Callback cb = new Callback();
            p.begin_opNDGSS(i, null, cb.opNDGSSI, i);
            cb.check();
        }
    }
开发者ID:zhangwei5095,项目名称:ice,代码行数:96,代码来源:TwowaysAMI.cs

示例15: GetLanguageCode

		public static string GetLanguageCode(string xhtmlFileNameWithPath, string projectInputType, bool vernagular)
		{
			string languageCode = string.Empty;
			if (File.Exists(xhtmlFileNameWithPath))
			{
				if (Path.GetFileName(xhtmlFileNameWithPath).IndexOf("Preserve") == 0)
				{
					xhtmlFileNameWithPath = xhtmlFileNameWithPath.Replace(Path.GetFileName(xhtmlFileNameWithPath),
																		  Path.GetFileName(xhtmlFileNameWithPath)
																			  .Replace(
																				  "Preserve", ""));
				}
				List<string> langCodeList = new List<string>();
				XmlDocument xDoc = Common.DeclareXMLDocument(true);
				XmlNamespaceManager namespaceManager = new XmlNamespaceManager(xDoc.NameTable);
				namespaceManager.AddNamespace("x", "http://www.w3.org/1999/xhtml");
				xDoc.Load(xhtmlFileNameWithPath);
				XmlNode node;
				var vernacularLang = string.Empty;
				if (vernagular)
				{
					node = xDoc.SelectSingleNode("//*[@class='headword']/@*[local-name()='lang']");
					if (node != null)
					{
						vernacularLang = node.InnerText;
					}
					else
					{
						node = xDoc.SelectSingleNode("//*[@class='headref']/@*[local-name()='lang']");
						if (node != null)
						{
							vernacularLang = node.InnerText;
						}
						else
						{
							node = xDoc.SelectSingleNode("//*[@class='Paragraph']//@*[local-name()='lang']");
							if (node != null)
							{
								vernacularLang = node.InnerText;
							}
						}
					}
				}
				XmlNodeList fontList = xDoc.GetElementsByTagName("meta");
				for (int i = 0; i < fontList.Count; i++)
				{
					string langName = fontList[i].Attributes["name"].Value;
					string langContent = fontList[i].Attributes["content"].Value;

					if (langName.ToLower() == "dc.language")
					{
						if (vernagular)
						{
							if (langContent.Length < vernacularLang.Length ||
								langContent.Substring(0, vernacularLang.Length) != vernacularLang)
							{
								continue;
							}
							if (langContent.Length >= vernacularLang.Length &&
								langContent.Substring(vernacularLang.Length, 1) != ":")
							{
								continue;
							}
						}

						if (!langCodeList.Contains(langContent))
						{
							langCodeList.Add(langContent);
							languageCode = languageCode + langContent;
							if (i < fontList.Count - 1)
							{
								languageCode = languageCode + ";";
							}
						}
					}

				}
			}
			else
			{
				languageCode = "eng";
			}
			return languageCode;
		}
开发者ID:neilmayhew,项目名称:pathway,代码行数:84,代码来源:Common.cs


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