12 lines
34 KiB
Go
Raw Normal View History

2022-01-15 21:17:38 +00:00
//
// Copyright 2020 FoxyUtils ehf. All rights reserved.
//
// This is a commercial product and requires a license to operate.
// A trial license can be obtained at https://unidoc.io
//
// DO NOT EDIT: generated by unitwist Go source code obfuscator.
//
// Use of this source code is governed by the UniDoc End User License Agreement
// terms that can be accessed at https://unidoc.io/eula/
2023-03-01 18:42:44 +00:00
package mscfb ;import (_g "bytes";_gd "encoding/binary";_e "fmt";_d "github.com/richardlehane/msoleps/types";_bb "github.com/unidoc/unioffice/internal/mscfb/rw";_bf "io";_fa "os";_f "strconv";_a "time";_fe "unicode";_b "unicode/utf16";);func (_fgc *File )FileInfo ()_fa .FileInfo {return fileInfo {_fgc }};func (_ffgf *Reader )Created ()_a .Time {return _ffgf .File [0].Created ()};func (_gfd *Reader )setMiniStream ()error {if _gfd ._dda [0]._ea ==_dcfd ||_gfd ._bad ._aeca ==_dcfd ||_gfd ._bad ._fegf ==0{return nil ;};_edb :=int (_gfd ._bad ._fegf );_gfd ._bad ._egae =make ([]uint32 ,_edb );_gfd ._bad ._egae [0]=_gfd ._bad ._aeca ;for _fge :=1;_fge < _edb ;_fge ++{_acf ,_ggf :=_gfd .findNext (_gfd ._bad ._egae [_fge -1],false );if _ggf !=nil {return Error {ErrFormat ,"s\u0065\u0074\u0074\u0069ng\u0020m\u0069\u006e\u0069\u0020\u0073t\u0072\u0065\u0061\u006d\u0020\u0028"+_ggf .Error ()+"\u0029",int64 (_gfd ._bad ._egae [_fge -1])};};_gfd ._bad ._egae [_fge ]=_acf ;};_edb =int (_gfd ._cfc /4*_gfd ._bad ._fegf );_gfd ._bad ._gbg =make ([]uint32 ,0,_edb );_abff :=_gfd ._dda [0]._ea ;var _becc error ;for _abff !=_dcfd {_gfd ._bad ._gbg =append (_gfd ._bad ._gbg ,_abff );_abff ,_becc =_gfd .findNext (_abff ,false );if _becc !=nil {return Error {ErrFormat ,"s\u0065\u0074\u0074\u0069ng\u0020m\u0069\u006e\u0069\u0020\u0073t\u0072\u0065\u0061\u006d\u0020\u0028"+_becc .Error ()+"\u0029",int64 (_abff )};};};return nil ;};func (_bcf *File )stream (_fbe int )([][2]int64 ,error ){var _degc bool ;var _ggcg int ;var _cea int64 ;if _bcf .Size < _aga {_degc =true ;_ggcg =_fbe /int (_ddfc )+2;_cea =int64 (_ddfc );}else {_ggcg =_fbe /int (_bcf ._be ._cfc )+2;_cea =int64 (_bcf ._be ._cfc );};_bef :=make ([][2]int64 ,0,_ggcg );var _aff ,_ecc int ;if _bcf ._ggc > 0{_fga ,_eed :=_bcf ._be .getOffset (_bcf ._dcg ,_degc );if _eed !=nil {return nil ,_eed ;};if _cea -_bcf ._ggc >=int64 (_fbe ){_bef =append (_bef ,[2]int64 {_fga +_bcf ._ggc ,int64 (_fbe )});}else {_bef =append (_bef ,[2]int64 {_fga +_bcf ._ggc ,_cea -_bcf ._ggc });};if _cea -_bcf ._ggc <=int64 (_fbe ){_bcf ._dcg ,_eed =_bcf ._be .findNext (_bcf ._dcg ,_degc );if _eed !=nil {return nil ,_eed ;};_ecc +=int (_cea -_bcf ._ggc );_bcf ._ggc =0;}else {_bcf ._ggc +=int64 (_fbe );};if _bef [0][1]==int64 (_fbe ){return _bef ,nil ;};if _bcf ._dcg ==_dcfd {return nil ,Error {ErrRead ,"\u0075\u006ee\u0078\u0070\u0065\u0063\u0074\u0065\u0064\u0020\u0065\u0061\u0072\u006c\u0079\u0020\u0065\u006e\u0064\u0020\u006f\u0066\u0020\u0063ha\u0069\u006e",int64 (_bcf ._dcg )};};_aff ++;};for {if _aff >=cap (_bef ){return nil ,Error {ErrRead ,"\u0069\u006e\u0064\u0065x\u0020\u006f\u0076\u0065\u0072\u0072\u0075\u006e\u0073\u0020s\u0065c\u0074\u006f\u0072\u0020\u006c\u0065\u006eg\u0074\u0068",int64 (_aff )};};_dega ,_aeabg :=_bcf ._be .getOffset (_bcf ._dcg ,_degc );if _aeabg !=nil {return nil ,_aeabg ;};if _fbe -_ecc < int (_cea ){_bef =append (_bef ,[2]int64 {_dega ,int64 (_fbe -_ecc )});_bcf ._ggc =int64 (_fbe -_ecc );return _dgc (_bef ),nil ;}else {_bef =append (_bef ,[2]int64 {_dega ,_cea });_ecc +=int (_cea );_bcf ._dcg ,_aeabg =_bcf ._be .findNext (_bcf ._dcg ,_degc );if _aeabg !=nil {return nil ,_aeabg ;};if _ecc ==_fbe {return _dgc (_bef ),nil ;};};_aff ++;};};func (_ddc *File )Modified ()_a .Time {return _ddc ._afa .Time ()};type File struct{Name string ;Initial uint16 ;Path []string ;Size int64 ;_gec int64 ;_dcg uint32 ;_ggc int64 ;*directoryEntryFields ;_be *Reader ;};func (_afc fileInfo )Mode ()_fa .FileMode {return _afc .File .mode ()};func (_cad *File )Created ()_a .Time {return _cad ._de .Time ()};func (_fad *File )Write (b []byte )(int ,error ){if _fad .Size < 1||_fad ._gec >=_fad .Size {return 0,_bf .EOF ;};if _bdc :=_fad .ensureWriterAt ();_bdc !=nil {return 0,_bdc ;};_dab :=len (b );if int64 (_dab )> _fad .Size -_fad ._gec {_dab =int (_fad .Size -_fad ._gec );};_gc ,_aac :=_fad .stream (_dab );if _aac !=nil {return 0,_aac ;};var _eae ,_afd int ;for _ ,_aeab :=range _gc {_ddfg :=_eae +int (_aeab [1]);if _ddfg < _eae ||_ddfg > _dab {return 0,Error {ErrWrite ,"\u0062\u0061d\u0020\u0077\u0072i\u007