Exemplo n.º 1
0
            public bool MoveNext()
            {
                while (_reader.Read() && !_token.IsCancellationRequested)
                {
                    if (_reader.CurrentToken.Type == JTokenType.Property)
                    {
                        if (((JProperty)_reader.CurrentToken).Name.CompareTo("id") == 0)
                        {
                            _curProject = new Project()
                            {
                                ProjectId = Convert.ToInt32(((JProperty)_reader.CurrentToken).Value.ToString())
                            };

                            if (!MoveToNextProperty(_reader))
                            {
                                return(false);
                            }

                            _curProject.TeamId = new Guid(((JProperty)_reader.CurrentToken).Value.ToString());

                            if (!MoveToNextProperty(_reader))
                            {
                                return(false);
                            }

                            _curProject.ProjectName = ((JProperty)_reader.CurrentToken).Value.ToString();

                            if (!MoveToNextProperty(_reader))
                            {
                                return(false);
                            }

                            // IsPublic?
                            if (!Convert.ToBoolean(((JProperty)_reader.CurrentToken).Value.ToString()))
                            {
                                // Scan isn't public, move to the next scan.
                                _curProject = new Project();
                                continue;
                            }

                            _curProject.PresetId = CxProjectScanSettings.GetScanSettings
                                                       (_ctx, _token, _curProject.ProjectId).PresetId;

                            return(true);
                        }
                    }
                }

                return(false);
            }
Exemplo n.º 2
0
            public bool MoveNext()
            {
                while (true)
                {
                    if (_reader.CurrentToken == null)
                    {
                        while (_reader.Read() && _reader.CurrentToken.Type != JTokenType.Array)
                        {
                            ;
                        }
                        if (_reader.CurrentToken == null || _reader.CurrentToken.Type != JTokenType.Array)
                        {
                            return(false);
                        }

                        _projectArray = (JArray)_reader.CurrentToken;
                    }
                    else
                    {
                        _arrayPos++;
                    }

                    if (!(_arrayPos < _projectArray.Count))
                    {
                        return(false);
                    }

                    _curProject = (Project) new JsonSerializer().
                                  Deserialize(new JTokenReader(_projectArray[_arrayPos]), typeof(Project));

                    if (!_curProject.IsPublic)
                    {
                        _curProject = null;
                        continue;
                    }
                    else
                    {
                        _curProject.PresetId = CxProjectScanSettings.GetScanSettings
                                                   (_ctx, _token, _curProject.ProjectId).PresetId;
                        break;
                    }
                }

                return(true);
            }