Search Unity

How to use UniParse in Windows Universal App

Discussion in 'Windows' started by Deleted User, Nov 27, 2014.

  1. Deleted User

    Deleted User

    Guest

    Hello,everybody:
    In my game,I used the UniParse to get data from my web.It runned very good in Android.However ,When I want port my game to Windiws Universal App,there are many errors.Someone can help solve it?Thanks a lot!
     
  2. Aurimas-Cernius

    Aurimas-Cernius

    Unity Technologies

    Joined:
    Jul 31, 2013
    Posts:
    3,732
    What kind of errors? Are those missing types, methods?
     
  3. Deleted User

    Deleted User

    Guest

    Yes.The UniParse use some classes such as TcpClient and SslStream.I don't knows how to change it .Could you help me?Thanks a lot.
     
  4. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,674
    Do you have the source code for the plugin? If not, there's not much you can do, except for contacting the plugin author.
     
  5. Deleted User

    Deleted User

    Guest

    I have the source code for the plugin.However,I don't know how to change these problem.Following is the problem where in the plugin source code:

    ThreadPool.QueueUserWorkItem(new WaitCallback(delegate(object t)
    {
    try
    {
    var retry = 0;
    while (++retry < maximumRetryCount)
    {
    if (useCache)
    {
    string etag = "";
    if (etags.TryGetValue(uri.AbsoluteUri, out etag))
    {
    SetHeader("If-None-Match", etag);
    }
    }
    SetHeader("Host", uri.Host);
    var client = new TcpClient();
    client.Connect(uri.Host, uri.Port);
    using (var stream = client.GetStream())
    {
    var ostream = stream as Stream;
    if (uri.Scheme.ToLower() == "https")
    {
    JohnTest(uri.ToString());
    ostream = new SslStream(stream, false, new RemoteCertificateValidationCallback(ValidateServerCertificate));
    try
    {
    var ssl = ostream as SslStream;
    ssl.AuthenticateAsClient(uri.Host);
    }
    catch (Exception e)
    {
    }
    }

    WriteToStream(ostream);
    response = new Response();
    state = RequestState.Reading;
    response.ReadFromStream(ostream);
    processDel(this);
    }
    client.Close();
    switch (response.status)
    {
    case 307:
    case 302:
    case 301:
    uri = new Uri(response.GetHeader("Location"));
    continue;
    default:
    retry = maximumRetryCount;
    break;
    }
    }
    if (useCache)
    {
    string etag = response.GetHeader("etag");
    if (etag.Length > 0)
    etags[uri.AbsoluteUri] = etag;
    }

    }
    catch (Exception e)
    {
    exception = e;

    isDone = true;

    if (errorHandleDelegate != null)
    {
    errorHandleDelegate(e);
    }

    }

    state = RequestState.Done;
    isDone = true;
    }));

    public static bool ValidateServerCertificate(object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors)
    {
    return true;
    }
     
  6. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,674
    If you have the source code, it should be easier to fix. However, it might still take some effort. You'll have to replace/reimplement unavailable classes yourself.