Skip to content

Commit

Permalink
make folicon media info file hidden.
Browse files Browse the repository at this point in the history
Refector: renamed HideIcons to HideFile
  • Loading branch information
DineshSolanki committed Aug 6, 2021
1 parent 7ce21b1 commit 6592404
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 13 deletions.
9 changes: 5 additions & 4 deletions FoliCon/Modules/Util.cs
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,7 @@ public static int MakeIco(string iconMode, string selectedFolder, DataTable pick
}

if (!File.Exists(targetFile)) continue;
HideIcons(targetFile);
HideFile(targetFile);
SetFolderIcon($"{i}.ico", $@"{selectedFolder}\{i}");
}
ApplyChanges(selectedFolder);
Expand Down Expand Up @@ -469,15 +469,15 @@ public static void BuildFolderIco(string iconMode, string filmFolderPath, string
icon.Dispose();
}

public static void HideIcons(string icoFile)
public static void HideFile(string icoFile)
{
// Set icon file attribute to "Hidden"
// Set file attribute to "Hidden"
if ((File.GetAttributes(icoFile) & FileAttributes.Hidden) != FileAttributes.Hidden)
{
File.SetAttributes(icoFile, File.GetAttributes(icoFile) | FileAttributes.Hidden);
}

// Set icon file attribute to "System"
// Set file attribute to "System"
if ((File.GetAttributes(icoFile) & FileAttributes.System) != FileAttributes.System)
{
File.SetAttributes(icoFile, File.GetAttributes(icoFile) | FileAttributes.System);
Expand Down Expand Up @@ -581,6 +581,7 @@ public static void SaveMediaInfo(int id, string mediaType, string folderPath)
var filePath = $@"{folderPath}\folicon.folicon";
InIHelper.AddValue("ID", id.ToString(),null,filePath);
InIHelper.AddValue("MediaType", mediaType,null,filePath);
Util.HideFile(filePath);
}

public static (string ID, string MediaType) ReadMediaInfo(string folderPath)
Expand Down
2 changes: 1 addition & 1 deletion FoliCon/ViewModels/CustomIconControlViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ private int MakeIcons()

File.Move(iconPath, newIconPath);
if (!File.Exists(newIconPath)) continue;
Util.HideIcons(newIconPath);
Util.HideFile(newIconPath);
Util.SetFolderIcon($"{Directories[i]}.ico", folderPath);
Index++;
if (StopSearch)
Expand Down
16 changes: 8 additions & 8 deletions FoliCon/ViewModels/SearchResultViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -246,8 +246,8 @@ private void PickMethod()
}
else
{
_tmdbObject.ResultPicked(SearchResult.Result.Results[pickedIndex], SearchResult.MediaType,
_fullFolderPath, rating);
_tmdbObject.ResultPicked(SearchResult.Result, SearchResult.MediaType,
_fullFolderPath, rating,_isPickedById);
}
}
else if (SearchMode == MediaTypes.Game)
Expand All @@ -262,10 +262,9 @@ private void PickMethod()
}
catch (Exception ex)
{
if (ex.Message == "NoPoster")
{
MessageBox.Show(CustomMessageBox.Warning(LangProvider.GetLang("NoPosterFound"), SearchTitle));
}
MessageBox.Show(ex.Message == "NoPoster"
? CustomMessageBox.Warning(LangProvider.GetLang("NoPosterFound"), SearchTitle)
: CustomMessageBox.Error(ex.Message, SearchTitle));
}

CloseDialog("true");
Expand All @@ -281,12 +280,13 @@ private void MouseDoubleClick()
var pickedIndex = ResultListViewData.Data.IndexOf(ResultListViewData.SelectedItem);
try
{
if (_isPickedById)
if (_isPickedById && SearchResult.MediaType != MediaTypes.Game)
{

_dialogService.ShowPosterPicker(_tmdbObject, SearchResult, pickedIndex, ResultListViewData.Data,
_isPickedById, r => { });
}
else if (SearchMode != MediaTypes.Game)
else if (SearchResult.MediaType != MediaTypes.Game)
{
_dialogService.ShowPosterPicker(_tmdbObject, SearchResult, pickedIndex, ResultListViewData.Data,
_isPickedById, r => { });
Expand Down

0 comments on commit 6592404

Please sign in to comment.