Talstra Json Folder & Files Maker

API

Estimated reading: 2 minutes 291 views Contributors

FileManager API

The FileManager API provides functionalities to read and create files and directories from JSON content. It allows the user to specify the file or directory path and name and also provides some default options for reading and creating files and directories.

Dependencies

  • Newtonsoft.Json v12.0.3

FileManager Class

Properties

CurrentFolderPath : string

  • The current directory path.

Methods

CreateFilesFromJson(string jsonFile, bool recursive = false): void

  • Reads the JSON content from the specified file and creates the corresponding files and directories. If recursive is true, it will create directories and files recursively.

CreateFilesFromMainContentJSON(string MainContentJSON, bool isGDDIncluded, bool recursive = false): bool

  • Reads the JSON content from a string and creates the corresponding files and directories. If recursive is true, it will create directories and files recursively. If isGDDIncluded is true, it will also save a GDDTemplate.docx file to the directory. Returns true if the operation is successful, false otherwise.

ReadFromJson(string jsonFile): string

  • Reads the JSON content from the specified file and returns it as a string.

SaveResourceToDisk(string resourceName, string destinationPath): void

  • Saves the specified resource file to the specified directory path.

GetDirectoryPath(string filePath): string

  • Returns the directory path of the specified file path.

CreateExampleJson(): string

  • Returns an example JSON string.

IsValidJsonString(string jsonString): bool

  • Checks if the specified string is a valid JSON string.

OpenDialogue(FileFilter filter): string

  • Opens a file dialog or folder dialog depending on the filter parameter and returns the selected file path or folder path.

SaveJsonToFile(string MainContent): string

  • Opens a save file dialog and saves the specified string to a file with the selected name and location. Returns the selected file path.

Enums

FileFilter

  • Specifies the filter options for the OpenDialogue method.
  • Folder – Allows the selection of a folder.
  • Json – Allows the selection of a JSON file.
  • All – Allows the selection of any file.
Share this Doc

API

Or copy link

CONTENTS

Chat Icon Close Icon