mirror of
https://bitbucket.org/anguist/ntpa
synced 2026-10-02 16:31:57 +00:00
Version 0.2 changes
This commit is contained in:
@@ -1,74 +1,107 @@
|
||||
//
|
||||
// DirectoryStreamDestination.cs
|
||||
//
|
||||
// Author:
|
||||
// Carsten Sonne Larsen <cs@innolan.dk>
|
||||
//
|
||||
// Copyright (c) 2013 Carsten Sonne Larsen
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
using System;
|
||||
using System.IO;
|
||||
using Ntp.Analyzer.Log;
|
||||
|
||||
namespace Ntp.Analyzer.Export
|
||||
{
|
||||
public class DirectoryStreamDestination : StreamDestination
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Ntp.Analyzer.Export.DirectoryStreamDestination"/> class.
|
||||
/// </summary>
|
||||
/// <param name="basePath">Base path.</param>
|
||||
/// <param name="path">Path.</param>
|
||||
/// <param name="prefix">Prefix.</param>
|
||||
public DirectoryStreamDestination (string basePath, string path, string prefix)
|
||||
{
|
||||
this.path = basePath + path;
|
||||
this.prefix = prefix;
|
||||
}
|
||||
|
||||
private readonly string path;
|
||||
private readonly string prefix;
|
||||
|
||||
public override void Write (Stream stream, LogBase log)
|
||||
{
|
||||
string file = path + prefix + Param;
|
||||
|
||||
if (File.Exists (file)) {
|
||||
File.Delete (file);
|
||||
}
|
||||
|
||||
FileStream fileStream = null;
|
||||
|
||||
try {
|
||||
fileStream = new FileStream (file, FileMode.CreateNew);
|
||||
|
||||
stream.CopyTo (fileStream);
|
||||
} catch (Exception e) {
|
||||
log.WriteLine (e);
|
||||
} finally {
|
||||
// Release memory
|
||||
if (fileStream != null) {
|
||||
fileStream.Close ();
|
||||
fileStream = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//
|
||||
// DirectoryStreamDestination.cs
|
||||
//
|
||||
// Author:
|
||||
// Carsten Sonne Larsen <cs@innolan.net>
|
||||
//
|
||||
// Copyright (c) 2014 Carsten Sonne Larsen
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
using Ntp.Analyzer.Log;
|
||||
|
||||
namespace Ntp.Analyzer.Export
|
||||
{
|
||||
public class DirectoryStreamDestination : StreamDestination
|
||||
{
|
||||
private readonly string path;
|
||||
private readonly string prefix;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Ntp.Analyzer.Export.DirectoryStreamDestination" /> class.
|
||||
/// </summary>
|
||||
/// <param name="basePath">Base path.</param>
|
||||
/// <param name="path">Path.</param>
|
||||
/// <param name="prefix">Prefix.</param>
|
||||
public DirectoryStreamDestination(string basePath, string path, string prefix)
|
||||
{
|
||||
this.path = basePath + path;
|
||||
this.prefix = prefix;
|
||||
}
|
||||
|
||||
public override string Location
|
||||
{
|
||||
get { return path; }
|
||||
}
|
||||
|
||||
public override string AbsoluteLocation
|
||||
{
|
||||
get { return path + prefix; }
|
||||
}
|
||||
|
||||
public override void Test()
|
||||
{
|
||||
string testFile = AbsoluteLocation + "configtest";
|
||||
string testContent = "FileStreamDestinationTest";
|
||||
|
||||
if (File.Exists(testFile))
|
||||
{
|
||||
File.Delete(testFile);
|
||||
}
|
||||
|
||||
File.WriteAllText(testFile, testContent);
|
||||
|
||||
File.Delete(testFile);
|
||||
}
|
||||
|
||||
public override void Write(Stream stream, LogBase log)
|
||||
{
|
||||
string file = path + prefix + Param;
|
||||
|
||||
if (File.Exists(file))
|
||||
{
|
||||
File.Delete(file);
|
||||
}
|
||||
|
||||
FileStream fileStream = null;
|
||||
|
||||
try
|
||||
{
|
||||
fileStream = new FileStream(file, FileMode.CreateNew);
|
||||
|
||||
stream.CopyTo(fileStream);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
log.WriteLine(e);
|
||||
}
|
||||
finally
|
||||
{
|
||||
// Release memory
|
||||
if (fileStream != null)
|
||||
{
|
||||
fileStream.Close();
|
||||
fileStream = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,68 +1,101 @@
|
||||
//
|
||||
// FileStreamDestination.cs
|
||||
//
|
||||
// Author:
|
||||
// Carsten Sonne Larsen <cs@innolan.dk>
|
||||
//
|
||||
// Copyright (c) 2013 Carsten Sonne Larsen
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
using System;
|
||||
using System.IO;
|
||||
using Ntp.Analyzer.Log;
|
||||
|
||||
namespace Ntp.Analyzer.Export
|
||||
{
|
||||
public class FileStreamDestination : StreamDestination
|
||||
{
|
||||
public FileStreamDestination (string path, string file)
|
||||
{
|
||||
this.path = path;
|
||||
this.file = file;
|
||||
}
|
||||
|
||||
private readonly string path;
|
||||
private readonly string file;
|
||||
|
||||
public override void Write (Stream stream, LogBase log)
|
||||
{
|
||||
string absFile = path + file;
|
||||
|
||||
if (File.Exists (absFile)) {
|
||||
File.Delete (absFile);
|
||||
}
|
||||
|
||||
FileStream fileStream = null;
|
||||
|
||||
try {
|
||||
fileStream = new FileStream (absFile, FileMode.CreateNew);
|
||||
|
||||
stream.CopyTo (fileStream);
|
||||
} catch (Exception e) {
|
||||
log.WriteLine (e);
|
||||
} finally {
|
||||
// Release memory
|
||||
if (fileStream != null) {
|
||||
fileStream.Close ();
|
||||
fileStream = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//
|
||||
// FileStreamDestination.cs
|
||||
//
|
||||
// Author:
|
||||
// Carsten Sonne Larsen <cs@innolan.net>
|
||||
//
|
||||
// Copyright (c) 2014 Carsten Sonne Larsen
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
using Ntp.Analyzer.Log;
|
||||
|
||||
namespace Ntp.Analyzer.Export
|
||||
{
|
||||
public class FileStreamDestination : StreamDestination
|
||||
{
|
||||
private readonly string file;
|
||||
private readonly string path;
|
||||
|
||||
public FileStreamDestination(string path, string file)
|
||||
{
|
||||
this.path = path;
|
||||
this.file = file;
|
||||
}
|
||||
|
||||
public override string Location
|
||||
{
|
||||
get { return file; }
|
||||
}
|
||||
|
||||
public override string AbsoluteLocation
|
||||
{
|
||||
get { return path + file; }
|
||||
}
|
||||
|
||||
public override void Test()
|
||||
{
|
||||
string testFile = AbsoluteLocation;
|
||||
string testContent = "FileStreamDestinationTest";
|
||||
|
||||
if (File.Exists(testFile))
|
||||
{
|
||||
File.Delete(testFile);
|
||||
}
|
||||
|
||||
File.WriteAllText(testFile, testContent);
|
||||
|
||||
File.Delete(testFile);
|
||||
}
|
||||
|
||||
public override void Write(Stream stream, LogBase log)
|
||||
{
|
||||
string absFile = AbsoluteLocation;
|
||||
|
||||
if (File.Exists(absFile))
|
||||
{
|
||||
File.Delete(absFile);
|
||||
}
|
||||
|
||||
FileStream fileStream = null;
|
||||
|
||||
try
|
||||
{
|
||||
fileStream = new FileStream(absFile, FileMode.CreateNew);
|
||||
|
||||
stream.CopyTo(fileStream);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
log.WriteLine(e);
|
||||
}
|
||||
finally
|
||||
{
|
||||
// Release memory
|
||||
if (fileStream != null)
|
||||
{
|
||||
fileStream.Close();
|
||||
fileStream = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,109 @@
|
||||
//
|
||||
// FtpStreamDestination.cs
|
||||
//
|
||||
// Author:
|
||||
// Carsten Sonne Larsen <cs@innolan.net>
|
||||
//
|
||||
// Copyright (c) 2014 Carsten Sonne Larsen
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Net;
|
||||
using Ntp.Analyzer.Log;
|
||||
|
||||
namespace Ntp.Analyzer.Export
|
||||
{
|
||||
public sealed class FtpStreamDestination: StreamDestination
|
||||
{
|
||||
private readonly string file;
|
||||
private readonly string path;
|
||||
|
||||
public FtpStreamDestination(string path, string file)
|
||||
{
|
||||
this.path = path;
|
||||
this.file = file;
|
||||
}
|
||||
|
||||
public override string Location
|
||||
{
|
||||
get { return file; }
|
||||
}
|
||||
|
||||
public override string AbsoluteLocation
|
||||
{
|
||||
get { return path + file; }
|
||||
}
|
||||
|
||||
public override void Test()
|
||||
{
|
||||
/*
|
||||
string testFile = AbsoluteLocation;
|
||||
string testContent = "FileStreamDestinationTest";
|
||||
|
||||
if (File.Exists(testFile))
|
||||
{
|
||||
File.Delete(testFile);
|
||||
}
|
||||
|
||||
File.WriteAllText(testFile, testContent);
|
||||
|
||||
File.Delete(testFile);
|
||||
*/
|
||||
}
|
||||
|
||||
public override void Write (Stream stream, LogBase log)
|
||||
{
|
||||
string absFile = AbsoluteLocation;
|
||||
|
||||
if (File.Exists (absFile)) {
|
||||
File.Delete (absFile);
|
||||
}
|
||||
|
||||
try {
|
||||
FtpWebRequest request = (FtpWebRequest)WebRequest.Create ("ftp://172.20.83.1/test.png");
|
||||
request.Method = WebRequestMethods.Ftp.UploadFile;
|
||||
request.Credentials = new NetworkCredential ("ntapf", "ntpafps");
|
||||
request.UsePassive = false;
|
||||
|
||||
request.ContentLength = stream.Length;
|
||||
Stream requestStream = request.GetRequestStream ();
|
||||
stream.CopyTo (requestStream);
|
||||
requestStream.Close ();
|
||||
|
||||
FtpWebResponse response = (FtpWebResponse)request.GetResponse ();
|
||||
|
||||
Console.WriteLine ("Upload File Complete, status {0}", response.StatusDescription);
|
||||
|
||||
response.Close ();
|
||||
|
||||
} catch (Exception e) {
|
||||
log.WriteLine (e);
|
||||
} finally {/*
|
||||
// Release memory
|
||||
if (fileStream != null)
|
||||
{
|
||||
fileStream.Close();
|
||||
fileStream = null;
|
||||
}
|
||||
*/
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,39 +1,37 @@
|
||||
//
|
||||
// IStreamGenerator.cs
|
||||
//
|
||||
// Author:
|
||||
// Carsten Sonne Larsen <cs@innolan.dk>
|
||||
//
|
||||
// Copyright (c) 2013 Carsten Sonne Larsen
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Ntp.Analyzer.Export
|
||||
{
|
||||
public interface IStreamGenerator
|
||||
{
|
||||
Stream Generate ();
|
||||
|
||||
IEnumerable<StreamDestination> Destinations { get; }
|
||||
}
|
||||
}
|
||||
//
|
||||
// IStreamGenerator.cs
|
||||
//
|
||||
// Author:
|
||||
// Carsten Sonne Larsen <cs@innolan.net>
|
||||
//
|
||||
// Copyright (c) 2014 Carsten Sonne Larsen
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
|
||||
namespace Ntp.Analyzer.Export
|
||||
{
|
||||
public interface IStreamGenerator
|
||||
{
|
||||
IEnumerable<StreamDestination> Destinations { get; }
|
||||
Stream Generate();
|
||||
}
|
||||
}
|
||||
@@ -1,42 +1,44 @@
|
||||
//
|
||||
// StreamDestination.cs
|
||||
//
|
||||
// Author:
|
||||
// Carsten Sonne Larsen <cs@innolan.dk>
|
||||
//
|
||||
// Copyright (c) 2013 Carsten Sonne Larsen
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
using System;
|
||||
using System.IO;
|
||||
using Ntp.Analyzer.Log;
|
||||
|
||||
namespace Ntp.Analyzer.Export
|
||||
{
|
||||
public abstract class StreamDestination
|
||||
{
|
||||
public StreamDestination ()
|
||||
{
|
||||
}
|
||||
|
||||
public string Param { get; set; }
|
||||
|
||||
public abstract void Write (Stream stream, LogBase log);
|
||||
}
|
||||
}
|
||||
//
|
||||
// StreamDestination.cs
|
||||
//
|
||||
// Author:
|
||||
// Carsten Sonne Larsen <cs@innolan.net>
|
||||
//
|
||||
// Copyright (c) 2014 Carsten Sonne Larsen
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
|
||||
using System.IO;
|
||||
using Ntp.Analyzer.Log;
|
||||
|
||||
namespace Ntp.Analyzer.Export
|
||||
{
|
||||
public abstract class StreamDestination
|
||||
{
|
||||
public abstract string Location { get; }
|
||||
|
||||
public abstract string AbsoluteLocation { get; }
|
||||
|
||||
public string Param { get; set; }
|
||||
|
||||
public abstract void Test();
|
||||
|
||||
public abstract void Write(Stream stream, LogBase log);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
//
|
||||
// WebDestination.cs
|
||||
//
|
||||
// Author:
|
||||
// Carsten Sonne Larsen <cs@innolan.net>
|
||||
//
|
||||
// Copyright (c) 2014 Carsten Sonne Larsen
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
|
||||
using System;
|
||||
|
||||
namespace Ntp.Analyzer.Export
|
||||
{
|
||||
// Refactor and use with IServable the same way as IStreamGenerator and StreamDestination
|
||||
public sealed class WebDestination : StreamDestination
|
||||
{
|
||||
public WebDestination (string path, string file)
|
||||
{
|
||||
this.path = path;
|
||||
this.file = file;
|
||||
}
|
||||
|
||||
private readonly string file;
|
||||
private readonly string path;
|
||||
|
||||
public override string Location
|
||||
{
|
||||
get { return file; }
|
||||
}
|
||||
|
||||
public override string AbsoluteLocation
|
||||
{
|
||||
get { return (path != String.Empty ? path + "@" : String.Empty) + file; }
|
||||
}
|
||||
|
||||
public override void Test ()
|
||||
{
|
||||
throw new NotImplementedException ();
|
||||
}
|
||||
|
||||
public override void Write (System.IO.Stream stream, Ntp.Analyzer.Log.LogBase log)
|
||||
{
|
||||
throw new NotImplementedException ();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,51 +1,51 @@
|
||||
//
|
||||
// WebLinkConfiguration.cs
|
||||
//
|
||||
// Author:
|
||||
// Carsten Sonne Larsen <cs@innolan.dk>
|
||||
//
|
||||
// Copyright (c) 2013 Carsten Sonne Larsen
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
using System;
|
||||
|
||||
namespace Ntp.Analyzer.Export
|
||||
{
|
||||
public sealed class WebLink
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Ntp.Analyzer.Export.WebLink"/> class.
|
||||
/// </summary>
|
||||
/// <param name="link">Link.</param>
|
||||
public WebLink (string link)
|
||||
{
|
||||
this.link = link;
|
||||
}
|
||||
|
||||
private readonly string link;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the WWW link.
|
||||
/// </summary>
|
||||
/// <value>The link.</value>
|
||||
public string Link {
|
||||
get { return link; }
|
||||
}
|
||||
}
|
||||
}
|
||||
//
|
||||
// WebLinkConfiguration.cs
|
||||
//
|
||||
// Author:
|
||||
// Carsten Sonne Larsen <cs@innolan.net>
|
||||
//
|
||||
// Copyright (c) 2014 Carsten Sonne Larsen
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
|
||||
namespace Ntp.Analyzer.Export
|
||||
{
|
||||
public sealed class WebLink
|
||||
{
|
||||
private readonly string link;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Ntp.Analyzer.Export.WebLink" /> class.
|
||||
/// </summary>
|
||||
/// <param name="link">Link.</param>
|
||||
public WebLink(string link)
|
||||
{
|
||||
this.link = link;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the WWW link.
|
||||
/// </summary>
|
||||
/// <value>The link.</value>
|
||||
public string Link
|
||||
{
|
||||
get { return link; }
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user