Example #1
0
        public AppManifestStore(Func <string, bool> overwriteFunc, Func <string> loadFunc)
        {
            this.buildManifest = new BuildManifest <BuildManifestType>();

            // load or renew runtimeManifest.
            RuntimeManifestType runtimeManifestObj;

            {
                var runtimeManifestObjStr = loadFunc();

                // loaded str is null or empty. need crate new file.
                if (string.IsNullOrEmpty(runtimeManifestObjStr))
                {
                    runtimeManifestObj = new RuntimeManifestType();
                    var jsonStr = JsonUtility.ToJson(runtimeManifestObj);
                    overwriteFunc(jsonStr);
                }
                else
                {
                    runtimeManifestObj = JsonUtility.FromJson <RuntimeManifestType>(runtimeManifestObjStr);
                }
            }

            this.runtimeManifest = new RuntimeManifest <RuntimeManifestType>(runtimeManifestObj);
            this.overwriteFunc   = overwriteFunc;
            this.loadFunc        = loadFunc;
        }
Example #2
0
        public void ReloadFromStorage()
        {
            RuntimeManifestType runtimeManifestObj;

            {
                var runtimeManifestObjStr = loadFunc();

                // loaded str is null or empty. need crate new file.
                if (string.IsNullOrEmpty(runtimeManifestObjStr))
                {
                    runtimeManifestObj = new RuntimeManifestType();
                    var jsonStr = JsonUtility.ToJson(runtimeManifestObj);
                    overwriteFunc(jsonStr);
                }
                else
                {
                    runtimeManifestObj = JsonUtility.FromJson <RuntimeManifestType>(runtimeManifestObjStr);
                }
            }

            this.runtimeManifest = new RuntimeManifest <RuntimeManifestType>(runtimeManifestObj);
        }
Example #3
0
        public void ReloadFromStorage()
        {
            RuntimeManifestType runtimeManifestObj;

            {
                var runtimeManifestObjStr = loadFunc();

                // loaded str is null or empty. need crate new file.
                if (string.IsNullOrEmpty(runtimeManifestObjStr))
                {
                    runtimeManifestObj = new RuntimeManifestType();
                    var jsonStr = JsonUtility.ToJson(runtimeManifestObj);
                    overwriteFunc(jsonStr);
                }
                else
                {
                    // get persisted and compare to coded one.
                    runtimeManifestObj = new RuntimeManifestType();
                    runtimeManifestObj.UpdateFromStoredJson(runtimeManifestObjStr);
                }
            }

            this.runtimeManifest = new RuntimeManifest <RuntimeManifestType>(runtimeManifestObj);
        }