Esempio n. 1
0
        /// <summary>
        /// Loads the Library from a file.
        /// </summary>
        public void loadLibrary()
        {
            this.libraryNodeViewerList.Clear();

            if (!File.Exists(Path.Combine(WorkSpace.DIR, LIB_FILE_NAME)))
            {
                return;
            }

            NodeSerializer serializer = new NodeSerializer();
            ClassManager   cManager   = Singleton <ClassManager> .Instance;

            JObject json       = JObject.Parse(File.ReadAllText(Path.Combine(WorkSpace.DIR, LIB_FILE_NAME)));
            JToken  arrayToken = new JObject();

            json.TryGetValue("lib", out arrayToken);

            JArray array = arrayToken as JArray;

            if (array != null)
            {
                array
                .Select(n => serializer.deserializeNode(n as JObject, cManager))
                .ForEach(addLibraryNode);
            }
        }