Initial Commit

This commit is contained in:
2016-07-27 00:32:34 -04:00
commit 8d162b2035
701 changed files with 188672 additions and 0 deletions

View File

@@ -0,0 +1,61 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Configuration;
namespace Pluto.Registration {
public static class Configuration {
public static string Url {
get {
return ConfigurationManager.AppSettings["Url"];
}
}
public static int Port {
get {
return int.Parse(ConfigurationManager.AppSettings["Port"]);
}
}
public static string SQLServer
{
get
{
return ConfigurationManager.AppSettings["SQLServer"];
}
}
public static string SQLInstance
{
get
{
return ConfigurationManager.AppSettings["SQLInstance"];
}
}
public static string SQLDatabaseName
{
get
{
return ConfigurationManager.AppSettings["SQLDatabaseName"];
}
}
public static string SQLUsername
{
get
{
return ConfigurationManager.AppSettings["SQLUsername"];
}
}
public static string SQLPassword
{
get
{
return ConfigurationManager.AppSettings["SQLPassword"];
}
}
}
}

View File

@@ -0,0 +1,60 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Pluto.Registration
{
/// <summary>
/// Only used for Debugging / Testing
/// </summary>
public static class DEBUGGING_ONLY
{
/// <summary>
/// Called in Debug Mode to allow us to step into specific things and
/// easier test them straight thru the service
/// </summary>
internal static void DEBUGSTEP_INTO()
{
Registration.Setup_Logger();
RegistrationTest();
}
internal static void RegistrationTest()
{
//const string TEST_SYSTEM_API_KEY = "$BBB8BDE06BC210B44F6#L";
//const string TEST_SYSTEM_API_KEY2 = "$9F0A95844FB07804892#M";
//const string TEST_HOST_GUID = "c8feacf2-6170-420a-843f-ef905784ec5b";
//const string TEST_HOST_GUID2 = "c8feacf2-6170-420a-843f-ef905784ec5b";
//// Check Connectivity
//bool bHasAccess = DataAccessLayer.VerifyConnectivity();
//// Instantiate Registration Object
//Registration registration = new Registration();
//// Test Registration of a new Practice
//string strApiKey;
//string strPin;
//Server server = new Server();
//server.HostGUID = "7c18db98-3c34-4382-963c-1175f0d20f44";
//server.InternalIP = "10.24.52.25";
//server.Port = 1945;
//server.ExternalIP = "";
//bool bSuccess = registration.RegisterNewServerPractice("Happy Valley Medical Clinic (McK)", server, "Medisoft", out strApiKey, out strPin);
//Host host = registration.GetApiHostMobile(TEST_SYSTEM_API_KEY);
//host = registration.GetApiHostWifi(TEST_SYSTEM_API_KEY2);
//Client[] clients = registration.GetClients(true);
//if (clients != null)
//{
// foreach (Client client in clients)
// {
// string d = client.systemApiKey;
// }
//}
}
}
}

View File

@@ -0,0 +1,392 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Sdaleo;
using Sdaleo.Systems.SQLServer;
using System.Data;
using Sdaleo.Systems;
using System.Net;
using RegistrationServer;
namespace Pluto.Registration
{
internal static class DataAccessLayer
{
private static SQLServerCredential credential = null;
private static DB db = null;
private const int PORT_EMPTY = 0;
internal static string MAKE_SURE_APOSTROPHY_IS_SQL_READY(string str)
{
if (!String.IsNullOrEmpty(str))
{
str = str.Replace("'", "''");
return str;
}
return String.Empty;
}
internal static string SqlDTString(DateTime dt)
{
if (dt.Year < 1753) // sql server limit check.
{
return "01/01/1753 01:01:01 AM";
}
string s = dt.ToShortDateString() + " " + dt.ToLongTimeString();
return s;
}
/// <summary>
/// Const will be used when registering in order to distinguish an internal Practice from a real Customer
/// </summary>
public const string INTERNAL_TEST_PRACTICE = " (Mck)";
/// <summary>
/// Data Layer
/// </summary>
static DataAccessLayer()
{
credential = new SQLServerCredential(Configuration.SQLServer, Configuration.SQLInstance, Configuration.SQLDatabaseName, Configuration.SQLUsername, Configuration.SQLPassword);
db = new DB(credential);
}
/// <summary>
/// Verify General Connectivity to the SQL Server
/// </summary>
/// <returns>true if it can connect to the SQL Server Instance</returns>
internal static bool VerifyConnectivity()
{
SQLServerVersion version;
DBError dbError = SQLServerGeneral.GetSQLServerVersion(credential, out version);
return !dbError.ErrorOccured;
}
#region Sanity Existence Checking
/// <summary>
/// Check that a Host Guid Exists in the Table
/// </summary>
/// <param name="Host_Guid"></param>
/// <returns></returns>
internal static bool Host_Guid_Exist(Guid Host_Guid)
{
// Check Host GUID
if (Host_Guid == null || String.IsNullOrEmpty(Host_Guid.ToString()))
return false;
DBRetVal retVal = db.ExecuteScalar(String.Format("Select [ID] From [Hosts_Guids] Where [Host_Guid] = '{0}'", Host_Guid));
if (retVal.ErrorOccured)
Registration.Logger.Error("Host_Guid_Exist Error:{0}", retVal.ErrorMsg);
return retVal.IsValid;
}
/// <summary>
/// Check that the specified System Api Key Exists
/// </summary>
/// <param name="SystemApiKey"></param>
/// <returns></returns>
internal static bool System_Api_Key_Exist(string SystemApiKey)
{
if (!String.IsNullOrEmpty(SystemApiKey))
{
DBRetVal retVal = db.ExecuteScalar(String.Format("Select [ID] From [Hosts_Guids] Where [SystemApiKey] = '{0}'", MAKE_SURE_APOSTROPHY_IS_SQL_READY(SystemApiKey)));
if (retVal.ErrorOccured)
Registration.Logger.Error("System_Api_Key_Exist Error:{0}", retVal.ErrorMsg);
return retVal.IsValid;
}
return false;
}
#endregion
#region Retrieve IP n Port Stuff
/// <summary>
/// Retrieve the Wifi IP and Port
/// </summary>
/// <param name="systemApiKey"></param>
/// <param name="ip"></param>
/// <param name="port"></param>
/// <param name="practiceName"></param>
/// <returns></returns>
internal static bool RetrieveIPWifiAndPort(string systemApiKey, out string ip, out int port, out string practiceName)
{
ip = String.Empty;
port = PORT_EMPTY;
practiceName = String.Empty;
if (!String.IsNullOrEmpty(systemApiKey))
{
DBRetVal retVal = db.FillDataTable(String.Format("Select [Internal_IP],[Port],[Practice_Name] From [Hosts_Guids] Where [SystemApiKey] = '{0}'", MAKE_SURE_APOSTROPHY_IS_SQL_READY(systemApiKey)));
if (retVal.IsValid)
{
DataRow row = retVal.GetDataTableFirstRow();
ip = DataRet.Retrieve(row[0]);
port = DataRet.Retrieve<int>(row[1], PORT_EMPTY);
practiceName = DataRet.Retrieve(row[2]);
return true;
}
if (retVal.ErrorOccured)
Registration.Logger.Error("RetrieveIPWifiAndPort Error:{0}", retVal.ErrorMsg);
}
return false;
}
/// <summary>
/// Retrieve the Mobile IP and Port
/// </summary>
/// <param name="systemApiKey"></param>
/// <param name="ip"></param>
/// <param name="port"></param>
/// <param name="practiceName"></param>
/// <returns></returns>
internal static bool RetrieveIPMobileAndPort(string systemApiKey, out string ip, out int port, out string practiceName)
{
ip = String.Empty;
port = PORT_EMPTY;
practiceName = String.Empty;
if (!String.IsNullOrEmpty(systemApiKey))
{
DBRetVal retVal = db.FillDataTable(String.Format("Select [External_IP],[Port],[Practice_Name] From [Hosts_Guids] Where [SystemApiKey] = '{0}'", MAKE_SURE_APOSTROPHY_IS_SQL_READY(systemApiKey)));
if (retVal.IsValid)
{
DataRow row = retVal.GetDataTableFirstRow();
ip = DataRet.Retrieve(row[0]);
port = DataRet.Retrieve<int>(row[1], PORT_EMPTY);
practiceName = DataRet.Retrieve(row[2]);
return true;
}
if (retVal.ErrorOccured)
Registration.Logger.Error("RetrieveIPMobileAndPort Error:{0}", retVal.ErrorMsg);
}
return false;
}
#endregion
#region MSLConnect Call-Ins
/// <summary>
/// Register a New Server Practice (For this to work SystemApiKey MUST be UNIQUE) and Practice Name must not be ""
/// </summary>
/// <param name="SystemApiKey"></param>
/// <param name="Host_Guid"></param>
/// <param name="Internal_IP"></param>
/// <param name="External_IP"></param>
/// <param name="Port"></param>
/// <param name="PracticeName"></param>
/// <returns></returns>
internal static bool RegisterNewServerPractice(string SystemApiKey, Guid Host_Guid, string Internal_IP, string External_IP, uint Port, string PracticeName)
{
// Check Host GUID
if (Host_Guid == null || String.IsNullOrEmpty(Host_Guid.ToString()))
{
Registration.Logger.Error("RegisterNewServerPractice Invalid Host_Guid passed in");
return false;
}
// Check Validity of Internal IP
IPAddress ip;
if (!String.IsNullOrEmpty(Internal_IP) && !IPAddress.TryParse(Internal_IP, out ip) &&
Yaulw.Net.IPHostHelper.IsValidIPv4Address(ip, false))
{
Registration.Logger.Error("RegisterNewServerPractice Internal IP passed in is Invalid");
return false;
}
// Check Validity of External IP
if (!String.IsNullOrEmpty(External_IP) && !IPAddress.TryParse(External_IP, out ip) &&
Yaulw.Net.IPHostHelper.IsValidIPv4Address(ip, false))
{
Registration.Logger.Error("RegisterNewServerPractice External IP passed in is Invalid");
return false;
}
// Check port validity
if (Port <= PORT_EMPTY)
{
Registration.Logger.Error("RegisterNewServerPractice Invalid Port passed in");
return false;
}
// Check Validity of Practice Name
if (String.IsNullOrEmpty(PracticeName))
{
Registration.Logger.Error("RegisterNewServerPractice Invalid Practice Name passed in");
return false;
}
// For Logging Purposes * Last Sanity Check *
if (System_Api_Key_Exist(SystemApiKey))
{
Registration.Logger.Error("RegisterNewServerPractice SystemApiKey is not unique");
return false;
}
// Make sure ' are preserved and don't cause an issue with SQL
PracticeName = MAKE_SURE_APOSTROPHY_IS_SQL_READY(PracticeName);
// Is it a Internal Practice
bool bIsInternal = PracticeName.EndsWith(INTERNAL_TEST_PRACTICE);
string sql = String.Format("INSERT INTO [Hosts_Guids] ([SystemApiKey],[Host_Guid],[Internal_IP],[External_IP],[Port],[Practice_Name],[IsInternal],[LastServerUpdate]) VALUES ('{0}','{1}','{2}','{3}',{4},'{5}',{6},'{7}')", SystemApiKey, Host_Guid, Internal_IP, External_IP, Port, PracticeName, bIsInternal ? 1 : 0, SqlDTString(DateTime.Now));
DBRetVal retVal = db.ExecuteNonQuery(sql);
if (retVal.ErrorOccured)
Registration.Logger.Error("RegisterNewServerPractice Error:{0}", retVal.ErrorMsg);
bool bSuccess = retVal.IsValid;
if (!bSuccess)
Registration.Logger.Error("RegisterNewServerPractice returning false for SQL String: {0}", sql);
return bSuccess;
}
/// <summary>
/// Update a Server with an IP change
/// </summary>
/// <param name="Host_Guid"></param>
/// <param name="Internal_IP"></param>
/// <param name="External_IP"></param>
/// <param name="Port"></param>
/// <returns></returns>
internal static bool UpdateServer(Guid Host_Guid, string Internal_IP, string External_IP, uint Port)
{
// Check Host GUID
if (Host_Guid == null || String.IsNullOrEmpty(Host_Guid.ToString()))
{
Registration.Logger.Error("UpdateServer Invalid Host_Guid passed in");
return false;
}
// Check Host GUID - Ultimate Sanity Check
if (!Host_Guid_Exist(Host_Guid))
{
Registration.Logger.Error("UpdateServer Invalid Host_Guid passed in. Host GUID does not exist");
return false;
}
// Check Validity of Internal IP
IPAddress ip;
if (!String.IsNullOrEmpty(Internal_IP) && !IPAddress.TryParse(Internal_IP, out ip) &&
Yaulw.Net.IPHostHelper.IsValidIPv4Address(ip, false))
{
Registration.Logger.Error("UpdateServer Internal IP passed in is Invalid");
return false;
}
// Check Validity of External IP
if (!String.IsNullOrEmpty(External_IP) && !IPAddress.TryParse(External_IP, out ip) &&
Yaulw.Net.IPHostHelper.IsValidIPv4Address(ip, false))
{
Registration.Logger.Error("UpdateServer External IP passed in is Invalid");
return false;
}
// Check port validity
if (Port <= PORT_EMPTY)
{
Registration.Logger.Error("UpdateServer Invalid Port passed in");
return false;
}
DBRetVal retVal = db.ExecuteNonQuery(String.Format("UPDATE [Hosts_Guids] SET [Internal_IP]='{0}',[External_IP]='{1}',[Port]={2},[LastServerUpdate]='{3}' WHERE [Host_Guid]='{4}'", Internal_IP, External_IP, Port,SqlDTString(DateTime.Now), Host_Guid));
if (retVal.ErrorOccured)
Registration.Logger.Error("UpdateServer Error:{0}", retVal.ErrorMsg);
return retVal.IsValid;
}
/// <summary>
/// Update the Practice Name
/// </summary>
/// <param name="SystemApiKey"></param>
/// <param name="PracticeName"></param>
/// <returns></returns>
internal static bool UpdatePracticeName(string SystemApiKey, string PracticeName)
{
// Check Validity of Practice Name
if (String.IsNullOrEmpty(PracticeName))
{
Registration.Logger.Error("UpdatePracticeName Invalid Practice Name passed in");
return false;
}
// Check Validity of System Key
if (!System_Api_Key_Exist(SystemApiKey))
{
Registration.Logger.Error("UpdatePracticeName Invalid SystemApiKey Passed in. Does not exist");
return false;
}
// Make sure ' are preserved and don't cause an issue with SQL
PracticeName = MAKE_SURE_APOSTROPHY_IS_SQL_READY(PracticeName);
DBRetVal retVal = db.ExecuteNonQuery(String.Format("UPDATE [Hosts_Guids] SET [Practice_Name]='{0}' WHERE [SystemApiKey]='{1}'", PracticeName, SystemApiKey));
if (retVal.ErrorOccured)
Registration.Logger.Error("UpdatePracticeName Error:{0}", retVal.ErrorMsg);
return retVal.IsValid;
}
/// <summary>
/// Retrieve External or Internal Clients
/// </summary>
/// <param name="bInternal"></param>
/// <returns></returns>
internal static Client[] GetClients(bool bInternal)
{
string sql = String.Format("SELECT [SystemApiKey],[External_IP],[Internal_IP],[Port],[Practice_Name] FROM [Hosts_Guids] WHERE [IsInternal]={0}", bInternal ? 1 : 0);
DBRetVal retVal = db.FillDataTable(sql);
if (retVal.IsValid)
{
List<Client> clients = new List<Client>();
foreach (DataRow row in retVal.GetDataTableRetVal().Rows)
{
Client client = new Client();
client.host = new Host();
client.host.practiceName = DataRet.Retrieve(row["Practice_Name"]);
if(bInternal)
client.host.host = DataRet.Retrieve(row["Internal_IP"]);
else
client.host.host = DataRet.Retrieve(row["External_IP"]);
client.host.port = DataRet.Retrieve<int>(row["Port"], PORT_EMPTY); ;
client.systemApiKey = DataRet.Retrieve(row["SystemApiKey"]);
clients.Add(client);
}
return clients.ToArray();
}
return null;
}
/// <summary>
/// Host Has been updated to a newer version, let's track it
/// </summary>
/// <param name="HostGuid"></param>
/// <param name="Version"></param>
internal static void HostHasBeenUpdated(Guid HostGuid, string Version)
{
// Check Host GUID
if (HostGuid == null || String.IsNullOrEmpty(HostGuid.ToString()))
{
Registration.Logger.Error("HostHasBeenUpdated Invalid HostGuid passed in");
return;
}
// Check Host GUID - Ultimate Sanity Check
if (!Host_Guid_Exist(HostGuid))
{
Registration.Logger.Error("RegisterNewServerPractice Invalid Host_Guid passed in. Host GUID does not exist");
return;
}
if (String.IsNullOrEmpty(Version))
{
Registration.Logger.Error("HostHasBeenUpdated Invalid Version passed in");
return;
}
DBRetVal retVal = db.ExecuteNonQuery(String.Format("UPDATE [Hosts_Guids] SET [UpdatedToVersion]='{0}' WHERE [Host_Guid]='{1}'", MAKE_SURE_APOSTROPHY_IS_SQL_READY(Version), HostGuid.ToString()));
if (retVal.ErrorOccured)
Registration.Logger.Error("HostHasBeenUpdated Error:{0}", retVal.ErrorMsg);
}
#endregion
}
}

View File

@@ -0,0 +1,36 @@
namespace Pluto.Registration
{
partial class Installer
{
/// <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 Component 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()
{
components = new System.ComponentModel.Container();
}
#endregion
}
}

View File

@@ -0,0 +1,37 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Configuration.Install;
using System.Linq;
using System.ServiceProcess;
namespace Pluto.Registration
{
[RunInstaller(true)]
public partial class Installer : System.Configuration.Install.Installer
{
public Installer()
{
InitializeComponent();
ServiceProcessInstaller serviceProcessInstaller = new ServiceProcessInstaller();
ServiceInstaller serviceInstaller = new ServiceInstaller();
//# Service Account Information
serviceProcessInstaller.Account = ServiceAccount.LocalSystem;
serviceProcessInstaller.Username = null;
serviceProcessInstaller.Password = null;
//# Service Information
serviceInstaller.ServiceName = "PlutoRegistrationServer";
serviceInstaller.DisplayName = "McKesson Mobile Gateway Server";
serviceInstaller.Description = "Manages connection information for McKesson's PPS Mobile Solution";
serviceInstaller.StartType = ServiceStartMode.Automatic;
// # Done
this.Installers.Add(serviceProcessInstaller);
this.Installers.Add(serviceInstaller);
}
}
}

View File

@@ -0,0 +1,31 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.ServiceProcess;
using System.Text;
using System.Reflection;
namespace RegistrationServer
{
static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
static void Main()
{
ServiceBase[] ServicesToRun;
ServicesToRun = new ServiceBase[]
{
new RegistrationService()
};
#if DEBUG
RegistrationService s = (RegistrationService) ServicesToRun[0];
s.DebugStart(null);
#else
ServiceBase.Run(ServicesToRun);
#endif
}
}
}

View File

@@ -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("RegistrationServer")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Microsoft")]
[assembly: AssemblyProduct("RegistrationServer")]
[assembly: AssemblyCopyright("Copyright © Microsoft 2012")]
[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("2f54dfc9-3261-40c9-97d5-3c5ceeed556a")]
// 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")]

View File

@@ -0,0 +1 @@
RemObjects.SDK.Server.IpTcpServerChannel, RemObjects.SDK.Server, Version=7.0.63.1055, Culture=neutral, PublicKeyToken=3df3cad1b7aa5098

View File

@@ -0,0 +1,195 @@
<?xml version="1.0" encoding="utf-8"?>
<Library Name="Registration" Namespace="Pluto.Registration" UID="{78EC3334-3689-434D-A567-A828E647FFA3}" Version="3.0">
<Documentation><![CDATA[Responsible for registration both client and server devices, as well as obtaining the host for the Server / Data. This allows us to be somewhat flexible on both where the data is hosted and where the server is hosted]]></Documentation>
<Services>
<Service Name="Registration" UID="{B8CBB9BF-74BD-4C0C-8AA2-9B228F75958F}">
<Documentation><![CDATA[Registration API for Mobile / Server Api/Key connectivity]]></Documentation>
<Interfaces>
<Interface Name="Default" UID="{F74A7C92-391B-47EF-8CE7-8D0B95DD51C9}">
<Operations>
<Operation Name="GetApiHostMobile" UID="{023983DF-C040-4D8A-83CA-1A86950B03A7}">
<Parameters>
<Parameter Name="Host" DataType="Host" Flag="Result">
</Parameter>
<Parameter Name="SystemApiKey" DataType="AnsiString" Flag="In" >
</Parameter>
</Parameters>
</Operation>
<Operation Name="GetApiHostWifi" UID="{EE346396-B312-43FC-83E0-79997140F254}">
<Parameters>
<Parameter Name="host" DataType="Host" Flag="Result">
</Parameter>
<Parameter Name="SystemApiKey" DataType="AnsiString" Flag="In" >
</Parameter>
</Parameters>
</Operation>
<Operation Name="GetClients" UID="{EE9DD0AA-44F1-4B5A-A6DF-8305C02B913A}">
<Parameters>
<Parameter Name="Result" DataType="Clients" Flag="Result">
</Parameter>
<Parameter Name="internal" DataType="Boolean" Flag="In" >
</Parameter>
</Parameters>
</Operation>
<Operation Name="GetRegistrationServer" UID="{11F9BC6D-90BA-4EBD-ABFE-18DA367B0B7F}">
<Parameters>
<Parameter Name="Host" DataType="Host" Flag="Result">
</Parameter>
<Parameter Name="SystemApiKey" DataType="AnsiString" Flag="In" >
</Parameter>
</Parameters>
</Operation>
<Operation Name="RegisterNewServerPractice" UID="{04462D32-D14F-483E-98FD-BE35BFF714A4}">
<Parameters>
<Parameter Name="Result" DataType="Boolean" Flag="Result">
</Parameter>
<Parameter Name="PracticeName" DataType="AnsiString" Flag="In" >
</Parameter>
<Parameter Name="server" DataType="Server" Flag="In" >
</Parameter>
<Parameter Name="serverType" DataType="AnsiString" Flag="In" >
</Parameter>
<Parameter Name="UserApiKey" DataType="AnsiString" Flag="Out" >
</Parameter>
<Parameter Name="UserApiPin" DataType="AnsiString" Flag="Out" >
</Parameter>
</Parameters>
</Operation>
<Operation Name="RegisterNewClient" UID="{5504CD73-A616-4E57-B531-F8C64C8469FC}">
<Parameters>
<Parameter Name="SystemApiKey" DataType="AnsiString" Flag="Result">
</Parameter>
<Parameter Name="UserApiKey" DataType="AnsiString" Flag="In" >
</Parameter>
<Parameter Name="UserApiPin" DataType="AnsiString" Flag="In" >
</Parameter>
</Parameters>
</Operation>
<Operation Name="ServerHasBeenUpdated" UID="{906F0F30-BF2A-4D8C-9B5C-0E745CF673C4}">
<Parameters>
<Parameter Name="HostGUID" DataType="AnsiString" Flag="In" >
</Parameter>
<Parameter Name="Version" DataType="AnsiString" Flag="In" >
</Parameter>
</Parameters>
</Operation>
<Operation Name="RetrieveNewClientPin" UID="{ED7A50DB-4A67-4E94-9CA1-55BDC0B24CFF}">
<Parameters>
<Parameter Name="pin" DataType="AnsiString" Flag="Result">
</Parameter>
<Parameter Name="UserApiKey" DataType="AnsiString" Flag="In" >
</Parameter>
</Parameters>
</Operation>
<Operation Name="UpdateServer" UID="{342E83E4-9541-4FB1-B8F7-2A19ABE2950B}">
<Parameters>
<Parameter Name="Result" DataType="Boolean" Flag="Result">
</Parameter>
<Parameter Name="server" DataType="Server" Flag="In" >
</Parameter>
</Parameters>
</Operation>
<Operation Name="UpdatePracticeName" UID="{5E789445-3DB5-45F8-B726-1107856969CB}">
<Parameters>
<Parameter Name="Result" DataType="Boolean" Flag="Result">
</Parameter>
<Parameter Name="UserApiKey" DataType="AnsiString" Flag="In" >
</Parameter>
<Parameter Name="UserApiPin" DataType="AnsiString" Flag="In" >
</Parameter>
<Parameter Name="PracticeName" DataType="AnsiString" Flag="In" >
</Parameter>
</Parameters>
</Operation>
<Operation Name="UpdatePracticeName2" UID="{0FDA0F70-75E2-4171-9F2D-FAAECD0A27A7}">
<Parameters>
<Parameter Name="Result" DataType="Boolean" Flag="Result">
</Parameter>
<Parameter Name="systemApiKey" DataType="AnsiString" Flag="In" >
</Parameter>
<Parameter Name="PracticeName" DataType="AnsiString" Flag="In" >
</Parameter>
</Parameters>
</Operation>
<Operation Name="IsServerReachable" UID="{BA9A677A-DEEE-4FA5-8319-98250F992581}">
<Parameters>
<Parameter Name="Result" DataType="Boolean" Flag="Result">
</Parameter>
<Parameter Name="server" DataType="Server" Flag="In" >
</Parameter>
</Parameters>
</Operation>
<Operation Name="IsClientReachable" UID="{6BEB398B-6016-4B28-9234-AE23659B544A}">
<Parameters>
<Parameter Name="Result" DataType="Boolean" Flag="Result">
</Parameter>
<Parameter Name="systemApiKey" DataType="AnsiString" Flag="In" >
</Parameter>
</Parameters>
</Operation>
<Operation Name="RetrieveHostGUIDForServerFromInternet" UID="{0C206CA2-8AC7-4725-BAD0-BA63005F03B3}">
<Parameters>
<Parameter Name="HostGUID" DataType="AnsiString" Flag="Result">
</Parameter>
<Parameter Name="server" DataType="Server" Flag="In" >
</Parameter>
</Parameters>
</Operation>
<Operation Name="DoesServerHostGUIDExist" UID="{6EB603F2-D2F1-4D42-8B27-5A9D2AC9F307}">
<Parameters>
<Parameter Name="Result" DataType="Boolean" Flag="Result">
</Parameter>
<Parameter Name="HostGUID" DataType="AnsiString" Flag="In" >
</Parameter>
</Parameters>
</Operation>
</Operations>
</Interface>
</Interfaces>
</Service>
</Services>
<Structs>
<Struct Name="Host" UID="{A5B4D84F-07F1-47A2-9806-E943ADB4999C}" AutoCreateParams="1">
<Documentation><![CDATA[Host Struct contains the Hostname (any url or ip) and the port to use for communication. All are using TCP/IP not http.]]></Documentation>
<Elements>
<Element Name="host" DataType="AnsiString">
</Element>
<Element Name="port" DataType="Integer">
</Element>
<Element Name="practiceName" DataType="AnsiString">
</Element>
</Elements>
</Struct>
<Struct Name="Server" UID="{E9E17642-32E7-4ACA-87E1-6C36CC6FF4D6}" AutoCreateParams="1">
<Documentation><![CDATA[A structure we used to 'track' a Server Instance. We keep this information in our registration table to track a server's IP change, internal and external.]]></Documentation>
<Elements>
<Element Name="HostGUID" DataType="AnsiString">
</Element>
<Element Name="InternalIP" DataType="AnsiString">
</Element>
<Element Name="ExternalIP" DataType="AnsiString">
</Element>
<Element Name="Port" DataType="Integer">
</Element>
</Elements>
</Struct>
<Struct Name="Client" UID="{7D68EBA7-9404-4C65-8B48-3A9FBF57FEE9}" AutoCreateParams="1">
<Elements>
<Element Name="systemApiKey" DataType="AnsiString">
</Element>
<Element Name="host" DataType="Host">
</Element>
</Elements>
</Struct>
</Structs>
<Enums>
</Enums>
<Arrays>
<Array Name="StringArray" UID="{43D47C95-D9B0-42BD-B446-0EF824F0F329}">
<ElementType DataType="AnsiString" />
</Array>
<Array Name="Clients" UID="{C75A12A2-8A0D-47AB-B2EA-5E9A96C1A318}">
<ElementType DataType="Client" />
</Array>
</Arrays>
</Library>

View File

@@ -0,0 +1,138 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
<ProductVersion>8.0.30703</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{6D35BEFC-9D4C-4317-9418-2DE43EB91A74}</ProjectGuid>
<OutputType>WinExe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Pluto.Registration</RootNamespace>
<AssemblyName>Pluto.RegistrationServer</AssemblyName>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
<TargetFrameworkProfile>
</TargetFrameworkProfile>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
<PlatformTarget>x86</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>..\Target\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
<PlatformTarget>x86</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>..\Target\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="RemObjects.InternetPack, Version=7.0.63.1055, Culture=neutral, PublicKeyToken=3df3cad1b7aa5098, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>Components\RemObjects.InternetPack.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="RemObjects.SDK, Version=7.0.63.1055, Culture=neutral, PublicKeyToken=3df3cad1b7aa5098, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>Components\RemObjects.SDK.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="RemObjects.SDK.Server, Version=7.0.63.1055, Culture=neutral, PublicKeyToken=3df3cad1b7aa5098, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>Components\RemObjects.SDK.Server.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="RemObjects.SDK.ZLib, Version=7.0.63.1055, Culture=neutral, PublicKeyToken=3df3cad1b7aa5098, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>Components\RemObjects.SDK.ZLib.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Sdaleo, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\3rdParty\Sdaleo\Sdaleo.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.configuration" />
<Reference Include="System.Configuration.Install" />
<Reference Include="System.Core" />
<Reference Include="System.Management" />
<Reference Include="System.Net" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.Data" />
<Reference Include="System.ServiceProcess" />
<Reference Include="System.Xml" />
<Reference Include="Yaulw, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\3rdParty\Sdaleo\Yaulw.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="Configuration.cs" />
<Compile Include="DataAccessLayer.cs" />
<Compile Include="DEBUGGING_ONLY.cs" />
<Compile Include="Installer.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="Installer.Designer.cs">
<DependentUpon>Installer.cs</DependentUpon>
</Compile>
<Compile Include="RegistrationService.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="RegistrationService.Designer.cs">
<DependentUpon>RegistrationService.cs</DependentUpon>
</Compile>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Registration_Impl.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="Registration_Intf.cs" />
<Compile Include="Registration_Invk.cs" />
<Compile Include="SystemAccessVerifier.cs" />
</ItemGroup>
<ItemGroup>
<None Include="app.config">
<SubType>Designer</SubType>
</None>
<None Include="Registration.rodl" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="licenses.licx" />
<EmbeddedResource Include="Properties\licenses.licx" />
<EmbeddedResource Include="RegistrationService.resx">
<DependentUpon>RegistrationService.cs</DependentUpon>
<SubType>Designer</SubType>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Pluto.MSL.Api\Pluto.MSL.Api.csproj">
<Project>{B794609D-A93E-41E3-9291-84FC73412347}</Project>
<Name>Pluto.MSL.Api</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PreBuildEvent>"C:\Program Files (x86)\RemObjects Software\RemObjects SDK (Common)\Bin\RODL.exe" /language:c# "$(ProjectDir)Registration.rodl"</PreBuildEvent>
</PropertyGroup>
<PropertyGroup>
<PostBuildEvent>
</PostBuildEvent>
</PropertyGroup>
<!-- 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.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<ProjectView>ShowAllFiles</ProjectView>
</PropertyGroup>
</Project>

View File

@@ -0,0 +1,85 @@
using Pluto.Registration;
namespace RegistrationServer
{
partial class RegistrationService
{
/// <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);
}
/// <summary>
/// Set the Port to use for the Channel
/// </summary>
/// <param name="Port">Port To use</param>
private void SetPort(int Port)
{
if (Port > 0 && this.ServerChannel.Port != Port)
{
this.ServerChannel.Port = Port;
this.ServerChannel.TcpServer.Port = Port;
}
}
#region Component 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.components = new System.ComponentModel.Container();
this.ServerChannel = new RemObjects.SDK.Server.IpTcpServerChannel(this.components);
this.binMessage = new RemObjects.SDK.BinMessage();
this.aesEncryptionEnvelope = new RemObjects.SDK.AesEncryptionEnvelope();
((System.ComponentModel.ISupportInitialize)(this.ServerChannel)).BeginInit();
//
// ServerChannel
//
this.ServerChannel.Dispatchers.Add(new RemObjects.SDK.Server.MessageDispatcher("bin", this.binMessage));
this.ServerChannel.Port = 443;
//
//
//
this.ServerChannel.TcpServer.Port = 443;
//
// binMessage
//
this.binMessage.ContentType = "application/octet-stream";
this.binMessage.Envelopes.Add(new RemObjects.SDK.MessageEnvelopeItem(this.aesEncryptionEnvelope));
this.binMessage.SerializerInstance = null;
//
// aesEncryptionEnvelope
//
this.aesEncryptionEnvelope.EnvelopeMarker = "AES";
this.aesEncryptionEnvelope.Password = "KxHWkkE5PAp4tuTzmPKQF7RUyylMk7VOV8zfYln2w6NZJMOvT3yrXofIJWxJYRSQwAkm8DysTG9k7";
//
// RegistrationService
//
this.ServiceName = "PlutoRegistrationServer";
((System.ComponentModel.ISupportInitialize)(this.ServerChannel)).EndInit();
}
#endregion
private RemObjects.SDK.Server.IpTcpServerChannel ServerChannel;
private RemObjects.SDK.BinMessage binMessage;
private RemObjects.SDK.AesEncryptionEnvelope aesEncryptionEnvelope;
}
}

View File

@@ -0,0 +1,356 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Linq;
using System.ServiceProcess;
using System.Text;
using Pluto.Registration;
using System.Reflection;
using Yaulw.Thread;
namespace RegistrationServer
{
public partial class RegistrationService : ServiceBase
{
#region Internal Consts
// Threshold used to determine if system just rebooted, and service just
// started. We need to wait a little because we need to make sure the Database Server is up
internal const int NUMBER_OF_MINUTES_SERVICE_UP_THRESHOLD = 5;
internal const int NUMBER_OF_MINUTES_SYSTEM_UP_THRESHOLD = 10;
#endregion
#region Internal Statics
/// <summary>
/// Service Start Time
/// </summary>
internal static DateTime ServiceStartDT = DateTime.MinValue;
#endregion
#region Private Members
/// <summary>
/// Check if this is the first time the network got enabled
/// </summary>
private bool FirstTimeNetworkConnected = true;
/// <summary>
/// Was the Channel Activated?
/// </summary>
private bool ROHasBeenActivated = false;
/// <summary>
/// Did a System Reboot just occur?
/// </summary>
private bool SystemJustStarted_SoUseServiceThreshold = false;
private bool ServiceUpTimeReached = false;
private bool SystemThresholdNotReached = true;
/// <summary>
/// Is the Logger Setup?
/// </summary>
private bool LoggerIsSetup = false;
/// <summary>
/// Our Connectivity Timer Thread
/// </summary>
private SingleThreadTimer connectivityTimer = null;
/// <summary>
/// If for some reason the network goes down, we should re-initialize
/// everything as if nothing happened
/// </summary>
private bool NetworkOutageDetected = false;
#endregion
#region Construction
/// <summary>
/// Singleton Instance of the Service
/// </summary>
internal static RegistrationService s_RegistrationService = null;
/// <summary>
/// Constructor
/// </summary>
public RegistrationService()
{
InitializeComponent();
// Log to the Application System Log
this.EventLog.Log = "Application";
s_RegistrationService = this;
// Handle all unexpected errors
AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);
}
/// <summary>
/// Unhandled Domain Exception
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
{
Exception ex = (Exception)e.ExceptionObject;
String msg = "UnhandledException Occured: " + ex.Message + "\n\n" + ex.InnerException.Message;
AppLogError(msg);
}
#endregion
#region Windows Event Logging
internal static void AppLogError(string errMsg)
{
s_RegistrationService.EventLog.WriteEntry(errMsg, EventLogEntryType.Error);
if (Registration.Logger != null)
Registration.Logger.Error(errMsg);
}
internal static void AppLogInfo(string infoMsg)
{
s_RegistrationService.EventLog.WriteEntry(infoMsg, EventLogEntryType.Information);
if (Registration.Logger != null)
Registration.Logger.Info(infoMsg);
}
internal static void AppLogWarning(string warnMsg)
{
s_RegistrationService.EventLog.WriteEntry(warnMsg, EventLogEntryType.Warning);
if (Registration.Logger != null)
Registration.Logger.Info(warnMsg);
}
#endregion
// usefull for debugging Service in visual studio
#if DEBUG
internal void DebugStart(string[] args)
{
DEBUGGING_ONLY.DEBUGSTEP_INTO();
OnStart(args);
}
#endif
#region System / Service Up Time
/// <summary>
/// Get Service UpTime
/// </summary>
/// <returns></returns>
private TimeSpan GetServiceUpTime()
{
return (DateTime.Now - ServiceStartDT);
}
/// <summary>
/// For Service Handling, see if the system has been up long enough
/// Once it becomes true, it will always return true
/// </summary>
private bool HasServiceBeenUpLongEnough()
{
if (!ServiceUpTimeReached)
ServiceUpTimeReached = GetServiceUpTime().TotalMinutes >= NUMBER_OF_MINUTES_SERVICE_UP_THRESHOLD;
return ServiceUpTimeReached;
}
/// <summary>
/// For Error Handling, see if the system has been up till this threshold
/// Once it becomes false, will always return false
/// </summary>
/// <returns></returns>
private bool IsSystemBeenUpWithinMaxThreshold()
{
if (SystemThresholdNotReached)
SystemThresholdNotReached = (Yaulw.Installer.Common.GetSystemUpTime().TotalMinutes <= NUMBER_OF_MINUTES_SYSTEM_UP_THRESHOLD);
return SystemThresholdNotReached;
}
#endregion
/// <summary>
/// Service Start-Up
/// </summary>
/// <param name="args"></param>
protected override void OnStart(string[] args)
{
try
{
// Service Started
// System just started, so make sure that service is timing out a little to make
// sure everything is up and running
SystemJustStarted_SoUseServiceThreshold = IsSystemBeenUpWithinMaxThreshold();
AppLogInfo(String.Format("MSLMobile Gateway Service started up at: {0}. System Reboot detected: {1}", DateTime.Now.ToLongTimeString(), SystemJustStarted_SoUseServiceThreshold));
ServiceStartDT = DateTime.Now;
// Internet / Network Connectivity Timer
// * Ran into issues when computer is rebooted, we need certain things working before the service can start,
// * therefore decided to put DataStore Read(), AutoUpdate, RO Connection into a Connection Timer,
// that keeps checking every 10 seconds if we have network connectivity * Enables / Disables RO Channels as needed, just in case *
AppLogInfo("MSLMobile Gateway Service starting connectivity timer.");
connectivityTimer = new SingleThreadTimer(ConnectivityHandler, (uint)TimeSpan.FromSeconds(10).TotalMilliseconds, true);
}
catch (Exception e)
{
AppLogError(String.Format("Service OnStart() Error thrown. Fatal. Can't continue: {0}", e.Message));
this.Stop();
}
}
#region Private Connectivity Timed Thread (runs every 10 Seconds)
/// <summary>
/// Single Threaded Connectivity Handler (Handles Auto-Update, ReadInDataStore(), and RO Channels)
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void ConnectivityHandler(object sender, Yaulw.Thread.SingleThreadTimer.STElapsedEventArgs e)
{
// System just started, we won't do anyting in here until our
// Service Startup 'NUMBER_OF_MINUTES_SERVICE_UP_THRESHOLD' timeout of is reached
if (SystemJustStarted_SoUseServiceThreshold && !HasServiceBeenUpLongEnough())
return;
// Check Connectivity,
// ~withouth basic networking being up there is nothing really to do here
bool bHasConnection = Yaulw.Net.IPHostHelper.HasConnection();
if (!bHasConnection)
{
DeactivateChannelIfActivated(true);
return;
}
// Always set up the Logger First (Needed for all subsequent DB Calls)
if (!LoggerIsSetup)
{
AppLogInfo("Setting up Logger");
Registration.Setup_Logger();
LoggerIsSetup = true;
}
// * Check to Make sure the System has been up long enough *
// Calling VerifyConnectivity() requires SQL Server to be up
// and running and hence, we can't do it right at service start when the
// server just rebooted, we wait 5 of service uptime to make sure after a server reboot,
// that the services needed are up
if (FirstTimeNetworkConnected)
{
AppLogInfo("System has been up long enough. Starting Initialization.");
// Make sure we can connect to the Database
try
{
if (!DataAccessLayer.VerifyConnectivity())
{
AppLogError("Cannot verify SQL Server Credentials upon initialization. Service must be stopped.");
this.Stop();
}
else
{
AppLogInfo("Success. SQL Server Credentials could connect upon initialization.");
}
}
catch (Exception ex)
{
AppLogError(String.Format("Cannot verify SQL Server Credentials upon initialization '{0}'. Service must be stopped.", ex.Message));
this.Stop();
}
FirstTimeNetworkConnected = false;
return;
}
// We have a valid SQL Server Connection, hence we can continue
if (!FirstTimeNetworkConnected)
{
// If Network disconnection occured, we should try to re-read in everything,
// to make sure we are doing the best we can
if (NetworkOutageDetected)
{
AppLogInfo("Network Outage Detected - Trying to retry connecting to SQL Server");
// Make sure we can connect to the Database
try
{
if (!DataAccessLayer.VerifyConnectivity())
AppLogError("Cannot verify SQL Server Credentials after Network Outage.");
else
AppLogInfo("Success. SQL Server Credentials could connect after Networ Outage.");
}
catch (Exception ex)
{
AppLogError(String.Format("Cannot verify SQL Server Credentials after Network Outage '{0}'.", ex.Message));
}
}
// Activate the RO Channel
ActivateChannelIfNotActivated();
}
}
#endregion
#region Private RO Channel Helpers
/// <summary>
/// Activate all Channel
/// </summary>
private void ActivateChannelIfNotActivated()
{
if (!ROHasBeenActivated)
{
SetPort(Configuration.Port);
ServerChannel.Activate();
ROHasBeenActivated = true;
AppLogInfo(String.Format("MSLMobile Gateway Service Channel Activated on Port:{0}.", Configuration.Port));
NetworkOutageDetected = false;
}
}
/// <summary>
/// Deactivate RO Channel
/// </summary>
private void DeactivateChannelIfActivated(bool bNetworkOutage)
{
if (ROHasBeenActivated)
{
ServerChannel.Deactivate();
ROHasBeenActivated = false;
AppLogInfo("MSLMobile Gateway Service Channel Deactivated.");
NetworkOutageDetected = bNetworkOutage;
}
}
#endregion
// usefull for debugging Service in visual studio
#if DEBUG
internal void DebugStop() { OnStop(); }
#endif
/// <summary>
/// SCM OnStop() call-in
/// </summary>
protected override void OnStop()
{
try
{
// First stop the internal connectivity timer
if (connectivityTimer != null)
{
AppLogInfo("MSLMobile Gateway Service connectivity timer stopped.");
connectivityTimer.Stop();
}
DeactivateChannelIfActivated(false);
AppLogInfo("End DeactivateChannelIfActivated.");
}
catch (Exception) { /* ignore */ }
}
}
}

View File

@@ -0,0 +1,132 @@
<?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=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>
<metadata name="ServerChannel.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 54</value>
</metadata>
<metadata name="binMessage.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 91</value>
</metadata>
<metadata name="aesEncryptionEnvelope.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>126, 91</value>
</metadata>
<metadata name="$this.TrayLargeIcon" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
</root>

View File

@@ -0,0 +1,520 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:2.0.50727.4971
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace Pluto.Registration
{
using System;
using RemObjects.SDK;
using RemObjects.SDK.Types;
using RemObjects.SDK.Server;
using RemObjects.SDK.Server.ClassFactories;
using System.Net;
using System.Net.Sockets;
using System.Diagnostics;
using RegistrationServer;
using Yaulw.Assembly;
using Yaulw.File;
using Yaulw.Tools;
[RemObjects.SDK.Server.ClassFactories.StandardClassFactory()]
[RemObjects.SDK.Server.Service(Name = "Registration", InvokerClass = typeof(Registration_Invoker), ActivatorClass = typeof(Registration_Activator))]
public class Registration : RemObjects.SDK.Server.Service, IRegistration
{
private System.ComponentModel.Container components = null;
public Registration() :
base()
{
this.InitializeComponent();
}
private void InitializeComponent()
{
}
protected override void Dispose(bool aDisposing)
{
if (aDisposing)
{
if ((this.components != null))
{
this.components.Dispose();
}
}
base.Dispose(aDisposing);
}
#region Logging
/// <summary>
/// For Logging to a File
/// </summary>
internal static Logging Logger = null;
/// <summary>
/// Setup the Logger Object, should be done only once at when the application starts
/// </summary>
internal static void Setup_Logger()
{
if (Logger == null)
{
// Default Log File Settings
const int LOG_FILE_FILE_SIZE_IN_MB = 4;
const int LOG_FILE_NUM_OF_BACKUPS = 2;
const string FILE_EXTENSION_LOG_DEFAULT = "log";
// Default Log File Name N Path Settings
string Path = AssemblyW.SpecializedAssemblyInfo.GetAssemblyPath(AssemblyW.AssemblyST.Entry);
string LogFileNameNPath = PathNaming.PathEndsWithSlash(Path) + AssemblyW.GetAssemblyName(AssemblyW.AssemblyST.Entry) + "." + FILE_EXTENSION_LOG_DEFAULT;
// Log Config
Logging_Configuration config = new Logging_Configuration();
config.LogFileNameNPath = LogFileNameNPath;
config.maxFileSizeInMB = LOG_FILE_FILE_SIZE_IN_MB;
config.numOfBackupLogFiles = LOG_FILE_NUM_OF_BACKUPS;
config.Log4NetDetailPatternLayout = "%date{dd MMM HH:mm:ss,fff} %level - %message%newline";
config.LogCallingType = false;
config.LogCallingFunction = false;
config.Detail = Logging_Detail.DEBUG;
config.UseExclusiveFileLock = false;
// Now just create the Logger
Logger = Logging.AddGlobalLoggerConfiguration(AssemblyW.GetAssemblyName(AssemblyW.AssemblyST.Entry), config);
// Make a Debug Message show,
Logger.Info("Logger Started at:{0}", DateTime.Now.ToString());
}
}
#endregion
#region IMP Get Registration Server (could be Important for Migration)
/// <summary>
/// Get Host and IP of the Registration Server,
/// useful when we plan on switching later
/// </summary>
/// <param name="SystemApiKey"></param>
/// <returns></returns>
public virtual Host GetRegistrationServer(string SystemApiKey)
{
// For now only pass out * this service's configuration *
var host = new Host();
host.host = Configuration.Url;
host.port = Configuration.Port;
return host;
}
#endregion
#region Retrieve IP n Port Stuff
/// <summary>
/// Get Mobile Host
/// </summary>
/// <param name="SystemApiKey"></param>
/// <returns></returns>
public virtual Host GetApiHostMobile(string SystemApiKey)
{
Host host = new Host();
try
{
int p;
string h;
string n;
if (DataAccessLayer.RetrieveIPMobileAndPort(SystemApiKey, out h, out p, out n))
{
host.host = h;
host.port = p;
host.practiceName = n;
}
}
catch (Exception e)
{
Logger.Error("GetApiHostMobile Error", e);
}
return host;
}
/// <summary>
/// Get Wifi Host
/// </summary>
/// <param name="SystemApiKey"></param>
/// <returns></returns>
public virtual Host GetApiHostWifi(string SystemApiKey)
{
Host host = new Host();
try
{
int p;
string h;
string n;
if (DataAccessLayer.RetrieveIPWifiAndPort(SystemApiKey, out h, out p, out n))
{
host.host = h;
host.port = p;
host.practiceName = n;
}
}
catch (Exception e)
{
Logger.Error("GetApiHostMobile Error", e);
}
return host;
}
#endregion
#region MSLConnect Call-Ins
/// <summary>
/// Register a New Server Practice
/// </summary>
/// <param name="PracticeName"></param>
/// <param name="server"></param>
/// <param name="serverType"></param>
/// <param name="UserApiKey"></param>
/// <param name="UserApiPin"></param>
/// <returns></returns>
public virtual bool RegisterNewServerPractice(string PracticeName, Server server, string serverType, out string UserApiKey, out string UserApiPin)
{
UserApiKey = String.Empty;
UserApiPin = String.Empty;
try
{
// One IP must exist! bound to a Practice ~otherwise, what is the point
if ((String.IsNullOrEmpty(server.InternalIP) && String.IsNullOrEmpty(server.ExternalIP)) || String.IsNullOrEmpty(PracticeName))
{
Logger.Error("RegisterNewServerPractice at least one IP must be passed in and a Practice Name");
return false;
}
if (String.IsNullOrEmpty(server.HostGUID))
{
Logger.Error("Server HostGUID must be passed in");
return false;
}
if (String.IsNullOrEmpty(serverType))
{
Logger.Error("serverType must be passed in");
return false;
}
// create GUID from HostGUID
Guid guid = new Guid(server.HostGUID);
Logger.Info("RegisterNewServerPractice called() for Practice {0} Product {1} Host_GUID {2}", PracticeName, serverType, server.HostGUID);
// Make sure that the SystemApiKey doesn't already exist * Do this up to 15 times just in case*
// more than that would be terrible system api key algorigthm
bool bIsUniqueSystemKey = false;
string SystemApiKey = SystemAccessVerifier.GenerateNewSystemApiKey(serverType[0]);
for (int i = 0; i < 10; ++i)
{
bIsUniqueSystemKey = !DataAccessLayer.System_Api_Key_Exist(SystemApiKey);
if (bIsUniqueSystemKey)
break;
else
SystemApiKey = SystemAccessVerifier.GenerateNewSystemApiKey(serverType[0]);
}
// We should only get here if we can validly insert a record with non-existing System Key
if (bIsUniqueSystemKey)
{
bool bRegisterSuccess = DataAccessLayer.RegisterNewServerPractice(SystemApiKey, guid, server.InternalIP, server.ExternalIP, (uint)server.Port, PracticeName);
if (bRegisterSuccess)
{
SystemAccessVerifier verifier = new SystemAccessVerifier(SystemApiKey);
UserApiKey = verifier.UserApiKey;
UserApiPin = verifier.Pin;
return bRegisterSuccess;
}
}
else
{
Logger.Error("RegisterNewServerPractice Error: System Key '{0}' already exists. 10x wasn't enought to generate a new one. Very Illogical!", SystemApiKey);
}
}
catch (Exception e)
{
Logger.Error("RegisterNewServerPractice Error", e);
}
return false;
}
/// <summary>
/// Retrieve the System API Key for a UserApiKey and UserApiPin
/// </summary>
/// <param name="UserApiKey"></param>
/// <param name="UserApiPin"></param>
/// <returns></returns>
public virtual string RegisterNewClient(string UserApiKey, string UserApiPin)
{
try
{
// Check all our inputs
if (!String.IsNullOrEmpty(UserApiKey) && !String.IsNullOrEmpty(UserApiPin) )
{
// Retrieve the System Key from their credentials
string SystemApiKey = String.Empty;
SystemAccessVerifier verifier = new SystemAccessVerifier(UserApiKey, UserApiPin);
if (!String.IsNullOrEmpty(verifier.SystemApiKey))
{
// Check to make sure that this system key exists
if (!DataAccessLayer.System_Api_Key_Exist(verifier.SystemApiKey))
{
Logger.Error("System Key '{2}' retrieval failed for registering a New Client with UserApiKey '{0}' and Pin '{1}'", UserApiKey, UserApiPin, verifier.SystemApiKey);
return String.Empty;
}
return verifier.SystemApiKey;
}
else
{
Logger.Error("System Key '{2}' verification failed for registering a New Client with UserApiKey '{0}' and Pin '{1}'", UserApiKey, UserApiPin, verifier.SystemApiKey);
}
}
}
catch (Exception e)
{
Logger.Error("RegisterNewServerPractice Error", e);
}
return String.Empty;
}
/// <summary>
/// Retrieve Pin for a Client
/// </summary>
/// <param name="UserApiKey"></param>
/// <returns></returns>
public virtual string RetrieveNewClientPin(string UserApiKey)
{
try
{
if (!String.IsNullOrEmpty(UserApiKey))
{
string Pin = SystemAccessVerifier.RetrieveUserApkiKeyPin(UserApiKey);
if (!String.IsNullOrEmpty(Pin))
return Pin;
else
Logger.Error("Failed to retrieve Pin for UserApiKey:{0}", UserApiKey);
}
}
catch (Exception e)
{
Logger.Error("RetrieveNewClientPin Error", e);
}
return String.Empty;
}
/// <summary>
/// Update the Server
/// </summary>
/// <param name="server"></param>
/// <returns></returns>
public virtual bool UpdateServer(Server server)
{
try
{
Guid guid = new Guid(server.HostGUID);
bool bSuccess = DataAccessLayer.UpdateServer(guid, server.InternalIP, server.ExternalIP, (uint)server.Port);
return bSuccess;
}
catch (Exception e)
{
Logger.Error("UpdateServer Error", e);
}
return false;
}
/// <summary>
/// Update Practice Name
/// </summary>
/// <param name="UserApiKey"></param>
/// <param name="UserApiPin"></param>
/// <param name="PracticeName"></param>
/// <returns></returns>
public virtual bool UpdatePracticeName(string UserApiKey, string UserApiPin, string PracticeName)
{
try
{
// Retrieve the System Key from their credentials
string SystemApiKey = String.Empty;
SystemAccessVerifier verifier = new SystemAccessVerifier(UserApiKey, UserApiPin);
if (!String.IsNullOrEmpty(verifier.SystemApiKey))
{
bool bSuccess = UpdatePracticeName2(verifier.SystemApiKey, PracticeName);
return bSuccess;
}
else
Logger.Error("Failed to Retrieve SystemApiKey for UserApiKey:{0} and Pin:{1}", UserApiKey, UserApiPin);
}
catch (Exception e)
{
Logger.Error("UpdatePracticeName Error", e);
}
return false;
}
/// <summary>
/// Update Practice Name 2
/// </summary>
/// <param name="SystemApiKey"></param>
/// <param name="PracticeName"></param>
/// <returns></returns>
public virtual bool UpdatePracticeName2(string SystemApiKey, string PracticeName)
{
try
{
bool bSuccess = DataAccessLayer.UpdatePracticeName(SystemApiKey, PracticeName);
return bSuccess;
}
catch (Exception e)
{
Logger.Error("UpdatePracticeName2 Error", e);
}
return false;
}
/// <summary>
/// Same really as IsServerReachable except that it can be called by just passing in
/// a System API Key
/// </summary>
/// <param name="SystemApiKey"></param>
/// <returns></returns>
public virtual bool IsClientReachable(string SystemApiKey)
{
Host host = GetApiHostMobile(SystemApiKey);
Server server = new Server();
server.ExternalIP = host.host;
server.Port = host.port;
bool bCanConnect = IsServerReachable(server);
if (!bCanConnect)
Logger.Error("IsClientReachable call to IsServerReachable returned false");
return bCanConnect;
}
/// <summary>
/// Check to see if the specified external IP address and port can be reached from here
/// Must be on a different port than this server is running on
/// </summary>
/// <param name="server"></param>
/// <returns></returns>
public virtual bool IsServerReachable(Server server)
{
// To Do: in the future! - Check to see if the IP address is not private range,
// no need to do a port open on a private IP address, we should never be called with a private IP!
// if we do that is an error.
IPAddress ip = IPAddress.None;
if (String.IsNullOrEmpty(server.ExternalIP) || server.Port == Configuration.Port ||
!IPAddress.TryParse(server.ExternalIP, out ip) || !Yaulw.Net.IPHostHelper.IsValidIPv4Address(ip, false))
{
Logger.Error("Invalid IP/configuration passed into IsServerReachable IP:{0} Port:{1}", ip, server.Port);
return false;
}
bool bCanConnect = Yaulw.Net.IPHostHelper.IsPortOpen(ip, server.Port);
return bCanConnect;
}
/// <summary>
/// Calls Pluto API on the specified server and port to try to get the HOST GUID
/// from there. This is done on purpose to check that the service that is up could
/// actually belong to ourselves
/// </summary>
/// <param name="server">Valid Server Object with the external IP set and valid port</param>
/// <returns>will return the HOST GUID of the Pluto Instance, if found, otherwise ""</returns>
public virtual string RetrieveHostGUIDForServerFromInternet(Server server)
{
try
{
IPAddress ip = IPAddress.None;
if (String.IsNullOrEmpty(server.ExternalIP) || server.Port == Configuration.Port ||
!IPAddress.TryParse(server.ExternalIP, out ip) || !Yaulw.Net.IPHostHelper.IsValidIPv4Address(ip, false))
{
Logger.Error("Invalid IP/configuration passed into RetrieveHostGUIDForServerFromInternet IP:{0} Port:{1}", ip, server.Port);
return String.Empty;
}
// Try to use Pluto Api to retrieve the Pluto instance's HOST GUID
Pluto.MSL.Api.API.SetNetworkSettings(ip.ToString(), (uint)server.Port);
string FoundHostGuid = Pluto.MSL.Api.API.GetHostGUID();
if (!String.IsNullOrEmpty(FoundHostGuid))
return FoundHostGuid;
}
catch (Exception e)
{
Logger.Error("RetrieveHostGUIDForServerFromInternet Error", e);
}
return String.Empty;
}
#endregion
#region Pluto AddOns
/// <summary>
/// Checks to see if the Host GUID exists on the Database
/// </summary>
/// <param name="HostGUID"></param>
/// <returns></returns>
public virtual bool DoesServerHostGUIDExist(string HostGUID)
{
try
{
Guid guid = new Guid(HostGUID);
bool bExists = DataAccessLayer.Host_Guid_Exist(guid);
return bExists;
}
catch (Exception e)
{
Logger.Error("DoesServerHostGUIDExist Error", e);
}
return false;
}
/// <summary>
/// Updates the version for the specified Host GUID
/// </summary>
/// <param name="HostGUID"></param>
/// <param name="Version"></param>
public virtual void ServerHasBeenUpdated(string HostGUID, string Version)
{
try
{
Guid guid = new Guid(HostGUID);
DataAccessLayer.HostHasBeenUpdated(guid, Version);
}
catch (Exception e)
{
Logger.Error("ServerHasBeenUpdated Error", e);
}
}
/// <summary>
/// GetClients used for internal / corporate
/// </summary>
/// <param name="IsInternal"></param>
/// <returns></returns>
public virtual Client[] GetClients(bool IsInternal)
{
try
{
Client[] clients = DataAccessLayer.GetClients(IsInternal);
return clients;
}
catch (Exception e)
{
Logger.Error("GetClients Error", e);
}
return null;
}
#endregion
}
}

View File

@@ -0,0 +1,695 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.296
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace Pluto.Registration {
using System;
using RemObjects.SDK;
using RemObjects.SDK.Types;
using System.Collections.Generic;
[RemObjects.SDK.Remotable(ActivatorClass=typeof(Host_Activator))]
[System.Reflection.ObfuscationAttribute(Exclude=true)]
public partial class Host : RemObjects.SDK.Types.ComplexType {
private string @__host;
private int @__port;
private string @__practiceName;
[RemObjects.SDK.StreamAs(RemObjects.SDK.StreamingFormat.AnsiString)]
public virtual string host {
get {
return @__host;
}
set {
@__host = value;
this.TriggerPropertyChanged("host");
}
}
public virtual int port {
get {
return @__port;
}
set {
@__port = value;
this.TriggerPropertyChanged("port");
}
}
[RemObjects.SDK.StreamAs(RemObjects.SDK.StreamingFormat.AnsiString)]
public virtual string practiceName {
get {
return @__practiceName;
}
set {
@__practiceName = value;
this.TriggerPropertyChanged("practiceName");
}
}
public override void ReadComplex(RemObjects.SDK.Serializer aSerializer) {
if (aSerializer.RecordStrictOrder) {
host = aSerializer.ReadAnsiString("host");
port = aSerializer.ReadInt32("port");
practiceName = aSerializer.ReadAnsiString("practiceName");
}
else {
host = aSerializer.ReadAnsiString("host");
port = aSerializer.ReadInt32("port");
practiceName = aSerializer.ReadAnsiString("practiceName");
}
}
public override void WriteComplex(RemObjects.SDK.Serializer aSerializer) {
if (aSerializer.RecordStrictOrder) {
aSerializer.WriteAnsiString("host", host);
aSerializer.WriteInt32("port", port);
aSerializer.WriteAnsiString("practiceName", practiceName);
}
else {
aSerializer.WriteAnsiString("host", host);
aSerializer.WriteInt32("port", port);
aSerializer.WriteAnsiString("practiceName", practiceName);
}
}
}
[RemObjects.SDK.Activator()]
[System.Reflection.ObfuscationAttribute(Exclude=true, ApplyToMembers=false)]
public class Host_Activator : RemObjects.SDK.TypeActivator {
public Host_Activator() :
base() {
}
public override object CreateInstance() {
return new Host();
}
}
[RemObjects.SDK.Remotable(ActivatorClass=typeof(Server_Activator))]
[System.Reflection.ObfuscationAttribute(Exclude=true)]
public partial class Server : RemObjects.SDK.Types.ComplexType {
private string @__HostGUID;
private string @__InternalIP;
private string @__ExternalIP;
private int @__Port;
[RemObjects.SDK.StreamAs(RemObjects.SDK.StreamingFormat.AnsiString)]
public virtual string HostGUID {
get {
return @__HostGUID;
}
set {
@__HostGUID = value;
this.TriggerPropertyChanged("HostGUID");
}
}
[RemObjects.SDK.StreamAs(RemObjects.SDK.StreamingFormat.AnsiString)]
public virtual string InternalIP {
get {
return @__InternalIP;
}
set {
@__InternalIP = value;
this.TriggerPropertyChanged("InternalIP");
}
}
[RemObjects.SDK.StreamAs(RemObjects.SDK.StreamingFormat.AnsiString)]
public virtual string ExternalIP {
get {
return @__ExternalIP;
}
set {
@__ExternalIP = value;
this.TriggerPropertyChanged("ExternalIP");
}
}
public virtual int Port {
get {
return @__Port;
}
set {
@__Port = value;
this.TriggerPropertyChanged("Port");
}
}
public override void ReadComplex(RemObjects.SDK.Serializer aSerializer) {
if (aSerializer.RecordStrictOrder) {
HostGUID = aSerializer.ReadAnsiString("HostGUID");
InternalIP = aSerializer.ReadAnsiString("InternalIP");
ExternalIP = aSerializer.ReadAnsiString("ExternalIP");
Port = aSerializer.ReadInt32("Port");
}
else {
ExternalIP = aSerializer.ReadAnsiString("ExternalIP");
HostGUID = aSerializer.ReadAnsiString("HostGUID");
InternalIP = aSerializer.ReadAnsiString("InternalIP");
Port = aSerializer.ReadInt32("Port");
}
}
public override void WriteComplex(RemObjects.SDK.Serializer aSerializer) {
if (aSerializer.RecordStrictOrder) {
aSerializer.WriteAnsiString("HostGUID", HostGUID);
aSerializer.WriteAnsiString("InternalIP", InternalIP);
aSerializer.WriteAnsiString("ExternalIP", ExternalIP);
aSerializer.WriteInt32("Port", Port);
}
else {
aSerializer.WriteAnsiString("ExternalIP", ExternalIP);
aSerializer.WriteAnsiString("HostGUID", HostGUID);
aSerializer.WriteAnsiString("InternalIP", InternalIP);
aSerializer.WriteInt32("Port", Port);
}
}
}
[RemObjects.SDK.Activator()]
[System.Reflection.ObfuscationAttribute(Exclude=true, ApplyToMembers=false)]
public class Server_Activator : RemObjects.SDK.TypeActivator {
public Server_Activator() :
base() {
}
public override object CreateInstance() {
return new Server();
}
}
[RemObjects.SDK.Remotable(ActivatorClass=typeof(Client_Activator))]
[System.Reflection.ObfuscationAttribute(Exclude=true)]
public partial class Client : RemObjects.SDK.Types.ComplexType {
private string @__systemApiKey;
private Host @__host;
[RemObjects.SDK.StreamAs(RemObjects.SDK.StreamingFormat.AnsiString)]
public virtual string systemApiKey {
get {
return @__systemApiKey;
}
set {
@__systemApiKey = value;
this.TriggerPropertyChanged("systemApiKey");
}
}
public virtual Host host {
get {
return @__host;
}
set {
@__host = value;
this.TriggerPropertyChanged("host");
}
}
public override void ReadComplex(RemObjects.SDK.Serializer aSerializer) {
if (aSerializer.RecordStrictOrder) {
systemApiKey = aSerializer.ReadAnsiString("systemApiKey");
host = ((Host)(aSerializer.Read("host", typeof(Host), RemObjects.SDK.StreamingFormat.Default)));
}
else {
host = ((Host)(aSerializer.Read("host", typeof(Host), RemObjects.SDK.StreamingFormat.Default)));
systemApiKey = aSerializer.ReadAnsiString("systemApiKey");
}
}
public override void WriteComplex(RemObjects.SDK.Serializer aSerializer) {
if (aSerializer.RecordStrictOrder) {
aSerializer.WriteAnsiString("systemApiKey", systemApiKey);
aSerializer.Write("host", host, typeof(Host), RemObjects.SDK.StreamingFormat.Default);
}
else {
aSerializer.Write("host", host, typeof(Host), RemObjects.SDK.StreamingFormat.Default);
aSerializer.WriteAnsiString("systemApiKey", systemApiKey);
}
}
}
[RemObjects.SDK.Activator()]
[System.Reflection.ObfuscationAttribute(Exclude=true, ApplyToMembers=false)]
public class Client_Activator : RemObjects.SDK.TypeActivator {
public Client_Activator() :
base() {
}
public override object CreateInstance() {
return new Client();
}
}
public interface IRegistration : RemObjects.SDK.IROService {
Host GetApiHostMobile(string SystemApiKey);
Host GetApiHostWifi(string SystemApiKey);
Client[] GetClients(bool @internal);
Host GetRegistrationServer(string SystemApiKey);
bool RegisterNewServerPractice(string PracticeName, Server server, string serverType, out string UserApiKey, out string UserApiPin);
string RegisterNewClient(string UserApiKey, string UserApiPin);
void ServerHasBeenUpdated(string HostGUID, string Version);
string RetrieveNewClientPin(string UserApiKey);
bool UpdateServer(Server server);
bool UpdatePracticeName(string UserApiKey, string UserApiPin, string PracticeName);
bool UpdatePracticeName2(string systemApiKey, string PracticeName);
bool IsServerReachable(Server server);
bool IsClientReachable(string systemApiKey);
string RetrieveHostGUIDForServerFromInternet(Server server);
bool DoesServerHostGUIDExist(string HostGUID);
}
public partial class Registration_Proxy : RemObjects.SDK.Proxy, IRegistration {
public Registration_Proxy(RemObjects.SDK.IMessage aMessage, RemObjects.SDK.IClientChannel aClientChannel) :
base(aMessage, aClientChannel) {
}
public Registration_Proxy(RemObjects.SDK.IMessage aMessage, RemObjects.SDK.IClientChannel aClientChannel, string aOverrideInterfaceName) :
base(aMessage, aClientChannel, aOverrideInterfaceName) {
}
public Registration_Proxy(RemObjects.SDK.IRemoteService aRemoteService) :
base(aRemoteService) {
}
public Registration_Proxy(RemObjects.SDK.IRemoteService aRemoteService, string aOverrideInterfaceName) :
base(aRemoteService, aOverrideInterfaceName) {
}
public Registration_Proxy(System.Uri aUri) :
base(aUri) {
}
public Registration_Proxy(string aUrl) :
base(aUrl) {
}
protected override string @__GetInterfaceName() {
return "Registration";
}
public virtual Host GetApiHostMobile(string SystemApiKey) {
RemObjects.SDK.IMessage @__LocalMessage = this.@__GetMessage();
@__LocalMessage.InitializeRequestMessage(@__ClientChannel, "Registration", @__GetActiveInterfaceName(), "GetApiHostMobile");
@__LocalMessage.WriteAnsiString("SystemApiKey", SystemApiKey);
@__LocalMessage.FinalizeMessage();
@__ClientChannel.Dispatch(@__LocalMessage);
Host Host = ((Host)(@__LocalMessage.Read("Host", typeof(Host), RemObjects.SDK.StreamingFormat.Default)));
@__LocalMessage.Clear();
return Host;
}
public virtual Host GetApiHostWifi(string SystemApiKey) {
RemObjects.SDK.IMessage @__LocalMessage = this.@__GetMessage();
@__LocalMessage.InitializeRequestMessage(@__ClientChannel, "Registration", @__GetActiveInterfaceName(), "GetApiHostWifi");
@__LocalMessage.WriteAnsiString("SystemApiKey", SystemApiKey);
@__LocalMessage.FinalizeMessage();
@__ClientChannel.Dispatch(@__LocalMessage);
Host host = ((Host)(@__LocalMessage.Read("host", typeof(Host), RemObjects.SDK.StreamingFormat.Default)));
@__LocalMessage.Clear();
return host;
}
public virtual Client[] GetClients(bool @internal) {
RemObjects.SDK.IMessage @__LocalMessage = this.@__GetMessage();
@__LocalMessage.InitializeRequestMessage(@__ClientChannel, "Registration", @__GetActiveInterfaceName(), "GetClients");
@__LocalMessage.WriteBoolean("internal", @internal);
@__LocalMessage.FinalizeMessage();
@__ClientChannel.Dispatch(@__LocalMessage);
Client[] Result = ((Client[])(@__LocalMessage.Read("Result", typeof(Client[]), RemObjects.SDK.StreamingFormat.Default)));
@__LocalMessage.Clear();
return Result;
}
public virtual Host GetRegistrationServer(string SystemApiKey) {
RemObjects.SDK.IMessage @__LocalMessage = this.@__GetMessage();
@__LocalMessage.InitializeRequestMessage(@__ClientChannel, "Registration", @__GetActiveInterfaceName(), "GetRegistrationServer");
@__LocalMessage.WriteAnsiString("SystemApiKey", SystemApiKey);
@__LocalMessage.FinalizeMessage();
@__ClientChannel.Dispatch(@__LocalMessage);
Host Host = ((Host)(@__LocalMessage.Read("Host", typeof(Host), RemObjects.SDK.StreamingFormat.Default)));
@__LocalMessage.Clear();
return Host;
}
public virtual bool RegisterNewServerPractice(string PracticeName, Server server, string serverType, out string UserApiKey, out string UserApiPin) {
RemObjects.SDK.IMessage @__LocalMessage = this.@__GetMessage();
@__LocalMessage.InitializeRequestMessage(@__ClientChannel, "Registration", @__GetActiveInterfaceName(), "RegisterNewServerPractice");
@__LocalMessage.WriteAnsiString("PracticeName", PracticeName);
@__LocalMessage.Write("server", server, typeof(Server), RemObjects.SDK.StreamingFormat.Default);
@__LocalMessage.WriteAnsiString("serverType", serverType);
@__LocalMessage.FinalizeMessage();
@__ClientChannel.Dispatch(@__LocalMessage);
bool Result = @__LocalMessage.ReadBoolean("Result");
UserApiKey = @__LocalMessage.ReadAnsiString("UserApiKey");
UserApiPin = @__LocalMessage.ReadAnsiString("UserApiPin");
@__LocalMessage.Clear();
return Result;
}
public virtual string RegisterNewClient(string UserApiKey, string UserApiPin) {
RemObjects.SDK.IMessage @__LocalMessage = this.@__GetMessage();
@__LocalMessage.InitializeRequestMessage(@__ClientChannel, "Registration", @__GetActiveInterfaceName(), "RegisterNewClient");
@__LocalMessage.WriteAnsiString("UserApiKey", UserApiKey);
@__LocalMessage.WriteAnsiString("UserApiPin", UserApiPin);
@__LocalMessage.FinalizeMessage();
@__ClientChannel.Dispatch(@__LocalMessage);
string SystemApiKey = @__LocalMessage.ReadAnsiString("SystemApiKey");
@__LocalMessage.Clear();
return SystemApiKey;
}
public virtual void ServerHasBeenUpdated(string HostGUID, string Version) {
RemObjects.SDK.IMessage @__LocalMessage = this.@__GetMessage();
@__LocalMessage.InitializeRequestMessage(@__ClientChannel, "Registration", @__GetActiveInterfaceName(), "ServerHasBeenUpdated");
@__LocalMessage.WriteAnsiString("HostGUID", HostGUID);
@__LocalMessage.WriteAnsiString("Version", Version);
@__LocalMessage.FinalizeMessage();
@__ClientChannel.Dispatch(@__LocalMessage);
@__LocalMessage.Clear();
}
public virtual string RetrieveNewClientPin(string UserApiKey) {
RemObjects.SDK.IMessage @__LocalMessage = this.@__GetMessage();
@__LocalMessage.InitializeRequestMessage(@__ClientChannel, "Registration", @__GetActiveInterfaceName(), "RetrieveNewClientPin");
@__LocalMessage.WriteAnsiString("UserApiKey", UserApiKey);
@__LocalMessage.FinalizeMessage();
@__ClientChannel.Dispatch(@__LocalMessage);
string pin = @__LocalMessage.ReadAnsiString("pin");
@__LocalMessage.Clear();
return pin;
}
public virtual bool UpdateServer(Server server) {
RemObjects.SDK.IMessage @__LocalMessage = this.@__GetMessage();
@__LocalMessage.InitializeRequestMessage(@__ClientChannel, "Registration", @__GetActiveInterfaceName(), "UpdateServer");
@__LocalMessage.Write("server", server, typeof(Server), RemObjects.SDK.StreamingFormat.Default);
@__LocalMessage.FinalizeMessage();
@__ClientChannel.Dispatch(@__LocalMessage);
bool Result = @__LocalMessage.ReadBoolean("Result");
@__LocalMessage.Clear();
return Result;
}
public virtual bool UpdatePracticeName(string UserApiKey, string UserApiPin, string PracticeName) {
RemObjects.SDK.IMessage @__LocalMessage = this.@__GetMessage();
@__LocalMessage.InitializeRequestMessage(@__ClientChannel, "Registration", @__GetActiveInterfaceName(), "UpdatePracticeName");
@__LocalMessage.WriteAnsiString("UserApiKey", UserApiKey);
@__LocalMessage.WriteAnsiString("UserApiPin", UserApiPin);
@__LocalMessage.WriteAnsiString("PracticeName", PracticeName);
@__LocalMessage.FinalizeMessage();
@__ClientChannel.Dispatch(@__LocalMessage);
bool Result = @__LocalMessage.ReadBoolean("Result");
@__LocalMessage.Clear();
return Result;
}
public virtual bool UpdatePracticeName2(string systemApiKey, string PracticeName) {
RemObjects.SDK.IMessage @__LocalMessage = this.@__GetMessage();
@__LocalMessage.InitializeRequestMessage(@__ClientChannel, "Registration", @__GetActiveInterfaceName(), "UpdatePracticeName2");
@__LocalMessage.WriteAnsiString("systemApiKey", systemApiKey);
@__LocalMessage.WriteAnsiString("PracticeName", PracticeName);
@__LocalMessage.FinalizeMessage();
@__ClientChannel.Dispatch(@__LocalMessage);
bool Result = @__LocalMessage.ReadBoolean("Result");
@__LocalMessage.Clear();
return Result;
}
public virtual bool IsServerReachable(Server server) {
RemObjects.SDK.IMessage @__LocalMessage = this.@__GetMessage();
@__LocalMessage.InitializeRequestMessage(@__ClientChannel, "Registration", @__GetActiveInterfaceName(), "IsServerReachable");
@__LocalMessage.Write("server", server, typeof(Server), RemObjects.SDK.StreamingFormat.Default);
@__LocalMessage.FinalizeMessage();
@__ClientChannel.Dispatch(@__LocalMessage);
bool Result = @__LocalMessage.ReadBoolean("Result");
@__LocalMessage.Clear();
return Result;
}
public virtual bool IsClientReachable(string systemApiKey) {
RemObjects.SDK.IMessage @__LocalMessage = this.@__GetMessage();
@__LocalMessage.InitializeRequestMessage(@__ClientChannel, "Registration", @__GetActiveInterfaceName(), "IsClientReachable");
@__LocalMessage.WriteAnsiString("systemApiKey", systemApiKey);
@__LocalMessage.FinalizeMessage();
@__ClientChannel.Dispatch(@__LocalMessage);
bool Result = @__LocalMessage.ReadBoolean("Result");
@__LocalMessage.Clear();
return Result;
}
public virtual string RetrieveHostGUIDForServerFromInternet(Server server) {
RemObjects.SDK.IMessage @__LocalMessage = this.@__GetMessage();
@__LocalMessage.InitializeRequestMessage(@__ClientChannel, "Registration", @__GetActiveInterfaceName(), "RetrieveHostGUIDForServerFromInternet");
@__LocalMessage.Write("server", server, typeof(Server), RemObjects.SDK.StreamingFormat.Default);
@__LocalMessage.FinalizeMessage();
@__ClientChannel.Dispatch(@__LocalMessage);
string HostGUID = @__LocalMessage.ReadAnsiString("HostGUID");
@__LocalMessage.Clear();
return HostGUID;
}
public virtual bool DoesServerHostGUIDExist(string HostGUID) {
RemObjects.SDK.IMessage @__LocalMessage = this.@__GetMessage();
@__LocalMessage.InitializeRequestMessage(@__ClientChannel, "Registration", @__GetActiveInterfaceName(), "DoesServerHostGUIDExist");
@__LocalMessage.WriteAnsiString("HostGUID", HostGUID);
@__LocalMessage.FinalizeMessage();
@__ClientChannel.Dispatch(@__LocalMessage);
bool Result = @__LocalMessage.ReadBoolean("Result");
@__LocalMessage.Clear();
return Result;
}
}
public class CoRegistration {
public static IRegistration Create(RemObjects.SDK.IMessage aMessage, RemObjects.SDK.IClientChannel aClientChannel) {
return new Registration_Proxy(aMessage, aClientChannel);
}
public static IRegistration Create(RemObjects.SDK.IRemoteService aRemoteService) {
return new Registration_Proxy(aRemoteService);
}
public static IRegistration Create(System.Uri aUri) {
return new Registration_Proxy(aUri);
}
public static IRegistration Create(string aUrl) {
return new Registration_Proxy(aUrl);
}
}
public interface IRegistration_Async : RemObjects.SDK.IROService_Async {
System.IAsyncResult BeginGetApiHostMobile(string SystemApiKey, System.AsyncCallback @__Callback, object @__UserData);
Host EndGetApiHostMobile(System.IAsyncResult @__AsyncResult);
System.IAsyncResult BeginGetApiHostWifi(string SystemApiKey, System.AsyncCallback @__Callback, object @__UserData);
Host EndGetApiHostWifi(System.IAsyncResult @__AsyncResult);
System.IAsyncResult BeginGetClients(bool @internal, System.AsyncCallback @__Callback, object @__UserData);
Client[] EndGetClients(System.IAsyncResult @__AsyncResult);
System.IAsyncResult BeginGetRegistrationServer(string SystemApiKey, System.AsyncCallback @__Callback, object @__UserData);
Host EndGetRegistrationServer(System.IAsyncResult @__AsyncResult);
System.IAsyncResult BeginRegisterNewServerPractice(string PracticeName, Server server, string serverType, System.AsyncCallback @__Callback, object @__UserData);
bool EndRegisterNewServerPractice(System.IAsyncResult @__AsyncResult, out string UserApiKey, out string UserApiPin);
System.IAsyncResult BeginRegisterNewClient(string UserApiKey, string UserApiPin, System.AsyncCallback @__Callback, object @__UserData);
string EndRegisterNewClient(System.IAsyncResult @__AsyncResult);
System.IAsyncResult BeginServerHasBeenUpdated(string HostGUID, string Version, System.AsyncCallback @__Callback, object @__UserData);
void EndServerHasBeenUpdated(System.IAsyncResult @__AsyncResult);
System.IAsyncResult BeginRetrieveNewClientPin(string UserApiKey, System.AsyncCallback @__Callback, object @__UserData);
string EndRetrieveNewClientPin(System.IAsyncResult @__AsyncResult);
System.IAsyncResult BeginUpdateServer(Server server, System.AsyncCallback @__Callback, object @__UserData);
bool EndUpdateServer(System.IAsyncResult @__AsyncResult);
System.IAsyncResult BeginUpdatePracticeName(string UserApiKey, string UserApiPin, string PracticeName, System.AsyncCallback @__Callback, object @__UserData);
bool EndUpdatePracticeName(System.IAsyncResult @__AsyncResult);
System.IAsyncResult BeginUpdatePracticeName2(string systemApiKey, string PracticeName, System.AsyncCallback @__Callback, object @__UserData);
bool EndUpdatePracticeName2(System.IAsyncResult @__AsyncResult);
System.IAsyncResult BeginIsServerReachable(Server server, System.AsyncCallback @__Callback, object @__UserData);
bool EndIsServerReachable(System.IAsyncResult @__AsyncResult);
System.IAsyncResult BeginIsClientReachable(string systemApiKey, System.AsyncCallback @__Callback, object @__UserData);
bool EndIsClientReachable(System.IAsyncResult @__AsyncResult);
System.IAsyncResult BeginRetrieveHostGUIDForServerFromInternet(Server server, System.AsyncCallback @__Callback, object @__UserData);
string EndRetrieveHostGUIDForServerFromInternet(System.IAsyncResult @__AsyncResult);
System.IAsyncResult BeginDoesServerHostGUIDExist(string HostGUID, System.AsyncCallback @__Callback, object @__UserData);
bool EndDoesServerHostGUIDExist(System.IAsyncResult @__AsyncResult);
}
public partial class Registration_AsyncProxy : RemObjects.SDK.AsyncProxy, IRegistration_Async {
public Registration_AsyncProxy(RemObjects.SDK.IMessage aMessage, RemObjects.SDK.IClientChannel aClientChannel) :
base(aMessage, aClientChannel) {
}
public Registration_AsyncProxy(RemObjects.SDK.IMessage aMessage, RemObjects.SDK.IClientChannel aClientChannel, string aOverrideInterfaceName) :
base(aMessage, aClientChannel, aOverrideInterfaceName) {
}
public Registration_AsyncProxy(RemObjects.SDK.IRemoteService aRemoteService) :
base(aRemoteService) {
}
public Registration_AsyncProxy(RemObjects.SDK.IRemoteService aRemoteService, string aOverrideInterfaceName) :
base(aRemoteService, aOverrideInterfaceName) {
}
public Registration_AsyncProxy(System.Uri aUri) :
base(aUri) {
}
public Registration_AsyncProxy(string aUrl) :
base(aUrl) {
}
protected override string @__GetInterfaceName() {
return "Registration";
}
public virtual System.IAsyncResult BeginGetApiHostMobile(string SystemApiKey, System.AsyncCallback @__Callback, object @__UserData) {
RemObjects.SDK.IMessage @__LocalMessage = this.@__GetMessage();
@__LocalMessage.InitializeRequestMessage(@__ClientChannel, "Registration", @__GetActiveInterfaceName(), "GetApiHostMobile");
@__LocalMessage.WriteAnsiString("SystemApiKey", SystemApiKey);
@__LocalMessage.FinalizeMessage();
return @__ClientChannel.AsyncDispatch(@__LocalMessage, @__Callback, @__UserData);
}
public virtual Host EndGetApiHostMobile(System.IAsyncResult @__AsyncResult) {
RemObjects.SDK.IMessage @__LocalMessage = ((RemObjects.SDK.IClientAsyncResult)(@__AsyncResult)).Message;
Host Host = ((Host)(@__LocalMessage.Read("Host", typeof(Host), RemObjects.SDK.StreamingFormat.Default)));
@__LocalMessage.Clear();
return Host;
}
public virtual System.IAsyncResult BeginGetApiHostWifi(string SystemApiKey, System.AsyncCallback @__Callback, object @__UserData) {
RemObjects.SDK.IMessage @__LocalMessage = this.@__GetMessage();
@__LocalMessage.InitializeRequestMessage(@__ClientChannel, "Registration", @__GetActiveInterfaceName(), "GetApiHostWifi");
@__LocalMessage.WriteAnsiString("SystemApiKey", SystemApiKey);
@__LocalMessage.FinalizeMessage();
return @__ClientChannel.AsyncDispatch(@__LocalMessage, @__Callback, @__UserData);
}
public virtual Host EndGetApiHostWifi(System.IAsyncResult @__AsyncResult) {
RemObjects.SDK.IMessage @__LocalMessage = ((RemObjects.SDK.IClientAsyncResult)(@__AsyncResult)).Message;
Host host = ((Host)(@__LocalMessage.Read("host", typeof(Host), RemObjects.SDK.StreamingFormat.Default)));
@__LocalMessage.Clear();
return host;
}
public virtual System.IAsyncResult BeginGetClients(bool @internal, System.AsyncCallback @__Callback, object @__UserData) {
RemObjects.SDK.IMessage @__LocalMessage = this.@__GetMessage();
@__LocalMessage.InitializeRequestMessage(@__ClientChannel, "Registration", @__GetActiveInterfaceName(), "GetClients");
@__LocalMessage.WriteBoolean("internal", @internal);
@__LocalMessage.FinalizeMessage();
return @__ClientChannel.AsyncDispatch(@__LocalMessage, @__Callback, @__UserData);
}
public virtual Client[] EndGetClients(System.IAsyncResult @__AsyncResult) {
RemObjects.SDK.IMessage @__LocalMessage = ((RemObjects.SDK.IClientAsyncResult)(@__AsyncResult)).Message;
Client[] Result = ((Client[])(@__LocalMessage.Read("Result", typeof(Client[]), RemObjects.SDK.StreamingFormat.Default)));
@__LocalMessage.Clear();
return Result;
}
public virtual System.IAsyncResult BeginGetRegistrationServer(string SystemApiKey, System.AsyncCallback @__Callback, object @__UserData) {
RemObjects.SDK.IMessage @__LocalMessage = this.@__GetMessage();
@__LocalMessage.InitializeRequestMessage(@__ClientChannel, "Registration", @__GetActiveInterfaceName(), "GetRegistrationServer");
@__LocalMessage.WriteAnsiString("SystemApiKey", SystemApiKey);
@__LocalMessage.FinalizeMessage();
return @__ClientChannel.AsyncDispatch(@__LocalMessage, @__Callback, @__UserData);
}
public virtual Host EndGetRegistrationServer(System.IAsyncResult @__AsyncResult) {
RemObjects.SDK.IMessage @__LocalMessage = ((RemObjects.SDK.IClientAsyncResult)(@__AsyncResult)).Message;
Host Host = ((Host)(@__LocalMessage.Read("Host", typeof(Host), RemObjects.SDK.StreamingFormat.Default)));
@__LocalMessage.Clear();
return Host;
}
public virtual System.IAsyncResult BeginRegisterNewServerPractice(string PracticeName, Server server, string serverType, System.AsyncCallback @__Callback, object @__UserData) {
RemObjects.SDK.IMessage @__LocalMessage = this.@__GetMessage();
@__LocalMessage.InitializeRequestMessage(@__ClientChannel, "Registration", @__GetActiveInterfaceName(), "RegisterNewServerPractice");
@__LocalMessage.WriteAnsiString("PracticeName", PracticeName);
@__LocalMessage.Write("server", server, typeof(Server), RemObjects.SDK.StreamingFormat.Default);
@__LocalMessage.WriteAnsiString("serverType", serverType);
@__LocalMessage.FinalizeMessage();
return @__ClientChannel.AsyncDispatch(@__LocalMessage, @__Callback, @__UserData);
}
public virtual bool EndRegisterNewServerPractice(System.IAsyncResult @__AsyncResult, out string UserApiKey, out string UserApiPin) {
RemObjects.SDK.IMessage @__LocalMessage = ((RemObjects.SDK.IClientAsyncResult)(@__AsyncResult)).Message;
bool Result = @__LocalMessage.ReadBoolean("Result");
UserApiKey = @__LocalMessage.ReadAnsiString("UserApiKey");
UserApiPin = @__LocalMessage.ReadAnsiString("UserApiPin");
@__LocalMessage.Clear();
return Result;
}
public virtual System.IAsyncResult BeginRegisterNewClient(string UserApiKey, string UserApiPin, System.AsyncCallback @__Callback, object @__UserData) {
RemObjects.SDK.IMessage @__LocalMessage = this.@__GetMessage();
@__LocalMessage.InitializeRequestMessage(@__ClientChannel, "Registration", @__GetActiveInterfaceName(), "RegisterNewClient");
@__LocalMessage.WriteAnsiString("UserApiKey", UserApiKey);
@__LocalMessage.WriteAnsiString("UserApiPin", UserApiPin);
@__LocalMessage.FinalizeMessage();
return @__ClientChannel.AsyncDispatch(@__LocalMessage, @__Callback, @__UserData);
}
public virtual string EndRegisterNewClient(System.IAsyncResult @__AsyncResult) {
RemObjects.SDK.IMessage @__LocalMessage = ((RemObjects.SDK.IClientAsyncResult)(@__AsyncResult)).Message;
string SystemApiKey = @__LocalMessage.ReadAnsiString("SystemApiKey");
@__LocalMessage.Clear();
return SystemApiKey;
}
public virtual System.IAsyncResult BeginServerHasBeenUpdated(string HostGUID, string Version, System.AsyncCallback @__Callback, object @__UserData) {
RemObjects.SDK.IMessage @__LocalMessage = this.@__GetMessage();
@__LocalMessage.InitializeRequestMessage(@__ClientChannel, "Registration", @__GetActiveInterfaceName(), "ServerHasBeenUpdated");
@__LocalMessage.WriteAnsiString("HostGUID", HostGUID);
@__LocalMessage.WriteAnsiString("Version", Version);
@__LocalMessage.FinalizeMessage();
return @__ClientChannel.AsyncDispatch(@__LocalMessage, @__Callback, @__UserData);
}
public virtual void EndServerHasBeenUpdated(System.IAsyncResult @__AsyncResult) {
RemObjects.SDK.IMessage @__LocalMessage = ((RemObjects.SDK.IClientAsyncResult)(@__AsyncResult)).Message;
@__LocalMessage.Clear();
}
public virtual System.IAsyncResult BeginRetrieveNewClientPin(string UserApiKey, System.AsyncCallback @__Callback, object @__UserData) {
RemObjects.SDK.IMessage @__LocalMessage = this.@__GetMessage();
@__LocalMessage.InitializeRequestMessage(@__ClientChannel, "Registration", @__GetActiveInterfaceName(), "RetrieveNewClientPin");
@__LocalMessage.WriteAnsiString("UserApiKey", UserApiKey);
@__LocalMessage.FinalizeMessage();
return @__ClientChannel.AsyncDispatch(@__LocalMessage, @__Callback, @__UserData);
}
public virtual string EndRetrieveNewClientPin(System.IAsyncResult @__AsyncResult) {
RemObjects.SDK.IMessage @__LocalMessage = ((RemObjects.SDK.IClientAsyncResult)(@__AsyncResult)).Message;
string pin = @__LocalMessage.ReadAnsiString("pin");
@__LocalMessage.Clear();
return pin;
}
public virtual System.IAsyncResult BeginUpdateServer(Server server, System.AsyncCallback @__Callback, object @__UserData) {
RemObjects.SDK.IMessage @__LocalMessage = this.@__GetMessage();
@__LocalMessage.InitializeRequestMessage(@__ClientChannel, "Registration", @__GetActiveInterfaceName(), "UpdateServer");
@__LocalMessage.Write("server", server, typeof(Server), RemObjects.SDK.StreamingFormat.Default);
@__LocalMessage.FinalizeMessage();
return @__ClientChannel.AsyncDispatch(@__LocalMessage, @__Callback, @__UserData);
}
public virtual bool EndUpdateServer(System.IAsyncResult @__AsyncResult) {
RemObjects.SDK.IMessage @__LocalMessage = ((RemObjects.SDK.IClientAsyncResult)(@__AsyncResult)).Message;
bool Result = @__LocalMessage.ReadBoolean("Result");
@__LocalMessage.Clear();
return Result;
}
public virtual System.IAsyncResult BeginUpdatePracticeName(string UserApiKey, string UserApiPin, string PracticeName, System.AsyncCallback @__Callback, object @__UserData) {
RemObjects.SDK.IMessage @__LocalMessage = this.@__GetMessage();
@__LocalMessage.InitializeRequestMessage(@__ClientChannel, "Registration", @__GetActiveInterfaceName(), "UpdatePracticeName");
@__LocalMessage.WriteAnsiString("UserApiKey", UserApiKey);
@__LocalMessage.WriteAnsiString("UserApiPin", UserApiPin);
@__LocalMessage.WriteAnsiString("PracticeName", PracticeName);
@__LocalMessage.FinalizeMessage();
return @__ClientChannel.AsyncDispatch(@__LocalMessage, @__Callback, @__UserData);
}
public virtual bool EndUpdatePracticeName(System.IAsyncResult @__AsyncResult) {
RemObjects.SDK.IMessage @__LocalMessage = ((RemObjects.SDK.IClientAsyncResult)(@__AsyncResult)).Message;
bool Result = @__LocalMessage.ReadBoolean("Result");
@__LocalMessage.Clear();
return Result;
}
public virtual System.IAsyncResult BeginUpdatePracticeName2(string systemApiKey, string PracticeName, System.AsyncCallback @__Callback, object @__UserData) {
RemObjects.SDK.IMessage @__LocalMessage = this.@__GetMessage();
@__LocalMessage.InitializeRequestMessage(@__ClientChannel, "Registration", @__GetActiveInterfaceName(), "UpdatePracticeName2");
@__LocalMessage.WriteAnsiString("systemApiKey", systemApiKey);
@__LocalMessage.WriteAnsiString("PracticeName", PracticeName);
@__LocalMessage.FinalizeMessage();
return @__ClientChannel.AsyncDispatch(@__LocalMessage, @__Callback, @__UserData);
}
public virtual bool EndUpdatePracticeName2(System.IAsyncResult @__AsyncResult) {
RemObjects.SDK.IMessage @__LocalMessage = ((RemObjects.SDK.IClientAsyncResult)(@__AsyncResult)).Message;
bool Result = @__LocalMessage.ReadBoolean("Result");
@__LocalMessage.Clear();
return Result;
}
public virtual System.IAsyncResult BeginIsServerReachable(Server server, System.AsyncCallback @__Callback, object @__UserData) {
RemObjects.SDK.IMessage @__LocalMessage = this.@__GetMessage();
@__LocalMessage.InitializeRequestMessage(@__ClientChannel, "Registration", @__GetActiveInterfaceName(), "IsServerReachable");
@__LocalMessage.Write("server", server, typeof(Server), RemObjects.SDK.StreamingFormat.Default);
@__LocalMessage.FinalizeMessage();
return @__ClientChannel.AsyncDispatch(@__LocalMessage, @__Callback, @__UserData);
}
public virtual bool EndIsServerReachable(System.IAsyncResult @__AsyncResult) {
RemObjects.SDK.IMessage @__LocalMessage = ((RemObjects.SDK.IClientAsyncResult)(@__AsyncResult)).Message;
bool Result = @__LocalMessage.ReadBoolean("Result");
@__LocalMessage.Clear();
return Result;
}
public virtual System.IAsyncResult BeginIsClientReachable(string systemApiKey, System.AsyncCallback @__Callback, object @__UserData) {
RemObjects.SDK.IMessage @__LocalMessage = this.@__GetMessage();
@__LocalMessage.InitializeRequestMessage(@__ClientChannel, "Registration", @__GetActiveInterfaceName(), "IsClientReachable");
@__LocalMessage.WriteAnsiString("systemApiKey", systemApiKey);
@__LocalMessage.FinalizeMessage();
return @__ClientChannel.AsyncDispatch(@__LocalMessage, @__Callback, @__UserData);
}
public virtual bool EndIsClientReachable(System.IAsyncResult @__AsyncResult) {
RemObjects.SDK.IMessage @__LocalMessage = ((RemObjects.SDK.IClientAsyncResult)(@__AsyncResult)).Message;
bool Result = @__LocalMessage.ReadBoolean("Result");
@__LocalMessage.Clear();
return Result;
}
public virtual System.IAsyncResult BeginRetrieveHostGUIDForServerFromInternet(Server server, System.AsyncCallback @__Callback, object @__UserData) {
RemObjects.SDK.IMessage @__LocalMessage = this.@__GetMessage();
@__LocalMessage.InitializeRequestMessage(@__ClientChannel, "Registration", @__GetActiveInterfaceName(), "RetrieveHostGUIDForServerFromInternet");
@__LocalMessage.Write("server", server, typeof(Server), RemObjects.SDK.StreamingFormat.Default);
@__LocalMessage.FinalizeMessage();
return @__ClientChannel.AsyncDispatch(@__LocalMessage, @__Callback, @__UserData);
}
public virtual string EndRetrieveHostGUIDForServerFromInternet(System.IAsyncResult @__AsyncResult) {
RemObjects.SDK.IMessage @__LocalMessage = ((RemObjects.SDK.IClientAsyncResult)(@__AsyncResult)).Message;
string HostGUID = @__LocalMessage.ReadAnsiString("HostGUID");
@__LocalMessage.Clear();
return HostGUID;
}
public virtual System.IAsyncResult BeginDoesServerHostGUIDExist(string HostGUID, System.AsyncCallback @__Callback, object @__UserData) {
RemObjects.SDK.IMessage @__LocalMessage = this.@__GetMessage();
@__LocalMessage.InitializeRequestMessage(@__ClientChannel, "Registration", @__GetActiveInterfaceName(), "DoesServerHostGUIDExist");
@__LocalMessage.WriteAnsiString("HostGUID", HostGUID);
@__LocalMessage.FinalizeMessage();
return @__ClientChannel.AsyncDispatch(@__LocalMessage, @__Callback, @__UserData);
}
public virtual bool EndDoesServerHostGUIDExist(System.IAsyncResult @__AsyncResult) {
RemObjects.SDK.IMessage @__LocalMessage = ((RemObjects.SDK.IClientAsyncResult)(@__AsyncResult)).Message;
bool Result = @__LocalMessage.ReadBoolean("Result");
@__LocalMessage.Clear();
return Result;
}
}
}

View File

@@ -0,0 +1,234 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.296
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace Pluto.Registration {
using System;
using RemObjects.SDK;
using RemObjects.SDK.Types;
using RemObjects.SDK.Server;
[RemObjects.SDK.Server.Invoker()]
[System.Reflection.ObfuscationAttribute(Exclude=true)]
public class Registration_Invoker : RemObjects.SDK.Server.Invoker {
public Registration_Invoker() :
base() {
}
public static void Invoke_GetApiHostMobile(RemObjects.SDK.IROService @__Instance, RemObjects.SDK.IMessage @__Message, RemObjects.SDK.Server.IServerChannelInfo @__ServerChannelInfo, out RemObjects.SDK.Server.ResponseOptions @__oResponseOptions) {
RemObjects.SDK.ObjectDisposer @__ObjectDisposer = new RemObjects.SDK.ObjectDisposer(1);
try {
string SystemApiKey = @__Message.ReadAnsiString("SystemApiKey");
Host Host;
Host = ((IRegistration)(@__Instance)).GetApiHostMobile(SystemApiKey);
@__ObjectDisposer.Add(Host);
@__Message.InitializeResponseMessage(@__ServerChannelInfo, "Registration", "Registration", "GetApiHostMobileResponse");
@__Message.Write("Host", Host, typeof(Host), RemObjects.SDK.StreamingFormat.Default);
@__Message.FinalizeMessage();
@__oResponseOptions = RemObjects.SDK.Server.ResponseOptions.roDefault;
}
finally {
@__ObjectDisposer.Dispose();
}
}
public static void Invoke_GetApiHostWifi(RemObjects.SDK.IROService @__Instance, RemObjects.SDK.IMessage @__Message, RemObjects.SDK.Server.IServerChannelInfo @__ServerChannelInfo, out RemObjects.SDK.Server.ResponseOptions @__oResponseOptions) {
RemObjects.SDK.ObjectDisposer @__ObjectDisposer = new RemObjects.SDK.ObjectDisposer(1);
try {
string SystemApiKey = @__Message.ReadAnsiString("SystemApiKey");
Host host;
host = ((IRegistration)(@__Instance)).GetApiHostWifi(SystemApiKey);
@__ObjectDisposer.Add(host);
@__Message.InitializeResponseMessage(@__ServerChannelInfo, "Registration", "Registration", "GetApiHostWifiResponse");
@__Message.Write("host", host, typeof(Host), RemObjects.SDK.StreamingFormat.Default);
@__Message.FinalizeMessage();
@__oResponseOptions = RemObjects.SDK.Server.ResponseOptions.roDefault;
}
finally {
@__ObjectDisposer.Dispose();
}
}
public static void Invoke_GetClients(RemObjects.SDK.IROService @__Instance, RemObjects.SDK.IMessage @__Message, RemObjects.SDK.Server.IServerChannelInfo @__ServerChannelInfo, out RemObjects.SDK.Server.ResponseOptions @__oResponseOptions) {
RemObjects.SDK.ObjectDisposer @__ObjectDisposer = new RemObjects.SDK.ObjectDisposer(1);
try {
bool @internal = @__Message.ReadBoolean("internal");
Client[] Result;
Result = ((IRegistration)(@__Instance)).GetClients(@internal);
@__ObjectDisposer.Add(Result);
@__Message.InitializeResponseMessage(@__ServerChannelInfo, "Registration", "Registration", "GetClientsResponse");
@__Message.Write("Result", Result, typeof(Client[]), RemObjects.SDK.StreamingFormat.Default);
@__Message.FinalizeMessage();
@__oResponseOptions = RemObjects.SDK.Server.ResponseOptions.roDefault;
}
finally {
@__ObjectDisposer.Dispose();
}
}
public static void Invoke_GetRegistrationServer(RemObjects.SDK.IROService @__Instance, RemObjects.SDK.IMessage @__Message, RemObjects.SDK.Server.IServerChannelInfo @__ServerChannelInfo, out RemObjects.SDK.Server.ResponseOptions @__oResponseOptions) {
RemObjects.SDK.ObjectDisposer @__ObjectDisposer = new RemObjects.SDK.ObjectDisposer(1);
try {
string SystemApiKey = @__Message.ReadAnsiString("SystemApiKey");
Host Host;
Host = ((IRegistration)(@__Instance)).GetRegistrationServer(SystemApiKey);
@__ObjectDisposer.Add(Host);
@__Message.InitializeResponseMessage(@__ServerChannelInfo, "Registration", "Registration", "GetRegistrationServerResponse");
@__Message.Write("Host", Host, typeof(Host), RemObjects.SDK.StreamingFormat.Default);
@__Message.FinalizeMessage();
@__oResponseOptions = RemObjects.SDK.Server.ResponseOptions.roDefault;
}
finally {
@__ObjectDisposer.Dispose();
}
}
public static void Invoke_RegisterNewServerPractice(RemObjects.SDK.IROService @__Instance, RemObjects.SDK.IMessage @__Message, RemObjects.SDK.Server.IServerChannelInfo @__ServerChannelInfo, out RemObjects.SDK.Server.ResponseOptions @__oResponseOptions) {
RemObjects.SDK.ObjectDisposer @__ObjectDisposer = new RemObjects.SDK.ObjectDisposer(1);
try {
string PracticeName = @__Message.ReadAnsiString("PracticeName");
Server server = ((Server)(@__Message.Read("server", typeof(Server), RemObjects.SDK.StreamingFormat.Default)));
string serverType = @__Message.ReadAnsiString("serverType");
@__ObjectDisposer.Add(server);
bool Result;
string UserApiKey;
string UserApiPin;
Result = ((IRegistration)(@__Instance)).RegisterNewServerPractice(PracticeName, server, serverType, out UserApiKey, out UserApiPin);
@__Message.InitializeResponseMessage(@__ServerChannelInfo, "Registration", "Registration", "RegisterNewServerPracticeResponse");
@__Message.WriteBoolean("Result", Result);
@__Message.WriteAnsiString("UserApiKey", UserApiKey);
@__Message.WriteAnsiString("UserApiPin", UserApiPin);
@__Message.FinalizeMessage();
@__oResponseOptions = RemObjects.SDK.Server.ResponseOptions.roDefault;
}
finally {
@__ObjectDisposer.Dispose();
}
}
public static void Invoke_RegisterNewClient(RemObjects.SDK.IROService @__Instance, RemObjects.SDK.IMessage @__Message, RemObjects.SDK.Server.IServerChannelInfo @__ServerChannelInfo, out RemObjects.SDK.Server.ResponseOptions @__oResponseOptions) {
string UserApiKey = @__Message.ReadAnsiString("UserApiKey");
string UserApiPin = @__Message.ReadAnsiString("UserApiPin");
string SystemApiKey;
SystemApiKey = ((IRegistration)(@__Instance)).RegisterNewClient(UserApiKey, UserApiPin);
@__Message.InitializeResponseMessage(@__ServerChannelInfo, "Registration", "Registration", "RegisterNewClientResponse");
@__Message.WriteAnsiString("SystemApiKey", SystemApiKey);
@__Message.FinalizeMessage();
@__oResponseOptions = RemObjects.SDK.Server.ResponseOptions.roDefault;
}
public static void Invoke_ServerHasBeenUpdated(RemObjects.SDK.IROService @__Instance, RemObjects.SDK.IMessage @__Message, RemObjects.SDK.Server.IServerChannelInfo @__ServerChannelInfo, out RemObjects.SDK.Server.ResponseOptions @__oResponseOptions) {
string HostGUID = @__Message.ReadAnsiString("HostGUID");
string Version = @__Message.ReadAnsiString("Version");
((IRegistration)(@__Instance)).ServerHasBeenUpdated(HostGUID, Version);
@__Message.InitializeResponseMessage(@__ServerChannelInfo, "Registration", "Registration", "ServerHasBeenUpdatedResponse");
@__Message.FinalizeMessage();
@__oResponseOptions = RemObjects.SDK.Server.ResponseOptions.roNoResponse;
}
public static void Invoke_RetrieveNewClientPin(RemObjects.SDK.IROService @__Instance, RemObjects.SDK.IMessage @__Message, RemObjects.SDK.Server.IServerChannelInfo @__ServerChannelInfo, out RemObjects.SDK.Server.ResponseOptions @__oResponseOptions) {
string UserApiKey = @__Message.ReadAnsiString("UserApiKey");
string pin;
pin = ((IRegistration)(@__Instance)).RetrieveNewClientPin(UserApiKey);
@__Message.InitializeResponseMessage(@__ServerChannelInfo, "Registration", "Registration", "RetrieveNewClientPinResponse");
@__Message.WriteAnsiString("pin", pin);
@__Message.FinalizeMessage();
@__oResponseOptions = RemObjects.SDK.Server.ResponseOptions.roDefault;
}
public static void Invoke_UpdateServer(RemObjects.SDK.IROService @__Instance, RemObjects.SDK.IMessage @__Message, RemObjects.SDK.Server.IServerChannelInfo @__ServerChannelInfo, out RemObjects.SDK.Server.ResponseOptions @__oResponseOptions) {
RemObjects.SDK.ObjectDisposer @__ObjectDisposer = new RemObjects.SDK.ObjectDisposer(1);
try {
Server server = ((Server)(@__Message.Read("server", typeof(Server), RemObjects.SDK.StreamingFormat.Default)));
@__ObjectDisposer.Add(server);
bool Result;
Result = ((IRegistration)(@__Instance)).UpdateServer(server);
@__Message.InitializeResponseMessage(@__ServerChannelInfo, "Registration", "Registration", "UpdateServerResponse");
@__Message.WriteBoolean("Result", Result);
@__Message.FinalizeMessage();
@__oResponseOptions = RemObjects.SDK.Server.ResponseOptions.roDefault;
}
finally {
@__ObjectDisposer.Dispose();
}
}
public static void Invoke_UpdatePracticeName(RemObjects.SDK.IROService @__Instance, RemObjects.SDK.IMessage @__Message, RemObjects.SDK.Server.IServerChannelInfo @__ServerChannelInfo, out RemObjects.SDK.Server.ResponseOptions @__oResponseOptions) {
string UserApiKey = @__Message.ReadAnsiString("UserApiKey");
string UserApiPin = @__Message.ReadAnsiString("UserApiPin");
string PracticeName = @__Message.ReadAnsiString("PracticeName");
bool Result;
Result = ((IRegistration)(@__Instance)).UpdatePracticeName(UserApiKey, UserApiPin, PracticeName);
@__Message.InitializeResponseMessage(@__ServerChannelInfo, "Registration", "Registration", "UpdatePracticeNameResponse");
@__Message.WriteBoolean("Result", Result);
@__Message.FinalizeMessage();
@__oResponseOptions = RemObjects.SDK.Server.ResponseOptions.roDefault;
}
public static void Invoke_UpdatePracticeName2(RemObjects.SDK.IROService @__Instance, RemObjects.SDK.IMessage @__Message, RemObjects.SDK.Server.IServerChannelInfo @__ServerChannelInfo, out RemObjects.SDK.Server.ResponseOptions @__oResponseOptions) {
string systemApiKey = @__Message.ReadAnsiString("systemApiKey");
string PracticeName = @__Message.ReadAnsiString("PracticeName");
bool Result;
Result = ((IRegistration)(@__Instance)).UpdatePracticeName2(systemApiKey, PracticeName);
@__Message.InitializeResponseMessage(@__ServerChannelInfo, "Registration", "Registration", "UpdatePracticeName2Response");
@__Message.WriteBoolean("Result", Result);
@__Message.FinalizeMessage();
@__oResponseOptions = RemObjects.SDK.Server.ResponseOptions.roDefault;
}
public static void Invoke_IsServerReachable(RemObjects.SDK.IROService @__Instance, RemObjects.SDK.IMessage @__Message, RemObjects.SDK.Server.IServerChannelInfo @__ServerChannelInfo, out RemObjects.SDK.Server.ResponseOptions @__oResponseOptions) {
RemObjects.SDK.ObjectDisposer @__ObjectDisposer = new RemObjects.SDK.ObjectDisposer(1);
try {
Server server = ((Server)(@__Message.Read("server", typeof(Server), RemObjects.SDK.StreamingFormat.Default)));
@__ObjectDisposer.Add(server);
bool Result;
Result = ((IRegistration)(@__Instance)).IsServerReachable(server);
@__Message.InitializeResponseMessage(@__ServerChannelInfo, "Registration", "Registration", "IsServerReachableResponse");
@__Message.WriteBoolean("Result", Result);
@__Message.FinalizeMessage();
@__oResponseOptions = RemObjects.SDK.Server.ResponseOptions.roDefault;
}
finally {
@__ObjectDisposer.Dispose();
}
}
public static void Invoke_IsClientReachable(RemObjects.SDK.IROService @__Instance, RemObjects.SDK.IMessage @__Message, RemObjects.SDK.Server.IServerChannelInfo @__ServerChannelInfo, out RemObjects.SDK.Server.ResponseOptions @__oResponseOptions) {
string systemApiKey = @__Message.ReadAnsiString("systemApiKey");
bool Result;
Result = ((IRegistration)(@__Instance)).IsClientReachable(systemApiKey);
@__Message.InitializeResponseMessage(@__ServerChannelInfo, "Registration", "Registration", "IsClientReachableResponse");
@__Message.WriteBoolean("Result", Result);
@__Message.FinalizeMessage();
@__oResponseOptions = RemObjects.SDK.Server.ResponseOptions.roDefault;
}
public static void Invoke_RetrieveHostGUIDForServerFromInternet(RemObjects.SDK.IROService @__Instance, RemObjects.SDK.IMessage @__Message, RemObjects.SDK.Server.IServerChannelInfo @__ServerChannelInfo, out RemObjects.SDK.Server.ResponseOptions @__oResponseOptions) {
RemObjects.SDK.ObjectDisposer @__ObjectDisposer = new RemObjects.SDK.ObjectDisposer(1);
try {
Server server = ((Server)(@__Message.Read("server", typeof(Server), RemObjects.SDK.StreamingFormat.Default)));
@__ObjectDisposer.Add(server);
string HostGUID;
HostGUID = ((IRegistration)(@__Instance)).RetrieveHostGUIDForServerFromInternet(server);
@__Message.InitializeResponseMessage(@__ServerChannelInfo, "Registration", "Registration", "RetrieveHostGUIDForServerFromInternetResponse");
@__Message.WriteAnsiString("HostGUID", HostGUID);
@__Message.FinalizeMessage();
@__oResponseOptions = RemObjects.SDK.Server.ResponseOptions.roDefault;
}
finally {
@__ObjectDisposer.Dispose();
}
}
public static void Invoke_DoesServerHostGUIDExist(RemObjects.SDK.IROService @__Instance, RemObjects.SDK.IMessage @__Message, RemObjects.SDK.Server.IServerChannelInfo @__ServerChannelInfo, out RemObjects.SDK.Server.ResponseOptions @__oResponseOptions) {
string HostGUID = @__Message.ReadAnsiString("HostGUID");
bool Result;
Result = ((IRegistration)(@__Instance)).DoesServerHostGUIDExist(HostGUID);
@__Message.InitializeResponseMessage(@__ServerChannelInfo, "Registration", "Registration", "DoesServerHostGUIDExistResponse");
@__Message.WriteBoolean("Result", Result);
@__Message.FinalizeMessage();
@__oResponseOptions = RemObjects.SDK.Server.ResponseOptions.roDefault;
}
}
[RemObjects.SDK.Activator()]
[System.Reflection.ObfuscationAttribute(Exclude=true, ApplyToMembers=false)]
public class Registration_Activator : RemObjects.SDK.Server.ServiceActivator {
public Registration_Activator() :
base() {
}
public override RemObjects.SDK.IROService CreateInstance() {
return new Registration();
}
}
}

View File

@@ -0,0 +1,430 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Pluto.Registration
{
internal class SystemAccessVerifier
{
#region Consts
const int SYSTEM_API_KEY_LENGTH = 22;
const int USER_API_KEY_LENGTH = 20;
const int PIN_LENGTH = 6;
const string SYSTEM_API_KEY_BEGIN_MARKER = "$";
const string SYSTEM_API_KEY_END_MARKER = "#";
internal static readonly string LETTER_CHARS = "AZXVGLTCIRKPNOMQJSHUFWDEYB";
internal static int GET_LETTER_CHARS_COUNT { get { return LETTER_CHARS.Length; } }
#endregion
#region System Api Key
private string _systemApiKey = String.Empty;
internal string SystemApiKey
{
get
{
return _systemApiKey;
}
set
{
if (ValidateSystemKey(value))
_systemApiKey = value.ToUpper().Trim();
}
}
private static bool ValidateSystemKey(string key)
{
if(!String.IsNullOrEmpty(key))
key = key.ToUpper().Trim();
// $247B2CB4A437EB74C62#M
if (!String.IsNullOrEmpty(key) && key.Length == SYSTEM_API_KEY_LENGTH &&
key[0] == Char.Parse(SYSTEM_API_KEY_BEGIN_MARKER) && key[SYSTEM_API_KEY_LENGTH - 2] == Char.Parse(SYSTEM_API_KEY_END_MARKER) &&
Char.IsLetter(key[SYSTEM_API_KEY_LENGTH - 1]))
{
// AllAreLettersOrDigit?
for (int i = 1; i < SYSTEM_API_KEY_LENGTH - 2; ++i)
{
if (!Char.IsLetterOrDigit(key[i]))
return false;
}
return true;
}
return false;
}
#endregion
#region User Api Key
private string _UserApiKey = String.Empty;
internal string UserApiKey
{
get
{
return _UserApiKey;
}
set
{
if (ValidateUserKey(value))
_UserApiKey = value.ToUpper().Trim();
}
}
private static bool ValidateUserKey(string key)
{
if (!String.IsNullOrEmpty(key))
key = key.ToUpper().Trim();
//247BQCB4A-37EB-4C62M
if (!String.IsNullOrEmpty(key) && key.Length == USER_API_KEY_LENGTH &&
Char.IsLetter(key[USER_API_KEY_LENGTH - 1]) &&
Char.IsLetter(key[4]) && key[9] == '-' && key[14] == '-')
{
// Perform Product Security check
char productType = key[USER_API_KEY_LENGTH - 1];
int v = (int)productType % GET_LETTER_CHARS_COUNT;
if (key[4] == LETTER_CHARS[v])
return true;
}
return false;
}
#endregion
#region Pin
private string _Pin = String.Empty;
internal string Pin { get { return _Pin; } }
internal bool IsValidPin { get { return (_Pin != String.Empty); } }
#endregion
#region Product Type
private char _productType = '\0';
internal char ProductType { get { return Char.ToUpper(_productType); } }
internal bool IsValidProductType { get { return (_productType != '\0'); } }
#endregion
#region Construction
internal SystemAccessVerifier(string systemApiKey)
{
if (!String.IsNullOrEmpty(systemApiKey))
systemApiKey = systemApiKey.ToUpper().Trim();
SystemApiKey = systemApiKey;
_productType = GetProductTypeFromSystemApiKey(SystemApiKey);
ConvertSystemToUserApiKey();
_Pin = RetrieveUserApkiKeyPin(UserApiKey);
}
internal SystemAccessVerifier(string userApiKey, string pin)
{
if (!String.IsNullOrEmpty(userApiKey))
userApiKey = userApiKey.ToUpper().Trim();
if (ValidateUserKey(userApiKey))
{
string aPin = RetrieveUserApkiKeyPin(userApiKey);
if (!String.IsNullOrEmpty(aPin) && !String.IsNullOrEmpty(pin) &&
aPin == pin)
{
UserApiKey = userApiKey;
_Pin = pin;
ConvertUserToSystemApiKey();
_productType = GetProductTypeFromSystemApiKey(SystemApiKey);
}
}
}
#endregion
#region Private Converters
private void ConvertSystemToUserApiKey()
{
if (ValidateSystemKey(SystemApiKey) && IsValidProductType)
{
// $247B2CB4A437EB74C62#M
string s = SystemApiKey;
s = s.Replace(SYSTEM_API_KEY_BEGIN_MARKER, "");
s = s.Replace(SYSTEM_API_KEY_END_MARKER, "");
// pop off the product type
char productType = SystemApiKey[SYSTEM_API_KEY_LENGTH - 1];
s = s.Substring(0, s.Length - 1);
// Stripe out the invalid chars
StringBuilder sb = new StringBuilder(s);
sb.Remove(14, 1);
sb.Remove(9, 1);
sb.Remove(4, 1);
s = sb.ToString();
// Then put the Dashes back
s = MakeIntoDashSeperatedString(s, 4);
// reverse the string (how clever) :S
s = ReverseString(s);
sb = new StringBuilder(s);
int v = (int)productType % GET_LETTER_CHARS_COUNT;
sb[4] = LETTER_CHARS[v];
// Perform an arbitrary swap (just in case)
// Swap 10 to 3, and 16 to 5
char c = sb[10];
sb[10] = sb[3];
sb[3] = c;
c = sb[16];
sb[16] = sb[5];
sb[5] = c;
// Add More Randomness into this (nobody will ever know :S)
// Dynamic Calc for 2 + 2, 12 + 4
int a = (int)'A';
int z = (int)'Z';
int ic = (int)sb[2];
if ((ic >= a) && (ic + 2 <= z))
sb[2] = (char)(ic + 2);
ic = sb[12];
if ((ic >= a) && (ic + 4 <= z))
sb[12] = (char)(ic + 4);
// 247BQCB4A-37EB-4C62M
s = sb.ToString() + productType;
UserApiKey = s;
}
}
private void ConvertUserToSystemApiKey()
{
if (ValidateUserKey(UserApiKey) && IsValidPin)
{
// 247BQCB4A-37EB-4C62M
StringBuilder sb = new StringBuilder(UserApiKey);
char productType = sb[USER_API_KEY_LENGTH - 1];
sb.Remove(USER_API_KEY_LENGTH - 1, 1);
// Add More Randomness into this (nobody will ever know :S)
// Dynamic Calc for 2 - 2, 12 - 4
int a = (int)'A';
int z = (int)'Z';
int ic = (int)sb[2];
if ((ic - 2 >= a) && (ic <= z))
sb[2] = (char)(ic - 2);
ic = sb[12];
if ((ic - 4 >= a) && (ic <= z))
sb[12] = (char)(ic - 4);
//Otherway arround arbitrary swap (just in case)
// Swap 3 to 10, and 5 to 16
char c = sb[3];
sb[3] = sb[10];
sb[10] = c;
c = sb[5];
sb[5] = sb[16];
sb[16] = c;
// Assign '-'
sb[4] = '-';
// How clever :S
string s = ReverseString(sb.ToString());
int n = 0;
sb = new StringBuilder(s);
for (int i = 0; i < s.Length; ++i)
{
if (s[i] == '-')
{
sb[i] = (s[n]);
n++;
}
else
{
sb[i] = (s[i]);
}
}
// $247B2CB4A437EB74C62#M
s = SYSTEM_API_KEY_BEGIN_MARKER + sb.ToString() + SYSTEM_API_KEY_END_MARKER + Char.ToUpper(productType);
SystemApiKey = s;
}
}
#endregion
#region Internal Statics
internal static string GenerateNewSystemApiKey(char productType)
{
if (Char.IsLetter(productType))
{
Guid guid = Guid.NewGuid();
string s = MakeIntoDashUnseperatedString(guid.ToString().ToUpper());
s = s.Substring(0, USER_API_KEY_LENGTH - 4);
s = MakeIntoDashSeperatedString(s, 4);
int n = 0;
StringBuilder sb = new StringBuilder();
for (int i = 0; i < s.Length; ++i)
{
if (s[i] == '-')
{
sb.Append(s[n]);
n++;
}
else
{
sb.Append(s[i]);
}
}
//$C343C1B833740444938#M
s = SYSTEM_API_KEY_BEGIN_MARKER + sb.ToString() + SYSTEM_API_KEY_END_MARKER + Char.ToUpper(productType);
return s;
}
return String.Empty;
}
internal static char GetProductTypeFromSystemApiKey(string systemApiKey)
{
if (ValidateSystemKey(systemApiKey))
return Char.ToUpper(systemApiKey[SYSTEM_API_KEY_LENGTH - 1]);
else
return '\0';
}
internal static string RetrieveUserApkiKeyPin(string userApiKey)
{
if (!String.IsNullOrEmpty(userApiKey))
userApiKey = userApiKey.ToUpper().Trim();
if (ValidateUserKey(userApiKey))
{
string KeyChecksum = PerformChecksum(userApiKey).ToString();
if (KeyChecksum.Length == 1)
KeyChecksum = KeyChecksum + "7"; //Very Likely never single digit
string TimeChecksum = DateTime.Now.ToUniversalTime().ToShortDateString() + DateTime.Now.ToUniversalTime().Year.ToString().Substring(2);
TimeChecksum = PerformChecksum(TimeChecksum).ToString();
if (TimeChecksum.Length == 1)
TimeChecksum = TimeChecksum + "5"; //TimeChecksum coulde be single digit
bool bCheckPassed = false;
string nCheck = String.Empty;
char productType = userApiKey[USER_API_KEY_LENGTH - 1];
char check = userApiKey[4];
int v = (int)productType % GET_LETTER_CHARS_COUNT;
if (check == LETTER_CHARS[v])
{
bCheckPassed = true;
int n1 = (int)check + DateTime.Now.ToUniversalTime().Day;
int n2 = (int)LETTER_CHARS[v] - (int)DateTime.Now.ToUniversalTime().DayOfWeek;
int n1n2 = (n1 + n2);
nCheck = n1n2.ToString();
nCheck = nCheck.Substring(nCheck.Length - 2, 2);
}
// Use Pin Map to generate appropriate Pin
const string PIN_MAP = "2645309718";
string pin = String.Empty;
if (bCheckPassed)
{
int c1, c2, k1, k2, t1, t2;
int.TryParse(nCheck[0].ToString(), out c1);
int.TryParse(nCheck[1].ToString(), out c2);
int.TryParse(KeyChecksum[0].ToString(), out k1);
int.TryParse(KeyChecksum[1].ToString(), out k2);
int.TryParse(TimeChecksum[0].ToString(), out t1);
int.TryParse(TimeChecksum[1].ToString(), out t2);
pin = PIN_MAP[c2] + PIN_MAP[c1].ToString() + PIN_MAP[t2] + PIN_MAP[k2] + PIN_MAP[t1] + PIN_MAP[k1];
return pin;
}
}
return String.Empty;
}
#endregion
#region Private static Key Generation Helper Functions
private static string ReverseString(string str)
{
if (!String.IsNullOrEmpty(str))
{
Stack<char> stack = new Stack<char>();
foreach (char c in str)
stack.Push(c);
StringBuilder sb = new StringBuilder();
while (stack.Count > 0)
sb.Append(stack.Pop());
return sb.ToString();
}
return String.Empty;
}
/// <summary>
/// Perform checksum on string
/// </summary>
/// <param name="strAboutToBeChecksummed"></param>
/// <returns>Checksum</returns>
private static int PerformChecksum(string strAboutToBeChecksummed)
{
if (!String.IsNullOrEmpty(strAboutToBeChecksummed))
{
int nChecksum = 0;
for (int i = 0; i < strAboutToBeChecksummed.Length; ++i)
{
if (Char.IsDigit(strAboutToBeChecksummed[i]))
nChecksum = nChecksum + int.Parse(strAboutToBeChecksummed[i].ToString());
}
return nChecksum;
}
return 0;
}
/// <summary>
/// Dash a String every Nth Character
/// </summary>
/// <returns>a dashed string</returns>
private static string MakeIntoDashSeperatedString(string strAboutToBeDashed, int DashEveryNthCharacter)
{
if (!String.IsNullOrEmpty(strAboutToBeDashed))
{
StringBuilder sb = new StringBuilder();
for (int i = 0; i < strAboutToBeDashed.Length; i++)
{
if ((i != 0) && ((i % DashEveryNthCharacter) == 0))
sb.Append("-");
sb.Append(strAboutToBeDashed[i]);
}
return sb.ToString();
}
return String.Empty;
}
/// <summary>
/// Undash a String
/// </summary>
/// <returns>a string without dashes</returns>
private static string MakeIntoDashUnseperatedString(string strAboutToBeUndashed)
{
if (!String.IsNullOrEmpty(strAboutToBeUndashed))
return strAboutToBeUndashed.Replace("-", "");
return String.Empty;
}
/// <summary>
/// Check if the passed in string contains only digits
/// </summary>
/// <param name="strToCheckForDigits">string to check for digits for</param>
/// <returns>true, if all digits are numbers</returns>
private static bool ContainsOnlyDigits(string strToCheckForDigits)
{
if (!String.IsNullOrEmpty(strToCheckForDigits))
{
for (int i = 0; i < strToCheckForDigits.Length; ++i)
{
if (!Char.IsDigit(strToCheckForDigits[i]))
return false;
}
return true;
}
return false;
}
#endregion
}
}

View File

@@ -0,0 +1,13 @@
<?xml version="1.0"?>
<configuration>
<startup><supportedRuntime version="v2.0.50727"/></startup>
<appSettings>
<add key="Url" value="ppsmobile.mckesson.com"/>
<add key="Port" value="443" />
<add key="SQLServer" value="127.0.0.1" />
<add key="SQLInstance" value="SQLEXPRESS" />
<add key="SQLDatabaseName" value="Mobile_Registration" />
<add key="SQLUsername" value="sa" />
<add key="SQLPassword" value="Clinical$1" />
</appSettings>
</configuration>

View File

@@ -0,0 +1,13 @@
<?xml version="1.0"?>
<configuration>
<startup><supportedRuntime version="v2.0.50727"/></startup>
<appSettings>
<add key="Url" value="dev.ideastoaction.com"/>
<add key="Port" value="444" />
<add key="SQLServer" value="WEBBY" />
<add key="SQLInstance" value="SQLEXPRESS" />
<add key="SQLDatabaseName" value="Mobile_Registration" />
<add key="SQLUsername" value="sa" />
<add key="SQLPassword" value="Clinical$1" />
</appSettings>
</configuration>

View File

@@ -0,0 +1,13 @@
<?xml version="1.0"?>
<configuration>
<startup><supportedRuntime version="v2.0.50727"/></startup>
<appSettings>
<add key="Url" value="localhost"/>
<add key="Port" value="443" />
<add key="SQLServer" value="127.0.0.1" />
<add key="SQLInstance" value="SQLEXPRESS" />
<add key="SQLDatabaseName" value="Mobile_Registration" />
<add key="SQLUsername" value="sa" />
<add key="SQLPassword" value="Clinical$1" />
</appSettings>
</configuration>

View File

@@ -0,0 +1,13 @@
<?xml version="1.0"?>
<configuration>
<startup><supportedRuntime version="v2.0.50727"/></startup>
<appSettings>
<add key="Url" value="services.ndchealthvar.com"/>
<add key="Port" value="443" />
<add key="SQLServer" value="atl-gildb" />
<add key="SQLInstance" value="" />
<add key="SQLDatabaseName" value="Mobile_Registration" />
<add key="SQLUsername" value="MobileDBA" />
<add key="SQLPassword" value="G0MobileYEAH!@#" />
</appSettings>
</configuration>

View File

@@ -0,0 +1,12 @@
RemObjects.SDK.Server.IpTcpServerChannel, RemObjects.SDK.Server
RemObjects.SDK.Server.IpSuperHttpServerChannel, RemObjects.SDK.Server
RemObjects.SDK.Server.IpHttpServerChannel, RemObjects.SDK.Server
RemObjects.SDK.Server.NamedPipeServerChannel, RemObjects.SDK.Server
RemObjects.SDK.Server.LocalServerChannel, RemObjects.SDK.Server
RemObjects.SDK.Server.HttpSysServerChannel, RemObjects.SDK.Server
RemObjects.SDK.Server.HttpSysSuperHttpServerChannel, RemObjects.SDK.Server
RemObjects.SDK.Server.SuperTcpServerChannel, RemObjects.SDK.Server
RemObjects.SDK.Server.EventSinkManager, RemObjects.SDK.Server
RemObjects.SDK.Server.MasterServerSessionManager, RemObjects.SDK.Server
RemObjects.SDK.Server.MemoryMessageQueueManager, RemObjects.SDK.Server
RemObjects.SDK.Server.MemorySessionManager, RemObjects.SDK.Server

View File

@@ -0,0 +1,11 @@
C:\Users\Administrator\Projects\Pluto\Server\RegistrationServer\obj\x86\Debug\ResolveAssemblyReference.cache
C:\Users\Administrator\Projects\Pluto\Server\RegistrationServer\obj\x86\Debug\RegistrationServer.RegistrationService.resources
C:\Users\Administrator\Projects\Pluto\Server\RegistrationServer\obj\x86\Debug\ResGen.read.1.tlog
C:\Users\Administrator\Projects\Pluto\Server\RegistrationServer\obj\x86\Debug\ResGen.write.1.tlog
C:\Users\Administrator\Projects\Pluto\Server\RegistrationServer\obj\x86\Debug\Pluto.RegistrationServer.exe.licenses
C:\Users\Administrator\Projects\Pluto\Server\Target\Debug\RegistrationServer.config
C:\Users\Administrator\Projects\Pluto\Server\Target\Debug\Pluto.RegistrationServer.exe.config
C:\Users\Administrator\Projects\Pluto\Server\Target\Debug\Pluto.RegistrationServer.exe
C:\Users\Administrator\Projects\Pluto\Server\Target\Debug\Pluto.RegistrationServer.pdb
C:\Users\Administrator\Projects\Pluto\Server\RegistrationServer\obj\x86\Debug\Pluto.RegistrationServer.exe
C:\Users\Administrator\Projects\Pluto\Server\RegistrationServer\obj\x86\Debug\Pluto.RegistrationServer.pdb

View File

@@ -0,0 +1,11 @@
C:\Users\Administrator\Projects\Pluto\Server\Target\Release\Pluto.RegistrationServer.exe.config
C:\Users\Administrator\Projects\Pluto\Server\Target\Release\RegistrationServer.config
C:\Users\Administrator\Projects\Pluto\Server\Target\Release\Pluto.RegistrationServer.exe
C:\Users\Administrator\Projects\Pluto\Server\Target\Release\Pluto.RegistrationServer.pdb
C:\Users\Administrator\Projects\Pluto\Server\RegistrationServer\obj\x86\Release\ResolveAssemblyReference.cache
C:\Users\Administrator\Projects\Pluto\Server\RegistrationServer\obj\x86\Release\RegistrationServer.RegistrationService.resources
C:\Users\Administrator\Projects\Pluto\Server\RegistrationServer\obj\x86\Release\ResGen.read.1.tlog
C:\Users\Administrator\Projects\Pluto\Server\RegistrationServer\obj\x86\Release\ResGen.write.1.tlog
C:\Users\Administrator\Projects\Pluto\Server\RegistrationServer\obj\x86\Release\Pluto.RegistrationServer.exe.licenses
C:\Users\Administrator\Projects\Pluto\Server\RegistrationServer\obj\x86\Release\Pluto.RegistrationServer.exe
C:\Users\Administrator\Projects\Pluto\Server\RegistrationServer\obj\x86\Release\Pluto.RegistrationServer.pdb