UserResource Class | 
Namespace: Demo3D.Visuals
[SerializableAttribute] public class UserResource
The UserResource type exposes the following members.
| Name | Description | |
|---|---|---|
| UserResource | 
            Initializes a new instance of the UserResource class.
              | 
| Name | Description | |
|---|---|---|
| Created | 
            Gets the time at which this resource was created (not when the original file was created).
              | |
| LocalPath | 
            Gets or sets the name and path of this user resource, relative to the UserResources directory.
            Never set this property directly, always go through UserResourceLibrary.RenameFile.
              | |
| Persistence | 
            Gets or sets a value indicating whether this UserResource will remain in a UserResourceLibrary even when it's not referenced.
              | |
| SourcePath | 
            Gets the original path of the file.
              | 
| Name | Description | |
|---|---|---|
| GetInputStream | 
            Gets a Stream object which can be used to read the contents of the file.
              | |
| HasSameContent | 
            Checks whether the content of this UserResource matches the content of another UserResource instance.
              | 
[Auto] CustomPropertyValue<UserResourceReference> Data; [Auto] void OnReset(BoxVisual sender) { if (!sender.HasProperty("Data")) return; var ur = document.FindUserResource(this.Data); var localFile = WriteUserResourceToTemporaryFile( ur ); if (localFile == "") return; var dataTable = Demo3D.Utilities.DataSourceImporter.ReadDataTableFromTextFile( localFile ); File.Delete( localFile ); foreach (var colName in dataTable.Columns) { print(colName); } } string WriteUserResourceToTemporaryFile(UserResource ur) { if (ur == null) return ""; var ins = ur.GetInputStream(null); var len = ins.Length; var bytes = new byte[len]; ins.ReadExactly(bytes); var tmpFile = Path.Combine( Path.GetTempPath(), Path.GetFileName(ur.LocalPath) ); File.WriteAllBytes( tmpFile, bytes ); return tmpFile; }