Ejemplo n.º 1
0
        protected override void parseResult()
        {
            //OK,lat,lng,speed,time,trackID
            try
            {
                string[] s = RawMessage.Split(',');
                OK = s[0].Equals("OK");

                //Make sure that number in English format
                NumberFormatInfo info = new NumberFormatInfo();
                info.PercentDecimalSeparator = ".";

                double lat = double.Parse(s[1], info);
                double.Parse(s[1], info);
                double lng = double.Parse(s[2], info);

                long speed = long.Parse(s[3]);
                long time  = long.Parse(s[4]);

                long trackID = long.Parse(s[5]);

                //Result a waypoint that inserted into Server Database
                Result = new Waypoint(new Geocode(lat, lng), speed, time, trackID);
            }
            catch { OK = false; }
        }
Ejemplo n.º 2
0
 protected override void parseResult()
 {
     //OK,trackID
     try
     {
         string[] s = RawMessage.Split(',');
         OK     = s[0].Equals("OK");
         Result = long.Parse(s[1]);
     }
     catch { OK = false; }
 }
Ejemplo n.º 3
0
 protected override void parseResult()
 {
     //OK,username
     try
     {
         string[] s = RawMessage.Split(',');
         OK     = s[0].Equals("OK");
         Result = s[1];
     }
     catch { OK = false; }
 }
Ejemplo n.º 4
0
        /// <summary>
        ///     For parsing IRCv3 message tags
        /// </summary>
        private void ParseTagsPrefix()
        {
            if (!RawMessage.StartsWith("@"))
            {
                return;
            }

            IsIRCv3Message = true;

            string fullTagsPrefix = RawMessage.Substring(0, RawMessage.IndexOf(' '));

            string[] primitiveTagsCollection = RawMessage.Split(';');

            foreach (string[] splitPrimitiveTag in primitiveTagsCollection.Select(primitiveTag => primitiveTag.Split('=')))
            {
                Tags.Add(splitPrimitiveTag[0], splitPrimitiveTag[1] ?? string.Empty);
            }
        }
Ejemplo n.º 5
0
        internal S_SYSTEM_MESSAGE(TeraMessageReader reader) : base(reader)
        {
            reader.Skip(2);//offset
            RawMessage = reader.ReadTeraString();
            var    parts = RawMessage.Split(new[] { '\v' });
            ushort id;

            ushort.TryParse(parts[0].Replace("@", ""), out id);
            MsgType = reader.SysMsgNamer?.GetName(id) ?? id.ToString();
            int i = 1;

            while (i + 2 <= parts.Length)
            {
                Parameters[parts[i]] = parts[i + 1];
                i = i + 2;
            }
            //todo add various strsheet_*.xml to reconstruct game message as it seen by user (if needed?)
            Debug.WriteLine(MsgType + ":   " + string.Join(";\t", Parameters.Select(x => x.Key + ": " + x.Value)));
        }