Ejemplo n.º 1
0
 private void UpdateDatabaseOSX()
 {
     if (File.Exists(_macDBPath + "/" + DBNameDecrypted) == true)
     {
         if (File.Exists(_macDBPath + "/" + DBName) == true)
         {
             File.Delete(_macDBPath + "/" + DBName);
         }
         SecureFile.EncryptFile(_macDBPath + "/" + DBNameDecrypted, _macDBPath + "/" + DBName);
         File.Delete(_macDBPath + "/" + DBNameDecrypted);
     }
 }
Ejemplo n.º 2
0
    private void CreateDatabaseLogicForMac()
    {
        if (Directory.Exists(_macDBPath) == true)
        {
            if (File.Exists(_macDBPath + "/" + DBName) == true)
            {
                if (File.Exists(_macDBPath + "/" + DBNameDecrypted) == true)
                {
                    if (File.Exists(_macDBPath + "/" + DBName) == true)
                    {
                        File.Delete(_macDBPath + "/" + DBName);
                    }

                    SecureFile.EncryptFile(_macDBPath + "/" + DBNameDecrypted, _macDBPath + "/" + DBName);
                }
                else
                {
                    SecureFile.DecryptFile(_macDBPath + "/" + DBName, _macDBPath + "/" + DBNameDecrypted);
                }

                string __foundVersion = CheckBundleVersion();

                if (__foundVersion != CurrentBundleVersion.version)
                {
                    if (File.Exists(_macDBPath + "/" + DBName) == true)
                    {
                        File.Delete(_macDBPath + "/" + DBName);
                    }
                    if (File.Exists(_macDBPath + "/" + DBNameDecrypted) == true)
                    {
                        File.Delete(_macDBPath + "/" + DBNameDecrypted);
                    }

                    File.Copy(Application.streamingAssetsPath + "/" + DBName, _macDBPath + "/" + DBName, true);

                    SecureFile.DecryptFile(_macDBPath + "/" + DBName, _macDBPath + "/" + DBNameDecrypted);

                    InsertBundleVersionDataInDatabase(CurrentBundleVersion.version);
                }
            }
            else
            {
                File.Copy(Application.streamingAssetsPath + "/" + DBName, _macDBPath + "/" + DBName, true);

                if (File.Exists(_macDBPath + "/" + DBNameDecrypted) == true)
                {
                    if (File.Exists(_macDBPath + "/" + DBName) == true)
                    {
                        File.Delete(_macDBPath + "/" + DBName);
                    }

                    SecureFile.EncryptFile(_macDBPath + "/" + DBNameDecrypted, _macDBPath + "/" + DBName);
                }
                else
                {
                    SecureFile.DecryptFile(_macDBPath + "/" + DBName, _macDBPath + "/" + DBNameDecrypted);
                }
            }
        }
        else
        {
            Directory.CreateDirectory(_macDBPath);
            File.Copy(Application.streamingAssetsPath + "/" + DBName, _macDBPath + "/" + DBName, true);
            SecureFile.DecryptFile(_macDBPath + "/" + DBName, _macDBPath + "/" + DBNameDecrypted);

            InsertBundleVersionDataInDatabase(CurrentBundleVersion.version);
        }
    }