Example #1
0
        private void GetHDFAttributeDefs()
        {
            List <HDFAttributeDef[]> lstDefses = new List <HDFAttributeDef[]>();

            //foreach (H4SDS dataset in H4File.Datasets)
            for (int i = 0; i < H4File.Datasets.Length; i++)
            {
                H4SDS             dataset        = H4File.Datasets[i];
                HDFAttributeDef[] attributeDef5s = new HDFAttributeDef[dataset.SDAttributes.Length];
                lstDefses.Add(attributeDef5s);

                //foreach (HDFAttribute attribute4 in dataset.SDAttributes)
                for (int j = 0; j < dataset.SDAttributes.Length; j++)
                {
                    HDFAttribute    attribute4 = dataset.SDAttributes[j];
                    HDFAttributeDef attribute5 = new HDFAttributeDef();
                    attribute5.Name   = attribute4.Name;
                    attribute5.Size   = attribute4.Count;
                    attribute5.Type   = Utility.GetAttrType(attribute4.DataType);
                    attribute5.Value  = attribute4.Value;
                    attributeDef5s[j] = attribute5;
                }
            }
            DatasetsAttributeDefs = lstDefses;
        }
Example #2
0
        public HDFAttributeDef[] GetHDFAttributeDefs()
        {
            HDFAttribute[]         globalAttrs    = Hdf4FileAttr.H4File.GlobalAttrs;
            List <HDFAttributeDef> attributeDef5s = new List <HDFAttributeDef>();

            for (int i = 0; i < globalAttrs.Length; i++)
            {
                HDFAttribute    attribute4 = globalAttrs[i];
                HDFAttributeDef attribute5 = new HDFAttributeDef();
                attribute5.Name = attribute4.Name;
                attribute5.Size = attribute4.Count;
                attribute5.Type = Utility.GetAttrType(attribute4.DataType);
                if (attribute4.DataType == HDF4Helper.DataTypeDefinitions.DFNT_CHAR8)
                {
                    attribute5.Value = GetNewAttr(attribute4.Value);
                }
                else
                {
                    attribute5.Value = attribute4.Value;
                }
                attributeDef5s.Add(attribute5);
            }
            if (attributeDef5s.Count == 0)
            {
                return(null);
            }
            else
            {
                attributeDef5s.Sort((cur, last) => cur.Name.CompareTo(last.Name));
                return(attributeDef5s.ToArray());
            }
        }
Example #3
0
        //public byte[] GetNewAttr(string attr)
        //{
        //    string newAttr = attr.Replace(UpperLeftPointOld, UpperLeftPointNew)
        //        .Replace(LowerRightPointOld, LowerRightPointNew)
        //        .Replace(XDimOld, XDimNew)
        //        .Replace(YDimOld, YDimNew);
        //    //return newAttr;//.ToCharArray();
        //    var stringLength = newAttr.Length;
        //    byte[] bs = Encoding.Default.GetBytes(newAttr);
        //    return bs;
        //}

        public HDFAttributeDef[] GetHDFAttributeDefs()
        {
            HDFAttribute[]    globalAttrs    = Hdf4FileAttr.H4File.GlobalAttrs;
            HDFAttributeDef[] attributeDef5s = new HDFAttributeDef[globalAttrs.Length];
            for (int i = 0; i < globalAttrs.Length; i++)
            {
                HDFAttribute    attribute4 = globalAttrs[i];
                HDFAttributeDef attribute5 = new HDFAttributeDef();
                attribute5.Name = attribute4.Name;
                attribute5.Size = attribute4.Count;
                attribute5.Type = Utility.GetBaseType(attribute4.DataType);
                if (attribute4.DataType == HDF4Helper.DataTypeDefinitions.DFNT_CHAR8)
                {
                    attribute5.Value = GetNewAttr(attribute4.Value);
                }
                else
                {
                    attribute5.Value = attribute4.Value;
                }
                attributeDef5s[i] = attribute5;
            }
            return(attributeDef5s);
        }