📄 01.htm
字号:
1; //此项目为子目录<BR>else return
0;<BR>}<BR>///////////////////////////////////////////////////////////////////////////////////////////////<BR><BR>///////////////////////////////// 获取当前目录下
下一个有效文件或者文件夹 /////////////////<BR>void
get_pre_item(void)<BR>{<BR>if(item_count>=2)item_count--;<BR>if(item_count==0)item_count=1;<BR>get_nst_item();<BR>}<BR>//////////////////////////////////////////////////////////////////////////////////////////////<BR><BR>///////////////////////////////// 获取当前目录下
下一个有效文件或者文件夹 /////////////////<BR>void
get_next_item(void)<BR>{<BR>item_count++;<BR>get_nst_item();<BR>}<BR>///////////////////////////////////////////////////////////////////////////////////////////////<BR><BR>//////////////////////////////// 进入一个文件夹 /////////////////////////////////////////<BR>void
enter_dir(void)<BR>{<BR>unsigned char
i;<BR>current_dir.father_dir_cluster_number=current_dir.first_cluster_number;<BR>current_dir.first_cluster_number=temp_dir.first_cluster_number;<BR>current_dir.current_cluster_number=current_dir.first_cluster_number;<BR>not_root_dir++;<BR>for(i=0;i<13;i++)<BR> {<BR> if(item_name[i]==0x2020)break;<BR> dir_name[folder_length/2]=item_name[i];<BR> folder_length+=2;<BR> }<BR>dir_name[folder_length/2]=0x5C20;<BR>folder_length+=2;<BR>item_count=0;<BR>play_count=0;<BR>}<BR>////////////////////////////////////////////////////////////////////////////////////////////////<BR><BR>////////////////////////////////// 找出父文件夹起始簇号 ////////////////////////////////////<BR>unsigned
long int find_father_dir(void)<BR>{<BR>unsigned long int
cluster_number;<BR>unsigned int i,j;<BR>unsigned long int
LBA;<BR>current_dir.current_cluster_number=current_dir.first_cluster_number;<BR>do<BR> {<BR> LBA=get_dir_next_sector();<BR> for(i=0;i<dbr[driver_number].sectors_per_cluster;i++)<BR> {<BR> read_IDE_sector(LBA);<BR> for(j=0;j<dbr[driver_number].bytes_per_sectors/32;j++)<BR> {<BR> if((buffer[j*32+0]=='.')&&(buffer[j*32+1]=='.')&&(buffer[j*32+11]&0x10)) //找到父目录项<BR> {<BR> ((unsigned
char
*)&(cluster_number))[0]=buffer[j*32+0x15];<BR> ((unsigned
char
*)&(cluster_number))[1]=buffer[j*32+0x14];<BR> ((unsigned
char
*)&(cluster_number))[2]=buffer[j*32+0x1B];<BR> ((unsigned
char
*)&(cluster_number))[3]=buffer[j*32+0x1A];<BR> if(cluster_number==0)<BR> {<BR> cluster_number=dbr[0].root_cluster_num;<BR> }<BR> return
cluster_number;<BR> }<BR> }<BR> LBA++;<BR> }<BR> }while((!(current_dir.current_cluster_number>=0xFFFFFFF8))&&(LBA<(dpt[driver_number].start_sector+dpt[driver_number].total_sectors)));
//直到文件夹结束<BR>folder_length=4; //如果找不到父目录,则发生严重错误,退回到根目录<BR>for(i=2;i<200;i++)dir_name[i]=0x2020;<BR>not_root_dir=0;<BR>current_dir.first_cluster_number=dbr[0].root_cluster_num;<BR>current_dir.current_cluster_number=current_dir.first_cluster_number;<BR>}<BR>/////////////////////////////////////////////////////////////////////////////////////////////////<BR>unsigned
int
not_root_dir; //如果该值不为0,表示不是根目录<BR><BR>///////////////////////////// 退到上一级目录,如果为根目录,则退不动 /////////////////////////<BR>void
exit_dir(void)<BR>{<BR>unsigned char
i;<BR>if(not_root_dir)<BR> {<BR> not_root_dir--;<BR> current_dir.first_cluster_number=current_dir.father_dir_cluster_number;<BR> current_dir.current_cluster_number=current_dir.first_cluster_number;<BR> if(not_root_dir)current_dir.father_dir_cluster_number=find_father_dir();<BR> folder_length--;<BR> dir_name[folder_length/2]=0x2020;<BR> for(i=0;i<13;i++)<BR> {<BR> folder_length-=2;<BR> if(((unsigned
char
*)&(dir_name[folder_length/2]))[0]==0x5C)break;<BR> if(((unsigned
char
*)&(dir_name[folder_length/2]))[1]==0x5C)break;<BR> dir_name[folder_length/2]=0x2020;<BR> }<BR> folder_length++;<BR> }<BR>play_count=0;<BR>item_count=0;<BR>}<BR>/////////////////////////////////////////////////////////////////////////////////////////////////<BR><BR>///////////////////////////////// 获取当前文件夹中,第n个有效文件或者文件夹 ////////////////<BR>void
get_nst_item(void)<BR>{<BR>unsigned int
i,j,k,temp_count;<BR>unsigned long int LBA;<BR>unsigned char xdata
temp_buffer[32];<BR>key=0;<BR>temp_count=0;<BR>play_count=0;<BR>current_dir.current_cluster_number=current_dir.first_cluster_number;<BR>do<BR> {<BR> LBA=get_dir_next_sector();<BR> for(i=0;i<dbr[driver_number].sectors_per_cluster;i++)<BR> {<BR> read_IDE_sector(LBA);<BR> for(j=0;j<dbr[driver_number].bytes_per_sectors/32;j++)<BR> {<BR> if(j==15){for(k=0;k<32;k++)temp_buffer[k]=buffer[k+512-32];} //如果已到最后一个项,则将之保存<BR> for(k=0;k<11;k++)file.name[k]=buffer[j*32+k];<BR> file.attribute=buffer[j*32+11];<BR> if(is_a_mp3_file())<BR> {<BR> if(black)<BR> {<BR> write_LCD_command(0x34);<BR> write_LCD_command(0x05);<BR> write_LCD_command(0x30);<BR> black=0;<BR> }<BR> temp_count++;<BR> play_count++;<BR> if(temp_count==item_count)<BR> {<BR> for(k=0;k<11;k++)item_name[k]=buffer[j*32+k]; //保存短文件名<BR> if(j==0){for(k=0;k<32;k++)buffer[k+512-32]=temp_buffer[k];j=16;} //如果为第一项,则用刚刚保存的一项替换最后一项<BR> j--;<BR> if((buffer[j*32+11]==0x0F)&&(buffer[j*32]!=0xE5)) //如果找到长目录,则用长目录名替换短目录名<BR> {<BR> for(k=0;k<10;k++)<BR> {<BR> ((unsigned
char
*)item_name)[k]=buffer[j*32+0x02+k];<BR> k++;<BR> ((unsigned
char
*)item_name)[k]=buffer[j*32+k];<BR> }<BR> for(k=0;k<12;k++)<BR> {<BR> ((unsigned
char
*)item_name)[10+k]=buffer[j*32+0x0F+k];<BR> k++;<BR> ((unsigned
char
*)item_name)[10+k]=buffer[j*32+0x0D+k];<BR> }<BR> ((unsigned
char
*)item_name)[22]=buffer[j*32+0x1D];<BR> ((unsigned
char
*)item_name)[23]=buffer[j*32+0x1C];<BR> ((unsigned
char
*)item_name)[24]=buffer[j*32+0x1F];<BR> ((unsigned
char
*)item_name)[25]=buffer[j*32+0x1E];<BR> }<BR> for(k=0;k<13;k++){if((item_name[k]==0x0000)||(item_name[k]==0xFF00)||(item_name[k]==0xFFFF))break;change_code(&(item_name[k]));}<BR> for(;k<13;k++)item_name[k]=0x2020;<BR> file_or_folder=IS_MP3FILE;<BR> return;<BR> }<BR> }<BR> if(is_a_folder())<BR> {<BR> if(!black)<BR> {<BR> write_LCD_command(0x34);<BR> write_LCD_command(0x05);<BR> write_LCD_command(0x30);<BR> black=1;<BR> }<BR> temp_count++;<BR> if(temp_count==item_count)<BR> {<BR> ((unsigned
char
*)&(temp_dir.first_cluster_number))[0]=buffer[j*32+0x15];<BR> ((unsigned
char
*)&(temp_dir.first_cluster_number))[1]=buffer[j*32+0x14];<BR> ((unsigned
char
*)&(temp_dir.first_cluster_number))[2]=buffer[j*32+0x1B];<BR> ((unsigned
char
*)&(temp_dir.first_cluster_number))[3]=buffer[j*32+0x1A];<BR> temp_dir.current_cluster_number=temp_dir.first_cluster_number;<BR> for(k=0;k<11;k++)item_name[k]=buffer[j*32+k]; //保存短文件名<BR> if(j==0){for(k=0;k<32;k++)buffer[k+512-32]=temp_buffer[k];j=16;}<BR> j--;<BR> if((buffer[j*32+11]==0x0F)&&(buffer[j*32]!=0xE5))<BR> {<BR> for(k=0;k<10;k++)<BR> {<BR> ((unsigned
char
*)item_name)[k]=buffer[j*32+0x02+k];<BR> k++;<BR> ((unsigned
char
*)item_name)[k]=buffer[j*32+k];<BR> }<BR> for(k=0;k<12;k++)<BR> {<BR> ((unsigned
char
*)item_name)[10+k]=buffer[j*32+0x0F+k];<BR> k++;<BR> ((unsigned
char
*)item_name)[10+k]=buffer[j*32+0x0D+k];<BR> }<BR> ((unsigned
char
*)item_name)[22]=buffer[j*32+0x1D];<BR> ((unsigned
char
*)item_name)[23]=buffer[j*32+0x1C];<BR> ((unsigned
char
*)item_name)[24]=buffer[j*32+0x1F];<BR> ((unsigned
char
*)item_name)[25]=buffer[j*32+0x1E];<BR> }<BR> for(k=0;k<13;k++){if((item_name[k]==0x0000)||(item_name[k]==0xFF00)||(item_name[k]==0xFFFF))break;change_code(&(item_name[k]));}<BR> for(;k<13;k++)item_name[k]=0x2020;<BR> file_or_folder=IS_FOLDER;<BR> return;<BR> }<BR> }<BR> }<BR> LBA++;<BR> if(key)<BR> {<BR> if(key==KEY_FUN){key=0;goto
exit;}<BR> else
key=0;<BR> }<BR> }<BR> }while((!(current_dir.current_cluster_number>=0xFFFFFFF8))&&(LBA<(dpt[driver_number].start_sector+dpt[driver_number].total_sectors)));
//直到文件夹结束<BR><BR>exit:<BR>item_count=0;<BR>play_count=0;<BR>file_or_folder=IS_EMPTY;<BR>for(k=0;k<13;k++)item_name[k]=0x2020;<BR>}<BR>////////////////////////////////////////////////////////////////////////////////////////////////<BR><BR><BR>
<P align=center>
<CENTER></CENTER>
<P></P>
<P><FONT color=#336699><STRONG>签名:</STRONG></FONT><BR>
<DIV align=right>
<TABLE cellSpacing=0 cellPadding=0 border=0>
<TBODY>
<TR>
<TD class=text9><FONT
color=#ff0000>声明:本人所有发言均为个人观点。由此贴带来的后果,<BR> 本人一般不予负责。在您相信本贴之前,请慎重考虑!<BR> <BR> computer00</FONT></TD></TR>
<TR></TR></TBODY></TABLE></DIV>
<P></P></TD></TR></TBODY></TABLE><BR></TD></TR></TBODY></TABLE><IMG height=5
src="C:\Documents and Settings\liweihua\My Documents\硬盘mp3源代码\01.files\blank(1).gif"
width=1><BR>
<CENTER>
<TABLE cellSpacing=3 cellPadding=0 align=center border=0>
<TBODY>
<TR>
<TD>
<SCRIPT language=javascript src="01.files/ShowBoardAd.htm"></SCRIPT>
</TD>
<TD width=119><!--放置站内通告开始 -->
<MARQUEE onmouseover="if (document.all!=null){this.stop()}"
style="HEIGHT: 60px" onmouseout="if (document.all!=null){this.start()}"
scrollAmount=4 scrollDelay=400 direction=up><A
href="http://www.cnhxzy.com/index.htm"
target=_blank>电子线路板制作就像打印一样简单!!!</A> <BR><A href="http://www.whkj.com/"
target=BoardList>微打 编程器 键盘显示芯片 仿真器 实验仪 示波器 虚拟仪器;;我们专业供应!</A> <BR><!--放置站内通告结束 --></MARQUEE></TD></TR></TBODY></TABLE></CENTER>
<TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
<TBODY>
<TR>
<TD class=pagehead noWrap>相关帖子</TD></TR></TBODY></TABLE>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -