Click here to Skip to main content
14,692,851 members
Home » Discussions » C#
   

C#

 
GeneralRe: Task.Run.Wait Pin
OriginalGriff3-Jul-20 5:00
mveOriginalGriff3-Jul-20 5:00 
AnswerRe: Task.Run.Wait Pin
jsc423-Jul-20 7:31
professionaljsc423-Jul-20 7:31 
QuestionStrange characters in JSON RPC server response Pin
pkfox1-Jul-20 4:37
professionalpkfox1-Jul-20 4:37 
AnswerRe: Strange characters in JSON RPC server response Pin
Luc Pattyn1-Jul-20 6:33
sitebuilderLuc Pattyn1-Jul-20 6:33 
GeneralRe: Strange characters in JSON RPC server response Pin
pkfox1-Jul-20 7:23
professionalpkfox1-Jul-20 7:23 
GeneralRe: Strange characters in JSON RPC server response Pin
pkfox1-Jul-20 7:46
professionalpkfox1-Jul-20 7:46 
GeneralRe: Strange characters in JSON RPC server response Pin
Luc Pattyn1-Jul-20 10:36
sitebuilderLuc Pattyn1-Jul-20 10:36 
GeneralRe: Strange characters in JSON RPC server response Pin
pkfox1-Jul-20 11:40
professionalpkfox1-Jul-20 11:40 
Hi Luc it was VS misleading me here is what I ended up doing to parse the values

Response from server - there are non printable characters in the response which I can't get to display here which contain the data lengths
ENAMELMSPiJSON9000UUID$0b5a576d-a276-4920-a9e8-134c41133102VERS7.9.2;
ResponseColumn ParseResponseString(string FieldName,string ResponseString)
{
    ResponseColumn rc = new ResponseColumn();

    int pos = ResponseString.IndexOf(FieldName);

    string ColumnName = ResponseString.Substring(pos,5);
    int DataLen = Convert.ToInt32(ColumnName[4]);
    pos+= 5; // this moves the pointer along the string to the value part
    string ColumnValue = ResponseString.Substring(pos,DataLen); // this reads the string starting at pos the length of DataLen

    rc.ColumnName = FieldName;
    rc.ColumnValue = ColumnValue;
    return rc;
}

public class ResponseColumn
{
    public string ColumnName {get;set;}
    public string ColumnValue{get;set;}
}

and use it thus
ResponseColumn rcPortNumber = ParseResponseString("JSON",ResponseString); // Gets me the port number.
ResponseColumn rcServerName = ParseResponseString("NAME",ResponseString); // Gets me the server name.
ResponseColumn rcServerVer  = ParseResponseString("VERS",ResponseString); // Gets me the server version.

Thanks for all your help
"We can't stop here - this is bat country" - Hunter S Thompson - RIP


modified 2-Jul-20 7:34am.

GeneralRe: Strange characters in JSON RPC server response Pin
Luc Pattyn5-Jul-20 4:27
sitebuilderLuc Pattyn5-Jul-20 4:27 
GeneralRe: Strange characters in JSON RPC server response Pin
pkfox5-Jul-20 6:45
professionalpkfox5-Jul-20 6:45 
GeneralRe: Strange characters in JSON RPC server response Pin
Luc Pattyn5-Jul-20 7:19
sitebuilderLuc Pattyn5-Jul-20 7:19 
GeneralRe: Strange characters in JSON RPC server response Pin
pkfox5-Jul-20 23:15
professionalpkfox5-Jul-20 23:15 
GeneralRe: Strange characters in JSON RPC server response Pin
Luc Pattyn6-Jul-20 3:12
sitebuilderLuc Pattyn6-Jul-20 3:12 
GeneralRe: Strange characters in JSON RPC server response Pin
pkfox6-Jul-20 4:08
professionalpkfox6-Jul-20 4:08 
GeneralRe: Strange characters in JSON RPC server response Pin
Luc Pattyn6-Jul-20 4:23
sitebuilderLuc Pattyn6-Jul-20 4:23 
GeneralRe: Strange characters in JSON RPC server response Pin
Luc Pattyn6-Jul-20 7:14
sitebuilderLuc Pattyn6-Jul-20 7:14 
GeneralRe: Strange characters in JSON RPC server response Pin
pkfox6-Jul-20 7:56
professionalpkfox6-Jul-20 7:56 
GeneralRe: Strange characters in JSON RPC server response Pin
Luc Pattyn6-Jul-20 8:16
sitebuilderLuc Pattyn6-Jul-20 8:16 
GeneralRe: Strange characters in JSON RPC server response Pin
pkfox6-Jul-20 8:27
professionalpkfox6-Jul-20 8:27 
GeneralRe: Strange characters in JSON RPC server response Pin
Luc Pattyn6-Jul-20 8:43
sitebuilderLuc Pattyn6-Jul-20 8:43 
GeneralRe: Strange characters in JSON RPC server response Pin
pkfox6-Jul-20 9:05
professionalpkfox6-Jul-20 9:05 
QuestionIntegers to Float IEEE 754 Pin
Member 1487212830-Jun-20 17:39
MemberMember 1487212830-Jun-20 17:39 
AnswerRe: Integers to Float IEEE 754 Pin
Luc Pattyn30-Jun-20 18:29
sitebuilderLuc Pattyn30-Jun-20 18:29 
GeneralRe: Integers to Float IEEE 754 Pin
Member 148721281-Jul-20 6:44
MemberMember 148721281-Jul-20 6:44 
GeneralRe: Integers to Float IEEE 754 Pin
Luc Pattyn1-Jul-20 6:50
sitebuilderLuc Pattyn1-Jul-20 6:50 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.