Exemplo n.º 1
0
		public void ParseHtml(string htmlContent, ProcessContent addContentFunction, ProcessContent closeContentFunction)
		{
			elementQueue.Push(new ElementState());

			int currentPosition = 0;
			while (currentPosition < htmlContent.Length)
			{
				int openPosition = htmlContent.IndexOf('<', currentPosition);
				if (openPosition == -1)
				{
					break;
				}
				int closePosition = htmlContent.IndexOf('>', openPosition);
				if (htmlContent[openPosition + 1] == '/')
				{
					closeContentFunction(this, null);
					elementQueue.Pop();

					// get any content that is after this close but before the next open or close
					int nextOpenPosition = htmlContent.IndexOf('<', closePosition);
					if (nextOpenPosition > closePosition + 1)
					{
						string contentBetweenInsideAndEnd = htmlContent.Substring(closePosition + 1, nextOpenPosition - (closePosition + 1));
						addContentFunction(this, contentBetweenInsideAndEnd);
					}
				}
				else
				{
					ParseTypeContent(openPosition, closePosition, htmlContent);

					int endOfName = typeNameEndRegex.Match(htmlContent, openPosition + 1).Index;
					elementQueue.Peek().typeName = htmlContent.Substring(openPosition + 1, endOfName - (openPosition + 1));

					int nextOpenPosition = htmlContent.IndexOf('<', closePosition);
					string content = htmlContent.Substring(closePosition + 1, nextOpenPosition - closePosition - 1);
					addContentFunction(this, content);

					if (voidElements.Contains(elementQueue.Peek().typeName))
					{
						closeContentFunction(this, null);
						elementQueue.Pop();

						// get any content that is after this close but before the next open or close
						int nextOpenPosition2 = htmlContent.IndexOf('<', closePosition);
						if (nextOpenPosition2 > closePosition + 1)
						{
							string contentBetweenInsideAndEnd = htmlContent.Substring(closePosition + 1, nextOpenPosition2 - (closePosition + 1));
							addContentFunction(this, contentBetweenInsideAndEnd);
						}
					}
				}
				currentPosition = closePosition + 1;
			}
		}
Exemplo n.º 2
0
 private void StartLive()
 {
     this.isRunning = true;
     new Thread(() =>
     {
         while (this.isRunning)
         {
             this.pictureBox1.Image = ProcessContent.GetWindowContent(actualwindow);
             Thread.Sleep(1000 / rec.GetFps());
         }
     }).Start();
 }
Exemplo n.º 3
0
        public ContentContainer LoadContent(string path, ProcessContent process)
        {
            ContentContainer cc;

            if (!_content.TryGetValue(path, out cc)) // Check if content is not already loaded
            {
                // Create content container for content
                cc             = new ContentContainer(path);
                cc.LoadedAsync = false;
                cc.Process     = process;

                // Load content from file
                LoadFromFile(cc);
            }

            // Return content container
            return(cc);
        }
Exemplo n.º 4
0
        public void ParseHtml(string htmlContent, ProcessContent addContentFunction, ProcessContent closeContentFunction)
        {
            elementQueue.Push(new ElementState());

            int currentPosition = 0;

            while (currentPosition < htmlContent.Length)
            {
                int openPosition = htmlContent.IndexOf('<', currentPosition);
                if (openPosition == -1)
                {
                    break;
                }
                int closePosition = htmlContent.IndexOf('>', openPosition);
                if (htmlContent[openPosition + 1] == '/')
                {
                    closeContentFunction(this, null);
                    elementQueue.Pop();

                    // get any content that is after this close but before the next open or close
                    int nextOpenPosition = htmlContent.IndexOf('<', closePosition);
                    if (nextOpenPosition > closePosition + 1)
                    {
                        string contentBetweenInsideAndEnd = htmlContent.Substring(closePosition + 1, nextOpenPosition - (closePosition + 1));
                        addContentFunction(this, contentBetweenInsideAndEnd);
                    }
                }
                else
                {
                    ParesTypeContent(openPosition, closePosition, htmlContent);

                    int endOfName = typeNameEndRegex.Match(htmlContent, openPosition + 1).Index;
                    elementQueue.Peek().typeName = htmlContent.Substring(openPosition + 1, endOfName - (openPosition + 1));

                    int    nextOpenPosition = htmlContent.IndexOf('<', closePosition);
                    string content          = htmlContent.Substring(closePosition + 1, nextOpenPosition - closePosition - 1);
                    addContentFunction(this, content);
                }
                currentPosition = closePosition + 1;
            }
        }
Exemplo n.º 5
0
        public ActionResult AddProcess(ProcessModel p)
        {
            if (Session["UserID"] == null)
            {
                return(RedirectToAction("Index", "YoneticiGiris"));
            }
            else
            {
                var            cid     = Convert.ToInt32(TempData["id"]);
                fuelrmEntities db      = new fuelrmEntities();
                ProcessContent content = new ProcessContent();
                content.Description = p.details;
                content.ProuctID    = p.productid;
                content.Type        = p.type;
                var prodname = (from i in db.URUNLISTEM
                                where i.PRODUCT_CODE == p.productid.ToString()
                                select i
                                ).FirstOrDefault();
                content.ProductName = prodname.PRODUCT_NAME;
                db.ProcessContent.Add(content);
                ProcessINFO process = new ProcessINFO();
                process.ContentID   = content.ID;
                process.Description = p.describtion;
                process.Time        = DateTime.Now;
                process.AdminID     = Convert.ToInt32(Session["UserID"]);
                process.CarID       = Convert.ToInt32(cid);
                db.ProcessINFO.Add(process);
                db.SaveChanges();


                var query = (from car in db.CarInfo
                             where car.ID == cid
                             select car.UserID).FirstOrDefault();



                return(RedirectToAction("TakeProcess", new { id = cid }));
            }
            // return RedirectToAction("CarList","Musteri", new { id = query});
        }