This class is subject to change. Programs using this class may require changes with a new version of VirtualLab.
Class providing support methods for loading & importing of files.
More...
|
| static string | AddExtension (string fileName, string extension) |
| | Adds an extension to the given file name. More...
|
| |
| static string | AppendDateTimeToFileName (string fileName) |
| | Appends the date and the time to the end of the given file name. More...
|
| |
| static IStorableOnHDD | GenericLoad (string fileName, out ListOfSavedViewSettings viewSettings) |
| | Loads an object from HDD. More...
|
| |
| static Bitmap | GetImageForDocumentType (DocumentType documentType) |
| | Gets the type of the image matching the given document type. More...
|
| |
| static void | ImportAndShowFile (string fileName, DocumentType? documentType=null) |
| | Method to import various file types and show the imported data as new document. This method is not thread-safe. More...
|
| |
| static bool | IsDoumentsWithoutViewSettingsSaveMechanism (Type typeOfFormDcoument) |
| | Method which defined which types of document windows shall not use the saving algorithm for view settings More...
|
| |
| static IDocument | LoadDocument (string fileName) |
| | Loads a document, but not the corresponding view settings. More...
|
| |
| static IDocument | LoadDocument (string fileName, out ListOfSavedViewSettings viewSettings) |
| | Loads a document. More...
|
| |
| static FormDocument | LoadDocument_GUISupport (string fileName, string documentName="", bool addToRecentFileList=true) |
| | Loads a document to the GUI. This method does the following steps: More...
|
| |
| static string | MakeFileNameValid (string fileName) |
| | Makes the given file name valid, i.e. all characters not allowed in file names are replaced by an underscore. More...
|
| |
| static void | OpenFolderInExplorer (string folder) |
| | Opens the given folder in Windows File Explorer. More...
|
| |
| static void | SaveCompressed (IStorableOnHDD documentToSave, string filePath, ListOfSavedViewSettings viewSettings=null) |
| | Saves the given file as a zip file. More...
|
| |
This class is subject to change. Programs using this class may require changes with a new version of VirtualLab.
Class providing support methods for loading & importing of files.
◆ AddExtension()
| static string AddExtension |
( |
string |
fileName, |
|
|
string |
extension |
|
) |
| |
|
static |
Adds an extension to the given file name.
- Parameters
-
| fileName | The file name. |
| extension | The extension. |
- Returns
- The file name with the added extension. If the extension does not contain a leading period (.), a period is added. In contrast to Path.ChangeExtension, "filename.3" + ".ext" becomes "filename.3.ext", not "filename.ext". If the file name already ends with the given extension, it is not added anew.
◆ AppendDateTimeToFileName()
| static string AppendDateTimeToFileName |
( |
string |
fileName | ) |
|
|
static |
Appends the date and the time to the end of the given file name.
- Parameters
-
| fileName | The file name including path and extension. |
- Returns
- The altered file name with the date and time added in brackets and in ISO format, e.g. (C:\myfile (2018-11-09T134257).txt").
◆ GenericLoad()
| static IStorableOnHDD GenericLoad |
( |
string |
fileName, |
|
|
out ListOfSavedViewSettings |
viewSettings |
|
) |
| |
|
static |
Loads an object from HDD.
- Parameters
-
| fileName | The file name of the object to load. It is checked whether the file exists and whether the extension of that file is a supported document type of VirtualLab. |
| viewSettings | Out parameter to return the view settings (e.g. size of the document window) saved together with the actual document. |
- Returns
- The loaded document. Can be
null if no view settings were stored alongside the actual object.
◆ GetImageForDocumentType()
| static Bitmap GetImageForDocumentType |
( |
DocumentType |
documentType | ) |
|
|
static |
Gets the type of the image matching the given document type.
- Parameters
-
| documentType | The document type for which the matching image shall be returned. |
- Returns
- Retrieves the correct image matching the given document type.
- Exceptions
-
| System.ArgumentException | No suitable image could be found for the given document type. |
◆ ImportAndShowFile()
| static void ImportAndShowFile |
( |
string |
fileName, |
|
|
DocumentType? |
documentType = null |
|
) |
| |
|
static |
Method to import various file types and show the imported data as new document. This method is not thread-safe.
- Parameters
-
| fileName | The full name including the path of the file to be imported. |
| documentType | Optional parameter to indicate that the import shall be done into a specific document type. Currently used to indicate that bitmaps shall be imported into a ChromaticFieldSset instead of a HarmonicFieldsSet. |
- Exceptions
-
| FileLoadException | File format unsupported |
◆ IsDoumentsWithoutViewSettingsSaveMechanism()
| static bool IsDoumentsWithoutViewSettingsSaveMechanism |
( |
Type |
typeOfFormDcoument | ) |
|
|
static |
Method which defined which types of document windows shall not use the saving algorithm for view settings
- Parameters
-
| typeOfFormDcoument | The type of the corresponding document window. |
- Returns
True for IFTA Optimization and module documents as these do not support the view settings mechanism.
◆ LoadDocument() [1/2]
| static IDocument LoadDocument |
( |
string |
fileName | ) |
|
|
static |
Loads a document, but not the corresponding view settings.
- Parameters
-
| fileName | The file name of the document to load. It is checked whether the file exists and whether the extension of that file is a supported document type of VirtualLab. |
- Returns
- The loaded document.
◆ LoadDocument() [2/2]
| static IDocument LoadDocument |
( |
string |
fileName, |
|
|
out ListOfSavedViewSettings |
viewSettings |
|
) |
| |
|
static |
Loads a document.
- Parameters
-
| fileName | The file name of the document to load. It is checked whether the file exists and whether the extension of that file is a supported document type of VirtualLab. |
| viewSettings | Out parameter to return the view settings (e.g. size of the document window) saved together with the actual document. |
- Returns
- The loaded document.
◆ LoadDocument_GUISupport()
| static FormDocument LoadDocument_GUISupport |
( |
string |
fileName, |
|
|
string |
documentName = "", |
|
|
bool |
addToRecentFileList = true |
|
) |
| |
|
static |
Loads a document to the GUI. This method does the following steps:
-
Enable the hour glass cursor.
-
Load the file.
-
Add the file to the "Recent Files" list.
-
Displays the document window (including the loaded view settings, if applicable)
-
Disable the hourglass cursor.
- Parameters
-
| fileName | The file name of the document to load. It is checked whether the file exists and whether the extension of that file is a supported document type of VirtualLab. |
| documentName | If this optional parameter is specified it gives the caption of the document. Otherwise the file name is used to this end. |
| addToRecentFileList | By default the loaded document is added to the list of recently used files. However if you set this optional parameter to false, this is not the case. |
- Returns
- The shown document window.
- Exceptions
-
| ArgumentException | No main form is given. |
◆ MakeFileNameValid()
| static string MakeFileNameValid |
( |
string |
fileName | ) |
|
|
static |
Makes the given file name valid, i.e. all characters not allowed in file names are replaced by an underscore.
- Parameters
-
| fileName | The file name to make valid. |
- Returns
- The changed file name.
◆ OpenFolderInExplorer()
| static void OpenFolderInExplorer |
( |
string |
folder | ) |
|
|
static |
Opens the given folder in Windows File Explorer.
- Parameters
-
| folder | The folder to open. |
◆ SaveCompressed()
| static void SaveCompressed |
( |
IStorableOnHDD |
documentToSave, |
|
|
string |
filePath, |
|
|
ListOfSavedViewSettings |
viewSettings = null |
|
) |
| |
|
static |
Saves the given file as a zip file.
- Parameters
-
| documentToSave | The document to save. |
| filePath | The file path under which the document shall be saved. |
| viewSettings | If this optional parameter is set, the given view settings are also stored in the compressed file. |