Exemple #1
0
    /// <summary>
    /// Converts the dump response to string.
    /// </summary>
    /// <param name='response'>
    /// The dump response. Because dump response can be up to 16 MB, it is passed as a reference. However, the method won't modify it.
    /// </param>
    /// <param name='data'>
    /// The dumpt data. Because the data can be up to 16 MB, it is passed as out.
    /// </param>
    public void DumpResponseToString(ref string response, out string data)
    {
        int returnIndex = response.IndexOf('\n');

        if (returnIndex == -1)
        {
            GJDebug("Wrong response format. Can't read response.", LogType.Error);
            data = string.Empty;
        }
        else
        {
            data = response.Substring(returnIndex + 1);
        }
    }
Exemple #2
0
    /// <summary>
    /// Encrypt the input string to MD5.
    /// </summary>
    /// <returns>
    /// The encrypted string to MD5.
    /// </returns>
    /// <param name='input'>
    /// The string to encrypt.
    /// </param>
    /// <remarks>
    /// This method is taken from the first version of the Unity Game Jolt API and was written by Ashley Gwinnell and Daniel Twomey.
    /// </remarks>
    string MD5(string input)
    {
        // WP8 and Windows Metro fix kindly provided by runewake2 [http://gamejolt.com/profile/runewake2/2008/]
#if UNITY_WP8 || UNITY_METRO
        byte[] data = MD5Core.GetHash(input, System.Text.Encoding.ASCII);
#else
        System.Security.Cryptography.MD5CryptoServiceProvider x = new System.Security.Cryptography.MD5CryptoServiceProvider();
        byte [] data = System.Text.Encoding.ASCII.GetBytes(input);
        data = x.ComputeHash(data);
#endif
        string ret = "";
        for (int i = 0; i < data.Length; i++)
        {
            ret += data [i].ToString("x2").ToLower();
        }
        return(ret);
    }
Exemple #3
0
 /// <summary>
 /// Encrypt the input string to MD5.
 /// </summary>
 /// <returns>
 /// The encrypted string to MD5.
 /// </returns>
 /// <param name='input'>
 /// The string to encrypt.
 /// </param>
 /// <remarks>
 /// This method is taken from the first version of the Unity Game Jolt API and was written by Ashley Gwinnell and Daniel Twomey.
 /// </remarks>
 string MD5(string input)
 {
     // WP8 and Windows Metro fix kindly provided by runewake2 [http://gamejolt.com/profile/runewake2/2008/]
     #if UNITY_WP8 || UNITY_METRO
     byte[] data = MD5Core.GetHash(input, System.Text.Encoding.ASCII);
     #else
     System.Security.Cryptography.MD5CryptoServiceProvider x = new System.Security.Cryptography.MD5CryptoServiceProvider ();
     byte [] data = System.Text.Encoding.ASCII.GetBytes (input);
     data = x.ComputeHash (data);
     #endif
     string ret = "";
     for (int i=0; i < data.Length; i++)
         ret += data [i].ToString("x2").ToLower();
     return ret;
 }
Exemple #4
0
 /// <summary>
 /// Releases unmanaged resources and performs other cleanup operations before the application quit.
 /// </summary>
 void OnApplicationQuit()
 {
     StopAllCoroutines ();
     user = null;
     users = null;
     sessions = null;
     trophies = null;
     scores = null;
     data = null;
     instance = null;
 }
Exemple #5
0
 /// <summary>
 /// Converts the dump response to string.
 /// </summary>
 /// <param name='response'>
 /// The dump response. Because dump response can be up to 16 MB, it is passed as a reference. However, the method won't modify it.
 /// </param>
 /// <param name='data'>
 /// The dumpt data. Because the data can be up to 16 MB, it is passed as out.
 /// </param>
 public void DumpResponseToString(ref string response, out string data)
 {
     int returnIndex = response.IndexOf ('\n');
     if (returnIndex == -1)
     {
         GJDebug ("Wrong response format. Can't read response.", LogType.Error);
         data = string.Empty;
     }
     else
     {
         data = response.Substring (returnIndex + 1);
     }
 }