Ejemplo n.º 1
0
        void SandboxExpireCheck()
        {
            if (!Directory.Exists(PathRouter.SandboxPath))
            {
                Directory.CreateDirectory(PathRouter.SandboxPath);
                return;
            }

            string sanboxVersionFile = PathRouter.SandboxPath + PathRouter.Version;
            bool   exists            = File.Exists(sanboxVersionFile);

            if (exists)
            {
                Version sandboxVersion   = Version.Create(File.ReadAllBytes(sanboxVersionFile));
                string  inAppVersionFile = PathRouter.StreamingPath + PathRouter.Version;
                Version inAppVersion;
                if (Application.platform == RuntimePlatform.Android)
                {
                    inAppVersion = Version.Create(AndroidPlugin.GetAssetBytes(inAppVersionFile));
                }
                else
                {
                    inAppVersion = Version.Create(File.ReadAllBytes(inAppVersionFile));
                }

                if (inAppVersion > sandboxVersion)
                {
                    Directory.Delete(PathRouter.SandboxPath, true);
                    HotfixLog.LogFormat(
                        "Clear sandbox files, version(inApp:{0}) > version(sandbox:{1})",
                        inAppVersion, sandboxVersion);
                }
            }
        }