I am working on a project where values are stored in a Text file and should be retrieved every time the application starts. The text file is very simple and straight forward:
{
"HowManyDayImages": "11",
"HowManyNightImages": "5",
}
I have this simple class with two values as numbers:
public class ImageConfig
{
public int HowManyDayImages { get; set; }
public int HowManyNightImages { get; set; }
}
then I have this code to look up the respected file and read the values from it and set them:
public static async void LoadConfigAsync()
{
try
{
ApplicationDataContainer settings = ApplicationData.Current.LocalSettings;
string themeName = (string)settings.Values["Theme"];
StorageFolder localFolder = ApplicationData.Current.LocalFolder;
StorageFolder timeFolder = await localFolder.GetFolderAsync("Dynamic");
StorageFolder themeFolder = await localFolder.GetFolderAsync(themeName);
string imageConf;
if (File.Exists("images.conf"))
{
imageConf = File.ReadAllText("images.conf");
}
else
{
imageConf = Encoding.UTF8.GetString(Properties.Resources.imageConf);
}
imageSettings = JsonConvert.DeserializeObject<ImageConfig>(imageConf);
}
catch
{
}
}
with this I am facing two problems. the first is that in this line " Encoding.UTF8.GetString(Properties.Resources.imageConf);" I am getting the error that "Properties" does not exist in the current context.
The second problem I am facing is that I keep getting an error saying that "Dynamic" could not be found.