Skip to content

Commit

Permalink
2 new Icon mockup added.
Browse files Browse the repository at this point in the history
  • Loading branch information
DineshSolanki committed Aug 9, 2021
1 parent d32f51f commit 599f9bf
Show file tree
Hide file tree
Showing 11 changed files with 137 additions and 17 deletions.
14 changes: 14 additions & 0 deletions FoliCon/FoliCon.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,18 @@ dineshsolanki.github.io/folicon/</Description>
<None Remove="Resources\Mockup faelpessoal base.png" />
<None Remove="Resources\mockup faelpessoal front.png" />
<None Remove="Resources\mockup liaher base.png" />
<None Remove="Resources\mockup liaher front.png" />
<None Remove="Resources\mockup2base.png" />
<None Remove="Resources\No-WiFi.png" />
<None Remove="Resources\NoPosterAvailable.png" />
<None Remove="Resources\PosterIcon.ico" />
<None Remove="Resources\PosterIconAlt.ico" />
<None Remove="Resources\PosterIconFaelpessoal 2.ico" />
<None Remove="Resources\PosterIconFaelpessoal.ico" />
<None Remove="Resources\PosterIconFaelpessoalHorizontal.ico" />
<None Remove="Resources\PosterIconFaelpessoalHorizontal2.ico" />
<None Remove="Resources\PosterIconLiaher.ico" />
<None Remove="Resources\PosterIconLiaher2.ico" />
<None Remove="Resources\PosterMockup.png" />
<None Remove="Resources\shield.png" />
<None Remove="Resources\Strong-WiFi.png" />
Expand All @@ -50,13 +57,20 @@ dineshsolanki.github.io/folicon/</Description>
<PackageReference Include="WinCopies.IconLib" Version="0.75.0-rc" />
</ItemGroup>
<ItemGroup>
<Resource Include="Resources\PosterIconFaelpessoal 2.ico" />
<Resource Include="Resources\PosterIconFaelpessoalHorizontal2.ico" />
<Resource Include="Resources\PosterIconFaelpessoal.ico" />
<Resource Include="Resources\PosterIconFaelpessoalHorizontal.ico" />
<Resource Include="Resources\folicon Icon.ico" />
<Resource Include="Resources\folicon Icon.png" />
<Resource Include="Resources\PosterIconLiaher2.ico" />
<Resource Include="Resources\PosterIconLiaher.ico" />
<Resource Include="Resources\LoadingPosterImage.png" />
<Resource Include="Resources\mockup cover cropped.png" />
<Resource Include="Resources\Mockup faelpessoal base.png" />
<Resource Include="Resources\mockup faelpessoal front.png" />
<Resource Include="Resources\mockup liaher base.png" />
<Resource Include="Resources\mockup liaher front.png" />
<Resource Include="Resources\mockup2base.png" />
<Resource Include="Resources\No-WiFi.png" />
<Resource Include="Resources\NoPosterAvailable.png" />
Expand Down
45 changes: 31 additions & 14 deletions FoliCon/Modules/Util.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ public static async void CheckForUpdate(bool onlyShowIfUpdateAvailable = false)
{
var info = new GrowlInfo
{

Message = LangProvider.GetLang("NewVersionFound").Format(ver.TagName, ver.Changelog.Replace("\\n", Environment.NewLine)),
Message = LangProvider.GetLang("NewVersionFound").Format(ver.TagName,
ver.Changelog.Replace("\\n", Environment.NewLine)),
ConfirmStr = LangProvider.GetLang("UpdateNow"),
CancelStr = LangProvider.GetLang("Ignore"),
ShowDateTime = false,
Expand All @@ -75,7 +75,9 @@ public static async void CheckForUpdate(bool onlyShowIfUpdateAvailable = false)
Growl.InfoGlobal(info);
}
}
else Growl.ErrorGlobal(new GrowlInfo { Message = LangProvider.GetLang("NetworkNotAvailable"), ShowDateTime = false });
else
Growl.ErrorGlobal(new GrowlInfo
{ Message = LangProvider.GetLang("NetworkNotAvailable"), ShowDateTime = false });
}

/// <summary>
Expand Down Expand Up @@ -179,6 +181,7 @@ public static void DeleteIconsFromSubfolders(string folderPath)
{
DeleteIconsFromFolder(folder);
}

RefreshIconCache();
SHChangeNotify(SHCNE.SHCNE_ASSOCCHANGED, SHCNF.SHCNF_IDLIST | SHCNF.SHCNF_FLUSHNOWAIT, folderPath);
}
Expand All @@ -200,6 +203,7 @@ public static void DeleteMediaInfoFromSubfolders(string folderPath)
File.Delete(icoFile);
}
}

/// <summary>
/// Checks if Web is accessible from This System
/// </summary>
Expand Down Expand Up @@ -229,9 +233,10 @@ public static List<string> GetFolderNames(string folderPath)
if (!string.IsNullOrEmpty(folderPath))
{
folderNames.AddRange(from folder in Directory.GetDirectories(folderPath)
where !File.Exists(folder + @"\" + Path.GetFileName(folder) + ".ico")
select Path.GetFileName(folder));
where !File.Exists(folder + @"\" + Path.GetFileName(folder) + ".ico")
select Path.GetFileName(folder));
}

return folderNames;
}

Expand Down Expand Up @@ -273,33 +278,38 @@ public static void AddToPickedListDataTable(DataTable dataTable, string poster,
dataTable.Rows.Add(nRow);
}

public static ObservableCollection<ListItem> FetchAndAddDetailsToListView(ResultResponse result, string query, bool isPickedById)
public static ObservableCollection<ListItem> FetchAndAddDetailsToListView(ResultResponse result, string query,
bool isPickedById)
{
var source = new ObservableCollection<ListItem>();

if (result.MediaType == MediaTypes.Tv)
{
dynamic ob = isPickedById ? (TvShow) result.Result : (SearchContainer<SearchTv>)result.Result;
dynamic ob = isPickedById ? (TvShow)result.Result : (SearchContainer<SearchTv>)result.Result;
source = Tmdb.ExtractTvDetailsIntoListItem(ob);
}
else if (result.MediaType == MediaTypes.Movie || result.MediaType == MediaTypes.Collection)
{
if (query.ToLower(CultureInfo.InvariantCulture).Contains("collection"))
{
dynamic ob = isPickedById ? (Collection) result.Result : (SearchContainer<SearchCollection>)result.Result;
dynamic ob = isPickedById
? (Collection)result.Result
: (SearchContainer<SearchCollection>)result.Result;
source = Tmdb.ExtractCollectionDetailsIntoListItem(ob);
}
else
{
dynamic ob;
try
{
ob = isPickedById ? (Movie) result.Result : (SearchContainer<SearchMovie>)result.Result;
ob = isPickedById ? (Movie)result.Result : (SearchContainer<SearchMovie>)result.Result;
source = Tmdb.ExtractMoviesDetailsIntoListItem(ob);
}
catch (Exception)
{
ob = isPickedById ? (Collection) result.Result : (SearchContainer<SearchCollection>)result.Result;
ob = isPickedById
? (Collection)result.Result
: (SearchContainer<SearchCollection>)result.Result;
source = Tmdb.ExtractCollectionDetailsIntoListItem(ob);
}
}
Expand Down Expand Up @@ -424,6 +434,7 @@ public static int MakeIco(string iconMode, string selectedFolder, DataTable pick
HideFile(targetFile);
SetFolderIcon($"{i}.ico", $@"{selectedFolder}\{i}");
}

ApplyChanges(selectedFolder);
SHChangeNotify(SHCNE.SHCNE_UPDATEITEM, SHCNF.SHCNF_PATHW, selectedFolder);
return iconProcessedCount;
Expand Down Expand Up @@ -466,6 +477,12 @@ public static void BuildFolderIco(string iconMode, string filmFolderPath, string
IconOverlay.Alternate => StaTask.Start(() =>
new PosterIconAlt(new PosterIcon(filmFolderPath, rating, ratingVisibility, mockupVisibility))
.RenderToBitmap()),
IconOverlay.Liaher => StaTask.Start(() =>
new PosterIconLiaher(new PosterIcon(filmFolderPath, rating, ratingVisibility, mockupVisibility))
.RenderToBitmap()),
IconOverlay.Faelpessoal => StaTask.Start(() => new PosterIconFaelpessoal(new PosterIcon(
filmFolderPath, rating,
ratingVisibility, mockupVisibility)).RenderToBitmap()),
_ => StaTask.Start(() =>
new Views.PosterIcon(new PosterIcon(filmFolderPath, rating, ratingVisibility, mockupVisibility))
.RenderToBitmap())
Expand Down Expand Up @@ -529,7 +546,7 @@ public static void ApplyChanges(string folderPath)
#endregion IconUtil

public static void ReadApiConfiguration(out string tmdbkey, out string igdbClientId,
out string igdbClientSecret, out string dartClientSecret, out string dartId)
out string igdbClientSecret, out string dartClientSecret, out string dartId)
{
var settings = GlobalDataHelper.Load<AppConfig>();
tmdbkey = settings.TmdbKey;
Expand Down Expand Up @@ -588,8 +605,8 @@ public static CultureInfo GetCultureInfoByLanguage(Languages language)
public static void SaveMediaInfo(int id, string mediaType, string folderPath)
{
var filePath = Path.Combine(folderPath, GlobalVariables.MediaInfoFile);
InIHelper.AddValue("ID", id.ToString(CultureInfo.InvariantCulture),null,filePath);
InIHelper.AddValue("MediaType", mediaType,null,filePath);
InIHelper.AddValue("ID", id.ToString(CultureInfo.InvariantCulture), null, filePath);
InIHelper.AddValue("MediaType", mediaType, null, filePath);
HideFile(filePath);
}

Expand All @@ -598,7 +615,7 @@ public static (string ID, string MediaType) ReadMediaInfo(string folderPath)
var filePath = Path.Combine(folderPath, GlobalVariables.MediaInfoFile);
var id = File.Exists(filePath) ? InIHelper.ReadValue("ID", null, filePath) : null;
var mediaType = File.Exists(filePath) ? InIHelper.ReadValue("MediaType", null, filePath) : null;
var mediaInfo = (ID:id, MediaType:mediaType);
var mediaInfo = (ID: id, MediaType: mediaType);
return mediaInfo;
}
}
Expand Down
Binary file added FoliCon/Resources/PosterIconFaelpessoal 2.ico
Binary file not shown.
Binary file added FoliCon/Resources/PosterIconFaelpessoal.ico
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added FoliCon/Resources/PosterIconLiaher.ico
Binary file not shown.
Binary file added FoliCon/Resources/PosterIconLiaher2.ico
Binary file not shown.
33 changes: 33 additions & 0 deletions FoliCon/Views/PosterIconFaelpessoal.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
using System;
using System.Collections.Generic;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
Expand All @@ -24,5 +26,36 @@ public PosterIconFaelpessoal()
{
InitializeComponent();
}

public PosterIconFaelpessoal(object dataContext)
{
DataContext = dataContext;
InitializeComponent();
}
public Bitmap RenderToBitmap()
{
return RenderTargetBitmapTo32BppArgb(AsRenderTargetBitmap());
}

private RenderTargetBitmap AsRenderTargetBitmap()
{
var size = new System.Windows.Size(256, 256);
Measure(size);
Arrange(new Rect(size));

var rtb = new RenderTargetBitmap((int)size.Width, (int)size.Height, 96, 96, PixelFormats.Default);
rtb.Render(this);

return rtb;
}

private static Bitmap RenderTargetBitmapTo32BppArgb(BitmapSource rtb)
{
var stream = new MemoryStream();
BitmapEncoder encoder = new PngBitmapEncoder();
encoder.Frames.Add(BitmapFrame.Create(rtb));
encoder.Save(stream);
return new Bitmap(stream);
}
}
}
33 changes: 33 additions & 0 deletions FoliCon/Views/PosterIconLiaher.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
using System;
using System.Collections.Generic;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
Expand All @@ -24,5 +26,36 @@ public PosterIconLiaher()
{
InitializeComponent();
}

public PosterIconLiaher(object dataContext)
{
DataContext = dataContext;
InitializeComponent();
}
public Bitmap RenderToBitmap()
{
return RenderTargetBitmapTo32BppArgb(AsRenderTargetBitmap());
}

private RenderTargetBitmap AsRenderTargetBitmap()
{
var size = new System.Windows.Size(256, 256);
Measure(size);
Arrange(new Rect(size));

var rtb = new RenderTargetBitmap((int)size.Width, (int)size.Height, 96, 96, PixelFormats.Default);
rtb.Render(this);

return rtb;
}

private static Bitmap RenderTargetBitmapTo32BppArgb(BitmapSource rtb)
{
var stream = new MemoryStream();
BitmapEncoder encoder = new PngBitmapEncoder();
encoder.Frames.Add(BitmapFrame.Create(rtb));
encoder.Save(stream);
return new Bitmap(stream);
}
}
}
29 changes: 26 additions & 3 deletions FoliCon/Views/posterIconConfig.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,20 +20,25 @@
<prism:Dialog.WindowStyle>
<Style TargetType="Window">
<Setter Property="Height" Value="300" />
<Setter Property="Width" Value="430" />
<Setter Property="ResizeMode" Value="NoResize" />
<Setter Property="MaxHeight" Value="300"></Setter>
<!--<Setter Property="Width" Value="430" />-->
<!--<Setter Property="ResizeMode" Value="NoResize" />-->
<Setter Property="WindowStyle" Value="ToolWindow" />
<Setter Property="prism:Dialog.WindowStartupLocation" Value="CenterOwner" />
</Style>
</prism:Dialog.WindowStyle>
<GroupBox hc:TitleElement.TitlePlacement="Top" Header="{langExtension:Lang Key={x:Static langs:LangKeys.PosterIconOverlay}}"
Style="{StaticResource GroupBoxTab}" FontSize="22" FontFamily="Cambria"
hc:TitleElement.Background="CornflowerBlue" Foreground="Black" BorderThickness="0"
Background="CornflowerBlue" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
Background="Transparent" Width="843">
<Grid HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="200" />
<ColumnDefinition Width="200" />
<ColumnDefinition Width="200" />
<ColumnDefinition Width="200" />
<ColumnDefinition Width="200" />
<ColumnDefinition Width="200" />
</Grid.ColumnDefinitions>
<RadioButton x:Name="RPoster" Grid.Column="0" GroupName="PosterOverlay"
Command="{Binding IconOverlayChangedCommand}"
Expand All @@ -54,6 +59,24 @@
<Image Source="/Resources/PosterIconAlt.ico" />
</RadioButton.Content>
</RadioButton>
<RadioButton x:Name="RPosterFaelpessoal" Grid.Column="2" GroupName="PosterOverlay"
Command="{Binding IconOverlayChangedCommand}"
CommandParameter="Faelpessoal" FontSize="16"
HorizontalAlignment="Left" VerticalAlignment="Stretch"
IsChecked="{Binding IconOverlay, ConverterParameter= Faelpessoal, Converter={StaticResource StringToBooleanConvertor}}">
<RadioButton.Content>
<Image Source="/Resources/PosterIconFaelpessoal.ico" />
</RadioButton.Content>
</RadioButton>
<RadioButton x:Name="RPosterLiaher" Grid.Column="3" GroupName="PosterOverlay"
Command="{Binding IconOverlayChangedCommand}"
CommandParameter="Liaher" FontSize="16"
HorizontalAlignment="Left" VerticalAlignment="Stretch"
IsChecked="{Binding IconOverlay, ConverterParameter= Liaher, Converter={StaticResource StringToBooleanConvertor}}">
<RadioButton.Content>
<Image Source="/Resources/PosterIconLiaher.ico" />
</RadioButton.Content>
</RadioButton>
</Grid>
</GroupBox>
</UserControl>

0 comments on commit 599f9bf

Please sign in to comment.