NTP Analyzer  0.8.2
Analyze the operation of time servers
Ntp.Analyzer.Export.FileSystemDestination Class Reference
Inheritance diagram for Ntp.Analyzer.Export.FileSystemDestination:
Collaboration diagram for Ntp.Analyzer.Export.FileSystemDestination:

Static Public Attributes

static uint FileGroupId = null
 
static uint FileMask = 644
 
static uint FileUserId = null
 

Static Protected Member Functions

static void ApplyPermissions (string file, LogBase log)
 
static string JoinPath (string path1, string path2)
 
static string JoinPath (string path1, string path2, string path3)
 
static void PrepareFile (string file, LogBase log)
 
static void TestFile (string file, string content)
 
static void WriteFile (Stream stream, string file, LogBase log)
 

Static Private Member Functions

static string ScrubPath (string path)
 

Additional Inherited Members

- Public Member Functions inherited from Ntp.Analyzer.Export.StreamDestination
abstract void Test ()
 
abstract void Write (Stream stream, LogBase log)
 
- Public Attributes inherited from Ntp.Analyzer.Export.StreamDestination
string ConfigName => null
 StreamDestinations never has a name. Always return null. More...
 
- Properties inherited from Ntp.Analyzer.Export.StreamDestination
abstract string AbsoluteLocation [get]
 
abstract string Link [get]
 
abstract string Location [get]
 
string Param [get, set]
 
abstract string Value [get]
 
- Properties inherited from Ntp.Analyzer.Interface.IConfigurationNode
string ConfigName [get]
 

Detailed Description

Definition at line 30 of file FileSystemDestination.cs.

Member Function Documentation

static void Ntp.Analyzer.Export.FileSystemDestination.ApplyPermissions ( string  file,
LogBase  log 
)
inlinestaticprotected

Definition at line 36 of file FileSystemDestination.cs.

References Ntp.Common.IO.Permission.ChangeFileMode(), Ntp.Common.IO.Permission.ChangeFileOwner(), and e.

37  {
38  if (FileUserId != null)
39  {
40  try
41  {
43  {
44  log.DestinationOwnerError(file);
45  }
46  }
47  catch (Exception e)
48  {
49  log.DestinationOwnerError(file, e);
50  }
51  }
52 
53  try
54  {
56  {
57  log.DestinationPermissionError(file);
58  }
59  }
60  catch (Exception e)
61  {
62  log.DestinationPermissionError(file, e);
63  }
64  }
static bool ChangeFileMode(string file, uint mode)
Definition: Permission.cs:29
var e
Definition: bootstrap.min.js:6
static bool ChangeFileOwner(string file, uint user, uint?group)
Definition: Permission.cs:39

Here is the call graph for this function:

static string Ntp.Analyzer.Export.FileSystemDestination.JoinPath ( string  path1,
string  path2 
)
inlinestaticprotected

Definition at line 66 of file FileSystemDestination.cs.

References a, b, and c.

67  {
68  string a = path1 ?? string.Empty;
69  string b = path2 ?? string.Empty;
70 
71  a = a.TrimEnd(Path.DirectorySeparatorChar).TrimEnd(Path.AltDirectorySeparatorChar);
72  b = b.TrimStart(Path.DirectorySeparatorChar).TrimStart(Path.AltDirectorySeparatorChar);
73 
74  string c = string.Concat(a, Path.DirectorySeparatorChar, b);
75  return ScrubPath(c);
76  }
function a
Definition: bootstrap.min.js:6
var c
Definition: bootstrap.min.js:6
var b
Definition: bootstrap.min.js:6
static string Ntp.Analyzer.Export.FileSystemDestination.JoinPath ( string  path1,
string  path2,
string  path3 
)
inlinestaticprotected

Definition at line 78 of file FileSystemDestination.cs.

79  {
80  return JoinPath(JoinPath(path1, path2), path3);
81  }
static string JoinPath(string path1, string path2)
static void Ntp.Analyzer.Export.FileSystemDestination.PrepareFile ( string  file,
LogBase  log 
)
inlinestaticprotected

Definition at line 83 of file FileSystemDestination.cs.

References Ntp.Common.IO.DirectoryCommand.CreateRecursiveFromFile(), e, and Ntp.Common.Log.File.

84  {
85  string created = null;
86  try
87  {
89  }
90  catch (Exception e)
91  {
92  log.DestinationPathError(file, e);
93  }
94 
95  if (created != null)
96  {
97  log.DestinationNewDirectory(created);
98  }
99 
100  if (File.Exists(file))
101  File.Delete(file);
102  }
static string CreateRecursiveFromFile(string file)
var e
Definition: bootstrap.min.js:6

Here is the call graph for this function:

static string Ntp.Analyzer.Export.FileSystemDestination.ScrubPath ( string  path)
inlinestaticprivate

Definition at line 128 of file FileSystemDestination.cs.

129  {
130  return path.Trim().
131  Replace(Path.AltDirectorySeparatorChar, Path.DirectorySeparatorChar);
132  }
static void Ntp.Analyzer.Export.FileSystemDestination.TestFile ( string  file,
string  content 
)
inlinestaticprotected

Definition at line 104 of file FileSystemDestination.cs.

References Ntp.Common.Log.File.

105  {
106  if (File.Exists(file))
107  File.Delete(file);
108 
109  File.WriteAllText(file, content);
110  File.Delete(file);
111  }
static void Ntp.Analyzer.Export.FileSystemDestination.WriteFile ( Stream  stream,
string  file,
LogBase  log 
)
inlinestaticprotected

Definition at line 113 of file FileSystemDestination.cs.

References e.

114  {
115  try
116  {
117  using (var fileStream = new FileStream(file, FileMode.CreateNew))
118  stream.CopyTo(fileStream);
119 
120  log.WroteFile(file);
121  }
122  catch (Exception e)
123  {
124  log.DestinationFileError(file, e);
125  }
126  }
var e
Definition: bootstrap.min.js:6

Member Data Documentation

uint Ntp.Analyzer.Export.FileSystemDestination.FileGroupId = null
static
uint Ntp.Analyzer.Export.FileSystemDestination.FileMask = 644
static
uint Ntp.Analyzer.Export.FileSystemDestination.FileUserId = null
static

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