Code Monkey home page Code Monkey logo

Comments (7)

benchen71 avatar benchen71 commented on September 1, 2024

Actually, now that I look more closely, the date modified for the problem file is originally 1980-01-01 07:00 (in the original EPUB). But the date modified of the unpacked file, the one that zipstorer is later crashing on when it tries to save it, is 31/12/2107 11:00 PM.

So now I see that the problem might be being caused by the open process, which would mean DosTimeToDateTime is not handling the original date modified.

from zipstorer.

benchen71 avatar benchen71 commented on September 1, 2024

For an example, see the "mimetype" file in the following:

Lewis - 4. The Silver Chair.zip

from zipstorer.

jaime-olivares avatar jaime-olivares commented on September 1, 2024

Hi, I see 2107 in all messages, rather than 2017.
is this a typo?

from zipstorer.

benchen71 avatar benchen71 commented on September 1, 2024

No it's not a typo. As far as I can tell, the open process takes the original file date 1980-01-01 07:00 and gives the unpacked file a date of 31/12/2107 11:00 PM. Then when my program later tries to save the zip file, zipstorer crashes.

from zipstorer.

benchen71 avatar benchen71 commented on September 1, 2024

I have implemented a work-around. The function DosTimeToDateTime in the zipstorer.vb now looks like this:

    Private Function DosTimeToDateTime(ByVal _dt As UInteger) As DateTime
        Dim year As Integer = CType(_dt >> 25, Integer) + 1980
        Dim month As Integer = CType(_dt >> 21, Integer) And 15
        Dim day As Integer = CType(_dt >> 16, Integer) And 31
        Dim hours As Integer = CType(_dt >> 11, Integer) And 31
        Dim minutes As Integer = CType(_dt >> 5, Integer) And 63
        Dim seconds As Integer = CType(_dt And 31, Integer) * 2

        If ((year >= 2107) Or (month = 0) Or (day = 0)) Then Return DateTime.Now

        Return New DateTime(year, month, day, hours, minutes, seconds)
    End Function

It's a bit of a fudge, but at least it prevents the exception error!

from zipstorer.

jaime-olivares avatar jaime-olivares commented on September 1, 2024

Solved by reading the NTFS FileTime extra info.

from zipstorer.

benchen71 avatar benchen71 commented on September 1, 2024

Thanks for this.

I've incorporated your changes into my program, converting them into vb.net in the process, and will do some testing. But initial tests look good!

from zipstorer.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.