本文整理汇总了C#中System.StringBuilder.AppendLine方法的典型用法代码示例。如果您正苦于以下问题:C# StringBuilder.AppendLine方法的具体用法?C# StringBuilder.AppendLine怎么用?C# StringBuilder.AppendLine使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.StringBuilder
的用法示例。
在下文中一共展示了StringBuilder.AppendLine方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetUsage
public string GetUsage()
{
var usage = new StringBuilder();
usage.AppendLine("Process Scheduler");
usage.AppendLine("-i, --input [filename]");
return usage.ToString();
}
示例2: Script
public ActionResult Script()
{
StringBuilder sb = new StringBuilder();
Dictionary<string, object> clientValidationRules = this.GetClientValidationRules();
sb.AppendLine("(function () {");
sb.AppendLine(String.Format("\tMilkshake.clientValidationRules = {0};", JsonConvert.SerializeObject(clientValidationRules)));
sb.AppendLine("})();");
return Content(sb.ToString(), "text/javascript");
}
开发者ID:martinnormark,项目名称:aspnet-mvc-client-validation-bridge,代码行数:11,代码来源:ClientValidationRulesController.cs
示例3: SerialiseToRibbonXml
public string SerialiseToRibbonXml()
{
/*
* <MenuSection Id="dev1.ApplicationRibbon.Section11.Section" Sequence="10" DisplayMode="Menu16">
<Controls Id="dev1.ApplicationRibbon.Section11.Section.Controls">
<Button Id="dev1.ApplicationRibbon.Button11.Button" LabelText="$LocLabels:dev1.ApplicationRibbon.Button11.Button.LabelText" Sequence="15" />
<Button Id="dev1.ApplicationRibbon.Button10.Button" LabelText="$LocLabels:dev1.ApplicationRibbon.Button10.Button.LabelText" Sequence="20" />
</Controls>
</MenuSection>*/
StringBuilder sb = new StringBuilder();
sb.AppendLine("<Menu Id=\"" + Id + "\">");
foreach (RibbonMenuSection section in Sections)
{
section.SerialiseToRibbonXml(sb);
}
sb.AppendLine("</Menu>");
return sb.ToString();
}
示例4: FrameIDFactory
static FrameIDFactory()
{
CreateEntries();
#if generate
var writer = new System.IO.StreamWriter(@"C:\Temp\table.txt");
_entries = new List<ID3v2FrameEntry>();
var elements = Enum.GetNames(typeof(ID3v2FrameID));
foreach (var element in elements)
{
var id = Enum.Parse(typeof(ID3v2FrameID), element);
var id3v4ID = ID3v2FrameIDFactory.GetID((ID3v2FrameID)id, ID3Version.ID3v2_4);
string id3v3ID;
try
{
id3v3ID = ID3v2FrameIDFactory.GetID((ID3v2FrameID)id, ID3Version.ID3v2_3);
}
catch (Exception)
{
id3v3ID = null;
}
string id3v2ID;
try
{
id3v2ID = ID3v2FrameIDFactory.GetID((ID3v2FrameID)id, ID3Version.ID3v2_2);
}
catch (Exception)
{
id3v2ID = null;
}
StringBuilder builder = new StringBuilder();
builder.AppendLine(" entry = new ID3v2FrameEntry()");
builder.AppendLine(" {");
builder.AppendLine(String.Format(" ID = ID3v2FrameID.{0},", ((ID3v2FrameID)id).ToString()));
builder.AppendLine(String.Format(" ID3v4ID = {0},", id3v4ID == null ? "null" : "\"" + id3v4ID + "\""));
builder.AppendLine(String.Format(" ID3v3ID = {0},", id3v3ID == null ? "null" : "\"" + id3v3ID + "\""));
builder.AppendLine(String.Format(" ID3v2ID = {0},", id3v2ID == null ? "null" : "\"" + id3v2ID + "\""));
builder.AppendLine(String.Format(" Desc = \"{0}\"", element));
builder.AppendLine(" };");
builder.AppendLine(" _entries.Add(entry);");
writer.WriteLine(builder.ToString());
writer.WriteLine();
writer.WriteLine();
}
writer.Flush();
writer.Dispose();
#endif
}
示例5: SerialiseToRibbonXml
public void SerialiseToRibbonXml(StringBuilder sb)
{
/*
* <MenuSection Id="dev1.ApplicationRibbon.Section11.Section" Sequence="10" DisplayMode="Menu16">
<Controls Id="dev1.ApplicationRibbon.Section11.Section.Controls">
<Button Id="dev1.ApplicationRibbon.Button11.Button" LabelText="$LocLabels:dev1.ApplicationRibbon.Button11.Button.LabelText" Sequence="15" />
<Button Id="dev1.ApplicationRibbon.Button10.Button" LabelText="$LocLabels:dev1.ApplicationRibbon.Button10.Button.LabelText" Sequence="20" />
</Controls>
</MenuSection>*/
sb.AppendLine("<MenuSection Id=\"" + XmlHelper.Encode(Id) + (Title!=null ? "\" Title=\"" + Title.ToString() : "") + "\" Sequence=\"" + Sequence.ToString() + "\" DisplayMode=\"" + DisplayMode + "\">");
sb.AppendLine("<Controls Id=\"" + XmlHelper.Encode(Id + ".Controls") + "\">");
foreach (RibbonControl button in Buttons)
{
button.SerialiseToRibbonXml(sb);
}
sb.AppendLine("</Controls>");
sb.AppendLine("</MenuSection>");
}
示例6: SerialiseToRibbonXml
public override void SerialiseToRibbonXml(StringBuilder sb)
{
/*
* <MenuSection Id="dev1.ApplicationRibbon.Section11.Section" Sequence="10" DisplayMode="Menu16">
<Controls Id="dev1.ApplicationRibbon.Section11.Section.Controls">
<Button Id="dev1.ApplicationRibbon.Button11.Button" LabelText="$LocLabels:dev1.ApplicationRibbon.Button11.Button.LabelText" Sequence="15" />
<Button Id="dev1.ApplicationRibbon.Button10.Button" LabelText="$LocLabels:dev1.ApplicationRibbon.Button10.Button.LabelText" Sequence="20" />
</Controls>
</MenuSection>*/
sb.AppendLine("<Button Id=\"" + XmlHelper.Encode(Id) + "\" LabelText=\"" + XmlHelper.Encode(LabelText) + "\" Sequence=\"" + Sequence.ToString() + "\" Command=\"" + XmlHelper.Encode(Command) + "\"" + ((Image32by32!=null) ? (" Image32by32=\"" + XmlHelper.Encode(Image32by32) + "\"") : "") + ((Image16by16!=null) ? (" Image16by16=\"" + XmlHelper.Encode(Image16by16) + "\"") : "") + " />");
}
示例7: GetListenerTrace
private string GetListenerTrace(ExportProvider provider)
{
var sb = new StringBuilder();
var workspaceWaiter = GetListeners(provider).First(l => l.Metadata.FeatureName == FeatureAttribute.Workspace).Value as TestAsynchronousOperationListener;
sb.AppendLine("workspace");
sb.AppendLine(workspaceWaiter.Trace());
var solutionCrawlerWaiter = GetListeners(provider).First(l => l.Metadata.FeatureName == FeatureAttribute.SolutionCrawler).Value as TestAsynchronousOperationListener;
sb.AppendLine("solutionCrawler");
sb.AppendLine(solutionCrawlerWaiter.Trace());
return sb.ToString();
}
示例8: GenerateDbSets
private string GenerateDbSets()
{
System.StringBuilder returnValue = new System.StringBuilder();
foreach (var dbSet in this.dbSets)
{
returnValue.AppendFormat("\t\t public DbSet<{0}> {1}", dbSet.Key.Name, dbSet.Value);
returnValue.AppendLine(" { get; set; }");
returnValue.AppendLine();
}
return returnValue;
}
示例9: CreateInstance
public DbContext CreateInstance()
{
var loCompiler = CodeDomProvider.CreateProvider("CSharp");
CompilerParameters parameters = new CompilerParameters();
parameters.GenerateInMemory = true;
foreach (var referencedAssembly in this.ReferencedAssemblies.Distinct())
{
string assemblyPath = string.Format("{0}\\bin\\{1}", AppDomain.CurrentDomain.BaseDirectory, referencedAssembly);
parameters.ReferencedAssemblies.Add((System.IO.File.Exists(assemblyPath)) ? assemblyPath : referencedAssembly);
}
CompilerResults compilerResult = loCompiler.CompileAssemblyFromSource(parameters, this.GetClassSource());
if (compilerResult.Errors.HasErrors)
{
System.StringBuilder errors = new System.StringBuilder("Error Generating Class");
errors.AppendLine();
foreach (var error in compilerResult.Errors)
errors.AppendLine(error.ToString());
throw new InvalidOperationException(errors.ToString());
}
return (DbContext) compilerResult.CompiledAssembly.CreateInstance(this.FullClassName);
}
示例10: Main
public static void Main(string[] args)
{
#if SAVE_ALL_TYPES
List<string> fieldTypes = new List<string>();
#endif
var generatorList = new List<ProtobufPacketGenerator>();
// Those ID's are not supported and should be parsed manually.
var bannedIDs = new int[] { 0x20, 0x22, 0x26, 0x34, 0x37, 0x38, 0x44, 0x45 };
var protocols = GetProtocolTables();
foreach (var protocol in protocols)
{
var className = $"{protocol.Name.Replace("-", "").Replace("_", "")}Packet";
var id = new VarInt(int.Parse(protocol.GetAt(0, 0).Remove(0, 2), NumberStyles.AllowHexSpecifier));
if (bannedIDs.Contains(id))
continue;
var state = (State) Enum.Parse(typeof(State), protocol.GetAt(0, 1).ExceptBlanks());
var boundTo = (BoundTo) Enum.Parse(typeof(BoundTo), protocol.GetAt(0, 2).ExceptBlanks());
var builder = new ProtobufPacketGenerator(className, id, boundTo, state);
for (int ix = 0; ix < protocol.Height; ix++)
{
var fieldName = protocol.GetAt(ix, 3).Replace("-", "").ExceptBlanks();
if (fieldName == "nofields")
continue;
var fieldType = protocol.GetAt(ix, 4).Replace("-", "").ExceptBlanks();
var note = protocol.GetAt(ix, 5);
builder.AddField(fieldName, ReplaceTypes(fieldType));
#if SAVE_ALL_TYPES
if (!fieldTypes.Contains(fieldType))
fieldTypes.Add(fieldType);
#endif
}
generatorList.Add(builder);
}
#if SAVE_ALL_TYPES
var fieldTypesBuilder = new StringBuilder();
foreach (string str in fieldTypes)
fieldTypesBuilder.AppendLine(str);
var fileTypeFile = FileSystemWrapper.OutputFolder.CreateFileAsync("FileTypes.txt", CreationCollisionOption.ReplaceExisting).Result;
using (StreamWriter stream = new StreamWriter(fileTypeFile.OpenAsync(PCLStorage.FileAccess.ReadAndWrite).Result))
stream.Write(fieldTypesBuilder.ToString());
#endif
foreach (var generator in generatorList)
{
var folder = FileSystemWrapper.OutputFolder.CreateFolderAsync("Generated", CreationCollisionOption.OpenIfExists).Result;
if (generator.BoundTo != BoundTo.NONE)
folder = folder.CreateFolderAsync(generator.BoundTo.ToString(), CreationCollisionOption.OpenIfExists).Result;
if (generator.State != State.NONE)
folder = folder.CreateFolderAsync(generator.State.ToString(), CreationCollisionOption.OpenIfExists).Result;
var classFile = folder.CreateFileAsync($"{generator.ClassName}.cs", CreationCollisionOption.ReplaceExisting).Result;
using (StreamWriter stream = new StreamWriter(classFile.OpenAsync(PCLStorage.FileAccess.ReadAndWrite).Result))
stream.Write(generator.GenerateClass());
}
}
示例11: ToString
public override string ToString()
{
StringBuilder text = new StringBuilder();
text.AppendLine("Дата приема " + DateReceiving.ToString());
text.AppendLine("Описание проблемы " + DiscriptionTrouble);
text.AppendLine(Dog.ToString());
return text.ToString();
}
示例12: ToString
/// <summary>
/// Returns the matrix in a textual form.
/// </summary>
public override String ToString()
{
var sb = new StringBuilder();
var rows = Rows;
var cols = Cols;
sb.Append("┌");
for (var i = 0; i < cols; ++i) sb.Append("{0,12}", String.Empty);
sb.AppendLine("┐");
for (var i = 0; i < rows; ++i)
{
sb.Append("│");
for (var j = 0; j < cols; ++j)
{
var format =
//"+0.##;-0.##"; // +0.03
//"G3"; // +3e-2
"#.####;-#.####;0"; // +.03
sb.Append("{0,10} ", _matrix[i, j].ToString(format));
}
sb.AppendLine("│");
}
sb.Append("└");
for (var i = 0; i < cols; ++i) sb.Append("{0,12}", String.Empty);
sb.AppendLine("┘");
return sb.ToString();
}
示例13: SerialiseToRibbonXml
public override void SerialiseToRibbonXml(StringBuilder sb)
{
sb.AppendLine("<FlyoutAnchor Id=\"" + XmlHelper.Encode(Id) + "\" LabelText=\"" + XmlHelper.Encode(LabelText) + "\" Sequence=\"" + Sequence.ToString() + "\" Command=\"" + XmlHelper.Encode(Command) + "\"" + ((Image32by32 != null) ? (" Image32by32=\"" + XmlHelper.Encode(Image32by32) + "\"") : "") + ((Image16by16 != null) ? (" Image16by16=\"" + XmlHelper.Encode(Image16by16) + "\"") : "") + " PopulateDynamically=\"false\">");
sb.AppendLine(Menu.SerialiseToRibbonXml());
sb.AppendLine("</FlyoutAnchor>");
}
示例14: Report
public void Report( string charName )
{
StringBuilder html = new StringBuilder();
html.Append( "<html>" );
html.Append( "<head>" );
html.Append( "</head>" );
html.AppendLine();
html.Append( css );
html.AppendLine();
html.Append( "<body>" );
html.AppendLine();
foreach( CombatEntity entity in this.entities.Values )
{
if( charName != null && entity.Name != charName ) continue;
if( charName == null && !entity.IsPlayerCharacter ) continue;
html.Append( "<table border='1' cellpadding='3' cellspacing='0'>" );
html.AppendLine();
html.Append( "<tr>" );
html.Append( "<td colspan='15'>" + entity.Name + "</td>" );
html.Append( "</tr>" );
html.Append( "<tr>" );
this.AddHeaders( html );
//html.Append( "<th>time</th><th class='lt'>summary</th><th>m:ss</th><th>took</th><th>heal</th><th>died</th><th>hits</th><th>miss</th><th>range</th><th>auto</th><th>dots</th><th>norm</th><th>crits</th><th>avg</th><th>dps</th>" );
html.Append( "</tr>" );
html.AppendLine();
foreach( CombatSession session in entity.GetSessions() )
{
string s = this.ToHtml( session );
if( s == string.Empty ) continue;
html.Append( "<tr class='hl'>" );
html.AppendLine();
this.AddRow( html, session );
//html.Append( s );
html.AppendLine();
html.Append( "</tr>" );
if( entity.Pets.Count > 0 )
{
foreach( CombatEntity pet in entity.Pets )
{
CombatSession petSession = pet.GetSessionWith( session.Target );
if( petSession != null )
{
string t = this.ToHtml( petSession );
if( t != string.Empty )
{
html.Append( "<tr class='pet'>" );
html.AppendLine();
this.AddRow( html, session );
//html.Append( t );
html.AppendLine();
html.Append( "</tr>" );
}
}
}
}
}
html.AppendLine();
html.Append( "</table>" );
}
html.AppendLine();
html.Append( "</body>" );
Console.WriteLine( html );
}
示例15: SaveCustomFilters
public static void SaveCustomFilters()
{
StringBuilder sb = new StringBuilder();
foreach (KeyValuePair<string, ConstellationFilter> kv in Families)
{
if (!kv.Value.Internal)
{
sb.Append(kv.Key);
sb.Append(";");
sb.AppendLine(kv.Value.ToString());
}
}
//Properties.Settings.Default.SavedFilters = sb.ToString();
}