diff --git a/README.md b/README.md
index da2c343..7ff4d0f 100644
--- a/README.md
+++ b/README.md
@@ -1,26 +1,26 @@
# Warning : Use this tool at your own risks, nobody can be taken as responsible if it damage your calculator !!!
-# Usage
+## Usage
The buttons are actually diconnected, if you want to test, dive through the code.
-# Things to change
+## Things to change
- Have a more js-like code approach !
-# Actual possibilities
+## Actual possibilities
- You can send files to flash memory (at least fls0, but maybe crd0 too), but only below ~1.5 ko (it freezes beyond, will patch this later)
- You can list files, make directories, remove directories etc...
- you can optimize your flash
- you can get your device infos
-# Future possibilities
+## Future possibilities
- Make a user friendly interface
- Support all p7 protocol's commands
- Screen casting ? (not a usb but a graphic difficulty)
- other stuffs
-# Thanks to :
+## Thanks to :
- Simon Lothar for his fx-reverse doc
- Cakeisalie5 for his p7 command line tool
\ No newline at end of file
diff --git a/commands.js b/commands.js
new file mode 100644
index 0000000..f331d39
--- /dev/null
+++ b/commands.js
@@ -0,0 +1,50 @@
+(function () {
+ /* ---------------------Single commands--------------------- */
+
+ /* Create a directory */
+ p7.commands.createDirectory = async (name, fileSystem) => await p7.send.singleCommand(flashCommandSubtype.createDirectory, 0, 0, [name, '', '', '', fileSystem, '']);
+
+ /* Delete a directory */
+ p7.commands.deleteDirectory = async (name, fileSystem) => await p7.send.singleCommand(flashCommandSubtype.deleteDirectory, 0, 0, [name, '', '', '', fileSystem, '']);
+
+ /* Rename a directory */
+ p7.commands.renameDirectory = async (oldName, newName, fileSystem) => await p7.send.singleCommand(flashCommandSubtype.renameDirectory, 0, 0, [oldName, newName, '', '', fileSystem, '']);
+
+ /* Change working directory */
+ p7.commands.changeDirectory = async (name, fileSystem) => await p7.send.singleCommand(flashCommandSubtype.changeDirectory, 0, 0, [name, '', '', '', fileSystem, '']);
+
+ /* Delete a file */
+ p7.commands.deleteFile = async (directory, name, fileSystem) => await p7.send.singleCommand(flashCommandSubtype.deleteFile, 0, 0, [directory, name, '', '', fileSystem, '']);
+
+ /* Rename a file */
+ p7.commands.renameFile = async (directory, oldName, newName, fileSystem) => await p7.send.singleCommand(flashCommandSubtype.renameFile, 0, 0, [directory, oldName, newName, '', fileSystem, '']);
+
+ /* Copy a file */
+ p7.commands.copyFile = async (oldDirectory, oldName, newDirectory, newName, fileSystem) => await p7.send.singleCommand(flashCommandSubtype.copyFile, 0, 0, [oldDirectory, oldName, newDirectory, newName, fileSystem, '']);
+
+ /* Optimize fileSystem */
+ p7.commands.optimizeFileSystem = async (fileSystem) => await p7.send.singleCommand(flashCommandSubtype.optimizeFileSystem, 0, 0, ['', '', '', '', fileSystem, '']);
+
+ /* ---------------------Single command requests--------------------- */
+
+ /* List files */
+ p7.commands.list = async function (fileSystem) {
+ let fileList = [];
+
+ try {
+ (await p7.send.singleCommandRoleswap(flashCommandSubtype.fileInfoTransferAllRequest, 0, 0, ['', '', '', '', fileSystem, '']))
+ .forEach(element =>
+ fileList.push({
+ size: element.fileSize,
+ DirectoryName: element.data[0],
+ name: element.data[1]
+ })
+ );
+ } catch (err) {
+ throw new Error("Couldn't list files: " + err.message);
+ }
+
+ return fileList;
+ }
+
+}) ();
\ No newline at end of file
diff --git a/const.js b/const.js
index 341e118..7396536 100644
--- a/const.js
+++ b/const.js
@@ -60,7 +60,7 @@ const flashCommandSubtype = {
'fileInfoTransfer': 0x4E,
'flashImageTransferRequest': 0x4F,
'flashImageTransfer': 0x50,
- 'optimizeFilesystem': 0x51
+ 'optimizeFileSystem': 0x51
// 'osUpdateRelated': [0x52 --> 0x57] ?
};
diff --git a/index.html b/index.html
index 16cf759..77a49fe 100644
--- a/index.html
+++ b/index.html
@@ -16,6 +16,7 @@
+