Показать сообщение отдельно
Старый 11.04.2016, 11:58   #2  
Art_Tanis is offline
Art_Tanis
Участник
 
225 / 36 (2) +++
Регистрация: 04.02.2014
Проблема решена
Вот пример замечательного джобика описывающего работа по получения курса валюты:
X++:
static void ExchRateTest(Args _args)
{
    Currency                    currency;
    str                         url;
    str                         exchRate = "";
    str                         fromCurrency, toCurrency;
 

    System.Net.HttpWebRequest   httpRequest  = null;
    System.Net.HttpWebResponse  httpResponse = null;
    CLRObject                   clro         = null;
    System.IO.Stream            stream       = null;
    System.IO.StreamReader      streamReader = null;
    ;

    fromCurrency    = 'USD';
    toCurrency      = 'INR';

    url = "http://finance.yahoo.com/d/quotes.csv?e=.csv&f=l1&s=" + fromCurrency + toCurrency + "=X";

    try
    {
        new InteropPermission(InteropKind::ClrInterop).assert();
        clro         = System.Net.WebRequest::Create(url);
        httpRequest  = clro;
        httpResponse = httpRequest.GetResponse();
        stream = httpResponse.GetResponseStream();
        streamReader = new System.IO.StreamReader(stream);
        exchRate = streamReader.ReadToEnd();

        info(strFmt("%1 to %2 - %3",fromCurrency,toCurrency,exchRate));
        CodeAccessPermission::revertAssert();
    }
    catch(Exception::CLRError)
    {
        throw error(AifUtil::getClrErrorMessage());
    }
}
За это сообщение автора поблагодарили: AlexeyS (1), Logger (3).