-
Notifications
You must be signed in to change notification settings - Fork 84
Support Memos for Visual FoxPro #118
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| <?php declare(strict_types=1); | ||
|
|
||
| namespace XBase\Memo\Creator; | ||
|
|
||
| use XBase\Stream\Stream; | ||
|
|
||
| class FoxProMemoCreator extends AbstractMemoCreator | ||
| { | ||
| public static function getExtension(): string | ||
| { | ||
| return 'fpt'; | ||
| } | ||
|
|
||
| protected function writeHeader(Stream $stream): void | ||
| { | ||
| $stream->write(pack('N',8)); //next block | ||
|
|
||
| $stream->seek(4); | ||
| $stream->write(str_pad('',2,chr(0))); //reserved | ||
|
|
||
| $stream->seek(6); | ||
| $stream->write(pack('n',64)); //Block size. 8 * 64 == 512, which will start records after the header | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -22,6 +22,8 @@ public static function create(Table $table) | |
| case TableType::DBASE_7_MEMO: | ||
| return new DBase7MemoCreator($table); | ||
| //todo foxpro | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should we delete this?
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The |
||
| case TableType::VISUAL_FOXPRO: | ||
| return new FoxProMemoCreator($table); | ||
| default: | ||
| throw new \Exception('Memo creator not realized for table version '.$table->getVersion()); | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,6 +5,7 @@ | |
| use XBase\DataConverter\Encoder\EncoderInterface; | ||
| use XBase\Enum\TableType; | ||
| use XBase\Table\Table; | ||
| use XBase\Memo\Creator\MemoCreatorFactory; | ||
|
|
||
| class MemoFactory | ||
| { | ||
|
|
@@ -25,7 +26,8 @@ public static function create(Table $table, EncoderInterface $encoder): ?MemoInt | |
| } | ||
| $memoFilepath = $fileInfo['dirname'].DIRECTORY_SEPARATOR.$fileInfo['filename'].$memoExt; | ||
| if (!file_exists($memoFilepath)) { | ||
| return null; //todo create file? | ||
| $memo_creator = MemoCreatorFactory::create($table); | ||
|
||
| $memo_creator->createFile(); | ||
| } | ||
|
|
||
| return $refClass->newInstance($table, $memoFilepath, $encoder); | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.