Exemple #1
0
        /// <summary>
        /// Transforms an array of <see cref="NFCNdefPayload"/> into an array of <see cref="NFCNdefRecord"/>
        /// </summary>
        /// <param name="records">Array of <see cref="NFCNdefPayload"/></param>
        /// <returns>Array of <see cref="NFCNdefRecord"/></returns>
        NFCNdefRecord[] GetRecords(NFCNdefPayload[] records)
        {
            var results = new NFCNdefRecord[records.Length];

            for (var i = 0; i < records.Length; i++)
            {
                var record     = records[i];
                var ndefRecord = new NFCNdefRecord
                {
                    TypeFormat = (NFCNdefTypeFormat)record.TypeNameFormat,
                    Payload    = record.Payload.ToByteArray()
                };
                results.SetValue(ndefRecord, i);
            }
            return(results);
        }
Exemple #2
0
        /// <summary>
        /// Transforms an array of <see cref="NdefRecord"/> into an array of <see cref="NFCNdefRecord"/>
        /// </summary>
        /// <param name="records">Array of <see cref="NdefRecord"/></param>
        /// <returns>Array of <see cref="NFCNdefRecord"/></returns>
        NFCNdefRecord[] GetRecords(NdefRecord[] records)
        {
            var results = new NFCNdefRecord[records.Length];

            for (var i = 0; i < records.Length; i++)
            {
                var ndefRecord = new NFCNdefRecord
                {
                    TypeFormat = (NFCNdefTypeFormat)records[i].Tnf,
                    Uri        = records[i].ToUri()?.ToString(),
                    MimeType   = records[i].ToMimeType(),
                    Payload    = records[i].GetPayload()
                };
                results.SetValue(ndefRecord, i);
            }
            return(results);
        }
Exemple #3
0
        /// <summary>
        /// Transforms an array of <see cref="NFCNdefPayload"/> into an array of <see cref="NFCNdefRecord"/>
        /// </summary>
        /// <param name="records">Array of <see cref="NFCNdefPayload"/></param>
        /// <returns>Array of <see cref="NFCNdefRecord"/></returns>
        NFCNdefRecord[] GetRecords(NFCNdefPayload[] records)
        {
            if (records == null)
            {
                return(null);
            }

            var results = new NFCNdefRecord[records.Length];

            for (var i = 0; i < records.Length; i++)
            {
                var record     = records[i];
                var ndefRecord = new NFCNdefRecord
                {
                    TypeFormat = (NFCNdefTypeFormat)record.TypeNameFormat,
                    Uri        = records[i].ToUri()?.ToString(),
                    MimeType   = records[i].ToMimeType(),
                    Payload    = record.Payload.ToByteArray()
                };
                results.SetValue(ndefRecord, i);
            }
            return(results);
        }