<commit_before>﻿// --------------------------------------------------------------------------------------------------------------------
// <copyright file="BlueprintManagerViewModel.cs" company="Slash Games">
//   Copyright (c) Slash Games. All rights reserved.
// </copyright>
// --------------------------------------------------------------------------------------------------------------------

namespace BlueprintEditor.ViewModels
{
    using System;
    using System.Collections.Generic;
    using System.Collections.ObjectModel;
    using System.Collections.Specialized;
    using System.ComponentModel;
    using System.Linq;
    using System.Windows.Data;

    using MonitoredUndo;

    using Slash.GameBase.Blueprints;
    using Slash.Tools.BlueprintEditor.Logic.Annotations;
    using Slash.Tools.BlueprintEditor.Logic.Data;

    using AggregateException = Slash.SystemExt.Exceptions.AggregateException;

    public class BlueprintManagerViewModel : INotifyPropertyChanged, IDataErrorInfo, ISupportsUndo
    {
        #region Fields

        private readonly HierarchicalBlueprintManager blueprintManager;

        private IEnumerable<Type> assemblyComponents;

        private ListCollectionView blueprintsView;

        private string newBlueprintId;

        #endregion

        #region Constructors and Destructors

        public BlueprintManagerViewModel(IEnumerable<Type> assemblyComponents, HierarchicalBlueprintManager blueprintManager)
        {
            this.AssemblyComponents = assemblyComponents;
            this.blueprintManager = blueprintManager;

            this.Blueprints = new ObservableCollection<BlueprintViewModel>();

            IEnumerable<KeyValuePair<string, Blueprint>> blueprints = this.blueprintManager.Blueprints;
            foreach (var blueprintPair in blueprints)
            {
                this.Blueprints.Add(
                    new BlueprintViewModel(blueprintPair.Key, blueprintPair.Value)
                        {
                            AssemblyComponents = this.assemblyComponents,
                            Root = this
                        });
            }

            this.CurrentBlueprintManager = (BlueprintManager)this.blueprintManager.Parents.First();

            this.Blueprints.CollectionChanged += this.OnBlueprintsChanged;
        }

        #endregion

        #region Public Events

        public event PropertyChangedEventHandler PropertyChanged;

        #endregion

        #region Public Properties<commit_msg>CHANGED: Tools.BlueprintEditor - Tree view shows blueprints ordered by name.<commit_after>﻿// --------------------------------------------------------------------------------------------------------------------
// <copyright file="BlueprintManagerViewModel.cs" company="Slash Games">
//   Copyright (c) Slash Games. All rights reserved.
// </copyright>
// --------------------------------------------------------------------------------------------------------------------

namespace BlueprintEditor.ViewModels
{
    using System;
    using System.Collections.Generic;
    using System.Collections.ObjectModel;
    using System.Collections.Specialized;
    using System.ComponentModel;
    using System.Linq;
    using System.Windows.Data;

    using MonitoredUndo;

    using Slash.GameBase.Blueprints;
    using Slash.Tools.BlueprintEditor.Logic.Annotations;
    using Slash.Tools.BlueprintEditor.Logic.Data;

    using AggregateException = Slash.SystemExt.Exceptions.AggregateException;

    public class BlueprintManagerViewModel : INotifyPropertyChanged, IDataErrorInfo, ISupportsUndo
    {
        #region Fields

        private readonly HierarchicalBlueprintManager blueprintManager;

        private IEnumerable<Type> assemblyComponents;

        private ListCollectionView blueprintsView;

        private string newBlueprintId;

        #endregion

        #region Constructors and Destructors

        public BlueprintManagerViewModel(IEnumerable<Type> assemblyComponents, HierarchicalBlueprintManager blueprintManager)
        {
            this.AssemblyComponents = assemblyComponents;
            this.blueprintManager = blueprintManager;

            this.Blueprints = new ObservableCollection<BlueprintViewModel>();

            IEnumerable<KeyValuePair<string, Blueprint>> blueprints = this.blueprintManager.Blueprints;
            foreach (var blueprintPair in blueprints.OrderBy(blueprint => blueprint.Key))
            {
                this.Blueprints.Add(
                    new BlueprintViewModel(blueprintPair.Key, blueprintPair.Value)
                        {
                            AssemblyComponents = this.assemblyComponents,
                            Root = this
                        });
            }

            this.CurrentBlueprintManager = (BlueprintManager)this.blueprintManager.Parents.First();

            this.Blueprints.CollectionChanged += this.OnBlueprintsChanged;
        }

        #endregion

        #region Public Events

        public event PropertyChangedEventHandler PropertyChanged;

        #endregion

        #region Public Properties
{'fraction_non_alphanumeric': 0.15194830624632857, 'fraction_numerical': 0.0, 'mean_word_length': 1.9138619509412436, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 18, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2567390', 'n_tokens_mistral': 1137, 'n_tokens_neox': 1090, 'n_words': 230}