mirror of
https://github.com/Ryujinx/GtkSharp.git
synced 2024-12-23 19:05:28 +00:00
gio: Make FileEnumerator implement IEnumerable<FileInfo>
This commit is contained in:
parent
c312fb739c
commit
24b0e12c62
|
@ -21,19 +21,25 @@
|
|||
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;
|
||||
|
||||
|
@ -42,13 +48,20 @@ namespace GLib {
|
|||
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