Unity64 Astarpath pathfinding Failure Bug resolution IOS64 Il2cpp-bad date/time format in the zip file

Source: Internet
Author: User

Move the game project to IOS64 above and there is a bug that the auto pathfinding is invalid, there is a hint Astarpath exception in the Xcode console,

Bad date/time format in the zip file

In the code query that is astarpath in the initialization, will read the scene of the pathfinding information file, but due to a parsing time in the Donetzip bug, resulting in an exception, so did not read the scene automatically seek information.

article from podcast Http://blog.csdn.net/huutu article from podcast Http://blog.csdn.net/huutu

We download the source code from Google to DotNetZip, then search the entire project for exception information, navigate to the file Shared.cs article from the podcast Http://blog.csdn.net/huutu

Article from Podcast Http://blog.csdn.net/huutu

Internal static DateTime Packedtodatetime (Int32 packeddatetime) {//WorkItem 7074 & WorkItem 7170  if (packeddatetime = = 0xFFFF | | packeddatetime = = 0) return new System.DateTime (1995, 1, 1, 0, 0,  0, 0);            Return a fixed date when none is supplied.            Int16 packedtime = Unchecked ((Int16) (Packeddatetime & 0x0000ffff));            Int16 packeddate = Unchecked ((Int16) ((Packeddatetime & 0xffff0000) >> 16));            int year = 1980 + ((Packeddate & 0xfe00) >> 9);            int month = (packeddate & 0x01e0) >> 5;            int day = packeddate & 0x001f;            int hour = (Packedtime & 0xf800) >> 11;            int minute = (Packedtime & 0x07e0) >> 5;            int second = packedtime & 0x001f;            int second = (Packedtime & 0x001f) * 2;            Validation and error checking.        This isn't foolproof but would catch most errors.    if (second >=) {minute++; second = 0;}            if (minute >=) {hour++; minute = 0;}            if (hour >=) {day++; hour = 0;}            DateTime d = System.DateTime.Now;            BOOL success= false;                try {d = new System.DateTime (year, month, day, hour, minute, second, 0);            success= true; } catch (System.ArgumentOutOfRangeException) {if (year = = 1980 && (Month = = 0 | | Day = = 0) {try {d = new System.DateTime (198                0, 1, 1, hour, minute, second, 0);                    success= true;                        } catch (System.ArgumentOutOfRangeException) {try                {d = new System.DateTime (1980, 1, 1, 0, 0, 0, 0);                        success= true;             }           catch (System.ArgumentOutOfRangeException) {}}}//WorkItem 8814//My God, I can ' t believe how many different ways applications//can mess up a simpl                E date format.                        else {try {while (Year < 1980) year++;                        while (Year > 2030) year--;                        while (month < 1) month++;                        while (month > month--);                        while (Day < 1) day++;                        while (Day > day--);                        while (minute < 0) minute++;                        while (minute > minute--);                        while (second < 0) second++;                        while (second > second--);                        D = New System.DateTime (year, month, day, hour, minute, second, 0); Success= TRue             } catch (System.ArgumentOutOfRangeException) {}}} if (!success) {String msg = String.Format ("Y ({0}) m ({1}) d ({2}) H ({3}) m ({4}) s ({+ 5})", year, month, day, Hou                R, minute, second); throw new Zipexception (String.Format ("Bad date/time Format in the zip file.            ({0}) ", msg));            }//WorkItem 6191//d = Adjusttime_reverse (d);            D = Datetime.specifykind (d, datetimekind.local);        return D; }
article from podcast Http://blog.csdn.net/huutu
Throw an exception at the end!article from podcast Http://blog.csdn.net/huutu

Article from Podcast Http://blog.csdn.net/huutu

As a zip library, it is natural to read the time information stored in the file, but we use it as a way to read the Astarpath saved, the time data in the zip is of little use to us, so

We do not have to worry about why the exception is thrown, directly return to a time, I will return to the present time! article from podcast Http://blog.csdn.net/huutu

The modified function

        Internal static DateTime Packedtodatetime (Int32 packeddatetime) {return System.DateTime.Now;                WorkItem 7074 & WorkItem 7170 if (packeddatetime = = 0xFFFF | | packeddatetime = = 0)  return new System.DateTime (1995, 1, 1, 0, 0, 0, 0);            Return a fixed date when none is supplied.            Int16 packedtime = Unchecked ((Int16) (Packeddatetime & 0x0000ffff));            Int16 packeddate = Unchecked ((Int16) ((Packeddatetime & 0xffff0000) >> 16));            int year = 1980 + ((Packeddate & 0xfe00) >> 9);            int month = (packeddate & 0x01e0) >> 5;            int day = packeddate & 0x001f;            int hour = (Packedtime & 0xf800) >> 11;            int minute = (Packedtime & 0x07e0) >> 5;            int second = packedtime & 0x001f;            int second = (Packedtime & 0x001f) * 2;            Validation and error checking. This is noT foolproof but would catch most errors.            if (second >=) {minute++; second = 0;}            if (minute >=) {hour++; minute = 0;}            if (hour >=) {day++; hour = 0;}            DateTime d = System.DateTime.Now;            BOOL success= false;                try {d = new System.DateTime (year, month, day, hour, minute, second, 0);            success= true; } catch (System.ArgumentOutOfRangeException) {if (year = = 1980 && (Month = = 0 | | Day = = 0) {try {d = new System.DateTime (198                0, 1, 1, hour, minute, second, 0);                    success= true;                        } catch (System.ArgumentOutOfRangeException) {try                {d = new System.DateTime (1980, 1, 1, 0, 0, 0, 0); Success= true;                } catch (System.ArgumentOutOfRangeException) {}}} WorkItem 8814//My God, I can ' t believe how many different ways applications//can M                ESS up a simple date format.                        else {try {while (Year < 1980) year++;                        while (Year > 2030) year--;                        while (month < 1) month++;                        while (month > month--);                        while (Day < 1) day++;                        while (Day > day--);                        while (minute < 0) minute++;                        while (minute > minute--);                        while (second < 0) second++;                        while (second > second--); D = New System.DateTime (year, month, day, hour, minute, second, 0);                    success= true;             } catch (System.ArgumentOutOfRangeException) {}}} if (!success) {String msg = String.Format ("Y ({0}) m ({1}) d ({2}) H ({3}) m ({4}) s ({+ 5})", year, month, day, Hou                R, minute, second); throw new Zipexception (String.Format ("Bad date/time Format in the zip file.            ({0}) ", msg));            }//WorkItem 6191//d = Adjusttime_reverse (d);            D = Datetime.specifykind (d, datetimekind.local);        return D; }
article from podcast Http://blog.csdn.net/huutu
The following is attached Donetzip project source code and compiled DLL, you can download the source code self-compiled or directly replace the DLL.article from podcast Http://blog.csdn.net/huutu

Article from Podcast Http://blog.csdn.net/huutu

http://download.csdn.net/detail/cp790621656/8481557

article from podcast Http://blog.csdn.net/huutu

Unity64 Astarpath pathfinding Failure Bug resolution IOS64 Il2cpp-bad date/time format in the zip file

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.