Beispiel #1
0
        private void ProcessDataInternal(IStorageCLI storage)
        {
            var subHandle = new SubHandleCLI();
            var iterator  = new IIteratorCLI();
            var dataList  = new List <DataTuple>();

            storage.EnumStreams(ref iterator);
            while (true)
            {
                bool isDone = iterator.ProcessNext(ref subHandle);

                var type = subHandle?.GetType();

                if (type != StorageType.BinaryStream || isDone)
                {
                    break;
                }

                var stream = subHandle.GetBinaryStream();

                if (stream.GetStreamType() == PropertyType.Data)
                {
                    dataList.Add(new DataTuple(stream.GetTitle(), stream.GetValue()));
                }
            }

            AddData(dataList);
        }
Beispiel #2
0
        public static GeneralTreeNodeViewModel FormNodeFromStorage(IStorageCLI storage)
        {
            if (storage == null || storage.IsNull())
            {
                PLogger.Log("Node was null, skipping...");
                return(null);
            }

            var newNode = new GeneralTreeNodeViewModel()
            {
                InnerStorage = storage
            };

            //EnumStreams here
            var infoIt = new IIteratorCLI();

            storage.EnumStreams(ref infoIt);

            var subHandle = new SubHandleCLI();

            while (true)
            {
                bool isDone = infoIt?.ProcessNext(ref subHandle) ?? false;
                var  type   = subHandle?.GetType();
                if (type != StorageType.BinaryStream || isDone)
                {
                    break;
                }

                var stream = subHandle.GetBinaryStream();

                ProcessNodeProperties(newNode, stream);
            }

            return(newNode);
        }