Пример #1
0
        private void rootCombo_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            file_tree = new FileTreeViewItem(null);
            file_tree.PropertyChanged += new PropertyChangedEventHandler(file_tree_PropertyChanged);

            List <DetectedFile> saves = game.Saves.Flatten();

            // This gets every detected save file
            foreach (DetectedFile save in saves)
            {
                // This tests if the save is from the currently selected root folder
                if (save.AbsoluteRoot == game.DetectedLocations[rootCombo.SelectedItem.ToString()].FullDirPath)
                {
                    string path = Path.Combine(save.Path, save.Name);
                    file_tree.addFile(new List <string>(path.Split(Path.DirectorySeparatorChar)), save);
                    // Splits the path into folders
                }
            }


            if (file_tree.Children.Count == 0)
            {
                CheckedTreeViewItem nofiles = new CheckedTreeViewItem(null);
                nofiles.Name = Strings.GetLabelString("NoFilesFound");
                file_tree.Children.Add(nofiles);
                fileTree.IsEnabled   = false;
                saveButton.IsEnabled = false;
            }
            else
            {
                fileTree.IsEnabled   = true;
                saveButton.IsEnabled = true;
            }
            fileTree.DataContext = file_tree;
        }
Пример #2
0
        public void addFile(List <string> file_path, DetectedFile file)
        {
            foreach (FileTreeViewItem item in _children)
            {
                if (file_path[0] == item.Name)
                {
                    file_path.RemoveAt(0);
                    item.addFile(file_path, file);
                    return;
                }
            }

            FileTreeViewItem new_item = new FileTreeViewItem(this);

            if (file_path.Count > 0)
            {
                new_item.Name = file_path[0];
                if (file_path.Count > 1)
                {
                    file_path.RemoveAt(0);
                    new_item.addFile(file_path, file);
                }
                else
                {
                    new_item.file = file;
                }
                _children.Add(new_item);
            }
        }
Пример #3
0
        public void addFile(List<string> file_path, DetectedFile file)
        {
            foreach (FileTreeViewItem item in _children) {
                if (file_path[0] == item.Name) {
                    file_path.RemoveAt(0);
                    item.addFile(file_path, file);
                    return;
                }
            }

            FileTreeViewItem new_item = new FileTreeViewItem(this);

            if (file_path.Count > 0) {
                new_item.Name = file_path[0];
                if (file_path.Count > 1) {
                    file_path.RemoveAt(0);
                    new_item.addFile(file_path, file);
                } else {
                    new_item.file = file;
                }
                _children.Add(new_item);
            }
        }
Пример #4
0
        private void rootCombo_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            file_tree = new FileTreeViewItem(null);
            file_tree.PropertyChanged += new PropertyChangedEventHandler(file_tree_PropertyChanged);

            List<DetectedFile> saves = game.Saves.Flatten();

            // This gets every detected save file
            foreach (DetectedFile save in saves) {
                // This tests if the save is from the currently selected root folder
                if (save.AbsoluteRoot == game.DetectedLocations[rootCombo.SelectedItem.ToString()].FullDirPath) {
                    string path = Path.Combine(save.Path, save.Name);
                    file_tree.addFile(new List<string>(path.Split(Path.DirectorySeparatorChar)), save);
                    // Splits the path into folders
                }
            }

            if (file_tree.Children.Count == 0) {
                CheckedTreeViewItem nofiles = new CheckedTreeViewItem(null);
                nofiles.Name = Strings.GetLabelString("NoFilesFound");
                file_tree.Children.Add(nofiles);
                fileTree.IsEnabled = false;
                saveButton.IsEnabled = false;
            } else {
                fileTree.IsEnabled = true;
                saveButton.IsEnabled = true;
            }
            fileTree.DataContext = file_tree;
        }