Beispiel #1
0
        public void TestStartAndStopExist()
        {
            string TestJSONString = "{ \"Property\" : 1.0 }";
            var    result         = ElementsFinder.StartAndStopExist(TestJSONString);

            Assert.True(result);
        }
Beispiel #2
0
        public IDecompositor Go()
        {
            int strIndex = 0;

            if (!string.IsNullOrEmpty(JSONInput))
            {
                if (ElementsFinder.StartAndStopExist(JSONInput))
                {
                    for (;;)
                    {
                        var index = ElementsFinder.GetNextPropertyIndex(JSONInput, strIndex);
                        if (index == -1)
                        {
                            IsComplited = false;
                            break;
                        }
                        var NextPropertyFragment = ElementsFinder.GetPropertyFragment(JSONInput, index);
                        if (!string.IsNullOrEmpty(NextPropertyFragment))
                        {
                            strIndex = index + NextPropertyFragment.Length;
                        }
                        else
                        {
                            IsComplited = false;
                            break;
                        }
                        var PropertyName     = ElementsFinder.GetFragmentName(NextPropertyFragment);
                        var PropertyDataType = ElementsFinder.GetFragmentDataType(NextPropertyFragment);
                        var PropertyType     = ElementsFinder.GetFragmentType(NextPropertyFragment);
                        var ProperyValue     = ElementsFinder.GetFragmentValue(NextPropertyFragment);
                        _Parts.Add(ClassPart.Create(PropertyType, PropertyDataType, NextPropertyFragment, PropertyName, ProperyValue));
                    }
                }
            }
            else
            {
                IsComplited = false;
            }
            return(this);
        }