mirror of
https://github.com/Ragora/T2-BoL.git
synced 2026-01-20 03:24:47 +00:00
67 lines
1.1 KiB
C#
67 lines
1.1 KiB
C#
// -----------------------------------------------------
|
|
// Basic file functions
|
|
// -----------------------------------------------------
|
|
function getFileBuffer(%file)
|
|
{
|
|
if (!IsFile(%file))
|
|
return "Not existant.";
|
|
|
|
new FileObject(FileBuffer);
|
|
FileBuffer.openForRead(%file);
|
|
|
|
while (!FileBuffer.isEOF())
|
|
{
|
|
%buffer = FileBuffer.readLine() @ "\n";
|
|
}
|
|
FileBuffer.detach();
|
|
return %buffer; //Long string. >.>
|
|
}
|
|
|
|
function getLine(%file, %line)
|
|
{
|
|
if (!IsFile(%file))
|
|
return "Not existant.";
|
|
|
|
new FileObject(FileLine);
|
|
FileLine.openForRead(%file);
|
|
|
|
for (%i = 0; %i < %line; %i++)
|
|
{
|
|
%line = FileLine.readLine();
|
|
}
|
|
FileLine.detach();
|
|
|
|
return %line;
|
|
}
|
|
|
|
function getLine(%file, %line)
|
|
{
|
|
if (!IsFile(%file))
|
|
return "Not existant.";
|
|
|
|
new FileObject(FileLine);
|
|
FileLine.openForRead(%file);
|
|
|
|
for (%i = 0; %i < %line; %i++)
|
|
{
|
|
%line = FileLine.readLine();
|
|
}
|
|
FileLine.detach();
|
|
|
|
return %line;
|
|
}
|
|
|
|
// -----------------------------------------------------
|
|
// Bound Functions
|
|
// -----------------------------------------------------
|
|
function fileObject::Detach(%this) //Detaches fileObject from file & deletes
|
|
{
|
|
%this.close();
|
|
%this.delete();
|
|
return %this;
|
|
}
|
|
|
|
|
|
|
|
|