public static TreeNode ToTreeNode(this SoundEntry snd)
        {
            if (snd.GetIsProperEntry())
            {
                var newNode = new TreeNode(snd.GetCommand())
                {
                    Name       = DB_Editor.NodeNameEntry,
                    ImageIndex = 0
                };

                var FilesNode = newNode.Nodes.Add(DB_Editor.NodeNameFiles);
                FilesNode.ImageIndex         = 1;
                FilesNode.SelectedImageIndex = 1;
                FilesNode.StateImageIndex    = 1;
                FilesNode.Name = DB_Editor.NodeNameFiles;
                foreach (var file in snd.GetAllFiles())
                {
                    if (file.RemoveWhitespaces() != String.Empty)
                    {
                        var fNode = FilesNode.Nodes.Add(file);
                        fNode.ImageIndex         = 1;
                        fNode.SelectedImageIndex = 1;
                        fNode.StateImageIndex    = 1;
                    }
                }

                var Requirement = newNode.Nodes.Add(DB_Editor.NodeNameRequirements);
                Requirement.ImageIndex         = 2;
                Requirement.SelectedImageIndex = 2;
                Requirement.StateImageIndex    = 2;
                Requirement.Name = DB_Editor.NodeNameRequirements;
                Requirement.Text = snd.GetRequirement().ToString();

                var Description = newNode.Nodes.Add(DB_Editor.NodeDescription);
                Description.ImageIndex         = 3;
                Description.SelectedImageIndex = 3;
                Description.StateImageIndex    = 3;
                Description.Name = DB_Editor.NodeDescription;
                Description.Text = snd.GetDescription();

                var DateTimeTreeNode = newNode.Nodes.Add(DB_Editor.NodeNameDateAdded);
                DateTimeTreeNode.ImageIndex         = 4;
                DateTimeTreeNode.SelectedImageIndex = 4;
                DateTimeTreeNode.StateImageIndex    = 4;
                DateTimeTreeNode.Name = DB_Editor.NodeNameDateAdded;
                DateTimeTreeNode.Text = snd.GetDateAdded().ToString();
                return(newNode);
            }
            else
            {
                throw new Exception(snd.GetCommand() + " is an incorrect entry!");
            }
        }
Exemple #2
0
 public AddEditNewEntryDialog(SoundEntry Entry)
 {
     InitializeComponent();
     AddComboboxDataSources();
     this.Text            = "Entry editing";
     this.TB_Command.Text = Entry.GetCommand();
     this.CBox_RequiredRight.SelectedIndex = (int)Entry.GetRequirement();
     foreach (var sound in Entry.GetAllFiles())
     {
         ListB_Files.Items.Add(sound);
     }
     this.RB_Description.Text = Entry.GetDescription();
     Verify();
 }
 private string GetTableRowForFile(SoundEntry hSound)
 {
     return(string.Format("<tr>" +
                          "<td height=\"21\" align=\"left\" bgcolor=\"{5}\">{0}{1}</td>" +
                          "<td height=\"21\" align=\"left\" bgcolor=\"{5}\">{2}</td>" +
                          "<td height=\"21\" align=\"left\" bgcolor=\"{5}\">{3}</td>" +
                          "<td height=\"21\" align=\"left\" bgcolor=\"{5}\">{4}</td>" +
                          "</tr>",
                          PrefixCharacter,
                          hSound.GetCommand(),
                          hSound.GetAllFiles().Length > 1 ? "multiple" : System.IO.Path.GetFileNameWithoutExtension(hSound.GetAllFiles().First()),
                          hSound.GetDescription(),
                          hSound.GetDateAdded().ToString(),
                          GetHTMLColor(hSound.GetRequirement())
                          ));
 }