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

Public Member Functions

 FtpStreamDestination (string path, string file)
 
override void Test ()
 
override void Write (Stream stream, LogBase log)
 

Public Attributes

override string AbsoluteLocation => path + file
 
override string Link => string.Empty
 
override string Location => file
 
override string Value => file
 
- Public Attributes inherited from Ntp.Analyzer.Export.StreamDestination
string ConfigName => null
 StreamDestinations never has a name. Always return null. More...
 

Private Attributes

readonly string file
 
readonly string path
 

Additional Inherited Members

- 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 29 of file FtpStreamDestination.cs.

Constructor & Destructor Documentation

Ntp.Analyzer.Export.FtpStreamDestination.FtpStreamDestination ( string  path,
string  file 
)
inline

Definition at line 31 of file FtpStreamDestination.cs.

32  {
33  this.path = path;
34  this.file = file;
35  }

Member Function Documentation

override void Ntp.Analyzer.Export.FtpStreamDestination.Test ( )
inlinevirtual

Implements Ntp.Analyzer.Export.StreamDestination.

Definition at line 48 of file FtpStreamDestination.cs.

49  {
50  /*
51  string testFile = AbsoluteLocation;
52  string testContent = "FileStreamDestinationTest";
53 
54  if (File.Exists(testFile))
55  {
56  File.Delete(testFile);
57  }
58 
59  File.WriteAllText(testFile, testContent);
60 
61  File.Delete(testFile);
62  */
63  }
override void Ntp.Analyzer.Export.FtpStreamDestination.Write ( Stream  stream,
LogBase  log 
)
inlinevirtual

Implements Ntp.Analyzer.Export.StreamDestination.

Definition at line 65 of file FtpStreamDestination.cs.

References Ntp.Common.Log.Console, e, Ntp.Common.Log.File, and Ntp.Common.Log.LogBase.WriteLine().

66  {
67  string absFile = AbsoluteLocation;
68 
69  if (File.Exists(absFile))
70  {
71  File.Delete(absFile);
72  }
73 
74  try
75  {
76  var request = (FtpWebRequest) WebRequest.Create("ftp://172.20.83.1/test.png");
77  request.Method = WebRequestMethods.Ftp.UploadFile;
78  request.Credentials = new NetworkCredential("ntapf", "ntpafps");
79  request.UsePassive = false;
80 
81  request.ContentLength = stream.Length;
82  Stream requestStream = request.GetRequestStream();
83  stream.CopyTo(requestStream);
84  requestStream.Close();
85 
86  var response = (FtpWebResponse) request.GetResponse();
87 
88  Console.WriteLine($"Upload File Complete, status {response.StatusDescription}");
89 
90  response.Close();
91  }
92  catch (Exception e)
93  {
94  log.WriteLine(e);
95  }
96  }
abstract void WriteLine(string text, Severity severity)
var e
Definition: bootstrap.min.js:6

Here is the call graph for this function:

Member Data Documentation

override string Ntp.Analyzer.Export.FtpStreamDestination.AbsoluteLocation => path + file

Definition at line 46 of file FtpStreamDestination.cs.

readonly string Ntp.Analyzer.Export.FtpStreamDestination.file
private

Definition at line 37 of file FtpStreamDestination.cs.

override string Ntp.Analyzer.Export.FtpStreamDestination.Link => string.Empty

Definition at line 40 of file FtpStreamDestination.cs.

override string Ntp.Analyzer.Export.FtpStreamDestination.Location => file

Definition at line 44 of file FtpStreamDestination.cs.

readonly string Ntp.Analyzer.Export.FtpStreamDestination.path
private

Definition at line 38 of file FtpStreamDestination.cs.

override string Ntp.Analyzer.Export.FtpStreamDestination.Value => file

Definition at line 42 of file FtpStreamDestination.cs.


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