Exemple #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);
        }
        public void ProcessNodeInfoAndAdd(ITreeNodeViewModel parent)
        {
            if (parent?.InnerStorage == null)
            {
                return;
            }

            var storage         = parent.InnerStorage;
            var storageIterator = new IIteratorCLI();

            storage?.EnumStorages(ref storageIterator);


            var newHandle = new SubHandleCLI();

            while (true)
            {
                bool isDone = storageIterator.ProcessNext(ref newHandle);

                var type = newHandle?.GetType();

                if (isDone || type != StorageType.IStorage || newHandle.IsEmpty())
                {
                    break;
                }

                GenerateNodeAndAdd(newHandle, parent);
            }
        }
Exemple #3
0
        public void ProcessNodeData(ITreeNodeViewModel node)
        {
            var storage   = node?.InnerStorage ?? throw new NullReferenceException("Invalid Node was passed");
            var iterator  = new IIteratorCLI();
            var subHandle = new SubHandleCLI();

            storage.EnumStorages(ref iterator);
            while (true)
            {
                bool isDone = iterator?.ProcessNext(ref subHandle) ?? false;
                var  type   = subHandle?.GetType();
                if (type != StorageType.IStorage || isDone)
                {
                    break;
                }
                var childStorage = subHandle.GetStorage();
                ProcessDataInternal(childStorage);
            }
        }
Exemple #4
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);
        }
Exemple #5
0
        private List <DataTuple> GatherExportList(ITreeNodeViewModel treeNode)
        {
            var storage = treeNode?.InnerStorage;

            var iterator = new IIteratorCLI();

            storage?.EnumStorages(ref iterator);

            var subHandle = new SubHandleCLI();
            var dataList  = new List <DataTuple>();

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

                if (isDone || subHandle?.GetType() != StorageType.IStorage)
                {
                    break;
                }
                dataList.AddRange(ProcessStorage(subHandle?.GetStorage()));
            }

            return(dataList);
        }