public AbsoluteModeTests()
        {
            addressMode = new AbsoluteMode(cpu);

            A.CallTo(() => cpu.Read(ProgramCounter)).Returns(LowAddress);
            A.CallTo(() => cpu.Read(ProgramCounter + 1)).Returns(HighAddress);
        }
Esempio n. 2
0
        public PythonAppConfigFileValue(bool directoryMode, AbsoluteMode allowAbsolute, [CanBeNull] string filter, [CanBeNull] string relativeTo)
        {
            _allowAbsolute = allowAbsolute;
            DirectoryMode  = directoryMode;
            RelativeTo     = relativeTo;

            if (filter == null)
            {
                Filter = DialogFilterPiece.AllFiles;
            }
            else
            {
                var index = filter.IndexOf('|');
                Filter = index == -1 ? new DialogFilterPiece(filter, filter)
                        : new DialogFilterPiece(filter.Substring(0, index), filter.Substring(index + 1));
            }
        }
 public virtual Uri RouteUrl(string routeName, object routeData, AbsoluteMode abMode)
 {
   return RouteUrl(routeName, null, new RouteValueDictionary(routeData), abMode);
 }
 public virtual Uri RouteUrl(string routeName, RouteValueDictionary routeData, AbsoluteMode abMode)
 {
   return RouteUrl(routeName, null, routeData, abMode);
 }
 public virtual Uri RouteUrl(string routeName, AbsoluteMode abMode)
 {
   return RouteUrl(routeName, null, null, abMode);
 }
 public virtual Uri ToUri(RequestContext context, string url, bool secure, AbsoluteMode abMode)
 {
   //make absolute if current scheme doesn't match needed scheme
   //which is typical when switching between http and https
   if (secure && !context.HttpContext.Request.IsSecureConnection)
   {
     return new Uri(ToAbsolute(context, url, true));
   }
   if (abMode == AbsoluteMode.Force) return new Uri(ToAbsolute(context, url, false));
   Uri uri = new Uri(url, UriKind.Relative);
   return uri;
 }
 protected virtual Uri ToUri(string routeName, string url, AbsoluteMode abMode)
 {
   System.Web.Routing.Route r = Routes[routeName] as System.Web.Routing.Route;
   bool secure = false;
   if (r != null && r.DataTokens["Secure"] != null) secure = (bool)r.DataTokens["Secure"];
   return ToUri(Context, url, secure & AppService.Secure, abMode);
 }
    public virtual Uri RouteUrl(string routeName, Id id, RouteValueDictionary routeData, AbsoluteMode abMode)
    {
      if (routeData == null) routeData = new RouteValueDictionary();
      if (id != null)
      {
        if (AppService.ServiceType == ServiceType.MultiFolder)
        {
          routeData["workspace"] = id.Workspace;
        }

        routeData["collection"] = id.Collection;

        //dated resource
        if (id.Date.Length == 10 && AppService.GetCollection(id).Dated)
        {
          routeData["year"] = id.Date.Substring(0, 4);
          routeData["month"] = id.Date.Substring(5, 2);
          routeData["day"] = id.Date.Substring(8, 2);
          if (!routeName.EndsWith("Dated")) routeName = routeName + "Dated";
        }

        if (!string.IsNullOrEmpty(id.EntryPath))
          routeData["path"] = id.EntryPath;
      }

      VirtualPathData path = Routes.GetVirtualPath(Context, routeName, routeData);
      string url = path == null ? string.Empty : path.VirtualPath;
      return ToUri(routeName, url, abMode);
    }
 public virtual Uri RouteUrl(string routeName, Id id, object routeData, AbsoluteMode abMode)
 {
   var dic = routeData == null ? new RouteValueDictionary() :
     routeData is RouteValueDictionary ? (RouteValueDictionary)routeData :
     new RouteValueDictionary(routeData);
   return RouteUrl(routeName, id, dic, abMode);
 }
 public static string RouteUrlEx(this UrlHelper helper, string routeName, AbsoluteMode abMode)
 {
   return RouteUriEx(helper, routeName, abMode).ToString();
 }
 /// <summary>
 /// Gets a route url using the correct route service.
 /// </summary>
 /// <param name="helper"></param>
 /// <param name="routeName">Name of the route.</param>
 /// <param name="forceAbsolute">Forces full url path.</param>
 /// <returns></returns>
 public static Uri RouteUriEx(this UrlHelper helper, string routeName, AbsoluteMode abMode)
 {
   return helper.GetRouteService(routeName).RouteUrl(routeName, abMode);
 }
 public static string RouteIdUrl(this UrlHelper helper, string routeName, Id id, object routeData, AbsoluteMode abMode)
 {
   return RouteIdUri(helper, routeName, id, routeData, abMode).ToString();
 }
 /// <summary>
 /// Route's to collection, entry, or media given the id.
 /// </summary>
 /// <param name="helper"></param>
 /// <param name="routeName">Name of the route.</param>
 /// <param name="id">Id of the resource.</param>
 /// <param name="routeData">The data for the route.</param>
 /// <returns></returns>
 public static Uri RouteIdUri(this UrlHelper helper, string routeName, Id id, object routeData, AbsoluteMode abMode)
 {
   return helper.GetRouteService(routeName).RouteUrl(routeName, id, routeData, abMode);
 }
 public static IEnumerable<AtomLink> GetPagingLinks(this UrlHelper helper, string routeName, Id id, RouteValueDictionary routeData, int total, int pageIndex, int pageSize, string contentType, AbsoluteMode mode)
 {
   int lastIndex = (int)Math.Ceiling((double)total / (double)pageSize) - 1;
   List<AtomLink> links = new List<AtomLink>();
   links.Add(new AtomLink { Href = helper.RouteIdUri(routeName, id, GetPageRouteData(0), mode), Rel = "first", Type = contentType });
   links.Add(new AtomLink { Href = helper.RouteIdUri(routeName, id, GetPageRouteData(lastIndex), mode), Rel = "last", Type = contentType });
   if (pageIndex > 0)
     links.Add(new AtomLink { Href = helper.RouteIdUri(routeName, id, GetPageRouteData(pageIndex - 1), mode), Rel = "previous", Type = contentType });
   if (pageIndex < lastIndex)
     links.Add(new AtomLink { Href = helper.RouteIdUri(routeName, id, GetPageRouteData(pageIndex + 1), mode), Rel = "next", Type = contentType });
   return links;
 }