Example #1
0
        public ModListTVViewModel(string category, ModListTVViewModel parent)
        {
            _parent   = parent;
            _category = category;

            HashSet <string> itemSet = new HashSet <string>();

            try
            {
                foreach (string line in File.ReadAllLines(Info.modListDir))
                {
                    JsonEntry entry = JsonConvert.DeserializeObject <JsonEntry>(line);

                    if (entry.category.Equals(category) && _parent == null)
                    {
                        itemSet.Add(entry.name);
                    }
                }
            }
            catch (Exception e)
            {
                MessageBox.Show("[VM] Error Accessing .modlist File \n" + e.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
            }


            foreach (string name in itemSet)
            {
                _children.Add(new ModListTVViewModel(name, this));
            }
        }
        public ModListViewModel()
        {
            HashSet <string> categorySet = new HashSet <string>();

            try
            {
                foreach (string line in File.ReadAllLines(Info.modListDir))
                {
                    JsonEntry entry = JsonConvert.DeserializeObject <JsonEntry>(line);

                    categorySet.Add(entry.category);
                }
            }
            catch (Exception e)
            {
                MessageBox.Show("[VM] Error Accessing .modlist File \n" + e.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
            }


            foreach (string category in categorySet)
            {
                _category = new ModListTVViewModel(category);

                _categories.Add(_category);
            }
        }
        public ModListTVViewModel(string category, ModListTVViewModel parent)
        {
            _parent   = parent;
            _category = category;

            HashSet <string> itemSet = new HashSet <string>();

            try
            {
                foreach (string line in File.ReadAllLines(Properties.Settings.Default.Modlist_Directory))
                {
                    JsonEntry entry = JsonConvert.DeserializeObject <JsonEntry>(line);

                    if (entry.category.Equals(category) && _parent == null)
                    {
                        itemSet.Add(entry.name);
                    }
                }
            }
            catch (Exception e)
            {
                FlexibleMessageBox.Show("Error Accessing .modlist File \n" + e.Message, "MLTVVM Error " + Info.appVersion, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }


            foreach (string name in itemSet)
            {
                _children.Add(new ModListTVViewModel(name, this));
            }
        }
Example #4
0
        public ModListViewModel()
        {
            HashSet <string> categorySet = new HashSet <string>();

            try
            {
                foreach (string line in File.ReadAllLines(Properties.Settings.Default.Modlist_Directory))
                {
                    JsonEntry entry = JsonConvert.DeserializeObject <JsonEntry>(line);

                    if (!entry.category.Equals(""))
                    {
                        categorySet.Add(entry.category);
                    }
                }
            }
            catch (Exception e)
            {
                FlexibleMessageBox.Show("Error Accessing .modlist File \n" + e.Message, "ModListViewModel Error " + Info.appVersion, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }


            foreach (string category in categorySet)
            {
                _category = new ModListTVViewModel(category);

                _categories.Add(_category);
            }
        }