add option for DataFormat hint comparisons to require BOTH FileNameFilter and MagicByteSequence to match
This commit is contained in:
parent
e1e4dfbfb5
commit
7b02518e4e
@ -63,7 +63,7 @@ namespace UniversalEditor
|
||||
private string mvarTitle = String.Empty;
|
||||
public string Title { get { return mvarTitle; } set { mvarTitle = value; } }
|
||||
|
||||
private DataFormatHintComparison mvarHintComparison = DataFormatHintComparison.Unspecified;
|
||||
private DataFormatHintComparison mvarHintComparison = DataFormatHintComparison.Both;
|
||||
public DataFormatHintComparison HintComparison { get { return mvarHintComparison; } set { mvarHintComparison = value; } }
|
||||
|
||||
private System.Collections.Specialized.StringCollection mvarFileNameFilters = new System.Collections.Specialized.StringCollection();
|
||||
@ -111,6 +111,7 @@ namespace UniversalEditor
|
||||
|
||||
bool filterCaseSensitive = false;
|
||||
if (!caseSensitiveOS || (caseSensitiveOS && !filterCaseSensitive)) fileName = fileName.ToLower();
|
||||
|
||||
for (int i = 0; i < mvarFileNameFilters.Count; i++)
|
||||
{
|
||||
string filter = mvarFileNameFilters[i];
|
||||
@ -212,6 +213,10 @@ namespace UniversalEditor
|
||||
if (!basedOnMagic) return basedOnFilter;
|
||||
return basedOnMagic;
|
||||
}
|
||||
case DataFormatHintComparison.Both:
|
||||
{
|
||||
return basedOnFilter && basedOnMagic;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -54,8 +54,14 @@ namespace UniversalEditor
|
||||
/// </summary>
|
||||
MagicThenFilter = 4,
|
||||
/// <summary>
|
||||
/// Return this <see cref="DataFormat" /> if both the magic bytes listed in the <see cref="Association" /> match the magic bytes of the
|
||||
/// <see cref="Accessor" /> AND the file name filters listed in the <see cref="Association" /> match the file name of the
|
||||
/// <see cref="Accessor" />.
|
||||
/// </summary>
|
||||
Both = 5,
|
||||
/// <summary>
|
||||
/// Always return this <see cref="DataFormat" /> as a result for the given <see cref="Association" />.
|
||||
/// </summary>
|
||||
Always = 5
|
||||
Always = 6
|
||||
}
|
||||
}
|
||||
|
||||
@ -883,6 +883,11 @@ namespace UniversalEditor.DataFormats.UEPackage
|
||||
filter.HintComparison = DataFormatHintComparison.Never;
|
||||
break;
|
||||
}
|
||||
case "both":
|
||||
{
|
||||
filter.HintComparison = DataFormatHintComparison.Both;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
filter.HintComparison = DataFormatHintComparison.Unspecified;
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
<Associations>
|
||||
<Association>
|
||||
<Filters>
|
||||
<Filter Title="VOCALOID5 project (JSON/ZIP)">
|
||||
<Filter Title="VOCALOID5 project (JSON/ZIP)" HintComparison="Both">
|
||||
<FileNameFilters>
|
||||
<FileNameFilter>*.vpr</FileNameFilter>
|
||||
</FileNameFilters>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user