Пример #1
0
        public void FromXMLObject(XMLObject xmlObject)
        {
            SearchEngineResult result = GetSearchEngineResultFromXMLObject(xmlObject);

            this._searchEngine = result._searchEngine;
            this._searchUrl    = result._searchUrl;
            this._results      = result._results;
        }
Пример #2
0
 public static void Test()
 {
     SearchEngineResult result = GetSearchResult();
     Console.WriteLine(result);
     XMLObject xmlObject = result.ToXMLObject();
     Console.WriteLine(xmlObject.ToString());
     XMLObject newXmlObject = new XMLObject(xmlObject.ToString());
     Console.WriteLine(newXmlObject.ToString());
     SearchEngineResult newResult = SearchEngineResult.GetSearchEngineResultFromXMLObject(newXmlObject);
     Console.WriteLine(newResult);
     Console.WriteLine(result.ToString() == newResult.ToString());
 }
Пример #3
0
        public static SearchEngineResult GetSearchEngineResultFromXMLObject(XMLObject xmlObject)
        {
            XmlSerializer      xmlSerializer   = new XmlSerializer(typeof(SearchEngineResult));
            StringReader       xmlStringReader = new StringReader(xmlObject.ToString());
            SearchEngineResult result          = xmlSerializer.Deserialize(xmlStringReader) as SearchEngineResult;

            xmlStringReader.Close();
            if (result == null)
            {
                result = new SearchEngineResult();
            }
            return(result);
        }
Пример #4
0
 public void FromXMLObject(XMLObject xmlObject)
 {
     SearchEngineResult result = GetSearchEngineResultFromXMLObject(xmlObject);
     this._searchEngine = result._searchEngine;
     this._searchUrl = result._searchUrl;
     this._results = result._results;
 }
Пример #5
0
 public static SearchEngineResult GetSearchEngineResultFromXMLObject(XMLObject xmlObject)
 {
     XmlSerializer xmlSerializer = new XmlSerializer(typeof(SearchEngineResult));
     StringReader xmlStringReader = new StringReader(xmlObject.ToString());
     SearchEngineResult result = xmlSerializer.Deserialize(xmlStringReader) as SearchEngineResult;
     xmlStringReader.Close();
     if (result == null)
     {
         result = new SearchEngineResult();
     }
     return result;
 }