本文整理汇总了C#中System.IO.TextWriter类的典型用法代码示例。如果您正苦于以下问题:C# TextWriter类的具体用法?C# TextWriter怎么用?C# TextWriter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TextWriter类属于System.IO命名空间,在下文中一共展示了TextWriter类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: WriteClass
public void WriteClass(IJsonClassGeneratorConfig config, TextWriter sw, JsonType type)
{
var visibility = config.InternalVisibility ? "Friend" : "Public";
if (config.UseNestedClasses)
{
sw.WriteLine(" {0} Partial Class {1}", visibility, config.MainClass);
if (!type.IsRoot)
{
if (ShouldApplyNoRenamingAttribute(config)) sw.WriteLine(" " + NoRenameAttribute);
if (ShouldApplyNoPruneAttribute(config)) sw.WriteLine(" " + NoPruneAttribute);
sw.WriteLine(" {0} Class {1}", visibility, type.AssignedName);
}
}
else
{
if (ShouldApplyNoRenamingAttribute(config)) sw.WriteLine(" " + NoRenameAttribute);
if (ShouldApplyNoPruneAttribute(config)) sw.WriteLine(" " + NoPruneAttribute);
sw.WriteLine(" {0} Class {1}", visibility, type.AssignedName);
}
var prefix = config.UseNestedClasses && !type.IsRoot ? " " : " ";
WriteClassMembers(config, sw, type, prefix);
if (config.UseNestedClasses && !type.IsRoot)
sw.WriteLine(" End Class");
sw.WriteLine(" End Class");
sw.WriteLine();
}
示例2: HtmlDecode
public virtual void HtmlDecode(string value, TextWriter output)
{
if (output == null)
throw new ArgumentNullException ("output");
output.Write (HtmlDecode (value));
}
示例3: InitBranch
public InitBranch(TextWriter stdout, Globals globals, Help helper, AuthorsFile authors)
{
_stdout = stdout;
_globals = globals;
_helper = helper;
_authors = authors;
}
示例4: UpdateOutputLogCommand
private UpdateOutputLogCommand(IStorageBlockBlob outputBlob, Func<string, CancellationToken, Task> uploadCommand)
{
_outputBlob = outputBlob;
_innerWriter = new StringWriter(CultureInfo.InvariantCulture);
_synchronizedWriter = TextWriter.Synchronized(_innerWriter);
_uploadCommand = uploadCommand;
}
示例5: toXML
public override void toXML(TextWriter tw)
{
tw.WriteLine("<" + Constants.BINC45MODELSELECTION_ELEMENT + " " +
Constants.MIN_NO_OBJ_ATTRIBUTE + "=\"" + this.m_minNoObj + "\" " +
" xmlns=\"urn:mites-schema\">\n");
tw.WriteLine("</" + Constants.BINC45MODELSELECTION_ELEMENT + ">");
}
示例6: Create
public static ITriggerBindingProvider Create(INameResolver nameResolver,
IStorageAccountProvider storageAccountProvider,
IExtensionTypeLocator extensionTypeLocator,
IHostIdProvider hostIdProvider,
IQueueConfiguration queueConfiguration,
IBackgroundExceptionDispatcher backgroundExceptionDispatcher,
IContextSetter<IMessageEnqueuedWatcher> messageEnqueuedWatcherSetter,
IContextSetter<IBlobWrittenWatcher> blobWrittenWatcherSetter,
ISharedContextProvider sharedContextProvider,
IExtensionRegistry extensions,
TextWriter log)
{
List<ITriggerBindingProvider> innerProviders = new List<ITriggerBindingProvider>();
innerProviders.Add(new QueueTriggerAttributeBindingProvider(nameResolver, storageAccountProvider,
queueConfiguration, backgroundExceptionDispatcher, messageEnqueuedWatcherSetter,
sharedContextProvider, log));
innerProviders.Add(new BlobTriggerAttributeBindingProvider(nameResolver, storageAccountProvider,
extensionTypeLocator, hostIdProvider, queueConfiguration, backgroundExceptionDispatcher,
blobWrittenWatcherSetter, messageEnqueuedWatcherSetter, sharedContextProvider, log));
// add any registered extension binding providers
foreach (ITriggerBindingProvider provider in extensions.GetExtensions(typeof(ITriggerBindingProvider)))
{
innerProviders.Add(provider);
}
return new CompositeTriggerBindingProvider(innerProviders);
}
示例7: Write
public static void Write(TextWriter writer, IEnumerable<Dictionary<string, string>> records)
{
if (records == null) return; //AOT
var allKeys = new HashSet<string>();
var cachedRecords = new List<IDictionary<string, string>>();
foreach (var record in records)
{
foreach (var key in record.Keys)
{
if (!allKeys.Contains(key))
{
allKeys.Add(key);
}
}
cachedRecords.Add(record);
}
var headers = allKeys.OrderBy(key => key).ToList();
if (!CsvConfig<Dictionary<string, string>>.OmitHeaders)
{
WriteRow(writer, headers);
}
foreach (var cachedRecord in cachedRecords)
{
var fullRecord = headers.ConvertAll(header =>
cachedRecord.ContainsKey(header) ? cachedRecord[header] : null);
WriteRow(writer, fullRecord);
}
}
示例8: Metas
public void Metas(TextWriter Output)
{
foreach (var meta in resourceManager.GetRegisteredMetas())
{
Output.WriteLine(meta.GetTag());
}
}
示例9: Merge
public static void Merge(FileDescriptorSet files, string path, TextWriter stderr, params string[] args)
{
if (stderr == null) throw new ArgumentNullException("stderr");
if (files == null) throw new ArgumentNullException("files");
if (string.IsNullOrEmpty(path)) throw new ArgumentNullException("path");
bool deletePath = false;
if(!IsValidBinary(path))
{ // try to use protoc
path = CompileDescriptor(path, stderr, args);
deletePath = true;
}
try
{
using (FileStream stream = File.OpenRead(path))
{
Serializer.Merge(stream, files);
}
}
finally
{
if(deletePath)
{
File.Delete(path);
}
}
}
示例10: HeadLinks
public void HeadLinks(TextWriter Output)
{
foreach (var link in resourceManager.GetRegisteredLinks())
{
Output.WriteLine(link.GetTag());
}
}
示例11: ResXResourceWriter
public ResXResourceWriter (TextWriter textWriter)
{
if (textWriter == null)
throw new ArgumentNullException ("textWriter");
this.textwriter = textWriter;
}
示例12: AddConversationsToDatabaseAsync
private async static Task AddConversationsToDatabaseAsync(Provider provider, Category category,
IEnumerable<Conversation> newConversations, TextWriter logger)
{
int conversationsAddedToDatabase = 0;
int conversationsUpdatedInDatabase = 0;
foreach (var newConversation in newConversations)
{
var existingCon = db.Conversations
.Where(c => c.CategoryID == category.CategoryID &&
c.Url == newConversation.Url)
.SingleOrDefault();
if (existingCon != null && existingCon.LastUpdated < newConversation.LastUpdated)
{
existingCon.LastUpdated = newConversation.LastUpdated;
existingCon.DbUpdated = DateTimeOffset.UtcNow;
existingCon.Body = newConversation.Body;
db.Entry(existingCon).State = EntityState.Modified;
conversationsUpdatedInDatabase++;
}
else if (existingCon == null)
{
newConversation.DbUpdated = DateTimeOffset.UtcNow;
db.Conversations.Add(newConversation);
conversationsAddedToDatabase++;
}
}
logger.WriteLine("Added {0} new conversations, updated {1} conversations",
conversationsAddedToDatabase, conversationsUpdatedInDatabase);
await db.SaveChangesAsync();
}
示例13: Render_Template_HTML
/// <summary> Renders the HTML for this element </summary>
/// <param name="Output"> Textwriter to write the HTML for this element </param>
/// <param name="Bib"> Object to populate this element from </param>
/// <param name="Skin_Code"> Code for the current skin </param>
/// <param name="isMozilla"> Flag indicates if the current browse is Mozilla Firefox (different css choices for some elements)</param>
/// <param name="popup_form_builder"> Builder for any related popup forms for this element </param>
/// <param name="Current_User"> Current user, who's rights may impact the way an element is rendered </param>
/// <param name="CurrentLanguage"> Current user-interface language </param>
/// <param name="Translator"> Language support object which handles simple translational duties </param>
/// <param name="Base_URL"> Base URL for the current request </param>
/// <remarks> This simple element does not append any popup form to the popup_form_builder</remarks>
public override void Render_Template_HTML(TextWriter Output, SobekCM_Item Bib, string Skin_Code, bool isMozilla, StringBuilder popup_form_builder, User_Object Current_User, Web_Language_Enum CurrentLanguage, Language_Support_Info Translator, string Base_URL )
{
// Check that an acronym exists
if (Acronym.Length == 0)
{
const string defaultAcronym = "Enter any spatial coverage information which relates to this material.";
switch (CurrentLanguage)
{
case Web_Language_Enum.English:
Acronym = defaultAcronym;
break;
case Web_Language_Enum.Spanish:
Acronym = defaultAcronym;
break;
case Web_Language_Enum.French:
Acronym = defaultAcronym;
break;
default:
Acronym = defaultAcronym;
break;
}
}
List<string> allValues = new List<string>();
if (Bib.Bib_Info.Subjects_Count > 0)
{
allValues.AddRange(from thisSubject in Bib.Bib_Info.Subjects where thisSubject.Class_Type == Subject_Info_Type.Hierarchical_Spatial select thisSubject.ToString());
}
render_helper(Output, allValues, Skin_Code, Current_User, CurrentLanguage, Translator, Base_URL);
}
示例14: GetCode
public void GetCode(CodeFormat format, TextWriter writer)
{
IOutputProvider output;
switch (format)
{
case CodeFormat.Disassemble:
output = OutputFactory.GetDisassembleOutputProvider();
break;
case CodeFormat.ControlFlowDecompile:
output = OutputFactory.GetDecompileCFOutputProvider();
break;
case CodeFormat.FullDecompile:
output = OutputFactory.GetDecompileFullOutputProvider();
break;
case CodeFormat.FullDecompileAnnotate:
output = OutputFactory.GetDecompileFullAnnotateOutputProvider();
break;
case CodeFormat.CodePath:
output = OutputFactory.GetCodePathOutputProvider();
break;
case CodeFormat.Variables:
output = OutputFactory.GetVariablesOutputProvider();
break;
case CodeFormat.ScruffDecompile:
output = OutputFactory.GetScruffDecompileOutputProvider();
break;
case CodeFormat.ScruffHeader:
output = OutputFactory.GetScruffHeaderOutputProvider();
break;
default:
throw new ArgumentOutOfRangeException("format");
}
output.Process(_file, writer);
}
示例15: ToGraphic
public static void ToGraphic(this ByteMatrix matrix, TextWriter output)
{
output.WriteLine(matrix.Width.ToString());
for (int j = 0; j < matrix.Width; j++)
{
for (int i = 0; i < matrix.Width; i++)
{
char charToPrint;
switch (matrix[i, j])
{
case 0:
charToPrint = s_0Char;
break;
case 1:
charToPrint = s_1Char;
break;
default:
charToPrint = s_EmptyChar;
break;
}
output.Write(charToPrint);
}
output.WriteLine();
}
}