Ejemplo n.º 1
0
        public void Load( BookItem b, bool useCache = false )
        {
            CurrentBook = b;

            if( b.IsLocal )
            {
                OnComplete( b );
                return;
            }

            if ( b is BookInstruction )
            {
                LoadInstruction( ( BookInstruction ) b, useCache );
                return;
            }

            string id = b.Id;
            string Mode = X.Const<string>( XProto.WProtocols, "ACTION_BOOK_INFO" );

            if( CurrentBook.XTest( XProto.BookItemEx ) )
            {
                Mode = CurrentBook.XField<string>( "Mode" );
            }

            XKey[] ReqKeys = X.Call<XKey[]>( XProto.WRequest, "DoBookAction", Mode, id );
            if ( useCache )
            {
                string cacheName = X.Call<string>( XProto.WRuntimeCache, "GetCacheString", new object[] { ReqKeys } );
                if ( Shared.Storage.FileExists( FileLinks.ROOT_CACHE + cacheName ) )
                {
                    ExtractBookInfo( Shared.Storage.GetString( FileLinks.ROOT_CACHE + cacheName ), id );
                    return;
                }
            }

            X.Instance<IRuntimeCache>( XProto.WRuntimeCache )
                .InitDownload( id, ReqKeys, PrelaodBookInfo, PrelaodBookInfo, true );
        }