var openFileDialog1 = new OpenFileDialog();
openFileDialog1.Filter = "JSON file (*.json*)|*.json*";
//Setting path of JSON file.
if (openFileDialog1.ShowDialog() == DialogResult.OK)
{
string LRClocalPath = Path.GetDirectoryName(openFileDialog1.FileName); //System.UnauthorizedAccessException error...
//Small debugging check.
/*if (File.Exists(LRClocalPath))
{
throw new Exception("Found the required path!");
}
else
{
throw new Exception("Something went wrong!"); //Getting this while debugging.
}*/
//Reading JSON file contents.
using var LRCFileContents = File.OpenRead(LRClocalPath);
JsonTextReader reader = new JsonTextReader(new StringReader(LRClocalPath));
//Prepearing View
}
else
{
throw new Exception("Did you even choose a file?");
}
var openFileDialog1 = new OpenFileDialog();
openFileDialog1.Filter = "JSON file (*.json*)|*.json*";
//Setting path of JSON file.
if (openFileDialog1.ShowDialog() == DialogResult.OK)
{
string LRClocalPath = Path.GetDirectoryName(openFileDialog1.FileName); //System.UnauthorizedAccessException error...
//Small debugging check.
/*if (File.Exists(LRClocalPath))
{
throw new Exception("Found the required path!");
}
else
{
throw new Exception("Something went wrong!"); //Getting this while debugging.
}*/
//Reading JSON file contents.
using var LRCFileContents = File.OpenRead(LRClocalPath);
JsonTextReader reader = new JsonTextReader(new StringReader(LRClocalPath));
//Prepearing View
}
else
{
throw new Exception("Did you even choose a file?");
}