本文整理汇总了C#中IDataWriter.close方法的典型用法代码示例。如果您正苦于以下问题:C# IDataWriter.close方法的具体用法?C# IDataWriter.close怎么用?C# IDataWriter.close使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IDataWriter
的用法示例。
在下文中一共展示了IDataWriter.close方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: convert
public classResult convert()
{
bool bIsError = false;
int dataType;
int dataSize;
byte[] mp3Data;
byte[] data;
result_ = new classResult();
result_.flvfile = flvFile_;
if (!File.Exists(flvFile_))
{
result_.errorno = ERROR_NO.NOEXISTFILE;
return result_;
}
FileInfo mp3FileInfo = new FileInfo(mp3File_);
if (!Directory.Exists(mp3FileInfo.DirectoryName))
{
//�f�B���N�g�����Ȃ��̂Ȃ�������̂�
mp3FileInfo.Directory.Create();
}
reader_ = (IDataReader)classDataReader.open(flvFile_, readMode_);
writer_ = (IDataWriter)classDataWriter.open(mp3File_, writeMode_);
// header
// FLV�t�@�C��������
mp3Data = reader_.read(3);
if (Encoding.ASCII.GetString(mp3Data).ToLower() != "flv")
{
result_.errorno = ERROR_NO.NOTFLVFILE;
bIsError = true;
}
if (!bIsError)
{
mp3Data = reader_.read(6);
try
{
while (reader_.eof)
{
// previous tag size(4)
data = reader_.read(4);
// DataType(1)
data = reader_.read(1);
if (data.Length != 1)
{
//result_.errorno = ERROR_NO.CONVERTERROR;
//bIsError = true;
break;
}
dataType = (int)data[0];
// DataSize(3)
data = reader_.read(3);
if (data.Length != 3)
{
//result_.errorno = ERROR_NO.CONVERTERROR;
//bIsError = true;
break;
}
dataSize = (int)data[0] * 0x10000 + (int)data[1] * 0x100 + (int)data[2];
Debug.WriteLine("classFLV2MP3::convert() data[0,1,2] = [" + Convert.ToString(data[0], 16) + "," + Convert.ToString(data[1], 16) + "," + Convert.ToString(data[2], 16) + "]: dataSize = " + Convert.ToString(dataSize, 16));
// time stamp(3),time stamp extended(1), stream id(3)
// �ǂݔ��
data = reader_.read(7);
//Debug.WriteLine("classFLV2MP3::convert() dataType = " + Convert.ToString(dataType, 16) + " : dataSize = " + Convert.ToString(dataSize, 16));
switch (dataType)
{
case 8: // Audio Data
// Audio Info(1)
mp3Data = reader_.read(1);
// mp3data
writer_.write(reader_.read(dataSize - 1));
break;
case 9: // Video Data
case 18: // META
default:
data = reader_.read(dataSize);
break;
}
}
}
catch (NullReferenceException e)
{
Console.WriteLine(e.Message);
}
}
if (!bIsError)
{
writer_.flush();
writer_.close();
reader_.close();
//.........这里部分代码省略.........