Skip to content

Commit

Permalink
cleaner: added autopov.pov as a kindred file to prevent it from being…
Browse files Browse the repository at this point in the history
… removed
  • Loading branch information
stojy committed Sep 20, 2023
1 parent 269b6b8 commit 38b15f8
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 6 deletions.
1 change: 1 addition & 0 deletions ClrVpin.sln.DotSettings
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,7 @@
<s:Boolean x:Key="/Default/UserDictionary/Words/=ARPPRODUCTICON/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=autho/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Autofill/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=autopov/@EntryIndexedValue">True</s:Boolean>

<s:Boolean x:Key="/Default/UserDictionary/Words/=backglasses/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=balutito/@EntryIndexedValue">True</s:Boolean>
Expand Down
2 changes: 1 addition & 1 deletion ClrVpin/Controls/Folder/ContentFolderType.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
</TextBox>

<TextBox Margin="5,0,0,0" Width="160" Style="{StaticResource TextBoxStyle}" VerticalAlignment="Top" materialDesign:HintAssist.Hint="Linked Files(s)"
ToolTip="Any related files with matching extensions will also be moved/copied/deleted."
ToolTip="Any related files with matching extension or filename. Depending on the usage context, these files will be either moved/copied or ignored."
Text="{Binding KindredExtensions, UpdateSourceTrigger=PropertyChanged}">
<b:Interaction.Triggers>
<b:EventTrigger EventName="TextChanged">
Expand Down
4 changes: 2 additions & 2 deletions ClrVpin/Models/Settings/Settings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ private void ApplyDefaults()
{
new() { Enum = ContentTypeEnum.Tables, Tip = "Playfield table", Extensions = "*.vpx, *.vpt", KindredExtensions = "*.ini, *.vbs, *.txt, *.pdf", Category = ContentTypeCategoryEnum.Pinball, IsFolderRequired = true},
new() { Enum = ContentTypeEnum.Backglasses, Tip = "Video used for the backglass", Extensions = "*.directb2s", Category = ContentTypeCategoryEnum.Pinball },
new() { Enum = ContentTypeEnum.PointOfViews, Tip = "3D camera configuration", Extensions = "*.pov", Category = ContentTypeCategoryEnum.Pinball },
new() { Enum = ContentTypeEnum.PointOfViews, Tip = "3D camera configuration", Extensions = "*.pov", KindredExtensions = "autopov.pov", Category = ContentTypeCategoryEnum.Pinball },
new() { Enum = ContentTypeEnum.Database, Tip = "Pinball X or Pinball Y database file", Extensions = "*.xml", Category = ContentTypeCategoryEnum.Database, IsFolderRequired = true},
new() { Enum = ContentTypeEnum.TableAudio, Tip = "Audio used when displaying a table", Extensions = "*.mp3, *.wav", Category = ContentTypeCategoryEnum.Media },
new() { Enum = ContentTypeEnum.LaunchAudio, Tip = "Audio used when launching a table", Extensions = "*.mp3, *.wav", Category = ContentTypeCategoryEnum.Media },
Expand Down Expand Up @@ -105,7 +105,7 @@ private void ApplyDefaults()
public int Version { get; set; }

[JsonIgnore]
public int MinVersion { get; set; } = 8;
public int MinVersion { get; set; } = 9;

public void Init(DefaultSettings defaultSettings)
{
Expand Down
2 changes: 1 addition & 1 deletion ClrVpin/Models/Settings/StaticSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ static StaticSettings()
new(HitTypeEnum.Missing, false, "Files that are missing. Missing files can be downloaded via the 'Feeder' feature from the home page."),
new(HitTypeEnum.Unknown, false, "Files that do match the configured file extension type, but don't match any of the tables in the database"),
new(HitTypeEnum.Unsupported, false,
"Files that don't match the configured file extension types - ONLY APPLICABLE FOR MEDIA CONTENT, since unsupported files are EXPECTED to exist in the tables folder (e.g. txt, exe, ogg, etc)")
"Files that don't match the configured file extension types - ONLY APPLICABLE FOR MEDIA CONTENT, since unsupported file types/extensions are EXPECTED to exist in the tables folder (e.g. txt, exe, ogg, etc)")
};

// merger matching criteria types - to be used elsewhere (merger)
Expand Down
7 changes: 5 additions & 2 deletions ClrVpin/Shared/Utils/ContentUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ public static IList<string> GetContentFileNames(ContentType contentType, string

public static IEnumerable<FileDetail> GetNonContentFileDetails(ContentType contentType, string folder)
{
// return all files that don't match the supported file extensions
// return all files that don't match the supported file extensions OR kindred file extensions
// - kindred file extensions are normally in the format *.<ext>, but may also include a file name, e.g. autopov.pov
var supportedExtensions = contentType.ExtensionsList.Select(x => x.TrimStart('*').ToLower()).ToList();
var kindredExtensions = contentType.KindredExtensionsList.Where(x => !string.IsNullOrWhiteSpace(x)).Select(x => x.TrimStart('*').ToLower());
supportedExtensions.AddRange(kindredExtensions);
Expand Down Expand Up @@ -101,7 +102,9 @@ public static async Task<List<FileDetail>> MatchContentToLocalAsync(List<LocalGa
// - e.g. possible for..
// a. table --> new table files added AND the database not updated yet
// b. table support and media --> as per pinball OR extra/redundant files exist where there is no table (yet!)
unmatchedSupportedFiles.Add(new FileDetail(contentType.Enum, HitTypeEnum.Unknown, FixFileTypeEnum.Skipped, contentFile, new FileInfo(contentFile).Length));
// c. pov --> known exception for 'autopov.pov' which is a special case that is known NOT to match a table
if (!contentType.KindredExtensionsList.Contains(Path.GetFileName(contentFile)))
unmatchedSupportedFiles.Add(new FileDetail(contentType.Enum, HitTypeEnum.Unknown, FixFileTypeEnum.Skipped, contentFile, new FileInfo(contentFile).Length));
}
}
});
Expand Down

0 comments on commit 38b15f8

Please sign in to comment.