- Code: Select all
Byte[] myBytes= EmbeddedResource.GetBytes(myPath);
string allStrings = System.Text.Encoding.ASCII.GetString(myBytes);
allStrings = allStrings .Replace("\r", "");
string[] stringArray = allStrings .Split('\n');
Similarly I found I could get a bunch of decimals between 0 and 1 with one on each line in an embedded resource text file using this.
- Code: Select all
const int numDecimals = 30; // I know count for decimals. Not for strings.
decimal[] decimalArray = new decimal[numDecimals];
Byte[] myBytes= EmbeddedResource.GetBytes(myPath);
string allDecimals = System.Text.Encoding.ASCII.GetString(myBytes);
allDecimals = allDecimals .Replace("\r", "");
string[] stringArray = allDecimals .Split('\n');
for (int i = 0; i < numDecimals ; i++)
decimalArray[i] = Double.Parse(stringArray [i]);
The strings I read in the first example appear to be the same on both dev and live. However, the decimal example only works when I'm running the server locally. Posting the .dll on player io appears to cause my decimal array to ignore the decimal. So a number like 0.325235 read correctly locally will be read as 325235 on player io.
Anyone know what could be causing this? Is there a better way I should be putting the decimals/strings into arrays?