+# File Storage Administration
+
+sub ReadStorageFile {
+ my ($this,$accountName,$fileName,$position,$sliceSize,$authAccountName) = @_;
+
+ croak 'usage CGP::CLI->ReadStorageFile(accountName,fileName[,position,sliceSize[,authAccountName]])'
+ unless (defined $accountName && defined $fileName);
+ my $line='ReadStorageFile '.$accountName.' FILE '.$this->printWords($fileName);
+ $line .= ' OFFSET '. $position if(defined $position && $position!=0);
+ $line .= ' SIZE '. $sliceSize if(defined $sliceSize);
+ $line .= ' AUTH '. $authAccountName if(defined $authAccountName);
+
+ $this->send($line);
+ return undef unless $this->_parseResponse;
+ $this->parseWords($this->getWords);
+}
+
+sub WriteStorageFile {
+ my ($this,$accountName,$fileName,$data,$position,$authAccountName) = @_;
+
+ croak 'usage CGP::CLI->WriteStorageFile(accountName,fileName,data [,position[,authAccountName]])'
+ unless (defined $accountName && defined $fileName && defined $data);
+ my $line='WriteStorageFile '.$accountName.' FILE '.$this->printWords($fileName);
+ $line .= ' OFFSET '. $position if(defined $position && $position!=0);
+ if($data=~/\[.*\]$/) {
+ $line .= ' DATA '.$data;
+ } else {
+ $line .= ' DATA ['.$data.']';
+ }
+ $line .= ' AUTH '. $authAccountName if(defined $authAccountName);
+ $this->send($line);
+ $this->_parseResponse;
+}
+
+sub RenameStorageFile {
+ my ($this,$accountName,$oldFileName,$newFileName,$authAccountName) = @_;
+
+ croak 'usage CGP::CLI->RenameStorageFile(accountName,oldFileName,newFileName[,authAccountName])'
+ unless (defined $accountName && defined $oldFileName && defined $newFileName);
+ my $line='RenameStorageFile '.$accountName.' FILE '.$this->printWords($oldFileName).' INTO '.$this->printWords($newFileName);
+ $line .= ' AUTH '. $authAccountName if(defined $authAccountName);
+ $this->send($line);
+ $this->_parseResponse;
+}
+
+sub DeleteStorageFile {
+ my ($this,$accountName,$fileName,$authAccountName) = @_;
+
+ croak 'usage CGP::CLI->DeleteStorageFile(accountName,fileName[,authAccountName])'
+ unless (defined $accountName && defined $fileName);
+ my $line='DeleteStorageFile '.$accountName.' FILE '.$this->printWords($fileName);
+ $line .= ' AUTH '. $authAccountName if(defined $authAccountName);
+ $this->send($line);
+ $this->_parseResponse;
+}
+
+sub ListStorageFiles {
+ my ($this,$accountName,$filePath,$authAccountName) = @_;
+
+ croak 'usage CGP::CLI->ListStorageFiles(accountName [,filePath[,authAccountName]])'
+ unless defined $accountName;
+ my $line = 'ListStorageFiles '.$accountName;
+ $line .= ' PATH '.$this->printWords($filePath) if $filePath;
+ $line .= ' AUTH '. $authAccountName if(defined $authAccountName);
+ $this->send($line);
+ return undef unless $this->_parseResponse;
+ $this->parseWords($this->getWords);
+}
+
+sub GetStorageFileInfo {
+ my ($this,$accountName,$filePath,$authAccountName) = @_;
+
+ croak 'usage CGP::CLI->GetStorageFileInfo(accountName[,filePath[,authAccountName])'
+ unless defined $accountName;
+ my $line='GetStorageFileInfo '.$accountName;
+ $line .= ' PATH '.$this->printWords($filePath) if $filePath;
+ $line .= ' AUTH '. $authAccountName if(defined $authAccountName);
+ $this->send($line);
+
+ return undef unless $this->_parseResponse;
+ $this->parseWords($this->getWords);
+}
+
+sub ReadStorageFileAttr {
+ my ($this,$accountName,$fileName,$atributes,$authAccountName) = @_;
+
+ croak 'usage CGP::CLI->ReadStorageFileAttr(accountName,fileName[,attributes[,authAccountName]])'
+ unless (defined $accountName && defined $fileName);
+ my $line='ReadStorageFileAttr '.$accountName.' FILE '.$this->printWords($fileName);
+ $line .= $atributes if(defined $atributes);
+ $line .= ' AUTH '. $authAccountName if(defined $authAccountName);
+
+ $this->send($line);
+ return undef unless $this->_parseResponse;
+ $this->parseWords($this->getWords);
+}
+
+sub UpdateStorageFileAttr {
+ my ($this,$accountName,$fileName,$attributes,$authAccountName) = @_;
+
+ croak 'usage CGP::CLI->UpdateStorageFileAttr(accountName,fileName,attributes[,authAccountName])'
+ unless (defined $accountName && defined $fileName && defined $attributes);
+ my $line='UpdateStorageFileAttr '.$accountName.' FILE '.$this->printWords($fileName).' '.$attributes;
+ $line .= ' AUTH '. $authAccountName if(defined $authAccountName);
+ $this->send($line);
+ $this->_parseResponse;
+}
+
+sub GetFileSubscription {
+ my ($this, $accountName) = @_;
+ croak 'usage CGP::CLI->GetFileSubscription($accountName)'
+ unless defined $accountName;
+ $this->send('GetFileSubscription '.$accountName);
+ return undef unless $this->_parseResponse();
+ $this->parseWords($this->getWords);
+}
+
+sub SetFileSubscription {
+ my ($this, $accountName, $newSubscription) = @_;
+ croak 'usage CGP::CLI->SetFileSubscription($accountName, \@newSubscription)'
+ unless defined $accountName && defined $newSubscription;
+ $this->send('SetFileSubscription '.$accountName.' '.$this->printWords($newSubscription));
+ $this->_parseResponse();
+}
+
+
+#################################################################