Exemplo n.º 1
0
 public FieldFacet(string fieldName, string fieldLabel, RefinementType refinementOption)
 {
     FieldName        = fieldName;
     FieldLabel       = fieldLabel;
     Sort             = FacetSortOption.Count;
     RefinementOption = refinementOption;
 }
Exemplo n.º 2
0
 public FieldFacet(string fieldName)
 {
     FieldName        = fieldName;
     FieldLabel       = fieldName;
     Sort             = FacetSortOption.Count;
     RefinementOption = RefinementType.Refinement;
 }
Exemplo n.º 3
0
 public CategoryFacet(string fieldName, string categoryName, string fieldLabel, RefinementType refinementOption)
 {
     FieldName        = fieldName;
     FieldLabel       = fieldLabel;
     CategoryName     = categoryName;
     Sort             = FacetSortOption.Count;
     RefinementOption = refinementOption;
 }
Exemplo n.º 4
0
 public NumRangeFacet(string fieldName, string fieldLabel, RefinementType refinementOption)
 {
     FieldName        = fieldName;
     FieldLabel       = fieldLabel;
     RefinementOption = refinementOption;
     Range            = new List <NumRange>();
     NumericFormat    = FormatType.Numeric;
 }
Exemplo n.º 5
0
 public DateRangeFacet(string fieldName, string fieldLabel, RefinementType refinementOption)
 {
     FieldName        = fieldName;
     FieldLabel       = fieldLabel;
     RefinementOption = refinementOption;
     Ranges           = new List <DateRange>();
     Sort             = FacetSortOption.None;
 }
Exemplo n.º 6
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);
            int v = reader.ReadInt();

            m_RefinementType = (RefinementType)reader.ReadInt();
            m_CraftType      = (RefinementCraftType)reader.ReadInt();
            m_SubCraftType   = (RefinementSubCraftType)reader.ReadInt();
            m_ModType        = (ModType)reader.ReadInt();
        }
Exemplo n.º 7
0
 public RefinementComponent(RefinementType type, RefinementCraftType craftType, ModType modType)
     : base(0)
 {
     m_RefinementType = type;
     m_CraftType      = craftType;
     GetSubCraftType();
     m_ModType = modType;
     GetItemID();
     GetHue();
 }
Exemplo n.º 8
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);
            int v = reader.ReadInt();

            m_RefinementType = (RefinementType)reader.ReadInt();
            m_CraftType      = (RefinementCraftType)reader.ReadInt();
            m_SubCraftType   = (RefinementSubCraftType)reader.ReadInt();
            m_ModType        = (ModType)reader.ReadInt();
            m_ModAmount      = reader.ReadInt();
            m_CheckBonus     = reader.ReadBool();

            m_Entry = new ModEntry(reader);
        }
Exemplo n.º 9
0
        public RefinementItem(RefinementType type, RefinementCraftType craftType, RefinementSubCraftType srtype, ModType modType)
            : base(0)
        {
            m_RefinementType = type;
            m_CraftType      = craftType;
            m_SubCraftType   = srtype;
            ModType          = modType;
            GetItemID();
            GetHue();
            ApplyModAmount();

            m_Entry = new ModEntry(m_ModAmount);

            m_CheckBonus = false;
        }
Exemplo n.º 10
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="currentRefinementsStr"></param>
        /// <param name="refinement"></param>
        /// <param name="refinementType"></param>
        /// <returns></returns>
        public static string AddRemoveRefinement(RefinementItem refinement, string currentRefinementsStr, RefinementType refinementType)
        {
            var refinementStr = string.Format("{0};{1};{2}", refinement.Name, refinement.Value, refinement.GroupLabel);

            if (string.IsNullOrEmpty(currentRefinementsStr))
            {
                return(StringEncoder.EncodeString(refinementStr));
            }

            var decodedCurrentRefinements = StringEncoder.DecodeString(currentRefinementsStr) ?? "";

            var currentRefinements = decodedCurrentRefinements.Split(',').ToList();

            var currentRefinementItems = currentRefinements.Select(r => new RefinementItem(r)).ToList();

            switch (refinementType)
            {
            case RefinementType.Single_Select:

                if (decodedCurrentRefinements.Contains(refinementStr))
                {
                    return(StringEncoder.EncodeString(string.Join(",", currentRefinements.Where(p => p != refinementStr))));
                }
                else if (decodedCurrentRefinements.Contains(refinement.GroupLabel))
                {
                    decodedCurrentRefinements = string.Join(",", currentRefinements.Where(p => !p.Contains(refinement.GroupLabel)));

                    return(StringEncoder.EncodeString(string.Format("{0},{1}", decodedCurrentRefinements, refinementStr)));
                }

                break;

            case RefinementType.Multi_Select:

                var likeRefinement = currentRefinementItems.FirstOrDefault(p => p.GroupLabel == refinement.GroupLabel);

                if (likeRefinement != null)
                {
                    //var rawValues = likeRefinement.Value.Replace("(", "").Replace(")", "");
                    var rawValues = likeRefinement.Value.StartsWith("(") ? likeRefinement.Value.Substring(1, likeRefinement.Value.Length - 2) : likeRefinement.Value;

                    var values = Regex.Split(rawValues, " OR ");

                    var valueStr = string.Join(" OR ", values.Where(v => v != refinement.Value));

                    if (values.Any(v => v == refinement.Value))
                    {
                        refinementStr = (string.IsNullOrEmpty(valueStr)) ? "" : string.Format("{0};({1});{2}", refinement.Name, valueStr, refinement.GroupLabel);
                    }
                    else
                    {
                        refinementStr = string.Format("{0};({1} OR {2});{3}", refinement.Name, valueStr, refinement.Value, refinement.GroupLabel);
                    }

                    decodedCurrentRefinements = string.Join(",", currentRefinements.Where(p => !p.Contains(refinement.GroupLabel)));

                    //return StringEncoder.EncodeString(string.Format("{0},{1}", decodedCurrentRefinements, refinementStr));
                }

                //return (string.IsNullOrEmpty(decodedCurrentRefinements)) ? refinementStr : StringEncoder.EncodeString(string.Format("{0},{1}", decodedCurrentRefinements, refinementStr));
                break;

            default:

                if (decodedCurrentRefinements.Contains(refinementStr))
                {
                    return(StringEncoder.EncodeString(string.Join(",", currentRefinements.Where(p => p != refinementStr))));
                }

                break;
            }

            //return StringEncoder.EncodeString(string.Format("{0},{1}", decodedCurrentRefinements, refinementStr));
            return(StringEncoder.EncodeString(string.IsNullOrEmpty(decodedCurrentRefinements) ? refinementStr : string.Format("{0},{1}", decodedCurrentRefinements, refinementStr)));
        }
Exemplo n.º 11
0
 public RefinementComponent(RefinementType type, RefinementCraftType craftType, ModType modType)
     : base(0)
 {
     m_RefinementType = type;
     m_CraftType = craftType;
     GetSubCraftType();
     m_ModType = modType;
     GetItemID();
     GetHue();
 }
Exemplo n.º 12
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);
            int v = reader.ReadInt();

            m_RefinementType = (RefinementType)reader.ReadInt();
            m_CraftType = (RefinementCraftType)reader.ReadInt();
            m_SubCraftType = (RefinementSubCraftType)reader.ReadInt();
            m_ModType = (ModType)reader.ReadInt();
            m_ModAmount = reader.ReadInt();
            m_CheckBonus = reader.ReadBool();

            m_Entry = new ModEntry(reader);
        }
Exemplo n.º 13
0
        public RefinementItem(RefinementType type, RefinementCraftType craftType, RefinementSubCraftType srtype, ModType modType)
            : base(0)
        {
            m_RefinementType = type;
            m_CraftType = craftType;
            m_SubCraftType = srtype;
            ModType = modType;
            GetItemID();
            GetHue();
            ApplyModAmount();

            m_Entry = new ModEntry(m_ModAmount);

            m_CheckBonus = false;
        }
Exemplo n.º 14
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);
            int v = reader.ReadInt();

            m_RefinementType = (RefinementType)reader.ReadInt();
            m_CraftType = (RefinementCraftType)reader.ReadInt();
            m_SubCraftType = (RefinementSubCraftType)reader.ReadInt();
            m_ModType = (ModType)reader.ReadInt();
        }