Jump to content

[C# Clientside] FileStream error


Recommended Posts

Hey everyone,


I encountered a problem which I was not able to find a solution to solve my issue. I want to use a JObject parsed from a .json file.

I used FileStreams and StreamReaders for that and got the error "C# filestreams could not be used" on login on the client side.

My code is:

public static JObject GetClothData(Sex sex)
  string plainText = string.Empty;
  using (FileStream fs = File.OpenRead($"Clothes{(sex == Sex.Male ? "M" : "F")}.json"))
    using (StreamReader sw = new StreamReader(fs))
      plainText = sw.ReadToEnd();
  return JObject.Parse(plainText);

Is there anything to do in advance to allow filestreams or are there any workarounds? (e.g. in JS I can require a json file)


Thanks in advance!


Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...