Actually I have an application in that I'm reading Stream data using StreamReader line to line and Inserting into Data Base If any Case Internet Connection Closed or system shutdown then i want to resume Stramreader don't want to read from starting Position of the Stream.
- Stream stream = res.GetResponseStream();
- using (StreamReader sr = new StreamReader(stream))
- {
- int i = 1;
- int j = 0;
- string ss = "";
- List<string> strContent = new List<string>();
- while (i > j)
- {
- StringBuilder sb = new StringBuilder();
- while (!sr.EndOfStream)
- {
- string line = sr.ReadLine();
- ss = ss + line;
- i++;
- if (line.Equals("</record>"))
- {
- if ((sr.EndOfStream))
- {
- }
- else
- {
- ss = ss + "</records>";
- }
- var mySourceDoc = new XmlDocument();
-
- mySourceDoc.LoadXml(ss);
-
- XmlDocument xmlAPDP = new XmlDocument();
- xmlAPDP.LoadXml(ss);
- XmlNodeReader xmlReader = new XmlNodeReader(xmlAPDP);
- DataSet dataSet = new DataSet();
- dataSet.ReadXml(xmlReader);
- string sds = WriteXML(dataSet);
- ss = "";
- ss = "<?xml version='1.0' encoding='utf-8'?><records xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:noNamespaceSchemaLocation ='premium-world-check.xsd'>";
- j = i;
- i = j + 1;
- break;
- }
- }
- if ((sr.EndOfStream))
- {
- break;
- }
- }
- }