using System;
using SystemIO;
using SystemText;
namespace WAV
{
/// <summary>
/// Summary description for Wav
/// </summary>
public class Wav
{public Wav()
{//
// TODO: Add constructor logic here
//
}
[STAThread]
static void Main(string[] args)
{
//
// TODO: Add code to start application here
//
string strpath=@C:\Documents and Settings\Administrator\桌面\trojan\怀念战友wav;//=@F:\Music;
if(argsLength>)
{strpath=args[]Trim();
}
if(FileExists(strpath))
{GetWavInfo(strpath);
ConsoleWriteLine(GetWavInfo Successfully!);
//ConsoleWriteLine();
}
else
{ConsoleWrite(Please Enter the write filepath!\n);
ConsoleWrite(用法: WAV [Full Path Of Your WAV filepath]);
}
}
public struct WavInfo
{public string groupid;
public string rifftype;
public long filesize;
public string chunkid;
public long chunksize;
public short wformattag; //记录着此声音的格式代号例如WAVE_FORMAT_PCMWAVE_FRAM_ADPCM等等
public ushort wchannels; //记录声音的频道数
public ulongdwsamplespersec;//记录每秒取样数
public ulongdwavgbytespersec;//记录每秒的数据量
public ushort wblockalign;//记录区块的对齐单位
public ushort wbitspersample;//记录每个取样所需的位元数
public string datachunkid;
public long datasize;
}
public static void GetWavInfo(string strpath)
{
WavInfo wavInfo = new WavInfo();
FileInfo fi = new FileInfo(strpath);
SystemIOFileStream fs=fiOpenRead();
if(fsLength>=)
{
byte[] bInfo=new byte[];
fsRead(bInfo);
SystemTextEncodingDefaultGetString(bInfo);
if(SystemTextEncodingDefaultGetString(bInfo)==RIFF&&SystemTextEncodingDefaultGetString(bInfo)==WAVE&&SystemTextEncodingDefaultGetString(bInfo)==fmt )
{
wavInfogroupid = SystemTextEncodingDefaultGetString(bInfo);
SystemBitConverterToInt(bInfo);
wavInfofilesize = SystemBitConverterToInt(bInfo);
//wavInfofilesize = ConvertToInt(SystemTextEncodingDefaultGetString(bInfo));
wavInforifftype = SystemTextEncodingDefaultGetString(bInfo);
wavInfochunkid = SystemTextEncodingDefaultGetString(bInfo);
wavInfochunksize = SystemBitConverterToInt(bInfo);
wavInfowformattag = SystemBitConverterToInt(bInfo);
wavInfowchannels = SystemBitConverterToUInt(bInfo);
wavInfodwsamplespersec = SystemBitConverterToUInt(bInfo);
wavInfodwavgbytespersec = SystemBitConverterToUInt(bInfo);
wavInfowblockalign = SystemBitConverterToUInt(bInfo);
wavInfowbitspersample = SystemBitConverterToUInt(bInfo);
wavInfodatachunkid = SystemTextEncodingDefaultGetString(bInfo);
wavInfodatasize = SystemBitConverterToInt(bInfo);
SystemConsoleWriteLine(groupid:+wavInfogroupid);
SystemConsoleWriteLine(filesize:+wavInfofilesize);
SystemConsoleWriteLine(rifftype:+wavInforifftype);
SystemConsoleWriteLine(chunkid:+wavInfochunkid);
SystemConsoleWriteLine(chunksize:+wavInfochunksize);
SystemConsoleWriteLine(wformattag:+wavInfowformattag);
SystemConsoleWriteLine(wchannels:+wavInfowchannels);
SystemConsoleWriteLine(dwsamplespersec:+wavInfodwsamplespersec);
SystemConsoleWriteLine(dwavgbytespersec:+wavInfodwavgbytespersec);
SystemConsoleWriteLine(wblockalign:+wavInfowblockalign);
SystemConsoleWriteLine(wbitspersample:+wavInfowbitspersample);
SystemConsoleWriteLine(datachunkid:+wavInfodatachunkid);
SystemConsoleWriteLine(datasize:+wavInfodatasize);
}
}
}
}
}