本文整理汇总了C#中ILog.WriteLine方法的典型用法代码示例。如果您正苦于以下问题:C# ILog.WriteLine方法的具体用法?C# ILog.WriteLine怎么用?C# ILog.WriteLine使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ILog
的用法示例。
在下文中一共展示了ILog.WriteLine方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: WriteStatistics
public virtual void WriteStatistics(ILog log)
{
log.WriteLine("");
log.WriteFixedLine('-');
log.WriteFixedLine("New files:", this._statistics.FileNotExistCount);
log.WriteFixedLine("Updated files:", this._statistics.UpdatedCount);
log.WriteFixedLine("Updated file dates:", this._statistics.UpdatedModifiedDateCount);
log.WriteFixedLine('-');
log.WriteLine("");
}
示例2: WriteStatistics
public void WriteStatistics(ILog log)
{
log.WriteLine("");
log.WriteFixedLine('-');
log.WriteFixedLine("New blobs:", this._statistics.BlobNotExistCount);
log.WriteFixedLine("Blobs updated:", this._statistics.UpdatedCount);
log.WriteFixedLine("Blob dates updated:", this._statistics.UpdatedModifiedDateCount);
log.WriteFixedLine("Blobs deleted:", this._statistics.FileNotExistCount);
log.WriteFixedLine('-');
log.WriteLine("");
}
示例3: PrintDependencySummary
private static void PrintDependencySummary(ILog logger, Dependency dependency) {
if (dependency.IsConflicted) {
if (dependency.IsMajorConflict) {
logger.WriteLine("***** Major Revision Conflict ***** ");
}
logger.WriteLine(@"{1} is referencing assembly {2}{0} Version being referenced {3}{0} Version in Lib {4}{0}",
Environment.NewLine,
dependency.ReferencingAssembly.Name,
dependency.ReferencedAssembly.Name,
dependency.ReferencedAssembly.Version,
dependency.LibAssembly.Version);
}
}
示例4: AddReader
public static void AddReader(ILog LogReader)
{
LogReaders.AddLast(LogReader);
lock (LogContent)
{
foreach (var LogLines in LogContent)
LogReader.WriteLine(LogLines);
}
}
示例5: PrintSummary
private static void PrintSummary(ILog logger, IEnumerable<Dependency> dependencies)
{
PrintHeading(logger, "Count of assemblies referenced");
var list = dependencies
.GroupBy(x => x.ReferencedAssembly.Name + "_" + x.ReferencedAssembly.Version)
.ToList();
foreach (IGrouping<string, Dependency> key in list)
{
logger.WriteLine(key.Key.PadRight(50) + key.Count());
}
PrintHeading(logger, "Incorrect Dependencies Summary");
foreach(var dependency in dependencies) {
PrintDependencySummary(logger, dependency);
}
}
示例6: PrintHeading
private static void PrintHeading(ILog logger, string text) {
logger.WriteLine("------------------------------------------");
logger.WriteLine(text);
logger.WriteLine("------------------------------------------");
}
示例7: Build
/// <summary>
/// Build the Schematic into a Circuit object.
/// </summary>
/// <param name="log"></param>
/// <returns></returns>
public Circuit Build(ILog log)
{
int errors = 0;
int warnings = 0;
log.WriteLine(MessageType.Info, "Building circuit...");
// Check for duplicate names.
foreach (string i in circuit.Components.Select(i => i.Name))
{
IEnumerable<Component> named = circuit.Components.Where(j => j.Name == i);
if (named.Count() > 1)
{
log.WriteLine(MessageType.Error, "Error: Name '{0}' is not unique", i);
foreach (Component j in named)
log.WriteLine(MessageType.Error, " " + j.ToString());
errors++;
}
}
// Check for unconnected terminals.
foreach (Component i in circuit.Components)
{
foreach (Terminal j in i.Terminals.Where(j => j.ConnectedTo == null))
{
Node dummy = new Node() { Name = "_x1" };
circuit.Nodes.Add(dummy);
j.ConnectedTo = dummy;
log.WriteLine(MessageType.Warning, "Warning: Unconnected terminal '{0}'", j.ToString());
warnings++;
}
}
// Check for error symbols.
foreach (Error i in circuit.Components.OfType<Error>())
{
log.WriteLine(MessageType.Error, "Error: {0}", i.Message);
errors++;
}
// Check for warning symbols.
foreach (Warning i in circuit.Components.OfType<Warning>())
{
log.WriteLine(MessageType.Warning, "Warning: {0}", i.Message);
warnings++;
}
// Check for deprecated symbols.
foreach (Component i in circuit.Components.Where(i => i.GetType().CustomAttribute<ObsoleteAttribute>() != null))
{
log.WriteLine(MessageType.Warning, "Warning: Use of deprecated symbol '{0}'", i.ToString());
warnings++;
}
log.WriteLine(MessageType.Info, "Build: {0} errors, {1} warnings", errors, warnings);
if (errors != 0)
throw new InvalidOperationException("Build failed");
else
return circuit;
}
示例8: Load
public static Schematic Load(string FileName, ILog Log)
{
XDocument doc = XDocument.Load(FileName);
Schematic S = Schematic.Deserialize(doc.Root, Log);
Log.WriteLine(MessageType.Info, "Schematic loaded from '" + FileName + "'");
S.LogComponents();
return S;
}
示例9: Solve
/// <summary>
/// Solve the circuit for transient simulation.
/// </summary>
/// <param name="Analysis">Analysis from the circuit to solve.</param>
/// <param name="TimeStep">Discretization timestep.</param>
/// <param name="Log">Where to send output.</param>
/// <returns>TransientSolution describing the solution of the circuit.</returns>
public static TransientSolution Solve(Analysis Analysis, Expression TimeStep, IEnumerable<Arrow> InitialConditions, ILog Log)
{
Expression h = TimeStep;
Log.WriteLine(MessageType.Info, "Building solution for h={0}", TimeStep.ToString());
// Analyze the circuit to get the MNA system and unknowns.
List<Equal> mna = Analysis.Equations.ToList();
List<Expression> y = Analysis.Unknowns.ToList();
LogExpressions(Log, MessageType.Verbose, "System of " + mna.Count + " equations and " + y.Count + " unknowns = {{ " + String.Join(", ", y) + " }}", mna);
// Evaluate for simulation functions.
// Define T = step size.
Analysis.Add("T", h);
// Define d[t] = delta function.
Analysis.Add(ExprFunction.New("d", Call.If((0 <= t) & (t < h), 1, 0), t));
// Define u[t] = step function.
Analysis.Add(ExprFunction.New("u", Call.If(t >= 0, 1, 0), t));
mna = mna.Resolve(Analysis).OfType<Equal>().ToList();
// Find out what variables have differential relationships.
List<Expression> dy_dt = y.Where(i => mna.Any(j => j.DependsOn(D(i, t)))).Select(i => D(i, t)).ToList();
// Find steady state solution for initial conditions.
List<Arrow> initial = InitialConditions.ToList();
Log.WriteLine(MessageType.Info, "Performing steady state analysis...");
SystemOfEquations dc = new SystemOfEquations(mna
// Derivatives, t, and T are zero in the steady state.
.Evaluate(dy_dt.Select(i => Arrow.New(i, 0)).Append(Arrow.New(t, 0), Arrow.New(T, 0)))
// Use the initial conditions from analysis.
.Evaluate(Analysis.InitialConditions)
// Evaluate variables at t=0.
.OfType<Equal>(), y.Select(j => j.Evaluate(t, 0)));
// Solve partitions independently.
foreach (SystemOfEquations i in dc.Partition())
{
try
{
List<Arrow> part = i.Equations.Select(j => Equal.New(j, 0)).NSolve(i.Unknowns.Select(j => Arrow.New(j, 0)));
initial.AddRange(part);
LogExpressions(Log, MessageType.Verbose, "Initial conditions:", part);
}
catch (Exception)
{
Log.WriteLine(MessageType.Warning, "Failed to find partition initial conditions, simulation may be unstable.");
}
}
// Transient analysis of the system.
Log.WriteLine(MessageType.Info, "Performing transient analysis...");
SystemOfEquations system = new SystemOfEquations(mna, dy_dt.Concat(y));
// Solve the diff eq for dy/dt and integrate the results.
system.RowReduce(dy_dt);
system.BackSubstitute(dy_dt);
IEnumerable<Equal> integrated = system.Solve(dy_dt)
.NDIntegrate(t, h, IntegrationMethod.Trapezoid)
// NDIntegrate finds y[t + h] in terms of y[t], we need y[t] in terms of y[t - h].
.Evaluate(t, t - h).Cast<Arrow>()
.Select(i => Equal.New(i.Left, i.Right)).Buffer();
system.AddRange(integrated);
LogExpressions(Log, MessageType.Verbose, "Integrated solutions:", integrated);
LogExpressions(Log, MessageType.Verbose, "Discretized system:", system.Select(i => Equal.New(i, 0)));
// Solving the system...
List<SolutionSet> solutions = new List<SolutionSet>();
// Partition the system into independent systems of equations.
foreach (SystemOfEquations F in system.Partition())
{
// Find linear solutions for y. Linear systems should be completely solved here.
F.RowReduce();
IEnumerable<Arrow> linear = F.Solve();
if (linear.Any())
{
linear = Factor(linear);
solutions.Add(new LinearSolutions(linear));
LogExpressions(Log, MessageType.Verbose, "Linear solutions:", linear);
}
// If there are any variables left, there are some non-linear equations requiring numerical techniques to solve.
if (F.Unknowns.Any())
{
// The variables of this system are the newton iteration updates.
List<Expression> dy = F.Unknowns.Select(i => NewtonIteration.Delta(i)).ToList();
// Compute JxF*dy + F(y0) == 0.
SystemOfEquations nonlinear = new SystemOfEquations(
F.Select(i => i.Gradient(F.Unknowns).Select(j => new KeyValuePair<Expression, Expression>(NewtonIteration.Delta(j.Key), j.Value))
//.........这里部分代码省略.........
示例10: LogList
// Logging helpers.
private static void LogList(ILog Log, MessageType Type, string Title, IEnumerable<string> List)
{
if (Log is NullLog) return;
if (List.Any())
{
Log.WriteLine(Type, Title);
Log.WriteLines(Type, List.Select(i => " " + i));
Log.WriteLine(Type, "");
}
}
示例11: AddReader
public static void AddReader(ILog LogReader)
{
LogReaders.AddLast(LogReader);
foreach (LogEntry LogLines in LogContent)
LogReader.WriteLine(LogLines);
}