public void LoadImageName() { // open folder, get all filenames //AppDomain.CurrentDomain.BaseDirectory string path = AppDomain.CurrentDomain.BaseDirectory + foldername; string[] filenames = Directory.GetFiles(path); // check filename to assign to variables foreach (var fullname in filenames) { string filename = Path.GetFileName(fullname); string[] tokens = StringProcess.SplitString(filename, new string[] { "_" }); if (tokens[0].ToLower() == "Application".ToLower()) { ApplicationIcon.Add ( new MyString() { Value = path + filename } ); } else if (tokens[0].ToLower() == "Option".ToLower()) { OptionIcon.Add ( new MyString() { Value = path + filename } ); } else if (tokens[0].ToLower() == "Remove".ToLower()) { RemoveIcon.Add ( new MyString() { Value = path + filename } ); } else if (tokens[0].ToLower() == "RemoveAll".ToLower()) { RemoveAllIcon.Add ( new MyString() { Value = path + filename } ); } else if (tokens[0].ToLower() == "Add".ToLower()) { AddIcon.Add ( new MyString() { Value = path + filename } ); } else if (tokens[0].ToLower() == "Preview".ToLower()) { PreviewIcon.Add ( new MyString() { Value = path + filename } ); } else if (tokens[0].ToLower() == "Start".ToLower()) { StartIcon.Add ( new MyString() { Value = path + filename } ); } else if (tokens[0].ToLower() == "Refresh".ToLower()) { RefreshIcon.Add ( new MyString() { Value = path + filename } ); } else if (tokens[0].ToLower() == "Help".ToLower()) { HelpIcon.Add ( new MyString() { Value = path + filename } ); } else if (tokens[0].ToLower() == "Open".ToLower()) { OpenIcon.Add ( new MyString() { Value = path + filename } ); } else if (tokens[0].ToLower() == "Save".ToLower()) { SaveIcon.Add ( new MyString() { Value = path + filename } ); } else if (tokens[0].ToLower() == "Information".ToLower()) { InformationIcon.Add ( new MyString() { Value = path + filename } ); } else if (tokens[0].ToLower() == "File".ToLower()) { FileIcon.Add ( new MyString() { Value = path + filename } ); } else if (tokens[0].ToLower() == "Folder".ToLower()) { FolderIcon.Add ( new MyString() { Value = path + filename } ); } else if (tokens[0].ToLower() == "Action".ToLower()) { ActionIcon.Add ( new MyString() { Value = path + filename } ); } else if (tokens[0].ToLower() == "List".ToLower()) { ListIcon.Add ( new MyString() { Value = path + filename } ); } } }
public void LoadImageName() { // open folder, get all filenames string path = AppDomain.CurrentDomain.BaseDirectory + foldername; string[] filenames = Directory.GetFiles(path); // check filename to assign to variables foreach (var fullname in filenames) { string filename = Path.GetFileName(fullname); string[] tokens = filename.Split(new string[] { "_" }, StringSplitOptions.RemoveEmptyEntries); if (tokens[0].ToLower() == "Application".ToLower()) { ApplicationIcon.Add ( path + filename ); } else if (tokens[0].ToLower() == "Option".ToLower()) { OptionIcon.Add ( path + filename ); } else if (tokens[0].ToLower() == "Remove".ToLower()) { RemoveIcon.Add ( path + filename ); } else if (tokens[0].ToLower() == "RemoveAll".ToLower()) { RemoveAllIcon.Add ( path + filename ); } else if (tokens[0].ToLower() == "Add".ToLower()) { AddIcon.Add ( path + filename ); } else if (tokens[0].ToLower() == "Preview".ToLower()) { PreviewIcon.Add ( path + filename ); } else if (tokens[0].ToLower() == "Start".ToLower()) { StartIcon.Add ( path + filename ); } else if (tokens[0].ToLower() == "Refresh".ToLower()) { RefreshIcon.Add ( path + filename ); } else if (tokens[0].ToLower() == "Help".ToLower()) { HelpIcon.Add ( path + filename ); } else if (tokens[0].ToLower() == "Open".ToLower()) { OpenIcon.Add ( path + filename ); } else if (tokens[0].ToLower() == "Save".ToLower()) { SaveIcon.Add ( path + filename ); } else if (tokens[0].ToLower() == "Information".ToLower()) { InformationIcon.Add ( path + filename ); } else if (tokens[0].ToLower() == "File".ToLower()) { FileIcon.Add ( path + filename ); } else if (tokens[0].ToLower() == "Folder".ToLower()) { FolderIcon.Add ( path + filename ); } else if (tokens[0].ToLower() == "Action".ToLower()) { ActionIcon.Add ( path + filename ); } else if (tokens[0].ToLower() == "List".ToLower()) { ListIcon.Add ( path + filename ); } else if (tokens[0].ToLower() == "UpDirection".ToLower()) { UpDirectionIcon.Add ( path + filename ); } else if (tokens[0].ToLower() == "RightDirection".ToLower()) { RightDirectionIcon.Add ( path + filename ); } else if (tokens[0].ToLower() == "DownDirection".ToLower()) { DownDirectionIcon.Add ( path + filename ); } else if (tokens[0].ToLower() == "LeftDirection".ToLower()) { LeftDirectionIcon.Add ( path + filename ); } else { Images.Add ( path + filename ); } } }