public static TaggedString ApplyTag(this string s, TagType tagType, string arg = null) { if (arg == null) { return(string.Format("(*{0}){1}(/{0})", tagType.ToString(), s)); } return(string.Format("(*{0}={1}){2}(/{0})", tagType.ToString(), arg, s)); }
public static string CombineReceiveDataString(ref string resault, string _clientID, string _value, TagType _type, bool _flag) { if (resault != null && resault != "") { resault = resault + "|" + _clientID + "|" + _value + "|" + _type.ToString().ToLower() + "|" + _flag.ToString().ToLower(); } else { resault = _clientID + "|" + _value + "|" + _type.ToString().ToLower() + "|" + _flag.ToString().ToLower(); } return(""); }
private T[] CatchArrayItems <T>(TagType arrayedTagType, TagType targetTagType, Func <TagBase, T> func) where T : IConvertible { List <T> list = new List <T>(); while (true) { if (JsonAt() != ']') { TagBase TagBase = ExtractValue(); TagType targetType = TagBase.TagType; if (targetType != targetTagType) { throw GenerateException("Unable to insert " + targetType.ToString() + " into " + arrayedTagType.ToString()); } list.Add(func(TagBase)); if (HasArrayNext()) { if (!InTextLength()) { throw GenerateException("Expected value"); } continue; } } CheckCharacter(']'); return(list.ToArray()); } }
public override void WriteStartTag(string name, TagType type) { TagContainerState currentState; currentState = _state.StartTag(type); if (string.IsNullOrEmpty(name)) { name = "tag"; } if (XmlConvert.EncodeName(name) == name) { _writer.WriteStartElement(name); } else { _writer.WriteStartElement("tag"); _writer.WriteAttributeString("name", name); } if (type != TagType.End && (currentState == null || currentState.ContainerType != TagType.List)) { _writer.WriteAttributeString("type", type.ToString()); } }
/// <summary> /// 构建Html /// </summary> /// <param name="tagType">标签类型</param> /// <param name="tagId">标签Id</param> /// <param name="attributes">属性</param> /// <param name="className">样式</param> /// <param name="innerHtml">内部Html</param> /// <returns>标签元素</returns> private static MvcHtmlString HtmlBuilder( TagType tagType, string tagId, RouteValueDictionary attributes, string className, string innerHtml ) { var builder = new TagBuilder(tagType.ToString()) { IdAttributeDotReplacement = "_" }; if (!string.IsNullOrWhiteSpace(tagId)) { builder.GenerateId(tagId); } if (!attributes.ContainsKey("class")) { if (!string.IsNullOrWhiteSpace(className)) { builder.AddCssClass(className); } } builder.MergeAttributes(attributes); builder.InnerHtml = innerHtml; return(MvcHtmlString.Create(builder.ToString())); }
private void TranscribeAttributes(XmlElement el) { el.SetAttribute("Description", Description); el.SetAttribute("Bonus", $"{Bonus:F3}"); el.SetAttribute("BonusTarget", BonusTarget); el.SetAttribute("TagType", TagType.ToString()); el.SetAttribute("Operation", Operation.ToString()); }
public override void WriteStartTag(string name, TagType type, TagType listType, int count) { this.WriteStartTag(name, type); _state.StartList(listType, count); _writer.WriteAttributeString("limitType", listType.ToString()); }
private void SkipValue() { switch (_type) { case TagType.Byte: _stream.Read(_byteBuffer, 0, 1); _readState = ReadState.TagType; break; case TagType.Short: _stream.Read(_shortBuffer, 0, BitHelper.ShortSize); _readState = ReadState.TagType; break; case TagType.Int: _stream.Read(_intBuffer, 0, BitHelper.IntSize); _readState = ReadState.TagType; break; case TagType.Long: _stream.Read(_longBuffer, 0, BitHelper.LongSize); _readState = ReadState.TagType; break; case TagType.Float: _stream.Read(_floatBuffer, 0, BitHelper.FloatSize); _readState = ReadState.TagType; break; case TagType.Double: _stream.Read(_doubleBuffer, 0, BitHelper.DoubleSize); _readState = ReadState.TagType; break; case TagType.ByteArray: break; case TagType.String: this.ReadStringData(); _readState = ReadState.TagType; break; case TagType.List: _stream.Read(_intBuffer, 0, BitHelper.IntSize); _readState = ReadState.TagType; break; case TagType.Compound: this.SetType(_stream.ReadByte()); break; case TagType.IntArray: break; default: throw new NotImplementedException(_type.ToString()); } }
public static ClusterTagDto ConvertToClusterTagDto(this IRfidTag tag, TagType tagType = TagType.PassiveRfid, DateTime?readTime = null) { return(new ClusterTagDto { TagNumber = tag.TagNumber, TagType = tagType.ToString(), AverageRssi = tag.Rssi, ReadCount = tag.ReadCount, ReadTime = readTime ?? DateTime.Now }); }
public string WrapInTag(string stringToWrapp, TagType typeOfTag = TagType.Info) { //check to see if the string is empty if (!string.IsNullOrWhiteSpace(stringToWrapp)) { return(string.Format("<{0}>{1}</{0}>", typeOfTag.ToString(), stringToWrapp)); } else { return(null); } }
public VRTrackerTag GetTag(TagType type) { foreach (VRTrackerTag tag in tags) { if (tag.tagType == type) { return(tag); } } Debug.LogWarning("Could not find a VR Tracker Tag with type " + type.ToString() + " in current Scene"); return(null); }
public TagsStorage(string name, TagType tagType) { this.tagType = tagType; if (this.tagType == TagType.Object) { this.name = name; } else { this.name = name + " [" + tagType.ToString() + "]"; } }
public static ITag CreateTag(TagType type) { switch (type) { case TagType.Byte: return(new ByteTag()); case TagType.Char: return(new CharTag()); case TagType.Double: return(new DoubleTag()); case TagType.Float: return(new FloatTag()); case TagType.Int: return(new IntTag()); case TagType.List: return(new ListTag()); case TagType.Long: return(new LongTag()); case TagType.Map: return(new MapTag()); case TagType.Short: return(new ShortTag()); case TagType.String: return(new StringTag()); case TagType.ByteArray: return(new ByteArrayTag()); case TagType.IntArray: return(new IntArrayTag()); case TagType.LongArray: return(new LongArrayTag()); case TagType.StringArray: return(new StringArrayTag()); default: throw new NotSupportedException(type.ToString()); } }
public static string LKTag(TagType eTagType, string context, IDictionary<string, object> htmlattributes) { TagBuilder tag = new TagBuilder(eTagType.ToString().ToLower()); tag.MergeAttributes(htmlattributes); tag.InnerHtml = context; string sHtml = ""; switch (eTagType) { case TagType.IMG: sHtml = tag.ToString(TagRenderMode.SelfClosing); break; default: sHtml = tag.ToString(TagRenderMode.Normal); break; } return sHtml; }
private TagBase GetListedTag() { CheckCharacter('['); SkipWhiteSpace(); if (!InTextLength()) { throw GenerateException("Expected value"); } else { TagList nbttaglist = new TagList(); TagType baseTagType = TagType.End; while (JsonAt() != ']') { TagBase TagBase = ExtractValue(); TagType tagtype = TagBase.TagType; if (baseTagType <= 0) { baseTagType = tagtype; } else if (tagtype != baseTagType) { throw GenerateException("Unable to insert " + tagtype.ToString() + " into ListTag of type " + baseTagType.ToString()); } nbttaglist.Add(TagBase); if (!HasArrayNext()) { break; } if (!InTextLength()) { throw GenerateException("Expected value"); } } CheckCharacter(']'); return(nbttaglist); } }
public string ToString(TagRenderMode renderMode) { var tagName = TagType.ToString(); var sb = new StringBuilder(); switch (renderMode) { case TagRenderMode.StartTag: sb.Append('<') .Append(tagName); AppendAttributes(sb); sb.Append('>'); break; case TagRenderMode.EndTag: sb.Append("</") .Append(tagName) .Append('>'); break; case TagRenderMode.SelfClosing: sb.Append('<') .Append(tagName); AppendAttributes(sb); sb.Append(" />"); break; default: sb.Append('<') .Append(tagName); AppendAttributes(sb); sb.Append('>') .Append(InnerHtml) .Append("</") .Append(tagName) .Append('>'); break; } return(sb.ToString()); }
public string this[TagType type] { get { return(GetId3Data()[type]); } set { switch (type) { case TagType.Artist: Artist = value; break; case TagType.Id: TrackId = value; break; case TagType.Title: Title = value; break; case TagType.Album: Album = value; break; case TagType.Genre: Genre = value; break; case TagType.Year: Year = value; break; case TagType.Comment: Comment = value; break; default: throw new ArgumentOutOfRangeException(type.ToString(), type, null); } } }
private void btn_Select_Click(object sender, EventArgs e) { //sm_mifare_lib.mifare sm132 = new sm_mifare_lib.mifare(); byte TagType; byte[] TagSerial = new byte[4]; byte ReturnCode = 0; byte i; if (sm132.CMD_SelectTag(out TagType, out TagSerial, out ReturnCode)) { textBox1.Text = "Tag Type:" + TagType.ToString() + " "; textBox1.Text += " Tag Serial: "; for (i = 0; i < 4; i++) { textBox1.Text += TagSerial[i].ToString("X2"); } } else //Select not successful { if (ReturnCode == 0x4E) //'N' { textBox1.Text = "No Tag found. Error Code:" + ReturnCode.ToString("X2"); } else if (ReturnCode == 0x55) //'U' { textBox1.Text = "RF Field is off. Error Code:" + ReturnCode.ToString("X2"); } else { textBox1.Text = "Communication Error. Error Code:" + ReturnCode.ToString("X2"); } } }
/// <summary> /// /// </summary> /// <param name="element_tag_type">This is enum, site =1, equip = 2, point=3, extendedpoint=4, // Extended Point is not belongs to haystake, this our extended Tag type department = 5, floor = 6, utilities = 7, zone = 8</param> /// <param name="Is_Disabled">If is Is_Disabled is true it mean return all the disabled elements </param> /// <returns></returns> public IList <ElementDTO> Get_Element_By_Element_Tag_Type(TagType element_tag_type, bool Is_Disabled) { ICollection <tblElement> elements = _dbcontext.tblElements.Include("tblTagElements").Where(element => element.Element_Tag_Type == element_tag_type.ToString() && element.Is_Disabled == Is_Disabled).ToList(); //Filter TagElement Table only not deleted foreach (var element in elements) { element.tblTagElements = element.tblTagElements.Where(d => d.Is_Deleted == false).ToList(); } return(ElementDTO.ConvertTableListToDTOList(elements)); }
public static string Revert(TagType Type) { char[] ca = Type.ToString().ToCharArray(); Array.Reverse(ca); return new string(ca); }
/// <summary> /// Almacena el valor de una tag en memoria /// </summary>> /// <returns></returns> public bool AddValue(int Id_Prensa, TagType Type, string Value, DateTime Moment) { bool sw = false; try { var key = Helper.ToKey(Id_Prensa, Type); if (!string.IsNullOrEmpty(key)) { if (this._valoresPrensa.ContainsKey(key)) { TagValue valor; if (this._valoresPrensa.TryGetValue(key, out valor)) { if (valor == null) { //No hay ningún valor asociado, le añadimos valor = CreateTagValue(Id_Prensa, Type, Value, Moment); sw = true; } else { // La señal ya contiene un valor, lo actualizamos valor.Date = Moment; valor.Value = Value; sw = true; } } } else { // De esta señal nunca se había recibido un valor, lo agregamos var valor = CreateTagValue(Id_Prensa, Type, Value, Moment); this._valoresPrensa.Add(key, valor); sw = true; } #if DEBUG // En el caso de estar compilado como debug para desarrollo agregamos traza de log log.Debug("Almacenando valor en colas de memoria. Prensa: {0}, Tipo: {1}, Insertado: {2}", Id_Prensa, Type.ToString(), sw); #endif } } catch (Exception er) { log.Error("AddValue()", er); } return(sw); }
private List <WixFileRow> CreateProductTagFiles(Output output) { List <WixFileRow> updatedFileRows = new List <WixFileRow>(); SourceLineNumberCollection sourceLineNumbers = null; Table tagTable = output.Tables["WixProductTag"]; if (null != tagTable) { string productCode = null; string productName = null; Version productVersion = null; string manufacturer = null; Table properties = output.Tables["Property"]; foreach (Row property in properties.Rows) { switch ((string)property[0]) { case "ProductCode": productCode = (string)property[1]; break; case "ProductName": productName = (string)property[1]; break; case "ProductVersion": productVersion = TagBinder.CreateFourPartVersion((string)property[1]); break; case "Manufacturer": manufacturer = (string)property[1]; break; } } // If the ProductCode is available, only keep it if it is a GUID. if (!String.IsNullOrEmpty(productCode)) { try { Guid guid = new Guid(productCode); productCode = guid.ToString("D").ToUpperInvariant(); } catch // not a GUID, erase it. { productCode = null; } } Table wixFileTable = output.Tables["WixFile"]; foreach (Row tagRow in tagTable.Rows) { string fileId = (string)tagRow[0]; string regid = (string)tagRow[1]; string name = (string)tagRow[2]; bool licensed = (null != tagRow[3] && 1 == (int)tagRow[3]); string typeString = (string)tagRow[4]; TagType type = String.IsNullOrEmpty(typeString) ? TagType.Application : (TagType)Enum.Parse(typeof(TagType), typeString); string uniqueId = String.IsNullOrEmpty(productCode) ? name.Replace(" ", "-") : productCode; if (String.IsNullOrEmpty(this.overallRegid)) { this.overallRegid = regid; sourceLineNumbers = tagRow.SourceLineNumbers; } else if (!this.overallRegid.Equals(regid, StringComparison.Ordinal)) { // TODO: display error that only one regid supported. } // Find the WixFileRow that matches for this WixProductTag. foreach (WixFileRow wixFileRow in wixFileTable.Rows) { if (fileId == wixFileRow.File) { // Write the tag file. wixFileRow.Source = Path.GetTempFileName(); using (FileStream fs = new FileStream(wixFileRow.Source, FileMode.Create)) { TagBinder.CreateTagFile(fs, regid, uniqueId, productName, productVersion, manufacturer, licensed, type, null); } updatedFileRows.Add(wixFileRow); // remember that we modified this file. // Ensure the matching "SoftwareIdentificationTag" row exists and // is populated correctly. Row swidRow; if (!this.swidRows.TryGet(fileId, out swidRow)) { Table swid = output.Tables["SoftwareIdentificationTag"]; swidRow = swid.CreateRow(wixFileRow.SourceLineNumbers); swidRow[0] = fileId; swidRow[1] = this.overallRegid; this.swidRows.Add(swidRow); } // Always rewrite. swidRow[2] = uniqueId; swidRow[3] = type.ToString(); } } } } // If we remembered the source line number for the regid, then add // a WixVariable to map to the regid. if (null != sourceLineNumbers) { Table wixVariableTable = output.Tables.EnsureTable(output.EntrySection, this.Core.TableDefinitions["WixVariable"]); WixVariableRow wixVariableRow = (WixVariableRow)wixVariableTable.CreateRow(sourceLineNumbers); wixVariableRow.Id = "WixTagRegid"; wixVariableRow.Value = this.overallRegid; wixVariableRow.Overridable = false; } return(updatedFileRows); }
public static Tag ReadTag(TagType read, Stream stream, bool nameread = true) { Tag tag = null; switch ((TagType)read) { case TagType.End: tag = new TagEnd(); break; case TagType.Byte: tag = new TagByte(); tag.Read(stream, nameread); break; case TagType.Short: tag = new TagShort(); tag.Read(stream, nameread); break; case TagType.Int: tag = new TagInt(); tag.Read(stream, nameread); break; case TagType.Long: tag = new TagLong(); tag.Read(stream, nameread); break; case TagType.Float: tag = new TagFloat(); tag.Read(stream, nameread); break; case TagType.Double: tag = new TagDouble(); tag.Read(stream, nameread); break; case TagType.ByteArray: tag = new TagByteArray(); tag.Read(stream, nameread); break; case TagType.String: tag = new TagString(); tag.Read(stream, nameread); break; case TagType.List: tag = new TagList(); tag.Read(stream, nameread); break; case TagType.Compound: tag = new TagCompound(); tag.Read(stream, nameread); break; case TagType.IntArray: tag = new TagIntArray(); tag.Read(stream, nameread); break; default: throw new IllegalNBTException("Unknown NBT Tag ID " + read + " " + read.ToString("X") + " " + char.ToString((char)read)); } return(tag); }
static public string ToTagTypeString(TagType type) { return(type.ToString()); }
private static void CreateTagFile(Stream stream, string regid, string uniqueId, string name, Version version, string manufacturer, bool licensed, TagType tagType, IList <SoftwareTag> containedTags) { using (XmlTextWriter writer = new XmlTextWriter(stream, Encoding.UTF8)) { writer.WriteStartDocument(); writer.WriteStartElement("software_identification_tag", "http://standards.iso.org/iso/19770/-2/2009/schema.xsd"); writer.WriteElementString("entitlement_required_indicator", licensed ? "true" : "false"); writer.WriteElementString("product_title", name); writer.WriteStartElement("product_version"); writer.WriteElementString("name", version.ToString()); writer.WriteStartElement("numeric"); writer.WriteElementString("major", version.Major.ToString()); writer.WriteElementString("minor", version.Minor.ToString()); writer.WriteElementString("build", version.Build.ToString()); writer.WriteElementString("review", version.Revision.ToString()); writer.WriteEndElement(); writer.WriteEndElement(); writer.WriteStartElement("software_creator"); writer.WriteElementString("name", manufacturer); writer.WriteElementString("regid", regid); writer.WriteEndElement(); if (licensed) { writer.WriteStartElement("software_licensor"); writer.WriteElementString("name", manufacturer); writer.WriteElementString("regid", regid); writer.WriteEndElement(); } writer.WriteStartElement("software_id"); writer.WriteElementString("unique_id", uniqueId); writer.WriteElementString("tag_creator_regid", regid); writer.WriteEndElement(); writer.WriteStartElement("tag_creator"); writer.WriteElementString("name", manufacturer); writer.WriteElementString("regid", regid); writer.WriteEndElement(); if (null != containedTags && 0 < containedTags.Count) { writer.WriteStartElement("complex_of"); foreach (SoftwareTag tag in containedTags) { writer.WriteStartElement("software_id"); writer.WriteElementString("unique_id", tag.Id); writer.WriteElementString("tag_creator_regid", tag.Regid); writer.WriteEndElement(); // </software_id> } writer.WriteEndElement(); // </complex_of> } if (TagType.Unknown != tagType) { writer.WriteStartElement("extended_information"); writer.WriteStartElement("tag_type", "http://www.tagvault.org/tv_extensions.xsd"); writer.WriteValue(tagType.ToString()); writer.WriteEndElement(); // </tag_type> writer.WriteEndElement(); // </extended_information> } writer.WriteEndElement(); // </software_identification_tag> } }
public static String UserCommunitiesTags(Int32 idUser, TagType type) { return(AllUserCommunitiesTags + idUser.ToString() + "_" + type.ToString() + "_"); }
public static String Tags(TagType type) { return(AllTags + type.ToString() + "_"); }
public static void CreateTagFile(Stream stream, string regid, string uniqueId, string name, string version, string manufacturer, bool licensed, TagType tagType, IEnumerable <SoftwareTag> containedTags) { using (var writer = XmlWriter.Create(stream, WriterSettings)) { writer.WriteStartDocument(); writer.WriteStartElement("software_identification_tag", "http://standards.iso.org/iso/19770/-2/2009/schema.xsd"); writer.WriteElementString("entitlement_required_indicator", licensed ? "true" : "false"); writer.WriteElementString("product_title", name); writer.WriteStartElement("product_version"); writer.WriteElementString("name", version.ToString()); if (Version.TryParse(version, out var parsedVersion)) { writer.WriteStartElement("numeric"); writer.WriteElementString("major", parsedVersion.Major.ToString()); writer.WriteElementString("minor", parsedVersion.Minor.ToString()); writer.WriteElementString("build", parsedVersion.Build.ToString()); writer.WriteElementString("review", parsedVersion.Revision.ToString()); writer.WriteEndElement(); } writer.WriteEndElement(); writer.WriteStartElement("software_creator"); writer.WriteElementString("name", manufacturer); writer.WriteElementString("regid", regid); writer.WriteEndElement(); if (licensed) { writer.WriteStartElement("software_licensor"); writer.WriteElementString("name", manufacturer); writer.WriteElementString("regid", regid); writer.WriteEndElement(); } writer.WriteStartElement("software_id"); writer.WriteElementString("unique_id", uniqueId); writer.WriteElementString("tag_creator_regid", regid); writer.WriteEndElement(); writer.WriteStartElement("tag_creator"); writer.WriteElementString("name", manufacturer); writer.WriteElementString("regid", regid); writer.WriteEndElement(); if (containedTags?.Any() == true) { writer.WriteStartElement("complex_of"); foreach (var tag in containedTags) { writer.WriteStartElement("software_id"); writer.WriteElementString("unique_id", tag.Id); writer.WriteElementString("tag_creator_regid", tag.Regid); writer.WriteEndElement(); // </software_id> } writer.WriteEndElement(); // </complex_of> } if (TagType.Unknown != tagType) { writer.WriteStartElement("extended_information"); writer.WriteStartElement("tag_type", "http://www.tagvault.org/tv_extensions.xsd"); writer.WriteValue(tagType.ToString()); writer.WriteEndElement(); // </tag_type> writer.WriteEndElement(); // </extended_information> } writer.WriteEndElement(); // </software_identification_tag> } }
public string GetId() { return(Type == TagType.Normal ? Tag.TagId.ToString() : Type.ToString()); }
private static void CreateTagFile(Stream stream, string regid, string uniqueId, string name, Version version, string manufacturer, bool licensed, TagType tagType, IList<SoftwareTag> containedTags) { using (XmlTextWriter writer = new XmlTextWriter(stream, Encoding.UTF8)) { writer.WriteStartDocument(); writer.WriteStartElement("software_identification_tag", "http://standards.iso.org/iso/19770/-2/2009/schema.xsd"); writer.WriteElementString("entitlement_required_indicator", licensed ? "true" : "false"); writer.WriteElementString("product_title", name); writer.WriteStartElement("product_version"); writer.WriteElementString("name", version.ToString()); writer.WriteStartElement("numeric"); writer.WriteElementString("major", version.Major.ToString()); writer.WriteElementString("minor", version.Minor.ToString()); writer.WriteElementString("build", version.Build.ToString()); writer.WriteElementString("review", version.Revision.ToString()); writer.WriteEndElement(); writer.WriteEndElement(); writer.WriteStartElement("software_creator"); writer.WriteElementString("name", manufacturer); writer.WriteElementString("regid", regid); writer.WriteEndElement(); if (licensed) { writer.WriteStartElement("software_licensor"); writer.WriteElementString("name", manufacturer); writer.WriteElementString("regid", regid); writer.WriteEndElement(); } writer.WriteStartElement("software_id"); writer.WriteElementString("unique_id", uniqueId); writer.WriteElementString("tag_creator_regid", regid); writer.WriteEndElement(); writer.WriteStartElement("tag_creator"); writer.WriteElementString("name", manufacturer); writer.WriteElementString("regid", regid); writer.WriteEndElement(); if (null != containedTags && 0 < containedTags.Count) { writer.WriteStartElement("complex_of"); foreach (SoftwareTag tag in containedTags) { writer.WriteStartElement("software_id"); writer.WriteElementString("unique_id", tag.Id); writer.WriteElementString("tag_creator_regid", tag.Regid); writer.WriteEndElement(); // </software_id> } writer.WriteEndElement(); // </complex_of> } if (TagType.Unknown != tagType) { writer.WriteStartElement("extended_information"); writer.WriteStartElement("tag_type", "http://www.tagvault.org/tv_extensions.xsd"); writer.WriteValue(tagType.ToString()); writer.WriteEndElement(); // </tag_type> writer.WriteEndElement(); // </extended_information> } writer.WriteEndElement(); // </software_identification_tag> } }
protected override void handleTag(BBeBTag tag) { switch (tag.Id) { case TagId.Text: string encoded = HttpUtility.HtmlEncode(((TextTag)tag).Value); StringBuilder utf8 = new StringBuilder(); foreach (char ch in encoded) { if ((ushort)ch > 127) { utf8.AppendFormat("&#{0};", (ushort)ch); } else { utf8.Append(ch); } } data.Append(utf8.ToString()); break; case TagId.EOL: data.Append("<br />"); break; case TagId.ItalicBegin: data.Append("<i>"); break; case TagId.ItalicEnd: data.Append("</i>"); break; case TagId.BeginSup: data.Append("<sup>"); break; case TagId.EndSup: data.Append("</sup>"); break; case TagId.BeginSub: data.Append("<sub>"); break; case TagId.EndSub: data.Append("</sub>"); break; case TagId.BeginButton: // TODO Can probably turn this into a hyperlink break; case TagId.FontSize: UInt16Tag fontSizeTag = (UInt16Tag)tag; if (fontSizeTag.Value == 100) { data.AppendFormat("</{0}>", m_eLastHeadingTag.ToString()); m_eLastHeadingTag = TagType.Unknown; } TagType type = ConvertFontSizeToHeading(fontSizeTag.Value); switch (type) { case TagType.H1: case TagType.H2: case TagType.H3: case TagType.H4: case TagType.H5: case TagType.H6: data.AppendFormat("<{0}>", type.ToString()); m_eLastHeadingTag = type; break; } break; case TagId.BeginPage: data.Append("<p>"); break; case TagId.EndPage: data.Append("</p>"); break; case TagId.FontWeight: break; case TagId.FontWidth: break; case TagId.EndButton: case TagId.KomaPlot: break; default: break; } }
public Tag_Type_Mapping_DTO Get_Tag_Type_Mapping_By_Tag_Type(TagType tag_type) { tblTag_Type_Mapping tbl_Tag_Type_Mapping = _dbcontext.tblTag_Type_Mapping.Single(d => d.Tag_Type == tag_type.ToString()); return(Tag_Type_Mapping_Convert.Convert_Tag_Type_Table_TO_DTO(tbl_Tag_Type_Mapping)); }
private void button1_Click(object sender, EventArgs e) { //sm_mifare_lib.mifare sm132 = new sm_mifare_lib.mifare(); //sm132.InitPort(); if (sm132.OpenPort(comboBox1.Text, 19200)) { richTextBox1.Text += "Port is initialized and opened\n"; timer1.Enabled = true; //sm_mifare_lib.mifare sm132 = new sm_mifare_lib.mifare(); //select tag begin byte TagType; byte[] TagSerial = new byte[4]; byte ReturnCode = 0; byte i; if (sm132.CMD_SelectTag(out TagType, out TagSerial, out ReturnCode)) { richTextBox1.Text += "Tag Type:" + TagType.ToString() + "\n"; richTextBox1.Text += "Tag Serial: "; for (i = 0; i < 4; i++) { richTextBox1.Text += TagSerial[i].ToString("X2"); } //auth begin byte AuthSource = 0xFF; byte BlockNo; //byte ReturnCode; byte[] Key = new byte[6]; BlockNo = byte.Parse("1"); //Mifare Default Key AuthSource = (byte)sm_mifare_lib.ASource.KeyMifareDefault; //Authenticate if (sm132.CMD_Authenticate(AuthSource, Key, BlockNo, out ReturnCode)) { richTextBox1.Text += "\nAuthentication Success Bloc: " + BlockNo + "\n"; //textBox_S.Text = textBox1.Text; byte BlockLogin = 1; byte BlockPwd = 2; byte[] BlockDataLogin = new byte[16]; byte[] BlockDataPwd = new byte[16]; string login_rfid = ""; string pwd_rfid = ""; if (sm132.CMD_ReadBlock(BlockLogin, out BlockDataLogin, out ReturnCode)) { richTextBox1.Text += "Read Successfull\n"; login_rfid = BlockDataLogin[0].ToString("X2"); login_rfid += BlockDataLogin[1].ToString("X2"); login_rfid += BlockDataLogin[2].ToString("X2"); login_rfid += BlockDataLogin[3].ToString("X2"); login_rfid += BlockDataLogin[4].ToString("X2"); login_rfid += BlockDataLogin[5].ToString("X2"); login_rfid += BlockDataLogin[6].ToString("X2"); login_rfid += BlockDataLogin[7].ToString("X2"); login_rfid += BlockDataLogin[8].ToString("X2"); login_rfid += BlockDataLogin[9].ToString("X2"); login_rfid += BlockDataLogin[10].ToString("X2"); login_rfid += BlockDataLogin[11].ToString("X2"); login_rfid += BlockDataLogin[12].ToString("X2"); login_rfid += BlockDataLogin[13].ToString("X2"); login_rfid += BlockDataLogin[14].ToString("X2"); login_rfid += BlockDataLogin[15].ToString("X2"); } else //Read not successful { if (ReturnCode == 0x4E) //'N' { richTextBox2.Text = "No Tag found. Error Code:" + ReturnCode.ToString("X2"); } else if (ReturnCode == 0x46) //'F' { richTextBox2.Text = "Read Failed:" + ReturnCode.ToString("X2"); } else { richTextBox2.Text = "Communication Error. Error Code:" + ReturnCode.ToString("X2"); } } if (sm132.CMD_ReadBlock(BlockPwd, out BlockDataPwd, out ReturnCode)) { pwd_rfid = BlockDataPwd[0].ToString("X2"); pwd_rfid += BlockDataPwd[1].ToString("X2"); pwd_rfid += BlockDataPwd[2].ToString("X2"); pwd_rfid += BlockDataPwd[3].ToString("X2"); pwd_rfid += BlockDataPwd[4].ToString("X2"); pwd_rfid += BlockDataPwd[5].ToString("X2"); pwd_rfid += BlockDataPwd[6].ToString("X2"); pwd_rfid += BlockDataPwd[7].ToString("X2"); pwd_rfid += BlockDataPwd[8].ToString("X2"); pwd_rfid += BlockDataPwd[9].ToString("X2"); pwd_rfid += BlockDataPwd[10].ToString("X2"); pwd_rfid += BlockDataPwd[11].ToString("X2"); pwd_rfid += BlockDataPwd[12].ToString("X2"); pwd_rfid += BlockDataPwd[13].ToString("X2"); pwd_rfid += BlockDataPwd[14].ToString("X2"); pwd_rfid += BlockDataPwd[15].ToString("X2"); //richTextBox1.Text += HexString2Ascii(pwd_rfid) + "\n"; if (string.Compare(textBox1.Text, HexString2Ascii(login_rfid)) == 0 && string.Compare(textBox2.Text, HexString2Ascii(pwd_rfid)) == 0) { richTextBox1.Text += "BIENVENUE\n"; byte BlockFlouss = 5; long Value = 0; if (sm132.CMD_Authenticate(AuthSource, Key, BlockFlouss, out ReturnCode)) { if (sm132.CMD_ReadValue(BlockFlouss, out Value, out ReturnCode)) { label8.Visible = true; textBox3.Visible = true; groupBox2.Visible = true; button5.Visible = true; button1.Visible = false; textBox1.Enabled = false; label2.Visible = false; textBox2.Text = ""; textBox2.Visible = false; comboBox1.Enabled = false; textBox3.Text = Value.ToString(); } else //ReadValue not successful { if (ReturnCode == 0x4E) //'N' { richTextBox2.Text = "No Tag found. Error Code:" + ReturnCode.ToString("X2"); } else if (ReturnCode == 0x46) //'F' { richTextBox2.Text = "Read Failed. Error Code:" + ReturnCode.ToString("X2"); } else if (ReturnCode == 0x49) //'I' { richTextBox2.Text = "Invalid Value Block. Error Code:" + ReturnCode.ToString("X2"); } else { richTextBox2.Text = "Communication Error. Error Code:" + ReturnCode.ToString("X2"); } } } } else { richTextBox1.Text += "LOGIN/MDP INCORRECT(S)\n"; } } else //Read not successful { if (ReturnCode == 0x4E) //'N' { richTextBox2.Text = "No Tag found. Error Code:" + ReturnCode.ToString("X2"); } else if (ReturnCode == 0x46) //'F' { richTextBox2.Text = "Read Failed:" + ReturnCode.ToString("X2"); } else { richTextBox2.Text = "Communication Error. Error Code:" + ReturnCode.ToString("X2"); } } } else { if (ReturnCode == 0x4E) //'N' { richTextBox2.Text += "No Tag or Login failed. Error Code:" + ReturnCode.ToString("X2") + "\n"; } else if (ReturnCode == 0x55) { richTextBox2.Text += "Login failed. Error Code:" + ReturnCode.ToString("X2") + "\n"; } else if (ReturnCode == 0x45) { richTextBox2.Text += "Invalid Key Format. Error Code:" + ReturnCode.ToString("X2") + "\n"; } else if (ReturnCode == 0) { richTextBox2.Text += "Communication Error. Error Code:" + ReturnCode.ToString("X2") + "\n"; } else { richTextBox2.Text += "Unknown Error. Error Code:" + ReturnCode.ToString("X2") + "\n"; } } //auth end } else //Select not successful { if (ReturnCode == 0x4E) //'N' { richTextBox2.Text += "No Tag found. Error Code:" + ReturnCode.ToString("X2") + "\n"; } else if (ReturnCode == 0x55) //'U' { richTextBox2.Text += "RF Field is off. Error Code:" + ReturnCode.ToString("X2") + "\n"; } else { richTextBox2.Text += "Communication Error. Error Code:" + ReturnCode.ToString("X2") + "\n"; } } //select tag end } else { richTextBox2.Text += "Port could not be opened\n"; } }
public string this[TagType type] { get { return GetId3Data()[type]; } set { switch (type) { case TagType.Artist: Artist = value; break; case TagType.Id: TrackId = value; break; case TagType.Title: Title = value; break; case TagType.Album: Album = value; break; case TagType.Genre: Genre = value; break; case TagType.Year: Year = value; break; case TagType.Comment: Comment = value; break; default: throw new ArgumentOutOfRangeException(type.ToString(), type, null); } } }