Engines/FlatRedBallXNA/FlatRedBall/IO/HttpManager.cs
/// <summary>Does an HTTP Get, and deserializes the XML result (assumes UTF8) with the File Manager Deserializer.</summary>
Does an HTTP Get, and deserializes the XML result (assumes UTF8) with the File Manager Deserializer.
Does an HTTP Get and deserializes the XML result ( assumes UTF8 ) with the File Manager Deserializer .
public static int PerformHttpGetAsXml<T>(Uri uri, Action<T, int> action, Action<Exception, int> error)
        {
            int returnValue = PerformHttpGet(uri, (xml, id) =>
                {
                    byte[] bytes = Encoding.UTF8.GetBytes(xml);
                    try
                    {
                        using (var stream = new MemoryStream(bytes))
                        {
                            T deserialized = FileManager.XmlDeserialize<T>(stream);
                            action(deserialized, id);
                        }
                    }
                    catch (Exception ex)
                    {
#if DEBUG
#endif
                        if (error != null) error(ex, id);
                        else throw;
                    }
                }, error);
            return returnValue;
        }
public static int PerformHttpGetAsXml < T > ( Uri uri , Action < T , int > action , Action < Exception , int > error ) { int returnValue = PerformHttpGet ( uri , ( xml , id ) => { byte [ ] bytes = Encoding . UTF8 . GetBytes ( xml ) ; try { using ( var stream = new MemoryStream ( bytes ) ) { T deserialized = FileManager . XmlDeserialize < T > ( stream ) ; action ( deserialized , id ) ; } } catch ( Exception ex ) { if DEBUG endif if ( error != null ) error ( ex , id ) ; else throw ; } } , error ) ; return returnValue ; }
Does an HTTP Get, and deserializes the XML result (assumes UTF8) with the File Manager Deserializer.
Does an HTTP Get and deserializes the XML result ( assumes UTF8 ) with the File Manager Deserializer .
//string text = ByteArrayToString(bytes);
uri
Uri
action
Action<T, int>
error
Action<Exception, int>