• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# LoggerResult类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中LoggerResult的典型用法代码示例。如果您正苦于以下问题:C# LoggerResult类的具体用法?C# LoggerResult怎么用?C# LoggerResult使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



LoggerResult类属于命名空间,在下文中一共展示了LoggerResult类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: SettingsGroup

 public SettingsGroup()
 {
     defaultProfile = new SettingsProfile(this, null);
     profileList.Add(defaultProfile);
     currentProfile = defaultProfile;
     Logger = new LoggerResult();
 }
开发者ID:robterrell,项目名称:paradox,代码行数:7,代码来源:SettingsGroup.cs


示例2: RunProcessAndRedirectToLogger

        public static int RunProcessAndRedirectToLogger(string command, string parameters, string workingDirectory, LoggerResult logger)
        {
            var process = new Process
            {
                StartInfo = new ProcessStartInfo(command)
                {
                    UseShellExecute = false,
                    CreateNoWindow = true,
                    RedirectStandardError = true,
                    RedirectStandardOutput = true,
                    WorkingDirectory = workingDirectory,
                    Arguments = parameters,
                }
            };

            process.Start();

            DataReceivedEventHandler outputDataReceived = (_, args) => LockProcessAndAddDataToLogger(process, logger, false, args);
            DataReceivedEventHandler errorDataReceived = (_, args) => LockProcessAndAddDataToLogger(process, logger, true, args);

            process.OutputDataReceived += outputDataReceived;
            process.ErrorDataReceived += errorDataReceived;
            process.BeginOutputReadLine();
            process.BeginErrorReadLine();
            process.WaitForExit();
            process.CancelOutputRead();
            process.CancelErrorRead();

            process.OutputDataReceived -= outputDataReceived;
            process.ErrorDataReceived -= errorDataReceived;

            return process.ExitCode;
        }
开发者ID:cg123,项目名称:xenko,代码行数:33,代码来源:ShellHelper.cs


示例3: SettingsContainer

 public SettingsContainer()
 {
     rootProfile = new SettingsProfile(this, null);
     profileList.Add(rootProfile);
     currentProfile = rootProfile;
     Logger = new LoggerResult();
 }
开发者ID:releed,项目名称:paradox,代码行数:7,代码来源:SettingsContainer.cs


示例4: Test

        public void Test()
        {
            var logger = new LoggerResult();
            var context = new AssetMigrationContext(null, logger);

            var files = Directory.EnumerateFiles(@"..\..\samples", "*.xkscene", SearchOption.AllDirectories);

            foreach (var sceneFile in files)
            {
                logger.HasErrors = false;
                logger.Clear();
                Console.WriteLine($"Checking file {sceneFile}");

                var file = new PackageLoadingAssetFile(sceneFile, null);

                var needMigration = AssetMigration.MigrateAssetIfNeeded(context, file, "Xenko");

                foreach (var message in logger.Messages)
                {
                    Console.WriteLine(message);
                }

                Assert.False(logger.HasErrors);

                if (needMigration)
                {
                    var result = Encoding.UTF8.GetString(file.AssetContent);
                    Console.WriteLine(result);

                    // We cannot load the Package here, as the package can use code/scripts that are only available when you actually compile project assmeblies
                }
            }
        }
开发者ID:psowinski,项目名称:xenko,代码行数:33,代码来源:TestSceneUpgrader.cs


示例5: CreateBuilder

 public static Builder CreateBuilder()
 {
     var logger = new LoggerResult();
     logger.ActivateLog(LogMessageType.Debug);
     var builder = new Builder(BuildPath, "Windows", "index", logger) { BuilderName = "TestBuilder", SlaveBuilderPath = @"SiliconStudio.BuildEngine.exe" };
     return builder;
 }
开发者ID:jiangzi,项目名称:paradox,代码行数:7,代码来源:Utils.cs


示例6: Run

 /// <summary>
 /// Performs a wide package validation analysis.
 /// </summary>
 /// <returns>Result of the validation.</returns>
 public LoggerResult Run()
 {
     if (packageSession == null) throw new InvalidOperationException("packageSession is null");
     var results = new LoggerResult();
     Run(results);
     return results;
 }
开发者ID:h78hy78yhoi8j,项目名称:xenko,代码行数:11,代码来源:PackageSessionAnalysisBase.cs


示例7: Execute

        public override bool Execute()
        {
            var result = new LoggerResult();
            var package = Package.Load(result, File.ItemSpec, new PackageLoadParameters()
                {
                    AutoCompileProjects = false,
                    LoadAssemblyReferences = false,
                    AutoLoadTemporaryAssets = false,
                });

            foreach (var message in result.Messages)
            {
                if (message.Type >= LogMessageType.Error)
                {
                    Log.LogError(message.ToString());
                }
                else if (message.Type == LogMessageType.Warning)
                {
                    Log.LogWarning(message.ToString());
                }
                else
                {
                    Log.LogMessage(message.ToString());
                }
            }

            // If we have errors loading the package, exit
            if (result.HasErrors)
            {
                return false;
            }

            Version = package.Meta.Version.ToString();
            return true;
        }
开发者ID:joewan,项目名称:xenko,代码行数:35,代码来源:PackageGetVersionTask.cs


示例8: FixAssetReferences

 public static LoggerResult FixAssetReferences(IEnumerable<AssetItem> items)
 {
     var parameters = new AssetAnalysisParameters() { IsProcessingAssetReferences = true, IsLoggingAssetNotFoundAsError =  true};
     var result = new LoggerResult();
     Run(items, result, parameters);
     return result;
 }
开发者ID:h78hy78yhoi8j,项目名称:xenko,代码行数:7,代码来源:AssetAnalysis.cs


示例9: CreateBuilder

 public static Builder CreateBuilder(bool createIndexFile)
 {
     var logger = new LoggerResult();
     logger.ActivateLog(LogMessageType.Debug);
     var indexName = createIndexFile ? VirtualFileSystem.ApplicationDatabaseIndexName : null;
     var builder = new Builder(logger, BuildPath, "Windows", indexName) { BuilderName = "TestBuilder", SlaveBuilderPath = @"SiliconStudio.BuildEngine.exe" };
     return builder;
 }
开发者ID:RainsSoft,项目名称:paradox,代码行数:8,代码来源:Utils.cs


示例10: Run

        public static LoggerResult Run(IEnumerable<AssetItem> items, AssetAnalysisParameters parameters)
        {
            if (items == null) throw new ArgumentNullException("items");
            if (parameters == null) throw new ArgumentNullException("parameters");

            var result = new LoggerResult();
            Run(items, result, parameters);
            return result;
        }
开发者ID:h78hy78yhoi8j,项目名称:xenko,代码行数:9,代码来源:AssetAnalysis.cs


示例11: PackageStore

        /// <summary>
        /// Initializes a new instance of the <see cref="PackageStore"/> class.
        /// </summary>
        /// <exception cref="System.InvalidOperationException">Unable to find a valid Xenko installation path</exception>
        private PackageStore(string installationPath = null, string defaultPackageName = "Xenko", string defaultPackageVersion = XenkoVersion.CurrentAsText)
        {
            // TODO: these are currently hardcoded to Xenko
            DefaultPackageName = defaultPackageName;
            DefaultPackageVersion = new PackageVersion(defaultPackageVersion);
            defaultPackageDirectory = DirectoryHelper.GetPackageDirectory(defaultPackageName);
   
            // 1. Try to use the specified installation path
            if (installationPath != null)
            {
                if (!DirectoryHelper.IsInstallationDirectory(installationPath))
                {
                    throw new ArgumentException("Invalid Xenko installation path [{0}]".ToFormat(installationPath), "installationPath");
                }

                globalInstallationPath = installationPath;
            }

            // 2. Try to resolve an installation path from the path of this assembly
            // We need to be able to use the package manager from an official Xenko install as well as from a developer folder
            if (globalInstallationPath == null)
            {
                globalInstallationPath = DirectoryHelper.GetInstallationDirectory(DefaultPackageName);
            }

            // If there is no root, this is an error
            if (globalInstallationPath == null)
            {
                throw new InvalidOperationException("Unable to find a valid Xenko installation or dev path");
            }

            // Preload default package
            var logger = new LoggerResult();
            var defaultPackageFile = DirectoryHelper.GetPackageFile(defaultPackageDirectory, DefaultPackageName);
            defaultPackage = Package.Load(logger, defaultPackageFile, GetDefaultPackageLoadParameters());
            if (defaultPackage == null)
            {
                throw new InvalidOperationException("Error while loading default package from [{0}]: {1}".ToFormat(defaultPackageFile, logger.ToText()));
            }
            defaultPackage.IsSystem = true;

            // A flag variable just to know if it is a bare bone development directory
            isDev = defaultPackageDirectory != null && DirectoryHelper.IsRootDevDirectory(defaultPackageDirectory);

            // Check if we are in a root directory with store/packages facilities
            if (NugetStore.IsStoreDirectory(globalInstallationPath))
            {
                packagesDirectory = UPath.Combine(globalInstallationPath, (UDirectory)NugetStore.DefaultGamePackagesDirectory);
                store = new NugetStore(globalInstallationPath);
            }
            else
            {
                // We should exit from here if NuGet is not configured.
                MessageBox.Show($"Unexpected installation. Cannot find a proper NuGet configuration for [{defaultPackageName}] in [{globalInstallationPath}]", "Installation Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                Environment.Exit(1);
            }
        }
开发者ID:cg123,项目名称:xenko,代码行数:61,代码来源:PackageStore.cs


示例12: Generate

        /// <summary>
        /// Generates this project template to the specified output directory.
        /// </summary>
        /// <param name="outputDirectory">The output directory.</param>
        /// <param name="projectName">Name of the project.</param>
        /// <param name="projectGuid">The project unique identifier.</param>
        /// <param name="options">The options arguments that will be made available through the Session property in each template.</param>
        /// <returns>LoggerResult.</returns>
        /// <exception cref="System.ArgumentNullException">outputDirectory
        /// or
        /// projectName</exception>
        /// <exception cref="System.InvalidOperationException">FilePath cannot be null on this instance</exception>
        public LoggerResult Generate(string outputDirectory, string projectName, Guid projectGuid, Dictionary<string, object> options = null)
        {
            if (outputDirectory == null) throw new ArgumentNullException("outputDirectory");
            if (projectName == null) throw new ArgumentNullException("projectName");
            if (FilePath == null) throw new InvalidOperationException("FilePath cannot be null on this instance");

            var result = new LoggerResult();
            Generate(outputDirectory, projectName, projectGuid, result, options);
            return result;
        }
开发者ID:Powerino73,项目名称:paradox,代码行数:22,代码来源:ProjectTemplate.cs


示例13: AssetToImportMergeGroup

 internal AssetToImportMergeGroup(AssetToImportByImporter parent, AssetItem item)
 {
     if (parent == null) throw new ArgumentNullException("parent");
     if (item == null) throw new ArgumentNullException("item");
     this.Parent = parent;
     Item = item;
     Merges = new List<AssetToImportMerge>();
     Enabled = true;
     var assetDescription = DisplayAttribute.GetDisplay(item.Asset.GetType());
     Log = new LoggerResult(string.Format("Import {0} {1}", assetDescription != null ? assetDescription.Name : "Asset" , item));
 }
开发者ID:h78hy78yhoi8j,项目名称:xenko,代码行数:11,代码来源:AssetToImportMergeGroup.cs


示例14: AssetToImportByImporter

 internal AssetToImportByImporter(AssetToImport parent, IAssetImporter importer, AssetItem previousItem = null)
 {
     if (parent == null) throw new ArgumentNullException("parent");
     if (importer == null) throw new ArgumentNullException("importer");
     this.Parent = parent;
     this.importer = importer;
     this.Items = new List<AssetToImportMergeGroup>();
     Enabled = true;
     Log = new LoggerResult(string.Format("{0} Importer", importer.Name));
     ImporterParameters = importer.GetDefaultParameters(previousItem != null);
     ImporterParameters.Logger = Log;
     PreviousItem = previousItem;
 }
开发者ID:Powerino73,项目名称:paradox,代码行数:13,代码来源:AssetToImportByImporter.cs


示例15: Init

        public void Init()
        {
            // Create and mount database file system
            var objDatabase = new ObjectDatabase("/data/db", "index", "/local/db");
            var databaseFileProvider = new DatabaseFileProvider(objDatabase);
            AssetManager.GetFileProvider = () => databaseFileProvider;

            Compiler = new EffectCompiler();
            Compiler.SourceDirectories.Add("shaders");
            MixinParameters = new ShaderMixinParameters();
            MixinParameters.Add(CompilerParameters.GraphicsPlatformKey, GraphicsPlatform.Direct3D11);
            MixinParameters.Add(CompilerParameters.GraphicsProfileKey, GraphicsProfile.Level_11_0);
            ResultLogger = new LoggerResult();
        }
开发者ID:Powerino73,项目名称:paradox,代码行数:14,代码来源:TestShaderMixer2.cs


示例16: Init

        public void Init()
        {
            // Create and mount database file system
            var objDatabase = ObjectDatabase.CreateDefaultDatabase();
            var databaseFileProvider = new DatabaseFileProvider(objDatabase);
            ContentManager.GetFileProvider = () => databaseFileProvider;

            Compiler = new EffectCompiler();
            Compiler.SourceDirectories.Add("shaders");
            MixinParameters = new CompilerParameters();
            MixinParameters.EffectParameters.Platform = GraphicsPlatform.Direct3D11;
            MixinParameters.EffectParameters.Profile = GraphicsProfile.Level_11_0;
            ResultLogger = new LoggerResult();
        }
开发者ID:Kryptos-FR,项目名称:xenko-reloaded,代码行数:14,代码来源:TestShaderMixer2.cs


示例17: Main

        private static int Main(string[] args)
        {
            Console.WriteLine(@"Bootstrapping: " + args[0]);

            var xenkoDir = Environment.GetEnvironmentVariable("SiliconStudioXenkoDir");
            var xenkoPkgPath = UPath.Combine(xenkoDir, new UFile("Xenko.xkpkg"));

            var session = PackageSession.Load(xenkoPkgPath);

            var generator = TemplateSampleGenerator.Default;

            var logger = new LoggerResult();

            var parameters = new TemplateGeneratorParameters { Session = session.Session };

            var outputPath = UPath.Combine(new UDirectory(xenkoDir), new UDirectory("samplesGenerated"));
            outputPath = UPath.Combine(outputPath, new UDirectory(args[0]));

            var xenkoTemplates = session.Session.Packages.First().Templates;
            parameters.Description = xenkoTemplates.First(x => x.Group.StartsWith("Samples") && x.Id == new Guid(args[1]));
            parameters.Name = args[0];
            parameters.Namespace = args[0];
            parameters.OutputDirectory = outputPath;
            parameters.Logger = logger;

            generator.Generate(parameters);

            var updaterTemplate = xenkoTemplates.First(x => x.FullPath.ToString().EndsWith("UpdatePlatforms.xktpl"));
            parameters.Description = updaterTemplate;

            var updater = UpdatePlatformsTemplateGenerator.Default;

            var gameSettingsAsset = session.Session.Packages.Last().GetGameSettingsAsset();

            var updateParams = new GameTemplateParameters
            {
                Common = parameters,
                ForcePlatformRegeneration = true,
                GraphicsProfile = gameSettingsAsset.DefaultGraphicsProfile,
                IsHDR = false,
                Orientation = gameSettingsAsset.DisplayOrientation,
                Platforms = AssetRegistry.SupportedPlatforms.ToList()
            };

            updater.Generate(updateParams);

            Console.WriteLine(logger.ToText());

            return logger.HasErrors ? 1 : 0;
        }
开发者ID:h78hy78yhoi8j,项目名称:xenko,代码行数:50,代码来源:Program.cs


示例18: UpdateReflection

        private void UpdateReflection(ShaderBytecode shaderBytecode, EffectReflection effectReflection, LoggerResult log)
        {
            var shaderReflectionRaw = new SharpDX.D3DCompiler.ShaderReflection(shaderBytecode);
            var shaderReflectionRawDesc = shaderReflectionRaw.Description;

            // Constant Buffers
            for (int i = 0; i < shaderReflectionRawDesc.ConstantBuffers; ++i)
            {
                var constantBufferRaw = shaderReflectionRaw.GetConstantBuffer(i);
                var constantBufferRawDesc = constantBufferRaw.Description;
                var linkBuffer = effectReflection.ConstantBuffers.FirstOrDefault(buffer => buffer.Name == constantBufferRawDesc.Name && buffer.Stage == ShaderStage.None);

                var constantBuffer = GetConstantBufferReflection(constantBufferRaw, ref constantBufferRawDesc, linkBuffer, log);
                constantBuffer.Stage = shaderBytecode.Stage;
                effectReflection.ConstantBuffers.Add(constantBuffer);
            }

            // BoundResources
            for (int i = 0; i < shaderReflectionRawDesc.BoundResources; ++i)
            {
                var boundResourceDesc = shaderReflectionRaw.GetResourceBindingDescription(i);

                string linkKeyName = null;
                foreach (var linkResource in effectReflection.ResourceBindings)
                {
                    if (linkResource.Param.RawName == boundResourceDesc.Name && linkResource.Stage == ShaderStage.None)
                    {
                        linkKeyName = linkResource.Param.KeyName;
                        break;
                    }

                }

                if (linkKeyName == null)
                {
                    log.Error("Resource [{0}] has no link", boundResourceDesc.Name);
                }
                else
                {

                    var binding = GetResourceBinding(boundResourceDesc, linkKeyName, log);
                    binding.Stage = shaderBytecode.Stage;

                    effectReflection.ResourceBindings.Add(binding);
                }
            }
        }
开发者ID:Powerino73,项目名称:paradox,代码行数:47,代码来源:ShaderCompiler.cs


示例19: TestLocalLogger

        public void TestLocalLogger()
        {
            var log = new LoggerResult();

            log.Info("#0");
            Assert.That(log.Messages.Count, Is.EqualTo(1));
            Assert.That(log.Messages[0].Type, Is.EqualTo(LogMessageType.Info));
            Assert.That(log.Messages[0].Text, Is.EqualTo("#0"));

            log.Info("#{0}", 1);
            Assert.That(log.Messages.Count, Is.EqualTo(2));
            Assert.That(log.Messages[1].Type, Is.EqualTo(LogMessageType.Info));
            Assert.That(log.Messages[1].Text, Is.EqualTo("#1"));

            Assert.That(log.HasErrors, Is.False);

            log.Error("#2");
            Assert.That(log.Messages.Count, Is.EqualTo(3));
            Assert.That(log.Messages[2].Type, Is.EqualTo(LogMessageType.Error));
            Assert.That(log.Messages[2].Text, Is.EqualTo("#2"));

            Assert.That(log.HasErrors, Is.True);

            log.Error("#{0}", 3);
            Assert.That(log.Messages.Count, Is.EqualTo(4));
            Assert.That(log.Messages[3].Type, Is.EqualTo(LogMessageType.Error));
            Assert.That(log.Messages[3].Text, Is.EqualTo("#3"));

            // Activate log from Info to Fatal. Verbose won't be logged.
            log.ActivateLog(LogMessageType.Info);
            log.Verbose("#4");
            Assert.That(log.Messages.Count, Is.EqualTo(4));

            // Activate log from Verbose to Fatal. Verbose will be logged
            log.ActivateLog(LogMessageType.Verbose);
            log.Verbose("#4");
            Assert.That(log.Messages.Count, Is.EqualTo(5));

            // Activate log from Info to Fatal and only Debug. Verbose won't be logged.
            log.ActivateLog(LogMessageType.Info);
            log.ActivateLog(LogMessageType.Debug, true);
            log.Verbose("#5");
            log.Debug("#6");
            Assert.That(log.Messages.Count, Is.EqualTo(6));
            Assert.That(log.Messages[5].Text, Is.EqualTo("#6"));
        }
开发者ID:cg123,项目名称:xenko,代码行数:46,代码来源:TestLogger.cs


示例20: Execute

        public override bool Execute()
        {

            var result = new LoggerResult();
            var package = Package.Load(result, File.ItemSpec, new PackageLoadParameters()
                {
                    AutoCompileProjects = false,
                    LoadAssemblyReferences = false,
                    AutoLoadTemporaryAssets = false,
                });

            foreach (var message in result.Messages)
            {
                if (message.Type >= LogMessageType.Error)
                {
                    Log.LogError(message.ToString());
                }
                else if (message.Type == LogMessageType.Warning)
                {
                    Log.LogWarning(message.ToString());
                }
                else
                {
                    Log.LogMessage(message.ToString());
                }
            }

            // If we have errors loading the package, exit
            if (result.HasErrors)
            {
                return false;
            }

            // Override version with task SpecialVersion (if specified by user)
            if (!string.IsNullOrEmpty(SpecialVersion))
            {
                package.Meta.Version = new PackageVersion(package.Meta.Version.Version, SpecialVersion);
            }

            Log.LogMessage(MessageImportance.High, "Packaging [{0}] version [{1}]", package.Meta.Name, package.Meta.Version);

            // Build the package
            PackageArchive.Build(package);
            return true;
        }
开发者ID:joewan,项目名称:xenko,代码行数:45,代码来源:PackageArchiveTask.cs



注:本文中的LoggerResult类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# LoggerVerbosity类代码示例发布时间:2022-05-24
下一篇:
C# LoggerLevel类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap