本文整理汇总了C#中LoggerResult类的典型用法代码示例。如果您正苦于以下问题:C# LoggerResult类的具体用法?C# LoggerResult怎么用?C# LoggerResult使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
LoggerResult类属于命名空间,在下文中一共展示了LoggerResult类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SettingsGroup
public SettingsGroup()
{
defaultProfile = new SettingsProfile(this, null);
profileList.Add(defaultProfile);
currentProfile = defaultProfile;
Logger = new LoggerResult();
}
示例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;
}
示例3: SettingsContainer
public SettingsContainer()
{
rootProfile = new SettingsProfile(this, null);
profileList.Add(rootProfile);
currentProfile = rootProfile;
Logger = new LoggerResult();
}
示例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
}
}
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}
}
示例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;
}
示例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));
}
示例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;
}
示例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();
}