Example #1
0
        public static RivetFilingFeed Load(string path)
        {
            RivetFilingFeed feed = new RivetFilingFeed();

            if (path.StartsWith("http", StringComparison.InvariantCultureIgnoreCase))
            {
                string tmp = Path.GetTempFileName();
                using (WebClient cli = new WebClient())
                {
                    cli.DownloadFile(path, tmp);
                }
                path = tmp;
            }

            using (FileStream fs = new FileStream(path, FileMode.Open, FileAccess.Read))
            {
                XmlSerializer s = new XmlSerializer(typeof(RivetFilingFeed));
                feed = (RivetFilingFeed)s.Deserialize(fs);
            }

            return(feed);
        }
Example #2
0
        public static RivetFilingFeed Load( string path )
        {
            RivetFilingFeed feed = new RivetFilingFeed();

            if( path.StartsWith( "http", StringComparison.InvariantCultureIgnoreCase ) )
            {
                string tmp = Path.GetTempFileName();
                using( WebClient cli = new WebClient() )
                {
                    cli.DownloadFile( path, tmp );
                }
                path = tmp;
            }

            using( FileStream fs = new FileStream( path, FileMode.Open, FileAccess.Read ) )
            {
                XmlSerializer s = new XmlSerializer( typeof( RivetFilingFeed ) );
                feed = (RivetFilingFeed)s.Deserialize( fs );
            }

            return feed;
        }