Skip to main content

SalResource

Namespace: PPJ.Runtime

Assembly: PPJ.Runtime.50 (5.0.0.0)

Provides resource-name resolution and a common image-loading contract for SAL resources.

public class SalResource

Derived classes load icons, bitmaps, or cursors from embedded assembly resources. Resolution first checks the supplied assembly and then the existing manifest-resource cache.

Example:

using PPJ.Runtime;

SalResource resource = new SalResourceImage("Logo.png");
object image = resource.GetImage();

Constructors

Instance member SalResource(name, asm)

Resolves an embedded resource using an assembly as the first search location.

NameTypeDescription
nameStringThe full manifest name or resource-name suffix. Must not be null.
asmAssemblyThe assembly to search first, or null to search the existing assembly-resource cache.

A missing resource leaves Name null and is logged; it does not cause this constructor to fail. Throws:

Properties

Instance member Name

String: Gets the resolved manifest resource name.

Methods

Static member FromName(name)

Finds a SAL resource exposed by a resource-container field.

ParameterTypeDescription
nameStringThe resource field name, optionally qualified by its container type and assembly.

Returns: SalResource. The resource instance, or null for an empty name or when no matching resource is found.

Uses cached resolutions first. Otherwise, searches public fields of the requested type, or Res and Resources types in loaded PPJ-linked assemblies.

Instance member GetImage()

Loads the graphic represented by this resource.

Returns: Object. The graphic supplied by the concrete resource type, or null if loading fails.

The concrete type determines the returned object type and caching behavior.

Instance member GetStream()

Opens a stream for the resolved manifest resource.

Returns: Stream. The resource stream. The caller is responsible for disposing it.

Throws:

  • Exception The resource has not been resolved or its stream cannot be obtained.