本文整理汇总了C#中FileStream.write方法的典型用法代码示例。如果您正苦于以下问题:C# FileStream.write方法的具体用法?C# FileStream.write怎么用?C# FileStream.write使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FileStream
的用法示例。
在下文中一共展示了FileStream.write方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: do_pascalgen
//.........这里部分代码省略.........
// Member functions of the builder classes
var argstrs = new List<string>();
var argcalls = new List<string>();
foreach (PascalArg parg in pargs)
{
argstrs.Add(wv.fmt("'{0}'", parg.varname));
argcalls.Add(parg.call);
}
setters.Add(wv.fmt(
"function _T{0}.MakeRawSql: string;\n"
+ "begin\n"
+ " result := TPwDatabase.ExecStr('{0}',\n"
+ " [{1}],\n"
+ " [{2}]);\n"
+ "end;\n\n",
elem.name,
argstrs.join( ",\n "),
argcalls.join(",\n ")));
foreach (PascalArg parg in pargs)
setters.Add(parg.GetSetters());
}
var sb = new StringBuilder();
sb.Append("(*\n"
+ " * THIS FILE IS AUTOMATICALLY GENERATED BY sm.exe\n"
+ " * DO NOT EDIT!\n"
+ " *)\n"
+ "unit " + unitname + ";\n\n");
var global_syms_keys = global_syms.Keys.ToList();
global_syms_keys.Sort();
var globalfields = new List<string>();
var globalprops = new List<string>();
foreach (var sym in global_syms_keys)
{
string type = global_syms[sym];
if (type.e())
{
log.print(WvLog.L.Error,
"Global symbol '{0}' is never used in any procedure!\n",
sym);
return;
}
globalfields.Add(wv.fmt("p_{0}: {1};", sym, type));
globalprops.Add(wv.fmt("property {0}: {1} read p_{0} write p_{0};",
sym, type));
}
sb.Append("interface\n\n"
+ "uses Classes, uPwData;\n"
+ "\n"
+ "{$M+}\n"
+ "type\n"
+ " " + types.join("\n ")
+ " \n"
+ " " + classname + " = class(TComponent)\n"
+ " private\n"
+ " fDb: TPwDatabase;\n"
+ " " + globalfields.join("\n ") + "\n"
+ " published\n"
+ " property db: TPwDatabase read fDb write fDb;\n"
+ " " + globalprops.join("\n ") + "\n"
+ " public\n"
+ " constructor Create(db: TPwDatabase); reintroduce;\n"
+ " " + iface.join(" ")
+ " end;\n\n");
sb.Append("implementation\n"
+ "\n"
+ "constructor " + classname + ".Create(db: TPwDatabase);\n"
+ "begin\n"
+ " inherited Create(db);\n"
+ " self.db := db;\n"
+ "end;\n"
+ "\n"
+ impl.join("")
);
sb.Append(setters.join(""));
sb.Append("\n\nend.\n");
if (outfile.e())
Console.Write(sb.ToString());
else
{
Console.Error.Write("Writing file: {0}\n", outfile);
using (var f = new FileStream(outfile,
FileMode.Create, FileAccess.Write))
{
f.write(sb.ToUTF8());
}
}
Console.Error.Write("Done.\n");
}