private static void OnLoadedCommandChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            ModuleProc PROC = new ModuleProc("FrameworkElementBehaviors", "OnLoadedCommandChanged");

            try
            {
                FrameworkElement fe = d as FrameworkElement;
                if (fe != null)
                {
                    fe.Loaded += (s, a) =>
                    {
                        ICommand cmd = e.NewValue as ICommand;
                        if (cmd != null &&
                            cmd.CanExecute(fe))
                        {
                            cmd.Execute(fe);
                        }
                    };
                }
            }
            catch (Exception ex)
            {
                Log.Exception(PROC, ex);
            }
        }
Exemplo n.º 2
0
        internal bool Parse_configurationInfo_getDenomination(s2sMessage target, DLDenominationCollectionDto collection)
        {
            ModuleProc PROC = new ModuleProc(this.DYN_MODULE_NAME, "Parse_configurationInfo_getDenomination");
            bool result = default(bool);

            try
            {
                configurationInfo ci = target.p_body.p_configuration.p_configurationInfo;
                if (collection != null)
                {
                    List<denomination> denominations = new List<denomination>();
                    foreach (var dto in collection)
                    {
                        denominations.Add(new denomination()
                        {
                            denominationId = dto.DenominationId,
                            denominationName = dto.DenominationName,
                            denominationValue = dto.DenominationValue,
                            denominationActive = dto.IsActive,
                        });
                    }
                    ci.denomination = denominations.ToArray();
                    result = true;
                }
            }
            catch (Exception ex)
            {
                Log.Exception(PROC, ex);
            }

            return result;
        }
        private void AddDefaultServiceBehaviors()
        {
            ModuleProc PROC = new ModuleProc("ExOneServiceHost", "AddDefaultServiceBehaviors");

            try
            {
                // ServiceMetadataBehavior
                _serviceMetadata = this.Description.Behaviors.Find<ServiceMetadataBehavior>();
                if (_serviceMetadata == null)
                {
                    _serviceMetadata = new ServiceMetadataBehavior();
                    this.Description.Behaviors.Add(_serviceMetadata);
                }
                _serviceMetadata.HttpGetEnabled = false;
                //bServiceMetadata.HttpGetUrl = uriHttp;                            

                // ServiceDebugBehavior
                ServiceDebugBehavior bServiceDebug = this.Description.Behaviors.Find<ServiceDebugBehavior>();
                if (bServiceDebug == null)
                {
                    bServiceDebug = new ServiceDebugBehavior();
                    this.Description.Behaviors.Add(bServiceDebug);
                }
                bServiceDebug.IncludeExceptionDetailInFaults = false;
            }
            catch (Exception ex)
            {
                Log.Exception(PROC, ex);
            }
        }
        public MessageQueueWorkerInfo(int messageThreshold, int queueThreshold, bool flushItemsBeforeClose, MessageQueueInfo[] queueInfos)
        {
            ModuleProc PROC = new ModuleProc(this.DYN_MODULE_NAME, ".ctor");

            try
            {
                this.MessageThreshold = messageThreshold;
                this.QueueThreshold = queueThreshold;
                this.FlushItemsBeforeClose = flushItemsBeforeClose;
                if (queueInfos == null)
                {
                    this.QueueInfos = new List<MessageQueueInfo>();
                }
                else
                {
                    this.QueueInfos = new List<MessageQueueInfo>(queueInfos);
                }

                Log.InfoV(PROC, "Message Threshold : {0:D}", messageThreshold);
            }
            catch (Exception ex)
            {
                Log.Exception(PROC, ex);
            }
        }
        public Message ProcessMessaage(Message request)
        {
            ModuleProc PROC = new ModuleProc(this.DYN_MODULE_NAME, "ProcessMessage");
            Message result = default(Message);
            IRequestChannel channel = null;

            try
            {
                channel = _factory.CreateChannel(this.TargetFinder.GetAddress(request));
                channel.Open();
                result = channel.Request(request);
            }
            catch (Exception ex)
            {
                Log.Exception(PROC, ex);
            }
            finally
            {
                if (channel != null && channel.State == CommunicationState.Opened)
                {
                    channel.Close();
                }
            }

            return result;
        }
        private void AddImportedSchemas(XmlSchema schema, XmlSchemaSet schemaSet, List<XmlSchema> importsList)
        {
            ModuleProc PROC = new ModuleProc(this.DYN_MODULE_NAME, "AddImportedSchemas");

            try
            {
                foreach (XmlSchemaImport import in schema.Includes)
                {
                    ICollection realSchemas = schemaSet.Schemas(import.Namespace);

                    foreach (XmlSchema ixsd in realSchemas)
                    {
                        if (!importsList.Contains(ixsd))
                        {
                            importsList.Add(ixsd);
                            AddImportedSchemas(ixsd, schemaSet, importsList);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Log.Exception(PROC, ex);
            }
        }
        public void Save(bool rollback)
        {
            ModuleProc PROC = new ModuleProc(this.DYN_MODULE_NAME, "SaveChanges");

            try
            {
                if (_scope != null)
                {
                    if (!rollback)
                    {
                        _scope.Complete();
                    }
                    else
                    {
                        Transaction.Current.Rollback();
                    }
                }
            }
            catch (Exception ex)
            {
                Log.Exception(PROC, ex);
            }
            finally
            {
                if (_scope != null)
                {
                    _scope.Dispose();
                }
            }
        }
        void AppNotifyService_NotifyData(object sender, AppNotifyDataEventArgs e)
        {
            ModuleProc PROC = new ModuleProc("AppNotifyService", "Subscribe");

            try
            {
                if (((ICommunicationObject)_callback).State == CommunicationState.Opened)
                {
                    try
                    {
                        _callback.NotifyData(e.Data);
                    }
                    catch
                    {
                        this.Unsubscribe();
                    }
                }
                else
                {
                    this.Unsubscribe();
                }
            }
            catch (Exception ex)
            {
                Log.Exception(PROC, ex);
                this.Unsubscribe();
            }
        }
Exemplo n.º 9
0
        internal bool Parse_configurationInfo_getGame(s2sMessage target, DLGameCollectionDto collection)
        {
            ModuleProc PROC = new ModuleProc(this.DYN_MODULE_NAME, "Parse_configurationInfo_getGame");
            bool result = default(bool);

            try
            {
                configurationInfo ci = target.p_body.p_configuration.p_configurationInfo;
                if (collection != null)
                {
                    List<game> Games = new List<game>();
                    foreach (var dto in collection)
                    {
                        Games.Add(new game()
                        {
                            gameId = dto.GameID.ToStringSafe(),
                            gameName = dto.GameName,
                            gameActive = dto.IsActive,
                        });
                    }
                    ci.game = Games.ToArray();
                    result = true;
                }
            }
            catch (Exception ex)
            {
                Log.Exception(PROC, ex);
            }

            return result;
        }
        internal static string GetMessage(int index)
        {
            ModuleProc PROC = new ModuleProc("", "GetMessage");
            string result = default(string);

            try
            {
                if (index > 0)
                {
                    int newIndex = (index % _displayMessages.Length);
                    if (newIndex >= 0 && newIndex < _displayMessages.Length)
                    {
                        result = _displayMessages[newIndex];
                    }
                }

                if(result.IsEmpty())
                {
                    result = _displayMessages[9];
                }
            }
            catch (Exception ex)
            {
                Log.Exception(PROC, ex);
            }

            return result;
        }
Exemplo n.º 11
0
        public bool Add(string settingName, string settingValue)
        {
            ModuleProc PROC = new ModuleProc(this.DYN_MODULE_NAME, "AddIfNotExists");
            bool result = false;

            try
            {
                using (Database db = this.DataManager.Connect())
                {
                    DbParameter[] parameters = db.CreateParametersV(
                                db.CreateParameter("@SettingName", settingName),
                                db.CreateParameter("@SettingValue", settingValue)
                            );
                    result = (db.ExecuteNonQuery(CommandType.Text, QUERY_INSERT_RECORD, parameters) > 0);
                }
            }
            catch (Exception ex)
            {
                Log.Exception(PROC, ex);
            }
            finally
            {
                if (result)
                    Log.InfoV(PROC, "Data with Hash code {0} was inserted into GIM Information ({1}).", settingName, (result ? "Success" : "Failure"));
            }

            return result;
        }
Exemplo n.º 12
0
        internal bool Parse_configurationInfo_getGame(s2sMessage target, XElement source)
        {
            ModuleProc PROC = new ModuleProc(this.DYN_MODULE_NAME, "Parse_configurationInfo_getGame");
            bool result = default(bool);

            try
            {
                if (source != null)
                {
                    var elements = source.GetElements("Game");
                    if (elements != null)
                    {
                        foreach (var element in elements)
                        {
                            game_infoUpdate dto = new game_infoUpdate();
                            dto.gameId = element.GetElementValue("GameID");
                            result = this.AddObjectToInfoUpdateData<game_infoUpdate>(target, dto);
                            break;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Log.Exception(PROC, ex);
            }

            return result;
        }
        public bool UpdateMessageHistory(bool logMessage, int fromSystem, int toSystem, string siteCode, DateTime dateTime,
                                            int refID, string request, string response)
        {
            ModuleProc PROC = new ModuleProc(this.DYN_MODULE_NAME, "UpdateMessageHistory");
            bool result = default(bool);
            if (!logMessage) return true;

            try
            {
                
                using (Database db = DbFactory.OpenDB(_connectionString))
                {
                    db.Open();
                    DbParameter[] parameters = db.CreateParameters(8);
                    parameters[0] = db.CreateParameter("@EBS_FromSystem", fromSystem);
                    parameters[1] = db.CreateParameter("@EBS_ToSystem", toSystem);
                    parameters[2] = db.CreateParameter("@EBS_SiteCode", DbType.AnsiString, 50, siteCode);
                    parameters[3] = db.CreateParameter("@EBS_DateTime", dateTime);
                    parameters[4] = db.CreateParameter("@EBS_RefID", refID);
                    parameters[5] = db.CreateParameter("@EBS_Request", request);
                    parameters[6] = db.CreateParameter("@EBS_Response", response);

                    parameters[7] = db.CreateRetValueParameter(DbType.Int32);
                    result = db.ExecuteNonQueryAndReturnIntOK("[dbo].[usp_EBS_InsertMessageHistory]", parameters);
                }
            }
            catch (Exception ex)
            {
                Log.Exception(PROC, ex);
            }

            return result;
        }
        public void StopMonitoring()
        {
            ModuleProc PROC = new ModuleProc(this.DYN_MODULE_NAME, "StopMonitoring");

            try
            {
                if (_fileMonitor != null)
                {
                    lock (_lock)
                    {
                        if (_fileMonitor != null)
                        {
                            _fileMonitor.EnableRaisingEvents = false;
                            _fileMonitor.Changed -= (OnFileMonitor_Changed);
                            _fileMonitor.Dispose();
                            _fileMonitor = null;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Log.Exception(PROC, ex);
            }
        }
        public void Start()
        {
            ModuleProc PROC = new ModuleProc(this.DYN_MODULE_NAME, "Start");

            try
            {
                this.PopulateCache(true);

                if (_fileMonitor == null)
                {
                    lock (_lock)
                    {
                        if (_fileMonitor == null)
                        {
                            _fileMonitor = new FileSystemWatcher();
                            _fileMonitor.Path = Path.GetDirectoryName(_config.FilePath);
                            _fileMonitor.Filter = Path.GetFileName(_config.FilePath);
                            _fileMonitor.EnableRaisingEvents = true;
                            _fileMonitor.NotifyFilter = NotifyFilters.LastWrite;
                            _fileMonitor.Changed += new FileSystemEventHandler(OnFileMonitor_Changed);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Log.Exception(PROC, ex);
            }
        }
        private void OnReceiveMessages()
        {
            ModuleProc PROC = new ModuleProc(this.DYN_MODULE_NAME, "OnReceiveMessages");

            try
            {
                while (!this.ExecutorService.WaitForShutdown())
                {
                    try
                    {
                        AppNotifyData data = _queue.Dequeue();
                        if (data != null && _callback != null)
                        {
                            _callback.NotifyData(data);
                        }
                    }
                    catch (Exception ex)
                    {
                        Log.Exception(PROC, ex);
                    }
                }
            }
            catch (Exception ex)
            {
                Log.Exception(PROC, ex);
            }
            finally
            {
                this.Shutdown();
            }
        }
        internal bool Parse_configurationInfo_getManufacturer(s2sMessage target, DLManufacturerCollectionDto collection)
        {
            ModuleProc PROC = new ModuleProc(this.DYN_MODULE_NAME, "Parse_configurationInfo_getManufacturer");
            bool result = default(bool);

            try
            {
                configurationInfo ci = target.p_body.p_configuration.p_configurationInfo;
                if (collection != null)
                {
                    List<manufacturer> manufacturers = new List<manufacturer>();
                    foreach (var dto in collection)
                    {
                        manufacturers.Add(new manufacturer()
                        {
                            manufacturerId = dto.ManufacturerId.ToString(),
                            manufacturerName = dto.ManufacturerName,
                            manufacturerValue = dto.ManufacturerValue,
                            manufacturerActive = dto.IsActive,
                        });
                    }
                    ci.manufacturer = manufacturers.ToArray();
                    result = true;
                }
            }
            catch (Exception ex)
            {
                Log.Exception(PROC, ex);
            }

            return result;
        }
        public MessageQueueInfo(string servicePath, bool isTransactional,
            IMessageFormatter formatter, int queueTimeout,
            KeyValuePair<string, IMessageFormatter>[] messageFormatters)
        {
            ModuleProc PROC = new ModuleProc(this.DYN_MODULE_NAME, ".ctor");

            try
            {
                this.ServicePath = servicePath;
                this.IsTransactional = isTransactional;
                this.Formatter = formatter;
                this.QueueTimeout = queueTimeout;
                if (messageFormatters != null)
                {
                    this.MessageFormatters = new SortedDictionary<string, IMessageFormatter>(StringComparer.InvariantCultureIgnoreCase);
                    foreach (KeyValuePair<string, IMessageFormatter> messageFormatter in messageFormatters)
                    {
                        this.MessageFormatters.Add(messageFormatter);
                    }
                }

                Log.InfoV(PROC, "Service Path : {0}, Is Transactional : {1}", servicePath, isTransactional);
            }
            catch (Exception ex)
            {
                Log.Exception(PROC, ex);
            }
        }
Exemplo n.º 19
0
        internal bool Parse_configurationInfo_getSite(s2sMessage target, DLSiteCollectionDto collection)
        {
            ModuleProc PROC = new ModuleProc(this.DYN_MODULE_NAME, "Parse_getConfiguration");
            bool result = default(bool);

            try
            {
                configurationInfo ci = target.p_body.p_configuration.p_configurationInfo;
                if (collection != null)
                {
                    List<casino> Casinos = new List<casino>();
                    foreach (var dto in collection)
                    {
                        Casinos.Add(new casino()
                        {
                            casinoId = dto.SiteId,
                            casinoName = dto.SiteName,
                            casinoActive = dto.IsActive
                        });
                    }
                    ci.casino = Casinos.ToArray();
                    result = true;
                }
            }
            catch (Exception ex)
            {
                Log.Exception(PROC, ex);
            }

            return result;
        }
        private void Start(string baseAddress, string path)
        {
            ModuleProc PROC = new ModuleProc(this.DYN_MODULE_NAME, "Start");

            try
            {
                if (_host == null)
                {
                    lock (_lock)
                    {
                        if (_host == null)
                        {
                            // Binding
                            NetTcpBinding binding = AppNotifyServiceHelper.CreateBinding();

                            // Host
                            Uri uriTcp = new Uri(new Uri(Uri.UriSchemeNetTcp + "://" + baseAddress), path);
                            //Uri uriHttp = new Uri(new Uri(Uri.UriSchemeHttp + "://" + baseAddress), path);
                            _host = new WcfServiceHost(typeof(AppNotifyService), _knownTypes, new Uri[] { uriTcp });

                            // ServiceMetadataBehavior
                            ServiceMetadataBehavior bServiceMetadata = _host.Description.Behaviors.Find<ServiceMetadataBehavior>();
                            if (bServiceMetadata == null)
                            {
                                bServiceMetadata = new ServiceMetadataBehavior();
                                _host.Description.Behaviors.Add(bServiceMetadata);
                            }
                            bServiceMetadata.HttpGetEnabled = false;
                            //bServiceMetadata.HttpGetUrl = uriHttp;                            

                            // ServiceDebugBehavior
                            ServiceDebugBehavior bServiceDebug = _host.Description.Behaviors.Find<ServiceDebugBehavior>();
                            if (bServiceDebug == null)
                            {
                                bServiceDebug = new ServiceDebugBehavior();
                                _host.Description.Behaviors.Add(bServiceDebug);
                            }
                            bServiceDebug.IncludeExceptionDetailInFaults = false;

                            // service points
                            _host.AddServiceEndpoint(typeof(IAppNotifyService), binding, string.Empty);
                            _host.AddServiceEndpoint(typeof(IMetadataExchange), MetadataExchangeBindings.CreateMexTcpBinding(), "mex");
                        }
                    }
                }

                if (_host != null &&
                    _host.State == CommunicationState.Created)
                {
                    _host.Open();
                    Log.InfoV(PROC, "Service started at : {0}", _host.BaseAddresses[0]);
                    _mreShutdown.Reset();
                }
            }
            catch (Exception ex)
            {
                Log.Exception(PROC, ex);
            }
        }
Exemplo n.º 21
0
 /// <summary>
 /// Writes the log exception.
 /// </summary>
 /// <param name="owner">The owner.</param>
 /// <param name="proc">Module procedure name.</param>
 /// <param name="ex">The ex.</param>
 public static void WriteLogException(this DisposableObjectLogger owner, ModuleProc proc, Exception ex)
 {
     if (owner.Logger == null)
     {
         return;
     }
     owner.Logger.WriteLogException(proc, ex);
 }
Exemplo n.º 22
0
 /// <summary>
 /// Writes the log warning.
 /// </summary>
 /// <param name="owner">The owner.</param>
 /// <param name="proc">Module procedure name.</param>
 /// <param name="message">The message.</param>
 public static void WriteLogWarning(this DisposableObjectLogger owner, ModuleProc proc, string message)
 {
     if (owner.Logger == null)
     {
         return;
     }
     owner.Logger.WriteLogWarning(proc, message);
 }
 void OnTransceiver_Receive(UdpFreeformEntity item)
 {
     using (ModuleProc PROC = new ModuleProc(this.DYN_MODULE_NAME, "ff_trans_Receive"))
     {
         Log.Info(PROC, "Processing G2H Message ...");
         ExCommsExecutorFactory.ProcessMessage(item.EntityData as FFMsg_G2H);
     }
 }
        public void ParseAnyElements()
        {
            ModuleProc PROC = new ModuleProc("", "ParseAnyElements");

            try
            {
                if (this.Any == null || this.Any.Length == 0) return;

                foreach (var item in this.Any)
                {
                    if (item.NamespaceURI == s2sHelper.NS_BS2S)
                    {
                        try
                        {
                            XElement xElm = XElement.Parse(item.OuterXml);

                            switch (item.LocalName.ToLower())
                            {
                                case "getcasino":
                                    {
                                        getConfigurationGetCasino o = new getConfigurationGetCasino();
                                        o.casinoId = xElm.GetAttributeValue("casinoId", s2sHelper.NS_BS2S);
                                        this.getCasino = new getConfigurationGetCasino[] { o };
                                    }
                                    break;

                                case "getdenomination":
                                    {
                                        getConfigurationGetDenomination o = new getConfigurationGetDenomination();
                                        o.denomId = xElm.GetAttributeValue("denomId", s2sHelper.NS_BS2S);
                                        this.getDenomination = new getConfigurationGetDenomination[] { o };
                                    }
                                    break;

                                case "getmanufacturer":
                                    {
                                        getConfigurationGetManufacturer o = new getConfigurationGetManufacturer();
                                        o.manufacturerId = xElm.GetAttributeValue("manufacturerId", s2sHelper.NS_BS2S);
                                        this.getManufacturer = new getConfigurationGetManufacturer[] { o };
                                    }
                                    break;

                                default:
                                    break;
                            }
                        }
                        catch (Exception ex)
                        {
                            Log.Exception(PROC, ex);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Log.Exception(PROC, ex);
            }
        }
        /// <summary>
        /// Initializes this instance.
        /// </summary>
        private void Initialize()
        {
            ModuleProc PROC = new ModuleProc(this.DYN_MODULE_NAME, "Initialize");

            try
            {
                if (_servicePath.IsEmpty())
                {
                    Log.Info(PROC, "Message queue path was empty. Unable to proceeed further.");
                    return;
                }

                int timeout = Math.Max(5000, Extensions.GetAppSettingValueInt("MessageQueueFailedTimeout", 10000));
                bool isSuccess = false;
                while (!isSuccess)
                {
                    try
                    {
                        if (this.ExecutorService.IsShutdown) break;

                        if (MessageQueue.Exists(_servicePath))
                        {
                            _innerQueue = new MessageQueue(_servicePath, false, false, QueueAccessMode.SendAndReceive);
                        }
                        else
                        {
                            _innerQueue = MessageQueue.Create(_servicePath, _isTransactional);
                            _innerQueue.SetPermissions("EVERYONE", MessageQueueAccessRights.FullControl);
                        }

                        isSuccess = true;
                        Log.InfoV(PROC, "Message queue object for queue [{0}] was created successfully.", _servicePath);
                        //_innerQueue.Formatter = _formatter;
                    }
                    catch (Exception ex)
                    {
                        Log.Exception(PROC, ex);
                        _innerQueue = null;
                        Thread.Sleep(timeout); 
                    }
                }
            }
            catch (Exception ex)
            {
                Log.Exception(PROC, ex);
            }
            finally
            {
                if (_innerQueue != null)
                {
                    if (!_innerQueue.CanRead)
                    {
                        Log.InfoV(PROC, "Message queue ({0}) was not allowed to read. Unable to proceeed further.", _servicePath);
                        Extensions.DisposeObject(ref _innerQueue);
                    }
                }
            }
        }
 protected override bool ConnectInternal(ModuleProc PROC, System.Net.EndPoint remoteEndpoint)
 {
     _handler = new TcpClient(AddressFamily.InterNetwork);
     _handler.SendTimeout = this.SendTimeout;
     _handler.ReceiveTimeout = this.ReceiveTimeout;
     _handler.Connect(_remoteEndPoint as IPEndPoint);
     _localEndPoint = _handler.Client.LocalEndPoint;
     _socket = _handler.Client;
     this.WriteSocketLog("has been connected successfully.");
     return true;
 }
        /// <summary>
        /// Creates the message.
        /// </summary>
        /// <param name="filePath">The file path.</param>
        /// <returns>Polled Event message.</returns>
        public static PolledEventMessage CreateMessage(string filePath)
        {
            if (!File.Exists(filePath)) return null;
            ModuleProc PROC = new ModuleProc("PolledEventMessage", "CreateMessage");
            PolledEventMessage result = default(PolledEventMessage);
            MemoryStream ms = null;
            Encoding unicode = Encoding.Unicode;

            try
            {
                using (FileStream fs = File.Open(filePath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
                {
                    StreamReader sr = new StreamReader(fs);

                    int actualLength = (int)fs.Length;
                    int desiredLength = (int)fs.Length;

                    if (sr.CurrentEncoding != Encoding.Unicode)
                    {
                        desiredLength *= 2;
                    }

                    fs.Position = 0;
                    char[] originalData = sr.ReadToEnd().ToCharArray();
                    byte[] copiedData = new byte[desiredLength];

                    fs.Position = 0;
                    unicode.GetBytes(originalData, 0, actualLength, copiedData, 0);

                    ms = new MemoryStream(copiedData);
                    sr.Close();
                }

                if (ms != null)
                {
                    result = ParseMessage(ms, Encoding.Unicode);
                }
            }
            catch (Exception ex)
            {
                Log.Exception(PROC, ex);
            }
            finally
            {
                if (ms != null)
                {
                    ms.Close();
                    Extensions.DisposeObject(ref ms);
                }
            }

            return result;
        }
        public void Unsubscribe()
        {
            ModuleProc PROC = new ModuleProc("AppNotifyService", "Subscribe");

            try
            {
                NotifyData -= new EventHandler<AppNotifyDataEventArgs>(AppNotifyService_NotifyData);
            }
            catch (Exception ex)
            {
                Log.Exception(PROC, ex);
            }
        }
Exemplo n.º 29
0
        public void Intialize()
        {
            ModuleProc PROC = new ModuleProc(this.DYN_MODULE_NAME, "Initialize");

            try
            {
                this.InitializeInternal();
            }
            catch (Exception ex)
            {
                Log.Exception(PROC, ex);
            }
        }
Exemplo n.º 30
0
        /// <summary>
        /// Runs this instance.
        /// </summary>
        public void Run()
        {
            ModuleProc PROC = new ModuleProc(this.DYN_MODULE_NAME, "Run");

            try
            {
                this.RunInternal();
            }
            catch (Exception ex)
            {
                Log.Exception(PROC, ex);
            }            
        }
        private void Initialize()
        {
            ModuleProc PROC = new ModuleProc(this.DYN_MODULE_NAME, "Initialize");

            try
            {
                _isLoaded = true;
            }
            catch (Exception ex)
            {
                Log.Exception(PROC, ex);
            }
        }
        /// <summary>
        /// Called when service host opened.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        private void OnWebServiceHost_Opened(object sender, EventArgs e)
        {
            ModuleProc PROC = new ModuleProc("WcfWebServiceHostBase", "OnWebServiceHost_Opened");

            ServiceHostBase host = sender as ServiceHostBase;
            if (host != null &&
                host.ChannelDispatchers != null)
            {
                foreach (ChannelDispatcher cdisp in host.ChannelDispatchers)
                {
                    Log.Info(PROC, "Listen Uri : " + cdisp.Listener.Uri.AbsoluteUri);
                }
            }
        }
        public virtual void CloseSslStream()
        {
            BMC.CoreLib.Diagnostics.ModuleProc PROC = new BMC.CoreLib.Diagnostics.ModuleProc(this.DYN_MODULE_NAME, "CloseSslStream");

            try
            {
                if (_sslStream != null)
                {
                    _sslStream.Close();
                    _sslStream = null;
                }
            }
            catch (Exception ex)
            {
                BMC.CoreLib.Log.Exception(PROC, ex);
            }
        }
        public System.Net.Security.SslStream GetSslStream(string targetHost, X509CertificateCollection clientCertificates)
        {
            BMC.CoreLib.Diagnostics.ModuleProc PROC = new BMC.CoreLib.Diagnostics.ModuleProc(this.DYN_MODULE_NAME, "GetSslStream");

            try
            {
                if (!this.EnsureConnectionEstablished())
                {
                    this.WriteSocketLog("Unable to establish the connection.");
                    return(null);
                }
                else
                {
                    if (_sslStream != null)
                    {
                        return(_sslStream);
                    }
                }

                NetworkStream ns = new NetworkStream(this.InternalSocket, true);
                if (this.RemoteCertificateValidation != null)
                {
                    _sslStream = new SslStream(ns, false, this.RemoteCertificateValidation, null);
                }
                else
                {
                    _sslStream = new SslStream(ns, false);
                }

                _sslStream.AuthenticateAsClient(targetHost, clientCertificates, this.SslProtocol, false);
            }
            catch (Exception ex)
            {
                BMC.CoreLib.Log.Exception(PROC, ex);
                this.Stop();
            }

            return(_sslStream);
        }
Exemplo n.º 35
0
 protected override bool DisconnectInternal(BMC.CoreLib.Diagnostics.ModuleProc PROC)
 {
     throw new NotImplementedException();
 }
Exemplo n.º 36
0
 protected override bool ConnectInternal(BMC.CoreLib.Diagnostics.ModuleProc PROC, EndPoint remoteEndpoint)
 {
     throw new NotImplementedException();
 }
Exemplo n.º 37
0
 /// <summary>
 /// Writes the log exception.
 /// </summary>
 /// <param name="proc">Module procedure name.</param>
 /// <param name="ex">The ex.</param>
 public void WriteLogException(ModuleProc proc, Exception ex)
 {
     this.WriteLogException(proc.Module, proc.Procedure, ex);
 }
Exemplo n.º 38
0
 /// <summary>
 /// Writes the log exception.
 /// </summary>
 /// <param name="proc">Module procedure name.</param>
 /// <param name="message">The message.</param>
 public void WriteLogException(ModuleProc proc, string message)
 {
     this.WriteLogException(proc.Module, proc.Procedure, message);
 }
Exemplo n.º 39
0
 /// <summary>
 /// Writes the log warning.
 /// </summary>
 /// <param name="proc">Module procedure name.</param>
 /// <param name="message">The message.</param>
 public void WriteLogWarning(ModuleProc proc, string message)
 {
     this.WriteLogWarning(proc.Module, proc.Procedure, message);
 }
Exemplo n.º 40
0
 protected override int ReadInternal(BMC.CoreLib.Diagnostics.ModuleProc PROC, byte[] buffer, int offset, int size)
 {
     return(0);
 }