Laden...

Forenbeiträge von PuppetMaster2k Ingesamt 5 Beiträge

17.04.2014 - 09:22 Uhr

Ich glaube du suchst CTRL+. (Punkt)

Für weitere Shortcuts siehe hier:
Tips and Tricks for Visual Studio
oder hier:
Visual Studio 2013 keyboard shortcuts

14.04.2014 - 13:57 Uhr

Ich hätte folgenden rekursiven Ansatz (als Extension Method):


public static class EnumerableExtension
{
  public static IEnumerable<T> Descendants<T>(this IEnumerable<T> source, Func<T, IEnumerable<T>> descendBy)
  {
    if (!source.Any())
    {
      yield break;
    }

    foreach (T value in source)
    {
      yield return value;

      foreach (T child in descendBy(value).Descendants(descendBy))
      {
        yield return child;
      }
    }
  }
}

//Anwendung
foreach(var node in rootNode.Descendants(n => n.Children))
{
    ...
}

07.04.2014 - 14:23 Uhr

Super! Vielen Dank! Läuft. 😃

07.04.2014 - 14:05 Uhr

Hallo Abt!

Erst mal Danke für die Arbeit, Mühe und das freie zur Verfügung stellen. Auf so eine Bibliothek habe ich gewartet.

Beim meinem ersten Test (dein Beispiel für "Get subfiles") fliegt eine InvalidPathException:

Fehlermeldung:
The directory name is invalid
Path=D:\Downloads\IrgendeinFile.zip

StackTrace:
bei SchwabenCode.QuickIO.Internal.InternalQuickIOCommon.NativeExceptionMapping(String path, Int32 errorCode) in c:_data\SchwabenCode\QuickIO\Dev\QuickIO\Internal\InternalQuickIOCommon.cs:Zeile 147.
bei SchwabenCode.QuickIO.Internal.InternalQuickIO.<EnumerateFiles>d__26.MoveNext() in c:_data\SchwabenCode\QuickIO\Dev\QuickIO\Internal\InternalQuickIO.cs:Zeile 754.
bei SchwabenCode.QuickIO.Internal.InternalQuickIO.<EnumerateFiles>d__26.MoveNext() in c:_data\SchwabenCode\QuickIO\Dev\QuickIO\Internal\InternalQuickIO.cs:Zeile 777.
bei QuickIOTest.Program.Main(String[] args) in d:\Work\QuickIOTest\QuickIOTest\Program.cs:Zeile 16.
bei System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
bei System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
bei Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
bei System.Threading.ThreadHelper.ThreadStart_Context(Object state)
bei System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
bei System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
bei System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
bei System.Threading.ThreadHelper.ThreadStart()

Dieser Fehler tritt nur auf, wenn ich über alle Ordner (SearchOption.AllDirectories) suchen möchte. Lasse ich die Option weg, funktioniert es.

Hier mein Code:


        static void Main(string[] args)
        {
            var result = QuickIO.EnumerateFiles(@"d:\Downloads", SearchOption.AllDirectories);
            foreach (var item in result) // Hier kommt die Exception
            {
                Console.WriteLine(item);
            }
            Console.ReadLine();
        }

Achja, Win 7, VS 2013, .NET 4.5