| LicenseSpring .Net SDK 8.1.0 Easily add Software Licensing to your application

Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | Properties | List of all members
LicenseSpring.LicenseFileStorage Class Reference

Class that saves license in a file, implements `ILicenseStorage` interface. More...

Inheritance diagram for LicenseSpring.LicenseFileStorage:

## Public Member Functions
virtual void | Clear ()
| Removes local license data.
string | LicenseFilePath ()
| Returns full path to the license file.
| LicenseFileStorage ()
| LicenseFileStorage constructor.
| LicenseFileStorage (string licenseFilePath=null)
| LicenseFileStorage constructor.
virtual string | LoadLicense ()
| Load license from file.
virtual void | SaveLicense (string licenseData)
| Saves given license data string to the file.

## Protected Member Functions
void | DeleteFile ()
| Delete license file.
string | LoadFromFile ()
| Read string data from the file.
void | SaveToFile (string data)
| Write string data to the file.

## Properties
string | LicenseFileName`[get, set]`
| License filename with extension (optional)
string | LicenseFolderPath`[get, set]`
| Folder path where License file is being stored.

## Detailed Description

Class that saves license in a file, implements `ILicenseStorage` interface.

This is the default license storage type.

File operations of this class is thread safe.

If you intend to access the same local license from multiple processes simultaneously, set `ExtendedOptions.EnableProcessSafety = true` and use this default storage. The SDK then serializes cross-process reads and writes at the transaction layer and applies atomic read-modify-write to avoid lost updates. This supersedes the obsolete `LicenseFileStorageEx`.

## Constructor & Destructor Documentation

## ◆ LicenseFileStorage()

LicenseSpring.LicenseFileStorage.LicenseFileStorage | ( | string | licenseFilePath = `null` | ) |

LicenseFileStorage constructor.

Parameters

  licenseFilePath | Optional argument, path to the license file

## Member Function Documentation

## ◆ Clear()

virtual void LicenseSpring.LicenseFileStorage.Clear | ( |  | ) |
| virtual

Removes local license data.

Implements LicenseSpring.ILicenseStorage.

Reimplemented in LicenseSpring.LicenseFileStorageEx.

## ◆ LicenseFilePath()

string LicenseSpring.LicenseFileStorage.LicenseFilePath | ( |  | ) |

Returns full path to the license file.

Returns
  Absolute path to the license file

## ◆ LoadFromFile()

string LicenseSpring.LicenseFileStorage.LoadFromFile | ( |  | ) |
| protected

Read string data from the file.

Returns
  File content as a Latin-1-packed byte container string

## ◆ LoadLicense()

virtual string LicenseSpring.LicenseFileStorage.LoadLicense | ( |  | ) |
| virtual

Load license from file.

Returns
  Ecrypted license data

Implements LicenseSpring.ILicenseStorage.

Reimplemented in LicenseSpring.LicenseFileStorageEx.

## ◆ SaveLicense()

virtual void LicenseSpring.LicenseFileStorage.SaveLicense | ( | string | licenseData | ) |
| virtual

Saves given license data string to the file.

Parameters

  licenseData | License data string

Implements LicenseSpring.ILicenseStorage.

Reimplemented in LicenseSpring.LicenseFileStorageEx.

## ◆ SaveToFile()

void LicenseSpring.LicenseFileStorage.SaveToFile | ( | string | data | ) |
| protected

Write string data to the file.

Parameters

  data | Data to save. Treated as a transparent byte container (Latin-1 packed) — the file is written verbatim in binary mode without text encoding or BOM.

## Property Documentation

## ◆ LicenseFileName

string LicenseSpring.LicenseFileStorage.LicenseFileName
| get set

License filename with extension (optional)

Default filename is License.key

## ◆ LicenseFolderPath

string LicenseSpring.LicenseFileStorage.LicenseFolderPath
| get set

Folder path where License file is being stored.

Default folder path is Environment.SpecialFolder.LocalApplicationData/LicenseSpring/{ProductCode}

The documentation for this class was generated from the following file:

- LicenseFileStorage.cs