public static IExCommsServiceInfo Run(IExecutorService executorService, string[] args) { using (ILogMethod method = Log.LogMethod("CommsServicesFactrory", "Run")) { IExCommsServiceInfo result = null; try { var activators = MEFHelper.GetExportedValues <IExCommsServerHostFactoryActivator>(); string key = args.Length == 0 ? "/all" : ((args[0] == "/debug") ? ((args.Length == 1) ? "/all" : args[1]) : args[0]); if (_servicesInfo.ContainsKey(key)) { result = _servicesInfo[key](executorService, activators); } } catch (Exception ex) { method.Exception(ex); } return(result); } }
public ExtensionLibrary() { AttachObserver(LoggerHelper.GetInstance()); MefHelper = new MEFHelper(); Drivers = new List<GlowDriver>(); Grabbers = new List<GlowScreenGrabber>(); Processors = new List<GlowScreenProcessor>(); Filters = new List<GlowFilter>(); Notifiers = new List<GlowNotifier>(); Extensions = new List<GlowExtension>(); }
private static void InitEncryptionFactory() { using (ILogMethod method = Log.LogMethod(DYN_MODULE_NAME, "Method")) { try { EncryptionFactory = MEFHelper.GetExportedValue <IFreeformEncryptionFactory>("FreeformEncryptionFactory"); } catch (Exception ex) { method.Exception(ex); } } }
private static void InitLogger() { #if !REF_BMC_COMMON try { _disableLogging = MEFHelper.GetExportedValue <bool>("DisableLogging"); } catch (Exception) { InitLoggerFromXml(); } #else _disableLogging = ConfigApplicationFactory.DisableLogging; #endif }
public static IDataInterface GetInterface() { if (_object == null) { lock (_lock) { if (_object == null) { try { _object = MEFHelper.GetExportedValue<IDataInterface>("DataInterface"); } catch (Exception) { _object = new CommonDataInterface(); } } } } return _object; }
private static IExMonitorServerConfigStore Create() { using (ILogMethod method = Log.LogMethod("ExMonitorServerConfigStoreFactory", "Create")) { IExMonitorServerConfigStore result = default(IExMonitorServerConfigStore); try { try { result = MEFHelper.GetExportedValue <IExMonitorServerConfigStore>("ExMonitorServerConfigStore"); } catch { result = new ExMonitorServerConfigStore(); } } catch (Exception ex) { method.Exception(ex); } return(result); } }
public static void Initialize(UIElement rootVisual) #endif { _objectWrapper = new _ObjectWrapper(); #if SILVERLIGHT _rootVisual = rootVisual; _dispatcher = System.Windows.Deployment.Current.Dispatcher; #endif CurrentApplication.Startup += CurrentApplication_Startup; #if !SILVERLIGHT CurrentApplication.StartupUri = new Uri(uri, UriKind.Relative); #endif #if NET4 if (Application.Current != null) { MEFHelper.ComposeParts(Application.Current); } #endif }
static void Main(string[] args) { Log.GlobalWriteToExternalLog += Log_GlobalWriteToExternalLog; IExecutorService exec = ExecutorServiceFactory.CreateExecutorService(); var activators = MEFHelper.GetExportedValues <IExCommsServerHostFactoryActivator>(); ExCommsServerHostFactory host = null; var activator = (from a in activators where a.ServerType == ExCommsHostingServerType.MonitorServer select a).FirstOrDefault(); if (activator == null) { return; } ExCommsHostingModuleTypeHelper.Current.ModuleType = ExCommsHostingModuleType.MonitorServer4CommsServer; host = activator.Create(exec); host.Start(); while (true) { Console.WriteLine(@"Press any key to continue..."); string s = Console.ReadLine(); if (s == "q") { break; } } exec.Shutdown(); host.Stop(); exec.AwaitTermination(TimeSpan.FromMinutes(2)); Thread.Sleep(10000); }
public static IExternalExcelApplication Create() { ModuleProc PROC = new ModuleProc("ExternalExcelLibraryFactory", "Create"); IExternalExcelApplication result = default(IExternalExcelApplication); try { if (_activeLibraryLoader == null) { lock (_librariesLock) { if (_activeLibraryLoader == null) { try { IEnumerable <IExternalExcelApplicationLoader> libraryLoaders = null; try { libraryLoaders = MEFHelper.GetExportedValues <IExternalExcelApplicationLoader>(); } catch { libraryLoaders = GetAssemblyLoaders(); } if (libraryLoaders != null) { _libraryLoaders = (from l in libraryLoaders orderby l.LibraryOrder select l).ToArray(); if (_libraryLoaders != null) { // load the first matched library until find valid one foreach (IExternalExcelApplicationLoader libraryLoader in _libraryLoaders) { if (libraryLoader != null) { if (libraryLoader.IsLoadedProperly) { Log.Info(PROC, "Excel Library : " + libraryLoader.LibraryName + " (Loaded)"); _activeLibraryLoader = libraryLoader; break; } else { Log.Info(PROC, "Excel Library : " + libraryLoader.LibraryName + " (Unable to load)"); } } } } } } catch (Exception ex) { Log.Exception(PROC, ex); } } } } // still no external loaders found (then take ExcelPackage as a rescuer) if (_activeLibraryLoader == null) { _activeLibraryLoader = new OpenXmlExcelApplicationLoader(); } if (_activeLibraryLoader != null) { IExternalExcelApplication library = null; try { library = _activeLibraryLoader.Create(); } catch { library = null; } if (library != null) { result = library; Log.Info(PROC, "Excel Library : " + _activeLibraryLoader.LibraryName + " (Created)"); } } } catch (Exception ex) { Log.Exception(PROC, ex); } return(result); }
static void Main(string[] args) { Console.Title = "ExCommsServer Testing"; Console.SetWindowSize(80, 58); BMCRegistryHelper.ActiveInstallationType = BMCCategorizedInstallationTypes.Exchange; Log.AddAppFileLoggingSystem(); Log.GlobalWriteToExternalLog += Log_GlobalWriteToExternalLog; TestPIDData(); //MonMsg_H2G monH2G = new MonMsg_H2G(); //MonTgt_H2G_AckNack nack = new MonTgt_H2G_AckNack(); //nack.Nack = true; //monH2G.AddTarget(nack); //var msg2 = MonitorEntityFactory.CreateEntity(monH2G); //var ffBuffer = FreeformEntityFactory.CreateBuffer(msg2); var configStore = ExMonitorServerConfigStoreFactory.Store; var cat = ErrorEventCategoryFactory.Categories; string barcode = "889900027000052237"; TicketIDInfo idInfo = new TicketIDInfo(barcode); int seqno = idInfo.SequenceNumber; //byte[] packed = FreeformHelper.GetBCDToBytes(sUnpacked, sUnpacked.Length / 2); //string sUnpacked2 = packed.GetBCDValueString(0, 0, 9); //EncryptSecurity(); //var dr = ExCommsDataContext.Current.GetMeterDeltaForPlayerSession(27, "1000012345", "IR"); //ExecutionStepsTest(); //return; //ExCommsHostingModuleTypeHelper.Current.SetAll(); //_server = new ExCommsServerImpl(ExecutorServiceFactory.CreateExecutorService()); //_server.Start(); IExecutorService exec = ExecutorServiceFactory.CreateExecutorService(); //ExecutionStepFactory.Initialize(exec, false, ExecutionStepDeviceTypes.GMU); //FFMsgHandlerFactory.Initialize(exec, FFTgtHandlerDeviceTypes.GMU, () => //{ // return new FFMsgTransmitter(); //}); MonTgt_G2H_GIM_GameIDInfo target = new MonTgt_G2H_GIM_GameIDInfo(); MonTgt_G2H_GVA_TED_Request r = new MonTgt_G2H_GVA_TED_Request(); //TestGIM(); //Console.ForegroundColor = ConsoleColor.Cyan; //GenerateKeys(SECURITY_KEY_INDEX.TICKET_KEY, IPADDR); //GenerateKeys(SECURITY_KEY_INDEX.EFT_KEY, IPADDR); //Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine("Start ExComms Server?"); Console.ResetColor(); string anser = "y";// Console.ReadLine(); if (anser == "y") { var activators = MEFHelper.GetExportedValues <IExCommsServerHostFactoryActivator>(); ExCommsServerHostFactoryActivatorFactory factory = new ExCommsServerHostFactoryActivatorFactory(exec, ExCommsHostingModuleType.CommunicationServer | ExCommsHostingModuleType.MonitorServer4CommsServer | ExCommsHostingModuleType.MonitorServer4MonProcessor , activators); factory.Start(); } long ticks = DateTime.Now.Ticks; byte[] lohi = FFDataTypeHelper.GetInt64Bytes(ticks, FFEndianType.LittleEndian); //TestGIM(); while (true) { Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine("Press any key to continue..."); Console.ResetColor(); string s = Console.ReadLine(); if (s == "q") { return; } //TestEncryptedTicketMessage(); //InitKeyExchangeStart(); //if (s == "k1") InitKeyExchangeStartG2H(); //if (s == "k2") InitKeyExchangeEnd(); //if (s == "t") GenerateKeys(SECURITY_KEY_INDEX.TICKET_KEY); //if (s == "e") GenerateKeys(SECURITY_KEY_INDEX.EFT_KEY); if (s == "g") { ExecutionStepsTest(); } if (s == "ss") { EncryptSecurity(); } if (s == "pci") { TestPlayerCardIn(); } if (s == "pco") { TestPlayerCardOut(); } if (s == "bal") { TestECashBalanceRequest(); } } //TestKeyExchangePartialKey(); return; //short sval = 9999; //short ss1 = sval; //List<byte> ll = new List<byte>(); //while (true) //{ // byte b1 = (byte)(ss1 % 10); // ll.Add(b1); // ss1 /= 10; //} byte[] b1234 = new byte[] { 0x12, 0x34, 0x56, 0x78 }; ulong u = b1234.GetBytesToBCDUInt64(0, 4); int v = 99999; byte b1 = (byte)(v & 0x0F); byte b2 = (byte)((v >> 4) & 0x0F); byte[] buf = "1000500026".GetBCDToBytes(5); byte[] iv = FFDataTypeHelper.GetInt32Bytes(99999, FFEndianType.LittleEndian); byte[] sb1 = FFDataTypeHelper.GetInt16Bytes(9999, FFEndianType.LittleEndian); byte[] sb2 = FFDataTypeHelper.GetInt16Bytes(9999, FFEndianType.BigEndian); short s1 = FFDataTypeHelper.GetInt16(sb1, FFEndianType.LittleEndian); short s2 = FFDataTypeHelper.GetInt16(sb2, FFEndianType.BigEndian); string cc = "1A345"; byte[] b = cc.GetHexBytesValue(2); //FF_AppId_SessionIds sval = FFEnumParserFactory.GetAppId<FF_GmuId_SessionIds, FF_AppId_SessionIds>(FF_GmuId_SessionIds.ECash); //FF_GmuId_SessionIds ss2 = FFEnumParserFactory.GetGmuId<FF_AppId_SessionIds, FF_GmuId_SessionIds>(FF_AppId_SessionIds.GIM); //byte b = 23; //FF_AppId_SessionIds ss3 = b.GetAppId<FF_GmuId_SessionIds, FF_AppId_SessionIds>(); }
public _ObjectWrapper() { #if NET4 MEFHelper.ComposeParts(this); #endif }