public void Test_01_Construction() { FileFilters filter1 = new FileFilters("Word Documents (*.doc)|*.doc"); Assert.IsTrue(filter1.Count == 1); Assert.IsTrue(filter1.GetDescription(0) == "Word Documents (*.doc)"); Assert.IsTrue(filter1.GetFilter(0) == "*.doc"); Assert.IsTrue(filter1[0] != null, "Failed to create the regular expression for the filter"); Assert.IsTrue(((Regex)filter1[0]).ToString() == @".+\.doc$"); FileFilters filter2 = new FileFilters("Excel Document (*.xls)|*.xls|Word Documents (*.doc)|*.doc|All Files(*.*)|*.*"); Assert.IsTrue(filter2.Count == 3); Assert.IsTrue(filter2.GetDescription(0) == "Excel Document (*.xls)"); Assert.IsTrue(filter2.GetFilter(0) == "*.xls"); Assert.IsTrue(filter2[0] != null, "Failed to create the regular expression for the filter"); Assert.IsTrue(((Regex)filter2[0]).ToString() == @".+\.xls$"); Assert.IsTrue(filter2.GetDescription(1) == "Word Documents (*.doc)"); Assert.IsTrue(filter2.GetFilter(1) == "*.doc"); Assert.IsTrue(filter2[1] != null, "Failed to create the regular expression for the filter"); Assert.IsTrue(((Regex)filter2[1]).ToString() == @".+\.doc$"); Assert.IsTrue(filter2.GetDescription(2) == "All Files(*.*)"); Assert.IsTrue(filter2.GetFilter(2) == "*.*"); Assert.IsTrue(filter2[2] != null, "Failed to create the regular expression for the filter"); Assert.IsTrue(((Regex)filter2[2]).ToString() == @".+"); }
private string GetSubfileExtensions(bool IsExporting) { switch (Type) { case BRESGroupType.Models: return(FileFilters.GetFilter(typeof(FMDL), null, IsExporting)); case BRESGroupType.Textures: return(FileFilters.GetFilter(typeof(FTEX), null, IsExporting)); case BRESGroupType.SkeletalAnim: return(FileFilters.GetFilter(typeof(FSKA), null, IsExporting)); case BRESGroupType.MaterialAnim: return(FileFilters.GetFilter(typeof(FMAA), null, IsExporting)); case BRESGroupType.ShaderParamAnim: return(FileFilters.GetFilter(typeof(FSHU), null, IsExporting)); case BRESGroupType.ColorAnim: return(FileFilters.GetFilter(typeof(FSHU), MaterialAnimation.AnimationType.Color, IsExporting)); case BRESGroupType.TexSrtAnim: return(FileFilters.GetFilter(typeof(FSHU), MaterialAnimation.AnimationType.TextureSrt, IsExporting)); case BRESGroupType.TexPatAnim: return(FileFilters.GetFilter(typeof(FTXP), MaterialAnimation.AnimationType.ShaderParam, IsExporting)); case BRESGroupType.BoneVisAnim: return(FileFilters.GetFilter(typeof(FVIS), null, IsExporting)); case BRESGroupType.MatVisAnim: return(FileFilters.GetFilter(typeof(FVIS), null, IsExporting)); case BRESGroupType.ShapeAnim: return(FileFilters.GetFilter(typeof(FSHA), null, IsExporting)); case BRESGroupType.SceneAnim: return(FileFilters.GetFilter(typeof(FSCN), null, IsExporting)); case BRESGroupType.Embedded: return(FileFilters.GetFilter(typeof(ExternalFileData), null, IsExporting)); default: return("All files(*.*)|*.*"); } }
public void ImportTexSrtAnim() { OpenFileDialog ofd = new OpenFileDialog(); if (IsWiiU) { ofd.Filter = FileFilters.GetFilter(typeof(FSHU), MaterialAnimation.AnimationType.TextureSrt); } else { ofd.Filter = FileFilters.FMAA; } ofd.Multiselect = true; if (ofd.ShowDialog() != DialogResult.OK) { return; } BFRESGroupNode group = null; if (IsWiiU) { group = GetOrCreateFolder <FSHU>(MaterialAnimation.AnimationType.TextureSrt); } else { group = GetOrCreateFolder <FMAA>(MaterialAnimation.AnimationType.TextureSrt); } group.Import(ofd.FileNames, GetResFile(), GetResFileU()); AddFolder(group); }
public void Test_02_WithMultipleMasks() { FileFilters filter1 = new FileFilters("Word & Excel (*.doc,*.xls)|*.doc,*.xls"); Assert.IsTrue(filter1.Count == 1); Assert.IsTrue(filter1.GetDescription(0) == "Word & Excel (*.doc,*.xls)"); Assert.IsTrue(filter1.GetFilter(0) == "*.doc,*.xls"); Assert.IsTrue(filter1[0] != null, "Failed to create the regular expression for the filter"); Assert.IsTrue(((Regex)filter1[0]).ToString() == @"(.+\.doc$)|(.+\.xls$)"); }