BGC Tools
Static Public Member Functions | Static Private Attributes
BGC.Utility.ReservedFiles Class Reference
Collaboration diagram for BGC.Utility.ReservedFiles:
Collaboration graph
[legend]

Static Public Member Functions

static bool ReserveFile (string path)
 Reserve a file so other processes won't use them More...
 
static bool UnReserveFile (string path)
 UnReserve a file if found More...
 
static bool IsFileReserved (string path)
 Returns if the path is currently reserved More...
 

Static Private Attributes

static HashSet< string > files = new HashSet<string>()
 

Detailed Description

Definition at line 6 of file ReservedFiles.cs.

Member Function Documentation

◆ IsFileReserved()

static bool BGC.Utility.ReservedFiles.IsFileReserved ( string  path)
inlinestatic

Returns if the path is currently reserved

Parameters
path
Returns
True if the file is reserved, false if not

Definition at line 47 of file ReservedFiles.cs.

48  {
49  return files.Contains(path);
50  }
static HashSet< string > files
Definition: ReservedFiles.cs:8

◆ ReserveFile()

static bool BGC.Utility.ReservedFiles.ReserveFile ( string  path)
inlinestatic

Reserve a file so other processes won't use them

Parameters
path
Returns
True if the file was succesfully reserved

Definition at line 15 of file ReservedFiles.cs.

16  {
17  if (files.Contains(path) == false)
18  {
19  files.Add(path);
20  return true;
21  }
22 
23  return false;
24  }
static HashSet< string > files
Definition: ReservedFiles.cs:8

◆ UnReserveFile()

static bool BGC.Utility.ReservedFiles.UnReserveFile ( string  path)
inlinestatic

UnReserve a file if found

Parameters
path
Returns
True if hte file was found and removed

Definition at line 31 of file ReservedFiles.cs.

32  {
33  if (files.Contains(path))
34  {
35  files.Remove(path);
36  return true;
37  }
38 
39  return false;
40  }
static HashSet< string > files
Definition: ReservedFiles.cs:8

Field Documentation

◆ files

HashSet<string> BGC.Utility.ReservedFiles.files = new HashSet<string>()
staticprivate

Definition at line 8 of file ReservedFiles.cs.


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