55 lines
1.5 KiB
C#
55 lines
1.5 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Threading.Tasks;
|
|
using System.Windows.Forms;
|
|
using System.IO;
|
|
using System.Text;
|
|
|
|
namespace PAFAXClient
|
|
{
|
|
static class Program
|
|
{
|
|
/// <summary>
|
|
/// Der Haupteinstiegspunkt für die Anwendung.
|
|
/// </summary>
|
|
[STAThread]
|
|
static void Main(String[] arguments)
|
|
{
|
|
Application.EnableVisualStyles();
|
|
Application.SetCompatibleTextRenderingDefault(false);
|
|
|
|
Form1 form1 = new Form1();
|
|
|
|
if (arguments.Length > 0)
|
|
{
|
|
if (arguments[0].Equals("--printer"))
|
|
{
|
|
Stream stdin = Console.OpenStandardInput();
|
|
byte[] buffer = new byte[1048576];
|
|
|
|
MemoryStream ms = new MemoryStream();
|
|
int n;
|
|
|
|
do
|
|
{
|
|
n = stdin.Read(buffer, 0, buffer.Length);
|
|
if (n > 0)
|
|
{
|
|
ms.Write(buffer, 0, n);
|
|
form1.lbReceiver.Items.Add(String.Format("Got {0} bytes jobdata", n));
|
|
}
|
|
} while (n > 0);
|
|
|
|
byte[] jobdata = ms.ToArray();
|
|
|
|
form1.lbReceiver.Items.Add(String.Format("Resulting Job Length: {0} bytes", jobdata.Length));
|
|
form1.setJobData(jobdata);
|
|
}
|
|
}
|
|
|
|
Application.Run(form1);
|
|
}
|
|
}
|
|
}
|