コード例 #1
0
    public void SearchListOfItems()
    {
        var obj = new HeaderObject()
        {
            Name        = "Header",
            LineObjects = new List <LineObject>()
            {
                new LineObject()
                {
                    Name = "Line1"
                },
                new LineObject()
                {
                    Name = "Line2"
                }
            }
        };

        var result = ObjectTextSearcher.Search(obj, "ine");

        result.Should().BeTrue();
    }
コード例 #2
0
 public QuicObject()
 {
     Security = "none";
     Key      = "";
     Header   = new();
 }
コード例 #3
0
        public static List <KeyValuePair <string, object> > Read(Stream stream, bool createImageObject)
        {
            var  header = new HeaderObject();
            Guid guid   = ReadGuid(stream);

            if (!guid.Equals(GUID_HEADER_OBJECT))
            {
                return(null);
            }
            var buf = new byte[14];

            stream.Read(buf, 0, 14);
            header.size  = BitConverter.ToUInt64(buf, 0);
            header.count = BitConverter.ToUInt32(buf, 8);

            List <KeyValuePair <string, object> > ecd = null;
            List <KeyValuePair <string, object> > heo = null;
            ContentsDescriptionObject             cd  = default(ContentsDescriptionObject);

            for (int i = 0; i < header.count; i++)
            {
                var guid_sub = ReadGuid(stream, 0);
                Logger.Debug(guid_sub.ToString() + " , " + stream.Position);
                if (guid_sub.Equals(GUID_CONTENTS_DESCRIPTION_OBJECT))
                {
                    cd = ReadContentsDescriptionObject(stream, 0);
                }
                else if (guid_sub.Equals(GUID_EXTENDED_CONTENTS_DESCRIPTION_OBJECT))
                {
                    ecd = ReadExtendedContentsDescriptionObject(stream, 0);
                }
                else if (guid_sub.Equals(GUID_HEADER_EXTENSION_OBJECT))
                {
                    heo = ReadHeaderExtensionObject(stream, 0);
                }
                else
                {
                    byte[] buf_size = new byte[8];
                    stream.Read(buf_size, 0, 8);
                    stream.Seek((long)BitConverter.ToUInt64(buf_size, 0) - 16 - 8, SeekOrigin.Current);
                }
            }
            if (ecd != null)
            {
                if (ecd.Find((e) => e.Key == "TITLE").Key == null && !String.IsNullOrEmpty(cd.title))
                {
                    ecd.Add(new KeyValuePair <string, object>("TITLE", cd.title));
                }
                if (ecd.Find((e) => e.Key == "ARTIST").Key == null && !String.IsNullOrEmpty(cd.artist))
                {
                    ecd.Add(new KeyValuePair <string, object>("ARTIST", cd.artist));
                }
                if (ecd.Find((e) => e.Key == "COMMENT").Key == null && !String.IsNullOrEmpty(cd.description))
                {
                    ecd.Add(new KeyValuePair <string, object>("COMMENT", cd.description));
                }
                if (heo != null)
                {
                    ecd.AddRange(heo);
                }
                return(ecd);
            }
            else
            {
                var tag = new List <KeyValuePair <string, object> >();
                if (cd.title != null)
                {
                    tag.Add(new KeyValuePair <string, object>("TITLE", cd.title));
                }
                if (cd.artist != null)
                {
                    tag.Add(new KeyValuePair <string, object>("ARTIST", cd.artist));
                }
                if (cd.description != null)
                {
                    tag.Add(new KeyValuePair <string, object>("COMMENT", cd.description));
                }
                return(tag);
            }
        }