예제 #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);
        }
    }
예제 #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);
    }
예제 #3
0
파일: GJAPI.cs 프로젝트: nyrrrr/LD28
 /// <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;
 }
예제 #4
0
파일: GJAPI.cs 프로젝트: nyrrrr/LD28
 /// <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;
 }
예제 #5
0
파일: GJAPI.cs 프로젝트: nyrrrr/LD28
 /// <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);
     }
 }