Ejemplo n.º 1
0
 public Ghost(GhostType type, EvidenceType evidence, EvidenceType absoluteEvidence = EvidenceType.None)
 {
     Type             = type;
     State            = GhostState.Potential;
     RequiredEvidence = evidence;
     AbsoluteEvidence = absoluteEvidence;
 }
Ejemplo n.º 2
0
        public async Task UpdateEvidenceStateAsync(EvidenceType evidenceType, EvidenceState evidenceState)
        {
            GameState?newState = await _gameService.UpdateEvidenceStateAsync(Context.ConnectionId, evidenceType, evidenceState);

            if (newState is null)
            {
                throw new HubException("Invalid input.");
            }

            await Clients.Group(newState.GameCode).OnEvidenceUpdated(newState.EvidenceStates, newState.EvidencePossibilities, newState.GhostPossibilities);
        }
Ejemplo n.º 3
0
 public EvidenceItem(int learnerId, int stepId, int activityId, int scenarioId, int emoteScenarioId, string evidenceName,double value,EvidenceType evidenceType, int sessionId)
 {
     this.evidenceName = evidenceName;
     this.evidenceType = evidenceType;
     this.actual = value.ToString();
     this.learnerId = learnerId;
     this.stepId = stepId;
     this.activityId = activityId;
     this.scenarioId = scenarioId;
     this.emoteScenarioId = emoteScenarioId;
     this.sessionId = sessionId;
 }
Ejemplo n.º 4
0
        public async Task <IActionResult> OnGetAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            EvidenceType = await _context.EvidenceType.FirstOrDefaultAsync(m => m.EvidenceTypeID == id);

            if (EvidenceType == null)
            {
                return(NotFound());
            }
            return(Page());
        }
Ejemplo n.º 5
0
  public CompetencyItem(String competencyName, Boolean competencyCorrect,String competencyActual,String competencyExpected,
 double comptencyValue, int competencyConfidence, double oldCompetencyValue, double competencyDelta, EvidenceType competencyType, Impact impact)
  {
      this.competencyName = competencyName;
      
      this.competencyCorrect = competencyCorrect;
      this.competencyActual = competencyActual;
      this.competencyExpected = competencyExpected;
      this.comptencyValue = comptencyValue;
      this.competencyConfidence = competencyConfidence;
      this.oldCompetencyValue = oldCompetencyValue;
      this.competencyDelta = competencyDelta;
      this.competencyType = competencyType;
      this.impact = impact;
  }
Ejemplo n.º 6
0
    public async Task UpdateEvidenceAsync(EvidenceType type, EvidenceState newState)
    {
        var evidence = _evidences.FirstOrDefault(evidence => evidence.Type == type);

        if (evidence is null)
        {
            return;
        }

        evidence.State = newState;
        RecalculateGhostStates();
        if (OnUpdated is not null)
        {
            await OnUpdated.Invoke();
        }
    }
        public override bool Equals(object obj)
        {
            if (obj == null)
            {
                return(false);
            }

            if (obj == this)
            {
                return(true);
            }

            return(obj is CreateDisputeEvidenceFileRequest other &&
                   ((IdempotencyKey == null && other.IdempotencyKey == null) || (IdempotencyKey?.Equals(other.IdempotencyKey) == true)) &&
                   ((EvidenceType == null && other.EvidenceType == null) || (EvidenceType?.Equals(other.EvidenceType) == true)) &&
                   ((ContentType == null && other.ContentType == null) || (ContentType?.Equals(other.ContentType) == true)));
        }
Ejemplo n.º 8
0
        public async Task <IActionResult> OnPostAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            EvidenceType = await _context.EvidenceType.FindAsync(id);

            if (EvidenceType != null)
            {
                _context.EvidenceType.Remove(EvidenceType);
                await _context.SaveChangesAsync();
            }

            return(RedirectToPage("./Index"));
        }
Ejemplo n.º 9
0
        public override int GetHashCode()
        {
            int hashCode = 814624770;

            if (IdempotencyKey != null)
            {
                hashCode += IdempotencyKey.GetHashCode();
            }

            if (EvidenceType != null)
            {
                hashCode += EvidenceType.GetHashCode();
            }

            if (EvidenceText != null)
            {
                hashCode += EvidenceText.GetHashCode();
            }

            return(hashCode);
        }
        public override int GetHashCode()
        {
            int hashCode = 52028208;

            if (IdempotencyKey != null)
            {
                hashCode += IdempotencyKey.GetHashCode();
            }

            if (EvidenceType != null)
            {
                hashCode += EvidenceType.GetHashCode();
            }

            if (ContentType != null)
            {
                hashCode += ContentType.GetHashCode();
            }

            return(hashCode);
        }
Ejemplo n.º 11
0
 public Evidence(EvidenceType type)
 {
     Type  = type;
     State = EvidenceState.Unknown;
 }
Ejemplo n.º 12
0
    private void RecalculateGhostStates()
    {
        foreach (var ghost in _ghosts)
        {
            ghost.State = GhostState.Potential;
        }

        var maximumMissing = Type == GameType.Nightmare ? 1 : 0;

        EvidenceType evidenceOfType(EvidenceState state) =>
        _evidences
        .Where(evidence => evidence.State == state)
        .Aggregate(EvidenceType.None, (acc, current) => acc | current.Type);

        EvidenceType presentEvidence = evidenceOfType(EvidenceState.Present);
        EvidenceType missingEvidence = evidenceOfType(EvidenceState.Missing);

        foreach (var ghost in _ghosts)
        {
            if (ghost.IsRuledOut)
            {
                ghost.State = GhostState.NotPossible;
                continue;
            }

            // If any of the present evidence is not in a
            // ghost's required, then it cannot be that ghost
            // E.g. if the Banshee needs DOTS, Fingerprints, and Orbs,
            // and EMF is selected, then it can't be the Bahshee
            if ((ghost.RequiredEvidence & presentEvidence) != presentEvidence)
            {
                ghost.State = GhostState.NotPossible;
                continue;
            }

            // If any of the absolute evidence is not present,
            // then it cannot be that ghost
            // E.g. if the Mimic has Ghost Orbs as an absolute,
            // and Ghost Orbs are missing (even on Nightmare),
            // then it cannot be the Mimic
            if ((ghost.AbsoluteEvidence & missingEvidence) != EvidenceType.None)
            {
                ghost.State = GhostState.NotPossible;
                continue;
            }

            var missingEvidenceCount =
                Enum.GetValues <EvidenceType>()
                .Where(evidenceType => evidenceType is not EvidenceType.None)
                .Count(evidenceType =>
                       ghost.RequiredEvidence.HasFlag(evidenceType) &&
                       missingEvidence.HasFlag(evidenceType)
                       );

            // If any ghosts have more evidence missing than maximumMissing, it's not possible
            // E.g. if the Banshee needs DOTS, Fingerprints, and Orbs, then
            // - On nightmare any one can be in the missing list, but not any more
            // - On normal, any missing means it is not possible
            if (missingEvidenceCount > maximumMissing)
            {
                ghost.State = GhostState.NotPossible;
            }
        }

        if (_ghosts.Count(ghost => ghost.State == GhostState.Potential) == 1)
        {
            _ghosts.First(ghos => ghos.State == GhostState.Potential).State = GhostState.Definite;
        }
    }
Ejemplo n.º 13
0
 public UpdateEvidenceAction(EvidenceType evidenceType, EvidenceState state)
 {
     EvidenceType = evidenceType;
     State        = state;
 }
Ejemplo n.º 14
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="ID">
 /// A <see cref="System.Int32"/> to uniquely identify the protein
 /// </param>
 /// <param name="Entry">
 /// A <see cref="System.String"/> with the protein entry name
 /// </param>
 /// <param name="Accession">
 /// A <see cref="System.String"/> with the protein accession number
 /// </param>
 /// <param name="Desc">
 /// A <see cref="System.String"/> with a description of the protein (optional)
 /// </param>
 /// <param name="Seq">
 /// A <see cref="System.String"/> with the protein sequence (optional)
 /// </param>
 public Protein( int ID, string Entry, string Accession, string Desc, string Seq )
 {
     this.ID = ID;
     this.Entry = Entry;
     this.Accession = Accession;
     this.Desc = Desc;
     this.Sequence = Seq;
     Peptides = new List<Peptide>();
     Subset = new List<Protein>();
     Evidence = Protein.EvidenceType.NonConclusive;
 }
Ejemplo n.º 15
0
        public async Task<IHttpActionResult> PostEvidence(string noticeNumber, long districtID, EvidenceType evidenceType, string mimeType)
        {       
            using (Stream stream = await this.Request.Content.ReadAsStreamAsync())
            {
                using (var memoryStream = new MemoryStream())
                {
                    stream.Position = 0;
                    stream.CopyTo(memoryStream);

                    using (var connection = new Oracle.DataAccess.Client.OracleConnection(DataContextConnectionString))
                    {
                        var infringementEvidenceType =
                            new InfringementEvidenceType
                            {
                                REFERENCE_NUMBER = noticeNumber,
                                EVIDENCE_TYPE = (int)evidenceType,
                                MIME_TYPE = mimeType,
                                DISTRICT_ID = districtID
                            };

                        using (var command = new Oracle.DataAccess.Client.OracleCommand())
                        {
                            try
                            {
                                if (connection.State != ConnectionState.Open)
                                {
                                    connection.Open();
                                }

                                command.Parameters.Add(
                                    new Oracle.DataAccess.Client.OracleParameter("P_INFRINGEMENT_EVIDENCE", Oracle.DataAccess.Client.OracleDbType.Object)
                                    {
                                        Value = infringementEvidenceType,
                                        UdtTypeName = "ITS.INFRINGEMENT_EVIDENCE_TYPE"
                                    });
                                command.Parameters.Add("O_RESULT", Oracle.DataAccess.Client.OracleDbType.RefCursor).Direction = ParameterDirection.Output;

                                ExcecuteNonQuery(command, "ITS.OFFENCE_CAPTURE.SUBMIT_INFRINGEMENT_EVIDENCE", connection);

                                if ((command.Parameters["O_RESULT"].Value is DBNull))
                                    throw new Exception("Failed to return valid file paths.");

                                var refCursor = (Oracle.DataAccess.Types.OracleRefCursor)command.Parameters["O_RESULT"].Value;

                                using (var dataReader = refCursor.GetDataReader())
                                {
                                    while (dataReader.Read())
                                    {
                                        if (dataReader["MIME_DATA_PATH"] is DBNull || dataReader["FILENAME"] is DBNull)
                                            continue;

                                        var filePath  = dataReader["MIME_DATA_PATH"] as string;
                                        var fileName = dataReader["FILENAME"] as string;

                                        Directory.CreateDirectory(filePath);
                                        filePath = Path.Combine(filePath, fileName);

                                        if (File.Exists(filePath))
                                            File.Delete(filePath);

                                        File.WriteAllBytes(filePath, memoryStream.ToArray());

                                        break;
                                    }
                                }
                            }
                            catch (Exception ex)
                            {
                                return this.BadRequestEx(Error.PopulateUnexpectedException(ex));
                            }
                            finally
                            {
                                foreach (Oracle.DataAccess.Client.OracleParameter parameter in command.Parameters)
                                {
                                    if (parameter.Value is IDisposable)
                                    {
                                        ((IDisposable)(parameter.Value)).Dispose();
                                    }

                                    parameter.Dispose();
                                }
                            }
                        }

                        return Ok();
                    }
                }
            }           
        }
Ejemplo n.º 16
0
 public async Task UpdateEvidenceAsync(EvidenceType evidenceType, EvidenceState state)
 {
     await EnsureStartedAsync();
     await TrySendAsync(nameof(IGameHub.UpdateEvidenceStateAsync), evidenceType, state);
 }
 protected void ToString(List <string> toStringOutput)
 {
     toStringOutput.Add($"IdempotencyKey = {(IdempotencyKey == null ? "null" : IdempotencyKey == string.Empty ? "" : IdempotencyKey)}");
     toStringOutput.Add($"EvidenceType = {(EvidenceType == null ? "null" : EvidenceType.ToString())}");
     toStringOutput.Add($"ContentType = {(ContentType == null ? "null" : ContentType == string.Empty ? "" : ContentType)}");
 }
Ejemplo n.º 18
0
 private void UpdateEvidence(EvidenceType type, EvidenceState state) =>
 Dispatcher.Dispatch(new UpdateEvidenceAction(type, state));
Ejemplo n.º 19
0
 public EvidencePossibility(EvidenceType type, Possibility possibility, EvidenceState originalState)
 {
     Type          = type;
     Possibility   = possibility;
     OriginalState = originalState;
 }
Ejemplo n.º 20
0
 public Ghost(string name, EvidenceType requiredEvidence)
 {
     Name             = name;
     RequiredEvidence = requiredEvidence;
 }