Beispiel #1
0
        public string GetPasswordFromLoginData()
        {
            string strdata;

            FileAESCrypter.DecryptFromFile(out strdata, loginDataFilePath);

            NCMBLoginData logindata = JsonUtility.FromJson <NCMBLoginData>(strdata);

            return(logindata.password);
        }
Beispiel #2
0
        public void AutoLogin(EventHandler successEventHandler = null, EventHandler failureEventHandler = null)
        {
            string strdata;

            FileAESCrypter.DecryptFromFile(out strdata, loginDataFilePath);

            NCMBLoginData logindata = JsonUtility.FromJson <NCMBLoginData>(strdata);

            Login(logindata.userName, logindata.password, successEventHandler, failureEventHandler);
        }
Beispiel #3
0
        private void SaveLoginData(string userName, string password)
        {
            NCMBLoginData logindata = new NCMBLoginData();

            logindata.userName = userName;
            logindata.password = password;

            string strdata = JsonUtility.ToJson(logindata);

            FileAESCrypter.EncryptToFile(strdata, loginDataFilePath);
        }
Beispiel #4
0
        public static void GenerateAPIKeyFile(string applicationKey, string clientKey, string apiKeyFilePath)
        {
            if (applicationKey.Length != 64 || clientKey.Length != 64)
            {
                Debug.Log("APIキーの値が不正です。");
            }
            else
            {
                APIKey apiKey = new APIKey();
                apiKey.applicationKey = applicationKey;
                apiKey.clientKey      = clientKey;

                string jsondata = JsonUtility.ToJson(apiKey);
                string path     = "/Resources/" + apiKeyFilePath + ".bytes";

                FileAESCrypter.EncryptToFile(jsondata, Application.dataPath + path);

                AssetDatabase.ImportAsset("Assets" + path);
                Debug.Log("APIキーの生成を行いました。");
            }
        }
Beispiel #5
0
        public override void Awake()
        {
            if (useAPIKeyFile && !string.IsNullOrEmpty(apiKeyFilePath))
            {
                APIKey    ncmbKeyPair = new APIKey();
                TextAsset textAssets  = Resources.Load(apiKeyFilePath) as TextAsset;

                if (textAssets == null)
                {
                    Debug.LogError("APIキーファイルが存在しません。NCMBメニューからAPIキーファイルを作成して下さい。");
                }
                else
                {
                    string strdata = FileAESCrypter.DecryptFromBytes(textAssets.bytes);
                    ncmbKeyPair = JsonUtility.FromJson <APIKey>(strdata);

                    applicationKey = ncmbKeyPair.applicationKey;
                    clientKey      = ncmbKeyPair.clientKey;
                }
            }

            base.Awake();
        }