Ejemplo n.º 1
0
        private static void LoadPersistentState()
        {
            StateTable = new Dictionary <string, string>();

            if (Refresh || !FileTools.FileExists(PersistentStatePath))
            {
                FileTools.CommitTextFile(PersistentStatePath, "");
            }

            string PersistentState = FileTools.LoadTextFile(PersistentStatePath, FileMode.Open);

            ParsePersistentState(PersistentState);
        }
Ejemplo n.º 2
0
        public static void Update()
        {
            if (Root != null)
            {
                return;
            }

            Root = new Dictionary <string, IDictionary>();

            string Book = FileTools.LoadTextFile(BookkeepingFileName, FileMode.OpenOrCreate);

            if (Book == null)
            {
                Book = "";
            }

            string[] Lines = Book.Split('\n');
            foreach (string Line in Lines)
            {
                if (string.IsNullOrEmpty(Line))
                {
                    continue;
                }

                if (Line.EndsWith("/"))
                {
                    IList <string> DirectoryPath = FromDirectoryName(Line);
                    InsertDirectory(DirectoryPath, out bool inserted);
                }
                else
                {
                    IList <string> FilePath = FromFileName(Line);
                    InsertFile(FilePath, out bool inserted);
                }
            }
        }