public void changeSettings(bool autoDJ, bool equaliser, bool shuffle, RepeatMode repeat) { bool autoDJMusicbee = mbApiInterface_.Player_GetAutoDjEnabled(); bool equaliserMusicbee = mbApiInterface_.Player_GetEqualiserEnabled(); RepeatMode repeatMusicbee = mbApiInterface_.Player_GetRepeat(); bool shuffleMusicbee = mbApiInterface_.Player_GetShuffle(); if (autoDJ && autoDJMusicbee != autoDJ) { mbApiInterface_.Player_StartAutoDj(); } else if (autoDJMusicbee != autoDJ) { mbApiInterface_.Player_SetShuffle(true); mbApiInterface_.Player_SetShuffle(false); } if (equaliserMusicbee != equaliser) { mbApiInterface_.Player_SetEqualiserEnabled(equaliser); } if (repeat != repeatMusicbee) { mbApiInterface_.Player_SetRepeat(repeat); } if (shuffle != shuffleMusicbee) { mbApiInterface_.Player_SetShuffle(shuffle); } }
public void SetPlayerRepeatMode(string playerId, RepeatMode repeatMode) { var value = JsonConvert.SerializeObject(repeatMode, new Converters.RepeatModeConverter()); var request = new SlimJsonRpcRequest(playerId, new object[] { "playlist", "repeat", value }); PostJsonRpcRequest(request); }
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { if (value != null) { RepeatMode mode = (RepeatMode)value; if (mode == RepeatMode.DoNotRepeat) { return("Не повторять"); } else if (mode == RepeatMode.RepeatDaily) { return("Ежедневно"); } else if (mode == RepeatMode.RepeatMonthly) { return("Ежемесячно"); } else if (mode == RepeatMode.RepeatTwiceAWeek) { return("Раз в две недели"); } else if (mode == RepeatMode.RepeatWeekly) { return("Еженедельно"); } else { return(null); } } else { return(null); } }
private void ChangeRepeatMode(object sender, MouseButtonEventArgs e) { switch ((string)((Label)sender).Tag) { case "N": // NoRepeat NoRepeat.Foreground = Brushes.White; RepeatSong.Foreground = _brush; RepeatAll.Foreground = _brush; _repeat = RepeatMode.NoRepeat; break; case "S": // Song NoRepeat.Foreground = _brush; RepeatSong.Foreground = Brushes.White; RepeatAll.Foreground = _brush; _repeat = RepeatMode.RepeatSong; break; case "A": // All NoRepeat.Foreground = _brush; RepeatSong.Foreground = _brush; RepeatAll.Foreground = Brushes.White; _repeat = RepeatMode.RepeatAll; break; default: throw new ArgumentOutOfRangeException(); } }
/// <summary> /// Loads a queue items /// </summary> /// <param name="repeatMode">queue repeat mode</param> /// <param name="medias">media items</param> /// <returns>media status</returns> public Task <MediaStatus> QueueLoadAsync(RepeatMode repeatMode, params MediaInformation[] medias) { return(QueueLoadAsync(repeatMode, medias.Select(mi => new QueueItem() { Media = mi }))); }
public Playlist(ViewModelServiceContainer container, IValidator <Playlist> validator, DialogViewModel dialogViewModel, Data.Playlist model) : base(model, validator, container.Messenger) { using (BusyStack.GetToken()) { _itemsLock = new object(); _dialogViewModel = dialogViewModel ?? throw new ArgumentNullException(nameof(dialogViewModel), $"{nameof(dialogViewModel)} {Resources.IsRequired}"); _sequenceProvider = container.SequenceService; _translator = container.LocalizationService; _title = model.Title; _description = model.Description; _repeatMode = (RepeatMode)model.RepeatMode; _isShuffeling = model.IsShuffeling; _sequence = model.Sequence; RepeatModes = new RangeObservableCollection <RepeatMode>(Enum.GetValues(typeof(RepeatMode)).Cast <RepeatMode>().ToList()); History = new Stack <int>(); Items = new RangeObservableCollection <MediaItem>(); Items.CollectionChanged += (o, e) => OnPropertyChanged(nameof(Count)); BindingOperations.EnableCollectionSynchronization(Items, _itemsLock); View = CollectionViewSource.GetDefaultView(Items); OnPropertyChanged(nameof(Count)); InitializeCommands(); Validate(); } }
public bool Previous() { if (RepeatMode.Equals(GroupRepeatMode.RepeatOne)) { LastChange = DateTime.UtcNow; return(true); } PlayingItemIndex--; if (PlayingItemIndex < 0) { if (RepeatMode.Equals(GroupRepeatMode.RepeatAll)) { PlayingItemIndex = SortedPlaylist.Count - 1; } else { PlayingItemIndex = 0; return(false); } } LastChange = DateTime.UtcNow; return(true); }
public void SetRepeatState(RepeatMode data) { repeatButton.StyleActivatedButton(data != RepeatMode.NoRepeat); repeatButton.Image = data == RepeatMode.RepeatOne ? Images.GetRepeatOneImage(15).ImageWithRenderingMode(UIImageRenderingMode.AlwaysTemplate) : Images.GetRepeatImage(15).ImageWithRenderingMode(UIImageRenderingMode.AlwaysTemplate); }
public void AddNote(string text, DateTime date, RepeatMode repeatMode) { Add(new Note() { Text = text, Date = date, RepeatMode = repeatMode }); }
public Task <MediaStatus> QueueLoadAsync(ISender sender, RepeatMode repeatMode, params MediaInformation[] medias) { return(QueueLoadAsync(sender, repeatMode, medias.Select(mi => new QueueItem() { Media = mi }).ToList())); }
public void SetRepeatMode(RepeatMode mode) { RepeatMode rmode = this.RepeatMode; this.RepeatMode = mode; if (this.NowPlaying.Track.TrackString is { })
internal CSSBorderImageRepeatProperty() : base(PropertyNames.BorderImageRepeat) { _inherited = false; _horizontal = RepeatMode.Stretch; _vertical = RepeatMode.Stretch; }
private RepeatMode GetVertRepeatMode(string cellText) { string fullCellText = cellText; string originalText = cellText; string repMode = "insert"; if (HasVertRepeaterDefined(cellText)) { int vertRepeatDefStart = cellText.ToLower().IndexOf("<vertrepeat"); int vertRepeatDefEnds = cellText.ToLower().IndexOf("/>", vertRepeatDefStart) + 2; string inSideText = cellText.Substring(vertRepeatDefStart, vertRepeatDefEnds - vertRepeatDefStart).Replace( "<vertrepeat", "").Replace("/>", ""); string[] valuePairs = inSideText.Replace(" ", "").Split(new char[] { ',' }, inSideText.Length); foreach (string valuePair in valuePairs) { if (valuePair.StartsWith("mode=")) { repMode = valuePair.Replace("mode=", "").Trim().ToLower(); } } } RepeatMode repeatMode = (RepeatMode)Enum.Parse(typeof(RepeatMode), repMode); return(repeatMode); }
public Event(int id, string name, DateTime?startTime, DateTime?endTime, string notes, Status status, User user, Contact contact, RepeatMode repeatMode, NotificationMode notificationMode) : base(id, name, endTime, notes, status, user) { StartTime = startTime; Contact = contact; RepeatMode = repeatMode; NotificationMode = notificationMode; }
protected void LoadPlayRepeatMode() { ISettingsManager settingsManager = ServiceRegistration.Get <ISettingsManager>(); PartyMusicPlayerSettings settings = settingsManager.Load <PartyMusicPlayerSettings>(); PlayMode = settings.PlayMode; RepeatMode = settings.RepeatMode; }
private Task <MediaStatus> QueueLoadAsync(ISender sender, RepeatMode repeatMode, List <QueueItem> queueItems) { return(SendAsync(sender, new QueueLoadMessage { RepeatMode = repeatMode, Items = queueItems })); }
public Task SetRepeatModeAsync(RepeatMode repeatMode, CancellationToken cancellationToken) { return(this.SendAsync( HttpMethod.Put, cancellationToken, additionalRouteValues: new[] { "repeat" }, queryParams: new { device_id = this.deviceId, state = repeatMode.GetEnumMemberValue() })); }
/// <summary> /// Loads a queue items /// </summary> /// <param name="repeatMode">queue repeat mode</param> /// <param name="queueItems">items to load</param> /// <returns>media status</returns> private async Task <MediaStatus> QueueLoadAsync(RepeatMode repeatMode, IEnumerable <QueueItem> queueItems) { return(await SendAsync(new QueueLoadMessage() { RepeatMode = repeatMode, Items = queueItems })); }
public Task SetRepeatModeAsync(RepeatMode repeatMode, CancellationToken cancellationToken) { return(this.SendAsync <PlayerBase>( HttpMethod.Put, cancellationToken, queryStringParameters: new { state = repeatMode.GetDescription() }, optionalQueryStringParameters: this.GetOptionalQueryStringParameters(), additionalRouteValues: new[] { "repeat" })); }
internal void SetRepeatMode(RepeatMode mode) { int ret = Interop.Bluetooth.SetRepeatMode(mode); if (ret != (int)BluetoothError.None) { Log.Error(Globals.LogTag, "Failed to set repeat mode to " + mode + " - " + (BluetoothError)ret); BluetoothErrorFactory.ThrowBluetoothException(ret); } }
internal void NotifyRepeatMode(RepeatMode repeat) { int ret = Interop.Bluetooth.NotifyRepeatMode((int)repeat); if (ret != (int)BluetoothError.None) { Log.Error(Globals.LogTag, "Failed to notify repeat mode to remote device, Error - " + (BluetoothError)ret); BluetoothErrorFactory.ThrowBluetoothException(ret); } }
/// <summary> /// Notifies the repeat mode to the remote device. /// </summary> /// <remarks> /// The remote device must be connected. /// </remarks> /// <param name="mode">The repeat mode.</param> /// <exception cref="NotSupportedException">Thrown when the Bluetooth is not supported.</exception> /// <exception cref="InvalidOperationException">Thrown when the Bluetooth is not enabled /// or when notifying the repeat mode state to the remote device fails. /// </exception> /// <since_tizen> 3 </since_tizen> public void NotifyRepeatMode(RepeatMode mode) { if (BluetoothAdapter.IsBluetoothEnabled && Globals.IsInitialize) { BluetoothAvrcpImpl.Instance.NotifyRepeatMode(mode); } else { BluetoothErrorFactory.ThrowBluetoothException((int)BluetoothError.NotEnabled); } }
public MainWindow() { InitializeComponent(); _player = Player.Instance; _player.ChangeDevice(); //init _tray = new TrayIcon(); _prevvol = 1.0f; _chapterprovider = new ChapterProvider(ChapterMenu); _chapterprovider.ChapterClicked += _chapterprovider_ChapterClicked; _timer = new DispatcherTimer(); _timer.Interval = TimeSpan.FromMilliseconds(40); _timer.IsEnabled = false; _timer.Tick += _timer_Tick; SongDat.NetworkMenu = NetMenu; _loaded = true; _equalizer = new Equalizer(); _equalizer.EqSliderChange += _equalizer_EqSliderChange; _equalizer.LoadSettings(); BtnChapters.IsEnabled = _chapterprovider.ChaptersEnabled; if (_player.Is64Bit) { Title += " (x64)"; } else { Title += " (x86)"; } _repeatMode = RepeatMode.None; Dispatcher.Invoke(() => { var src = Environment.GetCommandLineArgs(); string[] pars = new string[src.Length - 1]; Array.Copy(src, 1, pars, 0, src.Length - 1); DoLoadAndPlay(pars); }); if (Properties.Settings.Default.SaveVolume) { var vol = Properties.Settings.Default.LastVolume; if (vol > -1) { VolSlider.Value = vol; VolSlider_ValueChanged(this, null); } } if (Properties.Settings.Default.RegisterMultimediaKeys) { RegisterMultimedaKeys(); } }
protected void SetRepeatMode(RepeatMode mode) { IPlaylist playlist = _playlist; if (playlist == null) { return; } playlist.RepeatMode = mode; UpdateProperties(); }
private void getSettings() { bool autoDJMusicbee = mbApiInterface_.Player_GetAutoDjEnabled(); bool equaliserMusicbee = mbApiInterface_.Player_GetEqualiserEnabled(); RepeatMode repeatMusicbee = mbApiInterface_.Player_GetRepeat(); bool shuffleMusicbee = mbApiInterface_.Player_GetShuffle(); foreach (Screen screen in lcdScreenList_) { screen.playerSettingsChanged(autoDJMusicbee, equaliserMusicbee, shuffleMusicbee, repeatMusicbee); } }
public DiscordEvent(string name, RepeatMode repeatMode, DateTime time, Action <List <ulong> > eventContent, ulong channelID, int repeatRate = 1) { this.name = name; this.repeatMode = repeatMode; this.time = time; this.repeatRate = repeatRate; channels = new List <ulong>(); channels.Add(channelID); _event = eventContent; _nextOccurance = DateTime.Now; CalculateNextOccurance(); }
public DiscordEvent(string name, RepeatMode repeatMode, DateTime time, Action<List<ulong>> eventContent, ulong channelID, int repeatRate = 1) { this.name = name; this.repeatMode = repeatMode; this.time = time; this.repeatRate = repeatRate; channels = new List<ulong>(); channels.Add(channelID); _event = eventContent; _nextOccurance = DateTime.Now; CalculateNextOccurance(); }
public Playlist(ViewModelServiceContainer container, IValidator <Playlist> validator, IDialogViewModel dialogViewModel, IMediaItemMapper mediaItemMapper, PlaylistModel model) : base(model, validator, container?.Messenger) { if (container == null) { throw new ArgumentNullException(nameof(container), $"{nameof(container)} {Resources.IsRequired}"); } SkipChangeTracking = true; using (BusyStack.GetToken()) { _itemsLock = new object(); _mediaItemMapper = mediaItemMapper ?? throw new ArgumentNullException(nameof(mediaItemMapper), $"{nameof(mediaItemMapper)} {Resources.IsRequired}"); _dialogViewModel = dialogViewModel ?? throw new ArgumentNullException(nameof(dialogViewModel), $"{nameof(dialogViewModel)} {Resources.IsRequired}"); _sequenceProvider = container.SequenceService; _translator = container.LocalizationService; _title = model.Title; _description = model.Description; _repeatMode = (RepeatMode)model.RepeatMode; _isShuffeling = model.IsShuffeling; _sequence = model.Sequence; RepeatModes = new RangeObservableCollection <RepeatMode>(Enum.GetValues(typeof(RepeatMode)).Cast <RepeatMode>().ToList()); _history = new Stack <int>(); Items = new RangeObservableCollection <MediaItem>(); _items.CollectionChanged += (o, e) => OnPropertyChanged(nameof(Count)); BindingOperations.EnableCollectionSynchronization(Items, _itemsLock); View = CollectionViewSource.GetDefaultView(Items); // TODO add sorting by sequence OnPropertyChanged(nameof(Count)); LoadFromFileCommand = AsyncCommand.Create(LoadFromFile, () => CanLoadFromFile()); LoadFromFolderCommand = AsyncCommand.Create(LoadFromFolder, () => CanLoadFromFolder()); LoadFromUrlCommand = AsyncCommand.Create(LoadFromUrl, () => CanLoadFromUrl()); RemoveCommand = new RelayCommand <object>(Remove, CanRemove); RemoveRangeCommand = new RelayCommand <IList>(RemoveRange, CanRemoveRange); ClearCommand = new RelayCommand(() => Clear(), CanClear); AddRange(_mediaItemMapper.GetMany(model.MediaItems)); MessageTokens.Add(Messenger.Subscribe <PlayingMediaItemMessage>(OnPlaybackItemChanged, m => m.PlaylistId == Id && _items.Contains(m.Content))); Validate(); } SkipChangeTracking = false; }
/// <summary> /// Initializes a new instance of the <see cref="Playlist" /> class. /// </summary> /// <param name="translator">The translator.</param> /// <param name="mediaItemMapper">The media item mapper.</param> /// <param name="dialogViewModel">The dialog view model.</param> /// <param name="model">The model.</param> /// <exception cref="System.ArgumentNullException">dialogViewModel</exception> /// <exception cref="System.ArgumentException"></exception> public Playlist(ILocalizationService translator, IMediaItemMapper mediaItemMapper, ISequenceProvider sequenceProvider, IValidator <Playlist> validator, DialogViewModel dialogViewModel, Data.Playlist model) : base(model, validator) { using (_busyStack.GetToken()) { _itemsLock = new object(); _sequenceProvider = sequenceProvider ?? throw new ArgumentNullException(nameof(sequenceProvider)); _dialogViewModel = dialogViewModel ?? throw new ArgumentNullException(nameof(dialogViewModel)); _translator = translator ?? throw new ArgumentNullException(nameof(translator)); _mediaItemMapper = mediaItemMapper ?? throw new ArgumentNullException(nameof(mediaItemMapper)); Items = new RangeObservableCollection <MediaItem>(); RepeatModes = new ObservableCollection <RepeatMode>(Enum.GetValues(typeof(RepeatMode)).Cast <RepeatMode>().ToList()); History = new Stack <int>(); BindingOperations.EnableCollectionSynchronization(Items, _itemsLock); _title = model.Title; _description = model.Description; _id = model.Id; _repeatMode = (RepeatMode)model.RepeatMode; _isShuffeling = model.IsShuffeling; _sequence = model.Sequence; _createdBy = model.CreatedBy; _createdOn = model.CreatedOn; _updatedBy = model.UpdatedBy; _updatedOn = model.UpdatedOn; if (model.MediaItems == null) { throw new ArgumentException($"{model.MediaItems} cannot be null"); } Items.AddRange(_mediaItemMapper.GetMany(model.MediaItems)); Items.CollectionChanged += (o, e) => { OnPropertyChanged(nameof(Count)); }; View = CollectionViewSource.GetDefaultView(Items); OnPropertyChanged(nameof(Count)); InitializeCommands(); IntializeValidation(); Validate(); } }
private void BtnRepeat_Click(object sender, RoutedEventArgs e) { if (BtnRepeat.Tag is string mode) { int imode = Convert.ToInt32(mode); ++imode; if (imode > 2) { imode = 0; } _repeatMode = (RepeatMode)imode; BtnRepeat.Tag = imode.ToString(); } }
private void RegisterRepeatModeChangedEvent() { _repeatModeChangedCallback = (int repeat, IntPtr userData) => { if (_repeatModeChanged != null) { RepeatMode mode = (RepeatMode)repeat; _repeatModeChanged(null, new RepeatModeChangedEventArgs(mode)); } }; int ret = Interop.Bluetooth.SetRepeatModeChangedCallback(_repeatModeChangedCallback, IntPtr.Zero); if (ret != (int)BluetoothError.None) { Log.Error(Globals.LogTag, "Failed to set repeat mode changed callback, Error - " + (BluetoothError)ret); } }
static extern bool gimp_edit_blend(Int32 drawable_ID, BlendMode blend_mode, LayerModeEffects paint_mode, GradientType gradient_type, double opacity, double offset, RepeatMode repeat, bool reverse, bool supersample, int max_depth, double threshold, bool dither, double x1, double y1, double x2, double y2);
protected void SetRepeatMode(RepeatMode mode) { IPlaylist playlist = _playlist; if (playlist == null) return; playlist.RepeatMode = mode; UpdateProperties(); }
protected void LoadPlayRepeatMode() { ISettingsManager settingsManager = ServiceRegistration.Get<ISettingsManager>(); PartyMusicPlayerSettings settings = settingsManager.Load<PartyMusicPlayerSettings>(); PlayMode = settings.PlayMode; RepeatMode = settings.RepeatMode; }
/// <summary> /// The function populates the local player status variables and then /// starts the Monitoring of the player status every 1000 ms to retrieve /// any changes. /// </summary> private void StartPlayerStatusMonitoring() { scrobble = mbApiInterface.Player_GetScrobbleEnabled(); repeat = mbApiInterface.Player_GetRepeat(); shuffle = mbApiInterface.Player_GetShuffle(); timer = new Timer {Interval = 1000}; timer.Elapsed += HandleTimerElapsed; timer.Enabled = true; }
/// <summary> /// This function runs periodically every 1000 ms as the timer ticks and /// checks for changes on the player status. If a change is detected on /// one of the monitored variables the function will fire an event with /// the new status. /// </summary> /// <param name="sender"> /// The sender. /// </param> /// <param name="args"> /// The event arguments. /// </param> private void HandleTimerElapsed(object sender, ElapsedEventArgs args) { if (mbApiInterface.Player_GetShuffle() != shuffle) { shuffle = mbApiInterface.Player_GetShuffle(); EventBus.FireEvent(new MessageEvent(EventType.ReplyAvailable, new SocketMessage( Constants.PlayerShuffle, Constants.Message, shuffle) .toJsonString())); } if (mbApiInterface.Player_GetScrobbleEnabled() != scrobble) { scrobble = mbApiInterface.Player_GetScrobbleEnabled(); EventBus.FireEvent(new MessageEvent(EventType.ReplyAvailable, new SocketMessage(Constants.PlayerScrobble, Constants.Message, scrobble) .toJsonString())); } if (mbApiInterface.Player_GetRepeat() != repeat) { repeat = mbApiInterface.Player_GetRepeat(); EventBus.FireEvent(new MessageEvent( EventType.ReplyAvailable, new SocketMessage(Constants.PlayerRepeat, Constants.Message, repeat).toJsonString())); } }
public void EditBlend(BlendMode blend_mode, LayerModeEffects paint_mode, GradientType gradient_type, double opacity, double offset, RepeatMode repeat, bool reverse, bool supersample, int max_depth, double threshold, bool dither, double x1, double y1, double x2, double y2) { if (!gimp_edit_blend(ID, blend_mode, paint_mode, gradient_type, opacity, offset, repeat, reverse, supersample, max_depth, threshold, dither, x1, y1, x2, y2)) { throw new GimpSharpException(); } }
/// <summary> /// Populates all fields from the provided ConfigNode, parsing all formulas /// </summary> /// <param name="variables"></param> public void PopulateFromSourceNode(Dictionary<string, string> variables, ConfigNode source = null) { if (source == null) source = sourceNode; Variables = variables; id = MathParsing.ReplaceMathVariables(ConfigNodeUtils.GetValueOrDefault(source, "id"), variables); name = MathParsing.ReplaceMathVariables(ConfigNodeUtils.GetValueOrDefault(source, "name"), variables); description = MathParsing.ReplaceMathVariables(ConfigNodeUtils.GetValueOrDefault(source, "description"), variables); bool.TryParse(MathParsing.ReplaceMathVariables(ConfigNodeUtils.GetValueOrDefault(source, "Available", "true"), variables), out Available); List<string> tmpList = MathParsing.ReplaceMathVariables(ConfigNodeUtils.GetValueOrDefault(source, "activePreReqs"), variables).Split(',').ToList(); tmpList.ForEach((s) => s.Trim()); if (!tmpList.TrueForAll(s => s == "")) activePreReqs = tmpList.ToArray(); else activePreReqs = new string[] { }; //activePreReqs = tmpList.ToArray(); tmpList = MathParsing.ReplaceMathVariables(ConfigNodeUtils.GetValueOrDefault(source, "preReqs"), variables).Split(',').ToList(); tmpList.ForEach((s) => s.Trim()); if (!tmpList.TrueForAll(s => s == "")) preReqs = tmpList.ToArray(); else preReqs = new string[] { }; tmpList = MathParsing.ReplaceMathVariables(ConfigNodeUtils.GetValueOrDefault(source, "conflicts"), variables).Split(',').ToList(); tmpList.ForEach((s) => s.Trim()); //conflicts = tmpList.ToArray(); if (!tmpList.TrueForAll(s => s == "")) conflicts = tmpList.ToArray(); else conflicts = new string[] { }; time = MathParsing.ParseMath(ConfigNodeUtils.GetValueOrDefault(source, "time", "0"), variables); bool.TryParse(MathParsing.ReplaceMathVariables(ConfigNodeUtils.GetValueOrDefault(source, "required", "false"), variables), out required); string repeatStr = MathParsing.ReplaceMathVariables(ConfigNodeUtils.GetValueOrDefault(source, "required", "false"), variables).Trim(); switch (repeatStr) { case "NEVER": repeatable = RepeatMode.NEVER; break; case "EXPIRED": repeatable = RepeatMode.EXPIRED; break; case "ALWAYS": repeatable = RepeatMode.ALWAYS; break; default: repeatable = RepeatMode.NEVER; break; } tmpList = MathParsing.ReplaceMathVariables(ConfigNodeUtils.GetValueOrDefault(source, "classes"), variables).Split(',').ToList(); tmpList.ForEach((s) => s.Trim()); //classes = tmpList.ToArray(); if (!tmpList.TrueForAll(s => s == "")) classes = tmpList.ToArray(); else classes = new string[] { }; minLevel = (int)(MathParsing.ParseMath(ConfigNodeUtils.GetValueOrDefault(source, "minLevel", "0"), variables)); maxLevel = (int)(MathParsing.ParseMath(ConfigNodeUtils.GetValueOrDefault(source, "maxLevel", "5"), variables)); seatMax = (int)(MathParsing.ParseMath(ConfigNodeUtils.GetValueOrDefault(source, "seatMax", "-1"), variables)); seatMin = (int)(MathParsing.ParseMath(ConfigNodeUtils.GetValueOrDefault(source, "seatMin", "0"), variables)); costBase = MathParsing.ParseMath(ConfigNodeUtils.GetValueOrDefault(source, "costBase", "0"), variables); costSeat = MathParsing.ParseMath(ConfigNodeUtils.GetValueOrDefault(source, "costSeat", "0"), variables); costTeacher = MathParsing.ParseMath(ConfigNodeUtils.GetValueOrDefault(source, "costTeacher", "0"), variables); tmpList = MathParsing.ReplaceMathVariables(ConfigNodeUtils.GetValueOrDefault(source, "teachClasses"), variables).Split(',').ToList(); tmpList.ForEach((s) => s.Trim()); if (!tmpList.TrueForAll(s => s == "")) teachClasses = tmpList.ToArray(); else teachClasses = new string[] { }; teachMinLevel = (int)(MathParsing.ParseMath(ConfigNodeUtils.GetValueOrDefault(source, "teachMinLevel", "0"), variables)); //get the REWARD nodes and replace any variables in there too Rewards = source.GetNodes("REWARD"); foreach (ConfigNode node in Rewards) ConfigNodeUtils.ReplaceValuesInNode(node, variables); /* Expiry = source.GetNodes("EXPIRY"); foreach (ConfigNode node in Expiry) ConfigNodeUtils.ReplaceValuesInNode(node, variables);*/ }
private void RepeatLesson(Lesson l, RepeatMode rm, bool eoy, int nrepeats) { List<DateTime> dates = new List<DateTime>(); DateTime dt = DateTime.Now; bool hitEnd = false; while(!hitEnd) { // Get next date switch (rm) { case RepeatMode.None: hitEnd = true; break; case RepeatMode.Weekly: dt = dt.AddDays(7); break; case RepeatMode.Biweekly: dt = dt.AddDays(14); break; case RepeatMode.Monthly: dt = ProjectToNextMonth(dt); break; default: throw new Exception("Bad params"); } if (eoy && dt.Year != DateTime.Now.Year) hitEnd = true; else if (!eoy && nrepeats-- <= 0) hitEnd = true; if (!hitEnd) dates.Add(dt); } CloneLessons(l, dates); }