progress
This commit is contained in:
parent
16e76d6b31
commit
484dbfc9d9
529 changed files with 113694 additions and 0 deletions
49
AspClassic.Scripting/FileStreamContentProvider.cs
Normal file
49
AspClassic.Scripting/FileStreamContentProvider.cs
Normal file
|
@ -0,0 +1,49 @@
|
|||
using System;
|
||||
using System.IO;
|
||||
using System.Security.Permissions;
|
||||
|
||||
namespace AspClassic.Scripting;
|
||||
|
||||
[Serializable]
|
||||
internal sealed class FileStreamContentProvider : StreamContentProvider
|
||||
{
|
||||
[Serializable]
|
||||
private class PALHolder : MarshalByRefObject
|
||||
{
|
||||
[NonSerialized]
|
||||
private readonly PlatformAdaptationLayer _pal;
|
||||
|
||||
internal PALHolder(PlatformAdaptationLayer pal)
|
||||
{
|
||||
_pal = pal;
|
||||
}
|
||||
|
||||
internal Stream GetStream(string path)
|
||||
{
|
||||
return _pal.OpenInputFileStream(path);
|
||||
}
|
||||
|
||||
[SecurityPermission(SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.Infrastructure)]
|
||||
public override object InitializeLifetimeService()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private readonly string _path;
|
||||
|
||||
private readonly PALHolder _pal;
|
||||
|
||||
internal string Path => _path;
|
||||
|
||||
internal FileStreamContentProvider(PlatformAdaptationLayer pal, string path)
|
||||
{
|
||||
_path = path;
|
||||
_pal = new PALHolder(pal);
|
||||
}
|
||||
|
||||
public override Stream GetStream()
|
||||
{
|
||||
return _pal.GetStream(Path);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue