The situation is next:

I have got the function that get arrays of lognames and logfullname:

void loginsert(string [] lognames, string [] logfullname)
{
        if(logfullname[i].endsWith("txt"))
        {
                auto file = File(logfullname[i], "r");
                foreach (line; file.byLine)
                {
                        // long manupulation with strings
                }
        }

}

But now need add supporting passing to function not only txt files, but also zip archives. The problem that now I see only one way to do adding zip -- add block: if(logfullname[i].endsWith("zip"))
And in it do everything with unpacking content of archive like:

        foreach(ArchiveMember am; zip.directory)
        {
                string file = cast(string)zip.expand(am);
                foreach (line; file.lineSplitter())
                        {
                                
                        }
        }
        
and put inside it some same content that I am doing in "long manupulation with strings".


Maybe there is any better way? But I really can't understand it because auto file = File(logfullname[i], "r"); can't read unpacked content of archive.

Reply via email to