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


C# StringReader.Close方法代码示例

本文整理汇总了C#中System.IO.StringReader.Close方法的典型用法代码示例。如果您正苦于以下问题:C# StringReader.Close方法的具体用法?C# StringReader.Close怎么用?C# StringReader.Close使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.IO.StringReader的用法示例。


在下文中一共展示了StringReader.Close方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CreatePDF

        public bool CreatePDF(string text, string outPutPath)
        {
            var returnValue = false;
            try
            {
                StringReader sr = new StringReader(text);

              //  Document pdfDoc = new Document(PageSize.LETTER, 30, 30, 40, 30);
                Document pdfDoc = new Document(PageSize.A4, 30, 30, 40, 30);

                HTMLWorker htmlparser = new HTMLWorker(pdfDoc);
                //PdfWriter.GetInstance(pdfDoc, new FileStream(@"d:\Temp\Test.pdf", FileMode.Create));

                PdfWriter pdfWriter = PdfWriter.GetInstance(pdfDoc, new FileStream(outPutPath, FileMode.Create));
                //pdfWriter.PageEvent = new ITextEvents();

                pdfDoc.Open();

                htmlparser.Parse(sr);
                pdfDoc.Close();
                sr.Close();
                returnValue = true;
            }
            catch { }

            return returnValue;
        }
开发者ID:rayanc,项目名称:Pecuniaus,代码行数:27,代码来源:PdfHelper.cs

示例2: GetData

        public static UserInterfaceData GetData(string data)
        {
            UserInterfaceData userInterfaceData = new UserInterfaceData();

            StringReader reader = new StringReader(data);

            string line = "";
            int lineNumber = 0;

            while ((line = reader.ReadLine()) != null)
            {
                lineNumber++;

                if (line == "[/USERINTERFACES]")
                {
                    break;
                }
                else if (line == "[USERINTERFACE]")
                {
                    userInterfaceData.UserInterfaces.Add(ReadUserInterface(ref reader, ref lineNumber));
                }
            }

            reader.Close();
            reader.Dispose();

            return userInterfaceData;
        }
开发者ID:andreberg,项目名称:TLII.IO,代码行数:28,代码来源:UserInterfaceDataConverter.cs

示例3: PasteProcessor

 public PasteProcessor(ConnectionTag tag, string text)
 {
     _tag = tag;
     StringReader r = new StringReader(text);
     Fill(r);
     r.Close();
 }
开发者ID:rfyiamcool,项目名称:solrex,代码行数:7,代码来源:Paste.cs

示例4: ParseDatatxt

        public static DatatxtDesc ParseDatatxt(string st)
        {
            DatatxtDesc result = new DatatxtDesc();
            StringReader sr = new StringReader(st);
            string line;
            while ((line = sr.ReadLine()) != null)
            {
                if (line.Trim().Length == 0) continue;
                if (line.Trim() == "<object>")
                    while ((line = sr.ReadLine()) != null)
                    {
                        if (line.Trim() == "<object_end>") break;
                        ObjectInfo of = new ObjectInfo(GetTagAndIntValue(line, "id:"),
                                                         GetTagAndIntValue(line, "type:"),
                                                         GetTagAndStrValue(line, "file:"));
                        result.lObject.Add(of);

                    }
                if (line.Trim() == "<background>")
                    while ((line = sr.ReadLine()) != null)
                    {
                        if (line.Trim() == "<background_end>") break;
                        BackgroundInfo bf = new BackgroundInfo(GetTagAndIntValue(line, "id:"), GetTagAndStrValue(line, "file:"));
                        result.lBackground.Add(bf);
                    }

            }
            sr.Close();
            return result;
        }
开发者ID:NightmareX1337,项目名称:lfs,代码行数:30,代码来源:DatFiles.cs

示例5: MIMEHeader

 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="HeaderText">Text for the header</param>
 public MIMEHeader(string HeaderText)
 {
     if(string.IsNullOrEmpty(HeaderText))
         throw new ArgumentNullException("Header text can not be null");
     StringReader Reader=new StringReader(HeaderText);
     try
     {
         string LineRead=Reader.ReadLine();
         string Field=LineRead+"\r\n";
         while(!string.IsNullOrEmpty(LineRead))
         {
             LineRead=Reader.ReadLine();
             if (!string.IsNullOrEmpty(LineRead) && (LineRead[0].Equals(' ') || LineRead[0].Equals('\t')))
             {
                 Field += LineRead + "\r\n";
             }
             else
             {
                 Fields.Add(new Field(Field));
                 Field = LineRead + "\r\n";
             }
         }
     }
     finally
     {
         Reader.Close();
         Reader=null;
     }
 }
开发者ID:summer-breeze,项目名称:ChengGouHui,代码行数:33,代码来源:MIMEHeader.cs

示例6: DeserializeLLSDNotation

 public static OSD DeserializeLLSDNotation(string notationData)
 {
     StringReader reader = new StringReader(notationData);
     OSD osd = DeserializeLLSDNotation(reader);
     reader.Close();
     return osd;
 }
开发者ID:nivardus,项目名称:libopenmetaverse,代码行数:7,代码来源:NotationLLSD.cs

示例7: TestPublic

        public void TestPublic()
        {
            TextReader reader = new StringReader(OpenIdTestBase.LoadEmbeddedFile("dhpriv.txt"));

            try {
                string line;
                while ((line = reader.ReadLine()) != null) {
                    string[] parts = line.Trim().Split(' ');
                    byte[] x = Convert.FromBase64String(parts[0]);
                    DiffieHellmanManaged dh = new DiffieHellmanManaged(AssociateDiffieHellmanRequest.DefaultMod, AssociateDiffieHellmanRequest.DefaultGen, x);
                    byte[] pub = dh.CreateKeyExchange();
                    byte[] y = Convert.FromBase64String(parts[1]);

                    if (y[0] == 0 && y[1] <= 127) {
                        y.CopyTo(y, 1);
                    }

                    Assert.AreEqual(
                        Convert.ToBase64String(y),
                        Convert.ToBase64String(DiffieHellmanUtilities.EnsurePositive(pub)),
                        line);
                }
            } finally {
                reader.Close();
            }
        }
开发者ID:vrushalid,项目名称:dotnetopenid,代码行数:26,代码来源:DiffieHellmanTests.cs

示例8: UsingStringReaderAndStringWriter

        private void UsingStringReaderAndStringWriter()
        {
            Console.WriteLine("String Reader and String Writer example");
            Console.WriteLine("Some APIs expects TestWriter and TextReader but they can't work with string or StringBuilder. StringWriter and StringReader adapts to the interface of StringBuilder.");

            StringWriter stringWriter = new StringWriter();
            using (XmlWriter writer = XmlWriter.Create(stringWriter))
            {
                writer.WriteStartElement("book");
                writer.WriteElementString("price", "19.95");
                writer.WriteEndElement();
                writer.Flush();
            }

            string xml = stringWriter.ToString();
            Console.WriteLine("String created using StringWriter and XMLWriter is :");
            Console.WriteLine(xml);

            StringReader stringReader = new StringReader(xml);
            using (XmlReader reader = XmlReader.Create(stringReader))
            {
                reader.ReadToFollowing("price");
                decimal price = decimal.Parse(reader.ReadInnerXml(),new CultureInfo("en-US"));
                Console.WriteLine("Price read using String Reader and XMLReader is :" + price);
            }

            stringWriter.Close();
            stringReader.Close();
        }
开发者ID:mayankaggarwal,项目名称:MyConcepts,代码行数:29,代码来源:StringManipulationExamples.cs

示例9: LoadV1

        void LoadV1(BinaryReader binread)
        {
            var strread = new StringReader(binread.ReadString());
            var xmlread = XmlReader.Create(strread);
            var xmlserializer = new XmlSerializer(engineStartParams.type);
            engineStartParams.Load(xmlserializer.Deserialize(xmlread));
            strread.Close ();
            xmlread.Close ();

            int count = binread.ReadInt32();
            for(int i=0;i<count;i++)
            {
                var enabled = binread.ReadBoolean();
                var typestr = binread.ReadString();
                var type = Type.GetType (typestr);
                if(type == null)
                {
                    binread.ReadString(); // can't find type, so just read and throw away
                    continue;
                }
                var xmlserializer2 = new XmlSerializer(type);
                strread = new StringReader(binread.ReadString());
                xmlread = XmlReader.Create(strread);
                customGameStartParams[type].Load(xmlserializer2.Deserialize(xmlread));
                strread.Close ();
                xmlread.Close ();
                customGameStartParams[type].enabled = enabled;
            }
            binread.Close();
            xmlread.Close();
        }
开发者ID:TinnapopSonporm,项目名称:SinozeEngineBird,代码行数:31,代码来源:GameSetupIO.cs

示例10: GetData

        public static TriggerableData GetData(string data)
        {
            TriggerableData triggerableData = new TriggerableData();

            StringReader reader = new StringReader(data);

            string line = "";
            int lineNumber = 0;

            while ((line = reader.ReadLine()) != null)
            {
                lineNumber++;

                if (line == "[/TRIGGERABLES]")
                {
                    break;
                }
                else if (line == "[TRIGGERABLE]")
                {
                    triggerableData.Triggerables.Add(ReadTriggerable(ref reader, ref lineNumber));
                }
            }

            reader.Close();
            reader.Dispose();

            return triggerableData;
        }
开发者ID:andreberg,项目名称:TLII.IO,代码行数:28,代码来源:TriggerableDataConverter.cs

示例11: CreateRegistry

        public static FunctionMetadataRegistry CreateRegistry()
        {
            StringReader br = new StringReader(Resource1.functionMetadata);

            FunctionDataBuilder fdb = new FunctionDataBuilder(400);

            try
            {
                while (true)
                {
                    String line = br.ReadLine();
                    if (line == null)
                    {
                        break;
                    }
                    if (line.Length < 1 || line[0] == '#')
                    {
                        continue;
                    }
                    String TrimLine = line.Trim();
                    if (TrimLine.Length < 1)
                    {
                        continue;
                    }
                    ProcessLine(fdb, line);
                }
                br.Close();
            }
            catch (IOException)
            {
                throw;
            }

            return fdb.Build();
        }
开发者ID:ChiangHanLung,项目名称:PIC_VDS,代码行数:35,代码来源:FunctionMetadataReader.cs

示例12: GetData

        public static SkillData GetData(string data)
        {
            SkillData skillData = new SkillData();

            StringReader reader = new StringReader(data);

            string line = "";
            int lineNumber = 0;

            while ((line = reader.ReadLine()) != null)
            {
                lineNumber++;

                if (line == "[/SKILLS]")
                {
                    break;
                }
                else if (line == "[SKILL]")
                {
                    skillData.Skills.Add(ReadSkill(ref reader, ref lineNumber));
                }
            }

            reader.Close();
            reader.Dispose();

            return skillData;
        }
开发者ID:andreberg,项目名称:TLII.IO,代码行数:28,代码来源:SkillDataConverter.cs

示例13: MIMEHeader

 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="HeaderText">Text for the header</param>
 public MIMEHeader(string HeaderText)
 {
     Contract.Requires<ArgumentNullException>(!string.IsNullOrEmpty(HeaderText), "HeaderText");
     this.Fields = new List<Field>();
     StringReader Reader=new StringReader(HeaderText);
     try
     {
         string LineRead=Reader.ReadLine();
         string Field=LineRead+"\r\n";
         while(!string.IsNullOrEmpty(LineRead))
         {
             LineRead=Reader.ReadLine();
             if (!string.IsNullOrEmpty(LineRead) && (LineRead[0].Equals(' ') || LineRead[0].Equals('\t')))
             {
                 Field += LineRead + "\r\n";
             }
             else
             {
                 Fields.Add(new Field(Field));
                 Field = LineRead + "\r\n";
             }
         }
     }
     finally
     {
         Reader.Close();
         Reader=null;
     }
 }
开发者ID:kaytie,项目名称:Craig-s-Utility-Library,代码行数:33,代码来源:MIMEHeader.cs

示例14: LoadFromString

 public static Object LoadFromString( String targetString, Type targetType ) {
     XmlSerializer serializer = new XmlSerializer( targetType );
     TextReader textReader = new StringReader( targetString );
     Object result = serializer.Deserialize( textReader );
     textReader.Close();
     return result;
 }
开发者ID:mfz888,项目名称:xcore,代码行数:7,代码来源:EasyDB.cs

示例15: AddBPMChangesFromChart

        /// <summary>
        /// Opens a specified chart and reads in all the valid BPM changes 
        /// (i.e. 23232 = B 162224) and returns a populated list.
        /// </summary>
        /// <param name="inputFile">
        /// The whole *.chart file stored in one massive string.
        /// </param>
        /// <returns>
        /// A list containing every valid BPM change from the chart.  Due to the nature
        /// of the *.chart specification, these BPM changes will be in proper order.
        /// </returns>
        public static List<BPMChange> AddBPMChangesFromChart(string inputFile)
        {
            List<BPMChange> BPMChangeListToReturn = new List<BPMChange>();

            // Single out the BPM section via regular expressions
            string pattern = Regex.Escape("[") + "SyncTrack]\\s*" + Regex.Escape("{") + "[^}]*";
            Match matched_section = Regex.Match(inputFile, pattern);

            // Create the stream from the singled out section of the input string
            StringReader pattern_stream = new StringReader(matched_section.ToString());
            string current_line = "";
            string[] parsed_line;

            while ((current_line = pattern_stream.ReadLine()) != null)
            {
                // Trim and split the line to retrieve information
                current_line = current_line.Trim();
                parsed_line = current_line.Split(' ');

                // If a valid change is found, add it to the list
                if (parsed_line.Length == 4)
                {
                    if (parsed_line[2] == "B")
                        BPMChangeListToReturn.Add(new BPMChange(Convert.ToUInt32(parsed_line[0]), Convert.ToUInt32(parsed_line[3])));
                }
            }

            // Close the string stream
            pattern_stream.Close();

            return BPMChangeListToReturn;
        }
开发者ID:huming2207,项目名称:ghgame,代码行数:43,代码来源:ChartBPMManager.cs


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