public UserNotification_SetGroupUserOperation_Modify(ServerLoginUserInfo user, Guid guid, ElementTransitionInfo info, SizeF scale)
     : base(user)
 {
     GUID      = guid;
     TransInfo = info;
     Scale     = scale;
 }
 public UserNotification_SetGroupUserOperation_Property(ServerLoginUserInfo user, Guid guid, string propertyName, object value)
     : base(user)
 {
     GUID         = guid;
     PropertyName = propertyName;
     Value        = value;
 }
 public UserNotification_SetGroupUserOperation_SetWaterbagInfo(ServerLoginUserInfo user, Guid guid, float width, Microsoft.Xna.Framework.Vector2[] vecs)
     : base(user)
 {
     GUID  = guid;
     Width = width;
     Vecs  = vecs;
 }
Example #4
0
        public ServerLoginUserInfo GetLoginUserInfo(string ipport)
        {
            long accId = -1;

            if (OnlineSessions.TryGetValue(ipport, out accId))
            {
                ServerLoginUserInfo suser = null;
                OnlineUsers.TryGetValue(accId, out suser);
                return(suser);
            }
            return(null);
        }
Example #5
0
        public ServerLoginUserInfo GetLoginUserInfo(OperationContext context)
        {
            var imp = OperationContext.Current.IncomingMessageProperties[RemoteEndpointMessageProperty.Name] as RemoteEndpointMessageProperty;
            ServerLoginUserInfo user = GetLoginUserInfo(String.Format("{0}:{1}", imp.Address, imp.Port));

            if (user != null)
            {
                user.RegisterOperationContext(context);
                return(user);
            }
            return(null);
        }
 public UserNotification_SetGroupUserOperation(ServerLoginUserInfo user)
     : base(null)
 {
     TargetGroup = user.LoginInfo.ParentGroup;
     if (TargetGroup.IsCooperation)
     {
         UserIDs = TargetGroup.Users.Keys.ToArray();
     }
     else
     {
         UserIDs = user.LoginInfo.BeMonitoringUserIDs;
     }
     SendingUserID = user.AccountID;
 }
Example #7
0
        public RegisteredUserInfo RegisterUser(LoginInfo info, OperationContext context)
        {
            if (!info.IsAccountNameValid)
            {
                return(null);
            }
            var user = new RegisteredUserInfo(NewRegisterID, info.AccountName, info.Password);

            RegisteredUsers[user.AccountID] = user;
            var suser = new ServerLoginUserInfo(user, LoginStatus.登录中, context);

            TaskGroups[0].AddUser(suser.LoginInfo);
            return(user);
        }
Example #8
0
        public ServerLoginUserInfo RegisterService(OperationContext context, int linkPort)
        {
            var    imp               = OperationContext.Current.IncomingMessageProperties[RemoteEndpointMessageProperty.Name] as RemoteEndpointMessageProperty;
            string ipport1           = String.Format("{0}:{1}", imp.Address, linkPort);
            ServerLoginUserInfo user = GetLoginUserInfo(ipport1);

            if (user != null)
            {
                string ipport2 = String.Format("{0}:{1}", imp.Address, imp.Port);
                OnlineSessions[ipport2] = user.AccountID;
                user.RegisterOperationContext(context);
                return(user);
            }
            return(null);
        }
Example #9
0
        public bool KickUser(long accountId, int timeOut, LogoutReason reason, AutoResetEvent evt)
        {
            ServerLoginUserInfo user = GetLoginUserInfo(accountId);

            if (user == null)
            {
                return(false);
            }
            try
            {
                PushNotification(new UserNotification_ChangeUserStatus(user.LoginInfo.Info.TaskGroupID, user.AccountID, LoginStatus.离线));
                if (ProjectDoc.Instance.SelectedViewportInfo != null)
                {
                    ProjectDoc.Instance.SelectedViewportInfo.RemoveAllCreatorElements(user.AccountID);
                }
                if (user.LoginInfo.AdjudicatorMode)
                {
                    RemoveMonitorUserFromAllReferrencers(user.AccountID);
                }
                OnlineUsers.Remove(user.AccountID);
                OnlineSessions.Remove(user.LinkIPPortCaption);
                OnlineSessions.Remove(user.ServiceIPPortCaption);
                if (user.Channel.State != CommunicationState.Closed)
                {
                    CommonMethods.CloseChannel(user.Channel, timeOut, evt);
                }
                user.Channel.Closed -= new EventHandler(Channel_Closed);
                user.Context         = null;
                if (UserLogouted != null)
                {
                    UserLogouted(accountId, reason);
                }
                return(true);
            }
            catch (System.Exception ex)
            {
                return(false);
            }
        }
Example #10
0
        public void Load()
        {
            RegisteredUsers.Clear();
            TaskGroups.Clear();
            var defGroup = CreateTaskGroup(0);

            defGroup.Name = "未分组";
            if (File.Exists(DataFile))
            {
                XmlDocument doc = new XmlDocument();
                doc.Load(DataFile);
                XmlElement nodeUsers = doc.DocumentElement.GetElementsByTagName("Users")[0] as XmlElement;
                foreach (XmlElement elm in nodeUsers.ChildNodes)
                {
                    RegisteredUserInfo user = new RegisteredUserInfo(elm);
                    RegisteredUsers[user.AccountID] = user;
                    var group = CreateTaskGroup(user.TaskGroupID);
                    if (group == null)
                    {
                        group = defGroup;
                    }
                    var suser = new ServerLoginUserInfo(user, LoginStatus.离线, null);
                    group.AddUser(suser.LoginInfo);
                }
                XmlElement nodeGrps = doc.DocumentElement.GetElementsByTagName("Groups")[0] as XmlElement;
                foreach (XmlElement elm in nodeGrps.ChildNodes)
                {
                    int groupId = int.Parse(elm.GetAttribute("ID"));
                    var grp     = CreateTaskGroup(groupId);
                    if (grp != null)
                    {
                        grp.Name = elm.GetAttribute("Name");
                    }
                }
            }
        }
 public void Tick()
 {
     for (int i = 0; WaitingUsers.Count > 0 && i < LoadingUserSlots.Length; ++i)
     {
         if (LoadingUserSlots[i] == null)
         {
             ServerLoginUserInfo user = null;
             lock (WaitingUsers)
             {
                 user = WaitingUsers[0];
                 WaitingUsers.RemoveAt(0);
             }
             if (user.Status < LoginStatus.在线)
             {
                 --i;
             }
             else
             {
                 TransRequestService.QueryTransmission(user.LinkEndPoint.Address, user.LoginInfo.TransServicePort, TransFileKind.ResourceFile, user.LoginInfo.MissingResourceFiles);
                 LoadingUserSlots[i] = user;
             }
         }
     }
 }
 public UserNotification_SetGroupUserOperation_SetMaskInfo(ServerLoginUserInfo user, Guid guid, Microsoft.Xna.Framework.Vector2[] vecs)
     : base(user)
 {
     GUID = guid;
     Vecs = vecs;
 }
 public UserNotification_SetGroupUserOperation_HotkeyAnimation(ServerLoginUserInfo user, Guid guid, float time)
     : base(user)
 {
     GUID = guid;
     Time = time;
 }
 public UserNotification_SetGroupUserOperation_Drive(ServerLoginUserInfo user, Guid guid, int x, int y)
     : base(user)
 {
     GUID     = guid;
     Location = new Point(x, y);
 }
 public UserNotification_SetGroupUserOperation_Flip(ServerLoginUserInfo user, Guid guid, FlippingState state)
     : base(user)
 {
     GUID  = guid;
     State = state;
 }
 public UserNotification_SetGroupUserOperation_Drift(ServerLoginUserInfo user, Guid guid, int depth)
     : base(user)
 {
     GUID  = guid;
     Depth = depth;
 }
Example #17
0
        private void OperattionHistory_NewOperationPushed(Operation opt)
        {
            var           eo   = opt as Operation_Element;
            var           pr   = CurFocusTreeNodeProjReferrencer;
            UserTaskGroup grp  = SelectedTaskGroup;
            LoginUserInfo user = SelectedUserInfo;

            if (grp == null && user != null)
            {
                grp = user.ParentGroup;
            }
            ServerLoginUserInfo suser = null;

            if (user != null)
            {
                suser = user.LocalObj as ServerLoginUserInfo;
            }
            ProjectReferrencer prTarget = pr;

            if (grp.IsCooperation)
            {
                prTarget = grp;
            }
            else if (suser == null)
            {
                return;
            }
            if (opt is Operation_Element)
            {
                var eop = opt as Operation_Element;
                if (!eop.DonotMakeUserDirty)
                {
                    eop.Element.CreatorId = LoginUserInfo.SystemUserID;
                }
                if (prTarget != null && prTarget.IsStarted)
                {
                    if (eop is Operation_Element_Create)
                    {
                        Program.UserMgr.PushNotification(new UserNotification_SetGroupSystemOperation_Create(prTarget, eop.Element));
                    }
                    else if (opt is Operation_Element_Delete)
                    {
                        Program.UserMgr.PushNotification(new UserNotification_SetGroupSystemOperation_Delete(prTarget, eop.Element.GUID));
                    }
                    else if (opt is Operation_Element_Drift)
                    {
                        Program.UserMgr.PushNotification(new UserNotification_SetGroupSystemOperation_Drift(prTarget, eop.Element));
                    }
                    else if (opt is Operation_Element_Flip)
                    {
                        Program.UserMgr.PushNotification(new UserNotification_SetGroupSystemOperation_Flip(prTarget, eop.Element));
                    }
                    else if (opt is Operation_Element_ChangeProperty)
                    {
                        Program.UserMgr.PushNotification(new UserNotification_SetGroupSystemOperation_ChangeProperty(prTarget, eop.Element,
                                                                                                                     ((Operation_Element_ChangeProperty)opt).PropertyName,
                                                                                                                     ((Operation_Element_ChangeProperty)opt).ValueNew));
                    }
                    else if (opt is Operation_Element_ChangeMaskInfo)
                    {
                        Program.UserMgr.PushNotification(new UserNotification_SetGroupSystemOperation_SetMask(prTarget, eop.Element as ElementInfo_Mask));
                    }
                    else if (opt is Operation_Element_ChangeWaterbagInfo)
                    {
                        Program.UserMgr.PushNotification(new UserNotification_SetGroupSystemOperation_SetWaterbag(prTarget, eop.Element as ElementInfo_Waterbag));
                    }
                    else if (opt is Operation_Element_SetHotkeyAnimation)
                    {
                        Program.UserMgr.PushNotification(new UserNotification_SetGroupSystemOperation_HotkeyAnimation(prTarget, eop.Element));
                    }
                    //else if (opt is Operation_Element_ChangeLocation)
                    //    Program.UserMgr.PushNotification(new UserNotification_SetGroupSystemOperation_Drive(prTarget, eop.Element,
                    //        ((Operation_Element_ChangeLocation)opt).LocationNew.X,
                    //        ((Operation_Element_ChangeLocation)opt).LocationNew.Y));
                    else
                    {
                        Program.UserMgr.PushNotification(new UserNotification_SetGroupSystemOperation_Modify(prTarget, eop.Element));
                    }
                }
            }
        }
 public UserResSynchronizer()
 {
     LoadingUserSlots = new ServerLoginUserInfo[MaxThreadCount];
     TransRequestService.TransmissionFinished += new TransmissionRequestService.Delegate_Transmission(OnTransmissionFinished);
     TransRequestService.TransmissionFailed   += new TransmissionRequestService.Delegate_Transmission(OnTransmissionFailed);
 }
 public UserNotification_SetGroupUserOperation_Delete(ServerLoginUserInfo user, Guid guid)
     : base(user)
 {
     GUID = guid;
 }
 public UserNotification_SetGroupUserOperation_Create(ServerLoginUserInfo user, ElementCreateInfo info)
     : base(user)
 {
     CreateInfo = info;
 }