public override Item GetItem(Func <Item, bool> predicate, StartAt startAt) { if (startAt == StartAt.Random) { return(_items.Values.FirstOrDefault(predicate)); } for (int y = 0; y < _height; ++y) { for (int x = 0; x < _width; ++x) { // Reverse index for bottom right start point var item = startAt == StartAt.TopLeft ? _map[x, y] : _map[_width - 1 - x, _height - 1 - y]; // Skip empty slots if (item == null) { continue; } // Take item if it matches predicate if (predicate(item)) { return(item); } } } return(null); }
public override List <Item> GetItems(Func <Item, bool> predicate, StartAt startAt) { if (startAt == StartAt.Random) { return(_items.Values.Where(predicate).ToList()); } var result = new List <Item>(); for (int y = 0; y < _height; ++y) { for (int x = 0; x < _width; ++x) { // Reverse index for bottom right start point var item = startAt == StartAt.TopLeft ? _map[x, y] : _map[_width - 1 - x, _height - 1 - y]; // Skip empty slots if (item == null) { continue; } // An item can occupy more than one spot on the map, // make sure it's only added once. if (predicate(item) && !result.Contains(item)) { result.Add(item); } } } return(result); }
public override string ToString() { string globalId = ""; string start = ""; string _title = ""; string _processing_state = ""; if (GlobalId != null) { globalId = GlobalId; } if (StartAt != null) { start = StartAt.ToString(); } if (Title != null) { _title = Title; } if (ProcessingState != null) { _processing_state = ProcessingState; } return("GlobalId:" + globalId + " / Start:" + start + " / Title:" + _title + " / Processing state:" + _processing_state); }
public void SettingsCollection_MergeRange() { var startAtDefault = new StartAt(2); var vcodecDefault = new CodecVideo(VideoCodecType.Copy); var settingsCollectionI = SettingsCollection.ForInput(new StartAt(1)); var settingsCollectionO = SettingsCollection.ForOutput(new CodecVideo(VideoCodecType.Libx264)); var settingsCollectionMergeI = SettingsCollection.ForInput(startAtDefault); var settingsCollectionMergeO = SettingsCollection.ForOutput(vcodecDefault); Assert.Throws <ArgumentException>(() => settingsCollectionI.MergeRange(settingsCollectionMergeO, FFmpegMergeOptionType.OldWins)); Assert.Throws <ArgumentException>(() => settingsCollectionO.MergeRange(settingsCollectionMergeI, FFmpegMergeOptionType.OldWins)); Assert.Throws <ArgumentException>(() => settingsCollectionI.MergeRange(settingsCollectionMergeO, FFmpegMergeOptionType.NewWins)); Assert.Throws <ArgumentException>(() => settingsCollectionO.MergeRange(settingsCollectionMergeI, FFmpegMergeOptionType.NewWins)); Assert.DoesNotThrow(() => settingsCollectionI.MergeRange(settingsCollectionMergeI, FFmpegMergeOptionType.OldWins)); Assert.DoesNotThrow(() => settingsCollectionO.MergeRange(settingsCollectionMergeO, FFmpegMergeOptionType.OldWins)); var startAtSetting = settingsCollectionI.Items[0] as StartAt; var vcodecSetting = settingsCollectionO.Items[0] as CodecVideo; Assert.False(startAtSetting != null && startAtSetting.Length == startAtDefault.Length); Assert.False(vcodecSetting != null && vcodecSetting.Codec == vcodecDefault.Codec); Assert.DoesNotThrow(() => settingsCollectionI.MergeRange(settingsCollectionMergeI, FFmpegMergeOptionType.NewWins)); Assert.DoesNotThrow(() => settingsCollectionO.MergeRange(settingsCollectionMergeO, FFmpegMergeOptionType.NewWins)); startAtSetting = settingsCollectionI.Items[0] as StartAt; vcodecSetting = settingsCollectionO.Items[0] as CodecVideo; Assert.True(startAtSetting != null && startAtSetting.Length == startAtDefault.Length); Assert.True(vcodecSetting != null && vcodecSetting.Codec == vcodecDefault.Codec); }
public override bool Equals(object obj) { if (obj == null) { return(false); } if (obj == this) { return(true); } return(obj is Booking other && ((Id == null && other.Id == null) || (Id?.Equals(other.Id) == true)) && ((Version == null && other.Version == null) || (Version?.Equals(other.Version) == true)) && ((Status == null && other.Status == null) || (Status?.Equals(other.Status) == true)) && ((CreatedAt == null && other.CreatedAt == null) || (CreatedAt?.Equals(other.CreatedAt) == true)) && ((UpdatedAt == null && other.UpdatedAt == null) || (UpdatedAt?.Equals(other.UpdatedAt) == true)) && ((StartAt == null && other.StartAt == null) || (StartAt?.Equals(other.StartAt) == true)) && ((LocationId == null && other.LocationId == null) || (LocationId?.Equals(other.LocationId) == true)) && ((CustomerId == null && other.CustomerId == null) || (CustomerId?.Equals(other.CustomerId) == true)) && ((CustomerNote == null && other.CustomerNote == null) || (CustomerNote?.Equals(other.CustomerNote) == true)) && ((SellerNote == null && other.SellerNote == null) || (SellerNote?.Equals(other.SellerNote) == true)) && ((AppointmentSegments == null && other.AppointmentSegments == null) || (AppointmentSegments?.Equals(other.AppointmentSegments) == true))); }
public override bool Equals(object obj) { if (obj == null) { return(false); } if (obj == this) { return(true); } return(obj is Shift other && ((Id == null && other.Id == null) || (Id?.Equals(other.Id) == true)) && ((EmployeeId == null && other.EmployeeId == null) || (EmployeeId?.Equals(other.EmployeeId) == true)) && ((LocationId == null && other.LocationId == null) || (LocationId?.Equals(other.LocationId) == true)) && ((Timezone == null && other.Timezone == null) || (Timezone?.Equals(other.Timezone) == true)) && ((StartAt == null && other.StartAt == null) || (StartAt?.Equals(other.StartAt) == true)) && ((EndAt == null && other.EndAt == null) || (EndAt?.Equals(other.EndAt) == true)) && ((Wage == null && other.Wage == null) || (Wage?.Equals(other.Wage) == true)) && ((Breaks == null && other.Breaks == null) || (Breaks?.Equals(other.Breaks) == true)) && ((Status == null && other.Status == null) || (Status?.Equals(other.Status) == true)) && ((Version == null && other.Version == null) || (Version?.Equals(other.Version) == true)) && ((CreatedAt == null && other.CreatedAt == null) || (CreatedAt?.Equals(other.CreatedAt) == true)) && ((UpdatedAt == null && other.UpdatedAt == null) || (UpdatedAt?.Equals(other.UpdatedAt) == true)) && ((TeamMemberId == null && other.TeamMemberId == null) || (TeamMemberId?.Equals(other.TeamMemberId) == true))); }
/// <inheritdoc /> public override string ToString() { string ratesPart = Rates.Aggregate("", (acc, curr) => $"{acc}{Environment.NewLine}{curr.Key.ToShortDateString()}: {DayRates.RatesToString(curr.Value)}"); return($"{StartAt.ToShortDateString()}–{EndAt.ToShortDateString()} exchange rates for 1 {Base} " + ratesPart); }
public override IDocEntity SaveChanges(bool ignoreCache, DocConstantPermission permission) { Description = Description?.TrimAndPruneSpaces(); LastRunVersion = LastRunVersion?.TrimAndPruneSpaces(); Name = Name?.TrimAndPruneSpaces(); StartAt = StartAt?.TrimAndPruneSpaces(); return(base.SaveChanges(ignoreCache, permission)); }
public override Item GetItem(Func <Item, bool> predicate, StartAt startAt) { if (_item != null && predicate(_item)) { return(_item); } return(null); }
public override List <Item> GetItems(Func <Item, bool> predicate, StartAt startAt) { var result = new List <Item>(); if (_item != null && predicate(_item)) { result.Add(_item); } return(result); }
public void StartAt_Verify() { var settingWrong1 = new StartAt(0); var settingWrong2 = new StartAt(-1); var setting = new StartAt(120); Assert.Throws <InvalidOperationException>(() => { var s = settingWrong1.GetAndValidateString(); }); Assert.Throws <InvalidOperationException>(() => { var s = settingWrong2.GetAndValidateString(); }); Assert.DoesNotThrow(() => { var s = setting.GetAndValidateString(); }); Assert.Equal(setting.GetAndValidateString(), "-ss 00:02:00.0"); }
/// <summary> /// Returns items that match predicate. /// </summary> /// <param name="predicate"></param> /// <param name="startAt"> /// Affects the order of the returned items, based on their position in /// the inventory. /// </param> /// <returns></returns> public List <Item> GetItems(Func <Item, bool> predicate, StartAt startAt = StartAt.Random) { var result = new List <Item>(); foreach (var pocket in _pockets.Values) { result.AddRange(pocket.GetItems(predicate, startAt)); } return(result); }
public void StartAt_Verify() { var settingWrong1 = new StartAt(0); var settingWrong2 = new StartAt(-1); var setting = new StartAt(120); Assert.Throws <InvalidOperationException>(() => { SettingSerializer.Serialize(settingWrong1); }); Assert.Throws <InvalidOperationException>(() => { SettingSerializer.Serialize(settingWrong2); }); Assert.DoesNotThrow(() => SettingSerializer.Serialize(setting)); Assert.Equal(SettingSerializer.Serialize(setting), "-ss 00:02:00.0"); }
public async void OnSaveClick(object sender, RoutedEventArgs e) { if (SaveBtn_IsEnabled) { DealPostModel model = new DealPostModel { start_at = StartAt.ToString("o"), end_at = EndAt.ToString("o"), label = Label, description = Description }; try { var customer = await _api.PostDealWithRetryAsync(model); if (customer != null) { Views.ShellPage.ShellFrame.Navigate(typeof(Views.DealsPage), customer); } else { var unknowErrordialog = new Windows.UI.Popups.MessageDialog( "Une erreur est survenue", "Erreur"); unknowErrordialog.Commands.Add(new Windows.UI.Popups.UICommand("Fermer") { Id = 0 }); unknowErrordialog.DefaultCommandIndex = 0; var resultUnknow = await unknowErrordialog.ShowAsync(); } } catch (Exception ex) { var dialog = new Windows.UI.Popups.MessageDialog( ex.Message, "Erreur" ); dialog.Commands.Add(new Windows.UI.Popups.UICommand("Fermer") { Id = 0 }); dialog.DefaultCommandIndex = 0; var result = await dialog.ShowAsync(); } } }
/// <summary> /// Returns first item to match predicate, or null. /// </summary> /// <param name="predicate"></param> /// <param name="startAt"> /// Affects the order of the returned items, based on their position in /// the inventory. /// </param> /// <returns></returns> public Item GetItem(Func <Item, bool> predicate, StartAt startAt = StartAt.Random) { foreach (var pocket in _pockets.Values) { var item = pocket.GetItem(predicate, startAt); if (item != null) { return(item); } } return(null); }
public RussianRoulette() { Players = new List <StreamViewer>(); DeadPlayers = new List <StreamViewer>(); StartedAt = DateTime.Now; StartAt = DateTime.Now.AddMinutes(2); StartOneMinReminder = StartAt.AddMinutes(-1); StartTenSecReminder = StartAt.AddSeconds(-10); StartOneMinReminderAlerted = false; StartTenSecReminderAlerted = false; Started = false; Finished = false; }
public override bool Equals(object obj) { if (obj == null) { return(false); } if (obj == this) { return(true); } return(obj is TimeRange other && ((StartAt == null && other.StartAt == null) || (StartAt?.Equals(other.StartAt) == true)) && ((EndAt == null && other.EndAt == null) || (EndAt?.Equals(other.EndAt) == true))); }
public override int GetHashCode() { int hashCode = 1397829395; if (StartAt != null) { hashCode += StartAt.GetHashCode(); } if (EndAt != null) { hashCode += EndAt.GetHashCode(); } return(hashCode); }
public override bool Equals(object obj) { if (obj == null) { return(false); } if (obj == this) { return(true); } return(obj is Availability other && ((StartAt == null && other.StartAt == null) || (StartAt?.Equals(other.StartAt) == true)) && ((LocationId == null && other.LocationId == null) || (LocationId?.Equals(other.LocationId) == true)) && ((AppointmentSegments == null && other.AppointmentSegments == null) || (AppointmentSegments?.Equals(other.AppointmentSegments) == true))); }
public override bool Equals(object obj) { if (obj == null) { return(false); } if (obj == this) { return(true); } return(obj is Break other && ((Id == null && other.Id == null) || (Id?.Equals(other.Id) == true)) && ((StartAt == null && other.StartAt == null) || (StartAt?.Equals(other.StartAt) == true)) && ((EndAt == null && other.EndAt == null) || (EndAt?.Equals(other.EndAt) == true)) && ((BreakTypeId == null && other.BreakTypeId == null) || (BreakTypeId?.Equals(other.BreakTypeId) == true)) && ((Name == null && other.Name == null) || (Name?.Equals(other.Name) == true)) && ((ExpectedDuration == null && other.ExpectedDuration == null) || (ExpectedDuration?.Equals(other.ExpectedDuration) == true)) && IsPaid.Equals(other.IsPaid)); }
public override int GetHashCode() { int hashCode = 133095493; if (StartAt != null) { hashCode += StartAt.GetHashCode(); } if (LocationId != null) { hashCode += LocationId.GetHashCode(); } if (AppointmentSegments != null) { hashCode += AppointmentSegments.GetHashCode(); } return(hashCode); }
public override int GetHashCode() { int hashCode = 168552180; if (Id != null) { hashCode += Id.GetHashCode(); } if (StartAt != null) { hashCode += StartAt.GetHashCode(); } if (EndAt != null) { hashCode += EndAt.GetHashCode(); } if (BreakTypeId != null) { hashCode += BreakTypeId.GetHashCode(); } if (Name != null) { hashCode += Name.GetHashCode(); } if (ExpectedDuration != null) { hashCode += ExpectedDuration.GetHashCode(); } hashCode += IsPaid.GetHashCode(); return(hashCode); }
public override Item GetItem(Func<Item, bool> predicate, StartAt startAt) { if (startAt == StartAt.Random) return _items.Values.FirstOrDefault(predicate); for (int y = 0; y < _height; ++y) { for (int x = 0; x < _width; ++x) { // Reverse index for bottom right start point var item = startAt == StartAt.TopLeft ? _map[x, y] : _map[_width - 1 - x, _height - 1 - y]; // Skip empty slots if (item == null) continue; // Take item if it matches predicate if (predicate(item)) return item; } } return null; }
/// <summary> /// Returns items that match predicate. /// </summary> /// <param name="predicate"></param> /// <param name="startAt"></param> /// <returns></returns> public abstract List<Item> GetItems(Func<Item, bool> predicate, StartAt startAt);
/// <summary> /// Returns items that match predicate. /// </summary> /// <param name="predicate"></param> /// <param name="startAt"> /// Affects the order of the returned items, based on their position in /// the inventory. /// </param> /// <returns></returns> public List<Item> GetItems(Func<Item, bool> predicate, StartAt startAt = StartAt.Random) { var result = new List<Item>(); foreach (var pocket in _pockets.Values) result.AddRange(pocket.GetItems(predicate, startAt)); return result; }
/// <summary> /// Returns first item to match predicate, or null. /// </summary> /// <param name="predicate"></param> /// <param name="startAt"> /// Affects the order of the returned items, based on their position in /// the inventory. /// </param> /// <returns></returns> public Item GetItem(Func<Item, bool> predicate, StartAt startAt = StartAt.Random) { foreach (var pocket in _pockets.Values) { var item = pocket.GetItem(predicate, startAt); if (item != null) return item; } return null; }
public override List <Item> GetItems(Func <Item, bool> predicate, StartAt startAt) { return(_items.Where(predicate).ToList()); }
public override List<Item> GetItems(Func<Item, bool> predicate, StartAt startAt) { return _items.Where(predicate).ToList(); }
public override List<Item> GetItems(Func<Item, bool> predicate, StartAt startAt) { var result = new List<Item>(); if (_item != null && predicate(_item)) result.Add(_item); return result; }
public override List<Item> GetItems(Func<Item, bool> predicate, StartAt startAt) { if (startAt == StartAt.Random) return _items.Values.Where(predicate).ToList(); var result = new List<Item>(); for (int y = 0; y < _height; ++y) { for (int x = 0; x < _width; ++x) { // Reverse index for bottom right start point var item = startAt == StartAt.TopLeft ? _map[x, y] : _map[_width - 1 - x, _height - 1 - y]; // Skip empty slots if (item == null) continue; // An item can occupy more than one spot on the map, // make sure it's only added once. if (predicate(item) && !result.Contains(item)) result.Add(item); } } return result; }
/// <summary> /// Returns first item to match predicate, or null. /// </summary> /// <param name="predicate"></param> /// <param name="startAt"></param> /// <returns></returns> public abstract Item GetItem(Func <Item, bool> predicate, StartAt startAt);
/// <summary> /// Returns items that match predicate. /// </summary> /// <param name="predicate"></param> /// <param name="startAt"></param> /// <returns></returns> public abstract List <Item> GetItems(Func <Item, bool> predicate, StartAt startAt);
public override int GetHashCode() { int hashCode = -1338935965; if (Id != null) { hashCode += Id.GetHashCode(); } if (EmployeeId != null) { hashCode += EmployeeId.GetHashCode(); } if (LocationId != null) { hashCode += LocationId.GetHashCode(); } if (Timezone != null) { hashCode += Timezone.GetHashCode(); } if (StartAt != null) { hashCode += StartAt.GetHashCode(); } if (EndAt != null) { hashCode += EndAt.GetHashCode(); } if (Wage != null) { hashCode += Wage.GetHashCode(); } if (Breaks != null) { hashCode += Breaks.GetHashCode(); } if (Status != null) { hashCode += Status.GetHashCode(); } if (Version != null) { hashCode += Version.GetHashCode(); } if (CreatedAt != null) { hashCode += CreatedAt.GetHashCode(); } if (UpdatedAt != null) { hashCode += UpdatedAt.GetHashCode(); } if (TeamMemberId != null) { hashCode += TeamMemberId.GetHashCode(); } return(hashCode); }
public override Item GetItem(Func <Item, bool> predicate, StartAt startAt) { return(_items.FirstOrDefault(predicate)); }
public override Item GetItem(Func<Item, bool> predicate, StartAt startAt) { if (_item != null && predicate(_item)) return _item; return null; }
/// <summary> /// Compares the current object with another object of the same type. /// </summary> /// <remarks> /// Compares only by <see cref="StartAt"/> and ignores <see cref="Length"/> /// </remarks> /// <param name="other">An object to compare with this object.</param> /// <returns> /// A value that indicates the relative order of the objects being compared. /// </returns> public int CompareTo(CharRange other) { return(StartAt.CompareTo(other.StartAt)); }
public override Item GetItem(Func<Item, bool> predicate, StartAt startAt) { return _items.FirstOrDefault(predicate); }
private IEnumerator Start() { UserInterfacePortManager.ReleaseUtils.OverwriteCheck(); mStartAt = GetStartAt(); Stopwatch stopWatch = new Stopwatch(); stopWatch.Reset(); stopWatch.Start(); SingletonMonoBehaviour <UIShortCutMenu> .Instance.IsInputEnable = false; mKeyController = new KeyControl(); mAudioClip_SE002 = SoundFile.LoadSE(SEFIleInfos.SE_002); mAudioClip_CommonCancel1 = SoundFile.LoadSE(SEFIleInfos.CommonCancel1); mUIItemListManager.SetOnBackListener(OnItemListBack); mUIItemListManager.SetOnSwitchItemStoreListener(OnSwitchToItemStore); mUIItemListManager.SetKeyController(null); mUIItemStoreManager.SetOnBackListener(OnItemStoreBackListener); mUIItemStoreManager.SetOnSwitchItemListListener(OnSwitchToItemList); mUIItemStoreManager.SetKeyController(null); mUIItemAkashi.SetOnHiddenCallBack(OnAkashiHidenListener); int bgmId = 101; switch (mStartAt) { case StartAt.ItemList: mUIItemListManager.SetActive(isActive: true); mUIItemStoreManager.SetActive(isActive: false); mTransform_SwitchViewRoot.transform.localPosition = new Vector3(0f, 0f, 0f); bgmId = itemListManager.UserInfo.GetPortBGMId(SingletonMonoBehaviour <AppInformation> .Instance.CurrentDeckID); mUIItemListManager.Initialize(itemListManager); if (SingletonMonoBehaviour <UIPortFrame> .exist()) { SingletonMonoBehaviour <UIPortFrame> .Instance.CircleUpdateInfo(itemListManager); } break; case StartAt.ItemStore: mUIItemListManager.SetActive(isActive: false); mUIItemStoreManager.SetActive(isActive: true); mTransform_SwitchViewRoot.transform.localPosition = new Vector3(-960f, 0f, 0f); bgmId = itemStoreManager.UserInfo.GetPortBGMId(SingletonMonoBehaviour <AppInformation> .Instance.CurrentDeckID); mUIItemStoreManager.Initialize(itemStoreManager); if (SingletonMonoBehaviour <UIPortFrame> .exist()) { SingletonMonoBehaviour <UIPortFrame> .Instance.CircleUpdateInfo(itemStoreManager); } break; } mAudioClip_SceneBGM = SoundFile.LoadBGM((BGMFileInfos)bgmId); stopWatch.Stop(); if (RetentionData.GetData() != null) { RetentionData.GetData().Clear(); } for (int frame = 0; frame < stopWatch.Elapsed.Milliseconds / 60; frame++) { yield return(new WaitForEndOfFrame()); } SingletonMonoBehaviour <PortObjectManager> .Instance.PortTransition.EndTransition(delegate { SoundUtils.PlayBGM(this.mAudioClip_SceneBGM, isLoop: true); SingletonMonoBehaviour <UIShortCutMenu> .Instance.IsInputEnable = false; this.mUIItemAkashi.SetKeyController(this.mKeyController); this.mUIItemAkashi.Show(); this.mUIItemAkashi.SetClickable(clickable: true); this.DelayAction(0.2f, delegate { ShipUtils.PlayPortVoice(4); }); this.ChangeState(State.Akashi, popStack: false); }); }
/// <summary> /// Returns first item to match predicate, or null. /// </summary> /// <param name="predicate"></param> /// <param name="startAt"></param> /// <returns></returns> public abstract Item GetItem(Func<Item, bool> predicate, StartAt startAt);
public void Move(TimeSpan offset) { StartAt = StartAt.Add(offset); EndAt = EndAt.Add(offset); }