Added setup and minor fixes
This commit is contained in:
@@ -7,12 +7,18 @@
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<UseWPF>true</UseWPF>
|
||||
<ApplicationIcon>icon.ico</ApplicationIcon>
|
||||
<AssemblyName>TV Player</AssemblyName>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Remove="Assets\bkGround.jpg" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Content Include="icon.ico" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.2.2" />
|
||||
<PackageReference Include="LibVLCSharp" Version="3.8.2">
|
||||
|
||||
@@ -5,7 +5,8 @@ namespace TV_Player.ViewModels
|
||||
{
|
||||
public static class SettingsModel
|
||||
{
|
||||
private const string _filePath = "settings.json";
|
||||
private static readonly string AppDataFolder = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "TVPlayer");
|
||||
private static readonly string SettingsFilePath = Path.Combine(AppDataFolder, "settings.json");
|
||||
|
||||
public static string PlaylistURL { get; set; }
|
||||
public static bool StartFullScreen { get; set; }
|
||||
@@ -31,8 +32,10 @@ namespace TV_Player.ViewModels
|
||||
// Serialize the object to JSON
|
||||
string json = JsonConvert.SerializeObject(dataToSerialize, Formatting.Indented);
|
||||
|
||||
if (!Directory.Exists(AppDataFolder))
|
||||
Directory.CreateDirectory(AppDataFolder);
|
||||
// Save the JSON to a file
|
||||
File.WriteAllText(_filePath, json);
|
||||
File.WriteAllText(SettingsFilePath, json);
|
||||
}
|
||||
|
||||
public static void LoadSettings()
|
||||
@@ -46,10 +49,10 @@ namespace TV_Player.ViewModels
|
||||
StartFromLastScreen = default(bool),
|
||||
StartFullScreen = default(bool)
|
||||
};
|
||||
if (File.Exists(_filePath))
|
||||
if (File.Exists(SettingsFilePath))
|
||||
{
|
||||
// Read the JSON content from the file
|
||||
string json = File.ReadAllText(_filePath);
|
||||
string json = File.ReadAllText(SettingsFilePath);
|
||||
loadedData = JsonConvert.DeserializeAnonymousType(json, loadedData);
|
||||
}
|
||||
// Assign the values to the properties
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 135 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 166 KiB |
@@ -7,6 +7,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TV Player WPF", "TV Player
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TV Player MAUI", "TV Player\TV Player MAUI.csproj", "{4AEADD32-BAF5-4FB8-AB5B-63050CF46D29}"
|
||||
EndProject
|
||||
Project("{54435603-DBB4-11D2-8724-00A0C9A8B90C}") = "TVPlayerSetup", "TVPlayerSetup\TVPlayerSetup.vdproj", "{273EE5D6-5DF3-4B9D-9EF0-B348CBC22DA9}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
@@ -23,6 +25,8 @@ Global
|
||||
{4AEADD32-BAF5-4FB8-AB5B-63050CF46D29}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{4AEADD32-BAF5-4FB8-AB5B-63050CF46D29}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{4AEADD32-BAF5-4FB8-AB5B-63050CF46D29}.Release|Any CPU.Deploy.0 = Release|Any CPU
|
||||
{273EE5D6-5DF3-4B9D-9EF0-B348CBC22DA9}.Debug|Any CPU.ActiveCfg = Debug
|
||||
{273EE5D6-5DF3-4B9D-9EF0-B348CBC22DA9}.Release|Any CPU.ActiveCfg = Release
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user