当前位置: 首页>>代码示例>>C#>>正文


C# Writer类代码示例

本文整理汇总了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 = " . ";
        }
开发者ID:JasonWilkins,项目名称:visitor-tk,代码行数:30,代码来源:Format.cs

示例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;
    }
开发者ID:jcfr,项目名称:Gdcm,代码行数:60,代码来源:ReformatFile.cs

示例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;
        }
开发者ID:StubbleOrg,项目名称:Stubble,代码行数:16,代码来源:EscapedValueToken.cs

示例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;
        }
开发者ID:StubbleOrg,项目名称:Stubble,代码行数:16,代码来源:InvertedToken.cs

示例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);
 }
开发者ID:ZapTechnology,项目名称:ForSerial,代码行数:7,代码来源:ObjectDefinition.cs

示例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;
    }
开发者ID:jcfr,项目名称:Gdcm,代码行数:35,代码来源:GenerateDICOMDIR.cs

示例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");
 }
开发者ID:jincod,项目名称:Skype-Bot,代码行数:7,代码来源:Time.cs

示例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();
        }
开发者ID:ZapTechnology,项目名称:ForSerial,代码行数:29,代码来源:DefaultStructureDefinition.cs

示例9: Save

 public void Save()
 {
     Writer a = new Writer(Guid.NewGuid().ToString());
     s1.Save(a);
     s1.Flush();
     Assert.IsTrue(a.Id > 0);
 }
开发者ID:bjornebjornson,项目名称:GemaAjaxSpike,代码行数:7,代码来源:SchemaFixture.cs

示例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);
 }
开发者ID:soxtoby,项目名称:ForSerial,代码行数:7,代码来源:EnumDefinition.cs

示例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();
        }
开发者ID:soxtoby,项目名称:ForSerial,代码行数:26,代码来源:JsonDictionaryDefinition.cs

示例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);
     }
 }
开发者ID:tdmike,项目名称:PASaveEditor,代码行数:7,代码来源:Diggers.cs

示例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);
     }
 }
开发者ID:tdmike,项目名称:PASaveEditor,代码行数:7,代码来源:Informants.cs

示例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);
		}
开发者ID:w3he,项目名称:Bio.VCF,代码行数:9,代码来源:VCFWriter.cs

示例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);
 }
开发者ID:ZapTechnology,项目名称:ForSerial,代码行数:7,代码来源:ValueTypeDefinition.cs


注:本文中的Writer类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。