using System; namespace SharedUI { public sealed class App { private static int c = 1; private readonly String appName; private readonly String appFolder4Update; private readonly int value; public static readonly App DISPATCH_MOBILE = new App(c++, "AppServerMobile", "appserver_mobile"); public static readonly App DISPATCH_HYTERA = new App(c++, "SafeSyt", "dispatcher"); public static readonly App DISPATCH_ATLAS = new App(c++, "Atlas", "dispatcher"); public static readonly App DISPATCH_Vision = new App(c++, "Vision", "dispatcher"); public static readonly App DISPATCH_HARRIS = new App(c++, "Harris", "dispatcher"); public static readonly App DISPATCH_MOTOROLA = new App(c++, "SafeDispatch", "dispatcher"); public static readonly App DISPATCH_SIMOCO = new App(c++, "Simoco Dispatch", "dispatcher"); public static readonly App DISPATCH_EXCERA = new App(c++, "Excera Dispatch", "dispatcher"); public static readonly App DISPATCH_LINX = new App(c++, "LINX Dispatch", "dispatcher"); public static readonly App GW_ASTRO = new App(c++, "ASTRO Gateway", "gateway_astro"); public static readonly App GW_HYTERA = new App(c++, "Hytera Gateway", "gateway_astro"); public static readonly App GW_TRBO = new App(c++, "TRBO Gateway", "gateway_trbo"); public static readonly App GW_REPEATER = new App(c++, "Repeater Gateway", "gateway_repeater"); public static readonly App GW_CPLUS = new App(c++, "ConnectPlus Gateway", "gateway_cplus"); public static readonly App GW_TETRA = new App(c++, "TETRA Gateway", "gateway_tetra"); public static readonly App GW_TETRA_SDR = new App(c++, "TETRA SDR Getaway", "gateway_tetra_sdr"); public static readonly App GW_SEPURA_3T_SDR = new App(c++, "Sepura 3T SDR Gateway", "gateway_sepura_3t_sdr"); public static readonly App ADMIN_MODULE = new App(c++, "Administrative Module", "admin_module"); public static readonly App APP_SERVER = new App(c++, "Application Server", "appserver"); public static readonly App TCP_SERVER = new App(c++, "TCP Server Service", "tcp_server"); public static readonly App TCP_CLIENT = new App(c++, "TCP Client Service", "tcp_client"); public static readonly App UPDATER = new App(c++, "Updater", "updater"); public static readonly App LINX_GATEWAY = new App(c++, "LINX Gateway", "gateway_linx"); public static readonly App EXCERA_GATEWAY = new App(c++, "EXCERA Gateway", "gateway_excera"); public static readonly App GW_SMC = new App(c++, "SMC Gateway", "gateway_smc"); public static readonly App APP_SERVER_MOBILE = new App(c++, "Application Server Mobile", "appserver_mobile"); private App(int value, String appName, String appFolder4Update) { this.value = value; this.appName = appName; this.appFolder4Update = appFolder4Update; } public override String ToString() { return appName; } /// /// Get the application folder name based on it's type /// /// App type /// A string defining the application path public static String GetAppFolder(App app) { return app.appFolder4Update; } public static String GetAppName(App app) { return app.appName; } /// /// Detect if the current app version is allowed to run, or if the version /// is obsolete and needs to be prevented from running /// /// String containing the app server version /// String containing the application version /// Boolean representing true or false if the app is allowed to run or not public static bool isValidVersion(String appServerVers, String appVers) { try { String[] appServer = appServerVers.Split(new char[] { '.' }); String[] app = appVers.Split(new char[] { '.' }); if ((int)appServerVers[0] > (int)appVers[0] || (int)appServerVers[1] > (int)appVers[1] || (int)appServerVers[2] > (int)appVers[2]) return false; return true; } catch (Exception) { return false; } } } /* public class App { public const int DISPATCH = 0; public const int GW_TRBO = 1; public const int GW_REPEATER = 2; public const int GW_CPLUS = 3; public const int GW_TETRA = 4; public const int GW_TETRA_SDR = 5; public const int ADMIN_MODULE = 6; public const int APP_SERVER = 7; public const int TCP_SERVER = 8; public const int TCP_CLIENT = 9; /// /// Get the application folder name based on it's type /// /// App type /// A string defining the application path public static String GetAppFolder(int app) { switch (app) { case APP_SERVER: return "appserver"; case GW_TRBO: return "gateway_trbo"; case GW_REPEATER: return "gateway_repeater"; case DISPATCH: return "dispatcher"; default: return "default"; } } public static String GetAppName(int app) { switch (app) { case APP_SERVER: return "App Server"; case GW_TRBO: return "MotoTRBO Gateway"; case GW_REPEATER: return "Repeater Gateway"; case DISPATCH: return "Dispatcher"; default: return "default"; } } */ }