Exemplo n.º 1
0
        public string reloadData(string newLibraryPath)
        {
            "In Reload data".info();
            if (newLibraryPath.notNull())
            {
                var tmConfig = TMConfig.Current;
                tmConfig.XmlLibrariesPath = newLibraryPath;
                tmConfig.SaveTMConfig();
            }

            GuidanceItems_FileMappings.Clear();
            GuidanceExplorers_XmlFormat.Clear();
            Libraries.Clear();
            Folders.Clear();
            Views.Clear();
            GuidanceItems.Clear();

            if (newLibraryPath.valid())
            {
                setLibraryPath_and_LoadDataIntoMemory(newLibraryPath);
            }
            else
            {
                TM_Xml_Database.loadDataIntoMemory();
            }

            this.reCreate_GuidanceItemsCache();
            this.xmlDB_Load_GuidanceItems();

            this.createDefaultAdminUser();              // make sure this user exists

            return("In the library '{0}' there are {1} library(ies), {2} views and {3} GuidanceItems".
                   format(TM_Xml_Database.Path_XmlLibraries.directoryName(), Libraries.size(), Views.size(), GuidanceItems.size()));
        }
Exemplo n.º 2
0
        private void ReadDatabase()
        {
            string databaseXml = Path.Combine(App.IconLibPath, "database.xml");

            if (!File.Exists(databaseXml))
            {
                DoDatabaseUpdate();
                return;
            }

            Libraries.Clear();

            ProgressDialogResult result = ProgressDialog.ProgressDialog.Execute(
                Owner, "Reading Database", () =>
            {
                ProgressDialog.ProgressDialog.Current.Report("Reading ...");
                XDocument database = XDocument.Load(databaseXml);

                if (!(database.Root is XElement eltLibraries) || eltLibraries.Name != NSIconMaker + "Libraries")
                {
                    return;
                }

                int n = database
                        .Descendants()
                        .Count(d => d.Name.LocalName == "Overlay" || d.Name.LocalName == "Icon");

                ProgressDialog.ProgressDialog.Current.Report(min: 0, max: n, value: 0);

                List <IconLibrary> libraries = new List <IconLibrary>();
                libraries.AddRange(eltLibraries.Elements(NSIconMaker + "Library").Select(eltLibrary => new IconLibrary(eltLibrary)));
                ProgressDialog.ProgressDialog.Current.Arguments.Result = libraries;

                App.WaitForIdle();
            });
Exemplo n.º 3
0
 public static void GetAvailableLibraries(string instanceDirectory, string libraryDirectory, Libraries libraries)
 {
     libraries.Clear();
     string[] directories = libraryDirectory.Split(';');
     for (int index = 0; index < directories.Length; index++)
     {
         GetAvailableLibraries(instanceDirectory, directories[index], libraries, index > 0);
     }
 }
Exemplo n.º 4
0
        /// <summary>
        /// Loads paths to all user steam libraries.
        /// </summary>
        private void LoadLibraries()
        {
            Libraries.Clear();
            Libraries.Add(new Library(this, RootPath));

            var librariesPath = Path.Combine(RootPath, "steamapps", "libraryfolders.vdf");

            if (!File.Exists(librariesPath))
            {
                return;
            }

            var folders = (VdfTable)VdfDeserializer.FromFile(librariesPath).Deserialize();
            var index   = 1;

            while (folders.TryGetValue(index.ToString(), out var value))
            {
                Libraries.Add(new Library(this, ((VdfString)value).Content));
                index++;
            }
        }
Exemplo n.º 5
0
        public void Dispose()
        {
            Logger.Log.Debug("Disposing");

            ActiveLibrary = null;
            Libraries.Clear();
            Libraries = null;

            ActiveProject = null;
            Projects.Clear();
            Projects = null;

            CommandManager.Dispose();
            CommandManager = null;

            LibraryManager.Dispose();
            LibraryManager = null;

            WindowManager.Dispose();
            WindowManager = null;

            Logger.Log.Debug("Disposed");
        }