Autor Beitrag
lodibach
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 18



BeitragVerfasst: Do 29.04.10 15:28 
Hallo,
ich habe ein Problem. Ich möchte eine rekursive Schleife programmieren, die alle .mp3 Dateien in einem Ordner (auch in dessen Unterordner) zählt. Meine Schleife steht auch schon & läuft soweit, doch ich weiß nicht wie ich den meine Variable speichern soll.

+
ausblenden C#-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
FileInfo oFile = new FileInfo(sDateien[iFileindex]);
int iMP3Count = 0;
MigrateUtils.CUtils.GetMP3Count(new DirectoryInfo(sEingabeordner), iMP3Count);

        public static int GetMP3Count(FileSystemInfo oFileSystemInfo, int iMP3Count)
        {
            var oDirInfo = oFileSystemInfo as DirectoryInfo;
            
            if (oDirInfo != null)
            {
                foreach (var oDirEntry in oDirInfo.GetFileSystemInfos())
                {
                    GetMP3Count(oDirEntry, iMP3Count);
                }
            }
            else
            {
                if (oFileSystemInfo.Name.EndsWith(".MP3"truenull))
                {
                    iMP3Count += 1;
                }
            }
            
            return iMP3Count;
        } // GetMP3Count


+
bei dem dick geschriebenen setzt sich mein Wert immer wieder zurück. Was muss ich ändern?

Moderiert von user profile iconChristian S.: C#-Tags hinzugefügt
danielf
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 1012
Erhaltene Danke: 24

Windows XP
C#, Visual Studio
BeitragVerfasst: Do 29.04.10 15:32 
Ist das ein Test?
Kha
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 3803
Erhaltene Danke: 176

Arch Linux
Python, C, C++ (vim)
BeitragVerfasst: Do 29.04.10 16:57 
Kommt mir ein wenig bekannt vor :gruebel: ... hier geht's weiter.

_________________
>λ=
Dieses Thema ist gesperrt, Du kannst keine Beiträge editieren oder beantworten.

Das Thema wurde von einem Team-Mitglied geschlossen. Wenn du mit der Schließung des Themas nicht einverstanden bist, kontaktiere bitte das Team.