Пример #1
0
        void SelectAddon(WorkshoppableAddon addon)
        {
            _selectedAddon = addon;

            lblAddonTitle.Text  = addon.Title;
            lblAddonType.Text   = String.Join(", ", addon.Type);
            lblAddonTags.Text   = String.Join(", ", addon.Tags);
            lblAddonIgnore.Text = String.Join(", ", addon.Ignore);

            SetButtonText();

            if (addon.Title != null && addon.Type != null && addon.Type.Length > 0 && addon.Tags != null && addon.Tags.Length > 0)
            {
                btnSubmit.Enabled = true;
            }
            else
            {
                btnSubmit.Enabled = false;
            }
        }
Пример #2
0
        private void FetchAddons()
        {
            string Path = Environment.CurrentDirectory + "\\addons\\custom";

            cmbAddons.Items.Clear();

            if (Directory.Exists(Path))
            {
                _addons = new List <WorkshoppableAddon>();
                foreach (string folder in Directory.EnumerateDirectories(Path))
                {
                    if (File.Exists(folder + "\\workshop.json"))
                    {
                        WorkshoppableAddon addon = JsonConvert.DeserializeObject <WorkshoppableAddon>(File.ReadAllText(folder + "\\workshop.json"));
                        addon.Path = folder;

                        if (addon.Title != null)
                        {
                            _addons.Add(addon);
                            cmbAddons.Items.Add(addon.Title + (addon.FileId != 0 ? " (File ID: " + addon.FileId + ")" : ""));
                        }
                    }
                }

                if (_addons.Count == 0)
                {
                    cmbAddons.Text    = "No Valid workshop.json files found";
                    cmbAddons.Enabled = false;
                }
            }
            else
            {
                cmbAddons.Text    = "No Valid workshop.json files found";
                cmbAddons.Enabled = false;
            }
        }