Exemplo n.º 1
0
    /// <summary>
    /// Finish the directory listing.
    /// </summary>
    public virtual void close(PhpResource handle = null)
    {
        var res = handle ?? this.handle.AsResource();

        if (res != null)
        {
            PhpDirectory.closedir(res);
        }
        else
        {
            PhpException.InvalidImplicitCast(nameof(handle), PhpResource.PhpTypeName, "close");
        }
    }
Exemplo n.º 2
0
    public string read(PhpResource handle = null)
    {
        var res = handle ?? this.handle.AsResource();

        if (res != null)
        {
            return(PhpDirectory.readdir(res));
        }
        else
        {
            PhpException.InvalidImplicitCast(nameof(handle), PhpResource.PhpTypeName, "read");
            return(null);
        }
    }
Exemplo n.º 3
0
 /// <summary>
 /// Start listing of a directory (intended to be used from C#).
 /// </summary>
 /// <param name="ctx">Runtime context.</param>
 /// <param name="directory">The path to the directory.</param>
 public Directory(Context ctx, string directory)
 {
     this.path   = (PhpValue)directory;
     this.handle = PhpValue.FromClass(PhpDirectory.opendir(ctx, directory));
 }