本文整理汇总了C#中Writer类的典型用法代码示例。如果您正苦于以下问题:C# Writer类的具体用法?C# Writer怎么用?C# Writer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Writer类属于命名空间,在下文中一共展示了Writer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Config
public Config(Writer writer, Format fmt, GetConfig get_new_config)
{
m_fmt = fmt;
m_get_new_config = get_new_config ?? no_new_config;
file = new VectFormatter(writer);
file.seperator = fmt.line_spacing > 0 ? "" : " ";
file.seperator_spacing = fmt.line_spacing;
file.footer_spacing = 1;
top_vect = new_vect(writer, fmt.format_vect, "#(", "TV");
vect = new_vect(writer, fmt.format_vect, "#(", "V");
vect_cdr = new_vect(writer, fmt.format_vect, " . #(", "-V");
cons = new_cons(writer, fmt.do_abbrev, true, "C");
top_cons = new_cons(writer, fmt.do_abbrev, true, "TC");
vect_cons = new_cons(writer, fmt.do_abbrev, fmt.format_vect, "VC");
head_cons = new_cons(writer, fmt.do_abbrev, fmt.format_head, "HC");
vect_cons_cdr = new_cons_cdr(writer, fmt.format_vect, fmt.dot_cdr, fmt.dot_nil, "-VC");
head_cons_cdr = new_cons_cdr(writer, fmt.format_head, fmt.dot_cdr, fmt.dot_nil, "-HC");
appl_cons_cdr = new_cons_cdr(writer, fmt.format_appl, fmt.dot_cdr, fmt.dot_nil, "-AC");
data_cons_cdr = new_cons_cdr(writer, fmt.format_data, fmt.dot_cdr, fmt.dot_nil, "-DC");
atom = new AtomFormatter(writer);
atom_cdr = new AtomFormatter(writer);
atom_cdr.header = " . ";
}
示例2: Main
public static int Main(string[] args)
{
gdcm.FileMetaInformation.SetSourceApplicationEntityTitle( "My Reformat App" );
// http://www.oid-info.com/get/1.3.6.1.4.17434
string THERALYS_ORG_ROOT = "1.3.6.1.4.17434";
gdcm.UIDGenerator.SetRoot( THERALYS_ORG_ROOT );
System.Console.WriteLine( "Root dir is now: " + gdcm.UIDGenerator.GetRoot() );
string filename = args[0];
string outfilename = args[1];
Reader reader = new Reader();
reader.SetFileName( filename );
if( !reader.Read() )
{
System.Console.WriteLine( "Could not read: " + filename );
return 1;
}
UIDGenerator uid = new UIDGenerator(); // helper for uid generation
FileDerivation fd = new FileDerivation();
// For the pupose of this execise we will pretend that this image is referencing
// two source image (we need to generate fake UID for that).
string ReferencedSOPClassUID = "1.2.840.10008.5.1.4.1.1.7"; // Secondary Capture
fd.AddReference( ReferencedSOPClassUID, uid.Generate() );
fd.AddReference( ReferencedSOPClassUID, uid.Generate() );
// Again for the purpose of the exercise we will pretend that the image is a
// multiplanar reformat (MPR):
// CID 7202 Source Image Purposes of Reference
// {"DCM",121322,"Source image for image processing operation"},
fd.SetPurposeOfReferenceCodeSequenceCodeValue( 121322 );
// CID 7203 Image Derivation
// { "DCM",113072,"Multiplanar reformatting" },
fd.SetDerivationCodeSequenceCodeValue( 113072 );
fd.SetFile( reader.GetFile() );
// If all Code Value are ok the filter will execute properly
if( !fd.Derive() )
{
return 1;
}
gdcm.FileMetaInformation fmi = reader.GetFile().GetHeader();
// The following three lines make sure to regenerate any value:
fmi.Remove( new gdcm.Tag(0x0002,0x0012) );
fmi.Remove( new gdcm.Tag(0x0002,0x0013) );
fmi.Remove( new gdcm.Tag(0x0002,0x0016) );
Writer writer = new Writer();
writer.SetFileName( outfilename );
writer.SetFile( fd.GetFile() );
if( !writer.Write() )
{
System.Console.WriteLine( "Could not write: " + outfilename );
return 1;
}
return 0;
}
示例3: Render
/// <summary>
/// Renders a tokens representation (or interpolated lambda result) escaping the
/// result
/// </summary>
/// <param name="writer">The writer to write the token to</param>
/// <param name="context">The context to discover values from</param>
/// <param name="partials">The partial templates available to the token</param>
/// <param name="originalTemplate">The original template</param>
/// <returns>The rendered token result that has been escaped</returns>
public string Render(Writer writer, Context context, IDictionary<string, string> partials, string originalTemplate)
{
var value = context.Lookup(Value);
value = InterpolateLambdaValueIfPossible(value, writer, context, partials);
return value != null ? WebUtility.HtmlEncode(value.ToString()) : null;
}
示例4: Render
/// <summary>
/// Renders a tokens representation if the value (or interpolated value result)
/// is truthy
/// </summary>
/// <param name="writer">The writer to write the token to</param>
/// <param name="context">The context to discover values from</param>
/// <param name="partials">The partial templates available to the token</param>
/// <param name="originalTemplate">The original template</param>
/// <returns>The rendered result of the token if the resolved value is not truthy</returns>
public string Render(Writer writer, Context context, IDictionary<string, string> partials, string originalTemplate)
{
var value = context.Lookup(Value);
value = InterpolateLambdaValueIfPossible(value, writer, context, partials);
return !context.IsTruthyValue(value) ? writer.RenderTokens(ChildTokens, context, partials, originalTemplate) : null;
}
示例5: Read
public override void Read(object input, ObjectReader reader, Writer writer, PartialOptions optionsOverride)
{
if (ReferenceStructure(input, reader, optionsOverride))
return;
reader.AddReference();
writer.Write(input);
}
示例6: Main
public static int Main(string[] args)
{
string directory = args[0];
string outfilename = args[1];
Directory d = new Directory();
uint nfiles = d.Load( directory, true );
if(nfiles == 0) return 1;
//System.Console.WriteLine( "Files:\n" + d.toString() );
// Implement fast path ?
// Scanner s = new Scanner();
string descriptor = "My_Descriptor";
FilenamesType filenames = d.GetFilenames();
gdcm.DICOMDIRGenerator gen = new DICOMDIRGenerator();
gen.SetFilenames( filenames );
gen.SetDescriptor( descriptor );
if( !gen.Generate() )
{
return 1;
}
gdcm.FileMetaInformation.SetSourceApplicationEntityTitle( "GenerateDICOMDIR" );
gdcm.Writer writer = new Writer();
writer.SetFile( gen.GetFile() );
writer.SetFileName( outfilename );
if( !writer.Write() )
{
return 1;
}
return 0;
}
示例7: Time
public Time(Writer writer)
: base("!time")
{
this.writer = writer;
nz = TimeZoneInfo.FindSystemTimeZoneById("New Zealand Standard Time");
eu = TimeZoneInfo.FindSystemTimeZoneById("Central European Standard Time");
}
示例8: Read
public override void Read(object input, ObjectReader reader, Writer writer, PartialOptions optionsOverride)
{
if (ReferenceStructure(input, reader, optionsOverride))
return;
if (ShouldWriteTypeIdentifier(reader.Options, optionsOverride))
writer.BeginStructure(CurrentTypeResolver.GetTypeIdentifier(Type), reader.GetType());
else
writer.BeginStructure(Type);
for (int i = 0; i < AllSerializableProperties.Length; i++)
{
PropertyDefinition property = AllSerializableProperties[i];
if (property.MatchesPropertyFilter(reader.Options))
{
writer.AddProperty(property.SerializedName);
reader.PropertyStack.Push(property);
object value = property.GetFrom(input);
property.Read(value, reader, writer);
reader.PropertyStack.Pop();
}
}
writer.EndStructure();
}
示例9: Save
public void Save()
{
Writer a = new Writer(Guid.NewGuid().ToString());
s1.Save(a);
s1.Flush();
Assert.IsTrue(a.Id > 0);
}
示例10: Read
public override void Read(object input, ObjectReader reader, Writer writer, PartialOptions optionsOverride)
{
if ((optionsOverride.EnumSerialization ?? reader.Options.EnumSerialization) == EnumSerialization.AsString)
writer.Write(input.ToString());
else
writer.Write((int)input);
}
示例11: Read
public override void Read(object input, ObjectReader reader, Writer writer, PartialOptions optionsOverride)
{
IDictionary dictionary = input as IDictionary;
if (dictionary == null) return;
if (ReferenceStructure(input, reader, optionsOverride))
return;
if (ShouldWriteTypeIdentifier(reader.Options, optionsOverride))
writer.BeginStructure(CurrentTypeResolver.GetTypeIdentifier(Type), reader.GetType());
else
writer.BeginStructure(Type);
foreach (object key in dictionary.Keys)
{
// Convert.ToString is in case the keys are numbers, which are represented
// as strings when used as keys, but can be indexed with numbers in JavaScript
string name = Convert.ToString(key, CultureInfo.InvariantCulture);
object value = dictionary[key];
writer.AddProperty(name);
ValueTypeDef.ReadObject(value, reader, writer, PartialOptions.Default);
}
writer.EndStructure();
}
示例12: WriteNodes
public override void WriteNodes(Writer writer) {
for (int i = 0; i < Prisoners.Count; i++) {
Digger digger = Prisoners[i];
digger.Label = "[i " + i + "]";
writer.WriteNode(digger);
}
}
示例13: WriteNodes
public override void WriteNodes(Writer writer) {
for (int i = 0; i < Prisoners.Count; i++) {
Informant informant = Prisoners[i];
informant.Label = "[i " + i + "]";
writer.WriteNode(informant);
}
}
示例14: VCFWriter
//JAVA TO C# CONVERTER WARNING: 'final' parameters are not allowed in .NET:
//ORIGINAL LINE: public VCFWriter(final File location, final OutputStream output, final net.sf.samtools.SAMSequenceDictionary refDict, final boolean enableOnTheFlyIndexing, boolean doNotWriteGenotypes, final boolean allowMissingFieldsInHeader)
public VCFWriter(File location, OutputStream output, SAMSequenceDictionary refDict, bool enableOnTheFlyIndexing, bool doNotWriteGenotypes, bool allowMissingFieldsInHeader) : base(writerName(location, output), location, output, refDict, enableOnTheFlyIndexing)
{
this.doNotWriteGenotypes = doNotWriteGenotypes;
this.allowMissingFieldsInHeader = allowMissingFieldsInHeader;
this.charset = Charset.forName("ISO-8859-1");
this.writer = new OutputStreamWriter(lineBuffer, charset);
}
示例15: Read
public override void Read(object input, ObjectReader reader, Writer writer, PartialOptions optionsOverride)
{
if (writer.CanWrite(input))
writer.Write(input);
else
base.Read(input, reader, writer, optionsOverride);
}