Ignore:
Timestamp:
Apr 7, 2020, 10:15:48 PM (4 years ago)
Author:
chronos
Message:
  • Modified: Improved code formatting.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/includes/FileStream.php

    r815 r880  
    1515  function __destruct()
    1616  {
    17     if($this->Handle)
     17    if ($this->Handle)
    1818      fclose($this->Handle);
    1919  }
     
    2424    $this->CloseFile();
    2525    $this->Handle = fopen($FileName, 'rb');
    26     if(!$this->Handle) die(str_replace('%s', $FileName, FILE_NOT_FOUND));
     26    if (!$this->Handle) die(str_replace('%s', $FileName, FILE_NOT_FOUND));
    2727  }
    2828
     
    3232    $this->CloseFile();
    3333    $this->Handle = fopen($FileName, 'wb+');
    34     if(!$this->Handle) die(str_replace('%s', $FileName, FILE_NOT_FOUND));
     34    if (!$this->Handle) die(str_replace('%s', $FileName, FILE_NOT_FOUND));
    3535  }
    3636
    3737  public function CloseFile()
    3838  {
    39     if($this->Handle)
     39    if ($this->Handle)
    4040      fclose($this->Handle);
    4141  }
     
    4343  public function ReadBlock($Count)
    4444  {
    45     return(fread($this->Handle, $Count));
     45    return fread($this->Handle, $Count);
    4646  }
    4747
    4848  public function ReadByte()
    4949  {
    50     return(fread($this->Handle, 1));
     50    return fread($this->Handle, 1);
    5151  }
    5252
     
    5454  {
    5555    $val = unpack('V*', fread($this->Handle, 4));
    56     return($val[1]);
     56    return $val[1];
    5757  }
    5858
     
    6060  {
    6161    $val = unpack('I*', fread($this->Handle, 4));
    62     return($val[1]);
     62    return $val[1];
    6363  }
    6464
     
    6666  {
    6767    $val = unpack('f*', fread($this->Handle, 4));
    68     return($val[1]);
     68    return $val[1];
    6969  }
    7070
    7171  public function ReadChar()
    7272  {
    73     return(fread($this->Handle, 1));
     73    return fread($this->Handle, 1);
    7474  }
    7575
    7676  public function ReadLine()
    7777  {
    78     return(fgets($this->Handle));
     78    return fgets($this->Handle);
    7979  }
    8080
    8181  public function ReadTextLine()
    8282  {
    83     return(fgets($this->Handle));
     83    return fgets($this->Handle);
    8484  }
    8585
     
    131131  public function GetPosition()
    132132  {
    133     return(ftell($this->Handle));
     133    return ftell($this->Handle);
    134134  }
    135135
    136136  public function GetSize()
    137137  {
    138     return(filesize($this->FileName));
     138    return filesize($this->FileName);
    139139  }
    140140
    141141  public function SetSize($Size)
    142142  {
    143     return(ftruncate($this->Handle, $Size));
     143    return ftruncate($this->Handle, $Size);
    144144  }
    145145
    146146  public function EOF()
    147147  {
    148     return(feof($this->Handle));
     148    return feof($this->Handle);
    149149  }
    150150}
Note: See TracChangeset for help on using the changeset viewer.