├── README.md ├── alert.c ├── confirm.c ├── icons.h ├── mkfile ├── theme.c ├── theme.h ├── vdir.c └── vdir.png /README.md: -------------------------------------------------------------------------------- 1 | vdir 2 | ===== 3 | A minimalistic visual directory browser for Plan 9. 4 | 5 | ![vdir](vdir.png) 6 | 7 | Actions are performed using the right mouse button: 8 | - Home: go to current user's home directory 9 | - Open: present an entry to jump to a given directory 10 | - Up : go to the parent directory 11 | - New dir : present an entry to create a new directory 12 | - New file: present an entry to create a new empty file 13 | 14 | Middle-clicking on a file or folder will present a file operations menu. 15 | Right-clicking on the path (in the toolbar), plumbs the path name 16 | Right-clicking on folders, opens them. 17 | Right-clicking on files send them to the plumber. 18 | 19 | Keyboard shortcuts are: 20 | - Page up / Page down to scroll 21 | - Home to go to $home 22 | - Up arrow to go to parent directory 23 | - Space to plumb current directory path 24 | - q / Del to quit 25 | 26 | Usage: 27 | ------ 28 | Install with the usual ``mk install`` 29 | Run ``vdir [-r] [directory]`` 30 | If the `-r` flag is passed, delete will recursively delete directories. 31 | 32 | Path plumbing: 33 | -------------- 34 | When right-clicking the path in the toolbar, or pressing Space, the 35 | path name is sent to plumber. This can be used to open a window in 36 | the directory for instance: 37 | 38 | ``` 39 | src is vdir 40 | type is text 41 | arg isdir $data 42 | plumb start window -cd $data rc 43 | ``` 44 | 45 | In addition, a plumb rule can be installed so that plumbing a 46 | directory will change the current path of a running vdir: 47 | 48 | ``` 49 | type is text 50 | arg isdir $data 51 | plumb to vdir 52 | plumb client window vdir 53 | ``` 54 | 55 | Disclaimer: 56 | ----------- 57 | This was a quick and dirty hack that sure contains some bugs. 58 | Enjoy anyway :) 59 | -------------------------------------------------------------------------------- /alert.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | enum { Padding = 12, }; 9 | 10 | int 11 | max(int a, int b) 12 | { 13 | return a>b ? a : b; 14 | } 15 | 16 | void 17 | alert(const char *message, const char *err, Mousectl *mctl, Keyboardctl *kctl) 18 | { 19 | Alt alts[3]; 20 | Rectangle r, sc; 21 | Point o, p; 22 | Image *b, *save, *bg, *fg; 23 | int done, h, w, mw, ew; 24 | Mouse m; 25 | Rune k; 26 | 27 | alts[0].op = CHANRCV; 28 | alts[0].c = mctl->c; 29 | alts[0].v = &m; 30 | alts[1].op = CHANRCV; 31 | alts[1].c = kctl->c; 32 | alts[1].v = &k; 33 | alts[2].op = CHANEND; 34 | alts[2].c = nil; 35 | alts[2].v = nil; 36 | while(nbrecv(kctl->c, nil)==1) 37 | ; 38 | bg = allocimage(display, Rect(0,0,1,1), screen->chan, 1, 0xf8d7daff); 39 | fg = allocimage(display, Rect(0,0,1,1), screen->chan, 1, 0x721c24ff); 40 | done = 0; 41 | save = nil; 42 | h = Padding+font->height+Padding; 43 | if(err != nil) 44 | h += font->height; 45 | mw = stringwidth(font, message); 46 | ew = err != nil ? stringwidth(font, err) : 0; 47 | w = Padding+max(mw, ew)+Padding; 48 | b = screen; 49 | sc = b->clipr; 50 | replclipr(b, 0, b->r); 51 | while(!done){ 52 | o = addpt(screen->r.min, Pt((Dx(screen->r)-w)/2, (Dy(screen->r)-h)/2)); 53 | r = Rect(o.x, o.y, o.x+w, o.y+h); 54 | if(save==nil){ 55 | save = allocimage(display, r, b->chan, 0, DNofill); 56 | if(save==nil) 57 | break; 58 | draw(save, r, b, nil, r.min); 59 | } 60 | draw(b, r, bg, nil, ZP); 61 | border(b, r, 2, fg, ZP); 62 | p = addpt(o, Pt(Padding, Padding)); 63 | string(b, p, fg, ZP, font, message); 64 | if(err != nil){ 65 | p.x = o.x + Padding; 66 | p.y += font->height; 67 | string(b, p, fg, ZP, font, err); 68 | } 69 | flushimage(display, 1); 70 | if(b!=screen || !eqrect(screen->clipr, sc)){ 71 | freeimage(save); 72 | save = nil; 73 | } 74 | b = screen; 75 | sc = b->clipr; 76 | replclipr(b, 0, b->r); 77 | switch(alt(alts)){ 78 | default: 79 | continue; 80 | break; 81 | case 1: 82 | done = (k=='\n' || k==Kesc); 83 | break; 84 | case 0: 85 | done = m.buttons&1 && ptinrect(m.xy, r); 86 | break; 87 | } 88 | if(save){ 89 | draw(b, save->r, save, nil, save->r.min); 90 | freeimage(save); 91 | save = nil; 92 | } 93 | 94 | } 95 | replclipr(b, 0, sc); 96 | freeimage(bg); 97 | freeimage(fg); 98 | } 99 | -------------------------------------------------------------------------------- /confirm.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | enum { Padding = 12, }; 9 | 10 | int 11 | confirm(const char *message, Mousectl *mctl, Keyboardctl *kctl, Image *bg, Image *fg, Image *hi) 12 | { 13 | Alt alts[3]; 14 | Rectangle r, sc; 15 | Point o, p; 16 | Image *b, *save; 17 | int done, rc, h, w; 18 | Mouse m; 19 | Rune k; 20 | 21 | alts[0].op = CHANRCV; 22 | alts[0].c = mctl->c; 23 | alts[0].v = &m; 24 | alts[1].op = CHANRCV; 25 | alts[1].c = kctl->c; 26 | alts[1].v = &k; 27 | alts[2].op = CHANEND; 28 | alts[2].c = nil; 29 | alts[2].v = nil; 30 | while(nbrecv(kctl->c, nil)==1) 31 | ; 32 | done = 0; 33 | rc = 0; 34 | save = nil; 35 | h = Padding+font->height+Padding; 36 | w = Padding+stringwidth(font, message)+stringwidth(font, " Yes / No")+Padding; 37 | b = screen; 38 | sc = b->clipr; 39 | replclipr(b, 0, b->r); 40 | while(!done){ 41 | o = addpt(screen->r.min, Pt((Dx(screen->r)-w)/2, (Dy(screen->r)-h)/2)); 42 | r = Rect(o.x, o.y, o.x+w, o.y+h); 43 | if(save==nil){ 44 | save = allocimage(display, r, b->chan, 0, DNofill); 45 | if(save==nil) 46 | break; 47 | draw(save, r, b, nil, r.min); 48 | } 49 | draw(b, r, bg, nil, ZP); 50 | border(b, r, 2, hi, ZP); 51 | p = addpt(o, Pt(Padding, Padding)); 52 | p = string(b, p, fg, ZP, font, message); 53 | p = string(b, p, hi, ZP, font, " Y"); 54 | p = string(b, p, fg, ZP, font, "es /"); 55 | p = string(b, p, hi, ZP, font, " N"); 56 | string(b, p, fg, ZP, font, "o"); 57 | flushimage(display, 1); 58 | if(b!=screen || !eqrect(screen->clipr, sc)){ 59 | freeimage(save); 60 | save = nil; 61 | } 62 | b = screen; 63 | sc = b->clipr; 64 | replclipr(b, 0, b->r); 65 | switch(alt(alts)){ 66 | default: 67 | continue; 68 | break; 69 | case 1: 70 | if(k=='\n' || k==Kesc || k=='n' || k=='N'){ 71 | done = 1; 72 | rc = 0; 73 | }else if(k=='y' || k=='Y'){ 74 | done = 1; 75 | rc = 1; 76 | } 77 | break; 78 | case 0: 79 | done = m.buttons&1 && ptinrect(m.xy, r); 80 | rc = 0; 81 | break; 82 | } 83 | if(save){ 84 | draw(b, save->r, save, nil, save->r.min); 85 | freeimage(save); 86 | save = nil; 87 | } 88 | 89 | } 90 | replclipr(b, 0, sc); 91 | return rc; 92 | } 93 | -------------------------------------------------------------------------------- /icons.h: -------------------------------------------------------------------------------- 1 | /* -*- c -*- */ 2 | uchar homedata[] = { 3 | 0x00, 0x00, 0x00, 0x00, 4 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 5 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 6 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 7 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 8 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 9 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2e, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 10 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x4a, 0x00, 0x00, 0x00, 11 | 0x2e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 12 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 13 | 0x00, 0x00, 0x00, 0x00, 0x6e, 0x00, 0x00, 0x00, 0xfb, 0x00, 0x00, 0x00, 0xfd, 0x00, 0x00, 0x00, 14 | 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xd5, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 15 | 0xb3, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 16 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 17 | 0x9b, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xc5, 0x00, 0x00, 0x00, 0xc5, 0x00, 0x00, 0x00, 18 | 0xff, 0x00, 0x00, 0x00, 0x9b, 0x00, 0x00, 0x00, 0xdb, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 19 | 0xb3, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 20 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0xbf, 0x00, 0x00, 0x00, 21 | 0xff, 0x00, 0x00, 0x00, 0xa3, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 22 | 0xa1, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 23 | 0xb3, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 24 | 0x00, 0x00, 0x00, 0x00, 0x2a, 0x00, 0x00, 0x00, 0xdb, 0x00, 0x00, 0x00, 0xfd, 0x00, 0x00, 0x00, 25 | 0x7a, 0x00, 0x00, 0x00, 0x85, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 26 | 0x87, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, 0xfd, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 27 | 0xb3, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 28 | 0x48, 0x00, 0x00, 0x00, 0xf1, 0x00, 0x00, 0x00, 0xf3, 0x00, 0x00, 0x00, 0x5c, 0x00, 0x00, 0x00, 29 | 0xb1, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 30 | 0xff, 0x00, 0x00, 0x00, 0xb1, 0x00, 0x00, 0x00, 0x5a, 0x00, 0x00, 0x00, 0xf3, 0x00, 0x00, 0x00, 31 | 0xf1, 0x00, 0x00, 0x00, 0x4a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6e, 0x00, 0x00, 0x00, 32 | 0xfb, 0x00, 0x00, 0x00, 0xe1, 0x00, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, 0xd1, 0x00, 0x00, 0x00, 33 | 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 34 | 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xd3, 0x00, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, 35 | 0xdf, 0x00, 0x00, 0x00, 0xfb, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00, 0xb7, 0x00, 0x00, 0x00, 36 | 0xc7, 0x00, 0x00, 0x00, 0x54, 0x00, 0x00, 0x00, 0xeb, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 37 | 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 38 | 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xeb, 0x00, 0x00, 0x00, 39 | 0x56, 0x00, 0x00, 0x00, 0xc5, 0x00, 0x00, 0x00, 0xb9, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 40 | 0x06, 0x00, 0x00, 0x00, 0xb1, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 41 | 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 42 | 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 43 | 0xb3, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 44 | 0x00, 0x00, 0x00, 0x00, 0xb1, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 45 | 0xff, 0x00, 0x00, 0x00, 0xe3, 0x00, 0x00, 0x00, 0x93, 0x00, 0x00, 0x00, 0x93, 0x00, 0x00, 0x00, 46 | 0xe3, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 47 | 0xb3, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 48 | 0x00, 0x00, 0x00, 0x00, 0xb1, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 49 | 0xff, 0x00, 0x00, 0x00, 0xbd, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 50 | 0xbb, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 51 | 0xb3, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 52 | 0x00, 0x00, 0x00, 0x00, 0xb1, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 53 | 0xff, 0x00, 0x00, 0x00, 0xbd, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 54 | 0xbb, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 55 | 0xb3, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 56 | 0x00, 0x00, 0x00, 0x00, 0xb1, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 57 | 0xff, 0x00, 0x00, 0x00, 0xbd, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 58 | 0xbb, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 59 | 0xb3, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 60 | 0x00, 0x00, 0x00, 0x00, 0x2c, 0x00, 0x00, 0x00, 0x58, 0x00, 0x00, 0x00, 0x58, 0x00, 0x00, 0x00, 61 | 0x58, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 62 | 0x40, 0x00, 0x00, 0x00, 0x58, 0x00, 0x00, 0x00, 0x58, 0x00, 0x00, 0x00, 0x58, 0x00, 0x00, 0x00, 63 | 0x2c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 64 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 65 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 66 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 67 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 68 | }; 69 | 70 | uchar cddata[] = { 71 | 0x00, 0x00, 0x00, 0x00, 72 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 73 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 74 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 75 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 76 | 0x0a, 0x00, 0x00, 0x00, 0x16, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 77 | 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 78 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 79 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6a, 0x00, 0x00, 0x00, 80 | 0xfb, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 81 | 0xef, 0x00, 0x00, 0x00, 0x42, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 82 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 83 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xed, 0x00, 0x00, 0x00, 84 | 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 85 | 0xff, 0x00, 0x00, 0x00, 0xcb, 0x00, 0x00, 0x00, 0x44, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 86 | 0x40, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 87 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf3, 0x00, 0x00, 0x00, 88 | 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 89 | 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 90 | 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xef, 0x00, 0x00, 0x00, 91 | 0x2a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf5, 0x00, 0x00, 0x00, 92 | 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 93 | 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 94 | 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 95 | 0xb3, 0x00, 0x00, 0x00, 0x64, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0xf5, 0x00, 0x00, 0x00, 96 | 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xe3, 0x00, 0x00, 0x00, 97 | 0xd3, 0x00, 0x00, 0x00, 0xd3, 0x00, 0x00, 0x00, 0xd1, 0x00, 0x00, 0x00, 0xd1, 0x00, 0x00, 0x00, 98 | 0xd1, 0x00, 0x00, 0x00, 0xd1, 0x00, 0x00, 0x00, 0xd1, 0x00, 0x00, 0x00, 0xd3, 0x00, 0x00, 0x00, 99 | 0xd5, 0x00, 0x00, 0x00, 0xe1, 0x00, 0x00, 0x00, 0xdb, 0x00, 0x00, 0x00, 0xf5, 0x00, 0x00, 0x00, 100 | 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xa9, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 101 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 102 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 103 | 0x00, 0x00, 0x00, 0x00, 0x72, 0x00, 0x00, 0x00, 0xd7, 0x00, 0x00, 0x00, 0xf7, 0x00, 0x00, 0x00, 104 | 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x3a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 105 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 106 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 107 | 0x00, 0x00, 0x00, 0x00, 0xd1, 0x00, 0x00, 0x00, 0x7c, 0x00, 0x00, 0x00, 0xf7, 0x00, 0x00, 0x00, 108 | 0xff, 0x00, 0x00, 0x00, 0xd9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 109 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 110 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 111 | 0x30, 0x00, 0x00, 0x00, 0xfd, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0xf7, 0x00, 0x00, 0x00, 112 | 0xff, 0x00, 0x00, 0x00, 0x7a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 113 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 114 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 115 | 0x8f, 0x00, 0x00, 0x00, 0xbf, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf5, 0x00, 0x00, 0x00, 116 | 0xfd, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 117 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 118 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 119 | 0xe9, 0x00, 0x00, 0x00, 0x5e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xed, 0x00, 0x00, 0x00, 120 | 0xcb, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, 121 | 0x0e, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, 122 | 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x81, 0x00, 0x00, 0x00, 123 | 0xef, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x76, 0x00, 0x00, 0x00, 124 | 0xfd, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 125 | 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 126 | 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xef, 0x00, 0x00, 0x00, 127 | 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 128 | 0x16, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 129 | 0x20, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 130 | 0x20, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 131 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 132 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 133 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 134 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 135 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 136 | }; 137 | 138 | uchar updata[] = { 139 | 0x00, 0x00, 0x00, 0x00, 140 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 141 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 142 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 143 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 144 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 145 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 146 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 147 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 148 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 149 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 150 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 151 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 152 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 153 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x81, 0x00, 0x00, 0x00, 0x7e, 0x00, 0x00, 0x00, 154 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 155 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 156 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 157 | 0x00, 0x00, 0x00, 0x00, 0x81, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 158 | 0x83, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 159 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 160 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 161 | 0x83, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 162 | 0xff, 0x00, 0x00, 0x00, 0x85, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 163 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 164 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x83, 0x00, 0x00, 0x00, 165 | 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 166 | 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x87, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 167 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 168 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x85, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 169 | 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xbd, 0x00, 0x00, 0x00, 0xbb, 0x00, 0x00, 0x00, 170 | 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x89, 0x00, 0x00, 0x00, 171 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 172 | 0x00, 0x00, 0x00, 0x00, 0x87, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 173 | 0xff, 0x00, 0x00, 0x00, 0xbb, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 174 | 0xb9, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 175 | 0x89, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 176 | 0x87, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 177 | 0xb9, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 178 | 0x08, 0x00, 0x00, 0x00, 0xb7, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 179 | 0xff, 0x00, 0x00, 0x00, 0x89, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x87, 0x00, 0x00, 0x00, 180 | 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xb9, 0x00, 0x00, 0x00, 181 | 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 182 | 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0xb7, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 183 | 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x87, 0x00, 0x00, 0x00, 0x68, 0x00, 0x00, 0x00, 184 | 0xfd, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xb7, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 185 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 186 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0xb5, 0x00, 0x00, 0x00, 187 | 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x6a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 188 | 0x6a, 0x00, 0x00, 0x00, 0xb1, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 189 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 190 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 191 | 0xb1, 0x00, 0x00, 0x00, 0x6c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 192 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 193 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 194 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 195 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 196 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 197 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 198 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 199 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 200 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 201 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 202 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 203 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 204 | }; 205 | 206 | uchar newfolderdata[] = { 207 | 0x52, 0x00, 0x00, 0x00, 208 | 0xe5, 0x00, 0x00, 0x00, 0xf7, 0x00, 0x00, 0x00, 0xf7, 0x00, 0x00, 0x00, 0xf5, 0x00, 0x00, 0x00, 209 | 0xdd, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 210 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 211 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe7, 0x00, 0x00, 0x00, 212 | 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 213 | 0xff, 0x00, 0x00, 0x00, 0xc9, 0x00, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 214 | 0x20, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 215 | 0x1a, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf3, 0x00, 0x00, 0x00, 216 | 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 217 | 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 218 | 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 219 | 0xff, 0x00, 0x00, 0x00, 0xd9, 0x00, 0x00, 0x00, 0x16, 0x00, 0x00, 0x00, 0xf5, 0x00, 0x00, 0x00, 220 | 0x72, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x1a, 0x00, 0x00, 0x00, 221 | 0x1a, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 222 | 0x1a, 0x00, 0x00, 0x00, 0x1a, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 223 | 0x24, 0x00, 0x00, 0x00, 0xdb, 0x00, 0x00, 0x00, 0x6e, 0x00, 0x00, 0x00, 0xf5, 0x00, 0x00, 0x00, 224 | 0x44, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 225 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 226 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 227 | 0x00, 0x00, 0x00, 0x00, 0xc1, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, 0xf5, 0x00, 0x00, 0x00, 228 | 0x42, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 229 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 230 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 231 | 0x00, 0x00, 0x00, 0x00, 0xbf, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, 0xf5, 0x00, 0x00, 0x00, 232 | 0x42, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 233 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 234 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 235 | 0x00, 0x00, 0x00, 0x00, 0xbf, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, 0xf7, 0x00, 0x00, 0x00, 236 | 0x42, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 237 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 238 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 239 | 0x00, 0x00, 0x00, 0x00, 0xbf, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, 0xf7, 0x00, 0x00, 0x00, 240 | 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 241 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 242 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x2e, 0x00, 0x00, 0x00, 243 | 0x0c, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x00, 0xf7, 0x00, 0x00, 0x00, 244 | 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 245 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 246 | 0x0a, 0x00, 0x00, 0x00, 0xa1, 0x00, 0x00, 0x00, 0xfd, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 247 | 0xf5, 0x00, 0x00, 0x00, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf5, 0x00, 0x00, 0x00, 248 | 0x42, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 249 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 250 | 0xa1, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xe5, 0x00, 0x00, 0x00, 0x8b, 0x00, 0x00, 0x00, 251 | 0xfd, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x6a, 0x00, 0x00, 0x00, 0xf3, 0x00, 0x00, 0x00, 252 | 0x46, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 253 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x12, 0x00, 0x00, 0x00, 254 | 0xfd, 0x00, 0x00, 0x00, 0xe3, 0x00, 0x00, 0x00, 0x95, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 255 | 0xbd, 0x00, 0x00, 0x00, 0xef, 0x00, 0x00, 0x00, 0xd9, 0x00, 0x00, 0x00, 0xc7, 0x00, 0x00, 0x00, 256 | 0xcd, 0x00, 0x00, 0x00, 0x9d, 0x00, 0x00, 0x00, 0x9b, 0x00, 0x00, 0x00, 0x9b, 0x00, 0x00, 0x00, 257 | 0x9b, 0x00, 0x00, 0x00, 0x9b, 0x00, 0x00, 0x00, 0x5a, 0x00, 0x00, 0x00, 0x2c, 0x00, 0x00, 0x00, 258 | 0xff, 0x00, 0x00, 0x00, 0x8b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 259 | 0x00, 0x00, 0x00, 0x00, 0xc1, 0x00, 0x00, 0x00, 0xf5, 0x00, 0x00, 0x00, 0x1a, 0x00, 0x00, 0x00, 260 | 0x8b, 0x00, 0x00, 0x00, 0x9d, 0x00, 0x00, 0x00, 0x9d, 0x00, 0x00, 0x00, 0x9d, 0x00, 0x00, 0x00, 261 | 0x9d, 0x00, 0x00, 0x00, 0x9d, 0x00, 0x00, 0x00, 0x68, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 262 | 0xf5, 0x00, 0x00, 0x00, 0xfd, 0x00, 0x00, 0x00, 0xc1, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 263 | 0xf5, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xc9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 264 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 265 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 266 | 0x7a, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xf1, 0x00, 0x00, 0x00, 0xc3, 0x00, 0x00, 0x00, 267 | 0xff, 0x00, 0x00, 0x00, 0xfd, 0x00, 0x00, 0x00, 0x46, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 268 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 269 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 270 | 0x00, 0x00, 0x00, 0x00, 0x6a, 0x00, 0x00, 0x00, 0xd7, 0x00, 0x00, 0x00, 0xf3, 0x00, 0x00, 0x00, 271 | 0xc7, 0x00, 0x00, 0x00, 0x46, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 272 | }; 273 | 274 | uchar newfiledata[] = { 275 | 0x1a, 0x00, 0x00, 0x00, 276 | 0xb7, 0x00, 0x00, 0x00, 0xf1, 0x00, 0x00, 0x00, 0xf5, 0x00, 0x00, 0x00, 0xf7, 0x00, 0x00, 0x00, 277 | 0xf7, 0x00, 0x00, 0x00, 0xf3, 0x00, 0x00, 0x00, 0xb9, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 278 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 279 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xb9, 0x00, 0x00, 0x00, 280 | 0xc3, 0x00, 0x00, 0x00, 0x4c, 0x00, 0x00, 0x00, 0x46, 0x00, 0x00, 0x00, 0x44, 0x00, 0x00, 0x00, 281 | 0x42, 0x00, 0x00, 0x00, 0x7c, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xd5, 0x00, 0x00, 0x00, 282 | 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 283 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf1, 0x00, 0x00, 0x00, 284 | 0x4e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 285 | 0x00, 0x00, 0x00, 0x00, 0x2c, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 286 | 0xd7, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 287 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf5, 0x00, 0x00, 0x00, 288 | 0x48, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 289 | 0x00, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 290 | 0xff, 0x00, 0x00, 0x00, 0xd5, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 291 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf7, 0x00, 0x00, 0x00, 292 | 0x46, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 293 | 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0xf3, 0x00, 0x00, 0x00, 0xfb, 0x00, 0x00, 0x00, 294 | 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xa1, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 295 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf7, 0x00, 0x00, 0x00, 296 | 0x44, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 297 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 298 | 0x04, 0x00, 0x00, 0x00, 0x8d, 0x00, 0x00, 0x00, 0xc1, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 299 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf7, 0x00, 0x00, 0x00, 300 | 0x42, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 301 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 302 | 0x00, 0x00, 0x00, 0x00, 0x76, 0x00, 0x00, 0x00, 0xc3, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 303 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf5, 0x00, 0x00, 0x00, 304 | 0x42, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 305 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 306 | 0x00, 0x00, 0x00, 0x00, 0x62, 0x00, 0x00, 0x00, 0x87, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 307 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf5, 0x00, 0x00, 0x00, 308 | 0x42, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 309 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 310 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x12, 0x00, 0x00, 0x00, 0x2c, 0x00, 0x00, 0x00, 311 | 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf5, 0x00, 0x00, 0x00, 312 | 0x44, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 313 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 314 | 0x0a, 0x00, 0x00, 0x00, 0x9f, 0x00, 0x00, 0x00, 0xfb, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 315 | 0xf5, 0x00, 0x00, 0x00, 0x7a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf5, 0x00, 0x00, 0x00, 316 | 0x44, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 317 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 318 | 0x9f, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xe5, 0x00, 0x00, 0x00, 0x8d, 0x00, 0x00, 0x00, 319 | 0xfd, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x6a, 0x00, 0x00, 0x00, 0xf3, 0x00, 0x00, 0x00, 320 | 0x46, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 321 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x12, 0x00, 0x00, 0x00, 322 | 0xfb, 0x00, 0x00, 0x00, 0xe5, 0x00, 0x00, 0x00, 0x99, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 323 | 0xc1, 0x00, 0x00, 0x00, 0xf1, 0x00, 0x00, 0x00, 0xd7, 0x00, 0x00, 0x00, 0xf1, 0x00, 0x00, 0x00, 324 | 0x48, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 325 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2c, 0x00, 0x00, 0x00, 326 | 0xff, 0x00, 0x00, 0x00, 0x8b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 327 | 0x00, 0x00, 0x00, 0x00, 0xc1, 0x00, 0x00, 0x00, 0xf5, 0x00, 0x00, 0x00, 0xe3, 0x00, 0x00, 0x00, 328 | 0x6c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 329 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 330 | 0xf5, 0x00, 0x00, 0x00, 0xfb, 0x00, 0x00, 0x00, 0xbf, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 331 | 0xf3, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xcb, 0x00, 0x00, 0x00, 0x6c, 0x00, 0x00, 0x00, 332 | 0xfb, 0x00, 0x00, 0x00, 0xc5, 0x00, 0x00, 0x00, 0xc1, 0x00, 0x00, 0x00, 0xbf, 0x00, 0x00, 0x00, 333 | 0xbd, 0x00, 0x00, 0x00, 0xbd, 0x00, 0x00, 0x00, 0xbb, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 334 | 0x7c, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xf1, 0x00, 0x00, 0x00, 0xc1, 0x00, 0x00, 0x00, 335 | 0xff, 0x00, 0x00, 0x00, 0xfd, 0x00, 0x00, 0x00, 0x48, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 336 | 0x40, 0x00, 0x00, 0x00, 0x76, 0x00, 0x00, 0x00, 0x76, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, 337 | 0x78, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, 0x3a, 0x00, 0x00, 0x00, 338 | 0x00, 0x00, 0x00, 0x00, 0x6c, 0x00, 0x00, 0x00, 0xd9, 0x00, 0x00, 0x00, 0xf5, 0x00, 0x00, 0x00, 339 | 0xc9, 0x00, 0x00, 0x00, 0x48, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 340 | }; 341 | 342 | uchar filedata[] = { 343 | 0x00, 0x00, 0x00, 0x00, 344 | 0xbb, 0x00, 0x00, 0x00, 0xd9, 0x00, 0x00, 0x00, 0xd9, 0x00, 0x00, 0x00, 0xd9, 0x00, 0x00, 0x00, 345 | 0xd9, 0x00, 0x00, 0x00, 0xd9, 0x00, 0x00, 0x00, 0xe7, 0x00, 0x00, 0x00, 0x99, 0x00, 0x00, 0x00, 346 | 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 347 | 0xcb, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 348 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x74, 0x00, 0x00, 0x00, 0xb9, 0x00, 0x00, 0x00, 349 | 0x95, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 350 | 0xcd, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 351 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x74, 0x00, 0x00, 0x00, 0x42, 0x00, 0x00, 0x00, 352 | 0xc5, 0x00, 0x00, 0x00, 0x87, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 353 | 0xcd, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 354 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2e, 0x00, 0x00, 0x00, 0x66, 0x00, 0x00, 0x00, 355 | 0x6c, 0x00, 0x00, 0x00, 0xd1, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 356 | 0xcd, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 357 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 358 | 0x08, 0x00, 0x00, 0x00, 0xd1, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 359 | 0xcd, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 360 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 361 | 0x08, 0x00, 0x00, 0x00, 0xd3, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 362 | 0xcd, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 363 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 364 | 0x08, 0x00, 0x00, 0x00, 0xd3, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 365 | 0xcd, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 366 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 367 | 0x08, 0x00, 0x00, 0x00, 0xd3, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 368 | 0xcd, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 369 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 370 | 0x06, 0x00, 0x00, 0x00, 0xd3, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 371 | 0xcd, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 372 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 373 | 0x06, 0x00, 0x00, 0x00, 0xd3, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 374 | 0xcb, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 375 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 376 | 0x06, 0x00, 0x00, 0x00, 0xd3, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 377 | 0xbd, 0x00, 0x00, 0x00, 0xd7, 0x00, 0x00, 0x00, 0xd5, 0x00, 0x00, 0x00, 0xd5, 0x00, 0x00, 0x00, 378 | 0xd5, 0x00, 0x00, 0x00, 0xd5, 0x00, 0x00, 0x00, 0xd5, 0x00, 0x00, 0x00, 0xd5, 0x00, 0x00, 0x00, 379 | 0xd5, 0x00, 0x00, 0x00, 0xc5, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 380 | 381 | }; 382 | 383 | uchar folderdata[] = { 384 | 0x0c, 0x00, 0x00, 0x00, 385 | 0x42, 0x00, 0x00, 0x00, 0x46, 0x00, 0x00, 0x00, 0x44, 0x00, 0x00, 0x00, 0x12, 0x00, 0x00, 0x00, 386 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 387 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc7, 0x00, 0x00, 0x00, 388 | 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xdf, 0x00, 0x00, 0x00, 389 | 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 390 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf7, 0x00, 0x00, 0x00, 391 | 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 392 | 0xeb, 0x00, 0x00, 0x00, 0xe7, 0x00, 0x00, 0x00, 0xe5, 0x00, 0x00, 0x00, 0xe5, 0x00, 0x00, 0x00, 393 | 0xe3, 0x00, 0x00, 0x00, 0xe1, 0x00, 0x00, 0x00, 0x7a, 0x00, 0x00, 0x00, 0xef, 0x00, 0x00, 0x00, 394 | 0x12, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 395 | 0x0a, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 396 | 0x0a, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0xe9, 0x00, 0x00, 0x00, 0xe9, 0x00, 0x00, 0x00, 397 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 398 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 399 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe7, 0x00, 0x00, 0x00, 0xe9, 0x00, 0x00, 0x00, 400 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 401 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 402 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe7, 0x00, 0x00, 0x00, 0xe9, 0x00, 0x00, 0x00, 403 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 404 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 405 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe9, 0x00, 0x00, 0x00, 0xe9, 0x00, 0x00, 0x00, 406 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 407 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 408 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe9, 0x00, 0x00, 0x00, 0xe9, 0x00, 0x00, 0x00, 409 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 410 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 411 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe9, 0x00, 0x00, 0x00, 0xe9, 0x00, 0x00, 0x00, 412 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 413 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 414 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe9, 0x00, 0x00, 0x00, 0xcb, 0x00, 0x00, 0x00, 415 | 0xa9, 0x00, 0x00, 0x00, 0x9f, 0x00, 0x00, 0x00, 0x9f, 0x00, 0x00, 0x00, 0x9f, 0x00, 0x00, 0x00, 416 | 0x9f, 0x00, 0x00, 0x00, 0x9f, 0x00, 0x00, 0x00, 0x9f, 0x00, 0x00, 0x00, 0x9f, 0x00, 0x00, 0x00, 417 | 0x9f, 0x00, 0x00, 0x00, 0xa9, 0x00, 0x00, 0x00, 0xcb, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 418 | 0x44, 0x00, 0x00, 0x00, 0x46, 0x00, 0x00, 0x00, 0x46, 0x00, 0x00, 0x00, 0x46, 0x00, 0x00, 0x00, 419 | 0x46, 0x00, 0x00, 0x00, 0x46, 0x00, 0x00, 0x00, 0x46, 0x00, 0x00, 0x00, 0x46, 0x00, 0x00, 0x00, 420 | 0x46, 0x00, 0x00, 0x00, 0x44, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 421 | 422 | }; 423 | -------------------------------------------------------------------------------- /mkfile: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | #include 4 | #include 5 | #include "theme.h" 6 | 7 | Image* 8 | ereadcol(char *s) 9 | { 10 | Image *i; 11 | char *e; 12 | ulong c; 13 | 14 | c = strtoul(s, &e, 16); 15 | if(e == nil || e == s) 16 | return nil; 17 | c = (c << 8) | 0xff; 18 | i = allocimage(display, Rect(0, 0, 1, 1), screen->chan, 1, c); 19 | if(i == nil) 20 | sysfatal("allocimage: %r"); 21 | return i; 22 | } 23 | 24 | Theme* 25 | loadtheme(void) 26 | { 27 | Theme *theme; 28 | Biobuf *bp; 29 | char *s; 30 | 31 | if(access("/dev/theme", AREAD) < 0) 32 | return 0; 33 | bp = Bopen("/dev/theme", OREAD); 34 | if(bp == nil) 35 | return 0; 36 | theme = malloc(sizeof *theme); 37 | if(theme == nil){ 38 | Bterm(bp); 39 | return nil; 40 | } 41 | for(;;){ 42 | s = Brdstr(bp, '\n', 1); 43 | if(s == nil) 44 | break; 45 | if(strncmp(s, "back", 4) == 0) 46 | theme->back = ereadcol(s+5); 47 | else if(strncmp(s, "high", 4) == 0) 48 | theme->high = ereadcol(s+5); 49 | else if(strncmp(s, "border", 6) == 0) 50 | theme->border = ereadcol(s+7); 51 | else if(strncmp(s, "text", 4) == 0) 52 | theme->text = ereadcol(s+5); 53 | else if(strncmp(s, "htext", 5) == 0) 54 | theme->htext = ereadcol(s+6); 55 | else if(strncmp(s, "title", 5) == 0) 56 | theme->title = ereadcol(s+6); 57 | else if(strncmp(s, "ltitle", 6) == 0) 58 | theme->ltitle = ereadcol(s+7); 59 | else if(strncmp(s, "hold", 4) == 0) 60 | theme->hold = ereadcol(s+5); 61 | else if(strncmp(s, "lhold", 5) == 0) 62 | theme->lhold = ereadcol(s+6); 63 | else if(strncmp(s, "palehold", 8) == 0) 64 | theme->palehold = ereadcol(s+9); 65 | else if(strncmp(s, "paletext", 8) == 0) 66 | theme->paletext = ereadcol(s+9); 67 | else if(strncmp(s, "size", 4) == 0) 68 | theme->size = ereadcol(s+5); 69 | else if(strncmp(s, "menuback", 8) == 0) 70 | theme->menuback = ereadcol(s+9); 71 | else if(strncmp(s, "menuhigh", 8) == 0) 72 | theme->menuhigh = ereadcol(s+9); 73 | else if(strncmp(s, "menubord", 8) == 0) 74 | theme->menubord = ereadcol(s+9); 75 | else if(strncmp(s, "menutext", 8) == 0) 76 | theme->menutext = ereadcol(s+9); 77 | else if(strncmp(s, "menuhtext", 5) == 0) 78 | theme->menuhtext = ereadcol(s+6); 79 | free(s); 80 | } 81 | Bterm(bp); 82 | return theme; 83 | } 84 | 85 | -------------------------------------------------------------------------------- /theme.h: -------------------------------------------------------------------------------- 1 | typedef struct Theme Theme; 2 | 3 | struct Theme 4 | { 5 | Image *back; 6 | Image *high; 7 | Image *border; 8 | Image *text; 9 | Image *htext; 10 | Image *title; 11 | Image *ltitle; 12 | Image *hold; 13 | Image *lhold; 14 | Image *palehold; 15 | Image *paletext; 16 | Image *size; 17 | Image *menubar; 18 | Image *menuback; 19 | Image *menuhigh; 20 | Image *menubord; 21 | Image *menutext; 22 | Image *menuhtext; 23 | }; 24 | 25 | Theme* loadtheme(void); 26 | -------------------------------------------------------------------------------- /vdir.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include "icons.h" 10 | #include "theme.h" 11 | 12 | extern void alert(const char *message, const char *err, Mousectl *mctl, Keyboardctl *kctl); 13 | extern int confirm(const char *message, Mousectl *mctl, Keyboardctl *kctl, Image *bg, Image *fg, Image *hi); 14 | void redraw(void); 15 | 16 | enum 17 | { 18 | Toolpadding = 4, 19 | Padding = 1, 20 | Scrollwidth = 14, 21 | Slowscroll = 10, 22 | }; 23 | 24 | enum 25 | { 26 | Emouse, 27 | Eresize, 28 | Ekeyboard, 29 | Eplumb, 30 | }; 31 | 32 | enum 33 | { 34 | Mrename, 35 | Mdelete, 36 | }; 37 | char *menu2str[] = { "rename", "delete", nil }; 38 | Menu menu2 = { menu2str }; 39 | 40 | const char ellipsis[] = "…"; 41 | 42 | int mainstacksize = 32768; 43 | char *home; 44 | char path[4096]; 45 | Dir* dirs; 46 | long ndirs; 47 | Mousectl *mctl; 48 | Keyboardctl *kctl; 49 | Rectangle toolr; 50 | Rectangle homer; 51 | Rectangle upr; 52 | Rectangle cdr; 53 | Rectangle newdirr; 54 | Rectangle newfiler; 55 | Rectangle viewr; 56 | Rectangle scrollr; 57 | Rectangle scrposr; 58 | Rectangle pathr; 59 | Image *folder; 60 | Image *file; 61 | Image *ihome; 62 | Image *icd; 63 | Image *iup; 64 | Image *inewfile; 65 | Image *inewfolder; 66 | Image *toolbg; 67 | Image *toolfg; 68 | Image *viewbg; 69 | Image *viewfg; 70 | Image *selbg; 71 | Image *selfg; 72 | Image *scrollbg; 73 | Image *scrollfg; 74 | Image *high; 75 | int sizew; 76 | int lineh; 77 | int nlines; 78 | int offset; 79 | int plumbfd; 80 | int scrolling; 81 | int oldbuttons; 82 | int lastn; 83 | 84 | void 85 | showerrstr(char *msg) 86 | { 87 | char errbuf[ERRMAX]; 88 | 89 | errstr(errbuf, ERRMAX-1); 90 | alert(msg, errbuf, mctl, kctl); 91 | } 92 | 93 | void 94 | readhome(void) 95 | { 96 | Biobuf *bp; 97 | 98 | bp = Bopen("/env/home", OREAD); 99 | home = Brdstr(bp, 0, 0); 100 | Bterm(bp); 101 | } 102 | 103 | char* 104 | abspath(char *wd, char *p) 105 | { 106 | char *s; 107 | 108 | if(p[0]=='/') 109 | s = cleanname(p); 110 | else{ 111 | s = smprint("%s/%s", wd, p); 112 | cleanname(s); 113 | } 114 | return s; 115 | } 116 | 117 | int 118 | dircmp(Dir *a, Dir *b) 119 | { 120 | if(a->qid.type==b->qid.type) 121 | return strcmp(a->name, b->name); 122 | if(a->qid.type&QTDIR) 123 | return -1; 124 | return 1; 125 | } 126 | 127 | void 128 | loaddirs(void) 129 | { 130 | int fd, i; 131 | vlong m; 132 | 133 | fd = open(path, OREAD); 134 | if(fd<0){ 135 | showerrstr("Unable to load directory"); 136 | return; 137 | } 138 | if(dirs!=nil) 139 | free(dirs); 140 | ndirs = dirreadall(fd, &dirs); 141 | if(ndirs > 0) 142 | qsort(dirs, ndirs, sizeof *dirs, (int(*)(void*,void*))dircmp); 143 | else{ 144 | if(ndirs < 0) 145 | showerrstr("Unable to read directory"); 146 | ndirs = 0; 147 | } 148 | offset = 0; 149 | close(fd); 150 | m = 1; 151 | for(i=0; i < ndirs; i++){ 152 | if(dirs[i].length>m) 153 | m=dirs[i].length; 154 | } 155 | sizew = m == 0 ? 3 : 1+1+log(m)/log(10); 156 | } 157 | 158 | void 159 | up(void) 160 | { 161 | snprint(path, sizeof path, abspath(path, "..")); 162 | loaddirs(); 163 | } 164 | 165 | void 166 | cd(char *dir) 167 | { 168 | char newpath[4096] = {0}; 169 | 170 | if(dir == nil) 171 | snprint(newpath, sizeof newpath, home); 172 | else if(dir[0] == '/') 173 | snprint(newpath, sizeof newpath, dir); 174 | else 175 | snprint(newpath, sizeof newpath, "%s/%s", path, dir); 176 | if(access(newpath, 0)<0) 177 | showerrstr("Directory does not exist"); 178 | else 179 | snprint(path, sizeof path, abspath(path, newpath)); 180 | loaddirs(); 181 | } 182 | 183 | void 184 | mkdir(char *name) 185 | { 186 | char *p; 187 | int fd; 188 | 189 | p = smprint("%s/%s", path, name); 190 | if(access(p, 0)>=0){ 191 | showerrstr("Directory already exists"); 192 | goto cleanup; 193 | } 194 | fd = create(p, OREAD, DMDIR|0755); 195 | if(fd<0){ 196 | showerrstr("Unable to create directory"); 197 | goto cleanup; 198 | } 199 | close(fd); 200 | loaddirs(); 201 | cleanup: 202 | free(p); 203 | } 204 | 205 | void 206 | touch(char *name) 207 | { 208 | char *p; 209 | int fd; 210 | 211 | p = smprint("%s/%s", path, name); 212 | if(access(p, 0)>=0){ 213 | showerrstr("File already exists"); 214 | goto cleanup; 215 | } 216 | fd = create(p, OREAD, 0644); 217 | if(fd<0){ 218 | showerrstr("Unable to create file"); 219 | goto cleanup; 220 | } 221 | close(fd); 222 | loaddirs(); 223 | cleanup: 224 | free(p); 225 | } 226 | 227 | int 228 | doexec(char *cmd) 229 | { 230 | int rc; 231 | Waitmsg *msg; 232 | char *p; 233 | 234 | rc = 0; 235 | switch(rfork(RFPROC|RFFDG|RFREND)){ 236 | case -1: 237 | rc = -1; 238 | break; 239 | case 0: 240 | execl("/bin/rc", "rc", "-c", cmd, 0); 241 | fprint(2, "execl failed: %r"); 242 | threadexitsall("execl"); 243 | break; 244 | default: 245 | msg = wait(); 246 | if(msg != nil && msg->msg[0] != 0){ 247 | rc = -1; 248 | p = strchr(msg->msg, ':'); 249 | if(p != nil) 250 | werrstr(p+2); 251 | else 252 | werrstr(msg->msg); 253 | } 254 | if(msg != nil) 255 | free(msg); 256 | break; 257 | } 258 | return rc; 259 | } 260 | 261 | void 262 | rm(Dir d) 263 | { 264 | char cmd[300], buf[1024] = {0}; 265 | char *p, *qp; 266 | 267 | if(d.qid.type&QTDIR) 268 | snprint(buf, sizeof buf, "Delete directory '%s' and its subdirectories ?", d.name); 269 | else 270 | snprint(buf, sizeof buf, "Delete file '%s' ?", d.name); 271 | if(!confirm(buf, mctl, kctl, viewbg, viewfg, high)) 272 | return; 273 | p = smprint("%s/%s", path, d.name); 274 | qp = quotestrdup(p); 275 | snprint(cmd, sizeof cmd, "rm -r %s >/dev/null >[2=1]", qp); 276 | if(doexec(cmd) < 0) 277 | showerrstr("Cannot remove file/directory"); 278 | else 279 | loaddirs(); 280 | free(qp); 281 | free(p); 282 | } 283 | 284 | void 285 | mv(char *from, char *to) 286 | { 287 | char cmd[520]; 288 | char *fp, *tp, *qfp, *qtp; 289 | 290 | fp = smprint("%s/%s", path, from); 291 | tp = smprint("%s/%s", path, to); 292 | qfp = quotestrdup(fp); 293 | qtp = quotestrdup(tp); 294 | 295 | snprint(cmd, sizeof cmd, "mv %s %s >/dev/null >[2=1]", qfp, qtp); 296 | if(doexec(cmd) < 0) 297 | showerrstr("Cannot rename file/directory"); 298 | else 299 | loaddirs(); 300 | free(qtp); 301 | free(qfp); 302 | free(tp); 303 | free(fp); 304 | } 305 | 306 | int 307 | plumbfile(char *path, char *name) 308 | { 309 | char *f; 310 | int e; 311 | 312 | f = smprint("%s/%s", path, name); 313 | e = access(f, 0)==0; 314 | if(e) 315 | plumbsendtext(plumbfd, "vdir", nil, path, name); 316 | else{ 317 | alert("File does not exist anymore", nil, mctl, kctl); 318 | loaddirs(); 319 | redraw(); 320 | } 321 | free(f); 322 | return e; 323 | } 324 | 325 | void 326 | initcolors(void) 327 | { 328 | Theme *theme; 329 | 330 | theme = loadtheme(); 331 | if(theme == nil){ 332 | toolbg = allocimage(display, Rect(0,0,1,1), screen->chan, 1, 0xEFEFEFFF); 333 | toolfg = display->black; 334 | viewbg = display->white; 335 | viewfg = display->black; 336 | selbg = allocimage(display, Rect(0,0,1,1), screen->chan, 1, 0xEFEFEFFF); 337 | selfg = display->black; 338 | scrollbg = allocimage(display, Rect(0,0,1,1), screen->chan, 1, 0x999999FF); 339 | scrollfg = display->white; 340 | high = allocimage(display, Rect(0,0,1,1), screen->chan, 1, DGreygreen); 341 | }else{ 342 | toolbg = theme->back; 343 | toolfg = theme->text; 344 | viewbg = theme->back; 345 | viewfg = theme->text; 346 | selbg = theme->border; 347 | selfg = theme->text; 348 | scrollbg = theme->border; 349 | scrollfg = theme->back; 350 | high = theme->high; 351 | } 352 | } 353 | 354 | Image* 355 | loadicon(Rectangle r, uchar *data, int ndata) 356 | { 357 | Image *i; 358 | int n; 359 | 360 | i = allocimage(display, r, RGBA32, 0, DNofill); 361 | if(i==nil) 362 | sysfatal("allocimage: %r"); 363 | n = loadimage(i, r, data, ndata); 364 | if(n<0) 365 | sysfatal("loadimage: %r"); 366 | return i; 367 | } 368 | 369 | void 370 | initimages(void) 371 | { 372 | Rectangle small = Rect(0, 0, 12, 12); 373 | Rectangle big = Rect(0, 0, 16, 16); 374 | 375 | folder = loadicon(small, folderdata, sizeof folderdata); 376 | file = loadicon(small, filedata, sizeof filedata); 377 | ihome = loadicon(big, homedata, sizeof homedata); 378 | icd = loadicon(big, cddata, sizeof cddata); 379 | iup = loadicon(big, updata, sizeof updata); 380 | inewfile = loadicon(big, newfiledata, sizeof newfiledata); 381 | inewfolder = loadicon(big, newfolderdata, sizeof newfolderdata); 382 | } 383 | 384 | char* 385 | mdate(Dir d) 386 | { 387 | char *months[] = { "Jan", "Feb", "Mar", "Apr", "May", "Jun", 388 | "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" }; 389 | Tm *tm; 390 | 391 | tm = localtime(d.mtime); 392 | return smprint("%s %02d %02d:%02d", months[tm->mon], tm->mday, tm->hour, tm->min); 393 | } 394 | 395 | Rectangle 396 | drawbutton(Point *p, Image *c, Image *i) 397 | { 398 | Rectangle r; 399 | 400 | p->x += Toolpadding; 401 | r = Rect(p->x, p->y, p->x+16, p->y+16); 402 | draw(screen, r, c, i, ZP); 403 | p->x += 16+Toolpadding; 404 | return r; 405 | } 406 | 407 | Point 408 | drawtext(Point p, Image *i, char* t, int n) 409 | { 410 | char *s; 411 | Rune rn; 412 | 413 | s = t; 414 | if(*s && (p.x+stringwidth(font, s)) > n){ 415 | p = string(screen, p, i, ZP, font, ellipsis); 416 | while (*s && (p.x+stringwidth(font, s)) > n) s++; 417 | } 418 | for( ; *s; s++){ 419 | s += chartorune(&rn, s) - 1; 420 | p = runestringn(screen, p, i, ZP, font, &rn, 1); 421 | } 422 | return p; 423 | } 424 | 425 | void 426 | drawdir(int n, int selected) 427 | { 428 | char buf[255], *t; 429 | Dir d; 430 | Image *img, *bg, *fg; 431 | Point p; 432 | Rectangle r; 433 | int dy; 434 | 435 | if(offset+n>=ndirs) 436 | return; 437 | bg = selected ? selbg : viewbg; 438 | fg = selected ? selfg : viewfg; 439 | d = dirs[offset+n]; 440 | p = addpt(viewr.min, Pt(Toolpadding, Toolpadding)); 441 | p.y += n*lineh; 442 | r = Rpt(p, addpt(p, Pt(Dx(viewr)-2*Toolpadding, lineh))); 443 | draw(screen, r, bg, nil, ZP); 444 | t = mdate(d); 445 | snprint(buf, sizeof buf, "%*lld %s", sizew, d.length, t); 446 | free(t); 447 | img = (d.qid.type&QTDIR) ? folder : file; 448 | p.y -= Padding; 449 | dy = (lineh-12)/2; 450 | draw(screen, Rect(p.x, p.y+dy, p.x+12, p.y+dy+12), fg, img, ZP); 451 | p.x += 12+4+Padding; 452 | p.y += Padding; 453 | p = drawtext(p, fg, d.name, viewr.max.x - stringwidth(font, buf) - 2*Padding - Toolpadding); 454 | p.x = viewr.max.x - stringwidth(font, buf) - 2*Padding - Toolpadding; 455 | string(screen, p, fg, ZP, font, buf); 456 | } 457 | 458 | void 459 | flash(int n) 460 | { 461 | int i; 462 | 463 | for(i=0; i<5; i++){ 464 | drawdir(n, i&1); 465 | sleep(50); 466 | flushimage(display, 1); 467 | } 468 | } 469 | 470 | void 471 | redraw(void) 472 | { 473 | Point p; 474 | int i, h, y; 475 | 476 | draw(screen, screen->r, viewbg, nil, ZP); 477 | p = addpt(screen->r.min, Pt(0, Toolpadding)); 478 | draw(screen, toolr, toolbg, nil, ZP); 479 | line(screen, Pt(toolr.min.x, toolr.max.y), toolr.max, 0, 0, 0, toolfg, ZP); 480 | homer = drawbutton(&p, toolfg, ihome); 481 | cdr = drawbutton(&p, toolfg, icd); 482 | upr = drawbutton(&p, toolfg, iup); 483 | p.x += Toolpadding; 484 | p.y = toolr.min.y + (Toolpadding+16+Toolpadding-font->height)/2; 485 | pathr = Rect(p.x, p.y, p.x + stringwidth(font, path), p.y + font->height); 486 | p = drawtext(p, toolfg, path, screen->r.max.x - 2*(Toolpadding+16+Toolpadding)); 487 | p.x = screen->r.max.x - 2*(Toolpadding+16+Toolpadding); 488 | p.y = screen->r.min.y + Toolpadding; 489 | newdirr = drawbutton(&p, toolfg, inewfolder); 490 | newfiler = drawbutton(&p, toolfg, inewfile); 491 | draw(screen, scrollr, scrollbg, nil, ZP); 492 | if(ndirs>0){ 493 | h = ((double)nlines/ndirs)*Dy(scrollr); 494 | y = ((double)offset/ndirs)*Dy(scrollr); 495 | scrposr = Rect(scrollr.min.x, scrollr.min.y+y, scrollr.max.x-1, scrollr.min.y+y+h); 496 | }else 497 | scrposr = Rect(scrollr.min.x, scrollr.min.y, scrollr.max.x-1, scrollr.max.y); 498 | draw(screen, scrposr, scrollfg, nil, ZP); 499 | for(i = 0; i= ndirs) 509 | offset = 0; 510 | else if(offset < 0) 511 | offset = 0; 512 | else if(offset+nlines > ndirs) 513 | offset = ndirs-nlines; 514 | return offset; 515 | } 516 | 517 | void 518 | scrollup(int off) 519 | { 520 | int newoff; 521 | 522 | newoff = scrollclamp(offset - off); 523 | if(newoff == offset) 524 | return; 525 | offset = newoff; 526 | redraw(); 527 | } 528 | 529 | void 530 | scrolldown(int off) 531 | { 532 | int newoff; 533 | 534 | newoff = scrollclamp(offset + off); 535 | if(newoff == offset) 536 | return; 537 | offset = newoff; 538 | redraw(); 539 | } 540 | 541 | void 542 | evtresize(void) 543 | { 544 | if(getwindow(display, Refnone)<0) 545 | sysfatal("cannot reattach: %r"); 546 | lineh = Padding+font->height+Padding; 547 | toolr = screen->r; 548 | toolr.max.y = toolr.min.y+16+2*Toolpadding; 549 | scrollr = screen->r; 550 | scrollr.min.y = toolr.max.y+1; 551 | scrollr.max.x = scrollr.min.x + Scrollwidth; 552 | scrollr = insetrect(scrollr, 1); 553 | viewr = screen->r; 554 | viewr.min.x += Scrollwidth; 555 | viewr.min.y = toolr.max.y+1; 556 | nlines = Dy(viewr)/lineh; 557 | redraw(); 558 | } 559 | 560 | void 561 | evtkey(Rune k) 562 | { 563 | switch(k){ 564 | case 'q': 565 | case Kdel: 566 | threadexitsall(nil); 567 | break; 568 | case Kpgup: 569 | scrollup(nlines); 570 | break; 571 | case Kpgdown: 572 | scrolldown(nlines); 573 | break; 574 | case Khome: 575 | cd(nil); 576 | redraw(); 577 | break; 578 | case Kup: 579 | up(); 580 | redraw(); 581 | break; 582 | case 0x20: 583 | plumbsendtext(plumbfd, "vdir", nil, nil, path); 584 | break; 585 | } 586 | } 587 | 588 | Point 589 | cept(const char *text) 590 | { 591 | Point p; 592 | 593 | p = screen->r.min; 594 | p.x += (Dx(screen->r)-stringwidth(font, text)-4)/2; 595 | p.y += (Dy(screen->r)-font->height-4)/2; 596 | return p; 597 | } 598 | 599 | int 600 | indexat(Point p) 601 | { 602 | int n; 603 | 604 | if(!ptinrect(p, viewr)) 605 | return -1; 606 | n = (p.y-viewr.min.y)/lineh; 607 | if(offset+n>=ndirs) 608 | return -1; 609 | return n; 610 | } 611 | 612 | void 613 | evtmouse(Mouse m) 614 | { 615 | int n, dy; 616 | Dir d; 617 | char buf[4096] = {0}; 618 | 619 | if(oldbuttons == 0 && m.buttons != 0 && ptinrect(m.xy, scrollr)) 620 | scrolling = 1; 621 | else if(m.buttons == 0) 622 | scrolling = 0; 623 | 624 | if(m.buttons&1){ 625 | if(scrolling){ 626 | dy = 1+nlines*((double)(m.xy.y - scrollr.min.y)/Dy(scrollr)); 627 | scrollup(dy); 628 | } 629 | }else if(m.buttons&2){ 630 | if(ptinrect(m.xy, viewr)){ 631 | n = indexat(m.xy); 632 | if(n==-1) 633 | return; 634 | d = dirs[offset+n]; 635 | switch(menuhit(2, mctl, &menu2, nil)){ 636 | case Mdelete: 637 | rm(d); 638 | redraw(); 639 | break; 640 | case Mrename: 641 | snprint(buf, sizeof buf, "%s", d.name); 642 | if(enter("Rename to", buf, sizeof buf, mctl, kctl, nil)>0){ 643 | mv(d.name, buf); 644 | redraw(); 645 | } 646 | break; 647 | } 648 | }else if(scrolling){ 649 | if(nlines0){ 670 | cd(buf); 671 | redraw(); 672 | } 673 | }else if(ptinrect(m.xy, pathr)){ 674 | plumbsendtext(plumbfd, "vdir", nil, nil, path); 675 | }else if(ptinrect(m.xy, newdirr)){ 676 | m.xy = cept("Create directory"); 677 | if(enter("Create directory", buf, sizeof buf, mctl, kctl, nil)>0){ 678 | mkdir(buf); 679 | redraw(); 680 | } 681 | }else if(ptinrect(m.xy, newfiler)){ 682 | m.xy = cept("Create file"); 683 | if(enter("Create file", buf, sizeof buf, mctl, kctl, nil)>0){ 684 | touch(buf); 685 | redraw(); 686 | } 687 | }else if(ptinrect(m.xy, viewr)){ 688 | n = indexat(m.xy); 689 | if(n==-1) 690 | return; 691 | d = dirs[offset+n]; 692 | if(d.qid.type & QTDIR){ 693 | cd(d.name); 694 | redraw(); 695 | }else{ 696 | if(plumbfile(path, d.name)) 697 | flash(n); 698 | } 699 | } 700 | }else if(m.buttons&8) 701 | scrollup(Slowscroll); 702 | else if(m.buttons&16) 703 | scrolldown(Slowscroll); 704 | else{ 705 | n = indexat(m.xy); 706 | if(n==-1){ 707 | if(lastn!=-1){ 708 | drawdir(lastn, 0); 709 | lastn = -1; 710 | flushimage(display, 1); 711 | } 712 | }else if(n!=lastn){ 713 | if(lastn!=-1) 714 | drawdir(lastn, 0); 715 | drawdir(n, 1); 716 | lastn = n; 717 | flushimage(display, 1); 718 | } 719 | } 720 | 721 | oldbuttons = m.buttons; 722 | } 723 | 724 | void 725 | plumbdir(void *c) 726 | { 727 | Plumbmsg *m; 728 | char *s; 729 | int f; 730 | 731 | if((f = plumbopen("vdir", OREAD)) >= 0){ 732 | while((m = plumbrecv(f)) != nil){ 733 | s = m->data; 734 | if(*s != '/' && m->wdir != nil) 735 | s = smprint("%s/%.*s", m->wdir, m->ndata, m->data); 736 | else 737 | s = smprint("%.*s", m->ndata, m->data); 738 | plumbfree(m); 739 | if(sendp(c, s) != 1) 740 | break; 741 | } 742 | } 743 | 744 | threadexits(nil); 745 | } 746 | 747 | void 748 | usage(void) 749 | { 750 | fprint(2, "usage: %s [-r] [path]\n", argv0); 751 | exits("usage"); 752 | } 753 | 754 | void 755 | threadmain(int argc, char *argv[]) 756 | { 757 | Mouse m; 758 | Rune k; 759 | char *d; 760 | Alt alts[] = { 761 | { nil, &m, CHANRCV }, 762 | { nil, nil, CHANRCV }, 763 | { nil, &k, CHANRCV }, 764 | { nil, &d, CHANRCV }, 765 | { nil, nil, CHANEND }, 766 | }; 767 | 768 | offset = 0; 769 | scrolling = 0; 770 | oldbuttons = 0; 771 | lastn = -1; 772 | ARGBEGIN{ 773 | default: 774 | usage(); 775 | }ARGEND; 776 | if(getwd(path, sizeof path) == nil) 777 | sysfatal("getwd: %r"); 778 | if(argc==1 && access(argv[0], 0) >= 0) 779 | snprint(path, sizeof path, abspath(path, argv[0])); 780 | plumbfd = plumbopen("send", OWRITE|OCEXEC); 781 | if(plumbfd<0) 782 | sysfatal("plumbopen: %r"); 783 | if(initdraw(nil, nil, "vdir")<0) 784 | sysfatal("initdraw: %r"); 785 | display->locking = 0; 786 | mctl = initmouse(nil, screen); 787 | if(mctl==nil) 788 | sysfatal("initmouse: %r"); 789 | kctl = initkeyboard(nil); 790 | if(kctl==nil) 791 | sysfatal("initkeyboard: %r"); 792 | alts[Emouse].c = mctl->c; 793 | alts[Eresize].c = mctl->resizec; 794 | alts[Ekeyboard].c = kctl->c; 795 | alts[Eplumb].c = chancreate(sizeof(d), 1); 796 | proccreate(plumbdir, alts[Eplumb].c, 4096); 797 | readhome(); 798 | loaddirs(); 799 | initcolors(); 800 | initimages(); 801 | evtresize(); 802 | for(;;){ 803 | switch(alt(alts)){ 804 | case Emouse: 805 | evtmouse(m); 806 | break; 807 | case Eresize: 808 | evtresize(); 809 | break; 810 | case Ekeyboard: 811 | evtkey(k); 812 | break; 813 | case Eplumb: 814 | cd(d); 815 | free(d); 816 | redraw(); 817 | break; 818 | } 819 | } 820 | } 821 | -------------------------------------------------------------------------------- /vdir.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/telephil9/vdir/d57a09f05c237d004770493258c206bbe9916681/vdir.png --------------------------------------------------------------------------------