Пример #1
0
        public DependencyGraphManager()
        {
            if (!File.Exists(persistencePath))
            {
                // Although a missing dependency graph is unusual, we hope that it
                // will be renewed next time we check for updates.
                Utils.Warn("Couldn't load dependency graph ({0})", persistencePath);
                return;
            }

            current = DependencyGraphObject.FromJson(File.ReadAllText(persistencePath));
        }
Пример #2
0
        public bool Manage(string json)
        {
            if (!System.Threading.Monitor.TryEnter(monitorObj, ManageTimeout))
            {
                Utils.Log("Plugin or kit update is in progress, delaying managing new dependency graph");
                return(false);
            }

            try {
                DependencyGraphObject latest = DependencyGraphObject.FromJson(json);

                if (current == null || IsNewer(current.Version, latest.Version))
                {
                    File.WriteAllText(persistencePath, json);
                    current = latest;
                    Utils.Log("Updated dependency graph to {0}", latest.Version);
                }
            } finally {
                System.Threading.Monitor.Exit(monitorObj);
            }

            return(true);
        }