Skip to content

Commit

Permalink
updated helper Module for potential ID search feature
Browse files Browse the repository at this point in the history
  • Loading branch information
DineshSolanki committed Jul 2, 2020
1 parent 4f18657 commit 0467135
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 10 deletions.
13 changes: 13 additions & 0 deletions Folicon_Native/Classes/IDObject.vb
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
Public Class IDObject
Public Sub New()

End Sub
Public Sub New(id As Integer, mediatype As String)
Me.ID = id
Me.MediaType = mediatype
End Sub

Public Property ID As Integer
Public Property MediaType As String

End Class
2 changes: 2 additions & 0 deletions Folicon_Native/Folicon.vbproj
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,10 @@
</Compile>
<Compile Include="Classes\DArtBrowseResult.vb" />
<Compile Include="Classes\DArtTokenResponse.vb" />
<Compile Include="Classes\IDObject.vb" />
<Compile Include="Classes\ImageToDownload.vb" />
<Compile Include="Classes\ListItem.vb" />
<Compile Include="Modules\MediaType.vb" />
<Compile Include="Classes\PngToIcoService.vb" />
<Compile Include="Classes\ProgressUpdater.vb" />
<Compile Include="Classes\TitleCleaner.vb" />
Expand Down
16 changes: 10 additions & 6 deletions Folicon_Native/Model/LayoutDesign.vb
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,18 @@ Namespace Model
Public Class LayoutDesign
Inherits MyMovieIconLayout
Public Sub New()
MyBase.New(DummyFolderJpg(), "8.1")
MyBase.New("C:\dummy.jpg", "8.1", "visible", "visible")
End Sub
Private Shared Async Function DummyFolderJpg() As Task(Of String)
Dim folderJpgPath = "H:\Users\ \Documents\Video\24 (IN)\24 (IN).jpg"
If Not IO.File.Exists(folderJpgPath) Then

End If
Private Shared Async Function DummyFolderJpgAsync() As Task(Of String)
Dim tmpPath = IO.Path.GetTempPath
Dim folderJpgPath = IO.Path.Combine(tmpPath, "posterDummy.jpg")
'If Not IO.File.Exists(folderJpgPath) Then
' Await DownloadImageFromUrlAsync("https://image.tmdb.org/t/p/original/r0bgHi3MwGHTKPWyJdORsb4ukY8.jpg", folderJpgPath)
'End If
Return folderJpgPath
End Function
Private Shared Async Function GetImageAsync(url As String, savePath As String) As Task
Await DownloadImageFromUrlAsync(url, savePath)
End Function
End Class
End Namespace
10 changes: 7 additions & 3 deletions Folicon_Native/Modules/Helpers.vb
Original file line number Diff line number Diff line change
Expand Up @@ -270,23 +270,27 @@ Namespace Modules
KillExplorer()
Process.Start("explorer.exe")
End Sub
Public Sub WriteIDtoFile(ByVal ID As Integer, ByVal folderPath As String)
Public Sub WriteIDtoFile(ByVal ID As Integer, mediaType As String, ByVal folderPath As String)
Dim fileName As String = Path.Combine(folderPath, "id.folicon")
Using sw As StreamWriter = My.Computer.FileSystem.OpenTextFileWriter _
(fileName, True)
sw.WriteLine(ID)
sw.WriteLine(mediaType)
End Using
If File.Exists(fileName) Then
HideIcons(fileName)
End If
End Sub
Public Function GetID(folderPath As String) As Integer
Public Function GetID(folderPath As String) As IDObject
Dim obj As New IDObject
Dim fileName As String = Path.Combine(folderPath, "id.folicon")
If File.Exists(fileName) Then
Using sr As StreamReader = My.Computer.FileSystem.OpenTextFileReader _
(fileName)
Return sr.ReadLine()
obj.ID = sr.ReadLine()
obj.MediaType = sr.ReadLine
End Using
Return obj
End If
Return Nothing
End Function
Expand Down
6 changes: 6 additions & 0 deletions Folicon_Native/Modules/MediaType.vb
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Module MediaType
Public ReadOnly Property Game = "Game"
Public ReadOnly Property Movie = "Movie"
Public ReadOnly Property Collection = "Collection"
Public ReadOnly Property TV = "TV"
End Module
4 changes: 3 additions & 1 deletion Folicon_Native/testPage.xaml.vb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
Imports System.IO
Imports FoliconNative.ViewModel
Imports Notifications.Wpf
Imports FoliconNative.Modules

Class TestPage
ReadOnly fileWatcher As New FileSystemWatcher("E:\Movies\") With {
Expand All @@ -25,7 +26,8 @@ Class TestPage

End Sub

Private Sub Button_Click(sender As Object, e As RoutedEventArgs)
Private Async Sub Button_Click(sender As Object, e As RoutedEventArgs)

fileWatcher.EnableRaisingEvents = True
MessageBox.Show(fileWatcher.Path)

Expand Down

0 comments on commit 0467135

Please sign in to comment.