2 * FryingPan - Amiga CD/DVD Recording Software (User Interface and supporting Libraries only)
3 * Copyright (C) 2001-2011 Tomasz Wiszkowski Tomasz.Wiszkowski at gmail.com
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public License
7 * as published by the Free Software Foundation; either version 2.1
8 * of the License, or (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU Lesser General Public License for more details.
15 * You should have received a copy of the GNU Lesser General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20 #include "FileWriter.h"
21 #include <libclass/dos.h>
22 #include <Optical/Optical.h>
23 #include <LibC/LibC.h>
24 #include <libclass/utility.h>
26 FileWriter::FileWriter(const char* sFName
, EDtError
&rc
)
33 fh
= DOS
->Open(const_cast<char*>(getFileName()), MODE_NEWFILE
);
35 rc
= DT_UnableToOpenFile
;
40 FileWriter::~FileWriter()
44 BPTR
FileWriter::getFile()
49 const char* FileWriter::getFileName()
51 return sFileName
.Data();
54 bool FileWriter::writeData(void* buffer
, int len
)
69 short *b
= (short*)buffer
;
76 *b
= ((*b
&0xff00)>>8)|((*b
&0xff)<<8);
82 k
= DOS
->Write(fh
, buffer
, len
*sectorSize
)/sectorSize
;
90 void FileWriter::setLittleEndian(bool isLittle
)
95 bool FileWriter::setUp()
103 void FileWriter::cleanUp()
109 const char *FileWriter::getTrackName()
111 return getFileName();
114 void FileWriter::dispose()
119 unsigned short FileWriter::getBlockSize()
124 unsigned long FileWriter::getBlockCount()
129 void FileWriter::setBlockSize(unsigned short size
)
134 void FileWriter::setBlockCount(unsigned long count
)
139 void FileWriter::deleteFiles()
145 DOS
->DeleteFile((char*)getFileName());