private string GetClassName() { int startIndex = VirtualPath.LastIndexOf("/") + 1; int length = VirtualPath.IndexOf(".") - startIndex; string className = VirtualPath.Substring(startIndex, length); return(className); }
public TokenizedSassPath(StyleSheetResult styleResult) { StyleResult = styleResult; VirtualPath = styleResult.Path; Extension = styleResult.Extension.EmptyNull(); FileName = Path.GetFileName(styleResult.Path); FileNameWithoutExtension = FileName.Substring(0, FileName.Length - Extension.Length); Dir = VirtualPath.Substring(0, VirtualPath.Length - FileName.Length); }
/// <summary> /// Gets the virtual path to the resource after applying substitutions based on route data. /// </summary> public string GetSubstitutedVirtualPath(RequestContext requestContext) { string substVirtualPath = VirtualPath.Substring(2); //Trim off ~/ if (!VirtualPath.Contains("{")) { return(substVirtualPath); } Route route = new Route(substVirtualPath, this); VirtualPathData vpd = route.GetVirtualPath(requestContext, requestContext.RouteData.Values); if (vpd == null) { return(substVirtualPath); } return(vpd.VirtualPath); }
/// <summary> /// Generate the code from .apgen file. /// </summary> /// <param name="assemblyBuilder">AssemblyBuilder</param> public override void GenerateCode(AssemblyBuilder assemblyBuilder) { if (!flag && BuildManager.CodeAssemblies != null && getProfileMethodCount > 0) { getProfileMethodCount = 0; flag = true; } string path = Path.Combine( HttpRuntime.AppDomainAppPath, VirtualPath.Substring(HttpRuntime.AppDomainAppVirtualPath.Length + (HttpRuntime.AppDomainAppVirtualPath.Length == 1 ? 0 : 1))); using (TextWriter writer = assemblyBuilder.CreateCodeFile(this)) { APGen gen = APGenManager.OpenGenDocument(path); CodeDomProvider provider = assemblyBuilder.CodeDomProvider; provider.GenerateCodeFromCompileUnit(gen.Generate(), writer, null); writer.Flush(); writer.Close(); } }
public S3File(string virtualPath, S3VirtualPathProvider provider) : base(virtualPath) { this.provider = provider; //Must be inside virtual filesystem folder if (!provider.IsPathVirtual(virtualPath)) { throw new ArgumentException("S3 file path must be located within " + provider.VirtualFilesystemPrefix); } /////////// Parse path into bucket and key //Strip prefix String path = VirtualPath.Substring(provider.VirtualFilesystemPrefix.Length); //strip leading slashes path = path.TrimStart(new char[] { '/', '\\' }); //Now execute filter! path = provider.FilterPath(path); //strip leading slashes again path = path.TrimStart(new char[] { '/', '\\' }); int keyStartsAt = path.IndexOf('/'); if (keyStartsAt < 0) { throw new ArgumentException("S3 file path must specify a bucket" + path); } //Get bucket bucket = path.Substring(0, keyStartsAt); //Get key key = path.Substring(keyStartsAt + 1).TrimStart(new char[] { '/', '\\' }); }