[03_RoyalGallery/DotNet-PrinterController]

Created it.
master
LH 6 years ago
parent 96de52e22f
commit 3c25a876ae
  1. 14
      03_RoyalGallery/DotNet-PrinterController/PrinterController/App.config
  2. 102
      03_RoyalGallery/DotNet-PrinterController/PrinterController/Form1.Designer.cs
  3. 406
      03_RoyalGallery/DotNet-PrinterController/PrinterController/Form1.cs
  4. 1123
      03_RoyalGallery/DotNet-PrinterController/PrinterController/Form1.resx
  5. 22
      03_RoyalGallery/DotNet-PrinterController/PrinterController/Program.cs
  6. 36
      03_RoyalGallery/DotNet-PrinterController/PrinterController/Properties/AssemblyInfo.cs
  7. 71
      03_RoyalGallery/DotNet-PrinterController/PrinterController/Properties/Resources.Designer.cs
  8. 117
      03_RoyalGallery/DotNet-PrinterController/PrinterController/Properties/Resources.resx
  9. 30
      03_RoyalGallery/DotNet-PrinterController/PrinterController/Properties/Settings.Designer.cs
  10. 7
      03_RoyalGallery/DotNet-PrinterController/PrinterController/Properties/Settings.settings
  11. 97
      03_RoyalGallery/DotNet-PrinterController/PrinterController/Ultracombos.printerGrpc.cs
  12. 276
      03_RoyalGallery/DotNet-PrinterController/PrinterController/UltracombosPrinter.cs
  13. 9
      03_RoyalGallery/DotNet-PrinterController/PrinterController/packages.config

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />
</startup>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Interactive.Async" publicKeyToken="94bc3704cddfc263" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-3.0.3000.0" newVersion="3.0.3000.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>

@ -0,0 +1,102 @@
namespace TestPrinter
{
partial class Form1
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Form1));
this.printer_preview = new System.Windows.Forms.Button();
this.printer_setup = new System.Windows.Forms.Button();
this.pictureBox = new System.Windows.Forms.PictureBox();
this.comboBox1 = new System.Windows.Forms.ComboBox();
((System.ComponentModel.ISupportInitialize)(this.pictureBox)).BeginInit();
this.SuspendLayout();
//
// printer_preview
//
this.printer_preview.Location = new System.Drawing.Point(461, 442);
this.printer_preview.Name = "printer_preview";
this.printer_preview.Size = new System.Drawing.Size(166, 34);
this.printer_preview.TabIndex = 1;
this.printer_preview.Text = "預覽列印";
this.printer_preview.UseVisualStyleBackColor = true;
this.printer_preview.Click += new System.EventHandler(this.printer_preview_Click);
//
// printer_setup
//
this.printer_setup.Location = new System.Drawing.Point(180, 442);
this.printer_setup.Name = "printer_setup";
this.printer_setup.Size = new System.Drawing.Size(135, 34);
this.printer_setup.TabIndex = 2;
this.printer_setup.Text = "印表機設定";
this.printer_setup.UseVisualStyleBackColor = true;
this.printer_setup.Click += new System.EventHandler(this.printer_setup_Click);
//
// pictureBox
//
this.pictureBox.BackgroundImageLayout = System.Windows.Forms.ImageLayout.None;
this.pictureBox.Image = ((System.Drawing.Image)(resources.GetObject("pictureBox.Image")));
this.pictureBox.Location = new System.Drawing.Point(0, 1);
this.pictureBox.Name = "pictureBox";
this.pictureBox.Size = new System.Drawing.Size(799, 484);
this.pictureBox.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
this.pictureBox.TabIndex = 3;
this.pictureBox.TabStop = false;
//
// comboBox1
//
this.comboBox1.FormattingEnabled = true;
this.comboBox1.Location = new System.Drawing.Point(461, 415);
this.comboBox1.Name = "comboBox1";
this.comboBox1.Size = new System.Drawing.Size(166, 21);
this.comboBox1.TabIndex = 4;
this.comboBox1.SelectedIndexChanged += new System.EventHandler(this.printer_scale_mode_Changed);
//
// Form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(800, 488);
this.Controls.Add(this.comboBox1);
this.Controls.Add(this.printer_setup);
this.Controls.Add(this.printer_preview);
this.Controls.Add(this.pictureBox);
this.Name = "Form1";
this.Text = "Form1";
((System.ComponentModel.ISupportInitialize)(this.pictureBox)).EndInit();
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.Button printer_preview;
private System.Windows.Forms.Button printer_setup;
private System.Windows.Forms.PictureBox pictureBox;
private System.Windows.Forms.ComboBox comboBox1;
}
}

@ -0,0 +1,406 @@
using Grpc.Core;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Printing;
using System.IO;
using System.Threading.Tasks;
using System.Windows.Forms;
using UltraCombos.Utility;
using grpc = global::Grpc.Core;
using Newtonsoft.Json;
namespace TestPrinter
{
public partial class Form1 : Form
{
private PrintDocument pdDocument = new PrintDocument();
private PageSetupDialog setupDlg = new PageSetupDialog();
private PrintPreviewDialog previewDlg = new PrintPreviewDialog();
private PageSettings pageSettings;
private bool is_preview = false;
private bool is_pressed_ok = false;
private bool is_loaded_ok = false;
private string path = @"printer_settings.json";
//private System.Drawing.Image testing_image;
PrinterService service;
public enum ScaleMode
{
ScaleFit = 0,
ScaleFill,
ScaleFullFit,
ScaleFullFill,
ScaleFullPageFit,
ScaleFullPageFill,
MaxNum,
}
public Form1()
{
InitializeComponent();
for (int i = 0; i < (int)ScaleMode.MaxNum; ++i)
{
comboBox1.Items.Add((ScaleMode)(i));
}
comboBox1.SelectedIndex = 0;
pdDocument.DefaultPageSettings.Landscape = true;
pdDocument.PrinterSettings.DefaultPageSettings.Landscape = true;
pdDocument.PrintPage += new PrintPageEventHandler(OnPrintPage);
PaperSize papersize = null;
foreach (PaperSize size in pdDocument.PrinterSettings.PaperSizes)
{
if(size.PaperName.StartsWith("A4"))
{
papersize = size;
break;
}
}
if (papersize != null)
{
pdDocument.DefaultPageSettings.PaperSize = papersize;
pdDocument.PrinterSettings.DefaultPageSettings.PaperSize = papersize;
var hard_area = pdDocument.PrinterSettings.DefaultPageSettings.PrintableArea;
Margins margins = new Margins(
(int)Math.Round(hard_area.X),
(int)Math.Round(hard_area.Y),
(int)Math.Round(papersize.Width - (hard_area.X + hard_area.Width)),
(int)Math.Round(papersize.Height - (hard_area.Y + hard_area.Height))
);
pdDocument.DefaultPageSettings.Margins = margins;
}
pageSettings = pdDocument.DefaultPageSettings.Clone() as PageSettings;
PrintSettings s = Utils.LoadPrintSettings(path, pageSettings);
is_loaded_ok = s != null;
if (is_loaded_ok)
{
pdDocument.DefaultPageSettings = pageSettings.Clone() as PageSettings;
comboBox1.SelectedItem = s.ScaleMode;
}
var options = new List<Grpc.Core.ChannelOption> { new Grpc.Core.ChannelOption(ChannelOptions.MaxReceiveMessageLength, int.MaxValue) };
var services = new ServerServiceDefinition[] { Printer.BindService(new PrinterImpl(print_impl)) };
service = new PrinterService();
service.StartServer(options, services, 54578);
}
RectangleF getPrintableArea()
{
var rect = pdDocument.DefaultPageSettings.PrintableArea;
if (pdDocument.DefaultPageSettings.Landscape)
{
float tmp = rect.X;
rect.X = rect.Y;
rect.Y = tmp;
tmp = rect.Width;
rect.Width = rect.Height;
rect.Height = tmp;
}
return rect;
}
RectangleF getFullPageArea()
{
var rect = new RectangleF(0, 0, pdDocument.DefaultPageSettings.PaperSize.Width, pdDocument.DefaultPageSettings.PaperSize.Height);
if (pdDocument.DefaultPageSettings.Landscape)
{
float tmp = rect.Width;
rect.Width = rect.Height;
rect.Height = tmp;
}
return rect;
}
private void OnPrintPage(object sender, PrintPageEventArgs e)
{
Console.WriteLine("OnPrintPage()");
float dpiX = (float)e.PageSettings.PrinterSettings.DefaultPageSettings.PrinterResolution.X;
float dpiY = (float)e.PageSettings.PrinterSettings.DefaultPageSettings.PrinterResolution.Y;
e.Graphics.PageUnit = GraphicsUnit.Pixel;
e.Graphics.ScaleTransform(dpiX*0.01f, dpiY*0.01f);
var printable_area = getPrintableArea();
RectangleF hot_area;
switch (comboBox1.SelectedItem)
{
default:
case ScaleMode.ScaleFit:
case ScaleMode.ScaleFill:
hot_area = RectangleF.Intersect(e.MarginBounds, printable_area);
break;
case ScaleMode.ScaleFullFit:
case ScaleMode.ScaleFullFill:
hot_area = printable_area;
break;
case ScaleMode.ScaleFullPageFit:
case ScaleMode.ScaleFullPageFill:
hot_area = getFullPageArea();
break;
}
{
var state = e.Graphics.Save();
e.Graphics.TranslateTransform(hot_area.X, hot_area.Y);
if(is_preview == false)
e.Graphics.TranslateTransform(-printable_area.X, -printable_area.Y);
var image = pictureBox.Image;
float area_aspect = hot_area.Width / hot_area.Height;
float img_aspect = (float)image.Width / image.Height;
float x, y, w, h;
switch (comboBox1.SelectedItem)
{
default:
case ScaleMode.ScaleFit:
case ScaleMode.ScaleFullFit:
case ScaleMode.ScaleFullPageFit:
if (img_aspect > area_aspect)
{
w = hot_area.Width;
h = w / img_aspect;
}
else
{
h = hot_area.Height;
w = h * img_aspect;
}
break;
case ScaleMode.ScaleFill:
case ScaleMode.ScaleFullFill:
case ScaleMode.ScaleFullPageFill:
w = hot_area.Width;
h = hot_area.Height;
break;
}
x = 0.5f * (hot_area.Width - w);
y = 0.5f * (hot_area.Height - h);
Rectangle myRect = new Rectangle(
(int)Math.Round(x),
(int)Math.Round(y),
(int)Math.Round(w),
(int)Math.Round(h)
);
e.Graphics.DrawImage(
image,
myRect,
0,
0,
image.Width,
image.Height,
GraphicsUnit.Pixel);
e.Graphics.Restore(state);
}
if (is_preview)
{
e.Graphics.DrawRectangle(new Pen(Color.Red, 1), printable_area.X, printable_area.Y, printable_area.Width, printable_area.Height);
e.Graphics.DrawRectangle(new Pen(Color.Blue, 1), e.MarginBounds);
is_preview = false;
}
}
private void printer_preview_Click(object sender, EventArgs e)
{
previewDlg.Document = pdDocument;
is_preview = true;
previewDlg.ShowDialog();
}
private void printer_setup_Click(object sender, EventArgs e)
{
setupDlg.Document = pdDocument;
setupDlg.AllowMargins = true;
setupDlg.AllowOrientation = true;
setupDlg.AllowPaper = true;
setupDlg.AllowPrinter = true;
setupDlg.PageSettings = pageSettings;
PrintSettings s = Utils.LoadPrintSettings(path, setupDlg.PageSettings);
if (is_pressed_ok || s != null)
{
Utils.FixMarginsBug(setupDlg.PageSettings);
}
DialogResult ret = setupDlg.ShowDialog();
is_pressed_ok = ret == DialogResult.OK;
if (is_pressed_ok)
{
pdDocument.DefaultPageSettings = setupDlg.PageSettings.Clone() as PageSettings;
Utils.SavePrintSettings(path, setupDlg.PageSettings, (ScaleMode)comboBox1.SelectedItem);
}
}
private void print_impl(UltraCombos.Utility.Image request)
{
var data = request.Content.ToByteArray();
MemoryStream ms = new MemoryStream(data);
pictureBox.Image = System.Drawing.Image.FromStream(ms);
pdDocument.Print();
Console.WriteLine("print_impl");
}
private void printer_scale_mode_Changed(object sender, EventArgs e)
{
if (pageSettings == null)
{
return;
}
Utils.SavePrintSettings(path, pageSettings, (ScaleMode)comboBox1.SelectedItem);
}
}
sealed class Utils
{
//WTF Bug...
static public void FixMarginsBug(PageSettings s)
{
double left = s.Margins.Left;
double right = s.Margins.Right;
double top = s.Margins.Top;
double Bottom = s.Margins.Bottom;
s.Margins.Left = Convert.ToInt32(left * 2.54);
s.Margins.Right = Convert.ToInt32(right * 2.54);
s.Margins.Top = Convert.ToInt32(top * 2.54);
s.Margins.Bottom = Convert.ToInt32(Bottom * 2.54);
}
static public PrintSettings LoadPrintSettings(string path, PageSettings s)
{
if (!File.Exists(path))
{
return null;
}
string json = File.ReadAllText(path);
var obj = JsonConvert.DeserializeObject<PrintSettings>(json);
if (obj == null)
{
return null;
}
obj.To(s);
return obj;
}
static public bool SavePrintSettings(string path, PageSettings s, Form1.ScaleMode scale_mode)
{
var obj = new PrintSettings();
obj.From(s);
obj.ScaleMode = scale_mode;
string json = JsonConvert.SerializeObject(obj, Formatting.Indented);
File.WriteAllText(path, json);
return true;
}
}
public class PrintSettings
{
public PaperSize PaperSize;
public PaperSource PaperSource;
public Margins Margins;
public bool Landscape;
public Form1.ScaleMode ScaleMode;
public void To(PageSettings s)
{
s.PaperSize = PaperSize;
s.PaperSource = PaperSource;
s.Margins = Margins;
s.Landscape = Landscape;
}
public void From(PageSettings s)
{
PaperSize = s.PaperSize;
PaperSource = s.PaperSource;
Margins = s.Margins;
Landscape = s.Landscape;
}
}
public class PrinterService
{
//public int port = 54578;
protected Server server;
public void StartServer(IEnumerable<ChannelOption> options, IEnumerable<ServerServiceDefinition> services, int port)
{
try
{
server = new Server(options)
{
Ports = { new ServerPort("0.0.0.0", port, ServerCredentials.Insecure) }
};
foreach (var def in services)
server.Services.Add(def);
server.Start();
//Log("Start Grpc Server");
Console.WriteLine("Start Grpc Server");
}
catch (System.Exception e)
{
//Log(e.Message, LogType.Error);
Console.WriteLine(e.Message);
}
}
~PrinterService()
{
Shutdown();
}
protected void Shutdown()
{
if (server != null)
{
try
{
server.ShutdownAsync().Wait();
server = null;
}
catch { }
}
}
/*
protected void Log(object msg, LogType type = LogType.Log)
{
Debug.unityLogger.Log(type, $"<b>[Grpc Server]</b> {msg}");
}
*/
}
public class PrinterImpl : Printer.PrinterBase
{
public delegate void PrintDelegate(UltraCombos.Utility.Image request);
public event PrintDelegate onPrint;
public PrinterImpl(PrintDelegate func)
{
onPrint += func;
}
public override Task<Empty> Print(UltraCombos.Utility.Image request, grpc::ServerCallContext context)
{
//throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, ""));
onPrint.Invoke(request);
return Task.FromResult(new Empty());
}
}
}

@ -0,0 +1,22 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace TestPrinter
{
static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1());
}
}
}

@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("TestPrinter")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("TestPrinter")]
[assembly: AssemblyCopyright("Copyright © 2018")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("a8c4999e-be74-44ff-8320-c95e2eb43c6f")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

@ -0,0 +1,71 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace TestPrinter.Properties
{
/// <summary>
/// A strongly-typed resource class, for looking up localized strings, etc.
/// </summary>
// This class was auto-generated by the StronglyTypedResourceBuilder
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources
{
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources()
{
}
/// <summary>
/// Returns the cached ResourceManager instance used by this class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager
{
get
{
if ((resourceMan == null))
{
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("TestPrinter.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// Overrides the current thread's CurrentUICulture property for all
/// resource lookups using this strongly typed resource class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture
{
get
{
return resourceCulture;
}
set
{
resourceCulture = value;
}
}
}
}

@ -0,0 +1,117 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

@ -0,0 +1,30 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace TestPrinter.Properties
{
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
{
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
public static Settings Default
{
get
{
return defaultInstance;
}
}
}
}

@ -0,0 +1,7 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
<Profiles>
<Profile Name="(Default)" />
</Profiles>
<Settings />
</SettingsFile>

@ -0,0 +1,97 @@
// <auto-generated>
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: ultracombos.printer.proto
// </auto-generated>
#pragma warning disable 0414, 1591
#region Designer generated code
using grpc = global::Grpc.Core;
namespace UltraCombos.Utility {
public static partial class Printer
{
static readonly string __ServiceName = "UltraCombos.Utility.Printer";
static readonly grpc::Marshaller<global::UltraCombos.Utility.Image> __Marshaller_UltraCombos_Utility_Image = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::UltraCombos.Utility.Image.Parser.ParseFrom);
static readonly grpc::Marshaller<global::UltraCombos.Utility.Empty> __Marshaller_UltraCombos_Utility_Empty = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::UltraCombos.Utility.Empty.Parser.ParseFrom);
static readonly grpc::Method<global::UltraCombos.Utility.Image, global::UltraCombos.Utility.Empty> __Method_Print = new grpc::Method<global::UltraCombos.Utility.Image, global::UltraCombos.Utility.Empty>(
grpc::MethodType.Unary,
__ServiceName,
"Print",
__Marshaller_UltraCombos_Utility_Image,
__Marshaller_UltraCombos_Utility_Empty);
/// <summary>Service descriptor</summary>
public static global::Google.Protobuf.Reflection.ServiceDescriptor Descriptor
{
get { return global::UltraCombos.Utility.UltracombosPrinterReflection.Descriptor.Services[0]; }
}
/// <summary>Base class for server-side implementations of Printer</summary>
public abstract partial class PrinterBase
{
public virtual global::System.Threading.Tasks.Task<global::UltraCombos.Utility.Empty> Print(global::UltraCombos.Utility.Image request, grpc::ServerCallContext context)
{
throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, ""));
}
}
/// <summary>Client for Printer</summary>
public partial class PrinterClient : grpc::ClientBase<PrinterClient>
{
/// <summary>Creates a new client for Printer</summary>
/// <param name="channel">The channel to use to make remote calls.</param>
public PrinterClient(grpc::Channel channel) : base(channel)
{
}
/// <summary>Creates a new client for Printer that uses a custom <c>CallInvoker</c>.</summary>
/// <param name="callInvoker">The callInvoker to use to make remote calls.</param>
public PrinterClient(grpc::CallInvoker callInvoker) : base(callInvoker)
{
}
/// <summary>Protected parameterless constructor to allow creation of test doubles.</summary>
protected PrinterClient() : base()
{
}
/// <summary>Protected constructor to allow creation of configured clients.</summary>
/// <param name="configuration">The client configuration.</param>
protected PrinterClient(ClientBaseConfiguration configuration) : base(configuration)
{
}
public virtual global::UltraCombos.Utility.Empty Print(global::UltraCombos.Utility.Image request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
{
return Print(request, new grpc::CallOptions(headers, deadline, cancellationToken));
}
public virtual global::UltraCombos.Utility.Empty Print(global::UltraCombos.Utility.Image request, grpc::CallOptions options)
{
return CallInvoker.BlockingUnaryCall(__Method_Print, null, options, request);
}
public virtual grpc::AsyncUnaryCall<global::UltraCombos.Utility.Empty> PrintAsync(global::UltraCombos.Utility.Image request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
{
return PrintAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken));
}
public virtual grpc::AsyncUnaryCall<global::UltraCombos.Utility.Empty> PrintAsync(global::UltraCombos.Utility.Image request, grpc::CallOptions options)
{
return CallInvoker.AsyncUnaryCall(__Method_Print, null, options, request);
}
/// <summary>Creates a new instance of client from given <c>ClientBaseConfiguration</c>.</summary>
protected override PrinterClient NewInstance(ClientBaseConfiguration configuration)
{
return new PrinterClient(configuration);
}
}
/// <summary>Creates service definition that can be registered with a server</summary>
/// <param name="serviceImpl">An object implementing the server-side handling logic.</param>
public static grpc::ServerServiceDefinition BindService(PrinterBase serviceImpl)
{
return grpc::ServerServiceDefinition.CreateBuilder()
.AddMethod(__Method_Print, serviceImpl.Print).Build();
}
}
}
#endregion

@ -0,0 +1,276 @@
// <auto-generated>
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: ultracombos.printer.proto
// </auto-generated>
#pragma warning disable 1591, 0612, 3021
#region Designer generated code
using pb = global::Google.Protobuf;
using pbc = global::Google.Protobuf.Collections;
using pbr = global::Google.Protobuf.Reflection;
using scg = global::System.Collections.Generic;
namespace UltraCombos.Utility {
/// <summary>Holder for reflection information generated from ultracombos.printer.proto</summary>
public static partial class UltracombosPrinterReflection {
#region Descriptor
/// <summary>File descriptor for ultracombos.printer.proto</summary>
public static pbr::FileDescriptor Descriptor {
get { return descriptor; }
}
private static pbr::FileDescriptor descriptor;
static UltracombosPrinterReflection() {
byte[] descriptorData = global::System.Convert.FromBase64String(
string.Concat(
"Chl1bHRyYWNvbWJvcy5wcmludGVyLnByb3RvEhNVbHRyYUNvbWJvcy5VdGls",
"aXR5IgcKBUVtcHR5IhgKBUltYWdlEg8KB2NvbnRlbnQYASABKAwyTAoHUHJp",
"bnRlchJBCgVQcmludBIaLlVsdHJhQ29tYm9zLlV0aWxpdHkuSW1hZ2UaGi5V",
"bHRyYUNvbWJvcy5VdGlsaXR5LkVtcHR5IgBiBnByb3RvMw=="));
descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData,
new pbr::FileDescriptor[] { },
new pbr::GeneratedClrTypeInfo(null, new pbr::GeneratedClrTypeInfo[] {
new pbr::GeneratedClrTypeInfo(typeof(global::UltraCombos.Utility.Empty), global::UltraCombos.Utility.Empty.Parser, null, null, null, null),
new pbr::GeneratedClrTypeInfo(typeof(global::UltraCombos.Utility.Image), global::UltraCombos.Utility.Image.Parser, new[]{ "Content" }, null, null, null)
}));
}
#endregion
}
#region Messages
public sealed partial class Empty : pb::IMessage<Empty> {
private static readonly pb::MessageParser<Empty> _parser = new pb::MessageParser<Empty>(() => new Empty());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pb::MessageParser<Empty> Parser { get { return _parser; } }
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pbr::MessageDescriptor Descriptor {
get { return global::UltraCombos.Utility.UltracombosPrinterReflection.Descriptor.MessageTypes[0]; }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
pbr::MessageDescriptor pb::IMessage.Descriptor {
get { return Descriptor; }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public Empty() {
OnConstruction();
}
partial void OnConstruction();
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public Empty(Empty other) : this() {
_unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public Empty Clone() {
return new Empty(this);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public override bool Equals(object other) {
return Equals(other as Empty);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public bool Equals(Empty other) {
if (ReferenceEquals(other, null)) {
return false;
}
if (ReferenceEquals(other, this)) {
return true;
}
return Equals(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public override int GetHashCode() {
int hash = 1;
if (_unknownFields != null) {
hash ^= _unknownFields.GetHashCode();
}
return hash;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public override string ToString() {
return pb::JsonFormatter.ToDiagnosticString(this);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void WriteTo(pb::CodedOutputStream output) {
if (_unknownFields != null) {
_unknownFields.WriteTo(output);
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public int CalculateSize() {
int size = 0;
if (_unknownFields != null) {
size += _unknownFields.CalculateSize();
}
return size;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void MergeFrom(Empty other) {
if (other == null) {
return;
}
_unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void MergeFrom(pb::CodedInputStream input) {
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
}
}
}
}
public sealed partial class Image : pb::IMessage<Image> {
private static readonly pb::MessageParser<Image> _parser = new pb::MessageParser<Image>(() => new Image());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pb::MessageParser<Image> Parser { get { return _parser; } }
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pbr::MessageDescriptor Descriptor {
get { return global::UltraCombos.Utility.UltracombosPrinterReflection.Descriptor.MessageTypes[1]; }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
pbr::MessageDescriptor pb::IMessage.Descriptor {
get { return Descriptor; }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public Image() {
OnConstruction();
}
partial void OnConstruction();
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public Image(Image other) : this() {
content_ = other.content_;
_unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public Image Clone() {
return new Image(this);
}
/// <summary>Field number for the "content" field.</summary>
public const int ContentFieldNumber = 1;
private pb::ByteString content_ = pb::ByteString.Empty;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public pb::ByteString Content {
get { return content_; }
set {
content_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public override bool Equals(object other) {
return Equals(other as Image);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public bool Equals(Image other) {
if (ReferenceEquals(other, null)) {
return false;
}
if (ReferenceEquals(other, this)) {
return true;
}
if (Content != other.Content) return false;
return Equals(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public override int GetHashCode() {
int hash = 1;
if (Content.Length != 0) hash ^= Content.GetHashCode();
if (_unknownFields != null) {
hash ^= _unknownFields.GetHashCode();
}
return hash;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public override string ToString() {
return pb::JsonFormatter.ToDiagnosticString(this);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void WriteTo(pb::CodedOutputStream output) {
if (Content.Length != 0) {
output.WriteRawTag(10);
output.WriteBytes(Content);
}
if (_unknownFields != null) {
_unknownFields.WriteTo(output);
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public int CalculateSize() {
int size = 0;
if (Content.Length != 0) {
size += 1 + pb::CodedOutputStream.ComputeBytesSize(Content);
}
if (_unknownFields != null) {
size += _unknownFields.CalculateSize();
}
return size;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void MergeFrom(Image other) {
if (other == null) {
return;
}
if (other.Content.Length != 0) {
Content = other.Content;
}
_unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void MergeFrom(pb::CodedInputStream input) {
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 10: {
Content = input.ReadBytes();
break;
}
}
}
}
}
#endregion
}
#endregion Designer generated code

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Google.Protobuf" version="3.6.1" targetFramework="net461" />
<package id="Grpc" version="1.21.0" targetFramework="net461" />
<package id="Grpc.Core" version="1.21.0" targetFramework="net461" />
<package id="Grpc.Core.Api" version="1.21.0" targetFramework="net461" />
<package id="Newtonsoft.Json" version="11.0.2" targetFramework="net461" />
<package id="System.Interactive.Async" version="3.2.0" targetFramework="net461" />
</packages>
Loading…
Cancel
Save