Changed project names
This commit is contained in:
parent
b4c4aa4010
commit
a29e57e66d
130 changed files with 501 additions and 504 deletions
|
|
@ -0,0 +1,12 @@
|
|||
using System;
|
||||
|
||||
namespace AmagnoVirtualPrinter.Agent.Core.Interfaces
|
||||
{
|
||||
public interface IAmagnoVirtualPrinter : IDisposable
|
||||
{
|
||||
/// <summary>
|
||||
/// Initialize the virtual printer.
|
||||
/// </summary>
|
||||
void Init();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
namespace AmagnoVirtualPrinter.Agent.Core
|
||||
{
|
||||
public interface IAmagnoVirtualPrinterService
|
||||
{
|
||||
void Start();
|
||||
void Stop();
|
||||
}
|
||||
}
|
||||
20
Common/AmagnoVirtualPrinter.Agent.Core/Interfaces/IConfig.cs
Normal file
20
Common/AmagnoVirtualPrinter.Agent.Core/Interfaces/IConfig.cs
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
using JetBrains.Annotations;
|
||||
|
||||
namespace AmagnoVirtualPrinter.Agent.Core.Interfaces
|
||||
{
|
||||
public interface IConfig
|
||||
{
|
||||
/// <summary>
|
||||
/// The mask for the filename.
|
||||
/// </summary>
|
||||
/// <remarks>The mask can be look like {yyyy}{MM}{DD}{hh}{mm}{ss}{job05}{page03}</remarks>
|
||||
[NotNull]
|
||||
string FileNameMask { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The port of the printer.
|
||||
/// </summary>
|
||||
/// <remarks>E.g. 9101</remarks>
|
||||
short PrinterPort { get; }
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
namespace AmagnoVirtualPrinter.Agent.Core.Interfaces
|
||||
{
|
||||
public interface IDirectoryHelper
|
||||
{
|
||||
string GetOutputDirectory(IExConfig config);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
using System;
|
||||
using AmagnoVirtualPrinter.Agent.Core.Enums;
|
||||
using JetBrains.Annotations;
|
||||
|
||||
namespace AmagnoVirtualPrinter.Agent.Core.Interfaces
|
||||
{
|
||||
public interface IExConfig : IConfig
|
||||
{
|
||||
/// <summary>
|
||||
/// Splits a preconverter into two strings.
|
||||
/// </summary>
|
||||
/// <remarks>e.g. "C:\Program Files (x86)\MySoftware\MySoftware.exe PRINT" now becomes: string 1 = "C:\Program Files (x86)\MySoftware\MySoftware.exe" and string 2 = "PRINT"</remarks>
|
||||
[NotNull]
|
||||
Tuple<string, string> ResolvedPreconverter { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Splits a postconverter into two strings.
|
||||
/// </summary>
|
||||
/// <remarks>e.g. "C:\Program Files (x86)\MySoftware\MySoftware.exe PRINTCOMPLETE" now becomes: string 1 = "C:\Program Files (x86)\MySoftware\MySoftware.exe" and string 2 = "PRINTCOMPLETE"</remarks>
|
||||
[NotNull]
|
||||
Tuple<string, string> ResolvedPostconverter { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The full path of the output directory.
|
||||
/// </summary>
|
||||
[NotNull]
|
||||
string ResolvedOutputDirectory { get; }
|
||||
|
||||
/// <summary>
|
||||
/// An intermediate format which is read by the printer or similar.
|
||||
/// </summary>
|
||||
IntermediateFormat IntermediateFormat { get; }
|
||||
}
|
||||
}
|
||||
34
Common/AmagnoVirtualPrinter.Agent.Core/Interfaces/IJob.cs
Normal file
34
Common/AmagnoVirtualPrinter.Agent.Core/Interfaces/IJob.cs
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
using JetBrains.Annotations;
|
||||
|
||||
namespace AmagnoVirtualPrinter.Agent.Core.Interfaces
|
||||
{
|
||||
/// <summary>
|
||||
/// The information of the job.
|
||||
/// </summary>
|
||||
public interface IJob
|
||||
{
|
||||
/// <summary>
|
||||
/// The path to the file containing the data.
|
||||
/// </summary>
|
||||
[NotNull]
|
||||
string RawDataPath { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The path to the ini file.
|
||||
/// </summary>
|
||||
[NotNull]
|
||||
string IniDataPath { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Several job infos.
|
||||
/// </summary>
|
||||
[NotNull]
|
||||
IJobInfo JobInfo { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Information about the session.
|
||||
/// </summary>
|
||||
[NotNull]
|
||||
ISessionInfo SessionInfo { get; }
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
using System.IO;
|
||||
using JetBrains.Annotations;
|
||||
|
||||
namespace AmagnoVirtualPrinter.Agent.Core.Interfaces
|
||||
{
|
||||
public interface IJobFactory
|
||||
{
|
||||
[CanBeNull]
|
||||
IJob Create([NotNull]string printerName, [NotNull]Stream stream);
|
||||
|
||||
[NotNull]
|
||||
IJob Create([NotNull]string iniPath, [NotNull]string rawPath, IJobInfo jobInfo, ISessionInfo sessionInfo);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
using System.Printing;
|
||||
|
||||
namespace AmagnoVirtualPrinter.Agent.Core.Interfaces
|
||||
{
|
||||
public interface IJobInfo
|
||||
{
|
||||
int JobId { get; set; }
|
||||
string Name { get; set; }
|
||||
string DomainName { get; set; }
|
||||
string MachineName { get; set; }
|
||||
string UserName { get; set; }
|
||||
PrintJobStatus Status { get; set; }
|
||||
string DeviceName { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
using System;
|
||||
using AmagnoVirtualPrinter.Agent.Core.Model;
|
||||
using JetBrains.Annotations;
|
||||
|
||||
namespace AmagnoVirtualPrinter.Agent.Core.Interfaces
|
||||
{
|
||||
public interface IJobProcessor
|
||||
{
|
||||
/// <summary>
|
||||
/// Processes an <see cref="IJob"/> passed to it with the information from the <see cref="IUserConfig"/>.
|
||||
/// </summary>
|
||||
/// <param name="job"></param>
|
||||
/// <param name="userConfig"></param>
|
||||
/// <exception cref="ArgumentNullException">Throws when the <param name="job">job</param> or the <param name="userConfig"> is null.</param></exception>
|
||||
/// <exception cref="PostScriptConversionException">The job cannot be converted. There is no redirect to a printer. Will not be thrown.</exception>
|
||||
void Process([NotNull]IJob job, [NotNull]IUserConfig userConfig);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
using System;
|
||||
using JetBrains.Annotations;
|
||||
|
||||
namespace AmagnoVirtualPrinter.Agent.Core.Interfaces
|
||||
{
|
||||
public interface IJobRedirector
|
||||
{
|
||||
/// <summary>
|
||||
/// Redirects the information from the <param name="job">job</param> and the <param name="userConfig">config</param> to an Process to be executed.
|
||||
/// </summary>
|
||||
/// <param name="job"></param>
|
||||
/// <param name="userConfig"></param>
|
||||
/// <exception cref="ArgumentNullException">Throws when the <see cref="IJob"/> or the <see cref="IUserConfig"/> is null.</exception>
|
||||
void Redirect([NotNull]IJob job, [NotNull]IUserConfig userConfig);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,47 @@
|
|||
using System;
|
||||
using AmagnoVirtualPrinter.Agent.Core.Model;
|
||||
using JetBrains.Annotations;
|
||||
|
||||
namespace AmagnoVirtualPrinter.Agent.Core.Interfaces
|
||||
{
|
||||
public interface IJobService
|
||||
{
|
||||
/// <summary>
|
||||
/// Starts the <see cref="IJob"/> in a new Process.
|
||||
/// </summary>
|
||||
/// <param name="job"></param>
|
||||
/// <exception cref="ArgumentNullException">Throws when the <see cref="IJob"/> is null.</exception>
|
||||
void Start([NotNull]IJob job);
|
||||
|
||||
/// <summary>
|
||||
/// Creates an new <see cref="IJob"/> from the <param name="iniPath">ini file</param> and the <param name="rawPath">raw path</param>.
|
||||
/// </summary>
|
||||
/// <param name="iniPath"></param>
|
||||
/// <param name="rawPath"></param>
|
||||
/// <returns>An new <see cref="IJob"/> object.</returns>
|
||||
/// <exception cref="ArgumentException">Throws when the <paramref name="iniPath"/> or the <paramref name="rawPath"/> is null or empty.</exception>
|
||||
[NotNull]
|
||||
IJob CreateJob([NotNull]string iniPath, [NotNull]string rawPath);
|
||||
|
||||
/// <summary>
|
||||
/// Reads the <see cref="PrintStatus"/> from the <paramref name="iniPath"/>
|
||||
/// </summary>
|
||||
/// <param name="iniPath"></param>
|
||||
/// <returns>A <see cref="PrintStatus"/></returns>
|
||||
/// <exception cref="ArgumentException">Throws when the <paramref name="iniPath"/> is null or empty.</exception>
|
||||
PrintStatus ReadStatus([NotNull]string iniPath);
|
||||
|
||||
/// <summary>
|
||||
/// Starts a new process to finish the <see cref="IJob"/>.
|
||||
/// </summary>
|
||||
/// <param name="job"></param>
|
||||
void Finish([NotNull]IJob job);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the <see cref="JobStatus"/> from the ini file.
|
||||
/// </summary>
|
||||
/// <param name="iniPath">The path to the ini file</param>
|
||||
/// <returns><see cref="JobStatus"/></returns>
|
||||
JobStatus ReadJobStatus(string iniPath);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
using System;
|
||||
using AmagnoVirtualPrinter.Agent.Core.Model;
|
||||
|
||||
namespace AmagnoVirtualPrinter.Agent.Core.Interfaces
|
||||
{
|
||||
public interface IPostScriptConverter
|
||||
{
|
||||
event EventHandler<IJob> ProgressInitialized;
|
||||
event EventHandler<IJob> ProgressFinished;
|
||||
event EventHandler<ProgressUpdateArgs> ProgressUpdate;
|
||||
|
||||
void Convert(IJob job, string target, PostScriptRenderOptions options);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
using JetBrains.Annotations;
|
||||
|
||||
namespace AmagnoVirtualPrinter.Agent.Core.Interfaces
|
||||
{
|
||||
public interface IRegistryRepository
|
||||
{
|
||||
/// <summary>
|
||||
/// Try to get the ghostscript path from.
|
||||
/// </summary>
|
||||
/// <returns>True if the path exists.</returns>
|
||||
[ContractAnnotation("=>true,path:notnull; =>false,path:null")]
|
||||
bool TryGetGhostscriptPath(out string path);
|
||||
|
||||
/// <summary>
|
||||
/// Get the <see cref="IExConfig"/> from the registry.
|
||||
/// </summary>
|
||||
/// <returns>The configuration that was read from the registry in HKEY_LOCAL_MACHINE\SOFTWARE.</returns>
|
||||
[NotNull]
|
||||
IExConfig GetRegistryConfig();
|
||||
|
||||
/// <summary>
|
||||
/// Get the <see cref="IUserConfig"/> from the registry.
|
||||
/// </summary>
|
||||
/// <param name="sid">The security identifier with which each Windows user can be clearly identified in the network.</param>
|
||||
/// <returns>The configuration that was read from the registry in HKEY_USERS</returns>
|
||||
[NotNull]
|
||||
IUserConfig GetUserRegistryConfig([NotNull]string sid);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
namespace AmagnoVirtualPrinter.Agent.Core.Interfaces
|
||||
{
|
||||
public interface ISessionInfo
|
||||
{
|
||||
int Id { get; set; }
|
||||
|
||||
string Desktop { get; set; }
|
||||
|
||||
string Sid { get; set; }
|
||||
}
|
||||
}
|
||||
16
Common/AmagnoVirtualPrinter.Agent.Core/Interfaces/IShell.cs
Normal file
16
Common/AmagnoVirtualPrinter.Agent.Core/Interfaces/IShell.cs
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
using JetBrains.Annotations;
|
||||
|
||||
namespace AmagnoVirtualPrinter.Agent.Core.Interfaces
|
||||
{
|
||||
public interface IShell
|
||||
{
|
||||
void WriteIniEntry(string section, string key, string value, string iniFilePath);
|
||||
|
||||
[NotNull]
|
||||
T ReadIniEntry<T>(string section, string key, string iniFilePath);
|
||||
|
||||
void Execute(IJobInfo job, ISessionInfo session, string exe, string args);
|
||||
|
||||
bool FileExists([NotNull]string path);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
using JetBrains.Annotations;
|
||||
|
||||
namespace AmagnoVirtualPrinter.Agent.Core.Interfaces
|
||||
{
|
||||
public interface IUserConfig
|
||||
{
|
||||
/// <summary>
|
||||
/// The printer stored in the registry.
|
||||
/// </summary>
|
||||
[CanBeNull]
|
||||
string RedirectPrinter { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The DPI value stored in the registry.
|
||||
/// </summary>
|
||||
/// <remarks>Initial value is null.</remarks>
|
||||
double? UserRenderDpi { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The format that you choose on your client side stored in the registry.
|
||||
/// </summary>
|
||||
/// <remarks>Intital value is PDF</remarks>
|
||||
[NotNull]
|
||||
string Format { get; }
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
namespace AmagnoVirtualPrinter.Agent.Core.Interfaces
|
||||
{
|
||||
public enum JobStatus
|
||||
{
|
||||
Completed,
|
||||
Failed,
|
||||
InProgress
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue