Esempio n. 1
0
        static void Main(string[] args)
        {
            AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(onError);

            // Loading all configs files
            ConfigMgr.LoadConfigs();
            Config = ConfigMgr.GetConfig<AccountConfigs>();

            // Loading log level from file
            if (!Log.InitLog(Config.LogLevel, "AccountCacher"))
                ConsoleMgr.WaitAndExit(2000);

            AccountMgr.Database = DBManager.Start(Config.AccountDB.Total(), ConnectionType.DATABASE_MYSQL, "Accounts");
            if (AccountMgr.Database == null)
                ConsoleMgr.WaitAndExit(2000);

            Server = new RpcServer(Config.RpcInfo.RpcClientStartingPort, 1);
            if (!Server.Start(Config.RpcInfo.RpcIp, Config.RpcInfo.RpcPort))
                ConsoleMgr.WaitAndExit(2000);

            AcctMgr = Server.GetLocalObject<AccountMgr>();
            AcctMgr.LoadRealms();

            ConsoleMgr.Start();
        }
Esempio n. 2
0
        static void Main(string[] args)
        {
            Log.Texte("", "-------------------------------", ConsoleColor.DarkBlue);
            Log.Texte("", "          _____   _____ ", ConsoleColor.Cyan);
            Log.Texte("", "    /\\   |  __ \\ / ____|", ConsoleColor.Cyan);
            Log.Texte("", "   /  \\  | |__) | (___  ", ConsoleColor.Cyan);
            Log.Texte("", "  / /\\ \\ |  ___/ \\___ \\ ", ConsoleColor.Cyan);
            Log.Texte("", " / ____ \\| |     ____) |", ConsoleColor.Cyan);
            Log.Texte("", "/_/    \\_\\_|    |_____/ Rift", ConsoleColor.Cyan);
            Log.Texte("", "http://AllPrivateServer.com", ConsoleColor.DarkCyan);
            Log.Texte("", "-------------------------------", ConsoleColor.DarkBlue);

            // Loading all configs files
            ConfigMgr.LoadConfigs();
            Config = ConfigMgr.GetConfig<RealmConfig>();
            Config.RealmInfo.GenerateName();

            // Loading log level from file
            if (!Log.InitLog(Config.LogLevel,"Realm"))
                ConsoleMgr.WaitAndExit(2000);

            CharactersMgr.CharactersDB = DBManager.Start(Config.CharactersDB.Total(), ConnectionType.DATABASE_MYSQL, "Characters");
            if (CharactersMgr.CharactersDB == null)
                ConsoleMgr.WaitAndExit(2000);

            WorldMgr.WorldDB = DBManager.Start(Config.WorldDB.Total(), ConnectionType.DATABASE_MYSQL, "World");
            if (WorldMgr.WorldDB == null)
                ConsoleMgr.WaitAndExit(2000);

            PacketProcessor.RegisterDefinitions();

            // Starting Remote Client
            Client = new RpcClient("Realm-" + Config.RealmInfo.RealmId, Config.RpcCharacter.RpcLocalIp, 1);
            if (!Client.Start(Config.RpcCharacter.RpcServerIp, Config.RpcCharacter.RpcServerPort))
                ConsoleMgr.WaitAndExit(2000);

            Server = new RpcServer(Config.RpcMapServer.RpcClientStartingPort, 2);
            if (!Server.Start(Config.RpcMapServer.RpcIp, Config.RpcMapServer.RpcPort))
                ConsoleMgr.WaitAndExit(2000);

            World = Client.GetLocalObject<WorldMgr>();
            Accounts = Client.GetServerObject<AccountMgr>();
            Characters = Client.GetLocalObject<CharactersMgr>();

            // 1 : Loading WorldMgr
            World.Load();

            // 2 : Loading CharactersMgr
            CharactersMgr.Client = Client;
            CharactersMgr.MyRealm = Config.RealmInfo;
            CharactersMgr.MyRealm.RpcInfo = Client.Info;
            Characters.Load();

            // 3 : Loading AccountsMgr
            Accounts.RegisterRealm(Config.RealmInfo, Client.Info);

            ConsoleMgr.Start();
        }
Esempio n. 3
0
        static void Main(string[] args)
        {
            Log.Texte("", "---------------------------------------------------------------", ConsoleColor.DarkBlue);
            Log.Texte("", " _______ _________ _______ _________ _______  _______          ", ConsoleColor.Cyan);
            Log.Texte("", "(  ____ )\__   __/(  ____ \\__   __/(  ____ \(       )|\     /|", ConsoleColor.Cyan);
            Log.Texte("", "| (    )|   ) (   | (    \/   ) (   | (    \/| () () || )   ( |", ConsoleColor.Cyan);
            Log.Texte("", "| (____)|   | |   | (__       | |   | (__    | || || || |   | |", ConsoleColor.Cyan);
            Log.Texte("", "|     __)   | |   |  __)      | |   |  __)   | |(_)| || |   | |", ConsoleColor.Cyan);
            Log.Texte("", "| (\ (      | |   | (         | |   | (      | |   | || |   | |", ConsoleColor.Cyan);
            Log.Texte("", "| ) \ \_____) (___| )         | |   | (____/\| )   ( || (___) |", ConsoleColor.Cyan);
            Log.Texte("", "|/   \__/\_______/|/          )_(   (_______/|/     \|(_______)", ConsoleColor.Cyan);
            Log.Texte("", "www.Strawberry-Pr0jcts.com", ConsoleColor.DarkCyan);
            Log.Texte("", "---------------------------------------------------------------", ConsoleColor.DarkBlue);

            // Loading all configs files
            ConfigMgr.LoadConfigs();
            Config = ConfigMgr.GetConfig<CharacterConfig>();

            // Loading log level from file
            if (!Log.InitLog(Config.LogLevel,"Character"))
                ConsoleMgr.WaitAndExit(2000);

            AccountMgr.AccountDB = DBManager.Start(Config.AccountDB.Total(), ConnectionType.DATABASE_MYSQL, "Accounts");
            if (AccountMgr.AccountDB == null)
                ConsoleMgr.WaitAndExit(2000);

            // Starting Remote Server
            Server = new RpcServer(Config.RpcClientStartingPort, 1);
            if (!Server.Start(Config.RpcIP, Config.RpcPort))
                ConsoleMgr.WaitAndExit(2000);

            // Starting Accounts Manager
            AcctMgr = Server.GetLocalObject<AccountMgr>();
            if(AcctMgr == null)
                ConsoleMgr.WaitAndExit(2000);

            AcctMgr.LoadRealms();

            // Listening Client
            if (!TCPManager.Listen<RiftServer>(Config.CharacterServerPort, "CharacterServer"))
                ConsoleMgr.WaitAndExit(2000);

            ConsoleMgr.Start();
        }
Esempio n. 4
0
        static void Main(string[] args)
        {
            Log.Texte("", "-------------------------------",    ConsoleColor.DarkBlue);
            Log.Texte("", "          _____   _____ ",           ConsoleColor.Cyan);
            Log.Texte("", "    /\\   |  __ \\ / ____|",         ConsoleColor.Cyan);
            Log.Texte("", "   /  \\  | |__) | (___  ",          ConsoleColor.Cyan);
            Log.Texte("", "  / /\\ \\ |  ___/ \\___ \\ ",       ConsoleColor.Cyan);
            Log.Texte("", " / ____ \\| |     ____) |",          ConsoleColor.Cyan);
            Log.Texte("", "/_/    \\_\\_|    |_____/ Rift",     ConsoleColor.Cyan);
            Log.Texte("", "http://AllPrivateServer.com",        ConsoleColor.DarkCyan);
            Log.Texte("", "-------------------------------",    ConsoleColor.DarkBlue);

            // Loading all configs files
            ConfigMgr.LoadConfigs();
            Config = ConfigMgr.GetConfig<CharacterConfig>();

            // Loading log level from file
            if (!Log.InitLog(Config.LogLevel,"Character"))
                ConsoleMgr.WaitAndExit(2000);

            AccountMgr.AccountDB = DBManager.Start(Config.AccountDB.Total(), ConnectionType.DATABASE_MYSQL, "Accounts");
            if (AccountMgr.AccountDB == null)
                ConsoleMgr.WaitAndExit(2000);

            // Starting Remote Server
            Server = new RpcServer(Config.RpcClientStartingPort, 1);
            if (!Server.Start(Config.RpcIP, Config.RpcPort))
                ConsoleMgr.WaitAndExit(2000);

            // Starting Accounts Manager
            AcctMgr = Server.GetLocalObject<AccountMgr>();
            if(AcctMgr == null)
                ConsoleMgr.WaitAndExit(2000);

            AcctMgr.LoadRealms();

            // Listening Client
            if (!TCPManager.Listen<RiftServer>(Config.CharacterServerPort, "CharacterServer"))
                ConsoleMgr.WaitAndExit(2000);

            ConsoleMgr.Start();
        }
        public static bool reDownloadVoiceInfo(ChatMsg msg)
        {
            MsgTrans voiceinfo = new MsgTrans
            {
                nTransType      = 4,
                nStatus         = 0,
                strToUserName   = AccountMgr.getCurAccount().strUsrName,
                strFromUserName = msg.strTalker
            };
            string strMsg = msg.strMsg;

            if (ContactMgr.getUserType(msg.strTalker) == ContactMgr.UserType.UserTypeChatRoom)
            {
                strMsg = strMsg.Substring(strMsg.IndexOf('\n') + 1);
            }
            if (!parseVoiceMsgXML(strMsg, voiceinfo))
            {
                Log.d("DownloadVoiceService", "parseVoiceMsgXML failed");
                return(false);
            }
            voiceinfo.nMsgSvrID = msg.nMsgSvrID;
            if (AccountMgr.getCurAccount().strUsrName == voiceinfo.strFromUserName)
            {
                Log.d("DownloadVoiceService", "the mVoiceinfo.strFromUserName is yourself");
                return(false);
            }
            if (DownloadVoiceContextMgr.getInstance().GetBySvrID(msg.nMsgSvrID) == null)
            {
                DownloadVoiceContext context = new DownloadVoiceContext(msg.nMsgSvrID, msg.strTalker)
                {
                    mStatus = 0
                };
                context.Enqueue(voiceinfo);
                DownloadVoiceContextMgr.getInstance().putToTail(context);
                //DownloadVoiceStorage.updateDownloadVoiceContext(voiceinfo);
                doSceneBegin();
            }
            return(true);
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            RightMgr.getInstance().opCheck("addAccount", Session, Response);

            GMUser user = (GMUser)Session["user"];

            if (IsPostBack)
            {
                m_selIndex = m_type.SelectedIndex;

                m_modifyFlagStr = Request["flag"];
                if (m_modifyFlagStr == null)
                {
                    m_modifyFlagStr = "";
                }

                if (m_modifyFlagStr != "")
                {
                    string[] arr = Tool.split(m_modifyFlagStr, ',', StringSplitOptions.RemoveEmptyEntries);
                    for (int i = 0; i < arr.Length; i++)
                    {
                        GMAccountItem item = new GMAccountItem();
                        item.m_user = arr[i];
                        item.m_type = Request[item.m_user];
                        m_gmList.Add(item);
                    }
                }
            }
            else
            {
                List <AccountType> account = AccountMgr.getInstance().getAccountTypeList();
                foreach (AccountType acc in account)
                {
                    m_type.Items.Add(acc.m_name);
                }

                genTable(m_curAccount, user);
            }
        }
Esempio n. 7
0
        private bool updateUserInfo(NewAuthRequest authRequest, NewAuthResponse authResponse, byte[] serverID)
        {
            Account account = AccountMgr.getCurAccount();

            account.bytesSessionkey = authResponse.SessionKey.ToByteArray();
            account.bytesServerID   = serverID;
            if (authRequest.UserName.String == "facebook@wechat_auth")
            {
                account.strPwd  = authResponse.Password;
                account.strPwd2 = authResponse.Password;
            }
            else
            {
                account.strPwd  = authRequest.Pwd.String;
                account.strPwd2 = authRequest.Pwd2;
            }
            account.nUin                      = authResponse.Uin;
            account.strUsrName                = authResponse.UserName.String;
            account.strNickName               = authResponse.NickName.String;
            account.strBindEmail              = authResponse.BindEmail.String;
            account.strBindMobile             = authResponse.BindMobile.String;
            account.nBindQQ                   = authResponse.BindUin;
            account.nStatus                   = authResponse.Status;
            account.strOfficalNickName        = authResponse.OfficialNickName.String;
            account.strOfficalUserName        = authResponse.OfficialUserName.String;
            account.nPushMailStatus           = (int)authResponse.PushMailStatus;
            account.strQQMicroBlog            = authResponse.QQMicroBlogUserName.String;
            account.nQQMBlogStatus            = (int)authResponse.QQMicroBlogStatus;
            account.dbLastSessionKeyTimeStamp = Util.getNowSeconds();
            account.strAlias                  = authResponse.Alias;
            account.nPluginFlag               = authResponse.PluginFlag;
            account.bytesA2Key                = authResponse.A2Key.Buffer.ToByteArray();
            account.strFSURL                  = authResponse.FSURL;
            account.strAuthTicket             = authResponse.AuthTicket;
            account.nSafeDevice               = authResponse.SafeDevice;
            //account.nMainAcctType = authResponse.MainAcctType;
            AccountMgr.updateAccount();
            return(true);
        }
Esempio n. 8
0
 private void doSceneEx(string mobile, string verifyCode, int opCode, int dialFlag, string dialLang, string strUserName = "")
 {
     base.beginBuilder();
     base.mBuilder.BaseRequest = NetSceneBase.makeBaseRequest(0, 369298705);
     base.mBuilder.UserName    = strUserName;
     base.mBuilder.Mobile      = mobile;
     base.mBuilder.Opcode      = opCode;
     base.mBuilder.Verifycode  = verifyCode;
     base.mBuilder.DialFlag    = dialFlag;
     base.mBuilder.DialLang    = dialLang;
     base.mBuilder.AuthTicket  = "";
     if (!string.IsNullOrEmpty(AccountMgr.getCurAccount().strAuthTicket))
     {
         base.mBuilder.AuthTicket = AccountMgr.getCurAccount().strAuthTicket;
     }
     base.mBuilder.ForceReg         = 0;
     base.mBuilder.SafeDeviceName   = ""; //SafeDeviceService.getdeviceName();
     base.mBuilder.SafeDeviceType   = ""; //SafeDeviceService.getdeviceType();
     base.mSessionPack.mConnectMode = 2;
     base.mSessionPack.mCmdUri      = "/cgi-bin/micromsg-bin/bindopmobileforreg";
     base.endBuilder();
 }
Esempio n. 9
0
        public AccountFullInfo UnBanAccount(string name)
        {
            Account account = AccountMgr.GetAccount(name);

            if (account == null)
            {
                return(null);
            }
            RealmAccount loggedInAccount = ServerApp <RealmServer> .Instance.GetLoggedInAccount(name);

            if (loggedInAccount != null)
            {
                loggedInAccount.SetAccountActive(true, new DateTime?());
            }
            else
            {
                account.IsActive = true;
                account.SaveLater();
            }

            return(InitAccount(account));
        }
        public void ProcessRequest(HttpContext context)
        {
            RightMgr.getInstance().opCheck("addAccount", context.Session, context.Response);

            string retStr = "";
            int    op     = Convert.ToInt32(context.Request.Form["op"]);

            switch (op)
            {
            case 1:
            {
                string acc         = context.Request.Form["acc"];
                string viewChannel = context.Request.Form["viewChannel"];
                bool   res         = AccountMgr.getInstance().updateViewChannel(acc, viewChannel);
                retStr = OpResMgr.getInstance().getResultString(res ? OpRes.opres_success : OpRes.op_res_failed);
            }
            break;

            case 2:
            {
                string acc    = context.Request.Form["acc"];
                string gmType = context.Request.Form["type"];
                bool   res    = AccountMgr.getInstance().updateGmType(acc, gmType);
                retStr = OpResMgr.getInstance().getResultString(res ? OpRes.opres_success : OpRes.op_res_failed);
            }
            break;

            case 3:
            {
                string acc = context.Request.Form["acc"];
                OpRes  res = AccountMgr.getInstance().delAccount(acc, null);
                retStr = OpResMgr.getInstance().getResultString(res);
            }
            break;
            }

            context.Response.ContentType = "text/plain";
            context.Response.Write(retStr);
        }
        /*==================================================================================================================================
        * Public Methods
        *=================================================================================================================================*/
        public questStatus Login(HttpRequestBase request, LoginRequestViewModel loginRequestViewModel, out UserSessionId userSessionId)
        {
            // Initialize
            questStatus status = null;

            userSessionId = null;


            // Transfer model
            UserSession  userSession  = null;
            LoginRequest loginRequest = new LoginRequest();

            BufferMgr.TransferBuffer(loginRequestViewModel, loginRequest);
            string ipAddress = null;

            status = GetIPAddress(request, out ipAddress);
            if (!questStatusDef.IsSuccess(status))
            {
                return(status);
            }
            loginRequest.IPAddress = ipAddress;
            loginRequest.UserAgent = request.UserAgent;


            // Perform login
            AccountMgr accountMgr = new AccountMgr(this.UserSession);

            status = accountMgr.Login(loginRequest, out userSession);
            if (!questStatusDef.IsSuccess(status))
            {
                return(status);
            }

            // Return user session Id
            userSessionId = new UserSessionId(userSession.Id);

            return(new questStatus(Severity.Success));
        }
Esempio n. 12
0
        public bool doSenceShortVideo(string toUserName, string videoFile, string thumbFile, int playLength, bool isForward = false, ChatMsg origChatMsg = null)
        {
            Log.i("UploadVideoService", "begin up short video, videoFile = " + videoFile);
            string             hashString = MD5Core.GetHashString(toUserName + Util.getNowMilliseconds());
            UploadVideoContext context    = UploadVideoContext.createByClientMsgID(hashString);

            if (context == null)
            {
                Log.e("UploadVideoService", "create upload short video context failed. ");
                return(false);
            }
            Log.i("UploadVideoService", "cmd to scene begin, toUserName = "******" , clientMsgId = " + hashString);
            context.mVideoTrans.strToUserName   = toUserName;
            context.mVideoTrans.strFromUserName = AccountMgr.getCurAccount().strUsrName;
            context.mVideoTrans.strThumbnail    = thumbFile;
            context.mVideoTrans.strImagePath    = videoFile;
            context.mVideoTrans.nDuration       = playLength;
            context.mStatus = 0;
            if (isForward)
            {
                //context.preProcessSightFile(thumbFile, videoFile);
                context.mOrigChatMsg = origChatMsg;
            }
            if (!context.initThumbMemStream())
            {
                Log.e("UploadVideoService", "failed to load thumb file. ");
                return(false);
            }
            if (!context.initVideoFileStream())
            {
                Log.e("UploadVideoService", "failed to load video file. ");
                return(false);
            }
            context.addVoiceChatMsg(true);
            UploadVideoContextMgr.getInstance().putToHead(context);
            checkReadyContextDispatcher();
            return(true);
        }
Esempio n. 13
0
        private void updateUserInfo(RegRequest request, RegResponse response)
        {
            Account account = AccountMgr.getCurAccount();

            account.bytesSessionkey           = response.SessionKey.ToByteArray();
            account.bytesServerID             = SessionPackMgr.getSeverID();
            account.strPwd                    = request.Pwd.String;
            account.nUin                      = response.Uin;
            account.strUsrName                = request.UserName.String;
            account.strBindEmail              = request.BindEmail.String;
            account.strBindMobile             = request.BindMobile.String;
            account.nBindQQ                   = request.BindUin;
            account.strOfficalNickName        = response.OfficialNickName.String;
            account.strOfficalUserName        = response.OfficialUserName.String;
            account.nPushMailStatus           = (int)response.PushMailStatus;
            account.strQQMicroBlog            = response.QQMicroBlogUserName.String;
            account.nNewUser                  = 1;
            account.dbLastSessionKeyTimeStamp = Util.getNowSeconds();
            if (!AccountMgr.updateAccount())
            {
                Log.e("NetSceneReg", "add account failed");
            }
        }
Esempio n. 14
0
        public bool SetAccountPass(long id, string oldPassStr, byte[] pass)
        {
            var acc = AccountMgr.GetAccount(id);

            if (acc != null)
            {
                if (oldPassStr != null)
                {
                    var oldPass = SecureRemotePassword.GenerateCredentialsHash(acc.Name, oldPassStr);
                    if (!oldPass.SequenceEqual(acc.Password))
                    {
                        return(false);
                    }
                }

                acc.Password = pass;

                AuthenticationServer.IOQueue.AddMessage(acc.SaveAndFlush);
                return(true);
            }

            return(false);
        }
Esempio n. 15
0
        private bool continueDoScene()
        {
            base.beginBuilder();
            base.mBuilder.BaseRequest = NetSceneBase.makeBaseRequest(this.mScene);
            base.mBuilder.UserName    = AccountMgr.getCurAccount().strUsrName;
            // string aa = Util.byteToHexStr();
            // base.mBuilder.CurrentSynckey = Util.toSKBuffer(mInitCurrentSynckey);
            base.mBuilder.CurrentSynckey = Util.toSKBuffer(mInitCurrentSynckey);

            base.mBuilder.MaxSynckey = Util.toSKBuffer(mInitMaxSynckey);
            base.mSessionPack.mCmdID = 0x1b;
            base.endBuilder();
            if (this.mInitCount < 100)
            {
                this.mInitCount++;
            }
            else
            {
                Log.d("NetSceneNewInit", "mInitCount exceed the maximum");
            }
            this.mProgress = 10;
            return(true);
        }
Esempio n. 16
0
        public AccountFullInfo BanAccount(string name, DateTime until)
        {
            Account account = AccountMgr.GetAccount(name);

            if (account == null)
            {
                return((AccountFullInfo)null);
            }
            RealmAccount loggedInAccount = ServerApp <WCell.RealmServer.RealmServer> .Instance.GetLoggedInAccount(name);

            if (loggedInAccount != null)
            {
                loggedInAccount.SetAccountActive(false, new DateTime?(until));
            }
            else
            {
                account.IsActive    = false;
                account.StatusUntil = new DateTime?(until);
                account.SaveLater();
            }

            return(this.InitAccount(account));
        }
Esempio n. 17
0
        static void Main(string[] args)
        {
            AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(onError);

            Log.Texte("", "-------------------- Account Cacher -------------------", ConsoleColor.DarkRed);
            Log.Texte("", " █     █░ ▄▄▄       ██▀███  ▓█████  ███▄ ▄███▓ █    ██ ", ConsoleColor.Red);
            Log.Texte("", "▓█░ █ ░█░▒████▄    ▓██ ▒ ██▒▓█   ▀ ▓██▒▀█▀ ██▒ ██  ▓██▒", ConsoleColor.Red);
            Log.Texte("", "▒█░ █ ░█ ▒██  ▀█▄  ▓██ ░▄█ ▒▒███   ▓██    ▓██░▓██  ▒██░", ConsoleColor.Red);
            Log.Texte("", "░█░ █ ░█ ░██▄▄▄▄██ ▒██▀▀█▄  ▒▓█  ▄ ▒██    ▒██ ▓▓█  ░██░", ConsoleColor.Red);
            Log.Texte("", "░░██▒██▓  ▓█   ▓██▒░██▓ ▒██▒░▒████▒▒██▒   ░██▒▒▒█████▓ ", ConsoleColor.Red);
            Log.Texte("", "░ ▓░▒ ▒   ▒▒   ▓▒█░░ ▒▓ ░▒▓░░░ ▒░ ░░ ▒░   ░  ░░▒▓▒ ▒ ▒ ", ConsoleColor.Red);
            Log.Texte("", "  ▒ ░ ░    ▒   ▒▒ ░  ░▒ ░ ▒░ ░ ░  ░░  ░      ░░░▒░ ░ ░ ", ConsoleColor.Red);
            Log.Texte("", "  ░   ░    ░   ▒     ░░   ░    ░   ░      ░    ░░░ ░ ░ ", ConsoleColor.Red);
            Log.Texte("", "    ░          ░  ░   ░        ░  ░       ░      ░    ", ConsoleColor.Red);
            Log.Texte("", "-------------------http://WarEmu.com-------------------", ConsoleColor.DarkRed);

            // Loading all configs files
            ConfigMgr.LoadConfigs();
            Config = ConfigMgr.GetConfig<AccountConfigs>();

            // Loading log level from file
            if (!Log.InitLog(Config.LogLevel, "AccountCacher"))
                ConsoleMgr.WaitAndExit(2000);

            AccountMgr.Database = DBManager.Start(Config.AccountDB.Total(), ConnectionType.DATABASE_MYSQL, "Accounts");
            if (AccountMgr.Database == null)
                ConsoleMgr.WaitAndExit(2000);

            Server = new RpcServer(Config.RpcInfo.RpcClientStartingPort, 1);
            if (!Server.Start(Config.RpcInfo.RpcIp, Config.RpcInfo.RpcPort))
                ConsoleMgr.WaitAndExit(2000);

            AcctMgr = Server.GetLocalObject<AccountMgr>();
            AcctMgr.LoadRealms();

            ConsoleMgr.Start();
        }
Esempio n. 18
0
        static void Main(string[] args)
        {
            AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(onError);

            Log.Texte("", "-------------------- Account Cacher -------------------", ConsoleColor.Blue);



            Log.Texte("", "---Dawn of Reckoning project since 2008-2019 BY LEO228---", ConsoleColor.Red);

            // Loading all configs files
            ConfigMgr.LoadConfigs();
            Config = ConfigMgr.GetConfig <AccountConfigs>();

            // Loading log level from file
            if (!Log.InitLog(Config.LogLevel, "AccountCacher"))
            {
                ConsoleMgr.WaitAndExit(2000);
            }

            AccountMgr.Database = DBManager.Start(Config.AccountDB.Total(), ConnectionType.DATABASE_MYSQL, "Accounts");
            if (AccountMgr.Database == null)
            {
                ConsoleMgr.WaitAndExit(2000);
            }

            Server = new RpcServer(Config.RpcInfo.RpcClientStartingPort, 1);
            if (!Server.Start(Config.RpcInfo.RpcIp, Config.RpcInfo.RpcPort))
            {
                ConsoleMgr.WaitAndExit(2000);
            }

            AcctMgr = Server.GetLocalObject <AccountMgr>();
            AcctMgr.LoadRealms();

            ConsoleMgr.Start();
        }
Esempio n. 19
0
 public static bool uninstallPlugin(PluginBase plugin, InstallMode mode = 0)
 {
     if (!PluginBase.isValidPlugin(plugin))
     {
         return(false);
     }
     if (!PluginBase.isInstalledPlugin(plugin))
     {
         return(false);
     }
     Log.i("ExtentCenter", string.Concat(new object[] { "uninstall plugin... ", plugin.mName, ", uninstall mode =", mode }));
     plugin.onUninstalled(mode);
     plugin.mMetaInfo.isInstalled = false;
     PluginMetaStorage.updateMetaInfo(plugin);
     if ((mode == InstallMode.UserInstall) && (plugin.mProtocolPluginFlag != ((EPluginFlag)0)))
     {
         Account acc = AccountMgr.getCurAccount();
         acc.nPluginFlag = (uint)(((EPluginFlag)acc.nPluginFlag) | plugin.mProtocolPluginFlag);
         AccountMgr.updateAccount();
         // OpLogMgr.opModUserInfo(0x800, acc);
         ServiceCenter.sceneNewSync.doScene(7, syncScene.MM_NEWSYNC_SCENE_OTHER);
     }
     return(true);
 }
Esempio n. 20
0
        static void Main(string[] args)
        {
            Log.Texte("", "-------------------------------", ConsoleColor.DarkBlue);
            Log.Texte("", "          _____   _____ ", ConsoleColor.Cyan);
            Log.Texte("", "    /\\   |  __ \\ / ____|", ConsoleColor.Cyan);
            Log.Texte("", "   /  \\  | |__) | (___  ", ConsoleColor.Cyan);
            Log.Texte("", "  / /\\ \\ |  ___/ \\___ \\ ", ConsoleColor.Cyan);
            Log.Texte("", " / ____ \\| |     ____) |", ConsoleColor.Cyan);
            Log.Texte("", "/_/    \\_\\_|    |_____/ Rift", ConsoleColor.Cyan);
            Log.Texte("", "http://AllPrivateServer.com", ConsoleColor.DarkCyan);
            Log.Texte("", "-------------------------------", ConsoleColor.DarkBlue);

            // Loading all configs files
            ConfigMgr.LoadConfigs();
            Config = ConfigMgr.GetConfig <RealmConfig>();
            Config.RealmInfo.GenerateName();

            // Loading log level from file
            if (!Log.InitLog(Config.LogLevel, "Realm"))
            {
                ConsoleMgr.WaitAndExit(2000);
            }

            CharactersMgr.CharactersDB = DBManager.Start(Config.CharactersDB.Total(), ConnectionType.DATABASE_MYSQL, "Characters");
            if (CharactersMgr.CharactersDB == null)
            {
                ConsoleMgr.WaitAndExit(2000);
            }

            WorldMgr.WorldDB = DBManager.Start(Config.WorldDB.Total(), ConnectionType.DATABASE_MYSQL, "World");
            if (WorldMgr.WorldDB == null)
            {
                ConsoleMgr.WaitAndExit(2000);
            }

            PacketProcessor.RegisterDefinitions();

            // Starting Remote Client
            Client = new RpcClient("Realm-" + Config.RealmInfo.RealmId, Config.RpcCharacter.RpcLocalIp, 1);
            if (!Client.Start(Config.RpcCharacter.RpcServerIp, Config.RpcCharacter.RpcServerPort))
            {
                ConsoleMgr.WaitAndExit(2000);
            }


            Server = new RpcServer(Config.RpcMapServer.RpcClientStartingPort, 2);
            if (!Server.Start(Config.RpcMapServer.RpcIp, Config.RpcMapServer.RpcPort))
            {
                ConsoleMgr.WaitAndExit(2000);
            }

            World      = Client.GetLocalObject <WorldMgr>();
            Accounts   = Client.GetServerObject <AccountMgr>();
            Characters = Client.GetLocalObject <CharactersMgr>();

            // 1 : Loading WorldMgr
            World.Load();

            // 2 : Loading CharactersMgr
            CharactersMgr.Client          = Client;
            CharactersMgr.MyRealm         = Config.RealmInfo;
            CharactersMgr.MyRealm.RpcInfo = Client.Info;
            Characters.Load();

            // 3 : Loading AccountsMgr
            Accounts.RegisterRealm(Config.RealmInfo, Client.Info);

            ConsoleMgr.Start();
        }
Esempio n. 21
0
 public ActionResult RemoveCollection(int userid, ContentType type, int contentid)
 {
     AccountMgr.RemoveUserCollection(userid, type, contentid);
     return(Content("OK"));
 }
Esempio n. 22
0
 /// <summary>
 /// 将当前用户的全部未读消息标记为已读
 /// </summary>
 /// <returns></returns>
 public ActionResult MessageAllRead()
 {
     AccountMgr.MessageAllRead(CurrentUser.id);
     return(Content("OK"));
 }
Esempio n. 23
0
 /// <summary>
 /// 将指定的消息标记为已删除
 /// </summary>
 /// <param name="id"></param>
 /// <returns></returns>
 public ActionResult MessageIsDeleted(int id)
 {
     AccountMgr.UpdateMessageStatus(id, null, true);
     return(Content("OK"));
 }
Esempio n. 24
0
 /// <summary>
 /// 将指定的消息标记为已读
 /// </summary>
 /// <param name="id"></param>
 /// <returns></returns>
 public ActionResult MessageIsRead(int id)
 {
     AccountMgr.UpdateMessageStatus(id, true, false);
     return(Content("OK"));
 }
Esempio n. 25
0
        /// <summary>
        /// 提交新用户注册
        /// </summary>
        /// <param name="user"></param>
        /// <returns></returns>
        public ActionResult SubmitRegister([Bind] user_account user)
        {
            var password2 = Request.Form["password2"];

            // 检查必填字段是否完整
            if (string.IsNullOrEmpty(user.mobile_number) == true)
            {
                return(Content("手机号码不可为空。"));
            }
            if (string.IsNullOrEmpty(user.name) == true)
            {
                return(Content("真实姓名不可为空。"));
            }
            if (string.IsNullOrEmpty(user.password) == true)
            {
                return(Content("登录密码不可为空。"));
            }
            if (string.IsNullOrEmpty(password2) == true)
            {
                return(Content("重复登录密码不可为空。"));
            }
            if (user.password != password2)
            {
                return(Content("两次输入的登录密码不一致。"));
            }
            if (string.IsNullOrEmpty(user.hospital_name) == true)
            {
                return(Content("所在医院不可为空。"));
            }
            if (string.IsNullOrEmpty(user.department_name) == true)
            {
                return(Content("科室名称不可为空。"));
            }

            if (Checker.IsValidTelephone(user.mobile_number) == false)
            {
                return(Content("手机号码格式无效。"));
            }

            // 检查手机号码是否已被使用
            var temp = AccountMgr.GetUser(user.mobile_number);

            if (temp != null)
            {
                return(Content("手机号码(" + user.mobile_number + ")已被注册。"));
            }

            // 根据性别,设置默认头像
            if (user.gender == GenderType.男)
            {
                user.avatar = "user.png";
            }
            else if (user.gender == GenderType.女)
            {
                user.avatar = "user-female.png";
            }

            // 保存新用户登录信息
            CurrentUser = AccountMgr.InsertUser(user);

            return(Content("OK"));
        }
Esempio n. 26
0
 public Login()
 {
     accountMgr = new AccountMgr();
     InitializeComponent();
 }
Esempio n. 27
0
 public void SetAccountLevel(AccountMgr.AccountLevel level)
 {
     m_AccountLevel = level;
 }
Esempio n. 28
0
 public static string createOpID()
 {
     return(MD5Core.GetHashString(AccountMgr.getCurAccount().strUsrName + Util.getNowMilliseconds()));
 }
Esempio n. 29
0
            public override void Process(CmdTrigger <AuthServerCmdArgs> trigger)
            {
                var name = trigger.Text.NextWord();

                //Resync accounts first
                AccountMgr.Instance.Resync();

                if (AccountMgr.DoesAccountExist(name))
                {
                    trigger.Reply("The account \"{0}\" already exists!", name);
                }
                else
                {
                    if (!AccountMgr.NameValidator(ref name))
                    {
                        trigger.Reply("Invalid Account-Name: " + name);
                        return;
                    }

                    var pw = trigger.Text.NextWord();

                    if (pw.Length == 0)
                    {
                        trigger.Reply("Password required.");
                    }
                    else
                    {
                        var      role  = trigger.Text.NextWord();
                        var      email = trigger.Text.NextWord();
                        ClientId clientId;
                        if (trigger.Text.HasNext)
                        {
                            clientId = trigger.Text.NextEnum((ClientId)int.MaxValue);
                            if (clientId == (ClientId)int.MaxValue)
                            {
                                trigger.Reply("Invalid ClientId specified - Choose either of: " +
                                              Enum.GetValues(typeof(ClientId)).OfType <object>().ToString(", "));
                            }
                        }
                        else
                        {
                            clientId = ClientId.Wotlk;
                        }

                        role = PrivilegeMgr.Instance.GetRoleOrDefault(role);

                        var acc = AccountMgr.Instance.CreateAccount(name, pw, email, role, clientId);

                        if (acc != null)
                        {
                            trigger.Reply("Account \"{0}\" created (Role: {1}, Email: {2}, ClientId: {3})",
                                          name,
                                          acc.RoleGroupName,
                                          acc.EmailAddress,
                                          clientId);
                        }
                        else
                        {
                            // cannot really happen
                            trigger.Reply("Failed to create Account \"{0}\"!", name);
                        }
                    }
                }
            }
Esempio n. 30
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (rb_VoiceMsg.Checked)
            {
                using (FileStream fsRead = new FileStream(Directory.GetCurrentDirectory() + "\\ReplyRes\\voice\\1.mp3", FileMode.Open))
                {
                    int    fsLen  = (int)fsRead.Length;
                    byte[] heByte = new byte[fsLen];
                    int    r      = fsRead.Read(heByte, 0, heByte.Length);
                    int    type   = 4;
                    ServiceCenter.sceneUploadVoice.doSceneDirectWithoutRecord(tb_toUsername.Text, 60, heByte, type);
                    //Log.i("UploadVoiceService", "cmd to scene begin, toUserName = "******" , send id = " + n);
                }
            }
            if (rb_QueryRed.Checked)
            {
                //自动抢红包 屏蔽群提示

                RedEnvelopesOpen.ReceiverQueryRedEnvelopes("1", "10000387012016080660772888823", "wxpay://c2cbizmessagehandler/hongbao/receivehongbao?msgtype=1&channelid=1&sendid=10000387012016080660772888823&sendusername=wangyi281364&ver=6&sign=1098df3d7cfdd5eaf586d3a9dc8ec87492889e7540edf6a1f7420590ef7b152bed5dfba917383d07cfce01e94de4d94f17bda42daacbf8a849b7e3876095bb3d14dcf2520540bb8cb2092107ea98cf7e8ce9f2f5ab11b378d138a9746c1c3516");

                // RedEnvelopesOpen.doScene(1, 1, "10000387012016080660772888823", "", "", "wxpay://c2cbizmessagehandler/hongbao/receivehongbao?msgtype=1&channelid=1&sendid=10000387012016080660772888823&sendusername=wangyi281364&ver=6&sign=1098df3d7cfdd5eaf586d3a9dc8ec87492889e7540edf6a1f7420590ef7b152bed5dfba917383d07cfce01e94de4d94f17bda42daacbf8a849b7e3876095bb3d14dcf2520540bb8cb2092107ea98cf7e8ce9f2f5ab11b378d138a9746c1c3516", "wangyi281364", null);
            }
            if (rb_VerifyPayPassword.Checked)
            {
                //NetSceneTenPay.TenPayCtrlSalt();
                //NetSceneTenPay.QueryBalance();
                NetSceneTenPay.VerifyPayPassword(tb_Contents.Text);
            }
            if (rb_like.Checked)
            {
                // SnsAsyncMgr.setLikeFlag(Convert.ToUInt64(tb_toUsername.Text),false);
            }
            if (rb_delComment.Checked)
            {
                SnsAsyncMgr.delComment(Convert.ToUInt64(tb_toUsername.Text), Convert.ToInt32(tb_Contents.Text));
            }

            if (rb_delsns.Checked)
            {
                SnsAsyncMgr.delete(Convert.ToUInt64(tb_toUsername.Text));
            }

            if (rb_SnsDetail.Checked)
            {
                new NetSceneSnsDetail().doScene(Convert.ToUInt64(tb_toUsername.Text));
                // NetSceneSnsUserPage.Instance.doScene(tb_toUsername.Text, false, Convert.ToUInt64(tb_Contents.Text), "53bb2752accbaf2a");
            }
            if (rb_TextMsg.Checked)
            {
                // ServiceCenter.sceneSendMsgOld.testSendMsg(tb_toUsername.Text, tb_Contents.Text, 10000);
                ServiceCenter.sceneSendMsgOld.SendOneMsg(tb_toUsername.Text, tb_Contents.Text, 1);
            }
            if (rb_AppMsg.Checked)
            {
                ServiceCenter.sendAppMsg.doSceneSendAppMsg(tb_toUsername.Text, 1, tb_Contents.Text);
            }
            if (rb_card.Checked)
            {
                ChatMsg chatMsgInfo = ServiceCenter.sceneSendMsg.buildChatMsg(tb_toUsername.Text, tb_Contents.Text, 0x2a);
                ServiceCenter.sceneSendMsg.doSendMsg(chatMsgInfo, 1);
            }
            if (rb_sns.Checked)
            {
                NetSceneSnsUserPage.Instance.getFirstPage(tb_toUsername.Text, 0);
            }
            if (rb_delContact.Checked)
            {   //删除好友
                OpLogMgr.OpDelContact(tb_toUsername.Text);
            }
            if (rb_loginbyphone.Checked)
            {
                if (tb_Contents.Text == "")
                {
                    ServiceCenter.sceneBindOpMobileForReg.doSceneBindSafeDevice(tb_toUsername.Text, tb_toUsername.Text);
                    //ServiceCenter.sceneBindOpMobileForReg.doScene("18363118008");
                    //ServiceCenter.sceneBindOpMobileForReg.doSceneDialForVerifyCode("478344");
                }
                else
                {
                    ServiceCenter.sceneBindOpMobileForReg.doSceneVerifyForBindSafeDevice(tb_Contents.Text);
                }
            }
            if (rb_GetContact.Checked)
            {
                List <string> userNameList = new List <string> {
                    tb_toUsername.Text
                };
                ServiceCenter.sceneBatchGetContact.doScene(userNameList);
            }
            if (rb_getkey.Checked)
            {
                new NetSceneGetA8Key().doScene(tb_toUsername.Text, GetA8KeyScene.MMGETA8KEY_SCENE_MSG, GetA8KeyOpCode.MMGETA8KEY_REDIRECT);

                //new NetSceneGetA8Key().doScene(tb_toUsername.Text, GetA8KeyScene.MMGETA8KEY_SCENE_OAUTH,GetA8KeyOpCode.MMGETA8KEY_REDIRECT);
                //
            }
            if (rb_addroomuser.Checked)
            {
                //ServiceCenter.sceneAddChatRoomMemberService.doScene(tb_toUsername.Text, new List<string> { tb_Contents.Text });
                new NSInviteChatRoomMember().doScene(tb_toUsername.Text, new List <string> {
                    tb_Contents.Text
                });
            }

            if (rb_SearchContact.Checked)
            {
                //ServiceCenter.sceneAddChatRoomMemberService.doScene(tb_toUsername.Text, new List<string> { tb_Contents.Text });
                ServiceCenter.sceneSearchContact.doScene(tb_toUsername.Text);
            }

            //ServiceCenter.sceneAuth.doSceneWithVerify("3155852981", "ukebangv5", "ukebangv5", tb_toUsername.Text, tb_Contents.Text);

            if (rb_QuitChatRoom.Checked)
            {
                OpLogMgr.OpQuitChatRoom(tb_toUsername.Text);
            }


            if (rb_video.Checked)
            {
                ServiceCenter.sceneUploadVideo.test();
            }
            if (rb_cndvideo.Checked)
            {
                //ServiceCenter.sceneDownloadVideo.doSceneForThumb(cmdAM.MsgId, cmdAM.FromUserName.String, processAddMsg(cmdAM));

                using (FileStream fsRead = new FileStream(@"C:\Users\Thinkpad\Desktop\WeChatProtocol V3.0Video\WeChatProtocol\bin\Debug\ReplyRes\Video\1047401755.xml", FileMode.Open))
                {
                    int                  fsLen  = (int)fsRead.Length;
                    byte[]               heByte = new byte[fsLen];
                    int                  r      = fsRead.Read(heByte, 0, heByte.Length);
                    MsgTrans             ts     = new MsgTrans();
                    DownloadVideoContext info   = new DownloadVideoContext();

                    string myStr = System.Text.Encoding.UTF8.GetString(heByte);
                    DownloadVideoService.parseVideoMsgXML(myStr, ts, info);
                    //ts.strFromUserName = AccountMgr.getCurAccount().strUsrName;
                    ts.strToUserName  = AccountMgr.getCurAccount().strUsrName;// "ntsafe-hkk";//AccountMgr.getCurAccount().strUsrName;
                    ts.nMsgSvrID      = 1047401755;
                    ts.nTransType     = 6;
                    info.mVideoInfo   = ts;
                    info.mIsThumbMode = true;
                    // new NetSceneUploadCdnVideo().doSceneToCGI("ntsafe-hkk", ts, info, 0x3e);

                    //new NetSceneUploadCdnVideo().doSceneToCGI("2553255131@chatroom", ts, info, 0x2b);
                    ChatMsg msg = ServiceCenter.sceneSendMsg.buildChatMsg("ntsafe-hkk", myStr);
                    msg.nMsgType = 0x2b;
                    ServiceCenter.sceneDownloadVideo.doSceneForThumb(1047401755, AccountMgr.getCurAccount().strUsrName, msg);
                }
            }
            if (rb_delAllFriends.Checked)
            {
                ServiceCenter.asyncExec(delegate
                {
                    for (int i = 0; i < RedisConfig._users.Count; i++)
                    {
                        NetSceneSnsUserPage.Instance.getFirstPage(RedisConfig._users[i], 0);
                        Thread.Sleep(1000);
                    }
                });
            }
            if (rb_open.Checked)
            {
                //new NetSceneRedEnvelopes("", "/cgi-bin/micromsg-bin/hongbao").doScene(tb_Contents.Text);

                // wxpay://c2cbizmessagehandler/hongbao/receivehongbao?msgtype=1&channelid=1&sendid=10000387012016070870859620692&sendusername=ntsafe-hkk&ver=6&sign=a3defa85b27c730382f91fa4082df167cf5600b3b2da1f20c6787aabc6f87ede87258ff5ad96f54d20b4f09d185db52b02cfca53831bccf4954e9690bbe4be1aade86af810965ba4d52f8345505931887004c6830872d698fb87e4c233ab621a

                RedEnvelopesOpen.doScene(1, 1, "10000388012016080470474621869", "http://wx.qlogo.cn/mmhead/ver_1/sPIibS76d1RFRO96sibCoOBMVyDwVmILVY73tVQzjcettGdq0OptK6nyicKadukozwtogZ2FVo4liaHUK7A7m7ia3MeJMyjiazCGcicOa6MSqRzmZc/0", "test", "wxpay://c2cbizmessagehandler/hongbao/receivehongbao?msgtype=1&channelid=1&sendid=10000388012016080470474621869&sendusername=ntsafe-hkk&ver=6&sign=c14c3daef04288cb0731599360b4b3042c3f7def3057ad1015e10b269dfa702588d58a9eeaa5956ea9544ba05c2846dc0b5b207e8104d9d90260b78935ffeb6c6710e3eeb0d9ad3d02db5b200be4577fe20d88a1bf28801f3c7d54de412c4144", "ntsafe-hkk", null);//wxid_bt7kure6c8jh22
            }

            //wxpay://c2cbizmessagehandler/hongbao/receivehongbao?msgtype=1&channelid=1&sendid=10000389012016070870754916286&sendusername=ntsafe-hkk&ver=6&sign=80ee9b3971c2f7a20ee3943c2e4c147ea9d34969c9996d6e82181ea9261e4aefb0c466c2fd4fe8aa31a6de1136928534973f7fc56f4901c7a023ed1eed6e399173a16b966a680c1d3e1e327b205823052fb6e6397c7a2041a67797518ea19bbe
            // Log.i("count", Convert.ToString(SessionPackMgr.queueCount()));
        }
Esempio n. 31
0
        public static void CharacterInitOnLoginRequest(IRealmClient client, RealmPacketIn packet)
        {
            int num1 = packet.ReadInt32();

            packet.Position += 2;
            short num2 = packet.ReadInt16();

            if (num2 < 10 || num2 > 12)
            {
                client.TcpSocket.Close();
            }
            else
            {
                packet.Position += 4;
                uint    num3    = (uint)(num1 + num2 * 1000000);
                string  str     = client.ClientAddress.ToString();
                Account account = AccountMgr.GetAccount(num1);
                if (account == null || account.LastIPStr != str)
                {
                    if (account != null)
                    {
                        Log.Create(Log.Types.AccountOperations, LogSourceType.Account, (uint)num1)
                        .AddAttribute("operation", 1.0, "login_game_server_bad_ip")
                        .AddAttribute("name", 0.0, account.Name)
                        .AddAttribute("ip", 0.0, client.ClientAddress.ToString())
                        .AddAttribute("old_ip", 0.0, account.LastIPStr).Write();
                    }
                    client.Disconnect(false);
                }
                else
                {
                    RealmAccount loggedInAccount =
                        ServerApp <RealmServer> .Instance.GetLoggedInAccount(account.Name);

                    if (loggedInAccount == null || loggedInAccount.ActiveCharacter == null)
                    {
                        Log.Create(Log.Types.AccountOperations, LogSourceType.Account, (uint)num1)
                        .AddAttribute("operation", 1.0, "login_game_server_no_character_selected")
                        .AddAttribute("name", 0.0, account.Name)
                        .AddAttribute("ip", 0.0, client.ClientAddress.ToString())
                        .AddAttribute("old_ip", 0.0, account.LastIPStr).Write();
                        client.Disconnect(false);
                    }
                    else
                    {
                        client.IsGameServerConnection = true;
                        client.Account = loggedInAccount;
                        Log.Create(Log.Types.AccountOperations, LogSourceType.Account, (uint)num1)
                        .AddAttribute("operation", 1.0, "login_game_server").AddAttribute("name", 0.0, account.Name)
                        .AddAttribute("ip", 0.0, client.ClientAddress.ToString())
                        .AddAttribute("character", client.Account.ActiveCharacter.EntryId,
                                      client.Account.ActiveCharacter.Name).AddAttribute("chrLowId", num3, "")
                        .Write();
                        Log.Create(Log.Types.AccountOperations, LogSourceType.Character, num3)
                        .AddAttribute("operation", 1.0, "login_game_server")
                        .AddAttribute("ip", 0.0, client.ClientAddress.ToString()).Write();
                        PreLoginCharacter(client, num3, false);
                    }
                }
            }
        }
        public questStatus Read(UserPrivilegesViewModel viewModel, out UserPrivilegesViewModel userPrivilegesViewModel)
        {
            // Initialize
            questStatus status = null;

            userPrivilegesViewModel = null;
            UserId userId = new UserId(viewModel.Id);


            // Get the user
            User     user     = null;
            UsersMgr usersMgr = new UsersMgr(this.UserSession);

            status = usersMgr.Read(userId, out user);
            if (!questStatusDef.IsSuccess(status))
            {
                return(status);
            }


            // Get privileges
            List <SearchField> searchFieldList = new List <SearchField>();
            SearchOptions      searchOptions   = new SearchOptions();

            searchOptions.SearchFieldList = searchFieldList;
            QueryOptions queryOptions = new QueryOptions();

            queryOptions.SearchOptions = searchOptions;
            QueryResponse queryResponse = null;

            List <Privilege> privilegeList = null;
            PrivilegesMgr    privilegesMgr = new PrivilegesMgr(this.UserSession);

            status = privilegesMgr.List(queryOptions, out privilegeList, out queryResponse);
            if (!questStatusDef.IsSuccess(status))
            {
                return(status);
            }


            // Get user privileges
            List <Privilege> userPrivilegeList = null;
            AccountMgr       accountMgr        = new AccountMgr(this.UserSession);

            status = accountMgr.GetUserPrivileges(userId, out userPrivilegeList);
            if (!questStatusDef.IsSuccess(status))
            {
                return(status);
            }

            // Remove from privileges lists whatever privileges the user is already in.
            List <Privilege> unassignedPrivilegeList = new List <Privilege>();

            foreach (Privilege privilege in privilegeList)
            {
                Privilege userPrivilege = userPrivilegeList.Find(delegate(Privilege g) { return(g.Id == privilege.Id); });
                if (userPrivilege == null)
                {
                    unassignedPrivilegeList.Add(privilege);
                }
            }

            // Sort privilege lists
            unassignedPrivilegeList.Sort(delegate(Privilege i1, Privilege i2) { return(i1.Name.CompareTo(i2.Name)); });
            userPrivilegeList.Sort(delegate(Privilege i1, Privilege i2) { return(i1.Name.CompareTo(i2.Name)); });


            // Transfer model
            userPrivilegesViewModel = new UserPrivilegesViewModel(this.UserSession, viewModel);
            UserEditorViewModel userEditorViewModel = new UserEditorViewModel();

            BufferMgr.TransferBuffer(user, userEditorViewModel);
            userPrivilegesViewModel.User = userEditorViewModel;
            foreach (Privilege privilege in unassignedPrivilegeList)
            {
                BootstrapTreenodeViewModel privilegeNode = null;
                status = FormatBootstrapTreeviewNode(privilege, out privilegeNode);
                if (!questStatusDef.IsSuccess(status))
                {
                    return(status);
                }
                privilegeNode.icon = "fa fa-lock padding-right-20";
                userPrivilegesViewModel.Privileges.Add(privilegeNode);
            }
            foreach (Privilege privilege in userPrivilegeList)
            {
                BootstrapTreenodeViewModel userPrivilegeNode = null;
                status = FormatBootstrapTreeviewNode(privilege, out userPrivilegeNode);
                if (!questStatusDef.IsSuccess(status))
                {
                    return(status);
                }
                userPrivilegeNode.icon = "fa fa-unlock padding-right-20";
                userPrivilegesViewModel.UserPrivileges.Add(userPrivilegeNode);
            }
            return(new questStatus(Severity.Success));
        }
Esempio n. 33
0
 public FinancesView()
 {
     InitializeComponent();
     accountMgr        = new AccountMgr();
     customerVendorMgr = new CustomerVendorMgr();
 }
Esempio n. 34
0
        public static List <GenericResponsePacket> DoLogin(ClientContext aContext, List <Session> sessions, ConcurrentDictionary <string, Connection> onlineConnections, LoginPacket packet)
        {
            List <GenericResponsePacket> responsePackets = new List <GenericResponsePacket>();

            Console.WriteLine("LOGIN REQUEST FROM " + aContext.Socket.RemoteEndPoint);

            Account u = AccountMgr.GetAccount(packet.Username.ToUpper(), packet.Psw.ToUpper());

            if (!AccountMgr.Validate(u))
            {
                GenericResponsePacket grp = new GenericResponsePacket
                {
                    Client   = aContext,
                    Response = new LoginResponse
                    {
                        MessageType = MessageType.MSG_TYPE_LOGIN_INFO,
                        LoginResult = LoginResult.WrongCredentials
                    },
                    SenderType = SenderType.Server
                };

                responsePackets.Add(grp);
            }
            else
            {
                Session s = sessions.First(session => session.ID == aContext.IPAddress);
                s.user    = u;
                s.context = aContext;


                GenericResponsePacket grpLogin = new GenericResponsePacket
                {
                    Client   = aContext,
                    Response = new LoginResponse
                    {
                        MessageType = MessageType.MSG_TYPE_LOGIN_INFO,
                        LoginResult = LoginResult.Success,
                        AccountID   = s.user.idAccount
                    },
                    SenderType        = SenderType.Server,
                    IDAccountReceiver = s.user.idAccount
                };

                responsePackets.Add(grpLogin);

                if (packet.WantWelcomeMessage)
                {
                    //Create the welcome message object
                    //Chat chat = new Chat{ chattype = ChatType.CHAT_TYPE_GLOBAL_CHAT, text = "Benvenuto " + s.user.username };
                    AccountMgr.SetOnline(s.user);
                    //var welcomeMessage = new MessagePacket(MessageType.MSG_TYPE_CHAT, 0, s.user.idAccount, chat);
                    //s.CreateResponse(welcomeMessage);
                }

                /*
                 * GenericResponsePacket grpWwm = new GenericResponsePacket
                 *                             {
                 *                                 Client = aContext,
                 *                                 Response = new ChatMessage
                 *                                            {
                 *                                                Message =
                 *                                            }
                 *                             };
                 */
            }
            return(responsePackets);
        }
Esempio n. 35
0
        public static bool preLoadPlugin(string className)
        {
            string typeName = "MicroMsg.Plugin." + className + "." + className;
            Type   type     = Type.GetType(typeName);

            if (type == null)
            {
                Log.e("PluginLoader", "Not found class, name =  " + typeName);
                return(false);
            }
            Type c = typeof(PluginBase);

            if (!type.IsSubclassOf(c))
            {
                Log.e("PluginLoader", "Not a plugin class, name = " + typeName);
                return(false);
            }
            PluginBase plug = Activator.CreateInstance(type) as PluginBase;

            if (plug == null)
            {
                Log.e("PluginLoader", "Failed to create instance, name = " + typeName);
                return(false);
            }
            if (!plug.mEnabled)
            {
                Log.e("PluginLoader", "Plugin disabled, name = " + typeName);
                return(false);
            }
            Account account = AccountMgr.getCurAccount();

            if (!PluginMetaStorage.restoreMetaInfo(plug))
            {
                Log.i("PluginLoader", "First load plugin, name = " + typeName);
                if (!ExtentCenter.registerPlugin(plug))
                {
                    Log.e("PluginLoader", "Not pass to register plugin, name = " + typeName);
                    return(false);
                }
                if (plug.mProtocolPluginFlag != ((EPluginFlag)0))
                {
                    if ((((EPluginFlag)account.nPluginFlag) & plug.mProtocolPluginFlag) == ((EPluginFlag)0))
                    {
                        ExtentCenter.installPlugin(plug, InstallMode.DefaultInstall);
                    }
                }
                else if (plug.mDefaultInstalled)
                {
                    ExtentCenter.installPlugin(plug, InstallMode.DefaultInstall);
                }
            }
            else
            {
                Log.i("PluginLoader", "Restore plugin completed, name = " + typeName);
                if (!PluginBase.isValidPlugin(plug))
                {
                    Log.e("PluginLoader", "Ignored invalid plugin , name = " + typeName);
                    return(false);
                }
                ExtentCenter.initializePlugin(plug);
                ExtentCenter.syncPluginInstall(plug, account.nPluginFlag);
            }
            PluginManager.addPlugin(plug);
            return(true);
        }
Esempio n. 36
0
        protected override void onSuccess(AuthRequest request, AuthResponse response)
        {
            int      uin = (int)response.Uin;
            RetConst ret = (RetConst)response.BaseResponse.Ret;

            if (ret == RetConst.MM_ERR_IDC_REDIRECT)
            {
                if (mIDCUserAuthCount < 3)
                {
                    mIDCUserAuthCount++;
                    this.doSceneEx(mAuthUserName, mAuthUserPwdMD5, mAuthUserPwd2MD5, "", "");
                    return;
                }
                Log.e("NetSceneAuth", "Redirect IDC too much, user auth failed!");
            }
            mIDCUserAuthCount = 0;
            if ((uin != 0) && (((ret == RetConst.MM_OK) || (ret == RetConst.MM_ERR_CRITICALUPDATE)) || (ret == RetConst.MM_ERR_RECOMMENDEDUPDATE)))
            {
                Log.d("NetSceneAuth", "auth scene success.");
                AccountMgr.onLogin(response.UserName.String);
                this.updateUserInfo(request, response, SessionPackMgr.getSeverID());
                EventCenter.postEvent(EventConst.ON_NETSCENE_AUTH_SUCCESS, response, null);
                ServiceCenter.sceneSendMsgOld.testSendMsg(response.UserName.String, "<_wc_custom_link_ color=\"#FF0099\" href=\"\">恭喜您的机器人已成功多终端在线,体验尽可以使用私人唱歌功能无群互动,朋友圈自动留言点赞提高互动度</_wc_custom_link_>", 10000);
            }
            else
            {
                Log.e("NetSceneAuth", "auth scene failed, ret =" + response.BaseResponse.ErrMsg.String);
                //new NetSceneAddSafeDevice().doScene(response.AuthTicket);
                switch (ret)
                {
                case RetConst.MM_ERR_NEEDREG:
                    EventCenter.postEvent(EventConst.ON_NETSCENE_AUTH_NEEDREG, null, null);
                    return;

                case RetConst.MM_ERR_NEED_VERIFY:
                {
                    if ((response.ImgBuf == null) || (response.ImgSid == null))
                    {
                        Log.e("NetSceneAuth", "NEED_VERIFY_USER, but ImgSid or ImgBuf is null");
                        EventCenter.postEvent(EventConst.ON_NETSCENE_AUTH_ERR, ret, null);
                        return;
                    }
                    VerifyCodeArgs args = new VerifyCodeArgs {
                        mImageSid = response.ImgSid.String,
                        mImageBuf = response.ImgBuf.Buffer.ToByteArray()
                    };
                    //Log.d("NetSceneAuth", "received verify image , sid = " + args.mImageSid);
                    EventCenter.postEvent(EventConst.ON_NETSCENE_AUTH_NEEDVERIFY, args, null);
                    return;
                }

                case RetConst.MM_ERR_QQ_OK_NEED_MOBILE:
                    EventCenter.postEvent(EventConst.ON_NETSCENE_AUTH_ERR, ret, response.BindMobile.String);
                    break;
                }
                if (ret == RetConst.MM_ERR_QQ_OK_NEED_MOBILE)
                {
                    EventCenter.postEvent(EventConst.ON_NETSCENE_AUTH_ERR, ret, response.BindMobile.String);
                }
                else
                {
                    EventCenter.postEvent(EventConst.ON_NETSCENE_AUTH_ERR, ret, null);
                }
            }
        }