示例#1
0
 /// <summary>
 /// Displays points inside the area of the detected hand
 /// </summary>
 /// <param name="tracking_info">Requires tracking information of the hand</param>
 /// <param name="index">Requires the int index value that refers to a given hand from the array of hands </param>
 private void ShowInnerPoints(TrackingInfo tracking_info, int index)
 {
     inner_parent.SetActive(_show_inner);
     if (_show_inner)
     {
         for (int point = 0; point < inner_particles[index].Length; point++)
         {
             if (tracking_info.inner_points != null)
             {
                 if (point < tracking_info.amount_of_inner_points)
                 {
                     inner_particles[index][point].gameObject.SetActive(true);
                     inner_particles[index][point].position = mano_utils.CalculateNewPosition(tracking_info.inner_points[point], tracking_info.relative_depth);
                 }
                 else
                 {
                     inner_particles[index][point].gameObject.SetActive(false);
                 }
             }
             else
             {
                 Debug.Log("tracking info inner points are null");
             }
         }
     }
 }
        public async Task <IActionResult> PutTrackingInfo(int id, TrackingInfo trackingInfo)
        {
            if (id != trackingInfo.Id)
            {
                return(BadRequest());
            }

            _context.Entry(trackingInfo).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!TrackingInfoExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
示例#3
0
        public static double GetStalkingBonus(Mobile tracker, Mobile target)
        {
            TrackingInfo info = null;

            m_Table.TryGetValue(tracker, out info);

            if (info == null || info.m_Target != target || info.m_Map != target.Map)
            {
                return(0.0);
            }

            int xDelta = info.m_Location.X - target.X;
            int yDelta = info.m_Location.Y - target.Y;

            double bonus = Math.Sqrt((xDelta * xDelta) + (yDelta * yDelta));

            m_Table.Remove(tracker);                    //Reset as of Pub 40, counting it as bug for Core.SE.

            if (Core.ML)
            {
                return(Math.Min(bonus, 10 + tracker.Skills.Tracking.Value / 10));
            }

            return(bonus);
        }
示例#4
0
        /// <summary>
        /// 修改跟踪单
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        public virtual void UpdateTrackingInfo(TrackingInfo entity)
        {
            var trackingInfo = GetTrackingInfoBySysNo(entity.SysNo.Value);

            if (trackingInfo.Status == TrackingInfoStatus.Confirm)
            {
                ThrowBizException("TrackingInfo_Update_ConfirmStatusCanNotUpdate");
            }

            //修改责任人姓名
            ChangeResponsibleUserName(entity, trackingInfo, string.Empty);

            //多次备注之间用分号隔开
            string note = string.Concat(trackingInfo.Note, ";", entity.Note).TrimStart(';').TrimEnd(';');

            //备注内容查过500,需要记录日志。
            if (note.Length > 500)
            {
                //记录操作日志
                ObjectFactory <ICommonBizInteract> .Instance.CreateOperationLog(
                    GetMessageString("TrackingInfo_Log_UpdateTrackingInfo", ServiceContext.Current.UserSysNo, entity.SysNo, entity.Note)
                    , BizLogType.Invoice_TrackingInfo_UpdateTrackingInfo
                    , entity.SysNo.Value
                    , entity.CompanyCode);

                entity.Note = trackingInfo.Note;
            }
            else
            {
                entity.Note = note;
            }

            m_TrackInfoDA.UpdateTrackingInfo(entity);
        }
 private void ShowResult(TrackingInfo info)
 {
     StringBuilder builder = new StringBuilder();
     builder.Append("<h2>Result </h2><div>");
     builder.Append("<table cellspacing=\"0\" cellpadding=\"0\" border=\"0\" width=\"100%\">");
     builder.Append("<tr><td>");
     builder.Append("Tracking Number");
     builder.Append("</td><td>");
     builder.Append(info.TrackingNumber);
     builder.Append("</td></tr>");
     builder.Append("<tr><td>");
     builder.Append("Summary");
     builder.Append("</td><td>");
     builder.Append(info.Summary);
     builder.Append("</td></tr>");
     builder.Append("<tr><td>");
     builder.Append("Details");
     builder.Append("</td><td><div>");
     int i = 0;
     foreach (var detail in info.Details)
     {
         builder.Append("<p>" + detail + "</p>");
         i++;
     }
     if (info.Details.Count == 0)
     {
         builder.Append("<p>N/A</p>");
     }
     builder.Append("</div></td></tr>");
     builder.Append("</table></div>");
     dvTrackResponse.InnerHtml = builder.ToString();
 }
示例#6
0
    // Update is called once per frame
    void Update()
    {
        ManoGestureContinuous theGestureThatWillBeDetectedNow = ManomotionManager.Instance.Hand_infos[0].hand_info.gesture_info.mano_gesture_continuous;
        TrackingInfo          theTrackingInformation          = ManomotionManager.Instance.Hand_infos[0].hand_info.tracking_info;

        MoveTrashCanBasedOnContinuousGesture(theGestureThatWillBeDetectedNow, theTrackingInformation);
    }
        public async Task <bool> AddOrUpdateTracking(Guid trackingkey, TrackingInfo trackingInfo)
        {
            IDatabase cache  = connectionMultiplexer.GetDatabase();
            bool      result = await cache.StringSetAsync(trackingInfo.TrackingId.ToString(), JsonConvert.SerializeObject(trackingInfo));

            return(result);
        }
    /// <summary>
    /// Shows the bounding box info.
    /// </summary>
    /// <param name="tracking_info">Requires tracking information of the hand</param>
    /// <param name="index">Requires the int index value that refers to a given hand from the array of hands </param>
    private void ShowBoundingBoxInfo(TrackingInfo tracking_info, int index, Warning warning)
    {
        if (warning != Warning.WARNING_HAND_NOT_FOUND && Show_bounding_box)
        {
            if (!bounding_box_ui[index])
            {
                CreateBoundingBoxes();
            }


            if (bounding_box_ui[index])
            {
                if (!bounding_box_ui[index].gameObject.activeInHierarchy)
                {
                    bounding_box_ui[index].gameObject.SetActive(true);
                }

                bounding_box_ui[index].UpdateInfo(tracking_info.bounding_box);
            }
        }
        else
        {
            if (bounding_box_ui[index] && bounding_box_ui[index].gameObject.activeInHierarchy)
            {
                bounding_box_ui[index].gameObject.SetActive(false);
            }
        }
    }
 public HeapCellFilterTriplet(string aEntity, Color aColor, bool aEnabled, TrackingInfo aTrackingInfo)
 {
     iEntity       = aEntity;
     iColor        = aColor;
     iEnabled      = aEnabled;
     iTrackingInfo = aTrackingInfo;
 }
        internal override void Track(HeapCell aCell)
        {
            if (aCell.Symbol != null && aCell.Symbol.IsDefault)
            {
                System.Diagnostics.Debug.WriteLine("Unknown cell: " + aCell.ToStringExtended() + ", size: " + aCell.Symbol.Size + ", " + aCell.Symbol.Object);
            }

            if (aCell.Type == HeapCell.TType.EAllocated && !aCell.IsUnknown)
            {
                System.Diagnostics.Debug.Assert(aCell.Symbol != null);

                base.HandleCell(aCell);

                uint         address = (uint)aCell.Symbol.Address;
                TrackingInfo entry   = iList[address];

                // If we found an entry, then associate this cell with it.
                // Otherwise, we'll need to make a new entry...
                if (entry == null)
                {
                    entry = new TrackingInfo(aCell.Symbol);
                    entry.PayloadLength = aCell.PayloadLength;

                    iList.Add(address, entry);
                }
                entry.Associate(aCell);
            }
        }
示例#11
0
        public override List <VideoInfo> GetVideos(Category category)
        {
            List <VideoInfo> res = new List <VideoInfo>();

            Tuple <XmlDocument, XmlNamespaceManager> result = getData(((RssLink)category).Url);

            foreach (XmlNode node in result.Item1.SelectNodes(@"//a:response[not(a:propstat/a:prop/a:resourcetype/a:collection)]", result.Item2))
            {
                VideoInfo vid = new VideoInfo()
                {
                    VideoUrl = fullBasePath + node.SelectSingleNode(".//a:href", result.Item2).InnerText
                };
                int p = vid.VideoUrl.LastIndexOf('/');
                vid.Title = HttpUtility.UrlDecode(vid.VideoUrl.Substring(p + 1));

                TrackingInfo tInfo = new TrackingInfo()
                {
                    Regex     = Regex.Match(vid.Title, @"^(?<Title>.*?)\s*-\s*(?<Season>\d+)x(?<Episode>\d+)", RegexOptions.IgnoreCase),
                    VideoKind = VideoKind.TvSeries
                };
                if (tInfo.Season == 0)
                {
                    //probably movie
                    tInfo.Regex     = Regex.Match(vid.Title, @"^(?<Title>.*?)\s*-\s*(?<Year>\d{4})", RegexOptions.IgnoreCase);
                    tInfo.VideoKind = VideoKind.Movie;
                }
                vid.Other = tInfo;

                res.Add(vid);
            }
            res.Sort(VideoComparer);
            return(res);
        }
 /// <summary>
 /// Displays points inside the area of the detected hand
 /// </summary>
 /// <param name="tracking_info">Requires tracking information of the hand</param>
 /// <param name="index">Requires the int index value that refers to a given hand from the array of hands </param>
 private void ShowInnerPoints(TrackingInfo tracking_info, int index)
 {
     inner_parent.SetActive(_show_inner && ManomotionManager.Instance.Hand_infos[0].hand_info.warning != Warning.WARNING_HAND_NOT_FOUND);
     if (_show_inner)
     {
         for (int point = 0; point < inner_particles[index].Length; point++)
         {
             if (tracking_info.inner_points != null)
             {
                 if (point < tracking_info.amount_of_inner_points)
                 {
                     inner_particles[index][point].gameObject.SetActive(true);
                     inner_particles[index][point].localPosition = mano_utils.CalculateNewPosition(tracking_info.inner_points[point], tracking_info.relative_depth - 0.1f);
                 }
                 else
                 {
                     inner_particles[index][point].gameObject.SetActive(false);
                 }
             }
             else
             {
                 Debug.Log("tracking info inner points are null");
             }
         }
     }
 }
示例#13
0
 // Start is called before the first frame update
 void Start()
 {
     gestureInfo  = ManomotionManager.Instance.Hand_infos[0].hand_info.gesture_info;
     trackingInfo = ManomotionManager.Instance.Hand_infos[0].hand_info.tracking_info;
     warning      = ManomotionManager.Instance.Hand_infos[0].hand_info.warning;
     session      = ManomotionManager.Instance.Manomotion_Session;
 }
示例#14
0
    private void DisplayTriggerGesture(ManoGestureTrigger triggerGesture, TrackingInfo trackingInfo)
    {
        switch (triggerGesture)
        {
        case ManoGestureTrigger.NO_GESTURE:
            visualDisplay.text += "ManoGestureTrigger: NO_GESTURE\n";
            break;

        case ManoGestureTrigger.CLICK:
            visualDisplay.text += "ManoGestureTrigger: CLICK\n";
            break;

        case ManoGestureTrigger.DROP:
            visualDisplay.text += "ManoGestureTrigger: DROP\n";
            break;

        case ManoGestureTrigger.GRAB_GESTURE:
            visualDisplay.text += "ManoGestureTrigger: GRAB_GESTURE\n";
            break;

        case ManoGestureTrigger.PICK:
            visualDisplay.text += "ManoGestureTrigger: PICK\n";
            break;

        case ManoGestureTrigger.RELEASE_GESTURE:
            visualDisplay.text += "ManoGestureTrigger: RELEASE_GESTURE\n";
            break;

        default:
            visualDisplay.text += "ManoGestureTrigger: \n";
            break;
        }
    }
示例#15
0
        private List <VideoInfo> GetSeriesVideoList(string url, string data, Category parentCategory)
        {
            List <VideoInfo> videoList = new List <VideoInfo>();

            if (data.Length > 0)
            {
                Match m = regex_ShowVideoList.Match(data);
                while (m.Success)
                {
                    VideoInfo videoInfo = CreateVideoInfo();
                    videoInfo.Title = HttpUtility.HtmlDecode(m.Groups["Title"].Value);
                    // get, format and if needed absolutify the video url
                    videoInfo.VideoUrl = FormatDecodeAbsolutifyUrl(url, m.Groups["VideoUrl"].Value, videoListRegExFormatString, videoListUrlDecoding);

                    string       id    = m.Groups["id"].Value;
                    TrackingInfo tInfo = new TrackingInfo()
                    {
                        Title     = parentCategory.Name,
                        Regex     = Regex.Match(id, "s(?<Season>[^e]*)e(?<Episode>.*)"),
                        VideoKind = VideoKind.TvSeries
                    };
                    if (tInfo.Season != 0)
                    {
                        videoInfo.Other = tInfo;
                    }
                    videoList.Add(videoInfo);

                    m = m.NextMatch();
                }
            }

            return(videoList);
        }
    protected override void FixedUpdate()
    {
        GestureInformation  = ManomotionManager.Instance.Hand_infos[0].hand_info.gesture_info;
        TrackingInformation = ManomotionManager.Instance.Hand_infos[0].hand_info.tracking_info;
        ScreenPosition      = TrackingInformation.poi;

        Distance = Mathf.Pow(TrackingInformation.depth_estimation, 2);

        if (Distance > 0.0f && ScreenPosition.x > 0.0f)
        {
            MoveCursor();
        }

        if (IsGrabPieceGesture(GestureInformation.mano_gesture_trigger))
        {
            Debug.Log("Grab Gesture");
            GestureGrab();
        }

        if (IsReleaseGesture(GestureInformation.mano_gesture_trigger))
        {
            Debug.Log("Release");
            Release();
        }

        if (SelectedPiece == null)
        {
            return;
        }
        else
        {
            UpdateScreenPosition();
            SelectedPlacer.TouchPosition = WorldPosition;
        }
    }
        public async Task <TrackingInfo> GetTracking(Guid trackingKey)
        {
            IDatabase    cache        = connectionMultiplexer.GetDatabase();
            TrackingInfo trackingInfo = JsonConvert.DeserializeObject <TrackingInfo>(await cache.StringGetAsync(trackingKey.ToString()));

            return(trackingInfo);
        }
示例#18
0
    public void Interact(GestureInfo gestureInfo, TrackingInfo trackingInformation)
    {
        if (Input.GetMouseButtonDown(0))
        {
            Ray        ray = Camera.main.ScreenPointToRay(Input.mousePosition);
            RaycastHit hit;
            if (Physics.Raycast(ray.origin, ray.direction, out hit))
            {
                if (hit.transform.tag == interactableTag)
                {
                    StartCoroutine(closeMouth());
                }
            }
        }

        if (gestureInfo.mano_gesture_trigger == triggerGesture)
        {
            //Interact with the Big Tooth using a triggerGesture Gesture

            Ray        ray = Camera.main.ScreenPointToRay(cursorRectTransform.transform.position);
            RaycastHit hit;
            if (Physics.Raycast(ray.origin, ray.direction, out hit))
            {
                Handheld.Vibrate();
                if (hit.transform.tag == interactableTag)
                {
                    StartCoroutine(closeMouth());
                }
            }
        }
    }
示例#19
0
        private void ProcTaskListTime(HEADER obj)
        {
            mCount = 0;
            ICD.WorkList msg = (ICD.WorkList)obj;

            HEADER msgHis = new HEADER();

            msgHis.FillClientHeader(DEF.CMD_TaskHistory);

            foreach (Work item in msg.works)
            {
                if (mTracks.ContainsKey(item.recordID))
                {
                    continue;
                }

                TrackingInfo info = new TrackingInfo();
                info.workBase          = item;
                info.his               = null;
                mTracks[item.recordID] = info;
                mCount++;

                msgHis.ext1 = item.recordID.ToString();
                ICDPacketMgr.GetInst().sendMsgToServer(msgHis);
            }
        }
示例#20
0
        // Update is called once per frame
        void Update()
        {
            Warning      currentWarning      = ManomotionManager.Instance.Hand_infos[0].hand_info.warning;
            TrackingInfo currentTrackingInfo = ManomotionManager.Instance.Hand_infos[0].hand_info.tracking_info;

            MoveInteractionPoint(currentWarning, currentTrackingInfo);
        }
        public override void PrepareContent(HeapCellArrayWithStatistics aCells, HeapStatistics aStats)
        {
            try
            {
                HeapCell cell = aCells[0];
                System.Diagnostics.Debug.Assert(cell.Type == HeapCell.TType.EAllocated);
                System.Diagnostics.Debug.Assert(cell.Symbol != null);
                RelationshipManager relMgr = cell.RelationshipManager;
                //
                TrackingInfo info      = aStats.StatsAllocated.TrackerSymbols[cell.Symbol];
                int          instCount = info.AssociatedCellCount;
                //
                Title = instCount + " Instance(s)";
                //
                StringBuilder msg = new StringBuilder();
                //
                msg.AppendFormat("This allocated cell is an instance of {0} from {1}", cell.Symbol.NameWithoutVTablePrefix, cell.Symbol.ObjectWithoutSection);
                msg.Append(System.Environment.NewLine + System.Environment.NewLine);

                msg.AppendFormat("There {0} {1} instance{2} of this symbol, with each instance using {3} bytes of memory (plus cell header overhead).", (instCount == 0 || instCount > 1) ? "are" : "is", info.AssociatedCellCount, (instCount == 0 || instCount > 1) ? "s" : string.Empty, cell.PayloadLength);
                msg.Append(System.Environment.NewLine + System.Environment.NewLine);
                //
                msg.AppendFormat("In total, cells of this type use {0} bytes of heap memory", info.AssociatedMemory);
                msg.Append(System.Environment.NewLine + System.Environment.NewLine);
                //
                msg.AppendFormat("This cell references {0} other cell(s), and is referenced by {1} cell(s)", relMgr.EmbeddedReferencesTo.Count, relMgr.ReferencedBy.Count);
                msg.Append(System.Environment.NewLine + System.Environment.NewLine);
                //
                iLbl_Description.Text = msg.ToString();
            }
            finally
            {
                base.PrepareContent(aCells, aStats);
            }
        }
示例#22
0
        private void UpdateSelectionTotals()
        {
            bool atLeastOneValue = false;
            long total           = 0;

            foreach (XPTable.Models.Row row in iTable_SymbolMemory.SelectedItems)
            {
                TrackingInfo item = (TrackingInfo)row.Tag;
                //
                total          += item.AssociatedMemory;
                atLeastOneValue = true;
            }

            string totalValueAsString      = "[nothing selected]";
            string totalAsPercentageString = "";

            //
            if (atLeastOneValue)
            {
                int  allocCount;
                int  freeCount;
                long freeSpaceSize;
                long allocatedUnknownSize;
                long allocatedSymbolMatchSize;
                long totalHeapAllocatedMemory = TotalAllocatedMemory(out allocCount, out freeCount, out freeSpaceSize, out allocatedUnknownSize, out allocatedSymbolMatchSize);
                //
                totalValueAsString      = total.ToString();
                totalAsPercentageString = NumberFormattingUtils.NumberAsPercentageTwoDP(total, totalHeapAllocatedMemory) + " %";
            }
            //
            iLV_Summary.Items[9].SubItems[1].Text = totalValueAsString;
            iLV_Summary.Items[9].SubItems[2].Text = totalAsPercentageString;
        }
示例#23
0
    void ContinuousGesture(GestureInfo gesture, TrackingInfo tracking, Warning warning)
    {
        if (warning != Warning.WARNING_HAND_NOT_FOUND)
        {
            //found hand
            if (gesture.mano_gesture_continuous == ManoGestureContinuous.CLOSED_HAND_GESTURE)
            {
                openHand = false;
                if (reloading == false)
                {
                    reloading = true;
                    Invoke("Reload", 1f);
                }
                Vector3 boundingBoxCenter    = tracking.bounding_box_center;
                Vector3 projectileSpawnPoint = boundingBoxCenter;

                Vector3 holdAnimationPoint = boundingBoxCenter;
                holdAnimationPoint.z = 0.5f;

                projectileSpawnPoint.z             = 5f;
                boundingBoxCenter.z                = 3f;
                projectileSpawn.transform.position = Camera.main.ViewportToWorldPoint(projectileSpawnPoint);
                holdAnimation.transform.position   = Camera.main.ViewportToWorldPoint(holdAnimationPoint);
            }
        }

        else
        {
            reloading = false;
            reloaded  = false;
            openHand  = false;
            holdAnimation.SetActive(false);
        }
    }
示例#24
0
            public int Compare(object aLeft, object aRight)
            {
                TrackingInfo left  = null;
                TrackingInfo right = null;

                //
                if ((aLeft is TrackingInfo) && (aRight is TrackingInfo))
                {
                    left  = (TrackingInfo)aLeft;
                    right = (TrackingInfo)aRight;
                }
                else if (aLeft is XPTable.Models.Cell && aRight is XPTable.Models.Cell)
                {
                    XPTable.Models.Cell cellLeft  = (aLeft as XPTable.Models.Cell);
                    XPTable.Models.Cell cellRight = (aRight as XPTable.Models.Cell);
                    //
                    left  = (TrackingInfo)cellLeft.Row.Tag;
                    right = (TrackingInfo)cellRight.Row.Tag;
                }

                // Now do the compare...
                int ret = iBaseComparer.Compare(left, right);

                return(ret);
            }
示例#25
0
        private List <VideoInfo> Videos(string url)
        {
            HtmlDocument     doc    = GetWebData <HtmlDocument>(url, cookies: GetCookie());
            var              divs   = doc.DocumentNode.SelectNodes("//div[@class = 'moviefilm']");
            List <VideoInfo> videos = new List <VideoInfo>();

            foreach (var div in divs)
            {
                var           a     = div.SelectSingleNode("a");
                var           img   = a.SelectSingleNode("img");
                string        title = img.GetAttributeValue("alt", "");
                ITrackingInfo ti    = new TrackingInfo();
                //Series
                Regex rgx = new Regex(@"([^S\d+E\d+]*)S(\d+)E(\d+)");
                uint  s   = 0;
                uint  e   = 0;
                Match m   = rgx.Match(title);
                if (m.Success)
                {
                    ti.Title = m.Groups[1].Value;
                    uint.TryParse(m.Groups[2].Value, out s);
                    ti.Season = s;
                    uint.TryParse(m.Groups[3].Value, out e);
                    ti.Episode   = e;
                    ti.VideoKind = VideoKind.TvSeries;
                }
                else
                {
                    //movies
                    rgx = new Regex(@"(.+)\((\d{4})\)");
                    m   = rgx.Match(title);
                    uint y = 0;
                    if (m.Success)
                    {
                        ti.Title = m.Groups[1].Value;
                        uint.TryParse(m.Groups[2].Value, out y);
                        ti.Year      = y;
                        ti.VideoKind = VideoKind.Movie;
                    }
                }

                videos.Add(new VideoInfo()
                {
                    Title = title, Thumb = img.GetAttributeValue("src", ""), VideoUrl = a.GetAttributeValue("href", ""), Other = ti
                });
            }
            var      fastphp = doc.DocumentNode.SelectSingleNode("//div[@class = 'fastphp']");
            HtmlNode next    = null;

            if (fastphp != null)
            {
                next = fastphp.Descendants("a").FirstOrDefault(a => HttpUtility.HtmlDecode(a.InnerText).Contains("nästa"));
            }
            HasNextPage = next != null;
            if (HasNextPage)
            {
                nextPageUrl = "http://www.swefilmer.com/" + next.GetAttributeValue("href", "");
            }
            return(videos);
        }
示例#26
0
    // Update is called once per frame
    void Update()
    {
        TrackingInfo trackingInfo = ManomotionManager.Instance.Hand_infos[0].hand_info.tracking_info;
        Warning      warning      = ManomotionManager.Instance.Hand_infos[0].hand_info.warning;

        Display2DBoundingBox(warning, trackingInfo);
    }
    /// <summary>
    /// Displays the contour/outer points of the detected hand
    /// </summary>
    /// <param name="tracking_info">Requires tracking information of the hand</param>
    /// <param name="index">Requires the int index value that refers to a given hand from the array of hands </param>
    private void ShowContour(TrackingInfo tracking_info, int index)
    {
        contour_parent.SetActive(Show_contour && ManomotionManager.Instance.Hand_infos[0].hand_info.warning != Warning.WARNING_HAND_NOT_FOUND);

        contour_line_renderer[index].enabled = Show_contour;
        if (Show_contour)
        {
            if (tracking_info.contour_points != null)
            {
                contour_line_renderer[index].positionCount = tracking_info.amount_of_contour_points + 1; // +1 so that it loops

                for (int i = 0; i < contour_particles[index].Length; i++)
                {
                    if (i < tracking_info.amount_of_contour_points)
                    {
                        contour_particles[index][i].gameObject.SetActive(true);
                        Vector3 newPos = mano_utils.CalculateNewPosition(tracking_info.contour_points[i], tracking_info.relative_depth - .1f);

                        contour_particles[index][i].localPosition = newPos;
                        contour_line_renderer[index].SetPosition(i, contour_particles[index][i].localPosition);
                    }
                    else
                    {
                        contour_particles[index][i].gameObject.SetActive(false);
                    }
                }
                contour_line_renderer[index].SetPosition(tracking_info.amount_of_contour_points, contour_particles[index][0].localPosition);
            }
        }
    }
示例#28
0
        public async Task <JsonResult> ChangeStatusFromPhoneNumber(int PrankCallFromId, bool IsDefault)
        {
            IsDefault = IsDefault ? false : true;
            var    data        = new ResponseModel();
            var    objResponse = new SaveResponse();
            string viewFromCurrentController = string.Empty;

            if (PrankCallFromId > 0)
            {
                string token          = string.Empty;
                var    claimsIdentity = (ClaimsIdentity)HttpContext.User.Identity;
                var    userTokenClaim = claimsIdentity.Claims.SingleOrDefault(c => c.Type == "Token");
                if (userTokenClaim != null)
                {
                    token = userTokenClaim.Value;
                }
                data = await ApiClientFactory.Instance.ChangeStatusPrankCallFromPhoneNumber(token, PrankCallFromId, IsDefault);

                objResponse.StatusCode = Convert.ToInt32(data.StatusCode);

                if (objResponse.StatusCode == 200)
                {
                    objResponse.Message = "Record status changed successfully";
                    await TrackingInfo.TrackInfo(token, EmployeeId, ControllerContext.ActionDescriptor.ControllerName, PrankCallFromId.ToString(), PrankCallFromId, "ChangeStatusFromPhoneNumber");
                }
                else
                {
                    objResponse.Message = "Record not status changed successfully";
                }
            }
            return(new JsonResult(new
            {
                objResponse
            }));
        }
示例#29
0
    /// <summary>
    /// Displayes rough estimation of depth
    /// </summary>
    /// <param name="palmCenter">Requires the estimated position of the bounding box center.</param>
    void DisplayPalmCenter(TrackingInfo tracking_info, GestureInfo gesture, Warning warning)
    {
        if (ShowPalmCenter)
        {
            if (warning != Warning.WARNING_HAND_NOT_FOUND)
            {
                if (!palmCenterGizmo.activeInHierarchy)
                {
                    palmCenterGizmo.SetActive(true);
                }

                float smoothing = 1 - ManomotionManager.Instance.Manomotion_Session.smoothing_controller;
                palmCenterRectTransform.position = ManoUtils.Instance.CalculateScreenPosition(tracking_info.palm_center, tracking_info.depth_estimation);
                float newFillAmmount = 1 - ((int)(gesture.state / 6) * 0.25f);
                palmCenterFillAmmount.localScale = Vector3.Lerp(palmCenterFillAmmount.localScale, Vector3.one * newFillAmmount, 0.9f);
            }
            else
            {
                if (palmCenterGizmo.activeInHierarchy)
                {
                    palmCenterGizmo.SetActive(false);
                }
            }
        }
        else
        {
            if (palmCenterGizmo.activeInHierarchy)
            {
                palmCenterGizmo.SetActive(false);
            }
        }
    }
        protected override void ExtraVideoMatch(VideoInfo video, GroupCollection matchGroups)
        {

            TrackingInfo ti = new TrackingInfo();

            // for southpark world
            System.Text.RegularExpressions.Group epGroup = matchGroups["Episode"];
            if (epGroup.Success)
                ti.Regex = Regex.Match(epGroup.Value, @"(?<Season>\d\d)(?<Episode>\d\d)");

            // for nl and de
            if (ti.Season == 0)
                ti.Regex = Regex.Match(video.VideoUrl, @"\/S(?<Season>\d{1,3})E(?<Episode>\d{1,3})-", RegexOptions.IgnoreCase);

            if (ti.Season != 0)
            {
                ti.Title = "South Park";
                ti.VideoKind = VideoKind.TvSeries;
                video.Other = new VideoInfoOtherHelper() { TI = ti };
            }
            else
                video.Other = new VideoInfoOtherHelper();
            int time;
            if (Int32.TryParse(video.Airdate, out time))
            {
                video.Airdate = epoch.AddSeconds(time).ToString();
            }
        }
        public async Task <ActionResult <TrackingInfo> > PostTrackingInfo(TrackingInfo trackingInfo)
        {
            _context.TrackingInfo.Add(trackingInfo);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetTrackingInfo", new { id = trackingInfo.Id }, trackingInfo));
        }
示例#32
0
 private List<VideoInfo> GetVideos(string url, int page)
 {
     List<VideoInfo> videos = new List<VideoInfo>();
     HtmlDocument doc = GetWebData<HtmlDocument>(string.Format(url, page));
     HtmlNodeCollection movies = doc.DocumentNode.SelectNodes("//div[@class = 'item' and contains(@id,'mt-')]");
     if (movies != null)
     {
         foreach (HtmlNode movie in movies)
         {
             VideoInfo video = new VideoInfo();
             ITrackingInfo ti = new TrackingInfo() { VideoKind = VideoKind.Movie };
             HtmlNode a = movie.SelectSingleNode("a");
             if (a != null)
             {
                 video.VideoUrl = a.GetAttributeValue("href", "");
                 HtmlNode img = a.SelectSingleNode(".//img");
                 if (img != null)
                 {
                     video.Thumb = img.GetAttributeValue("src", "");
                 }
             }
             HtmlNode h2 = movie.SelectSingleNode(".//h2");
             if (h2 != null)
             {
                 video.Title = HttpUtility.HtmlDecode(h2.InnerText.Trim());
                 ti.Title = video.Title;
             }
             HtmlNode desc = movie.SelectSingleNode(".//span[@class = 'ttx']");
             if (desc != null)
             {
                 video.Description = HttpUtility.HtmlDecode(desc.InnerText.Trim());
             }
             HtmlNode airDate = movie.SelectSingleNode(".//span[@class = 'year']");
             if (airDate != null)
             {
                 video.Airdate = HttpUtility.HtmlDecode(airDate.InnerText.Trim());
                 uint y = 0;
                 uint.TryParse(video.Airdate, out y);
                 ti.Year = y;
             }
             video.Other = ti;
             videos.Add(video);
         }
     }
     return videos;
 }
    public override ITrackingInfo GetTrackingInfo(VideoInfo video)
    {
      try
      {
        TrackingInfo tInfo = new TrackingInfo()
        {
          Regex = Regex.Match(video.Title, @"(?<Title>[^(]*)\((?<Year>[^)]*)\)"),
          VideoKind = VideoKind.Movie
        };

      }
      catch (Exception e)
      {
        Log.Warn("Error parsing TrackingInfo data: {0}", e.ToString());
      }

      return base.GetTrackingInfo(video);
    }
    public override ITrackingInfo GetTrackingInfo(VideoInfo video)
    {
      Log.Debug("Debug Video.Title === " + video.Title);
      try
      {
        TrackingInfo tInfo = new TrackingInfo()
        {
          //Grimm – Season 3 Episode 3 – A Dish Best Served Cold
          Regex = Regex.Match(video.Title, @"(?<Title>.*)\s–\sS(?<Season>\d+)E(?<Episode>\d+)", RegexOptions.IgnoreCase),
          VideoKind = VideoKind.TvSeries
        };
        Match match = Regex.Match(video.Title, @"(?<Title>.*)\s–\sS(?<Season>\d+)E(?<Episode>\d+)");
        Log.Debug("Debug regex match === " + tInfo.Title + " Season " + tInfo.Season + " Episode " + tInfo.Episode);
      }
      catch (Exception e)
      {
        Log.Warn("Error parsing TrackingInfo data: {0}", e.ToString());
      }

      return base.GetTrackingInfo(video);
    }
        public override List<VideoInfo> GetVideos(Category category)
        {
            List<VideoInfo> videos = new List<VideoInfo>();
            string url = (category as RssLink).Url;
            if (url.Contains("/series/"))
            {
                HtmlNode doc = GetWebData<HtmlDocument>(url, encoding: Encoding.UTF8).DocumentNode;
                HtmlNodeCollection seasons = doc.SelectNodes("//div[contains(@class,'season') and contains(@class ,'panel')]");
                foreach(HtmlNode season in seasons)
                {
                    string seasonId = season.GetAttributeValue("id", "");
                    Regex rgx = new Regex(@"s(\d+)");
                    Match m = rgx.Match(seasonId);
                    uint seasonNo = 0;
                    if (m.Success)
                    {
                        seasonNo = uint.Parse(m.Groups[1].Value);
                    }
                    HtmlNodeCollection episodes = season.SelectNodes(".//a[contains(@class,'episode')]");
                    foreach(HtmlNode episode in episodes)
                    {
                        string episodeName = episode.InnerText;
                        rgx = new Regex(@"[^\d]*(\d+)");
                        m = rgx.Match(episodeName);
                        uint episodeNo = 0;
                        if (m.Success)
                        {
                            episodeNo = uint.Parse(m.Groups[1].Value);
                        }
                        ITrackingInfo ti = new TrackingInfo() { Title = category.Name, VideoKind = VideoKind.TvSeries, Season = seasonNo, Episode = episodeNo };
                        videos.Add(new VideoInfo()
                            {
                                Title = category.Name + " " + (seasonNo > 9 ? seasonNo.ToString() : ("0" + seasonNo.ToString())) + "x" + (episodeNo > 9 ? episodeNo.ToString() : ("0" + episodeNo.ToString())),
                                Other = ti,
                                Description = episodeName,
                                Thumb = category.Thumb,
                                VideoUrl = episode.GetAttributeValue("rel","")
                            });
                    }
                }
            }
            else
            {
                string data = GetWebData(url, encoding: Encoding.UTF8);
                ITrackingInfo ti = new TrackingInfo() { Title = category.Name, VideoKind = VideoKind.Movie };
                Regex rgx = new Regex(@"http://www.imdb.com/title/(tt[^/]*)");
                Match m = rgx.Match(data);
                if (m.Success)
                {
                    ti.ID_IMDB = m.Groups[1].Value;
                }

                rgx = new Regex(@"<li class=""t\s.*?id=""(?<tabId>[^""]*).*?href=""#"">(?<tabName>[^<]*)");
                foreach(Match tabMatch in rgx.Matches(data))
                {
                    string tabName = tabMatch.Groups["tabName"].Value;
                    string tabId = tabMatch.Groups["tabId"].Value;
                    Regex rgxATab = new Regex(@"<div class=""movbox.*?id=""m" + tabId + @""".*?write\(a\('(?<iframe>[^']*)", RegexOptions.Singleline);
                    Match matchATab = rgxATab.Match(data);
                    if (matchATab.Success)
                    {
                        string videoUrl = GetIframeUrl(matchATab.Groups["iframe"].Value);
                        if (!string.IsNullOrEmpty(videoUrl))
                        {
                            videos.Add(new VideoInfo()
                            {
                                Description = category.Description,
                                Other = ti,
                                Thumb = category.Thumb,
                                Title = category.Name + " - (" + tabName + ")",
                                VideoUrl = videoUrl
                            });
                        }
                    }
                }
            }
            return videos;
        }
 public override ITrackingInfo GetTrackingInfo(VideoInfo video)
 {
     if (Settings.Player == PlayerType.Internal)
     {//tracking
         if(video.Other is Dictionary<string,string>)
         {
             Dictionary<string, string> d = video.Other as Dictionary<string, string>;
             if(d.ContainsKey("tracking"))
             {
                 Regex rgx = new Regex(@"(?<VideoKind>[^\|]*)\|(?<Title>[^\|]*)\|(?<Year>[^\|]*)\|(?<ID_IMDB>[^\|]*)\|(?<Season>[^\|]*)\|(?<Episode>.*)");
                 Match m = rgx.Match(d["tracking"]);
                 ITrackingInfo ti = new TrackingInfo() { Regex = m };
                 return ti;
             }
         }
     }
     return base.GetTrackingInfo(video);
 }
示例#37
0
 public override ITrackingInfo GetTrackingInfo(VideoInfo video)
 {
     Regex rgx = new Regex(@"(?<VideoKind>TvSeries)(?<Title>.*)? [Ss]äsong.*?(?<Season>\d+).*?[Aa]vsnitt.*?(?<Episode>\d+)");
     Match m = rgx.Match("TvSeries" + video.Title);
     ITrackingInfo ti = new TrackingInfo() { Regex = m };
     return ti;
 }
示例#38
0
 public override List<VideoInfo> GetVideos(Category category)
 {
     List<VideoInfo> videos = new List<VideoInfo>();
     JObject json = GetWebData<JObject>((category as RssLink).Url);
     if (json["_embedded"]["sections"] != null)
     {
         json = (JObject)json["_embedded"]["sections"].First(s => s["_meta"]["section_name"].Value<string>() == "videos.latest");
     }
     foreach (JToken v in json["_embedded"]["videos"].Where(v => !v["publishing_status"]["login_required"].Value<bool>()))
     {
         VideoInfo video = new VideoInfo();
         video.Title = v["title"].Value<string>();
         video.SubtitleUrl = "";
         if (v["sami_path"] != null)
             video.SubtitleUrl = v["sami_path"].Value<string>();
         if (string.IsNullOrEmpty(video.SubtitleUrl) && v["subtitles_for_hearing_impaired"] != null)
             video.SubtitleUrl = v["subtitles_for_hearing_impaired"].Value<string>();
         if (string.IsNullOrEmpty(video.SubtitleUrl) && v["subtitles_webvtt"] != null)
             video.SubtitleUrl = v["subtitles_webvtt"].Value<string>();
         video.VideoUrl = v["_links"]["stream"]["href"].Value<string>();
         string desc = "";
         if (v["summary"] != null)
             desc = v["summary"].Value<string>();
         if (v["description"] != null)
             desc += "\r\n" + v["description"].Value<string>();
         video.Description = desc;
         video.Thumb = v["_links"]["image"]["href"].Value<string>().Replace("{size}", "230x150");
         if (v["duration"] != null && !string.IsNullOrEmpty(v["duration"].ToString()) && v["duration"].Value<int>() > 0)
         {
             TimeSpan t = TimeSpan.FromSeconds(v["duration"].Value<int>());
             video.Length = string.Format("{0:D2}:{1:D2}:{2:D2}", t.Hours, t.Minutes, t.Seconds);
         }
         else
         {
             video.Length = "--:--:--";
         }
         if (v["broadcasts"] != null && v["broadcasts"].Count() > 0 && !string.IsNullOrEmpty(v["broadcasts"].First()["air_at"].ToString()))
         {
             try
             {
                 DateTime dt = Convert.ToDateTime(v["broadcasts"].First()["air_at"].Value<string>());
                 video.Airdate = dt.ToString();
             }
             catch { }
         }
         //Extra carefull...
         JToken fp = v["format_position"];
         if (fp != null 
             && !string.IsNullOrEmpty(fp["is_episodic"].ToString())
             && fp["is_episodic"].Value<bool>() 
             && !string.IsNullOrEmpty(fp["season"].ToString()) 
             && !string.IsNullOrEmpty(fp["episode"].ToString())
             )
         {
             uint s = fp["season"].Value<uint>();
             uint e = fp["episode"].Value<uint>();
             if (s > 0 && e > 0)
             {
                 ITrackingInfo ti = new TrackingInfo() { VideoKind = VideoKind.TvSeries, Episode = e, Season = s, Title = v["format_title"].Value<string>() };
                 video.Other = ti;
             }
         }
         videos.Add(video);
     }
     return videos;
 }
        private List<VideoInfo> Videos(string url)
        {
            HtmlDocument doc = GetWebData<HtmlDocument>(url, cookies: GetCookie());
            var divs = doc.DocumentNode.SelectNodes("//div[@class = 'moviefilm']");
            List<VideoInfo> videos = new List<VideoInfo>();
            foreach (var div in divs)
            {
                var a = div.SelectSingleNode("a");
                var img = a.SelectSingleNode("img");
                string title = img.GetAttributeValue("alt", "");
                ITrackingInfo ti = new TrackingInfo();
                //Series
                Regex rgx = new Regex(@"([^S\d+E\d+]*)S(\d+)E(\d+)");
                uint s = 0;
                uint e = 0;
                Match m = rgx.Match(title);
                if (m.Success)
                {
                    ti.Title = m.Groups[1].Value;
                    uint.TryParse(m.Groups[2].Value, out s);
                    ti.Season = s;
                    uint.TryParse(m.Groups[3].Value, out e);
                    ti.Episode = e;
                    ti.VideoKind = VideoKind.TvSeries;
                }
                else
                {
                    //movies
                    rgx = new Regex(@"(.+)\((\d{4})\)");
                    m = rgx.Match(title);
                    uint y = 0;
                    if (m.Success)
                    {
                        ti.Title = m.Groups[1].Value;
                        uint.TryParse(m.Groups[2].Value, out y);
                        ti.Year = y;
                        ti.VideoKind = VideoKind.Movie;
                    }
                }

                videos.Add(new VideoInfo() { Title = title, Thumb = img.GetAttributeValue("src", ""), VideoUrl = a.GetAttributeValue("href", ""), Other = ti });
            }
            var fastphp = doc.DocumentNode.SelectSingleNode("//div[@class = 'fastphp']");
            HtmlNode next = null;
            if (fastphp != null)
                next = fastphp.Descendants("a").FirstOrDefault(a => HttpUtility.HtmlDecode(a.InnerText).Contains("nästa"));
            HasNextPage = next != null;
            if (HasNextPage) nextPageUrl = "http://www.swefilmer.com/" + next.GetAttributeValue("href", "");
            return videos;
        }
示例#40
0
		public int AddTracking(TrackingInfo objTracking)
		{
			return dataProvider.AddTracking(objTracking.ForumId, objTracking.UserId, objTracking.MaxTopicRead, objTracking.MaxPostRead, objTracking.LastAccessedOnDate);
		}
示例#41
0
		public void UpdateTracking(TrackingInfo objTracking)
		{
			dataProvider.UpdateTracking(objTracking.TrackingId, objTracking.ForumId, objTracking.UserId, objTracking.MaxTopicRead, objTracking.MaxPostRead, objTracking.LastAccessedOnDate);
		}
示例#42
0
        private List<VideoInfo> GetVideos()
        {
            List<VideoInfo> videos = new List<VideoInfo>();
            string url = string.Format(currentUrl, currentPage);
            JObject json = GetWebData<JObject>(url, cookies: Cookies);
            if (json["data"] != null && json["data"].Type != JTokenType.Null)
            {
                foreach (JToken episode in json["data"])
                {
                    bool isPremium = episode["content_info"]["package_label"]["value"].Value<string>() == "Premium";
                    if (ShowPremium || !isPremium)
                    {
                        VideoInfo video = new VideoInfo();
                        video.Title = episode["title"].Value<string>();
                        video.Title += isPremium && !HaveCredentials ? " [Premium]" : "";
                        if (episode["video_metadata_longDescription"] != null)
                            video.Description = episode["video_metadata_longDescription"].Value<string>();
                        if (string.IsNullOrEmpty(video.Description) && episode["description"] != null)
                            video.Description = episode["description"].Value<string>();
                        video.Thumb = episode["video_metadata_videoStillURL"].Value<string>();
                        video.VideoUrl = episode["id"].Value<string>();
                        int s = 0;
                        if (episode["season"] != null)
                            int.TryParse(episode["season"].Value<string>(), out s);
                        int e = 0;
                        if (episode["episode"] != null)
                            int.TryParse(episode["episode"].Value<string>(), out e);
                        if (s > 0 && e > 0)
                        {
                            JToken taxonomyItem = episode["taxonomy_items"].FirstOrDefault(taxi => taxi["type"].Value<string>() == "show");
                            if (taxonomyItem != null)
                            {
                                TrackingInfo ti = new TrackingInfo();
                                ti.Episode = (uint)e;
                                ti.Season = (uint)s;
                                ti.Title = taxonomyItem["name"].Value<string>();
                                ti.VideoKind = VideoKind.TvSeries;
                                video.Other = ti;
                            }
                            video.Title = (s + "x") + ((e > 9) ? e.ToString() : "0" + e.ToString()) + " - " + video.Title;
                        }
                        if (episode["video_metadata_first_startTime"] != null)
                        {
                            System.DateTime dt = new DateTime(1970, 1, 1, 0, 0, 0, 0, System.DateTimeKind.Utc);
                            dt = dt.AddSeconds(episode["video_metadata_first_startTime"].Value<long>()).ToLocalTime();
                            video.Airdate = dt.ToString();
                        }
                        if (episode["video_metadata_length"] != null)
                        {
                            long seconds = episode["video_metadata_length"].Value<long>() / 1000;
                            if (seconds > 0)
                                video.Length = OnlineVideos.Helpers.TimeUtils.TimeFromSeconds(seconds.ToString());
                        }

                        videos.Add(video);
                    }
                }
            }
            HasNextPage = false;
            if (json["total_pages"] != null && json["total_pages"].Type != JTokenType.Null)
            {
                int pages = json["total_pages"].Value<int>();
                HasNextPage = currentPage < pages - 1;
            }
            return videos;
        }
示例#43
0
 public static void AddInfo( Mobile tracker, Mobile target )
 {
     TrackingInfo info = new TrackingInfo( tracker, target );
     m_Table[tracker] = info;
 }
        public override ITrackingInfo GetTrackingInfo(VideoInfo video)
        {
            TrackingDetails details = video.Other as TrackingDetails;
            if (details != null)
            {
                TrackingInfo ti = new TrackingInfo() { Title = details.SeriesTitle, VideoKind = VideoKind.TvSeries };
                if (!string.IsNullOrEmpty(details.EpisodeTitle))
                {
                    Match m = Regex.Match(details.EpisodeTitle, @"Series ((?<num>\d+)|(?<alpha>[A-z]+))");
                    if (m.Success)
                    {
                        if (m.Groups["num"].Success)
                            ti.Season = uint.Parse(m.Groups["num"].Value);
                        else
                            ti.Season = (uint)(m.Groups["alpha"].Value[0] % 32); //special case for QI, convert char to position in alphabet
                    }

                    if ((m = Regex.Match(details.EpisodeTitle, @"Episode (\d+)")).Success || (m = Regex.Match(details.EpisodeTitle, @":\s*(\d+)\.")).Success || (m = Regex.Match(details.EpisodeTitle, @"^(\d+)\.")).Success)
                    {
                        ti.Episode = uint.Parse(m.Groups[1].Value);
                        //if we've got an episode number but no season, presume season 1
                        if (ti.Season == 0)
                            ti.Season = 1;
                    }
                }
                Log.Debug("BBCiPlayer: Parsed tracking info: Title '{0}' Season {1} Episode {2}", ti.Title, ti.Season, ti.Episode);
                return ti;
            }
            return base.GetTrackingInfo(video);
        }
示例#45
0
        private List<VideoInfo> GetSeriesVideoList(string url, string data, Category parentCategory)
        {
            List<VideoInfo> videoList = new List<VideoInfo>();
            if (data.Length > 0)
            {
                Match m = regex_ShowVideoList.Match(data);
                while (m.Success)
                {
                    VideoInfo videoInfo = CreateVideoInfo();
                    videoInfo.Title = HttpUtility.HtmlDecode(m.Groups["Title"].Value);
                    // get, format and if needed absolutify the video url
                    videoInfo.VideoUrl = FormatDecodeAbsolutifyUrl(url, m.Groups["VideoUrl"].Value, videoListRegExFormatString, videoListUrlDecoding);

                    string id = m.Groups["id"].Value;
                    TrackingInfo tInfo = new TrackingInfo()
                        {
                            Title = parentCategory.Name,
                            Regex = Regex.Match(id, "s(?<Season>[^e]*)e(?<Episode>.*)"),
                            VideoKind = VideoKind.TvSeries
                        };
                    if (tInfo.Season != 0)
                        videoInfo.Other = tInfo;
                    videoList.Add(videoInfo);

                    m = m.NextMatch();
                }
            }

            return videoList;
        }
示例#46
0
        public static TrackingInfo TrackPackage(string trackingnumber)
        {
            TrackingInfo info = new TrackingInfo();

            string request =
                "<?xml version=\"1.0\" ?>"
                + "<AccessRequest xml:lang='en-US'>"
                    + "<AccessLicenseNumber>????????</AccessLicenseNumber>"
                    + "<UserId>?????????</UserId>"
                    + "<Password>????????</Password>"
                + "</AccessRequest>"
                + "<?xml version=\"1.0\" ?>"
                + "<TrackRequest>"
                    + "<Request>"
                        + "<TransactionReference>"
                            + "<CustomerContext>guidlikesubstance</CustomerContext>"
                        + "</TransactionReference>"
                        + "<RequestAction>Track</RequestAction>"
                    + "</Request>"
                    + "<TrackingNumber>" + trackingnumber + "</TrackingNumber>"
                + "</TrackRequest>";

            //string url = "https://wwwcie.ups.com/ups.app/xml/Track"; // test
            string url = "https://onlinetools.ups.com/ups.app/xml/Track"; // production

            HttpWebRequest req = (HttpWebRequest)WebRequest.Create(url);

            byte[] requestBytes = System.Text.Encoding.ASCII.GetBytes(request);

            req.Method = "POST";
            req.ContentType = "text/xml;charset=utf-8";
            req.ContentLength = requestBytes.Length;

            Stream requestStream = req.GetRequestStream();
            requestStream.Write(requestBytes, 0, requestBytes.Length);
            requestStream.Close();

            HttpWebResponse res = (HttpWebResponse)req.GetResponse();

            XmlDocument doc = new XmlDocument();

            doc.Load(res.GetResponseStream());

            string response = doc.GetValue("/TrackResponse/Response/ResponseStatusCode");

            info.url = "http://wwwapps.ups.com/WebTracking/processInputRequest?TypeOfInquiryNumber=T&loc=en_US&InquiryNumber=" + trackingnumber;
            info.trackingNumber = trackingnumber;

            if (response == "0")
            {

                info.success = false;
                info.errorCode = doc.GetValue("/TrackResponse/Response/Error/ErrorCode");
                info.errorDescription = doc.GetValue("/TrackResponse/Response/Error/ErrorDescription");

            }
            else
            {

                info.success = true;
                info.statusCode = doc.GetValue("/TrackResponse/Shipment/Package/Activity/Status/StatusCode/Code");
                info.status = doc.GetValue("/TrackResponse/Shipment/Package/Activity/Status/StatusType/Description");
                info.service = doc.GetValue("/TrackResponse/Shipment/Service/Description");

                string pickupDate = doc.GetValue("/TrackResponse/Shipment/PickupDate");

                if (!String.IsNullOrEmpty(pickupDate))
                    info.pickedUp = DateTime.TryParse(pickupDate.Substring(4, 2) + "/" + pickupDate.Substring(6, 2) + "/" + pickupDate.Substring(0, 4), out info.pickedupdate);

                info.delivered = (info.status == "DELIVERED");

                if (info.delivered)
                {

                    string deliverDate = doc.GetValue("/TrackResponse/Shipment/Package/Activity/Date");
                    deliverDate = deliverDate.Substring(4, 2) + "/" + deliverDate.Substring(6, 2) + "/" + deliverDate.Substring(0, 4);

                    string deliverTime = doc.GetValue("/TrackResponse/Shipment/Package/Activity/Time");
                    deliverTime = deliverTime.Substring(0, 2) + ":" + deliverTime.Substring(2, 2);

                    DateTime.TryParse(deliverDate + " " + deliverTime, out info.deliveryDate);

                }

                info.shipFromAddress = doc.GetValue("/TrackResponse/Shipment/Shipper/Address/AddressLine1");
                info.shipFromCity = doc.GetValue("/TrackResponse/Shipment/Shipper/Address/StateProvinceCode");
                info.shipFromState = doc.GetValue("/TrackResponse/Shipment/Shipper/Address/StateProvinceCode");
                info.shipFromZip = doc.GetValue("/TrackResponse/Shipment/Shipper/Address/PostalCode");
                info.shipFromCountry = doc.GetValue("/TrackResponse/Shipment/Shipper/Address/CountryCode");

                info.shipToCity = doc.GetValue("/TrackResponse/Shipment/ShipTo/Address/City");
                info.shipToState = doc.GetValue("/TrackResponse/Shipment/ShipTo/Address/StateProvinceCode");
                info.shipToZip = doc.GetValue("/TrackResponse/Shipment/ShipTo/Address/PostalCode");
                info.shipToCountry = doc.GetValue("/TrackResponse/Shipment/ShipTo/Address/CountryCode");

            }

            return info;
        }
        private List<VideoInfo> getOnePageVideoList(Category category, string url)
        {
            currCategory = category;
            nextVideoListPageUrl = null;
            string webData;
            if (category.Other.Equals(Depth.BareList))
            {
                webData = GetWebData(url, cookies: cc, forceUTF8: true);
                webData = Helpers.StringUtils.GetSubString(webData, @"class=""listbig""", @"class=""clear""");
                string[] parts = url.Split(new[] { '/' }, StringSplitOptions.RemoveEmptyEntries);
                if (parts.Length >= 2)
                {
                    if (parts[parts.Length - 1] == "latest")
                        nextVideoListPageUrl = url + "/1";
                    else
                    {
                        int pageNr;
                        if (parts[parts.Length - 2] == "latest" && int.TryParse(parts[parts.Length - 1], out pageNr))
                            if (pageNr + 1 <= 9)
                                nextVideoListPageUrl = url.Substring(0, url.Length - 1) + (pageNr + 1).ToString();
                    }
                }
            }
            else
                webData = url;

            List<VideoInfo> videos = new List<VideoInfo>();
            if (!string.IsNullOrEmpty(webData))
            {
                Match m = regEx_VideoList.Match(webData);
                while (m.Success)
                {
                    VideoInfo video = CreateVideoInfo();

                    video.Title = HttpUtility.HtmlDecode(m.Groups["Title"].Value);
                    video.VideoUrl = m.Groups["VideoUrl"].Value;
                    if (!String.IsNullOrEmpty(video.VideoUrl) && !Uri.IsWellFormedUriString(video.VideoUrl, System.UriKind.Absolute))
                        video.VideoUrl = new Uri(new Uri(baseUrl), video.VideoUrl).AbsoluteUri;
                    video.Airdate = m.Groups["Airdate"].Value;
                    if (video.Airdate == "-")
                        video.Airdate = String.Empty;

                    try
                    {
                        TrackingInfo tInfo = new TrackingInfo()
                        {
                            Regex = Regex.Match(video.Title, @"(?<Title>.+)\s+Seas\.\s*?(?<Season>\d+)\s+Ep\.\s*?(?<Episode>\d+)", RegexOptions.IgnoreCase),
                            VideoKind = VideoKind.TvSeries
                        };

                        if (tInfo.Season == 0 &&
                            category != null && category.ParentCategory != null &&
                            !string.IsNullOrEmpty(category.Name) && !string.IsNullOrEmpty(category.ParentCategory.Name))
                        {
                            // 2nd way - using parent category name, category name and video title 
                            //Aaron Stone Season 1 (19 episodes) 1. Episode 21 1 Hero Rising (1)
                            string parseString = string.Format("{0} {1} {2}", category.ParentCategory.Name, category.Name, video.Title);
                            tInfo.Regex = Regex.Match(parseString, @"(?<Title>.+)\s+Season\s*?(?<Season>\d+).*?Episode\s*?(?<Episode>\d+)", RegexOptions.IgnoreCase);
                        }

                        if (tInfo.Season != 0)
                            video.Other = tInfo;
                    }
                    catch (Exception e)
                    {
                        Log.Warn("Error parsing TrackingInfo data: {0}", e.ToString());
                    }

                    videos.Add(video);
                    m = m.NextMatch();
                }

            }
            return videos;
        }
 public VideoInfoOtherHelper(SouthParkCountry spCountry, TrackingInfo trackingInfo)
 {
     this.SPCountry = spCountry;
     this.TI = trackingInfo;
 }