mirror of
https://github.com/Ryujinx/GtkSharp.git
synced 2024-12-23 15:15:34 +00:00
gio: Make FileEnumerator implement IEnumerable<FileInfo>
This commit is contained in:
parent
c312fb739c
commit
24b0e12c62
|
@ -21,34 +21,47 @@
|
|||
namespace GLib {
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
|
||||
public partial class FileEnumerator {
|
||||
public IEnumerator GetEnumerator ()
|
||||
public partial class FileEnumerator : IEnumerable<FileInfo> {
|
||||
public IEnumerator<FileInfo> GetEnumerator ()
|
||||
{
|
||||
return new Enumerator (this);
|
||||
}
|
||||
|
||||
|
||||
IEnumerator IEnumerable.GetEnumerator ()
|
||||
{
|
||||
return GetEnumerator ();
|
||||
}
|
||||
|
||||
public FileInfo NextFile ()
|
||||
{
|
||||
return NextFile ((Cancellable) null);
|
||||
}
|
||||
|
||||
class Enumerator : IEnumerator
|
||||
|
||||
class Enumerator : IEnumerator<FileInfo>
|
||||
{
|
||||
FileEnumerator file_enumerator;
|
||||
|
||||
|
||||
public Enumerator (FileEnumerator file_enumerator)
|
||||
{
|
||||
this.file_enumerator = file_enumerator;
|
||||
}
|
||||
|
||||
FileInfo current=null;
|
||||
public object Current {
|
||||
|
||||
void IDisposable.Dispose() { }
|
||||
|
||||
FileInfo current;
|
||||
public FileInfo Current {
|
||||
get {
|
||||
return current;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
object IEnumerator.Current
|
||||
{
|
||||
get { return Current; }
|
||||
}
|
||||
|
||||
public bool MoveNext ()
|
||||
{
|
||||
current = file_enumerator.NextFile ();
|
||||
|
|
|
@ -37,7 +37,6 @@
|
|||
<attr path="/api/namespace/interface[@cname='GTlsServerConnection']/property[@cname='authentication-mode']" name="hidden">1</attr>
|
||||
<attr path="/api/namespace/interface[@cname='GVolume']" name="consume_only">1</attr>
|
||||
<attr path="/api/namespace/interface[@cname='GVolume']/method[@name='GetMount']" name="name">GetMountInstance</attr>
|
||||
<add-node path="/api/namespace/object[@cname='GFileEnumerator']"><implements><interface name="IEnumerable" /></implements></add-node>
|
||||
<attr path="/api/namespace/object[@cname='GApplication']/signal[@cname='activate']" name="name">Activated</attr>
|
||||
<attr path="/api/namespace/object[@cname='GApplication']/signal[@cname='open']" name="name">Opened</attr>
|
||||
<attr path="/api/namespace/object[@cname='GDBusAuthObserver']/signal[@cname='authorize-authenticated-peer']" name="name">AuthenticatedPeerAuthorized</attr>
|
||||
|
|
Loading…
Reference in a new issue