Ejemplo n.º 1
0
    private void doLoading(object obp)
    {
        BookPropertySet bp = (BookPropertySet)obp;
        int             rx = 1;
        int             ry = 1;

        Debug.Log("Try to open : " + bp.filename);
        bookHandle = bookEngine.BEIDocViewCreate(bp.filename);
        bookEngine.BEILoadDocument(bookHandle, bp.filename, rx, ry);
        bp.title = Marshal.PtrToStringAnsi(bookEngine.BEIGetTitle(bookHandle));
        if (bp.title == null)
        {
            bp.title = "";
        }
        bp.author = Marshal.PtrToStringAnsi(bookEngine.BEIGetAuthors(bookHandle));
        if (bp.author == null)
        {
            bp.author = "No author";
        }
        if (bp.title == "")
        {
            bp.title = Path.GetFileNameWithoutExtension(bp.filename);
        }
        Debug.Log("Found book " + bp.title + " " + bp.author + " " + bp.filename);
        loading = false;

        // Each book is given a colour to distinguish it. Similar books (same author) get similar colours.
        bp.colour[0] = 0.75f + 0.25f * (float)bp.filename.GetHashCode() / Int32.MaxValue;
        bp.colour[1] = 0.75f + 0.25f * (float)bp.title.GetHashCode() / Int32.MaxValue;
        bp.colour[2] = 0.75f + 0.25f * (float)bp.author.GetHashCode() / Int32.MaxValue;
    }
Ejemplo n.º 2
0
    private void doLoading()
    {
        bookHandle = bookEngine.BEIDocViewCreate(loadingName);
        Debug.Log("Book Handle" + bookHandle);
        bookEngine.BEILoadDocument(bookHandle, loadingName, rx, ry);

        bookEngine.BEIPrepareCover(bookHandle, rx, ry);

        loading = false;
    }
Ejemplo n.º 3
0
    bool BookEngineInterface.BEILoadDocument(IntPtr handle, string fname, int width, int height)
    {
        bool result = false;

        switch (format)
        {
        case BookFormat.coolreader:
            result = cri.BEILoadDocument(handle, fname, width, height);
            break;

        case BookFormat.poppler:
            result = pop.BEILoadDocument(handle, fname, width, height);
            Debug.Log("Load pop " + result + "  " + handle + " " + fname);
            break;
        }
        Debug.Log("Loaded " + result + "  " + handle + " " + fname + " " + format);
        return(result);
    }