X13.Periphery.MsDevice.CalculateTopicId C# (CSharp) Method

CalculateTopicId() private method

private CalculateTopicId ( string path ) : ushort
path string
return ushort
    private ushort CalculateTopicId(string path) {
      ushort id;
      byte[] buf=Encoding.UTF8.GetBytes(path);
      id=Crc16.ComputeChecksum(buf);
      while(id==0 || id==0xF000 || id==0xFFFF || _topics.Any(z => z.it==TopicIdType.Normal && z.TopicId==id)) {
        id=Crc16.UpdateChecksum(id, (byte)_rand.Next(0, 255));
      }
      return id;
    }
    private TopicInfo GetTopicInfo(string path, bool sendRegister=true) {