private byte[] GetBytesWithoutInvalidAddresses(ConstructionTemplate template) { using (var stream = new MemoryStream()) { stream.Write(new[] { (byte)template.Type }, 0, 1); foreach (var argument in template.Elements) { if (argument is ScAddress) { var bytes = argument.GetBytes(); stream.Write(bytes, 0, bytes.Length); } else { if ((argument as ScAddress) != ScAddress.Invalid) { var bytes = argument.GetBytes(); stream.Write(bytes, 0, bytes.Length); } } } return(stream.ToArray()); } }
/// <summary> /// Инициализирует новый экземпляр класса <see cref="IteratorsChain"/> /// </summary> /// <param name="initialTemplate">Первый шаблон цепочки</param> public IteratorsChain(ConstructionTemplate initialTemplate) { chainMembers = new List <IteratorsChainMember>(); initialConstruction = initialTemplate; }
/// <summary> /// Инициализирует новый экземпляр класса <see cref="IteratorsChainMember"/> /// </summary> /// <param name="substitution">Подстановка <see cref="Substitution"/></param> /// /// <param name="constructionTemplate">Шаблон итератора <see cref="ConstructionTemplate"/></param> public IteratorsChainMember(Substitution substitution, ConstructionTemplate constructionTemplate) { this.substitution = substitution; this.constructionTemplate = constructionTemplate; }