public string ReadString()
        {
            string result = "";

            try
            {
                result = System.Text.Encoding.Unicode.GetString(Buffer, Position, (int)stream.Length - Position);
                int idx = result.IndexOf((char)0x00);
                if (!(idx == -1))
                {
                    result = result.Substring(0, idx);
                }
                Position += (result.Length * 2) + 2;
            }
            catch (Exception ex)
            {
                SysLogger.Log(ex.Message, SysLogType.Error);
                throw new Exception(ex.StackTrace + "\r\n" + ex.Message);
            }
            return(result);
        }
Esempio n. 2
0
 private void ExecuteTasks()
 {
     lock (tasks)
     {
         while (tasks.Count > 0)
         {
             try
             {
                 T obj;
                 lock (tasks)
                 {
                     obj = tasks.Dequeue();
                 }
                 callback(obj);
             }
             catch (Exception ex)
             {
                 SysLogger.Log(ex.Message, SysLogType.Error);
             }
         }
     }
 }