Commit ab11d17f by Tapio Haapala

Merge branch 'master' of gitlab.codecrew.fi:liv/moya-info-tools

Conflicts:
	BarcodeScannerClient/BarcodeScannerClient/BarcodeScannerClient/Form1.cs
	BarcodeScannerClient/BarcodeScannerClient/BarcodeScannerClient/bin/Debug/BarcodeScannerClient.exe
	BarcodeScannerClient/BarcodeScannerClient/BarcodeScannerClient/bin/Debug/BarcodeScannerClient.pdb
	BarcodeScannerClient/BarcodeScannerClient/BarcodeScannerClient/obj/x86/Debug/BarcodeScannerClient.csproj.FileListAbsolute.txt
	BarcodeScannerClient/BarcodeScannerClient/BarcodeScannerClient/obj/x86/Debug/BarcodeScannerClient.csprojResolveAssemblyReference.cache
	BarcodeScannerClient/BarcodeScannerClient/BarcodeScannerClient/obj/x86/Debug/BarcodeScannerClient.exe
	BarcodeScannerClient/BarcodeScannerClient/BarcodeScannerClient/obj/x86/Debug/BarcodeScannerClient.pdb
	MoyaAdmin/MoyaAdminUI/MoyaAdminUI/obj/Debug/MoyaAdminUI.csproj.FileListAbsolute.txt
	PrintServer/moyaPrintServer/moyaPrintServer/Form1.cs
	PrintServer/moyaPrintServer/moyaPrintServer/bin/Debug/moyaPrintServer.exe
	PrintServer/moyaPrintServer/moyaPrintServer/bin/Debug/moyaPrintServer.exe.config
	PrintServer/moyaPrintServer/moyaPrintServer/bin/Debug/moyaPrintServer.pdb
	PrintServer/moyaPrintServer/moyaPrintServer/bin/Debug/moyaPrintServer.vshost.exe
	PrintServer/moyaPrintServer/moyaPrintServer/bin/Debug/moyaPrintServer.vshost.exe.config
2 parents c570adcd b730dd7f
Showing with 1536 additions and 185 deletions
/BarcodeScannerClient/BarcodeScannerClient/BarcodeScannerClient/obj
/BarcodeScannerClient/BarcodeScannerClient/BarcodeScannerClient/bin
/PrintServer/moyaPrintServer/moyaPrintServer/obj
bin
namespace BarcodeScannerClient
{
partial class ApiSettings
{
/// <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()
{
this.label4 = new System.Windows.Forms.Label();
this.ApiPassTextBox = new System.Windows.Forms.TextBox();
this.label3 = new System.Windows.Forms.Label();
this.ApiUserTextBox = new System.Windows.Forms.TextBox();
this.label2 = new System.Windows.Forms.Label();
this.ApiKeyTextBox = new System.Windows.Forms.TextBox();
this.SaveButton = new System.Windows.Forms.Button();
this.label1 = new System.Windows.Forms.Label();
this.apiURLTextBox = new System.Windows.Forms.TextBox();
this.SuspendLayout();
//
// label4
//
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(12, 148);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(48, 13);
this.label4.TabIndex = 26;
this.label4.Text = "Api Pass";
//
// ApiPassTextBox
//
this.ApiPassTextBox.Location = new System.Drawing.Point(12, 164);
this.ApiPassTextBox.Name = "ApiPassTextBox";
this.ApiPassTextBox.PasswordChar = 'ῷ';
this.ApiPassTextBox.Size = new System.Drawing.Size(260, 20);
this.ApiPassTextBox.TabIndex = 25;
//
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(12, 109);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(47, 13);
this.label3.TabIndex = 24;
this.label3.Text = "Api User";
//
// ApiUserTextBox
//
this.ApiUserTextBox.Location = new System.Drawing.Point(12, 125);
this.ApiUserTextBox.Name = "ApiUserTextBox";
this.ApiUserTextBox.Size = new System.Drawing.Size(260, 20);
this.ApiUserTextBox.TabIndex = 23;
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(12, 70);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(79, 13);
this.label2.TabIndex = 22;
this.label2.Text = "Application key";
//
// ApiKeyTextBox
//
this.ApiKeyTextBox.Location = new System.Drawing.Point(12, 86);
this.ApiKeyTextBox.Name = "ApiKeyTextBox";
this.ApiKeyTextBox.Size = new System.Drawing.Size(260, 20);
this.ApiKeyTextBox.TabIndex = 21;
//
// SaveButton
//
this.SaveButton.Location = new System.Drawing.Point(197, 210);
this.SaveButton.Name = "SaveButton";
this.SaveButton.Size = new System.Drawing.Size(75, 23);
this.SaveButton.TabIndex = 20;
this.SaveButton.Text = "Save";
this.SaveButton.UseVisualStyleBackColor = true;
this.SaveButton.Click += new System.EventHandler(this.SaveButton_Click);
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(12, 27);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(47, 13);
this.label1.TabIndex = 19;
this.label1.Text = "Moya url";
//
// apiURLTextBox
//
this.apiURLTextBox.Location = new System.Drawing.Point(12, 43);
this.apiURLTextBox.Name = "apiURLTextBox";
this.apiURLTextBox.Size = new System.Drawing.Size(260, 20);
this.apiURLTextBox.TabIndex = 18;
//
// ApiSettings
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(284, 261);
this.Controls.Add(this.label4);
this.Controls.Add(this.ApiPassTextBox);
this.Controls.Add(this.label3);
this.Controls.Add(this.ApiUserTextBox);
this.Controls.Add(this.label2);
this.Controls.Add(this.ApiKeyTextBox);
this.Controls.Add(this.SaveButton);
this.Controls.Add(this.label1);
this.Controls.Add(this.apiURLTextBox);
this.Name = "ApiSettings";
this.Text = "ApiSettings";
this.Load += new System.EventHandler(this.ApiSettings_Load);
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Label label4;
private System.Windows.Forms.TextBox ApiPassTextBox;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.TextBox ApiUserTextBox;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.TextBox ApiKeyTextBox;
private System.Windows.Forms.Button SaveButton;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.TextBox apiURLTextBox;
}
}
\ No newline at end of file
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace BarcodeScannerClient
{
public partial class ApiSettings : Form
{
public ApiSettings()
{
InitializeComponent();
}
private void SaveButton_Click(object sender, EventArgs e)
{
Properties.Settings.Default.ApiURL = apiURLTextBox.Text;
Properties.Settings.Default.ApiKey = ApiKeyTextBox.Text;
Properties.Settings.Default.ApiUser = ApiUserTextBox.Text;
Properties.Settings.Default.ApiPass = ApiPassTextBox.Text;
Properties.Settings.Default.Save();
this.DialogResult = System.Windows.Forms.DialogResult.OK;
}
private void ApiSettings_Load(object sender, EventArgs e)
{
apiURLTextBox.Text = Properties.Settings.Default.ApiURL;
ApiKeyTextBox.Text = Properties.Settings.Default.ApiKey;
ApiUserTextBox.Text = Properties.Settings.Default.ApiUser;
ApiPassTextBox.Text = Properties.Settings.Default.ApiPass;
}
}
}
<?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.Runtime.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:import namespace="http://www.w3.org/XML/1998/namespace" />
<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" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</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" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</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=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
\ No newline at end of file
using System;
using System.IO;
using System.Net;
using System.Security.Cryptography;
using System.Text;
public enum BarcodeHttpVerb
......@@ -55,10 +56,17 @@ namespace HttpUtils
{
return MakeRequest("");
}
public static string GetRequestURL(string server, string parameters)
{
int timestamp = ConvertToTimestamp(DateTime.Now);
string hash = CalculateSHA1("/" + parameters + "+" + BarcodeScannerClient.Properties.Settings.Default.ApiKey + "+" + BarcodeScannerClient.Properties.Settings.Default.ApiUser + "+" + timestamp + "+" + BarcodeScannerClient.Properties.Settings.Default.ApiPass);
string url = server + "/rest/" + parameters + "?appkey=" + BarcodeScannerClient.Properties.Settings.Default.ApiKey + "&appuser=" + BarcodeScannerClient.Properties.Settings.Default.ApiUser + "&appstamp=" + timestamp + "&appmac=" + hash;
return url;
}
public string MakeRequest(string parameters)
{
var request = (HttpWebRequest)WebRequest.Create(EndPoint + parameters);
var request = (HttpWebRequest)WebRequest.Create(EndPoint+parameters);
request.Method = Method.ToString();
request.ContentLength = 0;
......@@ -100,6 +108,33 @@ namespace HttpUtils
}
}
public static string CalculateSHA1(string text)
{
// Convert the input string to a byte array
byte[] buffer = Encoding.GetEncoding("iso-8859-1").GetBytes(text);
// In doing your test, you won't want to re-initialize like this every time you test a
// string.
SHA1CryptoServiceProvider cryptoTransformSHA1 =
new SHA1CryptoServiceProvider();
// The replace won't be necessary for your tests so long as you are consistent in what
// you compare.
string hash = BitConverter.ToString(cryptoTransformSHA1.ComputeHash(buffer)).Replace("-", "").ToLower();
return hash;
}
private static int ConvertToTimestamp(DateTime value)
{
//create Timespan by subtracting the value provided from
//the Unix Epoch
TimeSpan span = (value - new DateTime(1970, 1, 1, 0, 0, 0, 0).ToLocalTime());
//return the total seconds (which is a UNIX timestamp)
return (int)span.TotalSeconds;
}
} // class
}
\ No newline at end of file
......@@ -46,6 +46,12 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="ApiSettings.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="ApiSettings.Designer.cs">
<DependentUpon>ApiSettings.cs</DependentUpon>
</Compile>
<Compile Include="Form1.cs">
<SubType>Form</SubType>
</Compile>
......@@ -56,6 +62,9 @@
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="BarcodeRestClient.cs" />
<Compile Include="Scanner.cs" />
<EmbeddedResource Include="ApiSettings.resx">
<DependentUpon>ApiSettings.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Form1.resx">
<DependentUpon>Form1.cs</DependentUpon>
</EmbeddedResource>
......
......@@ -29,35 +29,18 @@
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Form1));
this.label1 = new System.Windows.Forms.Label();
this.apiUrlTextBox = new System.Windows.Forms.TextBox();
this.label4 = new System.Windows.Forms.Label();
this.PortsComboBox = new System.Windows.Forms.ComboBox();
this.status = new System.Windows.Forms.TextBox();
this.toolStrip1 = new System.Windows.Forms.ToolStrip();
this.settingsToolStripButton = new System.Windows.Forms.ToolStripButton();
this.toolStrip1.SuspendLayout();
this.SuspendLayout();
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(12, 9);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(52, 13);
this.label1.TabIndex = 11;
this.label1.Text = "API URL:";
//
// apiUrlTextBox
//
this.apiUrlTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.apiUrlTextBox.Location = new System.Drawing.Point(15, 30);
this.apiUrlTextBox.Name = "apiUrlTextBox";
this.apiUrlTextBox.Size = new System.Drawing.Size(298, 20);
this.apiUrlTextBox.TabIndex = 10;
//
// label4
//
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(12, 53);
this.label4.Location = new System.Drawing.Point(9, 31);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(71, 13);
this.label4.TabIndex = 16;
......@@ -65,42 +48,63 @@
//
// PortsComboBox
//
this.PortsComboBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.PortsComboBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.PortsComboBox.FormattingEnabled = true;
this.PortsComboBox.Location = new System.Drawing.Point(15, 69);
this.PortsComboBox.Location = new System.Drawing.Point(12, 47);
this.PortsComboBox.Name = "PortsComboBox";
this.PortsComboBox.Size = new System.Drawing.Size(298, 21);
this.PortsComboBox.Size = new System.Drawing.Size(313, 21);
this.PortsComboBox.TabIndex = 15;
this.PortsComboBox.SelectedIndexChanged += new System.EventHandler(this.PortsComboBox_SelectedIndexChanged);
//
// status
//
this.status.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.status.Location = new System.Drawing.Point(15, 96);
this.status.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.status.Location = new System.Drawing.Point(12, 74);
this.status.Multiline = true;
this.status.Name = "status";
this.status.ReadOnly = true;
this.status.Size = new System.Drawing.Size(298, 183);
this.status.Size = new System.Drawing.Size(313, 205);
this.status.TabIndex = 17;
//
// toolStrip1
//
this.toolStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.settingsToolStripButton});
this.toolStrip1.Location = new System.Drawing.Point(0, 0);
this.toolStrip1.Name = "toolStrip1";
this.toolStrip1.Size = new System.Drawing.Size(340, 25);
this.toolStrip1.TabIndex = 18;
this.toolStrip1.Text = "toolStrip1";
//
// settingsToolStripButton
//
this.settingsToolStripButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
this.settingsToolStripButton.Image = ((System.Drawing.Image)(resources.GetObject("settingsToolStripButton.Image")));
this.settingsToolStripButton.ImageTransparentColor = System.Drawing.Color.Magenta;
this.settingsToolStripButton.Name = "settingsToolStripButton";
this.settingsToolStripButton.Size = new System.Drawing.Size(23, 22);
this.settingsToolStripButton.Text = "Api Settings";
this.settingsToolStripButton.Click += new System.EventHandler(this.settingsToolStripButton_Click);
//
// Form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(325, 291);
this.ClientSize = new System.Drawing.Size(340, 291);
this.Controls.Add(this.toolStrip1);
this.Controls.Add(this.status);
this.Controls.Add(this.label4);
this.Controls.Add(this.PortsComboBox);
this.Controls.Add(this.label1);
this.Controls.Add(this.apiUrlTextBox);
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.Name = "Form1";
this.Text = "ScannerClient";
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.Form1_FormClosing);
this.Load += new System.EventHandler(this.Form1_Load);
this.toolStrip1.ResumeLayout(false);
this.toolStrip1.PerformLayout();
this.ResumeLayout(false);
this.PerformLayout();
......@@ -108,11 +112,11 @@
#endregion
private System.Windows.Forms.Label label1;
private System.Windows.Forms.TextBox apiUrlTextBox;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.ComboBox PortsComboBox;
private System.Windows.Forms.TextBox status;
private System.Windows.Forms.ToolStrip toolStrip1;
private System.Windows.Forms.ToolStripButton settingsToolStripButton;
}
}
......
......@@ -29,17 +29,20 @@ namespace BarcodeScannerClient
}
PortsComboBox.SelectedItem = Properties.Settings.Default.Port;
// apiKeyTextBox.Text = Properties.Settings.Default.ApiKey;
<<<<<<< HEAD
apiUrlTextBox.Text = Properties.Settings.Default.ApiURL;
if (apiUrlTextBox.Text == "")
{
apiUrlTextBox.Text = "http://my.event.ltd/shop/rfidListener.jsf?reader=demo_reader&tag=%";
}
=======
>>>>>>> b730dd7f982f556ecbc4adf437995c3832096919
}
string ret = "";
void scanner_BarcodeReceived(string data)
{
string url = apiUrlTextBox.Text.Replace("%", data);
string url = Properties.Settings.Default.ApiURL.Replace("%", data);
BarcodeRestClient client = new BarcodeRestClient(url);
try
......@@ -71,8 +74,7 @@ namespace BarcodeScannerClient
{
Properties.Settings.Default.Port = PortsComboBox.SelectedItem.ToString();
}
//Properties.Settings.Default.ApiKey = apiKeyTextBox.Text;
Properties.Settings.Default.ApiURL = apiUrlTextBox.Text;
Properties.Settings.Default.Save();
}
......@@ -85,5 +87,11 @@ namespace BarcodeScannerClient
}
scanner.Listen();
}
private void settingsToolStripButton_Click(object sender, EventArgs e)
{
ApiSettings frm = new ApiSettings();
frm.ShowDialog();
}
}
}
......@@ -117,7 +117,19 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="toolStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="settingsToolStripButton.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAACWSURBVDhPrZCLDcAgCAWd1hVcwRVcwRVcwRWcxeYRSCjV
hn4uIWkFTiT8Tu99jjEo+OgZKaXZWiOByDi1xxZZCR/vQZEtLKXQ2Sp3AbfZQt1ca70XYGTdYAMXcOke
jKwnseFapkgwst2BWyJA8FkCVhIEp33gSdKIJ8quOO1DGvmXJuNPPxDIDrTsETnniYgxvhOcCeEASkcG
PKycdQEAAAAASUVORK5CYII=
</value>
</data>
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
AAABAAkAMDAQAAAAAABoBgAAlgAAACAgEAAAAAAA6AIAAP4GAAAQEBAAAAAAACgBAADmCQAAMDAAAAEA
......
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.17929
// Runtime Version:4.0.30319.18449
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
......@@ -12,7 +12,7 @@ namespace BarcodeScannerClient.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "10.0.0.0")]
[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())));
......@@ -58,5 +58,29 @@ namespace BarcodeScannerClient.Properties {
this["ApiURL"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("")]
public string ApiUser {
get {
return ((string)(this["ApiUser"]));
}
set {
this["ApiUser"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("")]
public string ApiPass {
get {
return ((string)(this["ApiPass"]));
}
set {
this["ApiPass"] = value;
}
}
}
}
......@@ -11,5 +11,11 @@
<Setting Name="ApiURL" Type="System.String" Scope="User">
<Value Profile="(Default)" />
</Setting>
<Setting Name="ApiUser" Type="System.String" Scope="User">
<Value Profile="(Default)" />
</Setting>
<Setting Name="ApiPass" Type="System.String" Scope="User">
<Value Profile="(Default)" />
</Setting>
</Settings>
</SettingsFile>
\ No newline at end of file
......@@ -16,6 +16,12 @@
<setting name="ApiURL" serializeAs="String">
<value />
</setting>
<setting name="ApiUser" serializeAs="String">
<value />
</setting>
<setting name="ApiPass" serializeAs="String">
<value />
</setting>
</BarcodeScannerClient.Properties.Settings>
</userSettings>
</configuration>
\ No newline at end of file
C:\devel\proj\moya\BarcodeScannerClient\BarcodeScannerClient\BarcodeScannerClient\bin\Debug\BarcodeScannerClient.exe.config
C:\devel\proj\moya\BarcodeScannerClient\BarcodeScannerClient\BarcodeScannerClient\bin\Debug\BarcodeScannerClient.exe
C:\devel\proj\moya\BarcodeScannerClient\BarcodeScannerClient\BarcodeScannerClient\bin\Debug\BarcodeScannerClient.pdb
C:\devel\proj\moya\BarcodeScannerClient\BarcodeScannerClient\BarcodeScannerClient\obj\x86\Debug\BarcodeScannerClient.Form1.resources
C:\devel\proj\moya\BarcodeScannerClient\BarcodeScannerClient\BarcodeScannerClient\obj\x86\Debug\BarcodeScannerClient.Properties.Resources.resources
C:\devel\proj\moya\BarcodeScannerClient\BarcodeScannerClient\BarcodeScannerClient\obj\x86\Debug\BarcodeScannerClient.csproj.GenerateResource.Cache
C:\devel\proj\moya\BarcodeScannerClient\BarcodeScannerClient\BarcodeScannerClient\obj\x86\Debug\BarcodeScannerClient.exe
C:\devel\proj\moya\BarcodeScannerClient\BarcodeScannerClient\BarcodeScannerClient\obj\x86\Debug\BarcodeScannerClient.pdb
C:\devel\proj\moya\BarcodeScannerClient\BarcodeScannerClient\BarcodeScannerClient\obj\x86\Debug\BarcodeScannerClient.csprojResolveAssemblyReference.cache
C:\devel\proj\moya-info-tools\BarcodeScannerClient\BarcodeScannerClient\BarcodeScannerClient\bin\Debug\BarcodeScannerClient.exe.config
C:\devel\proj\moya-info-tools\BarcodeScannerClient\BarcodeScannerClient\BarcodeScannerClient\obj\x86\Debug\BarcodeScannerClient.exe
C:\devel\proj\moya-info-tools\BarcodeScannerClient\BarcodeScannerClient\BarcodeScannerClient\obj\x86\Debug\BarcodeScannerClient.pdb
C:\devel\proj\moya-info-tools\BarcodeScannerClient\BarcodeScannerClient\BarcodeScannerClient\bin\Debug\BarcodeScannerClient.exe
C:\devel\proj\moya-info-tools\BarcodeScannerClient\BarcodeScannerClient\BarcodeScannerClient\bin\Debug\BarcodeScannerClient.pdb
C:\devel\proj\moya-info-tools\BarcodeScannerClient\BarcodeScannerClient\BarcodeScannerClient\obj\x86\Debug\BarcodeScannerClient.csprojResolveAssemblyReference.cache
C:\devel\proj\moya-info-tools\BarcodeScannerClient\BarcodeScannerClient\BarcodeScannerClient\obj\x86\Debug\BarcodeScannerClient.Form1.resources
C:\devel\proj\moya-info-tools\BarcodeScannerClient\BarcodeScannerClient\BarcodeScannerClient\obj\x86\Debug\BarcodeScannerClient.Properties.Resources.resources
C:\devel\proj\moya-info-tools\BarcodeScannerClient\BarcodeScannerClient\BarcodeScannerClient\obj\x86\Debug\BarcodeScannerClient.csproj.GenerateResource.Cache
I:\devel\proj\moya-info-tools\BarcodeScannerClient\BarcodeScannerClient\BarcodeScannerClient\obj\x86\Debug\BarcodeScannerClient.csprojResolveAssemblyReference.cache
I:\devel\proj\moya-info-tools\BarcodeScannerClient\BarcodeScannerClient\BarcodeScannerClient\obj\x86\Debug\BarcodeScannerClient.Form1.resources
I:\devel\proj\moya-info-tools\BarcodeScannerClient\BarcodeScannerClient\BarcodeScannerClient\obj\x86\Debug\BarcodeScannerClient.Properties.Resources.resources
I:\devel\proj\moya-info-tools\BarcodeScannerClient\BarcodeScannerClient\BarcodeScannerClient\obj\x86\Debug\BarcodeScannerClient.csproj.GenerateResource.Cache
I:\devel\proj\moya-info-tools\BarcodeScannerClient\BarcodeScannerClient\BarcodeScannerClient\obj\x86\Debug\BarcodeScannerClient.exe
I:\devel\proj\moya-info-tools\BarcodeScannerClient\BarcodeScannerClient\BarcodeScannerClient\obj\x86\Debug\BarcodeScannerClient.ApiSettings.resources
I:\devel\proj\moya-info-tools\BarcodeScannerClient\BarcodeScannerClient\BarcodeScannerClient\bin\Debug\BarcodeScannerClient.exe.config
I:\devel\proj\moya-info-tools\BarcodeScannerClient\BarcodeScannerClient\BarcodeScannerClient\bin\Debug\BarcodeScannerClient.exe
I:\devel\proj\moya-info-tools\BarcodeScannerClient\BarcodeScannerClient\BarcodeScannerClient\bin\Debug\BarcodeScannerClient.pdb
I:\devel\proj\moya-info-tools\BarcodeScannerClient\BarcodeScannerClient\BarcodeScannerClient\obj\x86\Debug\BarcodeScannerClient.pdb
......@@ -3,8 +3,6 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Express 2012 for Windows Desktop
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CardDisplay", "CardDisplay\CardDisplay.csproj", "{9CE1A44D-28CF-4277-BAC7-D73A8C2D8059}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BarcodeScannerClient", "..\..\BarcodeScannerClient\BarcodeScannerClient\BarcodeScannerClient\BarcodeScannerClient.csproj", "{967BFEFE-7B3C-4EE9-80F1-EC6903E1ACB5}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x86 = Debug|x86
......@@ -15,10 +13,6 @@ Global
{9CE1A44D-28CF-4277-BAC7-D73A8C2D8059}.Debug|x86.Build.0 = Debug|x86
{9CE1A44D-28CF-4277-BAC7-D73A8C2D8059}.Release|x86.ActiveCfg = Release|x86
{9CE1A44D-28CF-4277-BAC7-D73A8C2D8059}.Release|x86.Build.0 = Release|x86
{967BFEFE-7B3C-4EE9-80F1-EC6903E1ACB5}.Debug|x86.ActiveCfg = Debug|x86
{967BFEFE-7B3C-4EE9-80F1-EC6903E1ACB5}.Debug|x86.Build.0 = Debug|x86
{967BFEFE-7B3C-4EE9-80F1-EC6903E1ACB5}.Release|x86.ActiveCfg = Release|x86
{967BFEFE-7B3C-4EE9-80F1-EC6903E1ACB5}.Release|x86.Build.0 = Release|x86
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
......
......@@ -49,32 +49,42 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="AddCardMetaData.cs">
<Compile Include="DataClasses\MetaData.cs" />
<Compile Include="Forms\AddCardMetaData.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="AddCardMetaData.Designer.cs">
<Compile Include="Forms\AddCardMetaData.Designer.cs">
<DependentUpon>AddCardMetaData.cs</DependentUpon>
</Compile>
<Compile Include="Card.cs" />
<Compile Include="CardList.cs" />
<Compile Include="Eventuser.cs" />
<Compile Include="Form1.cs">
<Compile Include="DataClasses\Card.cs" />
<Compile Include="DataClasses\CardList.cs" />
<Compile Include="DataClasses\Eventuser.cs" />
<Compile Include="Forms\ApiSettings.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Form1.Designer.cs">
<Compile Include="Forms\ApiSettings.Designer.cs">
<DependentUpon>ApiSettings.cs</DependentUpon>
</Compile>
<Compile Include="Forms\Form1.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Forms\Form1.Designer.cs">
<DependentUpon>Form1.cs</DependentUpon>
</Compile>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Reader.cs" />
<Compile Include="ReaderEvent.cs" />
<Compile Include="ReaderEventList.cs" />
<Compile Include="ReaderList.cs" />
<Compile Include="RestClient.cs" />
<EmbeddedResource Include="AddCardMetaData.resx">
<Compile Include="DataClasses\Reader.cs" />
<Compile Include="DataClasses\ReaderEvent.cs" />
<Compile Include="DataClasses\ReaderEventList.cs" />
<Compile Include="DataClasses\ReaderList.cs" />
<Compile Include="DataClasses\RestClient.cs" />
<EmbeddedResource Include="Forms\AddCardMetaData.resx">
<DependentUpon>AddCardMetaData.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Form1.resx">
<EmbeddedResource Include="Forms\ApiSettings.resx">
<DependentUpon>ApiSettings.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Forms\Form1.resx">
<DependentUpon>Form1.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.resx">
......@@ -98,12 +108,6 @@
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\BarcodeScannerClient\BarcodeScannerClient\BarcodeScannerClient\BarcodeScannerClient.csproj">
<Project>{967bfefe-7b3c-4ee9-80f1-ec6903e1acb5}</Project>
<Name>BarcodeScannerClient</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
......
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.Script.Serialization;
namespace CardDisplay.DataClasses
{
public class MetaData
{
public string key = "";
public string value = "";
public string ImportJson()
{
var ser = new JavaScriptSerializer();
return this.GetType().ToString() + ser.Serialize(this);
}
}
}
using System;
using System.IO;
using System.Net;
using System.Security.Cryptography;
using System.Text;
public enum HttpVerb
......@@ -16,25 +17,25 @@ namespace HttpUtils
public class RestClient
{
public string EndPoint { get; set; }
public BarcodeHttpVerb Method { get; set; }
public HttpVerb Method { get; set; }
public string ContentType { get; set; }
public string PostData { get; set; }
public RestClient()
{
EndPoint = "";
Method = BarcodeHttpVerb.GET;
Method = HttpVerb.GET;
ContentType = "application/json";
PostData = "";
}
public RestClient(string endpoint)
{
EndPoint = endpoint;
Method = BarcodeHttpVerb.GET;
Method = HttpVerb.GET;
ContentType = "application/json";
PostData = "";
}
public RestClient(string endpoint, BarcodeHttpVerb method)
public RestClient(string endpoint, HttpVerb method)
{
EndPoint = endpoint;
Method = method;
......@@ -42,7 +43,7 @@ namespace HttpUtils
PostData = "";
}
public RestClient(string endpoint, BarcodeHttpVerb method, string postData)
public RestClient(string endpoint, HttpVerb method, string postData)
{
EndPoint = endpoint;
Method = method;
......@@ -50,21 +51,57 @@ namespace HttpUtils
PostData = postData;
}
public static string GetRequestURL(string server, string parameters)
{
int timestamp = ConvertToTimestamp(DateTime.Now);
string hash = CalculateSHA1("/" + parameters + "+" + CardDisplay.Properties.Settings.Default.ApiKey + "+" + CardDisplay.Properties.Settings.Default.ApiUser + "+" + timestamp + "+" + CardDisplay.Properties.Settings.Default.ApiPass);
string url = server + "/rest/" + parameters + "?appkey=" + CardDisplay.Properties.Settings.Default.ApiKey + "&appuser=" + CardDisplay.Properties.Settings.Default.ApiUser + "&appstamp=" + timestamp + "&appmac=" + hash;
return url;
}
public static string CalculateSHA1(string text)
{
// Convert the input string to a byte array
byte[] buffer = Encoding.GetEncoding("iso-8859-1").GetBytes(text);
// In doing your test, you won't want to re-initialize like this every time you test a
// string.
SHA1CryptoServiceProvider cryptoTransformSHA1 =
new SHA1CryptoServiceProvider();
// The replace won't be necessary for your tests so long as you are consistent in what
// you compare.
string hash = BitConverter.ToString(cryptoTransformSHA1.ComputeHash(buffer)).Replace("-", "").ToLower();
return hash;
}
private static int ConvertToTimestamp(DateTime value)
{
//create Timespan by subtracting the value provided from
//the Unix Epoch
TimeSpan span = (value - new DateTime(1970, 1, 1, 0, 0, 0, 0).ToLocalTime());
//return the total seconds (which is a UNIX timestamp)
return (int)span.TotalSeconds;
}
public string MakeRequest()
{
return MakeRequest("");
}
public string MakeRequest(string parameters)
{
var request = (HttpWebRequest)WebRequest.Create(EndPoint + parameters);
var request = (HttpWebRequest)WebRequest.Create(GetRequestURL(EndPoint,parameters));
request.Method = Method.ToString();
request.ContentLength = 0;
request.ContentType = ContentType;
if (!string.IsNullOrEmpty(PostData) && Method == BarcodeHttpVerb.POST)
if (!string.IsNullOrEmpty(PostData) && Method == HttpVerb.POST)
{
var encoding = new UTF8Encoding();
var bytes = Encoding.GetEncoding("iso-8859-1").GetBytes(PostData);
......
using BarcodeScannerClient;
using CardDisplay.DataClasses;
using System;
using System.Collections.Generic;
using System.ComponentModel;
......@@ -85,6 +85,10 @@ namespace CardDisplay
value = prefixTextBox.Text + ".";
value += bookNumber.ToString() + "." + pageNumber.ToString() + "." + slotNumber.ToString();
MetaData data = new MetaData();
data.key = key;
data.value = value;
if ((slotNumber + 1) >= SlotsNumberNumericUpDown.Value)
{
slotNumber = 1;
......@@ -95,6 +99,10 @@ namespace CardDisplay
lastAddedTextBox.Text = key + ":" + value;
HttpUtils.RestClient client2 = new HttpUtils.RestClient(apiUrl + "/meta/printedcard/" + card.cardId + "/card-filing");
client2.PostData = data.ImportJson();
client2.MakeRequest();
break;
}
}
......
namespace CardDisplay.Forms
{
partial class ApiSettings
{
/// <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()
{
this.label4 = new System.Windows.Forms.Label();
this.ApiPassTextBox = new System.Windows.Forms.TextBox();
this.label3 = new System.Windows.Forms.Label();
this.ApiUserTextBox = new System.Windows.Forms.TextBox();
this.label2 = new System.Windows.Forms.Label();
this.ApiKeyTextBox = new System.Windows.Forms.TextBox();
this.SaveButton = new System.Windows.Forms.Button();
this.label1 = new System.Windows.Forms.Label();
this.apiURLTextBox = new System.Windows.Forms.TextBox();
this.SuspendLayout();
//
// label4
//
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(12, 148);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(48, 13);
this.label4.TabIndex = 35;
this.label4.Text = "Api Pass";
//
// ApiPassTextBox
//
this.ApiPassTextBox.Location = new System.Drawing.Point(12, 164);
this.ApiPassTextBox.Name = "ApiPassTextBox";
this.ApiPassTextBox.PasswordChar = 'ῷ';
this.ApiPassTextBox.Size = new System.Drawing.Size(260, 20);
this.ApiPassTextBox.TabIndex = 34;
//
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(12, 109);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(47, 13);
this.label3.TabIndex = 33;
this.label3.Text = "Api User";
//
// ApiUserTextBox
//
this.ApiUserTextBox.Location = new System.Drawing.Point(12, 125);
this.ApiUserTextBox.Name = "ApiUserTextBox";
this.ApiUserTextBox.Size = new System.Drawing.Size(260, 20);
this.ApiUserTextBox.TabIndex = 32;
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(12, 70);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(79, 13);
this.label2.TabIndex = 31;
this.label2.Text = "Application key";
//
// ApiKeyTextBox
//
this.ApiKeyTextBox.Location = new System.Drawing.Point(12, 86);
this.ApiKeyTextBox.Name = "ApiKeyTextBox";
this.ApiKeyTextBox.Size = new System.Drawing.Size(260, 20);
this.ApiKeyTextBox.TabIndex = 30;
//
// SaveButton
//
this.SaveButton.Location = new System.Drawing.Point(197, 210);
this.SaveButton.Name = "SaveButton";
this.SaveButton.Size = new System.Drawing.Size(75, 23);
this.SaveButton.TabIndex = 29;
this.SaveButton.Text = "Save";
this.SaveButton.UseVisualStyleBackColor = true;
this.SaveButton.Click += new System.EventHandler(this.SaveButton_Click);
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(12, 27);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(47, 13);
this.label1.TabIndex = 28;
this.label1.Text = "Moya url";
//
// apiURLTextBox
//
this.apiURLTextBox.Location = new System.Drawing.Point(12, 43);
this.apiURLTextBox.Name = "apiURLTextBox";
this.apiURLTextBox.Size = new System.Drawing.Size(260, 20);
this.apiURLTextBox.TabIndex = 27;
//
// ApiSettings
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(284, 261);
this.Controls.Add(this.label4);
this.Controls.Add(this.ApiPassTextBox);
this.Controls.Add(this.label3);
this.Controls.Add(this.ApiUserTextBox);
this.Controls.Add(this.label2);
this.Controls.Add(this.ApiKeyTextBox);
this.Controls.Add(this.SaveButton);
this.Controls.Add(this.label1);
this.Controls.Add(this.apiURLTextBox);
this.Name = "ApiSettings";
this.Text = "ApiSettings";
this.Load += new System.EventHandler(this.ApiSettings_Load);
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Label label4;
private System.Windows.Forms.TextBox ApiPassTextBox;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.TextBox ApiUserTextBox;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.TextBox ApiKeyTextBox;
private System.Windows.Forms.Button SaveButton;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.TextBox apiURLTextBox;
}
}
\ No newline at end of file
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace CardDisplay.Forms
{
public partial class ApiSettings : Form
{
public ApiSettings()
{
InitializeComponent();
}
private void SaveButton_Click(object sender, EventArgs e)
{
Properties.Settings.Default.ApiURL = apiURLTextBox.Text;
Properties.Settings.Default.ApiKey = ApiKeyTextBox.Text;
Properties.Settings.Default.ApiUser = ApiUserTextBox.Text;
Properties.Settings.Default.ApiPass = ApiPassTextBox.Text;
Properties.Settings.Default.Save();
this.DialogResult = System.Windows.Forms.DialogResult.OK;
}
private void ApiSettings_Load(object sender, EventArgs e)
{
apiURLTextBox.Text = Properties.Settings.Default.ApiURL;
ApiKeyTextBox.Text = Properties.Settings.Default.ApiKey;
ApiUserTextBox.Text = Properties.Settings.Default.ApiUser;
ApiPassTextBox.Text = Properties.Settings.Default.ApiPass;
}
}
}
<?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.Runtime.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:import namespace="http://www.w3.org/XML/1998/namespace" />
<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" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</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" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</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=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
\ No newline at end of file
......@@ -36,10 +36,6 @@
this.readersComboBox1 = new System.Windows.Forms.ComboBox();
this.readersComboBox2 = new System.Windows.Forms.ComboBox();
this.readersComboBox3 = new System.Windows.Forms.ComboBox();
this.apiUrlTextBox = new System.Windows.Forms.TextBox();
this.label1 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.apiKeyTextBox = new System.Windows.Forms.TextBox();
this.timer1 = new System.Windows.Forms.Timer(this.components);
this.slot1Timer = new System.Windows.Forms.Timer(this.components);
this.slot2Timer = new System.Windows.Forms.Timer(this.components);
......@@ -52,6 +48,7 @@
this.forwardSlot3Button = new System.Windows.Forms.Button();
this.toolStrip1 = new System.Windows.Forms.ToolStrip();
this.toolStripButton1 = new System.Windows.Forms.ToolStripButton();
this.settingsToolStripButton = new System.Windows.Forms.ToolStripButton();
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBox3)).BeginInit();
......@@ -117,39 +114,6 @@
this.readersComboBox3.TabIndex = 5;
this.readersComboBox3.SelectedIndexChanged += new System.EventHandler(this.readersComboBox3_SelectedIndexChanged);
//
// apiUrlTextBox
//
this.apiUrlTextBox.Location = new System.Drawing.Point(56, 28);
this.apiUrlTextBox.Name = "apiUrlTextBox";
this.apiUrlTextBox.Size = new System.Drawing.Size(159, 20);
this.apiUrlTextBox.TabIndex = 6;
this.apiUrlTextBox.TextChanged += new System.EventHandler(this.apiUrlTextBox_TextChanged);
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(9, 31);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(41, 13);
this.label1.TabIndex = 7;
this.label1.Text = "Api Url:";
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(225, 31);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(45, 13);
this.label2.TabIndex = 9;
this.label2.Text = "Api key:";
//
// apiKeyTextBox
//
this.apiKeyTextBox.Location = new System.Drawing.Point(276, 28);
this.apiKeyTextBox.Name = "apiKeyTextBox";
this.apiKeyTextBox.Size = new System.Drawing.Size(124, 20);
this.apiKeyTextBox.TabIndex = 8;
//
// timer1
//
this.timer1.Interval = 4000;
......@@ -239,7 +203,8 @@
// toolStrip1
//
this.toolStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.toolStripButton1});
this.toolStripButton1,
this.settingsToolStripButton});
this.toolStrip1.Location = new System.Drawing.Point(0, 0);
this.toolStrip1.Name = "toolStrip1";
this.toolStrip1.Size = new System.Drawing.Size(544, 25);
......@@ -256,6 +221,16 @@
this.toolStripButton1.Text = "Syötä korttidataa";
this.toolStripButton1.Click += new System.EventHandler(this.toolStripButton1_Click);
//
// settingsToolStripButton
//
this.settingsToolStripButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
this.settingsToolStripButton.Image = ((System.Drawing.Image)(resources.GetObject("settingsToolStripButton.Image")));
this.settingsToolStripButton.ImageTransparentColor = System.Drawing.Color.Magenta;
this.settingsToolStripButton.Name = "settingsToolStripButton";
this.settingsToolStripButton.Size = new System.Drawing.Size(23, 22);
this.settingsToolStripButton.Text = "Api Settings";
this.settingsToolStripButton.Click += new System.EventHandler(this.settingsToolStripButton_Click);
//
// Form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
......@@ -268,10 +243,6 @@
this.Controls.Add(this.prevSlot3Button);
this.Controls.Add(this.prevSlot2Button);
this.Controls.Add(this.prevSlot1Button);
this.Controls.Add(this.label2);
this.Controls.Add(this.apiKeyTextBox);
this.Controls.Add(this.label1);
this.Controls.Add(this.apiUrlTextBox);
this.Controls.Add(this.readersComboBox3);
this.Controls.Add(this.readersComboBox2);
this.Controls.Add(this.readersComboBox1);
......@@ -301,10 +272,6 @@
private System.Windows.Forms.ComboBox readersComboBox1;
private System.Windows.Forms.ComboBox readersComboBox2;
private System.Windows.Forms.ComboBox readersComboBox3;
private System.Windows.Forms.TextBox apiUrlTextBox;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.TextBox apiKeyTextBox;
private System.Windows.Forms.Timer timer1;
private System.Windows.Forms.Timer slot1Timer;
private System.Windows.Forms.Timer slot2Timer;
......@@ -317,6 +284,7 @@
private System.Windows.Forms.Button forwardSlot3Button;
private System.Windows.Forms.ToolStrip toolStrip1;
private System.Windows.Forms.ToolStripButton toolStripButton1;
private System.Windows.Forms.ToolStripButton settingsToolStripButton;
}
}
using HttpUtils;
using CardDisplay.Forms;
using HttpUtils;
using System;
using System.Collections.Generic;
using System.ComponentModel;
......@@ -18,7 +19,7 @@ namespace CardDisplay
InitializeComponent();
}
string readerApiUrl = "http://vectorama.moya.fi/MoyaWeb/rest/reader/List";
string readerApiUrl = "http://localhost:8080/MoyaWeb/rest/reader/List";
string statePrinted = "PRINTED";
......@@ -70,14 +71,11 @@ namespace CardDisplay
private void Form1_Load(object sender, EventArgs e)
{
apiKeyTextBox.Text = Properties.Settings.Default.ApiKey;
apiUrlTextBox.Text = Properties.Settings.Default.ApiURL;
if (Properties.Settings.Default.ApiURL != null && Properties.Settings.Default.ApiURL != "")
timer1.Enabled = true;
}
private void Form1_FormClosing(object sender, FormClosingEventArgs e)
{
Properties.Settings.Default.ApiKey = apiKeyTextBox.Text;
Properties.Settings.Default.ApiURL = apiUrlTextBox.Text;
Properties.Settings.Default.Save();
}
private void Form1_Resize(object sender, EventArgs e)
......@@ -125,11 +123,6 @@ namespace CardDisplay
}
private void apiUrlTextBox_TextChanged(object sender, EventArgs e)
{
timer1.Enabled = true;
}
private void readersComboBox1_SelectedIndexChanged(object sender, EventArgs e)
{
slot1Timer.Enabled = true;
......@@ -150,7 +143,7 @@ namespace CardDisplay
if (readersComboBox1.SelectedItem != null)
{
Reader reader = (Reader)readersComboBox1.SelectedItem;
RestClient client = new RestClient(apiUrlTextBox.Text + "/reader/readerevents/" + reader.readerId + "/" + slot1ReaderEventId);
RestClient client = new RestClient(Properties.Settings.Default.ApiURL + "/reader/readerevents/" + reader.readerId + "/" + slot1ReaderEventId);
try
{
ret = client.MakeRequest();
......@@ -159,7 +152,7 @@ namespace CardDisplay
ReaderEventList events = ser.Deserialize<ReaderEventList>(ret);
foreach (ReaderEvent re in events.readerEvents)
{
client = new RestClient(apiUrlTextBox.Text + "/card/ListAll");
client = new RestClient(Properties.Settings.Default.ApiURL + "/card/ListAll");
ret = client.MakeRequest();
CardList cards = ser.Deserialize<CardList>(ret);
cards.cards = cards.cards.OrderBy(c => c.printTime).ToList();
......@@ -168,7 +161,7 @@ namespace CardDisplay
if (card.state == statePrinted)
{
slot1Cards.Add(card);
pictureBox1.ImageLocation = apiUrlTextBox.Text + "/card/GetImage/" + card.cardId;
pictureBox1.ImageLocation = Properties.Settings.Default.ApiURL + "/card/GetImage/" + card.cardId;
slot1SelectedCard = card;
}
}
......@@ -187,7 +180,7 @@ namespace CardDisplay
if (readersComboBox2.SelectedItem != null)
{
Reader reader = (Reader)readersComboBox2.SelectedItem;
RestClient client = new RestClient(apiUrlTextBox.Text + "/reader/readerevents/" + reader.readerId + "/" + slot2ReaderEventId);
RestClient client = new RestClient(Properties.Settings.Default.ApiURL + "/reader/readerevents/" + reader.readerId + "/" + slot2ReaderEventId);
try
{
ret = client.MakeRequest();
......@@ -196,7 +189,7 @@ namespace CardDisplay
ReaderEventList events = ser.Deserialize<ReaderEventList>(ret);
foreach (ReaderEvent re in events.readerEvents)
{
client = new RestClient(apiUrlTextBox.Text + "/card/ListAll");
client = new RestClient(Properties.Settings.Default.ApiURL + "/card/ListAll");
ret = client.MakeRequest();
CardList cards = ser.Deserialize<CardList>(ret);
cards.cards = cards.cards.OrderBy(c => c.printTime).ToList();
......@@ -205,7 +198,7 @@ namespace CardDisplay
if (card.state == statePrinted)
{
slot2Cards.Add(card);
pictureBox2.ImageLocation = apiUrlTextBox.Text + "/rest/card/GetImage/" + card.cardId;
pictureBox2.ImageLocation = Properties.Settings.Default.ApiURL + "/rest/card/GetImage/" + card.cardId;
slot2SelectedCard = card;
}
}
......@@ -223,7 +216,7 @@ namespace CardDisplay
if (readersComboBox3.SelectedItem != null)
{
Reader reader = (Reader)readersComboBox3.SelectedItem;
RestClient client = new RestClient(apiUrlTextBox.Text + "/reader/readerevents/" + reader.readerId + "/" + slot3ReaderEventId);
RestClient client = new RestClient(Properties.Settings.Default.ApiURL + "/reader/readerevents/" + reader.readerId + "/" + slot3ReaderEventId);
try
{
ret = client.MakeRequest();
......@@ -232,7 +225,7 @@ namespace CardDisplay
ReaderEventList events = ser.Deserialize<ReaderEventList>(ret);
foreach (ReaderEvent re in events.readerEvents)
{
client = new RestClient(apiUrlTextBox.Text + "/card/ListAll");
client = new RestClient(Properties.Settings.Default.ApiURL + "/card/ListAll");
ret = client.MakeRequest();
CardList cards = ser.Deserialize<CardList>(ret);
cards.cards = cards.cards.OrderBy(c => c.printTime).ToList();
......@@ -241,7 +234,7 @@ namespace CardDisplay
if (card.state == statePrinted)
{
slot3Cards.Add(card);
pictureBox3.ImageLocation = apiUrlTextBox.Text + "/rest/card/GetImage/" + card.cardId;
pictureBox3.ImageLocation = Properties.Settings.Default.ApiURL + "/rest/card/GetImage/" + card.cardId;
slot3SelectedCard = card;
}
}
......@@ -262,7 +255,7 @@ namespace CardDisplay
if (i >= 0)
{
slot1SelectedCard = slot1Cards[i];
pictureBox1.ImageLocation = apiUrlTextBox.Text + "/rest/card/GetImage/" + slot1SelectedCard.cardId;
pictureBox1.ImageLocation = Properties.Settings.Default.ApiURL + "/rest/card/GetImage/" + slot1SelectedCard.cardId;
}
}
}
......@@ -275,7 +268,7 @@ namespace CardDisplay
if (i >= 0)
{
slot2SelectedCard = slot2Cards[i];
pictureBox2.ImageLocation = apiUrlTextBox.Text + "/rest/card/GetImage/" + slot2SelectedCard.cardId;
pictureBox2.ImageLocation = Properties.Settings.Default.ApiURL + "/rest/card/GetImage/" + slot2SelectedCard.cardId;
}
}
}
......@@ -288,7 +281,7 @@ namespace CardDisplay
if (i >= 0)
{
slot3SelectedCard = slot1Cards[i];
pictureBox3.ImageLocation = apiUrlTextBox.Text + "/rest/card/GetImage/" + slot3SelectedCard.cardId;
pictureBox3.ImageLocation = Properties.Settings.Default.ApiURL + "/rest/card/GetImage/" + slot3SelectedCard.cardId;
}
}
}
......@@ -301,7 +294,7 @@ namespace CardDisplay
if (i <= (slot1Cards.Count - 1))
{
slot1SelectedCard = slot1Cards[i];
pictureBox1.ImageLocation = apiUrlTextBox.Text + "/rest/card/GetImage/" + slot1SelectedCard.cardId;
pictureBox1.ImageLocation = Properties.Settings.Default.ApiURL + "/rest/card/GetImage/" + slot1SelectedCard.cardId;
}
}
}
......@@ -314,7 +307,7 @@ namespace CardDisplay
if (i <= (slot2Cards.Count - 1))
{
slot2SelectedCard = slot2Cards[i];
pictureBox2.ImageLocation = apiUrlTextBox.Text + "/rest/card/GetImage/" + slot2SelectedCard.cardId;
pictureBox2.ImageLocation = Properties.Settings.Default.ApiURL + "/rest/card/GetImage/" + slot2SelectedCard.cardId;
}
}
}
......@@ -327,14 +320,21 @@ namespace CardDisplay
if (i <= (slot3Cards.Count - 1))
{
slot3SelectedCard = slot2Cards[i];
pictureBox3.ImageLocation = apiUrlTextBox.Text + "/rest/card/GetImage/" + slot3SelectedCard.cardId;
pictureBox3.ImageLocation = Properties.Settings.Default.ApiURL + "/rest/card/GetImage/" + slot3SelectedCard.cardId;
}
}
}
private void toolStripButton1_Click(object sender, EventArgs e)
{
AddCardMetaData frm = new AddCardMetaData();
frm.ShowDialog();
}
private void settingsToolStripButton_Click(object sender, EventArgs e)
{
ApiSettings frm = new ApiSettings();
frm.ShowDialog();
}
}
}
......@@ -136,18 +136,27 @@
<data name="toolStripButton1.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAKaSURBVDhPzdBrT9JhGAZwvkmv2+pFa5mzwyapNTVTV5PR
qDCmeWCimDNBm8ecOGAp2Fylg6ZiOcXN5UwlJgrTTHChTBJICwKZqKAph+fqL3/rK9S1Pbu3+8XvvvYw
/p+Ieuwx+dC3WJvGZa5XOS6erOORqGxMqWbdLh2wxsrln3CypvNYaZ6o6jJD3LuG4/hDhGiN20Q56vJL
1YYr0oHVyTnbL7LmAaaWDiBW6NHU0Qc2v5WGKuQmjcHihlCxFAc0+i281W/C6gqRyo7ZyKjBRYJhwL0D
WDdiKJHoAG4BxBeYNCCQGSeNX9zgS2fiwN4R4PoZQtubFXBqBuEORECoHMYI2fADApkJ44I6pCRnnQDS
2RnLmheFzeNxoH/aiy6tEyuufTwQ9WF5fQeK4Q0EKfi4RVHrFPTGRSSl5tIAX/LR/PV7APfFg4hQQIx6
Ds8BaroWkCd8Derj4NsLkzDVwhcEHj4dQUV1AxL/NChp+2Df9O6CXa1GNN4BsLujMK34kVMsh5GaTWoH
DDaCnUPg3hMVIoQBYW0qDRS1jLkDoTDYld0IUYKXurLsPMSQ7gfS81sgejGPhVUvHN59+IIErHIlut9V
ITkjmwbYwm7nNgXcKevEZ2cY05YQJuZ96BlZxg1uI2TqOWh1VvS/t0A2YEJucTtOudy4zK+mAVa5wuPd
PQJP/BK3eI1IuFkKJksEtlCFZFYNOBVKZBe0II1Ti4TMUiRl85HWO4yreTwSB/LKOo+iBPAEwpixbGHM
4ERn7wSqml/h3PVCsItqUdeuglo7h1GdBYs2D1RaE3J4ErrBbb40eFeojLAEz0k6t4FkcOtJYlYZzqc/
wtlrXJy+wsEZZj5JyOSTSzmVJIUlimZxn4X/Av84DMZvXl38icQDkbIAAAAASUVORK5CYII=
YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAKcSURBVDhPzc9rT9JhGAZwvkmv2+pFa5mzwyamNU+prclo
lBjTPJAIzhmgZSpzaGBTsLlKB03Rcoqr5UwlJgrTTHCehglMC0ItNNDk8H+u/oL2Ferant3b/eJ3Xw/j
/4m400619Lsoea/LWqtxnD9aR9OkWWEqdGurCt0CVd7yCUfrWCpU1pHKdiukXXYcZstPkcGpH0Q95NxW
aE2XFLrl0cnlfWL3AGNz+5CqjKhv7Qab3xiDhEpLr8nmhkg1FwV6jVt4bdzAgtNPRK2TYf2Ek/hDgHsH
WFynUNJkALgFkJ5jxgCBwjxqXnCDr5iIAr+CgOt7APJXS+CI++D2hUFRFPkdocj6NiBQWjAsqMGVxMxj
YHLCZveisGE4CvSMe9Gud2LJtYc8STfm13agGliHn4YPWxQ1jsFonkVCck4M4Ms/Wr989eGOtA9hGqDo
5/DsQ9w+g1zRSyh0i/DuBkmQbrHpB+4+HISw6jHijxuUyD+sbnh3wa7SIhLtAKy6I7AsbSO7uAVmetZr
HTCtEOwcALcfaBAmDIiqk2NAkeyt2xcIgV3RgQAteOkr884D9Bu+ITVfBsmzacwse+Hw7mHTT8AqV6Pj
TSUS07JiAFvU4fxJAzfL2vDZGcK4LYCR6U10Ds7jGrcOSu0U9IZF9Ly3QamzIKe4GSdcblzkV8UAlkDl
of8InvQ5rvPqEJdRCiZLArZIg0SWGByhGlkFMqRwqhGXXoqELD5SugZwOZdHokDu/bZghAAeXwgTti28
MznR1jWCyoYXOHO1EOyiatQ0a6DVT2HIYMPsigcavQXZvKZYgxv8J/5bQnWYJXhKUrm1JI37iMRnluFs
6j2cTuLi5CUOTjHzSVw6n1zIriBJLEkkI08W+gv84zAYfwDinvxVez/TeQAAAABJRU5ErkJggg==
</value>
</data>
<data name="settingsToolStripButton.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAACWSURBVDhPrZCLDcAgCAWd1hVcwRVcwRVcwRWcxeYRSCjV
hn4uIWkFTiT8Tu99jjEo+OgZKaXZWiOByDi1xxZZCR/vQZEtLKXQ2Sp3AbfZQt1ca70XYGTdYAMXcOke
jKwnseFapkgwst2BWyJA8FkCVhIEp33gSdKIJ8quOO1DGvmXJuNPPxDIDrTsETnniYgxvhOcCeEASkcG
PKycdQEAAAAASUVORK5CYII=
</value>
</data>
</root>
\ No newline at end of file
......@@ -46,5 +46,29 @@ namespace CardDisplay.Properties {
this["ApiURL"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("")]
public string ApiUser {
get {
return ((string)(this["ApiUser"]));
}
set {
this["ApiUser"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("")]
public string ApiPass {
get {
return ((string)(this["ApiPass"]));
}
set {
this["ApiPass"] = value;
}
}
}
}
......@@ -8,5 +8,11 @@
<Setting Name="ApiURL" Type="System.String" Scope="User">
<Value Profile="(Default)" />
</Setting>
<Setting Name="ApiUser" Type="System.String" Scope="User">
<Value Profile="(Default)" />
</Setting>
<Setting Name="ApiPass" Type="System.String" Scope="User">
<Value Profile="(Default)" />
</Setting>
</Settings>
</SettingsFile>
\ No newline at end of file
......@@ -8,10 +8,16 @@
<userSettings>
<CardDisplay.Properties.Settings>
<setting name="ApiKey" serializeAs="String">
<value/>
<value />
</setting>
<setting name="ApiURL" serializeAs="String">
<value/>
<value />
</setting>
<setting name="ApiUser" serializeAs="String">
<value />
</setting>
<setting name="ApiPass" serializeAs="String">
<value />
</setting>
</CardDisplay.Properties.Settings>
</userSettings>
......
......@@ -8,10 +8,16 @@
<userSettings>
<CardDisplay.Properties.Settings>
<setting name="ApiKey" serializeAs="String">
<value/>
<value />
</setting>
<setting name="ApiURL" serializeAs="String">
<value/>
<value />
</setting>
<setting name="ApiUser" serializeAs="String">
<value />
</setting>
<setting name="ApiPass" serializeAs="String">
<value />
</setting>
</CardDisplay.Properties.Settings>
</userSettings>
......
......@@ -8,10 +8,16 @@
<userSettings>
<CardDisplay.Properties.Settings>
<setting name="ApiKey" serializeAs="String">
<value/>
<value />
</setting>
<setting name="ApiURL" serializeAs="String">
<value/>
<value />
</setting>
<setting name="ApiUser" serializeAs="String">
<value />
</setting>
<setting name="ApiPass" serializeAs="String">
<value />
</setting>
</CardDisplay.Properties.Settings>
</userSettings>
......
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity version="1.0.0.0" name="MyApplication.app"/>
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
<security>
<requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
<requestedExecutionLevel level="asInvoker" uiAccess="false"/>
</requestedPrivileges>
</security>
</trustInfo>
</assembly>
......@@ -15,3 +15,14 @@ C:\devel\proj\moya-info-tools\CardDisplay\CardDisplay\CardDisplay\obj\x86\Debug\
C:\devel\proj\moya-info-tools\CardDisplay\CardDisplay\CardDisplay\obj\x86\Debug\CardDisplay.Form1.resources
C:\devel\proj\moya-info-tools\CardDisplay\CardDisplay\CardDisplay\obj\x86\Debug\CardDisplay.Properties.Resources.resources
C:\devel\proj\moya-info-tools\CardDisplay\CardDisplay\CardDisplay\obj\x86\Debug\CardDisplay.csproj.GenerateResource.Cache
I:\devel\proj\moya-info-tools\CardDisplay\CardDisplay\CardDisplay\bin\Debug\CardDisplay.exe.config
I:\devel\proj\moya-info-tools\CardDisplay\CardDisplay\CardDisplay\obj\x86\Debug\CardDisplay.exe
I:\devel\proj\moya-info-tools\CardDisplay\CardDisplay\CardDisplay\obj\x86\Debug\CardDisplay.pdb
I:\devel\proj\moya-info-tools\CardDisplay\CardDisplay\CardDisplay\obj\x86\Debug\CardDisplay.csprojResolveAssemblyReference.cache
I:\devel\proj\moya-info-tools\CardDisplay\CardDisplay\CardDisplay\obj\x86\Debug\CardDisplay.AddCardMetaData.resources
I:\devel\proj\moya-info-tools\CardDisplay\CardDisplay\CardDisplay\obj\x86\Debug\CardDisplay.Form1.resources
I:\devel\proj\moya-info-tools\CardDisplay\CardDisplay\CardDisplay\obj\x86\Debug\CardDisplay.Properties.Resources.resources
I:\devel\proj\moya-info-tools\CardDisplay\CardDisplay\CardDisplay\obj\x86\Debug\CardDisplay.csproj.GenerateResource.Cache
I:\devel\proj\moya-info-tools\CardDisplay\CardDisplay\CardDisplay\bin\Debug\CardDisplay.exe
I:\devel\proj\moya-info-tools\CardDisplay\CardDisplay\CardDisplay\bin\Debug\CardDisplay.pdb
I:\devel\proj\moya-info-tools\CardDisplay\CardDisplay\CardDisplay\obj\x86\Debug\CardDisplay.Forms.ApiSettings.resources
D:\Devel\proj\MoyaAdmin\MoyaAdminUI\MoyaAdminUI\bin\Debug\MoyaAdminUI.exe.config
D:\Devel\proj\MoyaAdmin\MoyaAdminUI\MoyaAdminUI\bin\Debug\MoyaAdminUI.exe
D:\Devel\proj\MoyaAdmin\MoyaAdminUI\MoyaAdminUI\bin\Debug\MoyaAdminUI.pdb
D:\Devel\proj\MoyaAdmin\MoyaAdminUI\MoyaAdminUI\obj\Debug\MoyaAdminUI.csprojResolveAssemblyReference.cache
D:\Devel\proj\MoyaAdmin\MoyaAdminUI\MoyaAdminUI\obj\Debug\MoyaAdminUI.ComputerPlaceGridSettings.resources
D:\Devel\proj\MoyaAdmin\MoyaAdminUI\MoyaAdminUI\obj\Debug\MoyaAdminUI.MainForm.resources
D:\Devel\proj\MoyaAdmin\MoyaAdminUI\MoyaAdminUI\obj\Debug\MoyaAdminUI.Properties.Resources.resources
D:\Devel\proj\MoyaAdmin\MoyaAdminUI\MoyaAdminUI\obj\Debug\MoyaAdminUI.csproj.GenerateResource.Cache
D:\Devel\proj\MoyaAdmin\MoyaAdminUI\MoyaAdminUI\obj\Debug\MoyaAdminUI.exe
D:\Devel\proj\MoyaAdmin\MoyaAdminUI\MoyaAdminUI\obj\Debug\MoyaAdminUI.pdb
D:\Devel\proj\MoyaAdmin\MoyaAdminUI\MoyaAdminUI\obj\Debug\MoyaAdminUI.UsersFinderForm.resources
D:\Devel\proj\MoyaAdmin\MoyaAdminUI\MoyaAdminUI\obj\Debug\MoyaAdminUI.UserInfoForm.resources
D:\Devel\proj\MoyaAdmin\MoyaAdminUI\MoyaAdminUI\obj\Debug\MoyaAdminUI.ApiSettings.resources
D:\Devel\proj\MoyaAdmin\MoyaAdminUI\MoyaAdminUI\bin\Debug\AutoUpdateLib.dll
D:\Devel\proj\MoyaAdmin\MoyaAdminUI\MoyaAdminUI\bin\Debug\AutoUpdateLib.pdb
D:\Devel\proj\moya-info-tools\MoyaAdmin\MoyaAdminUI\MoyaAdminUI\bin\Debug\MoyaAdminUI.exe.config
D:\Devel\proj\moya-info-tools\MoyaAdmin\MoyaAdminUI\MoyaAdminUI\obj\Debug\MoyaAdminUI.exe
D:\Devel\proj\moya-info-tools\MoyaAdmin\MoyaAdminUI\MoyaAdminUI\obj\Debug\MoyaAdminUI.pdb
D:\Devel\proj\moya-info-tools\MoyaAdmin\MoyaAdminUI\MoyaAdminUI\bin\Debug\MoyaAdminUI.exe
D:\Devel\proj\moya-info-tools\MoyaAdmin\MoyaAdminUI\MoyaAdminUI\bin\Debug\MoyaAdminUI.pdb
D:\Devel\proj\moya-info-tools\MoyaAdmin\MoyaAdminUI\MoyaAdminUI\bin\Debug\AutoUpdateLib.dll
D:\Devel\proj\moya-info-tools\MoyaAdmin\MoyaAdminUI\MoyaAdminUI\bin\Debug\AutoUpdateLib.pdb
D:\Devel\proj\moya-info-tools\MoyaAdmin\MoyaAdminUI\MoyaAdminUI\obj\Debug\MoyaAdminUI.csprojResolveAssemblyReference.cache
D:\Devel\proj\moya-info-tools\MoyaAdmin\MoyaAdminUI\MoyaAdminUI\obj\Debug\MoyaAdminUI.ApiSettings.resources
D:\Devel\proj\moya-info-tools\MoyaAdmin\MoyaAdminUI\MoyaAdminUI\obj\Debug\MoyaAdminUI.ComputerPlaceGridSettings.resources
D:\Devel\proj\moya-info-tools\MoyaAdmin\MoyaAdminUI\MoyaAdminUI\obj\Debug\MoyaAdminUI.MainForm.resources
D:\Devel\proj\moya-info-tools\MoyaAdmin\MoyaAdminUI\MoyaAdminUI\obj\Debug\MoyaAdminUI.Properties.Resources.resources
D:\Devel\proj\moya-info-tools\MoyaAdmin\MoyaAdminUI\MoyaAdminUI\obj\Debug\MoyaAdminUI.UserInfoForm.resources
D:\Devel\proj\moya-info-tools\MoyaAdmin\MoyaAdminUI\MoyaAdminUI\obj\Debug\MoyaAdminUI.UsersFinderForm.resources
D:\Devel\proj\moya-info-tools\MoyaAdmin\MoyaAdminUI\MoyaAdminUI\obj\Debug\MoyaAdminUI.csproj.GenerateResource.Cache
I:\devel\proj\moya-info-tools\MoyaAdmin\MoyaAdminUI\MoyaAdminUI\bin\Debug\MoyaAdminUI.exe.config
namespace moyaPrintServer
{
partial class ApiSettings
{
/// <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()
{
this.label4 = new System.Windows.Forms.Label();
this.ApiPassTextBox = new System.Windows.Forms.TextBox();
this.label3 = new System.Windows.Forms.Label();
this.ApiUserTextBox = new System.Windows.Forms.TextBox();
this.label2 = new System.Windows.Forms.Label();
this.ApiKeyTextBox = new System.Windows.Forms.TextBox();
this.SaveButton = new System.Windows.Forms.Button();
this.label1 = new System.Windows.Forms.Label();
this.apiURLTextBox = new System.Windows.Forms.TextBox();
this.SuspendLayout();
//
// label4
//
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(12, 148);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(48, 13);
this.label4.TabIndex = 35;
this.label4.Text = "Api Pass";
//
// ApiPassTextBox
//
this.ApiPassTextBox.Location = new System.Drawing.Point(12, 164);
this.ApiPassTextBox.Name = "ApiPassTextBox";
this.ApiPassTextBox.PasswordChar = 'ῷ';
this.ApiPassTextBox.Size = new System.Drawing.Size(260, 20);
this.ApiPassTextBox.TabIndex = 34;
//
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(12, 109);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(47, 13);
this.label3.TabIndex = 33;
this.label3.Text = "Api User";
//
// ApiUserTextBox
//
this.ApiUserTextBox.Location = new System.Drawing.Point(12, 125);
this.ApiUserTextBox.Name = "ApiUserTextBox";
this.ApiUserTextBox.Size = new System.Drawing.Size(260, 20);
this.ApiUserTextBox.TabIndex = 32;
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(12, 70);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(79, 13);
this.label2.TabIndex = 31;
this.label2.Text = "Application key";
//
// ApiKeyTextBox
//
this.ApiKeyTextBox.Location = new System.Drawing.Point(12, 86);
this.ApiKeyTextBox.Name = "ApiKeyTextBox";
this.ApiKeyTextBox.Size = new System.Drawing.Size(260, 20);
this.ApiKeyTextBox.TabIndex = 30;
//
// SaveButton
//
this.SaveButton.Location = new System.Drawing.Point(197, 210);
this.SaveButton.Name = "SaveButton";
this.SaveButton.Size = new System.Drawing.Size(75, 23);
this.SaveButton.TabIndex = 29;
this.SaveButton.Text = "Save";
this.SaveButton.UseVisualStyleBackColor = true;
this.SaveButton.Click += new System.EventHandler(this.SaveButton_Click);
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(12, 27);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(47, 13);
this.label1.TabIndex = 28;
this.label1.Text = "Moya url";
//
// apiURLTextBox
//
this.apiURLTextBox.Location = new System.Drawing.Point(12, 43);
this.apiURLTextBox.Name = "apiURLTextBox";
this.apiURLTextBox.Size = new System.Drawing.Size(260, 20);
this.apiURLTextBox.TabIndex = 27;
//
// ApiSettings
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(284, 261);
this.Controls.Add(this.label4);
this.Controls.Add(this.ApiPassTextBox);
this.Controls.Add(this.label3);
this.Controls.Add(this.ApiUserTextBox);
this.Controls.Add(this.label2);
this.Controls.Add(this.ApiKeyTextBox);
this.Controls.Add(this.SaveButton);
this.Controls.Add(this.label1);
this.Controls.Add(this.apiURLTextBox);
this.Name = "ApiSettings";
this.Text = "ApiSettings";
this.Load += new System.EventHandler(this.ApiSettings_Load);
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Label label4;
private System.Windows.Forms.TextBox ApiPassTextBox;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.TextBox ApiUserTextBox;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.TextBox ApiKeyTextBox;
private System.Windows.Forms.Button SaveButton;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.TextBox apiURLTextBox;
}
}
\ No newline at end of file
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace moyaPrintServer
{
public partial class ApiSettings : Form
{
public ApiSettings()
{
InitializeComponent();
}
private void SaveButton_Click(object sender, EventArgs e)
{
Properties.Settings.Default.ApiURL = apiURLTextBox.Text;
Properties.Settings.Default.ApiKey = ApiKeyTextBox.Text;
Properties.Settings.Default.ApiUser = ApiUserTextBox.Text;
Properties.Settings.Default.ApiPass = ApiPassTextBox.Text;
Properties.Settings.Default.Save();
this.DialogResult = System.Windows.Forms.DialogResult.OK;
}
private void ApiSettings_Load(object sender, EventArgs e)
{
apiURLTextBox.Text = Properties.Settings.Default.ApiURL;
ApiKeyTextBox.Text = Properties.Settings.Default.ApiKey;
ApiUserTextBox.Text = Properties.Settings.Default.ApiUser;
ApiPassTextBox.Text = Properties.Settings.Default.ApiPass;
}
}
}
<?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.Runtime.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:import namespace="http://www.w3.org/XML/1998/namespace" />
<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" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</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" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</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=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
\ No newline at end of file
......@@ -31,10 +31,13 @@ namespace moyaPrintServer
}
autoPrintCheckBox.Checked = Properties.Settings.Default.AutoPrint;
PrintersComboBox.SelectedItem = Properties.Settings.Default.Printer;
<<<<<<< HEAD
apiKeyTextBox.Text = Properties.Settings.Default.ApiKey;
apiUrlTextBox.Text = Properties.Settings.Default.ApiURL;
if (apiUrlTextBox.Text == "")
apiUrlTextBox.Text = "https://event.domain.ltd/MoyaWeb/rest";
=======
>>>>>>> b730dd7f982f556ecbc4adf437995c3832096919
}
......@@ -50,8 +53,6 @@ namespace moyaPrintServer
Properties.Settings.Default.Printer = PrintersComboBox.SelectedItem.ToString();
}
Properties.Settings.Default.AutoPrint = autoPrintCheckBox.Checked;
Properties.Settings.Default.ApiKey = apiKeyTextBox.Text;
Properties.Settings.Default.ApiURL = apiUrlTextBox.Text;
Properties.Settings.Default.Save();
}
......@@ -219,6 +220,12 @@ namespace moyaPrintServer
return numberOfJobs;
}
private void settingsToolStripButton_Click(object sender, EventArgs e)
{
ApiSettings frm = new ApiSettings();
frm.ShowDialog();
}
}
}
......@@ -123,7 +123,19 @@
<metadata name="printTimer.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>133, 17</value>
</metadata>
<metadata name="toolStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>241, 17</value>
</metadata>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="settingsToolStripButton.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAACWSURBVDhPrZCLDcAgCAWd1hVcwRVcwRVcwRWcxeYRSCjV
hn4uIWkFTiT8Tu99jjEo+OgZKaXZWiOByDi1xxZZCR/vQZEtLKXQ2Sp3AbfZQt1ca70XYGTdYAMXcOke
jKwnseFapkgwst2BWyJA8FkCVhIEp33gSdKIJ8quOO1DGvmXJuNPPxDIDrTsETnniYgxvhOcCeEASkcG
PKycdQEAAAAASUVORK5CYII=
</value>
</data>
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
AAABAAgAICAQAAAAAADoAgAAhgAAABAQEAAAAAAAKAEAAG4DAAAwMAAAAQAIAKgOAACWBAAAICAAAAEA
......
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.17929
// Runtime Version:4.0.30319.18449
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
......@@ -12,7 +12,7 @@ namespace moyaPrintServer.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "10.0.0.0")]
[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())));
......@@ -70,5 +70,29 @@ namespace moyaPrintServer.Properties {
this["ApiKey"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("")]
public string ApiUser {
get {
return ((string)(this["ApiUser"]));
}
set {
this["ApiUser"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("")]
public string ApiPass {
get {
return ((string)(this["ApiPass"]));
}
set {
this["ApiPass"] = value;
}
}
}
}
......@@ -14,5 +14,11 @@
<Setting Name="ApiKey" Type="System.String" Scope="User">
<Value Profile="(Default)" />
</Setting>
<Setting Name="ApiUser" Type="System.String" Scope="User">
<Value Profile="(Default)" />
</Setting>
<Setting Name="ApiPass" Type="System.String" Scope="User">
<Value Profile="(Default)" />
</Setting>
</Settings>
</SettingsFile>
\ No newline at end of file
using System;
using System.IO;
using System.Net;
using System.Security.Cryptography;
using System.Text;
public enum HttpVerb
......@@ -56,9 +57,44 @@ namespace HttpUtils
return MakeRequest("");
}
public static string GetRequestURL(string server, string parameters)
{
int timestamp = ConvertToTimestamp(DateTime.Now);
string hash = CalculateSHA1("/" + parameters + "+" + moyaPrintServer.Properties.Settings.Default.ApiKey + "+" + moyaPrintServer.Properties.Settings.Default.ApiUser + "+" + timestamp + "+" + moyaPrintServer.Properties.Settings.Default.ApiPass);
string url = server + "/rest/" + parameters + "?appkey=" + moyaPrintServer.Properties.Settings.Default.ApiKey + "&appuser=" + moyaPrintServer.Properties.Settings.Default.ApiUser + "&appstamp=" + timestamp + "&appmac=" + hash;
return url;
}
public static string CalculateSHA1(string text)
{
// Convert the input string to a byte array
byte[] buffer = Encoding.GetEncoding("iso-8859-1").GetBytes(text);
// In doing your test, you won't want to re-initialize like this every time you test a
// string.
SHA1CryptoServiceProvider cryptoTransformSHA1 =
new SHA1CryptoServiceProvider();
// The replace won't be necessary for your tests so long as you are consistent in what
// you compare.
string hash = BitConverter.ToString(cryptoTransformSHA1.ComputeHash(buffer)).Replace("-", "").ToLower();
return hash;
}
private static int ConvertToTimestamp(DateTime value)
{
//create Timespan by subtracting the value provided from
//the Unix Epoch
TimeSpan span = (value - new DateTime(1970, 1, 1, 0, 0, 0, 0).ToLocalTime());
//return the total seconds (which is a UNIX timestamp)
return (int)span.TotalSeconds;
}
public string MakeRequest(string parameters)
{
var request = (HttpWebRequest)WebRequest.Create(EndPoint + parameters);
var request = (HttpWebRequest)WebRequest.Create(GetRequestURL( EndPoint, parameters));
request.Method = Method.ToString();
request.ContentLength = 0;
......
......@@ -8,16 +8,22 @@
<userSettings>
<moyaPrintServer.Properties.Settings>
<setting name="Printer" serializeAs="String">
<value/>
<value />
</setting>
<setting name="AutoPrint" serializeAs="String">
<value>False</value>
</setting>
<setting name="ApiURL" serializeAs="String">
<value/>
<value />
</setting>
<setting name="ApiKey" serializeAs="String">
<value/>
<value />
</setting>
<setting name="ApiUser" serializeAs="String">
<value />
</setting>
<setting name="ApiPass" serializeAs="String">
<value />
</setting>
</moyaPrintServer.Properties.Settings>
</userSettings>
......
<?xml version="1.0"?>
<configuration>
<configSections>
<sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<section name="moyaPrintServer.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false"/>
</sectionGroup>
</configSections>
<userSettings>
<moyaPrintServer.Properties.Settings>
<setting name="Printer" serializeAs="String">
<value />
</setting>
<setting name="AutoPrint" serializeAs="String">
<value>False</value>
</setting>
<setting name="ApiURL" serializeAs="String">
<value />
</setting>
<setting name="ApiKey" serializeAs="String">
<value />
</setting>
<setting name="ApiUser" serializeAs="String">
<value />
</setting>
<setting name="ApiPass" serializeAs="String">
<value />
</setting>
</moyaPrintServer.Properties.Settings>
</userSettings>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup></configuration>
<?xml version="1.0"?>
<configuration>
<configSections>
<sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<section name="moyaPrintServer.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false"/>
</sectionGroup>
</configSections>
<userSettings>
<moyaPrintServer.Properties.Settings>
<setting name="Printer" serializeAs="String">
<value />
</setting>
<setting name="AutoPrint" serializeAs="String">
<value>False</value>
</setting>
<setting name="ApiURL" serializeAs="String">
<value />
</setting>
<setting name="ApiKey" serializeAs="String">
<value />
</setting>
<setting name="ApiUser" serializeAs="String">
<value />
</setting>
<setting name="ApiPass" serializeAs="String">
<value />
</setting>
</moyaPrintServer.Properties.Settings>
</userSettings>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup></configuration>
......@@ -53,6 +53,12 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="ApiSettings.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="ApiSettings.Designer.cs">
<DependentUpon>ApiSettings.cs</DependentUpon>
</Compile>
<Compile Include="CalculateMD5Hash.cs" />
<Compile Include="Card.cs" />
<Compile Include="Form1.cs">
......@@ -65,6 +71,9 @@
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="RestClient.cs" />
<EmbeddedResource Include="ApiSettings.resx">
<DependentUpon>ApiSettings.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Form1.resx">
<DependentUpon>Form1.cs</DependentUpon>
</EmbeddedResource>
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!