Esempio n. 1
0
        private IAssemblyInfo ReadConfiguration()
        {
            var h5Options    = H5Options;
            var location     = h5Options.ProjectLocation;
            var configReader = new AssemblyConfigHelper();

            return(configReader.ReadConfig(location, h5Options.ProjectProperties.Configuration));
        }
Esempio n. 2
0
        internal virtual void ApplyProjectPropertiesToConfig()
        {
            Logger.ZLogTrace("ApplyProjectPropertiesToConfig...");

            var configReader = new AssemblyConfigHelper();

            configReader.ApplyTokens(AssemblyInfo, ProjectProperties);

            Logger.ZLogTrace("ApplyProjectPropertiesToConfig done");
        }
Esempio n. 3
0
        internal virtual void ApplyProjectPropertiesToConfig()
        {
            this.Log.Trace("ApplyProjectPropertiesToConfig...");

            var configReader = new AssemblyConfigHelper(this.Log);

            configReader.ApplyTokens(this.AssemblyInfo, this.ProjectProperties);

            this.Log.Trace("ApplyProjectPropertiesToConfig done");
        }
Esempio n. 4
0
        private IAssemblyInfo ReadConfiguration()
        {
            var bridgeOptions = this.BridgeOptions;

            var logger = this.Logger;

            var location = bridgeOptions.IsFolderMode ? bridgeOptions.Folder : bridgeOptions.ProjectLocation;

            var configReader = new AssemblyConfigHelper(logger);

            return(configReader.ReadConfig(bridgeOptions.IsFolderMode, location, bridgeOptions.ProjectProperties.Configuration));
        }
Esempio n. 5
0
        private IAssemblyInfo ReadConfiguration()
        {
            var bridgeOptions = this.BridgeOptions;

            var logger = this.Logger;

            var location = bridgeOptions.IsFolderMode ? bridgeOptions.Folder : bridgeOptions.ProjectLocation;

            try
            {
                var configReader = new AssemblyConfigHelper(logger);

                return(configReader.ReadConfig(bridgeOptions.IsFolderMode, location, bridgeOptions.Configuration));
            }
            catch (Exception ex)
            {
                Console.WriteLine("Could not read configuration: " + ex.ToString());
            }

            return(null);
        }
Esempio n. 6
0
        protected virtual void BuildAssemblyLocation(XDocument doc)
        {
            this.Log.Trace("BuildAssemblyLocation...");

            if (string.IsNullOrEmpty(this.AssemblyLocation))
            {
                this.Configuration = this.Configuration ?? "Debug";
                this.Platform      = this.Platform ?? "AnyCPU";
                var outputPath = this.GetOutputPath(doc, this.Configuration, this.Platform);

                if (string.IsNullOrEmpty(outputPath.Item2))
                {
                    this.Configuration = "Release";
                    outputPath         = this.GetOutputPath(doc, this.Configuration, this.Platform);
                }

                this.AssemblyName     = this.GetAssemblyName(doc);
                this.AssemblyLocation = Path.Combine(outputPath.Item2, this.AssemblyName + ".dll");

                if (!File.Exists(this.AssemblyLocation) && !this.Rebuild)
                {
                    this.Configuration    = "Release";
                    outputPath            = this.GetOutputPath(doc, this.Configuration, this.Platform);
                    this.AssemblyLocation = Path.Combine(outputPath.Item2, this.AssemblyName + ".dll");
                }

                this.OutputPath = outputPath.Item1;
            }

            this.Log.Info("    Configuration:" + this.Configuration);
            this.Log.Info("    OutputPath:" + this.OutputPath);
            this.Log.Info("    AssemblyLocation:" + this.AssemblyLocation);

            var configReader = new AssemblyConfigHelper(this.Log);

            configReader.ApplyTokens(this.AssemblyInfo, this.OutputPath);

            this.Log.Trace("BuildAssemblyLocation done");
        }
Esempio n. 7
0
        private bool SetLoggerConfigurationParameters()
        {
            var logger         = this.Logger;
            var bridgeOptions  = this.BridgeOptions;
            var assemblyConfig = this.TranslatorConfiguration;

            if (bridgeOptions.NoLoggerSetUp)
            {
                return(true);
            }

            logger.Info("Applying logger configuration parameters...");

            logger.Name = bridgeOptions.Name;

            if (!string.IsNullOrEmpty(logger.Name))
            {
                logger.Info("Logger name: " + logger.Name);
            }

            var loggerLevel = assemblyConfig.Logging.Level ?? LoggerLevel.None;

            logger.Info("Logger level: " + loggerLevel);

            if (loggerLevel <= LoggerLevel.None)
            {
                logger.Info("To enable further logging use configuration setting \"logging\" in bridge.json. See http://bridge.net/docs/global-configuration/#logging");
            }

            try
            {
                logger.LoggerLevel = loggerLevel;

                logger.Info("Read config file: " + AssemblyConfigHelper.ConfigToString(assemblyConfig));

                logger.BufferedMode = false;

                if (bridgeOptions.NoTimeStamp.HasValue)
                {
                    logger.UseTimeStamp = !bridgeOptions.NoTimeStamp.Value;
                }
                else if (assemblyConfig.Logging.TimeStamps.HasValue)
                {
                    logger.UseTimeStamp = assemblyConfig.Logging.TimeStamps.Value;
                }
                else
                {
                    logger.UseTimeStamp = true;
                }

                var fileLoggerWriter = logger.GetFileLogger();

                if (fileLoggerWriter != null)
                {
                    var logFileFolder = assemblyConfig.Logging.Folder;
                    if (string.IsNullOrWhiteSpace(logFileFolder))
                    {
                        logFileFolder = this.GetOutputFolder(false, false);
                    }
                    else if (!Path.IsPathRooted(logFileFolder))
                    {
                        logFileFolder = Path.Combine(this.GetOutputFolder(true, false), logFileFolder);
                    }

                    fileLoggerWriter.SetParameters(logFileFolder, assemblyConfig.Logging.FileName, assemblyConfig.Logging.MaxSize);
                }

                logger.Flush();

                logger.Info("Setting logger configuration parameters done");

                return(true);
            }
            catch (Exception ex)
            {
                Console.WriteLine("Could not read configuration: " + ex.ToString());
            }

            return(false);
        }
Esempio n. 8
0
            public void TestFixtureSetUp()
            {
                var logger = Substitute.For <ILogger>();

                this.Helper = new AssemblyConfigHelper(logger);
            }
Esempio n. 9
0
        private void SetLoggerConfigurationParameters()
        {
            var logger         = this.Logger;
            var bridgeOptions  = this.BridgeOptions;
            var assemblyConfig = this.TranslatorConfiguration;

            if (bridgeOptions.NoLoggerSetUp)
            {
                return;
            }

            logger.Trace("Applying logger configuration parameters...");

            logger.Name = bridgeOptions.Name;

            if (!string.IsNullOrEmpty(logger.Name))
            {
                logger.Trace("Logger name: " + logger.Name);
            }

            var loggerLevel = assemblyConfig.Logging.Level ?? LoggerLevel.None;

            logger.Trace("Logger level: " + loggerLevel);

            if (loggerLevel <= LoggerLevel.None)
            {
                logger.Info("    To enable detailed logging, configure \"logging\" in bridge.json.");
                logger.Info("    https://github.com/bridgedotnet/Bridge/wiki/global-configuration#logging");
            }

            logger.LoggerLevel = loggerLevel;

            logger.Trace("Read config file: " + AssemblyConfigHelper.ConfigToString(assemblyConfig));

            logger.BufferedMode = false;

            if (bridgeOptions.NoTimeStamp.HasValue)
            {
                logger.UseTimeStamp = !bridgeOptions.NoTimeStamp.Value;
            }
            else if (assemblyConfig.Logging.TimeStamps.HasValue)
            {
                logger.UseTimeStamp = assemblyConfig.Logging.TimeStamps.Value;
            }
            else
            {
                logger.UseTimeStamp = true;
            }

            var fileLoggerWriter = logger.GetFileLogger();

            if (fileLoggerWriter != null)
            {
                string logFileFolder = GetLoggerFolder(assemblyConfig);

                fileLoggerWriter.SetParameters(logFileFolder, assemblyConfig.Logging.FileName, assemblyConfig.Logging.MaxSize);
            }

            logger.Flush();

            logger.Trace("Setting logger configuration parameters done");
        }
Esempio n. 10
0
        protected virtual IAssemblyInfo ReadConfig()
        {
            var config = AssemblyConfigHelper.ReadConfig(this.FolderMode, this.Location);

            return(config);
        }