Search Results for

    Show / Hide Table of Contents

    Class ResourceIdentifier

    This class contains all the required code for maintaining resource identifiers. It has implicit conversions to and from a string, which makes it much easier to use. It has both static methods that operate on strings, as well as a class that can be manipulated.

    Inheritance
    System.Object
    ResourceIdentifier
    Inherited Members
    System.Object.Equals(System.Object)
    System.Object.Equals(System.Object, System.Object)
    System.Object.GetHashCode()
    System.Object.GetType()
    System.Object.MemberwiseClone()
    System.Object.ReferenceEquals(System.Object, System.Object)
    Namespace: OSGeo.MapGuide.ObjectModels
    Assembly: OSGeo.MapGuide.ObjectModels.dll
    Syntax
    public class ResourceIdentifier

    Constructors

    | Improve this Doc View Source

    ResourceIdentifier(ResourceIdentifier)

    Constructs a new ResourceIdentifier, based on an existing one.

    Declaration
    public ResourceIdentifier(ResourceIdentifier id)
    Parameters
    Type Name Description
    ResourceIdentifier id

    The resource identifier to copy

    | Improve this Doc View Source

    ResourceIdentifier(String)

    Constructs a new ResourceIdentifier with the given full path

    Declaration
    public ResourceIdentifier(string resourceId)
    Parameters
    Type Name Description
    System.String resourceId

    The path of the resource to refence

    | Improve this Doc View Source

    ResourceIdentifier(String, ResourceTypes)

    Constructs a new library based resource identifier

    Declaration
    public ResourceIdentifier(string name, ResourceTypes type)
    Parameters
    Type Name Description
    System.String name

    The name of the resource, may include path information with the "/" character

    ResourceTypes type

    The type of resource the identifier names

    | Improve this Doc View Source

    ResourceIdentifier(String, ResourceTypes, String)

    Constructs a new session based resource identifier

    Declaration
    public ResourceIdentifier(string name, ResourceTypes type, string sessionId)
    Parameters
    Type Name Description
    System.String name

    The name of the resource, may include path information with the "/" character

    ResourceTypes type

    The type of resource the identifier names

    System.String sessionId

    The session id to use

    Properties

    | Improve this Doc View Source

    Extension

    Gets or sets the extension of the resourceId

    Declaration
    public string Extension { get; set; }
    Property Value
    Type Description
    System.String
    | Improve this Doc View Source

    Fullname

    Gets or sets the name and extension of the resource

    Declaration
    public string Fullname { get; set; }
    Property Value
    Type Description
    System.String
    | Improve this Doc View Source

    Fullpath

    Gets the full path of the resource, that is the path without repository information

    Declaration
    public string Fullpath { get; set; }
    Property Value
    Type Description
    System.String
    | Improve this Doc View Source

    IsEmpty

    Gets a value indicating if the resource is blank

    Declaration
    public bool IsEmpty { get; }
    Property Value
    Type Description
    System.Boolean
    | Improve this Doc View Source

    IsFolder

    Gets a value indicating if the resource identifier points to a folder

    Declaration
    public bool IsFolder { get; }
    Property Value
    Type Description
    System.Boolean
    | Improve this Doc View Source

    IsInLibrary

    Gets a value indicating if the resource is in the library repository

    Declaration
    public bool IsInLibrary { get; }
    Property Value
    Type Description
    System.Boolean
    | Improve this Doc View Source

    IsInSessionRepository

    Gets a value indicating if the resource is in the session repository

    Declaration
    public bool IsInSessionRepository { get; }
    Property Value
    Type Description
    System.Boolean
    | Improve this Doc View Source

    IsValid

    Gets a value indicating if the resource identifier is valid

    Declaration
    public bool IsValid { get; }
    Property Value
    Type Description
    System.Boolean
    | Improve this Doc View Source

    Length

    Gets the length of the resource identifier as a string

    Declaration
    public int Length { get; }
    Property Value
    Type Description
    System.Int32
    | Improve this Doc View Source

    Name

    Gets or sets the name of the resource

    Declaration
    public string Name { get; set; }
    Property Value
    Type Description
    System.String
    | Improve this Doc View Source

    ParentFolder

    Gets the containing folder path for the resource, including the repository

    Declaration
    public string ParentFolder { get; }
    Property Value
    Type Description
    System.String
    | Improve this Doc View Source

    Path

    Gets the path of the resource, that is the path without repository information and no extension

    Declaration
    public string Path { get; set; }
    Property Value
    Type Description
    System.String
    | Improve this Doc View Source

    RepositoryPath

    Gets or sets the path to the resource, including the repository

    Declaration
    public string RepositoryPath { get; set; }
    Property Value
    Type Description
    System.String
    | Improve this Doc View Source

    ResourceId

    Gets or sets the full resource identifier

    Declaration
    public string ResourceId { get; set; }
    Property Value
    Type Description
    System.String
    | Improve this Doc View Source

    ResourceType

    Gets the resource type

    Declaration
    public string ResourceType { get; }
    Property Value
    Type Description
    System.String

    Methods

    | Improve this Doc View Source

    ConvertToLibrary()

    Converts this instance to be in the library repository

    Declaration
    public void ConvertToLibrary()
    | Improve this Doc View Source

    ConvertToLibrary(String)

    Converts a resource id to be placed in the library

    Declaration
    public static string ConvertToLibrary(string identifier)
    Parameters
    Type Name Description
    System.String identifier

    The identifier to convert

    Returns
    Type Description
    System.String

    The converted identifier

    | Improve this Doc View Source

    ConvertToSession(String)

    Converts this instance to be in the session repository

    Declaration
    public void ConvertToSession(string sessionId)
    Parameters
    Type Name Description
    System.String sessionId

    The sessionid

    | Improve this Doc View Source

    ConvertToSession(String, String)

    Converts a resource id to be placed in the library

    Declaration
    public static string ConvertToSession(string identifier, string sessionId)
    Parameters
    Type Name Description
    System.String identifier

    The identifier to convert

    System.String sessionId

    The session id of the repository it should be placed in

    Returns
    Type Description
    System.String

    The converted identifier

    | Improve this Doc View Source

    GetFullname(String)

    Gets the name and extension of the identifier

    Declaration
    public static string GetFullname(string identifier)
    Parameters
    Type Name Description
    System.String identifier

    The identifier to extract the information from

    Returns
    Type Description
    System.String

    The full name of the identifier

    | Improve this Doc View Source

    GetFullpath(String)

    Returns the full path of the resource, that is the resourceId without the repository information

    Declaration
    public static string GetFullpath(string identifier)
    Parameters
    Type Name Description
    System.String identifier

    The identifier to get the path from

    Returns
    Type Description
    System.String

    The path of the identifier

    | Improve this Doc View Source

    GetName(String)

    Gets the name of a resource, given its identifier

    Declaration
    public static string GetName(string identifier)
    Parameters
    Type Name Description
    System.String identifier

    The identifier to look for

    Returns
    Type Description
    System.String

    The name of the resource

    | Improve this Doc View Source

    GetParentFolder(String)

    Gets the parent folder.

    Declaration
    public static string GetParentFolder(string identifier)
    Parameters
    Type Name Description
    System.String identifier

    The identifier.

    Returns
    Type Description
    System.String
    | Improve this Doc View Source

    GetPath(String)

    Returns the path of the resource, that is the resourceId without the repository information and extension

    Declaration
    public static string GetPath(string identifier)
    Parameters
    Type Name Description
    System.String identifier

    The identifier to get the path from

    Returns
    Type Description
    System.String

    The path of the identifier

    | Improve this Doc View Source

    GetRepository(String)

    Gets the repository part of a resource identifier, eg.: "Library://" or "Session:xxxx//"

    Declaration
    public static string GetRepository(string identifier)
    Parameters
    Type Name Description
    System.String identifier
    Returns
    Type Description
    System.String
    | Improve this Doc View Source

    GetRepositoryPath(String)

    Returns the path that contains the resource, including the repository

    Declaration
    public static string GetRepositoryPath(string identifier)
    Parameters
    Type Name Description
    System.String identifier

    The resource identifier to use

    Returns
    Type Description
    System.String

    The folder for the identifier

    | Improve this Doc View Source

    GetResourceTypeAsString(String)

    Gets the type of this resource.

    Declaration
    public static string GetResourceTypeAsString(string identifier)
    Parameters
    Type Name Description
    System.String identifier
    Returns
    Type Description
    System.String
    Remarks

    Use this method over OSGeo.MapGuide.MaestroAPI.Resource.ResourceIdentifier.GetResourceType if the Maestro API may not be aware of the new resource type

    | Improve this Doc View Source

    GetSessionID(String)

    Gets the session id from a resource identifier. Must be a valid session-based id, otherwise null is returned

    Declaration
    public static string GetSessionID(string resourceId)
    Parameters
    Type Name Description
    System.String resourceId
    Returns
    Type Description
    System.String
    | Improve this Doc View Source

    IsFolderResource(String)

    Returns a value indicating if the resource points to a folder

    Declaration
    public static bool IsFolderResource(string identifier)
    Parameters
    Type Name Description
    System.String identifier

    The identifier to evaluate

    Returns
    Type Description
    System.Boolean

    A value indicating if the resource points to a folder

    | Improve this Doc View Source

    IsSessionBased(String)

    Determines whether this resource id is session-based

    Declaration
    public static bool IsSessionBased(string resourceID)
    Parameters
    Type Name Description
    System.String resourceID

    The resource ID.

    Returns
    Type Description
    System.Boolean

    true if this resource id is session-based; otherwise, false.

    | Improve this Doc View Source

    Normalize()

    Normalizes the identifier, that is prepends a slash if the identifier points to a folder

    Declaration
    public void Normalize()
    | Improve this Doc View Source

    Normalize(String)

    Normalizes a identifier, that is prepends a slash if it is a folder resource

    Declaration
    public static string Normalize(string identifier)
    Parameters
    Type Name Description
    System.String identifier

    The identifier to normalize

    Returns
    Type Description
    System.String

    The normalized identifier

    | Improve this Doc View Source

    SetExtension(String, String)

    Changes the extension of the given resource

    Declaration
    public static string SetExtension(string identifier, string newextension)
    Parameters
    Type Name Description
    System.String identifier

    The identifier to change the extension for

    System.String newextension

    The new extension to use

    Returns
    Type Description
    System.String

    The renmaed identifier

    | Improve this Doc View Source

    SetName(String, String)

    Sets the name of the resource, with or without the extension

    Declaration
    public static string SetName(string identifier, string newname)
    Parameters
    Type Name Description
    System.String identifier

    The identifier to give a new name

    System.String newname

    The new name to assign

    Returns
    Type Description
    System.String

    The renamed identifier

    | Improve this Doc View Source

    SetPath(String, String)

    Sets the path of the identifier, with or without the extension

    Declaration
    public static string SetPath(string identifier, string newpath)
    Parameters
    Type Name Description
    System.String identifier

    The identifier to update

    System.String newpath

    The new path to user, with or without the extension

    Returns
    Type Description
    System.String

    The new identifier

    | Improve this Doc View Source

    SetRepositoryPath(String, String)

    Sets the path including the repository to the given value

    Declaration
    public static string SetRepositoryPath(string identifier, string folder)
    Parameters
    Type Name Description
    System.String identifier

    The identifier to change the folder for

    System.String folder

    The new folder

    Returns
    Type Description
    System.String

    An identifier in the new folder

    | Improve this Doc View Source

    ToString()

    Returns the full resource id as a string

    Declaration
    public override string ToString()
    Returns
    Type Description
    System.String

    The full resource id as a string

    Overrides
    System.Object.ToString()
    | Improve this Doc View Source

    Validate(String, ResourceTypes)

    Determines if a resource identifier is valid and of the desired type

    Declaration
    public static bool Validate(string identifier, ResourceTypes type)
    Parameters
    Type Name Description
    System.String identifier

    The identifier to validate

    ResourceTypes type

    The type the resource identifer must be

    Returns
    Type Description
    System.Boolean

    A value indicating if the identifier is valid

    | Improve this Doc View Source

    Validate(String, Boolean)

    Determines if a resource identifier is valid

    Declaration
    public static bool Validate(string identifier, bool strict = true)
    Parameters
    Type Name Description
    System.String identifier

    The identifier to validate

    System.Boolean strict

    If true, will check if the type of the resource id is one that is supported by Maestro

    Returns
    Type Description
    System.Boolean

    A value indicating if the identifier is valid

    Operators

    | Improve this Doc View Source

    Implicit(ResourceIdentifier to String)

    Helper operator that makes using the resource identifiers easier

    Declaration
    public static implicit operator string (ResourceIdentifier id)
    Parameters
    Type Name Description
    ResourceIdentifier id

    The id to convert to a string

    Returns
    Type Description
    System.String

    The converted string

    | Improve this Doc View Source

    Implicit(String to ResourceIdentifier)

    Helper operator that makes using the resource identifiers easier

    Declaration
    public static implicit operator ResourceIdentifier(string id)
    Parameters
    Type Name Description
    System.String id

    The id to convert into a resource indetifier class

    Returns
    Type Description
    ResourceIdentifier

    The resource identifier

    • Improve this Doc
    • View Source
    In This Article
    Back to top Copyright © 2009 - 2022 Jackie Ng