private void OnInstantMessage(IClientAPI remoteClient, GridInstantMessage im) { if (m_debugEnabled) { m_log.DebugFormat("[GROUPS-MESSAGING]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); DebugGridInstantMessage(im); } UUID GroupID = new UUID(im.imSessionID); UUID AgentID = new UUID(im.fromAgentID); // Start group IM session if ((im.dialog == (byte)InstantMessageDialog.SessionGroupStart)) { if (m_debugEnabled) { m_log.InfoFormat("[GROUPS-MESSAGING]: imSessionID({0}) toAgentID({1})", im.imSessionID, im.toAgentID); } GroupRecord groupInfo = m_groupData.GetGroupRecord(UUID.Zero, GroupID, null); if (groupInfo != null) { m_groupData.AgentInvitedToGroupChatSession(AgentID, GroupID); ChatterBoxSessionStartReplyViaCaps(remoteClient, groupInfo.GroupName, GroupID); // we need to send here a list of known participants. im.dialog = (byte)InstantMessageDialog.SessionAdd; SendMessageToGroup(im, GroupID); } } // Send a message from locally connected client to a group if ((im.dialog == (byte)InstantMessageDialog.SessionSend)) { if (m_debugEnabled) { m_log.DebugFormat("[GROUPS-MESSAGING]: Send message to session for group {0} with session ID {1}", GroupID, im.imSessionID.ToString()); } //If this agent is sending a message, then they want to be in the session m_groupData.AgentInvitedToGroupChatSession(AgentID, GroupID); SendMessageToGroup(im, GroupID); } if ((im.dialog == (byte)InstantMessageDialog.SessionDrop)) { if (m_debugEnabled) { m_log.DebugFormat("[GROUPS-MESSAGING]: Send message to session for group {0} with session ID {1}", GroupID, im.imSessionID.ToString()); } m_groupData.AgentDroppedFromGroupChatSession(AgentID, GroupID); SendMessageToGroup(im, GroupID); } }
private static void TestGroupValues(JObject json, GroupRecord group) { foreach (var element in group.elements) { if (element is MainRecord rec) { var key = rec.fileFormId.ToString("X8"); CheckKey(json, key, group); TestRecordValues(json.Value <JObject>(key), rec); json.Remove(key); } else if (element is GroupRecord innerGroup) { if (innerGroup.isChildGroup) { return; } var key = innerGroup.name; CheckKey(json, key, group); TestGroupValues(json.Value <JObject>(key), innerGroup); json.Remove(key); } } ExpectAllPropertiesFound(json, group); }
public void CalculateDistance_ReturnDistanceBetweenTwoPoints() { try { #region Arrange double expected = 3; double actual = 0; GroupRecord group = new GroupRecord(); group.LocationX = 6; group.LocationY = 6; WellRecord well = new WellRecord(); well.TopX = 5; well.TopY = 3; #endregion #region Act actual = validateRecord.CalculateDistance(group.LocationX, group.LocationY, well.TopX, well.TopY); #endregion #region Assert Assert.IsTrue(actual > expected); #endregion } catch (Exception ex) { Assert.Fail(ex.Message); } finally { } }
public GroupRecord GetGroupRecord(UUID requestingAgentID, UUID groupID, string groupName) { m_log.DebugFormat( "[MOCK GROUPS SERVICES CONNECTOR]: Processing GetGroupRecord() for groupID {0}, name {1}", groupID, groupName); XGroup xg = GetXGroup(groupID, groupName); if (xg == null) { return(null); } GroupRecord gr = new GroupRecord() { GroupID = xg.groupID, GroupName = xg.name, AllowPublish = xg.allowPublish, MaturePublish = xg.maturePublish, Charter = xg.charter, FounderID = xg.founderID, // FIXME: group picture storage location unknown MembershipFee = xg.membershipFee, OpenEnrollment = xg.openEnrollment, OwnerRoleID = xg.ownerRoleID, ShowInList = xg.showInList }; return(gr); }
private static string GetSubDesc(this GroupRecord rec) { var recdata = rec.GetReadonlyData(); switch (rec.groupType) { case 0: return("(Contains: " + (char)recdata[0] + (char)recdata[1] + (char)recdata[2] + (char)recdata[3] + ")"); case 2: case 3: return("(Block number: " + (recdata[0] + recdata[1] * 256 + recdata[2] * 256 * 256 + recdata[3] * 256 * 256 * 256).ToString() + ")"); case 4: case 5: return("(Coordinates: [" + (recdata[0] + recdata[1] * 256) + ", " + recdata[2] + recdata[3] * 256 + "])"); case 1: case 6: case 7: case 8: case 9: case 10: return("(Parent FormID: 0x" + recdata[3].ToString("x2") + recdata[2].ToString("x2") + recdata[1].ToString("x2") + recdata[0].ToString("x2") + ")"); } return(null); }
/// <summary> /// Check that the required groups structure is in place. /// </summary> /// <exception cref="GroupsException">Thrown if there is something wrong with the groups setup</exception> public void CheckForRequiredSetup() { if (!WaterWarsConstants.ENABLE_GROUPS) { return; } if (null == m_groupsModule) { m_groupsModule = m_controller.Scenes[0].RequestModuleInterface <IGroupsModule>(); if (null == m_groupsModule) { throw new GroupsSetupException("No groups module present on server"); } } if (null == m_groupsMessagingModule) { m_groupsMessagingModule = m_controller.Scenes[0].RequestModuleInterface <IGroupsMessagingModule>(); if (null == m_groupsMessagingModule) { throw new GroupsSetupException("No groups messaging module present on server"); } } if (null == WaterWarsGroup) { WaterWarsGroup = GetGroup(WaterWarsConstants.GROUP_NAME); } if (null == WaterWarsAdminGroup) { WaterWarsAdminGroup = GetGroup(WaterWarsConstants.ADMIN_GROUP_NAME); } m_systemAccount = m_controller.Scenes[0].UserAccountService.GetUserAccount( UUID.Zero, WaterWarsConstants.SYSTEM_PLAYER_FIRST_NAME, WaterWarsConstants.SYSTEM_PLAYER_LAST_NAME); string name = string.Format( "{0} {1}", WaterWarsConstants.SYSTEM_PLAYER_FIRST_NAME, WaterWarsConstants.SYSTEM_PLAYER_LAST_NAME); if (null == m_systemAccount) { throw new GroupsSetupException( string.Format( "System player {0} not present. Please create this player before restarting OpenSim", name)); } if (!IsPlayerInRequiredGroup(m_systemAccount)) { throw new GroupsSetupException( string.Format( "System player {0} is not in group {1}. Please correct this.", name, WaterWarsGroup.GroupName)); } }
public override dynamic ConvertLabel(GroupRecord group, byte[] label) { return(FormId.FromSource( group.file, BitConverter.ToUInt32(label) )); }
public override dynamic ConvertLabel(GroupRecord group, byte[] label) { return(new Int16[2] { BitConverter.ToInt16(label), BitConverter.ToInt16(label, 2) }); }
public string GroupsEditGetRequest(Environment env, UUID groupID) { m_log.DebugFormat("[Wifi]: GroupsEditGetRequest {0}", groupID); Request request = env.TheRequest; SessionInfo sinfo; if (TryGetSessionInfo(request, out sinfo) && (sinfo.Account.UserLevel >= m_WebApp.AdminUserLevel)) { if (m_GroupsService != null) { env.Session = sinfo; env.Flags = Flags.IsLoggedIn | Flags.IsAdmin; env.State = State.GroupEditForm; GroupRecord group = m_GroupsService.GetGroupRecord(groupID); if (group != null) { List <object> loo = new List <object>(); loo.Add(group); env.Data = loo; } } else { m_log.WarnFormat("[Wifi]: No Groups service"); } return(WebAppUtils.PadURLs(env, sinfo.Sid, m_WebApp.ReadFile(env, "index.html"))); } return(m_WebApp.ReadFile(env, "index.html")); }
private void GetOwnerName(UUID ownerID, out string ownerFirstName, out string ownerLastName) { ownerFirstName = string.Empty; ownerLastName = string.Empty; string username = m_scene.UserManagementModule.GetUserName(ownerID); if (!string.IsNullOrEmpty(username) && !username.StartsWith("UnknownUMM2", StringComparison.InvariantCulture)) { string[] parts = username.Split(' '); ownerFirstName = parts[0]; if (parts.Length > 1) { ownerLastName = parts[1]; } } else { IGroupsModule groups = m_scene.RequestModuleInterface <IGroupsModule>(); if (groups != null) { GroupRecord grprec = groups.GetGroupRecord(ownerID); if (grprec != null && !string.IsNullOrEmpty(grprec.GroupName)) { ownerFirstName = grprec.GroupName; } } } if (string.IsNullOrEmpty(ownerFirstName)) { ownerFirstName = "(unknown)"; ownerLastName = string.Empty; } }
private void OnInstantMessage(IClientAPI remoteClient, GridInstantMessage im) { if (m_debugEnabled) { m_log.DebugFormat("[Groups.Messaging]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); DebugGridInstantMessage(im); } // Start group IM session if ((im.dialog == (byte)InstantMessageDialog.SessionGroupStart)) { if (m_debugEnabled) { m_log.InfoFormat("[Groups.Messaging]: imSessionID({0}) toAgentID({1})", im.imSessionID, im.toAgentID); } UUID GroupID = new UUID(im.imSessionID); UUID AgentID = new UUID(im.fromAgentID); GroupRecord groupInfo = m_groupData.GetGroupRecord(UUID.Zero.ToString(), GroupID, null); if (groupInfo != null) { AgentInvitedToGroupChatSession(AgentID.ToString(), GroupID); ChatterBoxSessionStartReplyViaCaps(remoteClient, groupInfo.GroupName, GroupID); IEventQueue queue = remoteClient.Scene.RequestModuleInterface <IEventQueue>(); queue.ChatterBoxSessionAgentListUpdates( GroupID , AgentID , new UUID(im.toAgentID) , false //canVoiceChat , false //isModerator , false //text mute , true ); } } // Send a message from locally connected client to a group if ((im.dialog == (byte)InstantMessageDialog.SessionSend)) { UUID GroupID = new UUID(im.imSessionID); UUID AgentID = new UUID(im.fromAgentID); if (m_debugEnabled) { m_log.DebugFormat("[Groups.Messaging]: Send message to session for group {0} with session ID {1}", GroupID, im.imSessionID.ToString()); } //If this agent is sending a message, then they want to be in the session AgentInvitedToGroupChatSession(AgentID.ToString(), GroupID); SendMessageToGroup(im, GroupID); } }
private void HandleOnInstantMessage(IClientAPI client, GridInstantMessage msg) { // m_log.DebugFormat( // "[EVENT RECORDER]: Handling IM from {0} {1}, type {2}", // client.Name, client.AgentId, (InstantMessageDialog)msg.dialog); if (msg.dialog != (byte)InstantMessageDialog.MessageFromAgent && msg.dialog != (byte)InstantMessageDialog.SessionSend) { return; } bool toGroup = msg.dialog == (byte)InstantMessageDialog.SessionSend; if (toGroup) { if (!RecordUserToGroupImEvents) { return; } } else { if (!RecordUserToUserImEvents) { return; } } string receiverName = "UNKNOWN"; UUID receiverId; if (toGroup) { receiverId = new UUID(msg.imSessionID); if (m_groupsModule != null) { GroupRecord gr = m_groupsModule.GetGroupRecord(receiverId); if (gr != null) { receiverName = gr.GroupName; } } } else { receiverId = new UUID(msg.fromAgentID); receiverName = m_userManagementModule.GetUserName(new UUID(msg.toAgentID)); } m_recorder.RecordEvent( new UserImEvent( new UUID(msg.fromAgentID), msg.fromAgentName, receiverId, receiverName, toGroup, msg.message, m_gridId, client.Scene.Name)); }
public static string GetDesc(this GroupRecord rec) { string desc = "[Record group]" + Environment.NewLine + "Record type: "; switch (rec.groupType) { case 0: desc += "Top " + rec.GetSubDesc(); break; case 1: desc += "World children " + rec.GetSubDesc(); break; case 2: desc += "Interior Cell Block " + rec.GetSubDesc(); break; case 3: desc += "Interior Cell Sub-Block " + rec.GetSubDesc(); break; case 4: desc += "Exterior Cell Block " + rec.GetSubDesc(); break; case 5: desc += "Exterior Cell Sub-Block " + rec.GetSubDesc(); break; case 6: desc += "Cell Children " + rec.GetSubDesc(); break; case 7: desc += "Topic Children " + rec.GetSubDesc(); break; case 8: desc += "Cell Persistent Children " + rec.GetSubDesc(); break; case 9: desc += "Cell Temporary Children " + rec.GetSubDesc(); break; case 10: desc += "Cell Visible Distant Children " + rec.GetSubDesc(); break; default: desc += "Unknown"; break; } return(desc + Environment.NewLine + "Records: " + rec.Records.Count.ToString() + Environment.NewLine + "Size: " + rec.Size.ToString() + " bytes (including header)"); }
public async Task <GroupRecord> getGroup(byte[] groupId) { var query = conn.Table <Group>().Where(v => v.group_id == GroupUtil.getEncodedId(groupId)); Reader reader = new Reader(query.ToList()); GroupRecord record = reader.getNext(); reader.close(); return(record); }
/// <summary> /// Updates the userpicks /// </summary> /// <param name='remoteClient'> /// Remote client. /// </param> /// <param name='pickID'> /// Pick I. /// </param> /// <param name='creatorID'> /// the creator of the pick /// </param> /// <param name='topPick'> /// Top pick. /// </param> /// <param name='name'> /// Name. /// </param> /// <param name='desc'> /// Desc. /// </param> /// <param name='snapshotID'> /// Snapshot I. /// </param> /// <param name='sortOrder'> /// Sort order. /// </param> /// <param name='enabled'> /// Enabled. /// </param> public void PickInfoUpdate(IClientAPI remoteClient, UUID pickID, UUID creatorID, bool topPick, string name, string desc, UUID snapshotID, int sortOrder, bool enabled) { m_log.DebugFormat("[PROFILES]: Start PickInfoUpdate Name: {0} PickId: {1} SnapshotId: {2}", name, pickID.ToString(), snapshotID.ToString()); UserProfilePick pick = new UserProfilePick(); string serverURI = string.Empty; GetUserProfileServerURI(remoteClient.AgentId, out serverURI); ScenePresence p = FindPresence(remoteClient.AgentId); Vector3 avaPos = p.AbsolutePosition; // Getting the global position for the Avatar Vector3 posGlobal = new Vector3(remoteClient.Scene.RegionInfo.RegionLocX * Constants.RegionSize + avaPos.X, remoteClient.Scene.RegionInfo.RegionLocY * Constants.RegionSize + avaPos.Y, avaPos.Z); string landOwnerName = string.Empty; ILandObject land = p.Scene.LandChannel.GetLandObject(avaPos.X, avaPos.Y); if (land.LandData.IsGroupOwned) { IGroupsModule groupMod = p.Scene.RequestModuleInterface <IGroupsModule>(); UUID groupId = land.LandData.GroupID; GroupRecord groupRecord = groupMod.GetGroupRecord(groupId); landOwnerName = groupRecord.GroupName; } else { IUserAccountService accounts = p.Scene.RequestModuleInterface <IUserAccountService>(); UserAccount user = accounts.GetUserAccount(p.Scene.RegionInfo.ScopeID, land.LandData.OwnerID); landOwnerName = user.Name; } pick.PickId = pickID; pick.CreatorId = creatorID; pick.TopPick = topPick; pick.Name = name; pick.Desc = desc; pick.ParcelId = p.currentParcelUUID; pick.SnapshotId = snapshotID; pick.User = landOwnerName; pick.SimName = remoteClient.Scene.RegionInfo.RegionName; pick.GlobalPos = posGlobal.ToString(); pick.SortOrder = sortOrder; pick.Enabled = enabled; object Pick = (object)pick; if (!JsonRpcRequest(ref Pick, "picks_update", serverURI, UUID.Random().ToString())) { remoteClient.SendAgentAlertMessage( "Error updating pick", false); } m_log.DebugFormat("[PROFILES]: Finish PickInfoUpdate {0} {1}", pick.Name, pick.PickId.ToString()); }
private void AddAgentToSession(UUID AgentID, UUID GroupID, GridInstantMessage msg) { if (m_log.IsDebugEnabled) { m_log.DebugFormat("[GroupsMessagingModule]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); } // Agent not in session and hasn't dropped from session // Add them to the session for now, and Invite them AgentInvitedToGroupChatSession(AgentID.ToString(), GroupID); IClientAPI activeClient = GetActiveClient(AgentID); if (activeClient != null) { GroupRecord groupInfo = m_groupData.GetGroupRecord(UUID.Zero.ToString(), GroupID, null); if (groupInfo != null) { if (m_log.IsDebugEnabled) { m_log.DebugFormat("[GroupsMessagingModule]: Sending chatterbox invite instant message"); } // Force? open the group session dialog??? // and simultanously deliver the message, so we don't need to do a seperate client.SendInstantMessage(msg); IEventQueue eq = activeClient.Scene.RequestModuleInterface <IEventQueue>(); eq.ChatterboxInvitation( GroupID , groupInfo.GroupName , new UUID(msg.fromAgentID) , msg.message , AgentID , msg.fromAgentName , msg.dialog , msg.timestamp , msg.offline == 1 , (int)msg.ParentEstateID , msg.Position , 1 , new UUID(msg.imSessionID) , msg.fromGroup , OpenMetaverse.Utils.StringToBytes(groupInfo.GroupName) ); eq.ChatterBoxSessionAgentListUpdates( new UUID(GroupID) , AgentID , new UUID(msg.toAgentID) , false //canVoiceChat , false //isModerator , false //text mute ); } } }
public bool IsWellGroupChild(GroupRecord group, WellRecord well) { double distance = CalculateDistance(group.LocationX, group.LocationY, well.TopX, well.TopY); if (distance <= group.Radius) //well inside group { return(true); } return(false); }
/// <summary> /// Get the given group. /// </summary> /// <exception cref="GroupsSetupException">Thrown if the group cannot be found</exception> /// <param name="groupName"></param> protected GroupRecord GetGroup(string groupName) { GroupRecord group = m_groupsModule.GetGroupRecord(groupName); if (null == group) { throw new GroupsSetupException( string.Format("Could not find group {0}. Please create it", groupName)); } return(group); }
internal void ReadGroups(PluginFile plugin) { var source = plugin.source; var endOffset = source.fileSize - 1; while (source.stream.Position < endOffset) { GroupRecord.Read(plugin, source); } plugin.internalElements.TrimExcess(); plugin.SortRecords(); }
private void OnInstantMessage(IClientAPI remoteClient, GridInstantMessage im) { if (m_debugEnabled) { m_log.DebugFormat("[GROUPS-MESSAGING]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); DebugGridInstantMessage(im); } // Start group IM session if ((im.dialog == (byte)InstantMessageDialog.SessionGroupStart)) { UUID groupID = new UUID(im.toAgentID); GroupRecord groupInfo = m_groupsModule.GetGroupRecord(groupID); if (groupInfo != null) { if (m_debugEnabled) { m_log.DebugFormat("[GROUPS-MESSAGING]: Start Group Session for {0}", groupInfo.GroupName); } AddAgentToGroupSession(im.fromAgentID, im.imSessionID); ChatterBoxSessionStartReplyViaCaps(remoteClient, groupInfo.GroupName, groupID); IEventQueue queue = remoteClient.Scene.RequestModuleInterface <IEventQueue>(); queue.ChatterBoxSessionAgentListUpdates( new UUID(groupID) , new UUID(im.fromAgentID) , new UUID(im.fromAgentID) , false //canVoiceChat , false //isModerator , false //text mute , im.dialog ); } } // Send a message from locally connected client to a group if ((im.dialog == (byte)InstantMessageDialog.SessionSend)) { UUID groupID = new UUID(im.toAgentID); if (m_debugEnabled) { m_log.DebugFormat("[GROUPS-MESSAGING]: Send message to session for group {0} with session ID {1}", groupID, im.imSessionID.ToString()); } SendMessageToGroup(remoteClient, im, groupID); } }
private void AddAgentToSession(UUID AgentID, UUID GroupID, GridInstantMessage msg) { // Agent not in session and hasn't dropped from session // Add them to the session for now, and Invite them AgentInvitedToGroupChatSession(AgentID.ToString(), GroupID); IClientAPI activeClient = GetActiveClient(AgentID); if (activeClient != null) { GroupRecord groupInfo = m_groupData.GetGroupRecord(UUID.Zero.ToString(), GroupID, null); if (groupInfo != null) { if (m_debugEnabled) { m_log.DebugFormat("[Groups.Messaging]: Sending chatterbox invite instant message"); } UUID fromAgent = new UUID(msg.fromAgentID); // Force? open the group session dialog??? // and simultanously deliver the message, so we don't need to do a seperate client.SendInstantMessage(msg); IEventQueue eq = activeClient.Scene.RequestModuleInterface <IEventQueue>(); if (eq != null) { eq.ChatterboxInvitation( GroupID , groupInfo.GroupName , fromAgent , msg.message , AgentID , msg.fromAgentName , msg.dialog , msg.timestamp , msg.offline == 1 , (int)msg.ParentEstateID , msg.Position , 1 , new UUID(msg.imSessionID) , msg.fromGroup , OpenMetaverse.Utils.StringToBytes(groupInfo.GroupName) ); var update = new GroupChatListAgentUpdateData(AgentID); var updates = new List <GroupChatListAgentUpdateData> { update }; eq.ChatterBoxSessionAgentListUpdates(GroupID, new UUID(msg.toAgentID), updates); } } } }
/// <summary> /// Look up the given user id to check whether it's one that is valid for this grid. /// </summary> /// <param name="uuid"></param> /// <returns></returns> private bool ResolveUserUuid(UUID uuid) { if (!m_validUserUuids.ContainsKey(uuid)) { try { UserProfileData profile = m_scene.CommsManager.UserService.GetUserProfile(uuid); if (profile != null) { m_validUserUuids.Add(uuid, true); } else { //what about group ids? GroupRecord grpRec = m_GroupsModule.GetGroupRecord(uuid); if (grpRec != null) { m_validUserUuids.Add(uuid, true); } else { m_validUserUuids.Add(uuid, false); } } } catch (UserProfileException) { //what about group ids? GroupRecord grpRec = m_GroupsModule.GetGroupRecord(uuid); if (grpRec != null) { m_validUserUuids.Add(uuid, true); } else { m_validUserUuids.Add(uuid, false); } } } if (m_validUserUuids[uuid]) { return(true); } else { return(false); } }
/** * @brief Allow any member of group given by config SetParcelMusicURLGroup to set music URL. * Code modelled after llSetParcelMusicURL(). * @param newurl = new URL to set (or "" to leave it alone) * @returns previous URL string */ public string xmrSetParcelMusicURLGroup(string newurl) { string groupname = m_ScriptEngine.Config.GetString("SetParcelMusicURLGroup", ""); if (groupname == "") { throw new ApplicationException("no SetParcelMusicURLGroup config param set"); } IGroupsModule igm = World.RequestModuleInterface <IGroupsModule> (); if (igm == null) { throw new ApplicationException("no GroupsModule loaded"); } GroupRecord grouprec = igm.GetGroupRecord(groupname); if (grouprec == null) { throw new ApplicationException("no such group " + groupname); } GroupMembershipData gmd = igm.GetMembershipData(grouprec.GroupID, m_host.OwnerID); if (gmd == null) { throw new ApplicationException("not a member of group " + groupname); } ILandObject land = World.LandChannel.GetLandObject(m_host.AbsolutePosition); if (land == null) { throw new ApplicationException("no land at " + m_host.AbsolutePosition.ToString()); } string oldurl = land.GetMusicUrl(); if (oldurl == null) { oldurl = ""; } if ((newurl != null) && (newurl != "")) { land.SetMusicUrl(newurl); } return(oldurl); }
public GroupEditor(GroupRecord gr) { this.gr=gr; InitializeComponent(); this.Icon=Properties.Resources.tesv_ico; cmbGroupType.ContextMenu=new ContextMenu(); cmbGroupType.SelectedIndex=(int)gr.groupType; tbRecType.Text=gr.ContentsType; byte[] data=gr.GetData(); tbX.Text=TypeConverter.h2ss(data[2], data[3]).ToString(); tbY.Text=TypeConverter.h2ss(data[0], data[1]).ToString(); tbBlock.Text=TypeConverter.h2i(data[0], data[1], data[2], data[3]).ToString(); tbParent.Text=TypeConverter.h2i(data[0], data[1], data[2], data[3]).ToString("X8"); tbDateStamp.Text=gr.dateStamp.ToString("X8"); tbFlags.Text=gr.flags.ToString("X8"); }
public GroupEditor(GroupRecord gr) { this.gr = gr; this.InitializeComponent(); Icon = Resources.tesv_ico; this.cmbGroupType.ContextMenu = new ContextMenu(); this.cmbGroupType.SelectedIndex = (int)gr.groupType; this.tbRecType.Text = gr.ContentsType; byte[] data = gr.GetData(); this.tbX.Text = TypeConverter.h2ss(data[2], data[3]).ToString(); this.tbY.Text = TypeConverter.h2ss(data[0], data[1]).ToString(); this.tbBlock.Text = TypeConverter.h2i(data[0], data[1], data[2], data[3]).ToString(); this.tbParent.Text = TypeConverter.h2i(data[0], data[1], data[2], data[3]).ToString("X8"); this.tbDateStamp.Text = gr.dateStamp.ToString("X8"); this.tbFlags.Text = gr.flags.ToString("X8"); }
static void Main(string[] args) { Console.WriteLine("Custom File Parser. v1.0. I owe Jeff for writing this....and Christmas is just around the corner....just saying."); Console.WriteLine("Hey Tom, what file am I parsing?"); var fileName = Console.ReadLine(); if (!File.Exists(fileName)) { Console.WriteLine("Try again dipshit, that file doesn't exist"); return; } var outputRecord = new List <GroupRecord>(); using (var reader = new StreamReader("JeffSample.csv")){ var currentgroup = string.Empty; while (!reader.EndOfStream) { var line = reader.ReadLine(); var values = line.Split(','); if (values.Count > 2 && values[0].IsNotNullOrEmpty()) { if (values[1].ToLowerInvariant == "group detail" || values[1].ToLowerInvariant) { continue; } if (values[0].ToLowerInvariant == "group #") { currentgroup = values[1]; continue; } try{ var groupRecord = new GroupRecord(values); outputRecord.Add(groupRecord); } catch (Exception ex) { Console.WriteLine("Well that sucked. I could not parse this line. Go fix it."); Console.WriteLine(values); Console.WriteLine($"And here is what I know {ex.Message}"); Console.ReadLine(); } } } } }
public GroupRecord GetGroupRecord(UUID requestingAgentID, UUID groupID, string groupName) { m_log.DebugFormat( "[MOCK GROUPS SERVICES CONNECTOR]: Processing GetGroupRecord() for groupID {0}, name {1}", groupID, groupName); XGroup[] groups; string field, val; if (groupID != UUID.Zero) { field = "groupID"; val = groupID.ToString(); } else { field = "name"; val = groupName; } groups = m_data.GetGroups(field, val); if (groups.Length == 0) { return(null); } XGroup xg = groups[0]; GroupRecord gr = new GroupRecord() { GroupID = xg.groupID, GroupName = xg.name, AllowPublish = xg.allowPublish, MaturePublish = xg.maturePublish, Charter = xg.charter, FounderID = xg.founderID, // FIXME: group picture storage location unknown MembershipFee = xg.membershipFee, OpenEnrollment = xg.openEnrollment, OwnerRoleID = xg.ownerRoleID, ShowInList = xg.showInList }; return(gr); }
internal void UpdateContainedIn(GroupRecord group, MainRecord rec) { if (group == null || !group.hasRecordParent) { return; } var parentRec = group.GetParentRecord(); var containedInDef = parentRec.mrDef.containedInDef; if (containedInDef == null) { return; } var element = (ValueElement)rec.FindElementForDef(containedInDef); element._data = FormId.FromSource(parentRec._file, parentRec.fileFormId); }
static OSDMap GroupRecord2OSDMap(GroupRecord group) { var resp = new OSDMap(); resp ["GroupID"] = group.GroupID; resp ["GroupName"] = group.GroupName; resp ["AllowPublish"] = group.AllowPublish; resp ["MaturePublish"] = group.MaturePublish; resp ["Charter"] = group.Charter; resp ["FounderID"] = group.FounderID; resp ["GroupPicture"] = group.GroupPicture; resp ["MembershipFee"] = group.MembershipFee; resp ["OpenEnrollment"] = group.OpenEnrollment; resp ["OwnerRoleID"] = group.OwnerRoleID; resp ["ShowInList"] = group.ShowInList; return(resp); }
/// <summary> /// Not really needed, but does confirm that the group exists. /// </summary> public bool StartGroupChatSession(UUID agentID, UUID groupID) { if (m_debugEnabled) { m_log.DebugFormat("[Groups.Messaging]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); } GroupRecord groupInfo = m_groupData.GetGroupRecord(agentID.ToString(), groupID, null); if (groupInfo != null) { return(true); } else { return(false); } }
public GroupMembershipData GetGroupMembershipData(UUID requestingAgentID, UUID GroupID, UUID AgentID) { GroupMembershipData GMD = new GroupMembershipData(); GroupRecord record = GetGroupRecord(requestingAgentID, GroupID, null); List <string> Membership = data.Query(new string[] { "GroupID", "AgentID" }, new object[] { GroupID, AgentID }, "osgroupmembership", "AcceptNotices, Contribution, ListInProfile, SelectedRoleID"); if (Membership.Count == 0) { return(null); } List <string> GroupRole = data.Query(new string[] { "GroupID", "RoleID" }, new object[] { GroupID, Membership[3] }, "osrole", "Title, Powers"); if (GroupRole.Count == 0) { return(null); } GMD.AcceptNotices = int.Parse(Membership[0]) == 1; //TODO: Figure out what this is and its effects if false GMD.Active = true; GMD.ActiveRole = UUID.Parse(Membership[3]); GMD.AllowPublish = record.AllowPublish; GMD.Charter = record.Charter; GMD.Contribution = int.Parse(Membership[1]); GMD.FounderID = record.FounderID; GMD.GroupID = record.GroupID; GMD.GroupName = record.GroupName; GMD.GroupPicture = record.GroupPicture; GMD.GroupPowers = ulong.Parse(GroupRole[1]); GMD.GroupTitle = GroupRole[0]; GMD.ListInProfile = int.Parse(Membership[2]) == 1; GMD.MaturePublish = record.MaturePublish; GMD.MembershipFee = record.MembershipFee; GMD.OpenEnrollment = record.OpenEnrollment; GMD.ShowInList = record.ShowInList; return(GMD); }
public GroupRecord GetGroupRecord(UUID requestingAgentID, UUID GroupID, string GroupName) { Dictionary<string, object> sendData = new Dictionary<string, object>(); sendData["METHOD"] = "GetGroupRecord"; sendData["requestingAgentID"] = requestingAgentID; sendData["GroupID"] = GroupID; sendData["GroupName"] = GroupName; string reqString = WebUtils.BuildXmlResponse(sendData); try { foreach (string m_ServerURI in m_ServerURIs) { string reply = SynchronousRestFormsRequester.MakeRequest("POST", m_ServerURI + "/auroradata", reqString); if (reply != string.Empty) { Dictionary<string, object> replyData = WebUtils.ParseXmlResponse(reply); if (replyData != null) { Dictionary<string, object>.ValueCollection replyvalues = replyData.Values; GroupRecord group = null; foreach (object f in replyvalues) { if (f is Dictionary<string, object>) { group = new GroupRecord((Dictionary<string, object>)f); } } // Success return group; } } } } catch (Exception e) { m_log.DebugFormat("[AuroraRemoteGroupsServiceConnector]: Exception when contacting server: {0}", e.ToString()); } return null; }
private static OSDMap GroupRecord2OSDMap(GroupRecord group) { OSDMap resp = new OSDMap(); resp["GroupID"] = group.GroupID; resp["GroupName"] = group.GroupName; resp["AllowPublish"] = group.AllowPublish; resp["MaturePublish"] = group.MaturePublish; resp["Charter"] = group.Charter; resp["FounderID"] = group.FounderID; resp["GroupPicture"] = group.GroupPicture; resp["MembershipFee"] = group.MembershipFee; resp["OpenEnrollment"] = group.OpenEnrollment; resp["OwnerRoleID"] = group.OwnerRoleID; resp["ShowInList"] = group.ShowInList; return resp; }
private void sanitizeToolStripMenuItem_Click(object sender, EventArgs e) { if (PluginTree.SelectedNode == null) { MessageBox.Show("No plugin selected", "Error"); return; } TreeNode tn = PluginTree.SelectedNode; while (!(tn.Tag is Plugin)) tn = tn.Parent; Plugin p = (Plugin)tn.Tag; Queue<Rec> toParse = new Queue<Rec>(p.Records); if (toParse.Count == 0 || toParse.Peek().Name != "TES4") { MessageBox.Show("Plugin lacks a vlid TES4 record. Cannot continue"); return; } tn.Nodes.Clear(); p.Records.Clear(); p.AddRecord(toParse.Dequeue()); Dictionary<string, GroupRecord> groups = new Dictionary<string, GroupRecord>(); GroupRecord gr; Record r2; foreach (string s in SanitizeOrder) { gr = new GroupRecord(s); p.Records.Add(gr); groups[s] = gr; } bool looseGroupsWarning = false; bool unknownRecordsWarning = false; while (toParse.Count > 0) { Rec r = toParse.Dequeue(); if (r is GroupRecord) { gr = (GroupRecord)r; if (gr.ContentsType == "CELL" || gr.ContentsType == "WRLD" || gr.ContentsType == "DIAL") { groups[gr.ContentsType].Records.AddRange(gr.Records); gr.Records.Clear(); } else { for (int i = 0; i < gr.Records.Count; i++) toParse.Enqueue(gr.Records[i]); gr.Records.Clear(); } } else { r2 = (Record)r; if (r2.Name == "CELL" || r2.Name == "WRLD" || r2.Name == "REFR" || r2.Name == "ACRE" || r2.Name == "ACHR" || r2.Name == "NAVM" || r2.Name == "DIAL" || r2.Name == "INFO") { looseGroupsWarning = true; p.AddRecord(r2); } else { if (groups.ContainsKey(r2.Name)) groups[r2.Name].AddRecord(r2); else { unknownRecordsWarning = true; p.AddRecord(r2); } } } } foreach (GroupRecord gr2 in groups.Values) { if (gr2.Records.Count == 0) p.DeleteRecord(gr2); } if (looseGroupsWarning) { MessageBox.Show("The subgroup structure of this plugins cell, world or dial records appears to be incorrect, and cannot be fixed automatically", "Warning"); } if (unknownRecordsWarning) { MessageBox.Show("The plugin contained records which were not recognised, and cannot be fixed automatically", "Warning"); } CreatePluginTree(p, tn); int reccount = -1; foreach (Rec r in p.Records) reccount += sanitizeCountRecords(r); if (p.Records.Count > 0 && p.Records[0].Name == "TES4") { Record tes4 = (Record)p.Records[0]; if (tes4.SubRecords.Count > 0 && tes4.SubRecords[0].Name == "HEDR" && tes4.SubRecords[0].Size >= 8) { byte[] data = tes4.SubRecords[0].GetData(); byte[] reccountbytes = TypeConverter.si2h(reccount); for (int i = 0; i < 4; i++) data[4 + i] = reccountbytes[i]; tes4.SubRecords[0].SetData(data); } } }
public List<GroupRecord> GetGroupRecords(UUID requestingAgentID, uint start, uint count, Dictionary<string, bool> sort, Dictionary<string, bool> boolFields) { string whereClause = "1=1"; List<string> filter = new List<string>(); string[] sortAndBool = { "OpenEnrollment", "MaturePublish" }; string[] BoolFields = { "OpenEnrollment", "ShowInList", "AllowPublish", "MaturePublish" }; string[] SortFields = { "Name", "MembershipFee", "OpenEnrollment", "MaturePublish" }; foreach (string field in sortAndBool) { if (boolFields.ContainsKey(field) == true && sort.ContainsKey(field) == true) { sort.Remove(field); } } foreach (string field in BoolFields) { if (boolFields.ContainsKey(field) == true) { filter.Add(string.Format("{0} = {1}", field, boolFields[field] ? "1" : "0")); } } if (filter.Count > 0) { whereClause = string.Join(" AND ", filter.ToArray()); } filter = new List<string>(); foreach (string field in SortFields) { if (sort.ContainsKey(field) == true) { filter.Add(string.Format("{0} {1}", field, sort[field] ? "ASC" : "DESC")); } } if (filter.Count > 0) { whereClause += " ORDER BY " + string.Join(", ", filter.ToArray()); } whereClause += string.Format(" LIMIT {0},{1}", start, count); List<GroupRecord> Reply = new List<GroupRecord>(); GroupRecord group; Dictionary<string, object> groupDict; List<string> osgroupsData = data.Query(whereClause, "osgroup", "GroupID, Name, Charter, InsigniaID, FounderID, MembershipFee, OpenEnrollment, ShowInList, AllowPublish, MaturePublish, OwnerRoleID"); if (osgroupsData.Count < 11) { return Reply; } for (int i = 0; i < osgroupsData.Count; ) { groupDict = new Dictionary<string, object>(); groupDict["GroupID"] = osgroupsData[i++]; groupDict["GroupName"] = osgroupsData[i++]; groupDict["Charter"] = osgroupsData[i++]; groupDict["GroupPicture"] = osgroupsData[i++]; groupDict["FounderID"] = osgroupsData[i++]; groupDict["MembershipFee"] = osgroupsData[i++]; groupDict["OpenEnrollment"] = int.Parse(osgroupsData[i++]) == 1 ? "true" : "false"; groupDict["ShowInList"] = int.Parse(osgroupsData[i++]) == 1 ? "true" : "false"; groupDict["AllowPublish"] = int.Parse(osgroupsData[i++]) == 1 ? "true" : "false"; groupDict["MaturePublish"] = int.Parse(osgroupsData[i++]) == 1 ? "true" : "false"; groupDict["OwnerRoleID"] = osgroupsData[i++]; group = new GroupRecord(groupDict); Reply.Add(group); } return Reply; }
public GroupRecord GetGroupRecord(UUID requestingAgentID, UUID GroupID, string GroupName) { GroupRecord record = new GroupRecord(); List<string> Keys = new List<string>(); List<object> Values = new List<object>(); if (GroupID != UUID.Zero) { Keys.Add("GroupID"); Values.Add(GroupID); } if (!string.IsNullOrEmpty(GroupName)) { Keys.Add("Name"); Values.Add(GroupName.MySqlEscape(50)); } List<string> osgroupsData = data.Query(Keys.ToArray(), Values.ToArray(), "osgroup", "GroupID, Name, Charter, InsigniaID, FounderID, MembershipFee, OpenEnrollment, ShowInList, AllowPublish, MaturePublish, OwnerRoleID"); if (osgroupsData.Count == 0) return null; record.GroupID = UUID.Parse(osgroupsData[0]); record.GroupName = osgroupsData[1]; record.Charter = osgroupsData[2]; record.GroupPicture = UUID.Parse(osgroupsData[3]); record.FounderID = UUID.Parse(osgroupsData[4]); record.MembershipFee = int.Parse(osgroupsData[5]); record.OpenEnrollment = int.Parse(osgroupsData[6]) == 1; record.ShowInList = int.Parse(osgroupsData[7]) == 1; record.AllowPublish = int.Parse(osgroupsData[8]) == 1; record.MaturePublish = int.Parse(osgroupsData[9]) == 1; record.OwnerRoleID = UUID.Parse(osgroupsData[10]); return record; }
public GroupRecord GetGroupRecord(UUID requestingAgentID, UUID GroupID, string GroupName) { Dictionary<string, object> sendData = new Dictionary<string, object>(); sendData["METHOD"] = "GetGroupRecord"; sendData["requestingAgentID"] = requestingAgentID; sendData["GroupID"] = GroupID; sendData["GroupName"] = GroupName; string reqString = WebUtils.BuildXmlResponse(sendData); try { List<string> m_ServerURIs = m_registry.RequestModuleInterface<IConfigurationService>().FindValueOf(requestingAgentID.ToString(), "RemoteServerURI", true); foreach (string m_ServerURI in m_ServerURIs) { string reply = SynchronousRestFormsRequester.MakeRequest("POST", m_ServerURI, reqString); if (reply != string.Empty) { Dictionary<string, object> replyData = WebUtils.ParseXmlResponse(reply); if (replyData != null) { Dictionary<string, object>.ValueCollection replyvalues = replyData.Values; foreach (object f in replyvalues) { if (f is Dictionary<string, object>) { GroupRecord group = new GroupRecord((Dictionary<string, object>)f); // Success return group; } } } } } } catch (Exception e) { MainConsole.Instance.DebugFormat("[AuroraRemoteGroupsServiceConnector]: Exception when contacting server: {0}", e.ToString()); } return null; }
public static void Display(GroupRecord gr) { GroupEditor ge=new GroupEditor(gr); ge.ShowDialog(); }