// -- connstructor

        /// <summary>
        ///
        /// </summary>
        public BatteryPackSimulator()
        {
            _log  = LoggingProvider.CreateLogger <BatteryPackSimulator>();
            _args = new BatteryArgs();
        }
Esempio n. 2
0
 public void SetConfiguration(Configuration configuration)
 {
     Configuration = configuration ?? Configuration.Default();
     Logging       = new LoggingProvider(Configuration.Logger);
     InitializeHttpClient();
 }
Esempio n. 3
0
        // -- constructors

        public D3vS1mFactory() : base()
        {
            _log            = LoggingProvider.CreateLogger <D3vS1mFactory>();
            base.Simulators = new SimulatorRepository();
        }
Esempio n. 4
0
 private void SetupLogging()
 {
     loggingProvider             = (LoggingProvider)ObjectFactory.GetProvider <ILoggingProvider>();
     loggingProvider.OnLogEntry += OnLogEntry;
 }
Esempio n. 5
0
 public GitHubVersionChecker()
 {
     this._log = LoggingProvider.GetLogger <GitHubVersionChecker>();
 }
Esempio n. 6
0
 public AdaptedFriisSimulator(RuntimeBase runtime) : base(runtime)
 {
     _log = LoggingProvider.CreateLogger <SimulatorBase>();
 }
Esempio n. 7
0
 static BaseTest()
 {
     LoggingProvider.Use(LoggingProvider.ConsoleLoggingProvider);
 }
Esempio n. 8
0
 public BatteryPackSimulator(RuntimeBase runtime) : base(runtime)
 {
     _log = LoggingProvider.CreateLogger <BatteryPackSimulator>();
 }
Esempio n. 9
0
 public SphericAntennaSimulator(RuntimeBase runtime) : base(runtime)
 {
     _log = LoggingProvider.CreateLogger <SphericAntennaSimulator>();
 }
Esempio n. 10
0
 public IPagedCollection <LogEntry> GetPagedItems(int pageIndex, int pageSize)
 {
     return(LoggingProvider.Instance().GetPagedLogEntries(pageIndex, pageSize));
 }
Esempio n. 11
0
 public BusinessService(DataStoreProvider dataStoreProvider, LoggingProvider loggingProvider, WebServiceProvider webServiceProvider)
 {
     _dataStoreProvider  = dataStoreProvider;
     _loggingProvider    = loggingProvider;
     _webServiceProvider = webServiceProvider;
 }
Esempio n. 12
0
 public void IsCreate()
 {
     LoggingProvider.InitiateFolder();
 }
Esempio n. 13
0
        /// <summary>
        /// LogEnd logs the Application Start Event.
        /// </summary>
        public static void LogEnd()
        {
            try
            {
                ApplicationShutdownReason shutdownReason = HostingEnvironment.ShutdownReason;
                string shutdownDetail;
                switch (shutdownReason)
                {
                case ApplicationShutdownReason.BinDirChangeOrDirectoryRename:
                    shutdownDetail = "The AppDomain shut down because of a change to the Bin folder or files contained in it.";
                    break;

                case ApplicationShutdownReason.BrowsersDirChangeOrDirectoryRename:
                    shutdownDetail = "The AppDomain shut down because of a change to the App_Browsers folder or files contained in it.";
                    break;

                case ApplicationShutdownReason.ChangeInGlobalAsax:
                    shutdownDetail = "The AppDomain shut down because of a change to Global.asax.";
                    break;

                case ApplicationShutdownReason.ChangeInSecurityPolicyFile:
                    shutdownDetail = "The AppDomain shut down because of a change in the code access security policy file.";
                    break;

                case ApplicationShutdownReason.CodeDirChangeOrDirectoryRename:
                    shutdownDetail = "The AppDomain shut down because of a change to the App_Code folder or files contained in it.";
                    break;

                case ApplicationShutdownReason.ConfigurationChange:
                    shutdownDetail = "The AppDomain shut down because of a change to the application level configuration.";
                    break;

                case ApplicationShutdownReason.HostingEnvironment:
                    shutdownDetail = "The AppDomain shut down because of the hosting environment.";
                    break;

                case ApplicationShutdownReason.HttpRuntimeClose:
                    shutdownDetail = "The AppDomain shut down because of a call to Close.";
                    break;

                case ApplicationShutdownReason.IdleTimeout:
                    shutdownDetail = "The AppDomain shut down because of the maximum allowed idle time limit.";
                    break;

                case ApplicationShutdownReason.InitializationError:
                    shutdownDetail = "The AppDomain shut down because of an AppDomain initialization error.";
                    break;

                case ApplicationShutdownReason.MaxRecompilationsReached:
                    shutdownDetail = "The AppDomain shut down because of the maximum number of dynamic recompiles of resources limit.";
                    break;

                case ApplicationShutdownReason.PhysicalApplicationPathChanged:
                    shutdownDetail = "The AppDomain shut down because of a change to the physical path for the application.";
                    break;

                case ApplicationShutdownReason.ResourcesDirChangeOrDirectoryRename:
                    shutdownDetail = "The AppDomain shut down because of a change to the App_GlobalResources folder or files contained in it.";
                    break;

                case ApplicationShutdownReason.UnloadAppDomainCalled:
                    shutdownDetail = "The AppDomain shut down because of a call to UnloadAppDomain.";
                    break;

                default:
                    shutdownDetail = "Shutdown reason: " + shutdownReason;
                    break;
                }

                var log = new LogInfo
                {
                    BypassBuffering = true,
                    LogTypeKey      = EventLogType.APPLICATION_SHUTTING_DOWN.ToString(),
                };
                log.AddProperty("Shutdown Details", shutdownDetail);
                LogController.Instance.AddLog(log);

                // enhanced shutdown logging
                var runtime = typeof(HttpRuntime).InvokeMember(
                    "_theRuntime",
                    BindingFlags.NonPublic | BindingFlags.Static | BindingFlags.GetField,
                    null,
                    null,
                    null) as HttpRuntime;

                if (runtime == null)
                {
                    Logger.InfoFormat("Application shutting down. Reason: {0}", shutdownDetail);
                }
                else
                {
                    var shutDownMessage = runtime.GetType().InvokeMember(
                        "_shutDownMessage",
                        BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.GetField,
                        null,
                        runtime,
                        null) as string;

                    var shutDownStack = runtime.GetType().InvokeMember(
                        "_shutDownStack",
                        BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.GetField,
                        null,
                        runtime,
                        null) as string;

                    Logger.Info("Application shutting down. Reason: " + shutdownDetail
                                + Environment.NewLine + "ASP.NET Shutdown Info: " + shutDownMessage
                                + Environment.NewLine + shutDownStack);
                }
            }
            catch (Exception exc)
            {
                Exceptions.LogException(exc);
            }

            var status = Globals.DependencyProvider.GetRequiredService <IApplicationStatusInfo>().Status;

            if (status != UpgradeStatus.Install)
            {
                // purge log buffer
                LoggingProvider.Instance().PurgeLogBuffer();
            }
        }
Esempio n. 14
0
        // -- constructors

        public AdaptedFriisSimulator()
        {
            _log  = LoggingProvider.CreateLogger <AdaptedFriisSimulator>();
            _args = new AdaptedFriisArgs();
        }
Esempio n. 15
0
        // -- constructor

        protected RuntimeBase()
        {
            _log     = LoggingProvider.CreateLogger <RuntimeBase>();
            _simRepo = new SimulatorRepository();
        }
 private void btnClearLog_Click(object sender, EventArgs e)
 {
     LoggingProvider.Instance().ClearLog();
     resultsPager.PageIndex = 0; //Back to first page.
     BindList();
 }
Esempio n. 17
0
        // -- constructor

        protected RuntimeBase()
        {
            _log = LoggingProvider.CreateLogger <RuntimeBase>();
            BindSimulators(new SimulatorRepository());
            Started += OnStart;
        }
Esempio n. 18
0
        /// -----------------------------------------------------------------------------
        /// <summary>
        /// LogEnd logs the Application Start Event
        /// </summary>
        /// -----------------------------------------------------------------------------
        public static void LogEnd()
        {
            try
            {
                ApplicationShutdownReason shutdownReason = HostingEnvironment.ShutdownReason;
                string shutdownDetail;
                switch (shutdownReason)
                {
                case ApplicationShutdownReason.BinDirChangeOrDirectoryRename:
                    shutdownDetail = "The AppDomain shut down because of a change to the Bin folder or files contained in it.";
                    break;

                case ApplicationShutdownReason.BrowsersDirChangeOrDirectoryRename:
                    shutdownDetail = "The AppDomain shut down because of a change to the App_Browsers folder or files contained in it.";
                    break;

                case ApplicationShutdownReason.ChangeInGlobalAsax:
                    shutdownDetail = "The AppDomain shut down because of a change to Global.asax.";
                    break;

                case ApplicationShutdownReason.ChangeInSecurityPolicyFile:
                    shutdownDetail = "The AppDomain shut down because of a change in the code access security policy file.";
                    break;

                case ApplicationShutdownReason.CodeDirChangeOrDirectoryRename:
                    shutdownDetail = "The AppDomain shut down because of a change to the App_Code folder or files contained in it.";
                    break;

                case ApplicationShutdownReason.ConfigurationChange:
                    shutdownDetail = "The AppDomain shut down because of a change to the application level configuration.";
                    break;

                case ApplicationShutdownReason.HostingEnvironment:
                    shutdownDetail = "The AppDomain shut down because of the hosting environment.";
                    break;

                case ApplicationShutdownReason.HttpRuntimeClose:
                    shutdownDetail = "The AppDomain shut down because of a call to Close.";
                    break;

                case ApplicationShutdownReason.IdleTimeout:
                    shutdownDetail = "The AppDomain shut down because of the maximum allowed idle time limit.";
                    break;

                case ApplicationShutdownReason.InitializationError:
                    shutdownDetail = "The AppDomain shut down because of an AppDomain initialization error.";
                    break;

                case ApplicationShutdownReason.MaxRecompilationsReached:
                    shutdownDetail = "The AppDomain shut down because of the maximum number of dynamic recompiles of resources limit.";
                    break;

                case ApplicationShutdownReason.PhysicalApplicationPathChanged:
                    shutdownDetail = "The AppDomain shut down because of a change to the physical path for the application.";
                    break;

                case ApplicationShutdownReason.ResourcesDirChangeOrDirectoryRename:
                    shutdownDetail = "The AppDomain shut down because of a change to the App_GlobalResources folder or files contained in it.";
                    break;

                case ApplicationShutdownReason.UnloadAppDomainCalled:
                    shutdownDetail = "The AppDomain shut down because of a call to UnloadAppDomain.";
                    break;

                default:
                    shutdownDetail = "No shutdown reason provided.";
                    break;
                }
                var log = new LogInfo
                {
                    BypassBuffering = true,
                    LogTypeKey      = EventLogController.EventLogType.APPLICATION_SHUTTING_DOWN.ToString()
                };
                log.AddProperty("Shutdown Details", shutdownDetail);
                LogController.Instance.AddLog(log);

                Logger.InfoFormat("Application shutting down. Reason: {0}", shutdownDetail);
            }
            catch (Exception exc)
            {
                Exceptions.LogException(exc);
            }
            if (Globals.Status != Globals.UpgradeStatus.Install)
            {
                //purge log buffer
                LoggingProvider.Instance().PurgeLogBuffer();
            }
        }
Esempio n. 19
0
        // -- methods

        public ObjReader(string file)
        {
            _log  = LoggingProvider.CreateLogger <ObjReader>();
            _file = file;
        }
Esempio n. 20
0
        private void Initialize()
        {
            LoggingProviderSection loggingConfig = null;
            // 找到配置文件中“LoggingProvider”节点
            loggingConfig = ConfigurationManager.GetSection(sectionName) as LoggingProviderSection;
            if (loggingConfig == null)
                return;

            providers = new LoggingProviderCollection();

            // 使用System.Web.Configuration.ProvidersHelper类调用每个Provider的Initialize()方法
            ProvidersHelper.InstantiateProviders(loggingConfig.Providers, providers, typeof(LoggingProvider));

            // 所用的Provider为配置中默认的Provider
            defaultProvider = providers[loggingConfig.DefaultProvider] as LoggingProvider;
            urlLogProvider = providers[loggingConfig.UrlLogProvider] as LoggingProvider;
            dataLogProvider = providers[loggingConfig.DataLogProvider] as LoggingProvider;
        }
        public ScriptManager(LoggingProvider logger, SoftwareConfiguration configuration)
        {
            if (logger == null)
            {
                throw new ArgumentNullException(nameof(logger));
            }
            if (configuration == null)
            {
                throw new ArgumentNullException(nameof(configuration));
            }


            for (int i = 0; i < 8; i++)
            {
                channels.Add(new VolumeChannel("XXX", "XXX", logger));
            }


            try
            {
                // TODO: consider using the advice in https://github.com/Microsoft/ClearScript/issues/65 instead of using WeakReferences.

                WeakReference <List <Channel> > weakChannelList = new WeakReference <List <Channel> >(channels);

                _engine.AddHostObject("host", new ExtendedHostFunctions());

                _engine.AddHostObject("AddVolumeChannel", (Func <int, String, String, int>)((int c, String displayName, String exeSuffix) => {
                    List <Channel> localChannels;
                    if (weakChannelList.TryGetTarget(out localChannels))
                    {
                        localChannels[c] = new VolumeChannel(displayName, exeSuffix, logger);
                    }
                    return(0);
                }));

                _engine.AddHostType("ScriptChannelCallback", typeof(ScriptChannelCallback));
                _engine.AddHostObject("AddScriptChannelInternal", (Func <int, ScriptChannelCallback, ScriptChannel>)((int c, ScriptChannelCallback config) => {
                    ScriptChannel nc;
                    ScriptChannel dv = ScriptChannel.ConstructForScript(config, out nc);
                    List <Channel> localChannels;
                    if (weakChannelList.TryGetTarget(out localChannels))
                    {
                        localChannels[c] = nc;
                    }
                    return(dv);
                }));

                _engine.Execute("builtin.js", Software.Properties.Resources.BuiltInScript);

                if (!File.Exists(configuration.ConfigFilePath))
                {
                    File.WriteAllText(configuration.ConfigFilePath, Software.Properties.Resources.DefaultConfigScript);
                }

                _engine.Execute(configuration.ConfigFilePath, File.ReadAllText(configuration.ConfigFilePath));
            }
            catch (ScriptEngineException e)
            {
                MessageBox.Show(e.ErrorDetails, "Error executing config.js", MessageBoxButtons.OK);
                throw e;
            }
        }