Hi Guys,
I have code that translates a text file so that it can be read into other software. However, the vendor file that I am translating, has changed two of the strings in the latest version (AD20). In the previous version (AD19) they used the strings Top Overlay and Bottom Overlay. In the new version (AD20) they use T.SilkS and B.SilkS to represent the same thing.
How should I change the code below so that it will read in both AD19 and AD20 versions?
Thanks for your help.
Bazza
I have code that translates a text file so that it can be read into other software. However, the vendor file that I am translating, has changed two of the strings in the latest version (AD20). In the previous version (AD19) they used the strings Top Overlay and Bottom Overlay. In the new version (AD20) they use T.SilkS and B.SilkS to represent the same thing.
How should I change the code below so that it will read in both AD19 and AD20 versions?
C#:
private string LayerContent
{
get
{
int indexStart = _line.IndexOf("NAME=Top Overlay"); //This works for AD19
int indexEnd = _line.IndexOf("NAME=Bottom Overlay"); //This works for AD19
//int indexStart = _line.IndexOf("NAME=T.SilkS"); //This works for AD20
//int indexEnd = _line.IndexOf("NAME=B.SilkS"); //This works for AD20
string context = _line.Substring(indexStart, indexEnd - indexStart);
return context;
}
}
Thanks for your help.
Bazza
Last edited by a moderator: