Exemple #1
0
        public override string ToString()
        {
            var sb = new StringBuilder(); //stringbuilder for performance

            sb.Append(base.ToString());
            sb.Append(",");
            sb.Append(SliderType.ToString().Substring(0, 1));
            sb.Append("|");
            sb.Append(ControlPoints.Skip(1).Select(c => $"{c.XForHitobject}:{c.YForHitobject}").ToString("|"));
            sb.Append(",");
            sb.Append(SegmentCount);
            sb.Append(",");
            sb.Append(Length);

            //TODO check if additions should be added
            if (PointHitsounds.All(p => p.IsDefault()))
            {
                return(sb.ToString());
            }
            sb.Append(",");
            sb.Append(PointHitsounds.Select(p => (int)p.SoundType).ToString("|"));
            sb.Append(",");
            sb.Append(PointHitsounds.Select(p => "" + (int)p.SampleSet + ":" + (int)p.AdditionSampleSet).ToString("|"));
            sb.Append(",");
            sb.Append(AdditionsForString);
            return(sb.ToString());
        }
Exemple #2
0
        public override void ConfigureController(Microsoft.DirectX.DirectInput.Device device)
        {
            base.ConfigureController(device);

            Guid axis    = AxisTypeGuid;
            bool slider  = SliderType == AxisType.EXT1 || SliderType == AxisType.EXT2;
            bool hasAxis = false;

            Microsoft.DirectX.DirectInput.DeviceObjectList list = device.GetObjects(Microsoft.DirectX.DirectInput.DeviceObjectTypeFlags.Axis);
            foreach (Microsoft.DirectX.DirectInput.DeviceObjectInstance o in list)
            {
                if (o.ObjectType == axis)
                {
                    if (slider && o.Name != AxisName)
                    {
                        continue;
                    }
                    Debug.WriteLine("Ustawienie parametrów osi: " + SliderType.ToString() + " kontrolera '" + device.DeviceInformation.InstanceName + "." + device.DeviceInformation.InstanceGuid.ToString() + "'.");
                    device.Properties.SetRange(Microsoft.DirectX.DirectInput.ParameterHow.ById, o.ObjectId, new Microsoft.DirectX.DirectInput.InputRange(Min, Max));
                    hasAxis = true;
                    break;
                }
            }
            if (!hasAxis)
            {
                throw new ApplicationException("Kontroler '" + device.DeviceInformation.InstanceName + "' o identyfikatorze '" + Controller.Alias + "' nie posiada osi '" + SliderType.ToString() + "'.");
            }
        }
Exemple #3
0
 public override void WriteToXml(XmlTextWriter xml)
 {
     xml.WriteStartElement("axis");
     xml.WriteAttributeString("type", SliderType.ToString());
     xml.WriteAttributeString("alias", InternalID);
     xml.WriteAttributeString("description", Description);
     xml.WriteAttributeString("min", Min.ToString());
     xml.WriteAttributeString("max", Max.ToString());
     xml.WriteAttributeString("axisName", AxisName);
     xml.WriteAttributeString("reverse", Reverse.ToString());
     xml.WriteEndElement();
 }
Exemple #4
0
        /// <summary>
        /// Gets by type
        /// </summary>
        /// <returns>Picture Sliders</returns>
        public virtual async Task <IList <PictureSlider> > GetPictureSliders(SliderType sliderType, string objectEntry = "")
        {
            string cacheKey = string.Format(SLIDERS_MODEL_KEY, _storeContext.CurrentStore.Id, sliderType.ToString(), objectEntry);

            return(await _cacheManager.GetAsync(cacheKey, async() =>
            {
                var query = from s in _reporistoryPictureSlider.Table
                            where s.SliderTypeId == (int)sliderType && s.Published
                            select s;

                if (!string.IsNullOrEmpty(objectEntry))
                {
                    query = query.Where(x => x.ObjectEntry == objectEntry);
                }

                var items = await query.ToListAsync();
                return items.Where(c => _storeMappingService.Authorize(c)).ToList();
            }));
        }