private object parseNode(string xml, Type pluginType)
        {
            XmlElement element  = DataMother.BuildDocument(xml).DocumentElement;
            var        reader   = new PrimitiveArrayReader();
            Instance   instance = reader.Read(element, pluginType);

            return(instance.Build(pluginType, new StubBuildSession()));
        }
        private object parseNode(string xml, Type pluginType)
        {
            XmlElement element = DataMother.BuildDocument(xml).DocumentElement;
            var reader = new PrimitiveArrayReader();
            Instance instance = reader.Read(element, pluginType);

            return instance.Build(pluginType, new StubBuildSession());
        }
Пример #3
0
        private object parseNode(string xml, Type pluginType)
        {
            XmlElement element  = DataMother.BuildDocument(xml).DocumentElement;
            var        reader   = new PrimitiveArrayReader();
            Instance   instance = reader.Read(element, pluginType);

            throw new NotImplementedException("Redo for the NWO");
            //return instance.Build(pluginType, new StubBuildSession());
        }
        private object parseNode(string xml, Type pluginType)
        {
            XmlElement element = DataMother.BuildDocument(xml).DocumentElement;
            var reader = new PrimitiveArrayReader();
            Instance instance = reader.Read(element, pluginType);

            throw new NotImplementedException("Redo for the NWO");
            //return instance.Build(pluginType, new StubBuildSession());
        }
Пример #5
0
        public void CanProcess_an_array_of_primitive_types()
        {
            var reader = new PrimitiveArrayReader();

            reader.CanProcess(typeof(string)).ShouldBeFalse();
            reader.CanProcess(typeof(IWidget[])).ShouldBeFalse();

            reader.CanProcess(typeof(string[])).ShouldBeTrue();
            reader.CanProcess(typeof(int[])).ShouldBeTrue();
            reader.CanProcess(typeof(double[])).ShouldBeTrue();
        }
        public void CanProcess_an_array_of_primitive_types()
        {
            var reader = new PrimitiveArrayReader();

            reader.CanProcess(typeof (string)).ShouldBeFalse();
            reader.CanProcess(typeof (IWidget[])).ShouldBeFalse();

            reader.CanProcess(typeof (string[])).ShouldBeTrue();
            reader.CanProcess(typeof (int[])).ShouldBeTrue();
            reader.CanProcess(typeof (double[])).ShouldBeTrue();
        }
Пример #7
0
        private void Convert()
        {
            // Close the row index writer
            _rowIndexWriter.Dispose();
            _rowIndexWriter = null;

            // If we wrote any rows we need to convert...
            if (_rowCountWritten > 0)
            {
                // Get the set of unique values and get rid of the value dictionary
                XArray values = _dictionary.Values();

                // Convert the indices previously written into raw values
                Func <XArray, XArray> converter = TypeConverterFactory.GetConverter(typeof(byte), typeof(int));
                using (IColumnReader rowIndexReader = new PrimitiveArrayReader <byte>(_streamProvider.OpenRead(Path.Combine(_columnPath, RowIndexFileName))))
                {
                    int           rowCount = rowIndexReader.Count;
                    ArraySelector page     = ArraySelector.All(0).NextPage(rowCount, 10240);
                    while (page.Count > 0)
                    {
                        // Read an XArray of indices and convert to int[]
                        XArray rowIndices = converter(rowIndexReader.Read(page));

                        // Write the corresponding values
                        // Reselect is safe because 'values' are converted to a contiguous array
                        _valueWriter.Append(values.Reselect(ArraySelector.Map((int[])rowIndices.Array, rowIndices.Count)));

                        page = page.NextPage(rowCount, 10240);
                    }
                }
            }

            // Remove the Dictionary (so future rows are streamed out as-is)
            _dictionary = null;

            // Delete the row index file
            _streamProvider.Delete(Path.Combine(_columnPath, RowIndexFileName));
        }