public ActionResult SetConfiguration([FromBody] ConfigureRequest model)
        {
            m_Logger.Info($"[PUT] {APIRoutes.ConfigurationRoute}");
            if (string.IsNullOrWhiteSpace(model.ManagementInformationPath))
            {
                m_Logger.Debug("Required parameter ManagementInformationPath is null, empty or whitespace");
                return(BadRequest());
            }

            if (!Directory.Exists(model.ManagementInformationPath))
            {
                m_Logger.Debug($"Required parameter ManagementInformationPath point to path that doesn't exist: {model.ManagementInformationPath}");
                return(BadRequest());
            }

            m_Manager.ManagementInformationPath = model.ManagementInformationPath;

            m_MemoryCache.Set(CacheKeys.ManagementInformationKey, model.ManagementInformationPath);
            return(Ok());
        }
Exemplo n.º 2
0
        private TimeSpan RunActionWithTimings(String name, Action action)
        {
            var sw = new Stopwatch();

            m_Logger.Debug("> start running action: {0}", name);

            sw.Start();
            action();
            sw.Stop();

            m_Logger.Debug(string.Empty);
            m_Logger.Debug("> action has finised and took:");
            m_Logger.Debug(">> Complete {0} ticks", sw.ElapsedTicks);

            var timespan = TimeSpan.FromMilliseconds(sw.ElapsedMilliseconds);

            m_Logger.Debug(">> {0:00}:{1:00}:{2:00}.{3:000}",
                           timespan.Hours,
                           timespan.Minutes,
                           timespan.Seconds,
                           timespan.Milliseconds);

            m_Logger.Debug(string.Empty);

            return(timespan);
        }