Change selectiontype to an Enum

This commit is contained in:
Minizbot2012 2021-01-17 12:37:17 -05:00
parent 53c17bef48
commit a84f2cda6f
4 changed files with 11 additions and 7 deletions

View file

@ -1,4 +1,5 @@
using System.Collections.Generic; using System.Collections.Generic;
using Penumbra.Models;
namespace Penumbra.Importer.Models namespace Penumbra.Importer.Models
{ {
@ -9,14 +10,14 @@ namespace Penumbra.Importer.Models
public string ImagePath { get; set; } public string ImagePath { get; set; }
public List< SimpleMod > ModsJsons { get; set; } public List< SimpleMod > ModsJsons { get; set; }
public string GroupName { get; set; } public string GroupName { get; set; }
public string SelectionType { get; set; } public SelectType SelectionType { get; set; }
public bool IsChecked { get; set; } public bool IsChecked { get; set; }
} }
internal class ModGroup internal class ModGroup
{ {
public string GroupName { get; set; } public string GroupName { get; set; }
public string SelectionType { get; set; } public SelectType SelectionType { get; set; }
public List< OptionList > OptionList { get; set; } public List< OptionList > OptionList { get; set; }
} }

View file

@ -2,6 +2,9 @@ using System.Collections.Generic;
namespace Penumbra.Models namespace Penumbra.Models
{ {
public enum SelectType {
Single, Multi
}
public struct Option { public struct Option {
public string OptionName; public string OptionName;
public string OptionDesc; public string OptionDesc;
@ -9,7 +12,7 @@ namespace Penumbra.Models
} }
public struct InstallerInfo { public struct InstallerInfo {
public string GroupName; public string GroupName;
public string SelectionType; public SelectType SelectionType;
public List<Option> Options; public List<Option> Options;
} }
} }

View file

@ -145,7 +145,7 @@ namespace Penumbra.Mods
} }
var current = settings.Conf[negivtron.Item1.GroupName]; var current = settings.Conf[negivtron.Item1.GroupName];
var flag = negivtron.Item1.Options.IndexOf(negivtron.Item2); var flag = negivtron.Item1.Options.IndexOf(negivtron.Item2);
if(negivtron.Item1.SelectionType=="Single") { if(negivtron.Item1.SelectionType==SelectType.Single) {
addFile = current == flag; addFile = current == flag;
} else { } else {
flag = 1 << negivtron.Item1.Options.IndexOf(negivtron.Item2); flag = 1 << negivtron.Item1.Options.IndexOf(negivtron.Item2);

View file

@ -613,7 +613,7 @@ namespace Penumbra.UI
conf[g.Key] = 0; conf[g.Key] = 0;
} }
switch(g.Value.SelectionType) { switch(g.Value.SelectionType) {
case "Multi": case SelectType.Multi:
{ {
var i = 0; var i = 0;
var flag = conf[g.Key]; var flag = conf[g.Key];
@ -629,7 +629,7 @@ namespace Penumbra.UI
} }
break; break;
} }
case "Single": case SelectType.Single:
{ {
var code = conf[g.Key]; var code = conf[g.Key];
if(g.Value.Options.Count >1) { if(g.Value.Options.Count >1) {
@ -644,7 +644,7 @@ namespace Penumbra.UI
default: { default: {
ImGui.Text("I dunno what this is, please report it!"); ImGui.Text("I dunno what this is, please report it!");
ImGui.Text(g.Value.GroupName); ImGui.Text(g.Value.GroupName);
ImGui.Text(g.Value.SelectionType); ImGui.Text(g.Value.SelectionType.ToString());
break; break;
} }
} }