public virtual Task <QueryResult <KeyValuePair <TKey, TValue> > > QueryAsync <TResult>( Expression <Func <KeyValuePair <TKey, TValue>, bool> > @where, Expression <Func <KeyValuePair <TKey, TValue>, TResult> > @select, int skip, int take, CancellationToken cancellationToken) { if (@where == null) { @where = value => true; } if (select != null && select.ReturnType != typeof(KeyValuePair <TKey, TValue>)) { throw new NotImplementedException("The select parameter is not supported yet"); } var totalValues = InternalDictionary .Where(pair => KeyHasNotExpired(pair.Key) && where.Compile().Invoke(pair)); int totalCount = 0; if (FetchQueryResultTotal) { totalCount = totalValues.Count(); } var resultValues = totalValues .Skip(skip) .Take(take); var queryResult = new QueryResult <KeyValuePair <TKey, TValue> >(resultValues, totalCount); return(Task.FromResult(queryResult)); }
public static T GetAnnotation <T>(this ODataAnnotatable annotatable) where T : class { Debug.Assert(annotatable != null, "annotatable != null"); return(InternalDictionary <T> .GetAnnotation(annotatable)); }
public override ILanguageValue this[string accessKey] { get { ILanguageValue compValue; if (InternalDictionary.TryGetValue(accessKey, out compValue)) { return(compValue); } var dataMemberType = ValueStructureType.GetDataMemberType(accessKey); compValue = ValueStructureType.RootAst.CreateDefaultValue(dataMemberType); InternalDictionary.Add(accessKey, compValue); return(compValue); } set { //TODO: Should you verify that the structure type contains a data member with the name in 'access_key'? if (InternalDictionary.ContainsKey(accessKey)) { InternalDictionary[accessKey] = value; } else { InternalDictionary.Add(accessKey, value); } } }
/// <summary> /// Override this to free resources /// </summary> /// <param name="disposing">true is Dispose() has been called</param> protected virtual void Dispose(bool disposing) { if (disposed) { return; } if (disposing) { // Free any other managed objects here. // } // Free any unmanaged objects here. // foreach (UIButton button in this) { if (subscribeCount > 0) { button.ButtonEvent -= new UIObjectButtonEventHandler(OnButtonEvent); } button.Dispose(); } InternalDictionary.Clear(); disposed = true; }
public virtual Task <bool> TryAddAsync( TKey key, TValue value, bool overwrite = false, CancellationToken cancellationToken = default) { if (key == null) { throw new ArgumentNullException(nameof(key)); } bool added; if (overwrite) { InternalDictionary.AddOrUpdate(key, value, (k, v) => value); added = true; } else { added = InternalDictionary.TryAdd(key, value); } if (added) { KeyExpirationDictionary.TryRemove(key, out _); } return(Task.FromResult(added)); }
private InternalDictionary<IListenerHandler> RegisterHandlers() { var handlers = new InternalDictionary<IListenerHandler>(); // регистрируем обработчики для методов плагинов foreach (var action in RequestReceived) { Logger.Info("Register HTTP handler (API): '{0}'", action.Metadata.Url); var handler = new ApiListenerHandler(action.Value); handlers.Register(action.Metadata.Url, handler); } // регистрируем обработчики для ресурсов foreach (var plugin in Context.GetAllPlugins()) { Type type = plugin.GetType(); var attributes = type.GetCustomAttributes<HttpResourceAttribute>(); foreach (var attribute in attributes) { Logger.Info("Register HTTP handler (resource): '{0}'", attribute.Url); var resHandler = new ResourceListenerHandler( type.Assembly, attribute.ResourcePath, attribute.ContentType); handlers.Register(attribute.Url, resHandler); } } return handlers; }
internal void Remove(Room room) { if (Contains(room)) { InternalDictionary.Remove(room.ID); } }
public void AddRange(IDictionary <TKey, TValue> items) { if (items == null) { throw new ArgumentNullException(nameof(items)); } if (items.Count > 0) { if (InternalDictionary.Count > 0) { if (items.Keys.Any((k) => InternalDictionary.ContainsKey(k))) { throw new ArgumentException("An item with the same key has already been added."); } else { foreach (var item in items) { InternalDictionary.Add(item); } } } else { InternalDictionary = new Dictionary <TKey, TValue>(items); } OnPropertyChanged(); CollectionChanged?.Invoke(this, new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Add, items.ToArray())); } }
private InternalDictionary <IListenerHandler> RegisterHandlers() { var handlers = new InternalDictionary <IListenerHandler>(); // регистрируем обработчики для методов плагинов foreach (var action in RequestReceived) { Logger.Info("Register HTTP handler (API): '{0}'", action.Metadata.Url); var handler = new ApiListenerHandler(action.Value); handlers.Register(action.Metadata.Url, handler); } // регистрируем обработчики для ресурсов foreach (var plugin in Context.GetAllPlugins()) { Type type = plugin.GetType(); var attributes = type.GetCustomAttributes <HttpResourceAttribute>(); foreach (var attribute in attributes) { Logger.Info("Register HTTP handler (resource): '{0}'", attribute.Url); var resHandler = new ResourceListenerHandler(type.Assembly, attribute); handlers.Register(attribute.Url, resHandler); } } return(handlers); }
public virtual Task <QueryResult <KeyValuePair <TKey, TItem> > > QueryAsync <TResult>(Expression <Func <KeyValuePair <TKey, TItem>, bool> > @where, Expression <Func <KeyValuePair <TKey, TItem>, TResult> > @select, int skip, int take, CancellationToken cancellationToken) { if (@where == null) { @where = value => true; } if (select != null && select.ReturnType != typeof(KeyValuePair <TKey, TItem>)) { throw new NotImplementedException("The select parameter is not supported yet"); } var totalValues = InternalDictionary .SelectMany(v => v .Value .ToListAsync().Result .Select(i => new KeyValuePair <TKey, TItem>(v.Key, i))) .Where(pair => where.Compile().Invoke(pair)); var resultValues = totalValues .Skip(skip) .Take(take); int totalCount = 0; if (FetchQueryResultTotal) { totalCount = totalValues.Count(); } return(Task.FromResult( new QueryResult <KeyValuePair <TKey, TItem> >(new AsyncEnumerableWrapper <KeyValuePair <TKey, TItem> >(resultValues), totalCount))); }
public static T GetAnnotation <T>(this ODataAnnotatable annotatable) where T : class { ExceptionUtils.CheckArgumentNotNull(annotatable, "annotatable"); return(InternalDictionary <T> .GetAnnotation(annotatable)); }
public void SetDefaultIfNotExist() { if (!InternalDictionary.ContainsKey(string.Empty)) { InternalDictionary.Add(string.Empty, LogLevel.None); } }
public static void SetAnnotation <T>(this ODataAnnotatable annotatable, T annotation) where T : class { Debug.Assert(annotatable != null, "annotatable != null"); Debug.Assert(annotation != null, "annotation != null"); InternalDictionary <T> .SetAnnotation(annotatable, annotation); }
public static void SetAnnotation <T>(this ODataAnnotatable annotatable, T annotation) where T : class { ExceptionUtils.CheckArgumentNotNull(annotatable, "annotatable"); ExceptionUtils.CheckArgumentNotNull(annotation, "annotation"); InternalDictionary <T> .SetAnnotation(annotatable, annotation); }
public void Remove(ScoreNote scoreNote1, ScoreNote scoreNote2) { var tuple = new TupleType(scoreNote1, scoreNote2); var revTuple = new TupleType(scoreNote2, scoreNote1); InternalDictionary.Remove(tuple); InternalDictionary.Remove(revTuple); }
public HttpListenerModule(AppFunc next, InternalDictionary<IListenerHandler> handlers, Logger logger) { if (next == null) throw new ArgumentNullException("next"); this.next = next; this.handlers = handlers; this.logger = logger; }
public static Dictionary <K, V> DictOf <K, V>(InternalDictionary <K, V> dictionary) { return ((Dictionary <K, V>) dictionary.GetType().GetField("Dictionary", BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public). GetValue( dictionary)); }
public void Clear() { if (InternalDictionary.Count > 0) { InternalDictionary.Clear(); OnPropertyChanged(); CollectionChanged?.Invoke(this, new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Reset)); } }
public virtual Task <bool> ContainsKeyAsync(TKey key, CancellationToken cancellationToken = default) { if (key == null) { throw new ArgumentNullException(nameof(key)); } var contains = InternalDictionary.ContainsKey(key) && !KeyHasExpired(key); return(Task.FromResult(contains)); }
/// <summary> /// Elimina un elemento /// </summary> public void Remove(string key) { // Normaliza la clave key = Normalize(key); // Elimina el elemento if (InternalDictionary.ContainsKey(key)) { InternalDictionary.Remove(key); } }
/// <summary> /// Removes the specified element from the set. /// </summary> /// <param name="o">The element to be removed.</param> /// <returns><c>true</c> if the set contained the specified element, <c>false</c> otherwise.</returns> public override bool Remove(object o) { bool contained = Contains(o); if (contained) { InternalDictionary.Remove(o); } return(contained); }
public static RegionAgent[] agentsFromList(InternalDictionary <UUID, Vector3> avs) { List <RegionAgent> agents = new List <RegionAgent>(); avs.ForEach(delegate(KeyValuePair <UUID, Vector3> pair) { agents.Add(new RegionAgent(pair.Key, pair.Value)); }); return(agents.ToArray()); }
public static void Lock <TKey, TValue>(this InternalDictionary <TKey, TValue> dict, Action <InternalDictionary <TKey, TValue> > block) { var lockTargetField = dict.GetType().GetField("Dictionary", BindingFlags.NonPublic | BindingFlags.GetField | BindingFlags.Instance); var lockTarget = lockTargetField.GetValue(dict); lock (lockTarget) { block(dict); } }
/// <summary> /// Removes the specified element from the set. /// </summary> /// <param name="element">The element to be removed.</param> /// <returns> /// <see langword="true"/> if the set contained the specified element. /// </returns> public override bool Remove(T element) { bool contained = Contains(element); if (contained) { InternalDictionary.Remove(element); } return(contained); }
private InternalDictionary<Delegate> RegisterScriptCommands() { var actions = new InternalDictionary<Delegate>(); foreach (var action in ScriptCommands) { actions.Register(action.Metadata.Alias, action.Value); } return actions; }
private InternalDictionary <Delegate> RegisterScriptCommands() { var actions = new InternalDictionary <Delegate>(); foreach (var action in ScriptCommands) { actions.Register(action.Metadata.Alias, action.Value); } return(actions); }
/// <summary> /// Adds the specified element to this set if it is not already present. /// </summary> /// <param name="o">The object to add to the set.</param> /// <returns><c>true</c> is the object was added, <c>false</c> if it was already present.</returns> public override bool Add(T o) { //The object we are adding is just a placeholder. The thing we are //really concerned with is 'o', the key. if (!InternalDictionary.ContainsKey(o)) { InternalDictionary.Add(o, _placeholderObject); return(true); } return(false); }
/// <summary> /// Removes the specified element from the set. /// </summary> /// <param name="element">The element to be removed.</param> /// <returns> /// <see langword="true" /> if the set contained the specified element. /// </returns> public override bool Remove(object element) { element = MaskNull(element); var contained = Contains(element); if (contained) { InternalDictionary.Remove(element); } return(contained); }
/// <summary> /// Adds the specified element to this set if it is not already present. /// </summary> /// <param name="o">The object to add to the set.</param> /// <returns><c>true</c> is the object was added, <c>false</c> if it was already present.</returns> public override bool Add(object o) { if (InternalDictionary[o] != null) { return(false); } //The object we are adding is just a placeholder. The thing we are //really concerned with is 'o', the key. InternalDictionary.Add(o, _placeholderObject); return(true); }
public static RegionParcel[] parcelsFromList(InternalDictionary <int, Parcel> ps) { List <RegionParcel> parcels = new List <RegionParcel>(); ps.ForEach(delegate(Parcel p) { }); return(parcels.ToArray()); }
public ListenerModule(AppFunc next, InternalDictionary <IListenerHandler> handlers, Logger logger) { if (next == null) { throw new ArgumentNullException("next"); } this.handlers = handlers; this.logger = logger; this.next = next; }
/// <summary> /// Adds the specified element to this set if it is not already present. /// </summary> /// <param name="element">The object to add to the set.</param> /// <returns> /// <see langword="true"/> is the object was added, /// <see langword="false"/> if the object was already present. /// </returns> public override bool Add(T element) { if (InternalDictionary.ContainsKey(element)) { return(false); } //The object we are adding is just a placeholder. The thing we are //really concerned with is 'o', the key. InternalDictionary.Add(element, PlaceholderObject); return(true); }
protected bool TryGetValue(TKey key, out TValue value) { if (InternalDictionary.TryGetValue(key, out var candidateValue) && !KeyHasExpired(key)) { value = candidateValue; return(true); } value = default; return(false); }
/// <summary> /// Construct a new instance of the GroupManager class /// </summary> /// <param name="client">A reference to the current <seealso cref="GridClient"/> instance</param> public GroupManager(GridClient client) { Client = client; TempGroupMembers = new InternalDictionary<UUID, Dictionary<UUID, GroupMember>>(); GroupMembersRequests = new List<UUID>(); TempGroupRoles = new InternalDictionary<UUID, Dictionary<UUID, GroupRole>>(); GroupRolesRequests = new List<UUID>(); TempGroupRolesMembers = new InternalDictionary<UUID, List<KeyValuePair<UUID, UUID>>>(); GroupRolesMembersRequests = new List<UUID>(); GroupName2KeyCache = new InternalDictionary<UUID, string>(); Client.Self.IM += Self_IM; Client.Network.RegisterEventCallback("AgentGroupDataUpdate", new Caps.EventQueueCallback(AgentGroupDataUpdateMessageHandler)); // deprecated in simulator v1.27 Client.Network.RegisterCallback(PacketType.AgentDropGroup, AgentDropGroupHandler); Client.Network.RegisterCallback(PacketType.GroupTitlesReply, GroupTitlesReplyHandler); Client.Network.RegisterCallback(PacketType.GroupProfileReply, GroupProfileReplyHandler); Client.Network.RegisterCallback(PacketType.GroupMembersReply, GroupMembersHandler); Client.Network.RegisterCallback(PacketType.GroupRoleDataReply, GroupRoleDataReplyHandler); Client.Network.RegisterCallback(PacketType.GroupRoleMembersReply, GroupRoleMembersReplyHandler); Client.Network.RegisterCallback(PacketType.GroupActiveProposalItemReply, GroupActiveProposalItemHandler); Client.Network.RegisterCallback(PacketType.GroupVoteHistoryItemReply, GroupVoteHistoryItemHandler); Client.Network.RegisterCallback(PacketType.GroupAccountSummaryReply, GroupAccountSummaryReplyHandler); Client.Network.RegisterCallback(PacketType.CreateGroupReply, CreateGroupReplyHandler); Client.Network.RegisterCallback(PacketType.JoinGroupReply, JoinGroupReplyHandler); Client.Network.RegisterCallback(PacketType.LeaveGroupReply, LeaveGroupReplyHandler); Client.Network.RegisterCallback(PacketType.UUIDGroupNameReply, UUIDGroupNameReplyHandler); Client.Network.RegisterCallback(PacketType.EjectGroupMemberReply, EjectGroupMemberReplyHandler); Client.Network.RegisterCallback(PacketType.GroupNoticesListReply, GroupNoticesListReplyHandler); Client.Network.RegisterEventCallback("AgentDropGroup", new Caps.EventQueueCallback(AgentDropGroupMessageHandler)); }
public AssetDownload() : base() { nextPacket = 0; outOfOrderPackets = new InternalDictionary<int, byte[]>(); }
/// <summary> /// Construct a new instance of the SimParcelsDownloadedEventArgs class /// </summary> /// <param name="simulator">The simulator the parcel data was retrieved from</param> /// <param name="simParcels">The dictionary containing the parcel data</param> /// <param name="parcelMap">The multidimensional array containing a x,y grid mapped /// to each 64x64 parcel's LocalID.</param> public SimParcelsDownloadedEventArgs(Simulator simulator, InternalDictionary<int, Parcel> simParcels, int[,] parcelMap) { this.m_Simulator = simulator; this.m_Parcels = simParcels; this.m_ParcelMap = parcelMap; }
/// <summary> /// Group Management Routines, Methods and Packet Handlers /// </summary> /// <param name="client">A reference to the current <seealso cref="GridClient"/> instance</param> public GroupManager(LoggerInstance log, NetworkManager network, AgentManager self) { Log = log; Network = network; Self = self; GroupMembersCaches = new InternalDictionary<UUID, Dictionary<UUID, GroupMember>>(); GroupMembersRequests = new List<UUID>(); GroupRolesCaches = new InternalDictionary<UUID, Dictionary<UUID, GroupRole>>(); GroupRolesRequests = new List<UUID>(); GroupRolesMembersCaches = new InternalDictionary<UUID, List<KeyValuePair<UUID, UUID>>>(); GroupRolesMembersRequests = new List<UUID>(); GroupName2KeyCache = new InternalDictionary<UUID, string>(); Network.RegisterEventCallback("AgentGroupDataUpdate", new Caps.EventQueueCallback(AgentGroupDataUpdateHandler)); Network.RegisterCallback(PacketType.AgentDropGroup, new NetworkManager.PacketCallback(AgentDropGroupHandler)); Network.RegisterCallback(PacketType.GroupTitlesReply, new NetworkManager.PacketCallback(GroupTitlesHandler)); Network.RegisterCallback(PacketType.GroupProfileReply, new NetworkManager.PacketCallback(GroupProfileHandler)); Network.RegisterCallback(PacketType.GroupMembersReply, new NetworkManager.PacketCallback(GroupMembersHandler)); Network.RegisterCallback(PacketType.GroupRoleDataReply, new NetworkManager.PacketCallback(GroupRoleDataHandler)); Network.RegisterCallback(PacketType.GroupRoleMembersReply, new NetworkManager.PacketCallback(GroupRoleMembersHandler)); Network.RegisterCallback(PacketType.GroupActiveProposalItemReply, new NetworkManager.PacketCallback(GroupActiveProposalItemHandler)); Network.RegisterCallback(PacketType.GroupVoteHistoryItemReply, new NetworkManager.PacketCallback(GroupVoteHistoryItemHandler)); Network.RegisterCallback(PacketType.GroupAccountSummaryReply, new NetworkManager.PacketCallback(GroupAccountSummaryHandler)); Network.RegisterCallback(PacketType.CreateGroupReply, new NetworkManager.PacketCallback(CreateGroupReplyHandler)); Network.RegisterCallback(PacketType.JoinGroupReply, new NetworkManager.PacketCallback(JoinGroupReplyHandler)); Network.RegisterCallback(PacketType.LeaveGroupReply, new NetworkManager.PacketCallback(LeaveGroupReplyHandler)); Network.RegisterCallback(PacketType.UUIDGroupNameReply, new NetworkManager.PacketCallback(UUIDGroupNameReplyHandler)); Network.RegisterCallback(PacketType.EjectGroupMemberReply, new NetworkManager.PacketCallback(EjectGroupMemberReplyHandler)); Network.RegisterCallback(PacketType.GroupNoticesListReply, new NetworkManager.PacketCallback(GroupNoticesListReplyHandler)); }
/// <summary> /// Process incoming avatar animations /// </summary> /// <param name="packet"></param> /// <param name="sim"></param> private void AvatarAnimationHandler(Packet packet, Simulator sim) { if (OnAvatarAnimation != null) { AvatarAnimationPacket anims = (AvatarAnimationPacket)packet; InternalDictionary<UUID, int> signaledAnims = new InternalDictionary<UUID, int>(); for(int i=0; i < anims.AnimationList.Length; i++) signaledAnims.Add(anims.AnimationList[i].AnimID, anims.AnimationList[i].AnimSequenceID); try { OnAvatarAnimation(anims.Sender.ID, signaledAnims); } catch (Exception e) { Logger.Log(e.Message, Helpers.LogLevel.Error, Client, e); } } }
/// <summary> /// Construct a new instance of the AnimationsChangedEventArgs class /// </summary> /// <param name="agentAnimations">The dictionary that contains the changed animations</param> public AnimationsChangedEventArgs(InternalDictionary<UUID, int> agentAnimations) { this.m_Animations = agentAnimations; }
public static RegionParcel[] parcelsFromList(InternalDictionary<int, Parcel> ps) { List<RegionParcel> parcels = new List<RegionParcel>(); ps.ForEach(delegate(Parcel p) { }); return parcels.ToArray(); }
public virtual void Avatars_OnAvatarAnimation(UUID agentID, InternalDictionary<UUID, int> agentAnimations) { OnEvent("On-Avatar-Animation", paramNamesOnAvatarAnimation, paramTypesOnAvatarAnimation, agentID, agentAnimations); }
public ScriptHost(InternalDictionary<Delegate> methods, Logger logger, Action<string, object[]> scriptRunner) { this.methods = methods; this.logger = logger; this.scriptRunner = scriptRunner; }
void Parcels_OnSimParcelsDownloaded(Simulator simulator, InternalDictionary<int, Parcel> simParcels, int[,] parcelMap) { lock (totalPrimsLock) { totalPrims = 0; simParcels.ForEach( delegate(Parcel parcel) { totalPrims += parcel.TotalPrims; }); if (Program.Verbosity > 0) Logger.Log(String.Format("Counted {0} total prims in this simulator", totalPrims), Helpers.LogLevel.Info); } }
/// public UUID CurrentAmin = UUID.Zero; /// <summary> /// Nephrael Rae: [on-object-animation '(avatar "Candie Brooks") "TALK"][on-object-animation '(avatar "Candie Brooks") "STAND_1"][on-object-animation '(avatar "Candie Brooks") "e45fbdc9-af8f-9408-f742-fcb8c341d2c8"] /// </summary> /// <param name="anims"></param> public void OnAvatarAnimations(List<Animation> anims0) { var anims = new InternalDictionary<UUID, int>(); var animDict = CogbotHelpers.DictOf(anims); foreach (var list in anims0) { animDict[list.AnimationID] = list.AnimationSequence; } Dictionary<UUID, int> RemovedAnims = new Dictionary<UUID, int>(); Dictionary<UUID, int> AddedAnims = new Dictionary<UUID, int>(); bool SendAnimEvent = !WorldObjects.UseNewEventSystem; //if (!theAvatar.Name.Contains("rael")) return; lock (ExpectedCurrentAnims) { int mostCurrentSequence = int.MinValue; int leastCurrentSequence = int.MaxValue; Dictionary<UUID, int> dictionary = CogbotHelpers.DictOf(ExpectedCurrentAnims);//.Dictionary; GetSequenceNumbers(dictionary, ref leastCurrentSequence, ref mostCurrentSequence); /// first time so find the lowest number int mostCurrentSequence1 = int.MinValue; int leastCurrentSequence1 = int.MaxValue; GetSequenceNumbers(animDict, ref leastCurrentSequence1, ref mostCurrentSequence1); //UUID mostCurrentAnim = UUID.Zero;// = UUID.Zero; /// List<String> names = new List<String>(); Dictionary<UUID, int> RemovedThisEvent = new Dictionary<UUID, int>(dictionary); anims.ForEach(delegate(UUID key) { RemovedThisEvent.Remove(key); int newAnimNumber; anims.TryGetValue(key, out newAnimNumber); if (newAnimNumber >= mostCurrentSequence) { mostCurrentSequence = newAnimNumber; WorldObjects.GridMaster.EnqueueRequestAsset(key, AssetType.Animation, true); //mostCurrentAnim = key; } if (ExpectedCurrentAnims.ContainsKey(key)) { int oldAnimNumber; ExpectedCurrentAnims.TryGetValue(key, out oldAnimNumber); if (oldAnimNumber == newAnimNumber) /// still the same { AddedAnims.Remove(key); RemovedAnims.Remove(key); return; } if (oldAnimNumber > newAnimNumber) { // Debug("error oldAnimNumber > newAnimNumber"); } /// else { if (oldAnimNumber + 1 != newAnimNumber) { RemovedAnims[key] = oldAnimNumber + 1; AddedAnims[key] = newAnimNumber; } } return; } AddedAnims[key] = newAnimNumber; /// AddedAnims.Add(key, newAnimNumber); RemovedAnims.Remove(key); /// int whenSeq = newAnimNumber + 1; /// if (!RemovedAnimsWhen.ContainsKey(whenSeq)) /// { /// RemovedAnimsWhen[whenSeq] = new List<UUID>(); /// } /// RemovedAnimsWhen[whenSeq].Add(key); }); List<UUID> shownRemoved = new List<UUID>(); List<UUID> showAdded = new List<UUID>(); Dictionary<UUID, int> AddedThisEvent = new Dictionary<UUID, int>(AddedAnims); foreach (UUID key in RemovedThisEvent.Keys) { dictionary.Remove(key); } foreach (UUID list in RemovedAnims.Keys) { if (RemovedThisEvent.ContainsKey(list)) { RemovedThisEvent.Remove(list); } } List<CogbotEvent> startStops = new List<CogbotEvent>(); //if (SimAnimationStore.IsSitAnim(RemovedThisEvent)) { // if (!SimAnimationStore.IsSitAnim(AddedThisEvent)) // { // LogEvent(new SimObjectEvent("StandUp", SimEventType.ANIM, this, ZHeading * SimPathStore.RAD2DEG, GetSimulator().Name, GetSimPosition())); // } //} //start or stop moving Dictionary<UUID, int> RemovedThisEventUnsent = new Dictionary<UUID, int>(RemovedThisEvent); Dictionary<UUID, int> AddedThisEventUnsent = new Dictionary<UUID, int>(AddedThisEvent); if (mergeEvents) { StartOrStopAnimEvent(RemovedThisEventUnsent, AddedThisEventUnsent, "Movement-TranslationProcess", startStops); StartOrStopAnimEvent(RemovedThisEventUnsent, AddedThisEventUnsent, "Jumping", startStops); StartOrStopAnimEvent(RemovedThisEventUnsent, AddedThisEventUnsent, "SittingDown", startStops); StartOrStopAnimEvent(RemovedThisEventUnsent, AddedThisEventUnsent, "StandingStill", startStops); // start or stop flying StartOrStopAnimEvent(RemovedThisEventUnsent, AddedThisEventUnsent, "Flying", startStops); //start or stop sleeping StartOrStopAnimEvent(RemovedThisEventUnsent, AddedThisEventUnsent, "Lying-Physical", startStops); //start or stop talking //StartOrStopAnimEvent(RemovedThisEvent, AddedThisEvent, SimAnimationStore.IsCommunationAnim, "Commuincation", SimEventType.ANIM, startStops); // StartOrStopAnimEvent(RemovedThisEvent, AddedThisEvent, "OtherAnim", startStops); foreach (CogbotEvent evt in startStops) { if (evt.Verb == "Flying") { LastEventByName[evt.EventName] = evt; if (evt.IsEventType(SimEventType.Start)) continue; } if (evt.Verb == "StandingStill") { LastEventByName[evt.EventName] = evt; //continue; } if (evt.Verb == "SittingDown") { LastEventByName[evt.EventName] = evt; //continue; } if (evt.EventName == "Movement-TranslationProcess-Start") { LastEventByName[evt.EventName] = evt; //lastEvent = evt; //continue; } //if (evt.EventName == "MovingStop") //{ // object old = GetLastEvent("MovingStart", 2); // evt.Verb = "MoveTo"; //} if (evt.IsEventType(SimEventType.Start)) { SetPosture(evt); } // LogEvent(evt); } } for (int seq = leastCurrentSequence; seq <= mostCurrentSequence; seq++) { if (RemovedAnims.Count > 0) { foreach (KeyValuePair<UUID, int> uuid in RemovedAnims) { if (seq == uuid.Value) { if (RemovedThisEventUnsent.ContainsKey(uuid.Key)) { var evt = AnimEvent(uuid.Key, SimEventType.Stop, seq); bool sent = LogEvent(evt); if (!sent && ShouldEventSource) { WorldSystem.SendPipelineEvent(evt); } shownRemoved.Add(uuid.Key); } } } } if (AddedAnims.Count > 0) { foreach (KeyValuePair<UUID, int> uuid in AddedAnims) { if (seq == uuid.Value) { if (AddedThisEventUnsent.ContainsKey(uuid.Key)) { var evt = AnimEvent(uuid.Key, SimEventType.Start, seq); bool sent = LogEvent(evt); if (!sent && ShouldEventSource) { WorldSystem.SendPipelineEvent(evt); } showAdded.Add(uuid.Key); } } } } } leastCurrentSequence = mostCurrentSequence; foreach (UUID key in shownRemoved) { RemovedThisEvent.Remove(key); RemovedAnims.Remove(key); } if (SimAssetStore.IsSitAnim(showAdded)) { } foreach (UUID key in showAdded) { AddedAnims.Remove(key); } } //ExpectedCurrentAnims.Dictionary.Clear(); var before = CogbotHelpers.DictOf(ExpectedCurrentAnims); lock (before) { before.Clear(); anims.ForEach(kv => before.Add(kv.Key, kv.Value)); } /// String newName = WorldSystem.GetAnimationName(mostCurrentAnim); /// { /// if (oldAnim != mostCurrentAnim) /// { /// String oldName = WorldSystem.GetAnimationName(oldAnim); /// if (oldName.Length > 4 && newName.Length > 4 && /// oldName.Substring(0, 5) == newName.Substring(0, 5)) /// { /// } /// else /// WorldSystem.SendNewEvent("On-Object-Start-Animation", this, newName); /// } /// } /// else /// { /// WorldSystem.SendNewEvent("On-Object-Start-Animation", this, newName); /// } /// CurrentAmin = mostCurrentAnim; /// SendNewEvent("On-Avatar-Animation", avatar, names); }
/// <summary> /// /// </summary> /// <param name="client"></param> public GroupManager(SecondLife client) { Client = client; GroupMembersCaches = new Dictionary<LLUUID, Dictionary<LLUUID, GroupMember>>(); GroupRolesCaches = new Dictionary<LLUUID, Dictionary<LLUUID, GroupRole>>(); GroupRolesMembersCaches = new Dictionary<LLUUID, List<KeyValuePair<LLUUID, LLUUID>>>(); GroupName2KeyCache = new InternalDictionary<LLUUID, string>(); Client.Network.RegisterCallback(PacketType.AgentGroupDataUpdate, new NetworkManager.PacketCallback(GroupDataHandler)); Client.Network.RegisterCallback(PacketType.AgentDropGroup, new NetworkManager.PacketCallback(AgentDropGroupHandler)); Client.Network.RegisterCallback(PacketType.GroupTitlesReply, new NetworkManager.PacketCallback(GroupTitlesHandler)); Client.Network.RegisterCallback(PacketType.GroupProfileReply, new NetworkManager.PacketCallback(GroupProfileHandler)); Client.Network.RegisterCallback(PacketType.GroupMembersReply, new NetworkManager.PacketCallback(GroupMembersHandler)); Client.Network.RegisterCallback(PacketType.GroupRoleDataReply, new NetworkManager.PacketCallback(GroupRoleDataHandler)); Client.Network.RegisterCallback(PacketType.GroupRoleMembersReply, new NetworkManager.PacketCallback(GroupRoleMembersHandler)); Client.Network.RegisterCallback(PacketType.GroupActiveProposalItemReply, new NetworkManager.PacketCallback(GroupActiveProposalItemHandler)); Client.Network.RegisterCallback(PacketType.GroupVoteHistoryItemReply, new NetworkManager.PacketCallback(GroupVoteHistoryItemHandler)); Client.Network.RegisterCallback(PacketType.GroupAccountSummaryReply, new NetworkManager.PacketCallback(GroupAccountSummaryHandler)); Client.Network.RegisterCallback(PacketType.GroupAccountDetailsReply, new NetworkManager.PacketCallback(GroupAccountDetailsHandler)); Client.Network.RegisterCallback(PacketType.GroupAccountTransactionsReply, new NetworkManager.PacketCallback(GroupAccountTransactionsHandler)); Client.Network.RegisterCallback(PacketType.CreateGroupReply, new NetworkManager.PacketCallback(CreateGroupReplyHandler)); Client.Network.RegisterCallback(PacketType.JoinGroupReply, new NetworkManager.PacketCallback(JoinGroupReplyHandler)); Client.Network.RegisterCallback(PacketType.LeaveGroupReply, new NetworkManager.PacketCallback(LeaveGroupReplyHandler)); Client.Network.RegisterCallback(PacketType.UUIDGroupNameReply, new NetworkManager.PacketCallback(UUIDGroupNameReplyHandler)); }
public override void InitPlugin() { registeredHandlers = RegisterHandlers(); }
public static RegionAgent[] agentsFromList(InternalDictionary<UUID, Vector3> avs) { List<RegionAgent> agents = new List<RegionAgent>(); avs.ForEach(delegate(KeyValuePair<UUID, Vector3> pair) { agents.Add(new RegionAgent(pair.Key, pair.Value)); }); return agents.ToArray(); }