Exemple #1
0
        public static string Join(string[] input, CaseType type)
        {
            var sb = new StringBuilder();
            var isFirstToken = true;

            foreach (var token in input)
            {
                switch (type)
                {
                    case CaseType.Camel:
                        sb.Append(isFirstToken ? token : ToUpperFirstCh(token));
                        break;
                    case CaseType.Pascal:
                        sb.Append(ToUpperFirstCh(token));
                        break;
                    case CaseType.Snake:
                        sb.Append(token + "_");
                        break;
                    case CaseType.HttpHeader:
                        sb.Append(ToUpperFirstCh(token) + "-");
                        break;
                }

                isFirstToken = false;
            }

            if (type == CaseType.Snake || type == CaseType.HttpHeader)
                sb.Remove(sb.Length - 1, 1);

            return sb.ToString();
        }
Exemple #2
0
        public bool DeleteCaseType(int id)
        {
            bool     flag = false;
            string   ids  = string.Empty;
            CaseType ct   = ctManager.GetCaseTypeByID(id);

            ids = id.ToString();

            if (ct.ModelID == 0)
            {
                IList <CaseType> list = ctManager.GetCaseType(id);
                if (list != null)
                {
                    for (int i = 0; i < list.Count; i++)
                    {
                        if (i < list.Count - 1)
                        {
                            ids += "," + list[i].ID + ",";
                        }
                        else
                        {
                            ids += "," + list[i].ID;
                        }
                    }
                }
            }
            flag = ctManager.DeleteCaseTypeByIDs(ids);
            return(flag);
        }
Exemple #3
0
        public static string TransformTo(this string input, CaseType caseType)
        {
            string outputInCaseType;

            if (string.IsNullOrWhiteSpace(input))
            {
                throw new ArgumentException("Input string is null, empty or white space: ", input);
            }

            switch (caseType)
            {
            case CaseType.SentenceCase:
                outputInCaseType = char.ToUpper(input[0]) + input.Substring(1).ToLower();
                break;

            case CaseType.UpperCase:
                outputInCaseType = input.ToUpper();
                break;

            case CaseType.LowerCase:
                outputInCaseType = input.ToLower();
                break;

            case CaseType.FirstLetterInLower:
                outputInCaseType = char.ToLower(input[0]) + input.Substring(1);
                break;

            default:
                throw new ArgumentOutOfRangeException($"That option is not available for {nameof(caseType)} , {caseType}");
            }
            return(outputInCaseType);
        }
Exemple #4
0
        public async Task <IActionResult> Edit(int id, [Bind("CaseTypeID,CaseTypeTitle,LongDescription,GroupNumber,Hierarchical_Approval")] CaseType caseType)
        {
            if (id != caseType.CaseTypeID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(caseType);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!CaseTypeExists(caseType.CaseTypeID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(caseType));
        }
Exemple #5
0
 public Case(int rot, CaseType type, Point Point)
 {
     this.rot = rot;
     this.type = (int)type;
     this.x = Point.X;
     this.y = Point.Y;
 }
Exemple #6
0
        public static string Convert(CaseType type, string value)
        {
            string aliasStr = string.Empty;
            int    aliasIdx = value.LastIndexOf(".", StringComparison.Ordinal);

            if (aliasIdx >= 0)
            {
                aliasStr = value.Substring(0, aliasIdx + 1);
                value    = value.Substring(aliasIdx + 1);
            }
            switch (type)
            {
            case CaseType.LowerCase:
                return(aliasStr + value.ToLower());

            case CaseType.UpperCase:
                return(aliasStr + value.ToUpper());

            case CaseType.IniCap:
                return(aliasStr + value[0].ToString().ToUpper() + value.Substring(1).ToLower());

            default:
                return(value);
            }
        }
Exemple #7
0
        public async Task Should_succesfully_return_casetyperesponse()
        {
            var hearingTypes = new List <HearingType> {
                new HearingType("NewHearing")
            };
            var caseType = new CaseType(1, "Civil")
            {
                HearingTypes = hearingTypes
            };
            var caseTypes = new List <CaseType>()
            {
                caseType
            };

            QueryHandler.Setup(q => q.Handle <GetAllCaseTypesQuery, List <CaseType> >(It.IsAny <GetAllCaseTypesQuery>())).ReturnsAsync(caseTypes);

            var result = await Controller.GetCaseTypes();

            result.Should().NotBeNull();
            var objectResult = (ObjectResult)result;

            objectResult.StatusCode.Should().Be((int)HttpStatusCode.OK);
            List <CaseTypeResponse> response = ((IEnumerable <CaseTypeResponse>)objectResult.Value).ToList();

            response.Count.Should().Be(1);
            response[0].Name.Should().Be("Civil");
            response[0].HearingTypes[0].Name.Should().Be("NewHearing");
        }
Exemple #8
0
        /// <summary>
        /// Converts a value to PascalCase.
        /// </summary>
        /// <param name="value">Value to convert.</param>
        /// <param name="caseType">Case type of the value.</param>
        /// <returns>Converted value.</returns>
        /// <exception cref="T:System.InvalidOperationException">Case type was unhandled.</exception>
        public static string ToPascalCase(string value, CaseType caseType)
        {
            if (string.IsNullOrEmpty(value))
            {
                return(value);
            }

            if (!value.IsCaseType(caseType))
            {
                throw new ArgumentException($"Value '{value}' is not of case type: '{caseType}'.");
            }

            if (caseType == CaseType.PascalCase)
            {
                return(value);
            }

            if (caseType == CaseType.KebabCase)
            {
                return(KebabCaseConverter.ToPascalCase(value));
            }

            if (caseType == CaseType.SnakeCase || caseType == CaseType.SnakeUpperCase)
            {
                return(SnakeCaseConverter.ToPascalCase(value));
            }

            if (caseType == CaseType.CamelCase)
            {
                return(CamelCaseConverter.ToPascalCase(value));
            }

            throw new InvalidOperationException($"Unhandled case type: {caseType}.");
        }
        public static NewParticipant Map(ParticipantRequest requestParticipant, CaseType caseType)
        {
            var caseRole = caseType.CaseRoles.FirstOrDefault(x => x.Name == requestParticipant.CaseRoleName);
            if (caseRole == null) throw new BadRequestException($"Invalid case role [{requestParticipant.CaseRoleName}]");

            var hearingRole = caseRole.HearingRoles.FirstOrDefault(x => x.Name == requestParticipant.HearingRoleName);
            if (hearingRole == null) throw new BadRequestException($"Invalid hearing role [{requestParticipant.HearingRoleName}]");

            var person = new Person(requestParticipant.Title, requestParticipant.FirstName, requestParticipant.LastName,
                requestParticipant.Username)
            {
                MiddleNames = requestParticipant.MiddleNames,
                ContactEmail = requestParticipant.ContactEmail,
                TelephoneNumber = requestParticipant.TelephoneNumber
            };

            if(!string.IsNullOrEmpty(requestParticipant.OrganisationName))
            {
                person.Organisation = new Organisation(requestParticipant.OrganisationName);
            }

            return new NewParticipant
            {
                Person = person,
                CaseRole = caseRole,
                HearingRole = hearingRole,
                DisplayName = requestParticipant.DisplayName,
                Representee = requestParticipant.Representee
            };
        }
        public void SetCaseType(CaseType caseType = null)
        {
            caseType ??= CaseType.FromString(_c.Test.TestData.HearingDetails.CaseType);

            _c.Test.HearingDetails.CaseType = CaseType.FromString(_c.Test.TestData.HearingDetails.CaseType);
            _commonSharedSteps.WhenTheUserSelectsTheOptionFromTheDropdown(_browsers[_c.CurrentUser].Driver, HearingDetailsPage.CaseTypeDropdown, CaseType.ToString(caseType));
        }
Exemple #11
0
        public async Task Should_succesfully_return_HearingRoleResponses()
        {
            var caseTypeName = "test";
            var caseRoleName = "TestRole";
            var caseRole     = new CaseRole(1, "TestRole")
            {
                HearingRoles = new List <HearingRole> {
                    new HearingRole(1, "HearingRoleTest")
                }
            };
            var caseType = new CaseType(1, "Civil")
            {
                CaseRoles = new List <CaseRole> {
                    caseRole
                }
            };

            QueryHandler.Setup(q => q.Handle <GetCaseTypeQuery, CaseType>(It.IsAny <GetCaseTypeQuery>())).ReturnsAsync(caseType);

            var result = await Controller.GetHearingRolesForCaseRole(caseTypeName, caseRoleName);

            result.Should().NotBeNull();
            var objectResult = (ObjectResult)result;

            objectResult.StatusCode.Should().Be((int)HttpStatusCode.OK);
            var response = (List <HearingRoleResponse>)objectResult.Value;

            response.Count.Should().Be(1);
            response[0].Name.Should().Be("HearingRoleTest");
        }
Exemple #12
0
 public CaseRequestMessageResponse(CaseType ct, Stream f, Dictionary <FileType, String> additionFiles, bool resultEnabled)
 {
     caseType        = ct;
     AdditionalFiles = additionFiles;
     file            = f;
     IsResultEnabled = resultEnabled;
 }
 public static void InitializeContainer(CaseType caseType, IUnityContainer unityContainer)
 {
     RepositoryFactory.InitializeContainer(unityContainer, caseType);
     unityContainer.RegisterType <OverallNumberComponent>();
     unityContainer.RegisterType <DatabaseComponent>();
     unityContainer.RegisterType <AttachmentsComponent>();
     unityContainer.RegisterType <WorkDaysComponent>();
     unityContainer.RegisterType <SearchCaseComponent>();
     unityContainer.RegisterType <TextPredictionsComponent>();
     unityContainer.RegisterType <PoliceStationComponent>();
     unityContainer.RegisterType <LookupComponent>();
     unityContainer.RegisterType <VacationsComponent>();
     unityContainer.RegisterType <CircuitMembersComponent>();
     unityContainer.RegisterType <ProsecuterComponent>();
     unityContainer.RegisterType <RollsComponent>();
     unityContainer.RegisterType <OrderOfAssignmentComponent>();
     unityContainer.RegisterType <SessionsComponent>();
     unityContainer.RegisterType <CircuitsComponent>();
     unityContainer.RegisterType <LoginComponent>();
     unityContainer.RegisterType <PersonComponent>();
     unityContainer.RegisterType <CrimeCaseComponent>();
     unityContainer.RegisterType <MasterCaseComponent>();
     unityContainer.RegisterType <UserComponent>();
     unityContainer.RegisterType <CycleComponent>();
     unityContainer.RegisterType <ProsecutionsComponent>();
     unityContainer.RegisterType <DefendantsComponent>();
     unityContainer.RegisterType <VictimsComponent>();
     unityContainer.RegisterType <VictimsSessionLogComponent>();
     unityContainer.RegisterType <DefendantsSessionLogComponent>();
     unityContainer.RegisterType <PoliceStationCircuitsComponent>();
     unityContainer.RegisterType <WitnessesComponent>();
 }
Exemple #14
0
 public void Setup()
 {
     _caseType = new CaseType(1, "Money claims")
     {
         CaseRoles = new List <CaseRole>
         {
             new CaseRole(0, "Claimant")
             {
                 HearingRoles = new List <HearingRole>
                 {
                     new HearingRole(1, "Claimant LIP"),
                     new HearingRole(2, "Representative")
                     {
                         UserRole = new UserRole(1, "individual")
                     }
                 }
             },
             new CaseRole(0, "Respondent")
             {
                 HearingRoles = new List <HearingRole>
                 {
                     new HearingRole(1, "Respondent LIP"),
                     new HearingRole(2, "Representative")
                     {
                         UserRole = new UserRole(1, "representative")
                     }
                 }
             }
         }
     };
 }
Exemple #15
0
        public void TestInitialize()
        {
            var caseType = new CaseType(1, "Civil")
            {
                CaseRoles    = CaseRoles,
                HearingTypes = new List <HearingType> {
                    new HearingType("Automated Test")
                }
            };

            QueryHandlerMock
            .Setup(x => x.Handle <GetCaseTypeQuery, CaseType>(It.IsAny <GetCaseTypeQuery>()))
            .ReturnsAsync(caseType);

            QueryHandlerMock
            .Setup(x => x.Handle <GetHearingVenuesQuery, List <HearingVenue> >(It.IsAny <GetHearingVenuesQuery>()))
            .ReturnsAsync(new List <HearingVenue> {
                new HearingVenue(1, "Birmingham Civil and Family Justice Centre")
            });

            var hearing = GetHearing("123");

            QueryHandlerMock
            .Setup(x => x.Handle <GetHearingByIdQuery, VideoHearing>(It.IsAny <GetHearingByIdQuery>()))
            .ReturnsAsync(hearing);
        }
Exemple #16
0
        private void WriteFiles(CaseType caseType, DistrictsScenario scenario, IDictionary <string, List <int> > dict)
        {
            List <string> lines = new List <string>();

            foreach (string key in dict.Keys)
            {
                string line = "";
                Console.Write(key + " ");
                line = line + (key + ",");
                foreach (int i in dict[key])
                {
                    Console.Write(i + ",");
                    line = line + (i + ",");
                }
                Console.WriteLine();
                //lines.Add("");
                lines.Add(line);
            }

            using (StreamWriter op = new StreamWriter("districs_data_" + caseType.ToString().ToLower() + "_" + scenario.name + "_" + DateTime.Now.ToString("yyyyMMddHHmmssfff") + ".csv"))
            {
                foreach (string line in lines)
                {
                    op.WriteLine(line);
                }
                op.Flush();
            }
        }
Exemple #17
0
 public VideoHearing(CaseType caseType, HearingType hearingType, DateTime scheduledDateTime, int scheduledDuration,
                     HearingVenue hearingVenue, string hearingRoomName, string otherInformation, string createdBy,
                     bool questionnaireNotRequired, bool audioRecordingRequired, string cancelReason) :
     base(caseType, hearingType, scheduledDateTime, scheduledDuration, hearingVenue, hearingRoomName,
          otherInformation, createdBy, questionnaireNotRequired, audioRecordingRequired, cancelReason)
 {
 }
Exemple #18
0
 public List <Cases> LoadCases(Model.Pagination pagination, CaseType caseType)
 {
     using (var db = Db)
     {
         return(db.PageQuery <Cases>(pagination, typeof(Cases).GetSelectSql("casetype=" + (int)caseType, casesIngnoreFields) + " order by DisplayOrder desc, TimeInMs desc"));
     }
 }
Exemple #19
0
 private void FillCaseTypeHash(string caseType)
 {
     if (!string.IsNullOrEmpty(caseType))
     {
         CaseType.Add(caseType);
     }
 }
Exemple #20
0
        public async Task LogAsync(SocketGuild Guild, IUser User, IUser Mod, CaseType CaseType, string Reason)
        {
            var Server = GuildHandler.GetGuild(Guild.Id);

            Reason = Reason ?? $"*Responsible moderator, please type `{Server.Prefix}Reason {Server.Mod.Cases.Count + 1} <Reason>`*";
            var ModChannel = Guild.GetTextChannel(Server.Mod.TextChannel);

            if (ModChannel == null)
            {
                return;
            }
            var Message = await ModChannel.SendMessageAsync($"**{CaseType}** | Case {Server.Mod.Cases.Count + 1}\n**User:** {User} ({User.Id})\n**Reason:** {Reason}\n" +
                                                            $"**Responsible Moderator:** {Mod}");

            Server.Mod.Cases.Add(new CaseWrapper
            {
                User       = $"{User}",
                UserId     = User.Id,
                ModId      = Mod.Id,
                Reason     = Reason,
                CaseType   = CaseType,
                MessageId  = Message.Id,
                CaseNumber = Server.Mod.Cases.Count + 1
            });
            GuildHandler.Save(Server);
        }
 public FieldAreaListVM(CaseType caseType)
 {
     _caseType    = caseType;
     Cases        = new ObservableCollection <ICase>();
     SelectedCase = default(ICase);
     BuildCases   = new AsyncCommand <string>(BuildCasesAsync, CanBuildCases, new RelayCommandErrorHandler());
 }
Exemple #22
0
 public List<Cases> LoadCases(Model.Pagination pagination, CaseType caseType)
 {
     using (var db = Db)
     {
         return db.PageQuery<Cases>(pagination, typeof(Cases).GetSelectSql("casetype=" + (int)caseType, casesIngnoreFields) + " order by DisplayOrder desc, TimeInMs desc");
     }
 }
Exemple #23
0
 public CaseRequestMessageResponse()
 {
     caseType        = CaseType.LiveCase;
     AdditionalFiles = new Dictionary <FileType, String>();
     file            = null;
     IsResultEnabled = true;
 }
Exemple #24
0
 public CaseRequestMessageResponse(CaseType ct, Stream f)
 {
     caseType        = ct;
     AdditionalFiles = new Dictionary <FileType, String>();
     file            = f;
     IsResultEnabled = true;
 }
Exemple #25
0
        /// <summary>
        /// Indicates if a string value is a particular <see cref="T:ByteDev.Strings.Case.CaseType" />.
        /// </summary>
        /// <param name="source">Value to evaluate.</param>
        /// <param name="caseType">Case type to evaluate.</param>
        /// <returns>True if value is of the case type; otherwise false.</returns>
        public static bool IsCaseType(this string source, CaseType caseType)
        {
            if (caseType == CaseType.CamelCase)
            {
                return(IsCamelCase(source));
            }

            if (caseType == CaseType.KebabCase)
            {
                return(IsKebabCase(source));
            }

            if (caseType == CaseType.PascalCase)
            {
                return(IsPascalCase(source));
            }

            if (caseType == CaseType.SnakeCase)
            {
                return(IsSnakeCase(source));
            }

            if (caseType == CaseType.SnakeUpperCase)
            {
                return(IsSnakeUpperCase(source));
            }

            throw new InvalidOperationException($"Unhandled case type: {caseType}.");
        }
Exemple #26
0
    private float decalage = 0.2f; //le decalage entre les pion

    public Case(int n, CaseType type)
    {
        positionNumerique   = n;
        positionGeometrique = plateau.dictionary[n];
        this.type           = type;
        pions = new GameObject[4];
    }
    public MenuCase(string[] parsedItems)
    {
        accountId    = int.Parse(parsedItems[0]);
        filename     = parsedItems[1].Replace("_", " ");
        authorName   = parsedItems[2];
        patientName  = parsedItems[3];
        recordNumber = parsedItems[4];
        difficulty   = parsedItems[5];
        description  = parsedItems[6];
        summary      = parsedItems[7];
        tags         = parsedItems[8].Split(new string[] { ", " }, StringSplitOptions.None);
        dateModified = long.Parse(parsedItems[9]);
        audience     = parsedItems[10];
        version      = parsedItems[11];
        int.TryParse(parsedItems[12], out rating);
        caseType = (CaseType)int.Parse(parsedItems[13]);

        if (parsedItems.Length > 14 && !parsedItems[14].TrimEnd(new char[] { '\n', '\r' }).Equals(""))
        {
            Texture2D temp = new Texture2D(2, 2);
            try {
                temp.LoadImage(Convert.FromBase64String(parsedItems[14]));
            } catch (FormatException error) {
                Debug.Log(error.Message);
                image = null;
                return;
            }
            image = Sprite.Create(temp, new Rect(0, 0, 100, 100), new Vector2(0, 0), 1);
        }
        else
        {
            image = null;
        }
    }
Exemple #28
0
 private void AssertCaseRolesAndHearingRolesAreSortedAscendingByName(CaseType caseType)
 {
     caseType.CaseRoles.Should().BeInAscendingOrder();
     foreach (var caseRole in caseType.CaseRoles)
     {
         caseRole.HearingRoles.Should().BeInAscendingOrder();
     }
 }
Exemple #29
0
 public Propriété(int p, CaseType type, typeProprieté t, long v, PionScript j, long pr, long h) : base(p, type)
 {
     typeP            = t;
     valeur           = v;
     propriétaire     = j;
     prixLoyer        = pr;
     valeurHypothéque = h;
 }
Exemple #30
0
 public CaseParser(string assignmentField, bool mutable, bool assignment, string fieldName, bool top, CaseType caseType)
 {
     this.assignmentField = assignmentField;
     this.mutable         = mutable;
     this.assignment      = assignment;
     this.fieldName       = fieldName;
     this.top             = top;
     this.caseType        = caseType;
 }
Exemple #31
0
        public Case Post(CreateCaseDTO value)
        {
            if (!CaseType.isValidType(value.Type))
            {
                throw new ArgumentException("Invalid Case type");
            }

            return(caseService.createAndPersistAsync(value));
        }
Exemple #32
0
 public CaseTerrain(int positionCarte, CaseType type, string nom, typeProprieté t, long prixProprieté, PionScript j, long prixLoyer, couleur cl, long hypothéque, long prixMaison, long prixHotel) : base(positionCarte, type, t, prixProprieté, j, prixLoyer, hypothéque)
 {
     nombreMaisons   = 0;
     couleur         = cl;
     this.prixMaison = prixMaison;
     this.prixHotel  = prixHotel;
     this.casPos     = positionCarte;
     this.nom        = nom;
 }
Exemple #33
0
 public Boolean Add(CaseType record)
 {
     if (record == null)
     {
         return(false);
     }
     CaseTypes.Add(record);
     return(SaveChanges() == 1);
 }
        public Skin(string name, string weapon, CaseType collection, SkinGrade grade)
        {
            Name = name;
            BaseWeapon = weapon;
            Collection = collection;
            Grade = grade;

            string weaponDesc = weapon.ToLower().Replace(" ", "");

            UnlocalizedName = collection.GetPrefixString() + "_" + weaponDesc + "_" +
                Name.ToLower().RemoveChars(' ', ',', '-', '\'');
        }
Exemple #35
0
 public List<Cases> LoadCases(Pagination pagination, CaseType caseType)
 {
     var cases = CasesData.LoadCases(pagination, caseType);
     LoadCaseItems(cases);
     if (cases != null && cases.Count > 0)
     {
         var items = new List<CaseItem>();
         cases.ForEach(c => { if (c.CaseItems != null)items.AddRange(c.CaseItems); });
         LoadCaseItemAttachment(items);
     }
     return cases ?? new List<Cases>(0);
 }
 public static string Convert(CaseType type, string value)
 {
     string aliasStr = string.Empty;
     int aliasIdx = value.LastIndexOf(".", StringComparison.Ordinal);
     if (aliasIdx >= 0)
     {
         aliasStr = value.Substring(0, aliasIdx + 1);
         value = value.Substring(aliasIdx + 1);
     }
     switch (type)
     {
         case CaseType.LowerCase:
             return aliasStr + value.ToLower();
         case CaseType.UpperCase:
             return aliasStr + value.ToUpper();
         case CaseType.IniCap:
             return aliasStr + value[0].ToString().ToUpper() + value.Substring(1).ToLower();
         default:
             return value;
     }
 }
Exemple #37
0
 public List<Cases> LoadSimpleCases(Pagination pagination, CaseType caseType)
 {
     return CasesManager.LoadSimpleCases(pagination, caseType);
 }
Exemple #38
0
 public WorkstationResult (L3.Cargo.Common.result result)
 {
     m_AnalysisTime = Convert.ToUInt32(result.AnalysisTime);
     m_Comment = result.Comment;
     m_CreateTime = result.CreateTime;
     m_Decision = (WorkstationDecision) Enum.Parse(typeof(WorkstationDecision), result.Decision, true);
     m_Reason = (WorkstationReason) Enum.Parse(typeof(WorkstationReason), result.Reason, true);
     m_UserName = result.User;
     m_WorkstationType = result.StationType;
     m_CaseId = result.CaseId;
     m_CaseType = (CaseType)Enum.Parse(typeof(CaseType), result.CaseType.ToString(), true);
     m_WorkstationId = result.WorkstationId;
 }
Exemple #39
0
 public UpdateCaseMessage(String caseId, CaseUpdateEnum type, CaseType caseType)
 {
     m_CaseId = caseId;
     m_Type = type;
     m_CaseType = caseType;
     m_Filename = String.Empty;
     m_File = new MemoryStream();
     m_AttachFileType = AttachFileTypeEnum.Unknown;
     m_ObjectId = String.Empty;
     m_WorkstationResult = null;
     m_UserName = String.Empty;           
     m_CreateTime = CreateTime;
 }
Exemple #40
0
 public List<Cases> LoadSimpleCases(Pagination pagination, CaseType caseType)
 {
     var cases = CasesData.LoadCases(pagination, caseType);
     return cases ?? new List<Cases>(0);
 }
Exemple #41
0
 public CaseRequestMessageResponse()
 {
     caseType = CaseType.LiveCase;
     AdditionalFiles = new Dictionary<FileType, String>();
     file = null;
     IsResultEnabled = true;
 }
Exemple #42
0
        /*! \brief Convert the caseness of a string into the specified type.
         *  \param s The string to convert.
         *  \param trans The transformation to perform.
         *  \return The transformed string.
         *
         *  Symbols (whitespace, non-letters) are unmodified. Letter characters are modified as dictated by the CaseType: \n
         *  Caps:   Every letter in the string is converted to a capital letter.\n
         *  Proper: The first letter of the word is made capital; the rest are made lowercase.\n
         *  Lower:  Every letter in the string is converted to a lowercase letter.\n
         *  Mixed:  The string is returned unmodified, since there are many ways to create a mixed case string, and we don't want to choose one arbitrarily.\n
         *  Null:   A null reference is returned.
         * */
        public static string transformCase(string s, CaseType trans)
        {
            if(s == null)
                return null;

            switch(trans)
            {
            case CaseType.Null:
                    return null;
            case CaseType.Caps:
                return s.ToUpper();
            case CaseType.Lower:
                return s.ToLower();
            case CaseType.Mixed:
                return s;
            case CaseType.Proper:
                string retval = s;
                int start = 0;
                while(start < retval.Length && !Char.IsLetter(retval[start]))
                {
                    start++;
                }

                if(start >= retval.Length)
                {
                    return retval;
                }

                char[] array = retval.ToCharArray();
                array[start] = Char.ToUpper(retval[start]);
                for(int i = start+1; i < retval.Length; i++)
                {
                    array[i] = Char.ToLower(retval[i]);
                }
                return new string(array);
            default:
                return null;
            }
        }
Exemple #43
0
 public CaseRequestMessageResponse(CaseType ct, Stream f)
 {
     caseType = ct;
     AdditionalFiles = new Dictionary<FileType, String>();
     file = f;
     IsResultEnabled = true;
 }
Exemple #44
0
 public CaseRequestMessageResponse(CaseType ct, Stream f, Dictionary<FileType, String> additionFiles, bool resultEnabled)
 {
     caseType = ct;
     AdditionalFiles = additionFiles;
     file = f;
     IsResultEnabled = resultEnabled;
 }
 public static void AddSkins(List<Skin> skins, string name, CaseType _case, SkinGrade grade, params string[] weapons)
 {
     skins.AddRange(weapons.Select(w => new Skin(name, w, _case, grade)));
 }
 public ConfigEntity()
 {
     IsDeleteCommentBeforeWhiteSpace = false;
     IsDeleteCommentAfterWhiteSpace = true;
     IsReservedWordAsComplement = true;
     LineSeparator = "\r\n";
     MaxIndenSize = 1000;
     IsDeleteOneLineComment = IsDeleteComment;
     IsDeleteMultiLineComment = IsDeleteComment;
     BeforeAliasDefineWhiteSpace = " ";
     StatementSeparatorCase = CaseType.UpperCase;
 }
Exemple #47
0
        private void caseObj_DisplayTIPEvent (CaseType caseType, bool isCorrect)
        {
            TIPPopUp tipPopUp = new TIPPopUp();
            string message = string.Empty;

            if (caseType == CaseType.CTICase)
            {
                message += "The x-ray image was a Combined Threat Image (CTI).\n\n";

                if (isCorrect)
                {
                    message += "You have correctly identified the CTI.";
                }
                else
                {
                    message += "You have missed identifying the CTI.";
                }
            }
            else if (caseType == CaseType.FTICase)
            {
                message += "The x-ray image includes a Fictional Threat Image (FTI).\n\n";

                if (isCorrect)
                {
                    message += "You have correctly identified the FTI.";
                }
                else
                {
                    message += "You have missed identifying the FTI.";
                }

                if (m_XrayImage.Count > 0)
                {
                    foreach (XRayImage xrayImage in m_XrayImage)
                    {
                        xrayImage.ShowFTILocations();
                    }
                }
            }

            if (m_XrayImage.Count > 0)
            {
                tipPopUp.PlacementTarget = m_XrayImage[0];
                tipPopUp.SetMessage(message);
                tipPopUp.SetIcon(isCorrect);
                tipPopUp.IsOpen = true;
            }
        }
 /// <summary>
 /// Determine si la case possède le type donné
 /// </summary>
 /// <param name="typeRef">Le type à comparer</param>
 /// <returns>True si le type à comparer correspond à l'un des types de la case, False dans le cas contraire</returns>
 public bool IsType(CaseType typeRef)
 {
     return Convert.ToBoolean(((int)this.Type >> (int)Math.Log((int)typeRef, 2)) & 1);
 }