Skip to content
This repository has been archived by the owner on Feb 16, 2023. It is now read-only.

Commit

Permalink
Add RAM/Archive destination setter.
Browse files Browse the repository at this point in the history
  • Loading branch information
adriweb committed Jul 29, 2017
1 parent a0e709b commit 027167a
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/TIVarFile.php
Expand Up @@ -307,6 +307,17 @@ public function setVarName($name = '')
$this->refreshMetadataFields();
}

public function setArchived($flag)
{
if ($this->calcModel->getFlags() >= TIFeatureFlags::hasFlash)
{
$this->varEntry['archivedFlag'] = ($flag === true) ? 1 : 0;
$this->refreshMetadataFields();
} else {
throw new \RuntimeException('Archived flag not supported on this calculator model');
}
}

public function getRawContent()
{
return $this->varEntry['data'];
Expand Down
4 changes: 4 additions & 0 deletions tests.php
Expand Up @@ -137,6 +137,10 @@
assert($testPrgm42->getReadableContent() == "Grande blabla:Disp \"Grande blabla");
//$testPrgm42->saveVarToFile("testData", "testMinTok_new");

$testPrgm42->setArchived(true);
assert($testPrgm42->getReadableContent() == "Grande blabla:Disp \"Grande blabla");
//$testPrgm42->saveVarToFile("testData", "testMinTok_archived_new");



$testReal = TIVarFile::loadFromFile('testData/Real.8xn'); // -42.1337
Expand Down

0 comments on commit 027167a

Please sign in to comment.