Compare commits
2 commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1dd12c02a5 | ||
|
|
49ee9b1079 |
4 changed files with 24 additions and 14 deletions
|
|
@ -147,7 +147,7 @@ namespace AmagnoVirtualPrinter.Agent.Lib.Misc
|
|||
var machine = job.MachineName?.TrimStart('\\');
|
||||
var username = job.UserName;
|
||||
|
||||
LogDebug($"Searching for session of {domain}\\{username} on {machine} !");
|
||||
LogDebug($"Searching for session of {domain}\\{username} on {machine}!");
|
||||
|
||||
if (domain == null || machine == null || username == null)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -30,7 +30,9 @@ namespace AmagnoVirtualPrinter.Agent.Lib.Misc
|
|||
[NotNull]
|
||||
private readonly IJobProcessor _jobProcessor;
|
||||
|
||||
private IDirectoryHelper _directoryHelper;
|
||||
[NotNull]
|
||||
private readonly IDirectoryHelper _directoryHelper;
|
||||
|
||||
private TcpListener _socket;
|
||||
private FileSystemWatcher _watcher;
|
||||
private string _outputDir;
|
||||
|
|
@ -101,19 +103,20 @@ namespace AmagnoVirtualPrinter.Agent.Lib.Misc
|
|||
|
||||
LogDebug($"{remote} --> {local}");
|
||||
job = _jobFactory.Create(printer, client.GetStream());
|
||||
if (job == null)
|
||||
{
|
||||
LogError("Job could not be created.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
LogDebug($"Temporarily printed '{job.RawDataPath}'!");
|
||||
socket.BeginAcceptTcpClient(HandleClient, ar.AsyncState);
|
||||
|
||||
_jobService.Start(job);
|
||||
|
||||
RestartFileWatcherIfNeeded(job.SessionInfo.Sid);
|
||||
|
||||
if (job == null)
|
||||
{
|
||||
LogError("Job could not be created. Check your Printer Settings.");
|
||||
}
|
||||
else
|
||||
{
|
||||
LogDebug($"Temporarily printed '{job.RawDataPath}'!");
|
||||
_jobService.Start(job);
|
||||
RestartFileWatcherIfNeeded(job.SessionInfo.Sid);
|
||||
}
|
||||
}
|
||||
|
||||
private void RestartFileWatcherIfNeeded(string sid)
|
||||
|
|
|
|||
|
|
@ -97,7 +97,7 @@ namespace AmagnoVirtualPrinter.Utils
|
|||
}
|
||||
|
||||
[ContractAnnotation("key:null => void")]
|
||||
private void CheckForNull(RegistryKey key, string keyName)
|
||||
private static void CheckForNull(RegistryKey key, string keyName)
|
||||
{
|
||||
if (key == null)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -63,7 +63,14 @@ namespace AmagnoVirtualPrinter.SetupDriver
|
|||
try
|
||||
{
|
||||
Console.WriteLine(exe + " " + args);
|
||||
using(var proc = Process.Start(exe, args))
|
||||
|
||||
var processStartInfo = new ProcessStartInfo(exe, args)
|
||||
{
|
||||
Verb = "runas",
|
||||
UseShellExecute = true
|
||||
};
|
||||
|
||||
using(var proc = Process.Start(processStartInfo))
|
||||
{
|
||||
proc?.WaitForExit();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue