本文整理汇总了C#中TextWriter类的典型用法代码示例。如果您正苦于以下问题:C# TextWriter类的具体用法?C# TextWriter怎么用?C# TextWriter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TextWriter类属于命名空间,在下文中一共展示了TextWriter类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: DoLog
private static void DoLog(String logMessage, TextWriter w)
{
w.Write("{0}", DateTime.Now.ToString("MM/dd/yy HH:mm"));
w.Write(" {0}", logMessage);
w.Write("\r\n");
w.Flush();
}
开发者ID:mihle,项目名称:VaultService,代码行数:7,代码来源:Logger.cs
示例2: Write
public static void Write(object element, int depth, TextWriter log)
{
ObjectDumper dumper = new ObjectDumper(depth);
dumper.writer = log;
dumper.WriteObject(null, element);
log.WriteLine(new string('-', 20));
}
开发者ID:diamondiamon,项目名称:WeikerenUtility,代码行数:7,代码来源:ObjectDumper.cs
示例3: Main
public static void Main()
{
//string ConnetionString = "mongodb://localhost:27017";
//string DbName = "artgallerydb";
//var client = new MongoClient(ConnetionString);
//MongoServer server = client.GetServer();
//var mongoDb = server.GetDatabase(DbName);
// var result = mongoDb.GetCollection<Artist>("artists").AsQueryable<Artist>();
Database.SetInitializer(new MigrateDatabaseToLatestVersion<ArtGalleryDbContext, Configuration>());
var data = new ArtGalleryDbContext();
var dataImporter = new MongoDb();
var consoleWriter = new TextWriter(Console.Out);
var msSqlDbDataImporter = new MsSqlDbDataImporter(dataImporter, data);
msSqlDbDataImporter.Subscribe(consoleWriter);
msSqlDbDataImporter.ImportData();
//db.Artists.Add(new ArtistSql
//{
// FirstName = "Pesho",
// MiddleName = "d",
// LastName = "Gosho"
//});
}
开发者ID:Databases-Team-Aluminium,项目名称:Team-Aluminium,代码行数:27,代码来源:Program.cs
示例4: Writer
public Writer(TextWriter writer, Grammar grammar)
{
m_writer = writer;
m_grammar = grammar;
foreach (Rule rule in m_grammar.Rules)
{
List<Rule> temp;
if (!m_rules.TryGetValue(rule.Name, out temp))
{
temp = new List<Rule>();
m_rules.Add(rule.Name, temp);
}
temp.Add(rule);
}
foreach (string e in m_grammar.Settings["exclude-methods"].Split(new char[]{' '}, StringSplitOptions.RemoveEmptyEntries))
{
m_engine.AddExcluded(e);
}
foreach (var entry in m_grammar.Settings)
{
if ("true".Equals(entry.Value))
m_engine.AddVariable(entry.Key, true);
else if ("false".Equals(entry.Value))
m_engine.AddVariable(entry.Key, false);
else
m_engine.AddVariable(entry.Key, entry.Value);
}
m_engine.AddVariable("debugging", m_grammar.Settings["debug"] != "none");
DoSetUsed();
}
开发者ID:dbremner,项目名称:peg-sharp,代码行数:34,代码来源:Writer.cs
示例5: CreateCmakeList
public void CreateCmakeList(string fullyQualifiedPath, string unqualifiedName, Dictionary<string,BuildElement> buildsys, Graph<string> buildgraph)
{
/*NOTE: This is a totally hacked solution to try and have a demo for the presentation. It will get much cleaner over time. */
string fullyQualifiedFileName = fullyQualifiedPath + "\\" + unqualifiedName;
TextWriter txtwriter = new TextWriter();
System.IO.StreamWriter file = new System.IO.StreamWriter(fullyQualifiedFileName);
BuildElement elem;
string objects = "";
string projectname = "";
//brute forced just for the demo
//this is not quite as brute forced, but pretty close
foreach(KeyValuePair<string,BuildElement> keyval in buildsys)
{
elem = keyval.Value;
CustomAction action = CustomActionsBare.determineAction(elem);
if(action == CustomAction.ConvertToProject)
{
projectname = elem.name;
for (int i = 0; i < elem.dependencies.Count; i++)
{
objects += elem.dependencies[i].Replace(".o", ".cpp") + " ";
}
}
//System.Console.WriteLine("TEST: "+elem.Key);
// System.Console.WriteLine(ProjectGenerator.InstructionParsing.CustomActionsBare.determineAction(elem.Value));
}
file.WriteLine("cmake_minimum_required (VERSION 2.6)");
file.WriteLine("project (" + projectname + ")");
file.WriteLine("");
file.WriteLine("add_executable("+projectname + " " + objects+")");
file.Close();
}
开发者ID:mheise,项目名称:Unmake,代码行数:35,代码来源:CmakeGen.cs
示例6: PrettyPrint
internal static void PrettyPrint(TextWriter output, object result)
{
if (result == null){
p (output, "null");
return;
}
if (result is Array){
Array a = (Array) result;
p (output, "{ ");
int top = a.GetUpperBound (0);
for (int i = a.GetLowerBound (0); i <= top; i++){
PrettyPrint (output, a.GetValue (i));
if (i != top)
p (output, ", ");
}
p (output, " }");
} else if (result is bool){
if ((bool) result)
p (output, "true");
else
p (output, "false");
} else if (result is string){
p (output, "\"");
EscapeString (output, (string)result);
p (output, "\"");
} else if (result is IDictionary){
IDictionary dict = (IDictionary) result;
int top = dict.Count, count = 0;
p (output, "{");
foreach (DictionaryEntry entry in dict){
count++;
p (output, "{ ");
PrettyPrint (output, entry.Key);
p (output, ", ");
PrettyPrint (output, entry.Value);
if (count != top)
p (output, " }, ");
else
p (output, " }");
}
p (output, "}");
} else if (WorksAsEnumerable (result)) {
int i = 0;
p (output, "{ ");
foreach (object item in (IEnumerable) result) {
if (i++ != 0)
p (output, ", ");
PrettyPrint (output, item);
}
p (output, " }");
} else if (result is char) {
EscapeChar (output, (char) result);
} else {
p (output, result.ToString ());
}
}
开发者ID:radare,项目名称:radare2-bindings,代码行数:60,代码来源:shell.cs
示例7: WriteToStream
public static void WriteToStream(TextWriter stream, DataTable table, bool header, bool quoteall, char separator)
{
if (header)
{
for (int i = 0; i < table.Columns.Count; i++)
{
WriteItem(stream, table.Columns[i].Caption, quoteall, separator);
if (i < table.Columns.Count - 1)
stream.Write(separator);
else
stream.Write('\n');
}
}
foreach (DataRow row in table.Rows)
{
for (int i = 0; i < table.Columns.Count; i++)
{
WriteItem(stream, row[i], quoteall, separator);
if (i < table.Columns.Count - 1)
stream.Write(separator);
else
stream.Write('\n');
}
}
}
开发者ID:hafizor,项目名称:stgeorge,代码行数:25,代码来源:CsvWriter.cs
示例8: XmlWriterTraceListener
public XmlWriterTraceListener (TextWriter writer, string name)
: base (writer, name)
{
XmlWriterSettings settings = new XmlWriterSettings ();
settings.OmitXmlDeclaration = true;
w = XmlWriter.Create (writer, settings);
}
开发者ID:oznetmaster,项目名称:SSMonoDiagnosticsLibrary,代码行数:7,代码来源:XmlWriterTraceListener.cs
示例9: run
public static int run(string[] args, Ice.Communicator communicator, TextWriter @out)
{
//
// When running as a MIDlet the properties for the server may be
// overridden by configuration. If it isn't then we assume
// defaults.
//
if(communicator.getProperties().getProperty("TestAdapter.Endpoints").Length == 0)
{
communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010");
}
if(communicator.getProperties().getProperty("ControllerAdapter.Endpoints").Length == 0)
{
communicator.getProperties().setProperty("ControllerAdapter.Endpoints", "tcp -p 12011");
communicator.getProperties().setProperty("ControllerAdapter.ThreadPool.Size", "1");
}
Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
Ice.ObjectAdapter adapter2 = communicator.createObjectAdapter("ControllerAdapter");
BackgroundControllerI backgroundController = new BackgroundControllerI(adapter);
adapter.add(new BackgroundI(backgroundController), communicator.stringToIdentity("background"));
adapter.add(new LocatorI(backgroundController), communicator.stringToIdentity("locator"));
adapter.add(new RouterI(backgroundController), communicator.stringToIdentity("router"));
adapter.activate();
adapter2.add(backgroundController, communicator.stringToIdentity("backgroundController"));
adapter2.activate();
communicator.waitForShutdown();
return 0;
}
开发者ID:joshmoore,项目名称:ice,代码行数:33,代码来源:Server.cs
示例10: Footer
static void Footer (TextWriter tw)
{
tw.WriteLine (@"## Feedback
Please report any documentation errors, typos or suggestions to the
[[Gendarme Google Group|http://groups.google.com/group/gendarme]]. Thanks!");
}
开发者ID:boothead,项目名称:mono-tools,代码行数:7,代码来源:xmldoc2wiki.cs
示例11: Log
private static void Log(Exception e, TextWriter w)
{
w.Write("\r\nLog Entry: ");
w.WriteLine("{0} {1}", DateTime.Now.ToLongTimeString(), DateTime.Now.ToLongDateString());
w.WriteLine("{0} : {1}", e.Message , e.StackTrace);
w.WriteLine("-------------------------------");
}
开发者ID:sealuzh,项目名称:PersonalAnalytics,代码行数:7,代码来源:Logger.cs
示例12: Host
public static void Host(TextWriter log, CancellationToken cancellationToken)
{
var defaultFactory = LogManager.Use<DefaultFactory>();
defaultFactory.Level(LogLevel.Info);
var configuration = new BusConfiguration();
configuration.EndpointName("APIComparer.Backend");
configuration.DisableFeature<SecondLevelRetries>();
configuration.DisableFeature<Sagas>();
configuration.DisableFeature<TimeoutManager>();
configuration.UseTransport<AzureStorageQueueTransport>()
.ConnectionString(AzureEnvironment.GetConnectionString);
configuration.UsePersistence<AzureStoragePersistence>();
configuration.EnableInstallers();
using (Bus.Create(configuration).Start())
{
log.WriteLine("APIComparer.Backend - bus started");
cancellationToken.WaitHandle.WaitOne();
}
log.WriteLine("APIComparer.Backend cancelled at " + DateTimeOffset.UtcNow);
}
开发者ID:AntoineGa,项目名称:APIComparer,代码行数:26,代码来源:Functions.cs
示例13: QueueBackup
public static void QueueBackup([Queue("backupqueue")] ICollector<CopyItem> message, TextWriter log)
{
try
{
// The schedule for this Web Job is Monday-Thursday at 11:30pm UTC, defined in settings.job
// Using storage connection tokens rather than the connection strings themselves so they are not leaked onto the queue.
// When DmlExec reads the queue it will look up the tokens from App Settings.
// Format is: key = "MySourceAccount" value = "DefaultEndpointsProtocol=https;AccountName=[account name];AccountKey=[account key]"
string sourceAccountToken = "MySourceAccount";
string destinationAccountToken = "MyDestinationAccount";
// Backup type of "full" or "incremental"
// Blob is always copied if it does not exist in destination container
// When Incremental = false, overwrite blob even if it exists in destination container
// When Incremental = true only copy if source is newer than the destination
bool isIncremental = true;
// Pop messages on the queue to copy one or more containers between two storage accounts
message.Add(CreateJob("Incremental images backup", sourceAccountToken, destinationAccountToken, "images", "", "imagesbackup", "", isIncremental, log));
message.Add(CreateJob("Incremental docs backup", sourceAccountToken, destinationAccountToken, "docs", "", "docsbackup", "", isIncremental, log));
}
catch (Exception ex)
{
log.WriteLine(ex.Message);
}
}
开发者ID:markjbrown,项目名称:AzureDmlBackup,代码行数:28,代码来源:Functions.cs
示例14: AcceptItem
public AcceptItem(string newText, TextWriter newWriter, Texture2D newTexture, Vector2 newPos)
{
text = newText;
writer = newWriter;
texture = newTexture;
position = newPos;
interactive_position = position - new Vector2(25, 17);
}
开发者ID:BibleUs,项目名称:Terrain-Engine,代码行数:8,代码来源:Controls.cs
示例15: Print
public void Print(TextWriter tw, string indent = "")
{
tw.WriteLine(indent + this.Name + "\\" + " " + this.GetSize() + " B");
foreach (var file in this.Files)
tw.WriteLine(indent + " " + file.Name + " " + file.Size + " B");
foreach (var folder in this.Folders)
folder.Print(tw, indent + " ");
}
开发者ID:staafl,项目名称:ta-hw-dsa,代码行数:8,代码来源:Folder.cs
示例16: Footer
static void Footer (TextWriter tw)
{
tw.WriteLine (@"= Feedback =
Please report any documentation errors, typos or suggestions to the
[http://groups.google.com/group/gendarme Gendarme Google Group]. Thanks!
[[Category:Gendarme]]");
}
开发者ID:nolanlum,项目名称:mono-tools,代码行数:8,代码来源:xmldoc2wiki.cs
示例17: renderSendFormIfNecessary
public void renderSendFormIfNecessary(TextWriter tw)
{
if (postPaymentRequestToRender != null)
{
postPaymentRequestToRender.RenderPaymentRequestForm(tw);
postPaymentRequestToRender = null;
}
}
开发者ID:JFox-sk,项目名称:EPayment,代码行数:8,代码来源:Default.aspx.cs
示例18: CcsParser_t
public CcsParser_t(string fname, TextWriter errwriter)
{
errpool = new CcsErrorPool_t(errwriter);
scanner = new CcsScanner_t(errpool, fname);
t = la = null;
/*---- constructor ----*/
maxT = 12;
/*---- enable ----*/
}
开发者ID:snowyu,项目名称:cocoxml,代码行数:9,代码来源:Parser.cs
示例19: Update
void Update()
{
textWriter = GameObject.FindGameObjectWithTag("InteractChat").GetComponent<TextWriter>();
if (textWriter.diagStarted && textWriter.currentInteraction == "Laptop")
laptopOpen.SetActive(true);
else
laptopOpen.SetActive(false);
}
开发者ID:LiamSorta,项目名称:Student-RPG,代码行数:9,代码来源:LaptopHandler.cs
示例20: Log
public static void Log(string logMessage, TextWriter w)
{
w.Write("\r\nLog Entry : ");
w.WriteLine("{0} {1}", DateTime.Now.ToLongTimeString(),
DateTime.Now.ToLongDateString());
w.WriteLine(" :");
w.WriteLine(" :{0}", logMessage);
w.WriteLine("-------------------------------");
}
开发者ID:kjeans,项目名称:online-shop,代码行数:9,代码来源:paypal.aspx.cs
注:本文中的TextWriter类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论