Пример #1
0
        private static void OnPerformanceTimerCallback(object state)
        {
            int availableWorkingThreads, availableCompletionPortThreads;

            ThreadPool.GetAvailableThreads(out availableWorkingThreads, out availableCompletionPortThreads);

            int maxWorkingThreads;
            int maxCompletionPortThreads;

            ThreadPool.GetMaxThreads(out maxWorkingThreads, out maxCompletionPortThreads);

            var globalPerfData = new GlobalPerformanceData
            {
                AvailableWorkingThreads        = availableWorkingThreads,
                AvailableCompletionPortThreads = availableCompletionPortThreads,
                MaxWorkingThreads        = maxWorkingThreads,
                MaxCompletionPortThreads = maxCompletionPortThreads,
                CpuUsage         = m_CpuUsagePC.NextValue() / m_CpuCores,
                TotalThreadCount = (int)m_ThreadCountPC.NextValue(),
                WorkingSet       = (long)m_WorkingSetPC.NextValue()
            };

            var perfBuilder = new StringBuilder();

            perfBuilder.AppendLine("---------------------------------------------------");
            perfBuilder.AppendLine(string.Format("CPU Usage: {0}%, Physical Memory Usage: {1:N}, Total Thread Count: {2}", globalPerfData.CpuUsage.ToString("0.00"), globalPerfData.WorkingSet, globalPerfData.TotalThreadCount));
            perfBuilder.AppendLine(string.Format("AvailableWorkingThreads: {0}, AvailableCompletionPortThreads: {1}", globalPerfData.AvailableWorkingThreads, globalPerfData.AvailableCompletionPortThreads));
            perfBuilder.AppendLine(string.Format("MaxWorkingThreads: {0}, MaxCompletionPortThreads: {1}", globalPerfData.MaxWorkingThreads, globalPerfData.MaxCompletionPortThreads));

            var instancesData = new List <PerformanceDataInfo>(m_ServerList.Count);

            m_ServerList.ForEach(s =>
            {
                var perfSource = s as IPerformanceDataSource;
                if (perfSource != null)
                {
                    var perfData = perfSource.CollectPerformanceData(globalPerfData);

                    instancesData.Add(new PerformanceDataInfo {
                        ServerName = s.Name, Data = perfData
                    });

                    perfBuilder.AppendLine(string.Format("{0} - Started Time: {1}, Total Connections: {2}, Total Handled Commands: {3}, Command Handling Speed: {4:f0}/s",
                                                         s.Name,
                                                         s.StartedTime,
                                                         perfData.CurrentRecord.TotalConnections,
                                                         perfData.CurrentRecord.TotalHandledCommands,
                                                         (perfData.CurrentRecord.TotalHandledCommands - perfData.PreviousRecord.TotalHandledCommands) / perfData.CurrentRecord.RecordSpan));
                }
            });

            LogUtil.LogPerf(perfBuilder.ToString());

            var handler = Messanger.GetHandler <PermformanceDataEventArgs>();

            if (handler != null)
            {
                handler(new PermformanceDataEventArgs(globalPerfData, instancesData.ToArray()));
            }
        }
Пример #2
0
        private void f_createBtn_Click(object sender, EventArgs e)
        {
            /*VALIDATION*/


            if (string.IsNullOrEmpty(f_titleTxt.Text))
            {
                Messanger.Error("Invalid title field");
                return;
            }
            else
            {
                Title = f_titleTxt.Text;
            }



            if (string.IsNullOrEmpty(f_teacherTxt.Text))
            {
                Messanger.Error("Invalid teacher field");
                return;
            }
            else
            {
                Teacher = f_teacherTxt.Text;
            }

            Close();
        }
Пример #3
0
 private void PublishSystemMessage(string messageToSend)
 {
     Messanger.Publish(new SystemNotyficationMessage
     {
         Message = messageToSend
     });
 }
        private void generateHtml_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(f_titleLbl.Text))
            {
                Messanger.Warning("First, you need to create subject");
                return;
            }


            if (subject.Semesters.Count == 0)
            {
                Messanger.Warning("Semesters list is empty");
                return;
            }

            FolderBrowserDialog folder = new FolderBrowserDialog();

            if (folder.ShowDialog() == DialogResult.Cancel)
            {
                return;
            }


            pageConfiguration config = new pageConfiguration();

            config.ShowDialog();

            HtmlGenerator html = new HtmlGenerator(folder.SelectedPath, subject, config.config);

            Messanger.Information("File generated successfully!");
        }
Пример #5
0
 public XmppClient(string url, string username, string password)
 {
     _url = url;
     _username = username;
     _password = password;
     Messanger = new Messanger();
 }
Пример #6
0
        public void Init()
        {
            RestClientMock = new Mock <IRestClient>();
            LoggerMock     = new Mock <ILogger <Messanger> >();

            sut = new Messanger(RestClientMock.Object, LoggerMock.Object, hereApi);
        }
Пример #7
0
        public StartMatchmakingResponse JoinMatchmakingQueue(Game game, GameMode mode, int msTimeout = 10000)
        {
            var req = new StartMatchmakingRequest(game.Id, mode.Name, game.Name, game.Version, mode.PlayerCount, typeof(MatchmakingCog).Assembly.GetName().Version, _client.Config.MatchamkingBotUser.JidUser);
            var mut = new AutoResetEvent(false);

            using (var mess = new Messanger())
            {
                mess.OnResetXmpp(_xmpp);
                StartMatchmakingResponse resp = null;
                mess.Map <StartMatchmakingResponse>(x =>
                {
                    if (x.RequestId == req.RequestId)
                    {
                        resp = x;
                    }
                    mut.Set();
                });

                mess.Send(req);
                if (!mut.WaitOne(msTimeout))
                {
                    return(null);
                }
                return(resp);
            }
        }
Пример #8
0
        public static bool Start()
        {
            if (!m_Initialized)
            {
                LogUtil.LogError("You cannot invoke method Start() before initializing!");
                return(false);
            }

            foreach (IAppServer server in m_ServerList)
            {
                if (!server.Start())
                {
                    LogUtil.LogError("Failed to start " + server.Name + " server!");
                }
                else
                {
                    LogUtil.LogInfo(server.Name + " has been started");
                }
            }

            Messanger.Send <List <IAppServer> >(m_ServerList);

            if (!m_Config.DisablePerformanceDataCollector)
            {
                StartPerformanceLog();
            }

            return(true);
        }
Пример #9
0
 public HolidayViewModel(IMainRepository repository)
 {
     _model       = new HolidayModel(repository);
     _messanger   = new Messanger();
     _monthsNames = InitializeMonthsCollection();
     _days        = InitializeDaysCollection();
     IntializeSelectedData();
 }
Пример #10
0
        public bool CreateUserAndAccount(RegisterModel model, out string result)
        {
            result = Messanger.Get(EMessages.CannotCreateUser);
            var account       = new Account();
            var accountMapper = new AccountMapper();

            accountMapper.Map(model, account);
            return(_accountFacade.SaveOrUpdate(account));
        }
Пример #11
0
 public MainViewModel(Window mainWindow)
 {
     _model               = new AppModel();
     _viewService         = new ViewService();
     _autoUpdateViewTimer = new Timer(new TimerCallback(AutoUpdateView), null, 0, 250);
     _noteDescription     = string.Empty;
     _mainWindow          = mainWindow;
     _messanger           = new Messanger();
     _messanger.AddUpdater(AutoUpdateHolidayCollection);
 }
Пример #12
0
        /*Check lessons hour field for correct number*/
        private bool checkLessonsHours()
        {
            if (string.IsNullOrEmpty(f_lectureHoursTxt.Text) &&
                string.IsNullOrEmpty(f_laboratoryHoursTxt.Text) &&
                string.IsNullOrEmpty(f_practiceHoursTxt.Text))
            {
                Messanger.Warning("Semester cant be empty. Please fill a fields");
                return(false);
            }


            if (!string.IsNullOrEmpty(f_lectureHoursTxt.Text))
            {
                try
                {
                    semester.Lectures.Hours = short.Parse(f_lectureHoursTxt.Text);
                }
                catch (FormatException)
                {
                    Messanger.Error("Lecture hours field invalid");
                    return(false);
                }
            }


            if (!string.IsNullOrEmpty(f_practiceHoursTxt.Text))
            {
                try
                {
                    semester.Practice.Hours = short.Parse(f_practiceHoursTxt.Text);
                }
                catch (FormatException)
                {
                    Messanger.Error("Practice hours field invalid");
                    return(false);
                }
            }


            if (!string.IsNullOrEmpty(f_laboratoryHoursTxt.Text))
            {
                try
                {
                    semester.Laboratory.Hours = short.Parse(f_laboratoryHoursTxt.Text);
                }
                catch (FormatException)
                {
                    Messanger.Error("Laboratory hours field invalid");
                    return(false);
                }
            }

            return(true);
        }
Пример #13
0
        public MatchmakingBot()
            : base(AppConfig.Instance.ServerPath, AppConfig.Instance.XmppUsername, AppConfig.Instance.XmppPassword)
        {
            ElementFactory.AddElementType("gameitem", "octgn:gameitem", typeof(HostedGameData));
            Messanger.Map <StartMatchmakingRequest>(StartMatchmakingMessage);
            Messanger.Map <MatchmakingLeaveQueueMessage>(LeaveMatchmakingQueueMessage);

            Queue           = new List <MatchmakingQueue>();
            _timer          = new Timer(2000);
            _timer.Elapsed += TimerOnElapsed;
            _timer.Start();
        }
Пример #14
0
        public MatchmakingCog(Client c, XmppClientConnection xmpp)
        {
            _client = c;
            _xmpp = xmpp;
            _messanger = new Messanger();
            _messanger.OnResetXmpp(xmpp);

            _messanger.Map<MatchmakingInLineUpdateMessage>(OnMatchmakingInLineUpdateMessage);
            _messanger.Map<MatchmakingReadyRequest>(OnMatchmakingReadyRequest);
            _messanger.Map<MatchmakingReadyFail>(OnMatchmakingFail);

            xmpp.OnMessage += XmppOnOnMessage;
        }
Пример #15
0
        public MatchmakingCog(Client c, XmppClientConnection xmpp)
        {
            _client    = c;
            _xmpp      = xmpp;
            _messanger = new Messanger();
            _messanger.OnResetXmpp(xmpp);

            _messanger.Map <MatchmakingInLineUpdateMessage>(OnMatchmakingInLineUpdateMessage);
            _messanger.Map <MatchmakingReadyRequest>(OnMatchmakingReadyRequest);
            _messanger.Map <MatchmakingReadyFail>(OnMatchmakingFail);

            xmpp.OnMessage += XmppOnOnMessage;
        }
Пример #16
0
        private static void TestMeduator()
        {
            var messanger = new Messanger();
            var shop      = new Shop(messanger);
            var stock     = new Stock(messanger);
            var code      = shop.AddBook("Приключение чиполлино");
            var newBook   = shop.GetBook(code);

            Console.WriteLine($"Книга \"{newBook.Name}\" - количество:{newBook.Count}");

            stock.Trace(code, 15);

            Console.WriteLine($"Книга \"{newBook.Name}\" - количество:{newBook.Count}");
        }
Пример #17
0
        protected void StopProfiling()
        {
            Messanger.StopListen();
            string resultPath = Path.Combine(WorkingDirectory, "result.txt");

            if (FileSystem.FileExist(resultPath))
            {
                using (Stream stream = FileSystem.OpenFileRead(resultPath))
                    Results.MethodInfos = new MethodInfosViewModel {
                        Methods = JsonSerializer.DeserializeFromStream <List <MethodInfo> >(stream)
                    };
            }

            ProfilingFinished();
        }
Пример #18
0
        static void Main(string[] args)
        {
            if (_sourceDirectory == null || _destinationDirectory == null)
            {
                return;
            }

            IMessanger logger = new Messanger(_logFile);

            logger.Start();

            FilesCollector filesCollector = new FilesCollector(logger);

            filesCollector.Collect(_sourceDirectory, _destinationDirectory);
        }
Пример #19
0
        public void ShowMessage()
        {
            Messages messages = new Messages(UtilityTestClass.NormalTestXMLFilePath);

            UtilityLibrary.Messanger messanger = new Messanger(UtilityTestClass.NormalTestXMLFilePath);
            DialogResult             dialogResult;

            //異常系
            //存在していないIDを指定
            bool isThrownError = false;

            try
            {
                dialogResult = messanger.ShowMessage("0000");
            }
            catch
            {
                isThrownError = true;
            }

            //MessageType = Cを指定
            isThrownError = false;
            try
            {
                dialogResult = messanger.ShowMessage("0005");
            }
            catch
            {
                isThrownError = true;
            }

            Assert.AreEqual(true, isThrownError);

            //正常系
            dialogResult = messanger.ShowMessage("0001");
            Assert.AreEqual(dialogResult, DialogResult.OK);

            dialogResult = messanger.ShowMessage("0002");
            Assert.AreEqual(dialogResult, DialogResult.OK);


            dialogResult = messanger.ShowMessage("0003");
            Assert.AreEqual(dialogResult, DialogResult.OK);


            dialogResult = messanger.ShowMessage("0004");
            Assert.AreEqual(dialogResult, DialogResult.Yes);
        }
Пример #20
0
        public void StartProfiling()
        {
            if (SettingsObject.Instance.Common.ClearTmpFolder)
            {
                FileSystem.DeleteDirectory(SettingsObject.Instance.Common.TmpFolder, true);
                FileSystem.CreateDirectory(SettingsObject.Instance.Common.TmpFolder);
            }

            if (StartProfilingInternal(CreateEnvironmentVariables()))
            {
                Messanger.StartListen();
            }
            else
            {
                StopProfiling();
            }
        }
Пример #21
0
        /*FULL VALIDATION*/
        private void button2_Click(object sender, EventArgs e)
        {
            if (!checkLessonsHours())
            {
                return;
            }

            if (string.IsNullOrEmpty(f_semesterTitleTxt.Text))
            {
                Messanger.Warning("Enter semester title");
                return;
            }

            semester.Title = f_semesterTitleTxt.Text;
            semester.Type  = f_semesterTypeCBox.SelectedItem.ToString() == "Exam" ? SemesterType.Exam : SemesterType.Credit;

            Close();
        }
        //ADD NEW SEMESTER TO LIST
        private void f_newSemesterBtn_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(f_titleLbl.Text))
            {
                Messanger.Warning("First, you need to create subject");
                return;
            }

            AddSemester newSemester = new AddSemester();

            newSemester.ShowDialog();

            if (string.IsNullOrEmpty(newSemester.semester.Title))
            {
                return;
            }

            add_semester(newSemester.semester);
        }
Пример #23
0
        private void addFileBtn_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(f_fileNameTxt.Text))
            {
                Messanger.Error("Enter file's name!");
                return;
            }

            if (string.IsNullOrEmpty(f_filePathLbl.Text))
            {
                Messanger.Error("Need to choose file!");
                return;
            }

            File.Title       = f_fileNameTxt.Text;
            File.Description = f_fileDescriptionTxt.Text;
            File.IsAvailable = f_publicFileChBox.Checked;
            File.file        = new FileInfo(f_filePathLbl.Text);
            Close();
        }
Пример #24
0
        public UserProfileViewModel(
            MessageHistoryService messageHistoryServ,
            UserSearcher userSearchingServ,
            FriendsService friendServ,
            Messanger mesServ,
            SessionInfo session,
            MessageSearcher mesSerServ,
            Services.PhotoService.UsersPhotoService profilePhotoService,
            ImageService imageServ,
            Authenticator authenticatorServ,
            ImageUrlService imageUrlServ)
        {
            Messages                 = new FlowDocument();
            controlsVisibility       = false;
            canExecute               = true;
            CurrentSession           = session;
            messageHistoryService    = messageHistoryServ;
            userSearchingService     = userSearchingServ;
            friendService            = friendServ;
            this.profilePhotoService = profilePhotoService;
            imageService             = imageServ;
            Friends = friendService.GetFriends(currentSession.LoggedUser.Id).ResultTask.Result;
            authenticatorService = authenticatorServ;
            imageUrlService      = imageUrlServ;

            FindFriendEmailOrLogin = string.Empty;
            messengerService       = mesServ;
            DocWidth = 248;
            FontSize = 13;
            messageSearchingService = mesSerServ;
            var imageUrl = profilePhotoService.GetProfilePhoto(currentSession.LoggedUser.ProfilePhotoId).Url;

            if (imageUrl.Contains(@"\Resources\images\ProfilePhotos"))
            {
                ImageSource = imageUrl;
            }
            else
            {
                ImageSource = imageUrlService.GetImageUrl(currentSession.LoggedUser.ProfilePhotoId);
            }
        }
Пример #25
0
        private void StartMatchmakingMessage(StartMatchmakingRequest mess)
        {
            lock (_queueLock)
            {
                try
                {
                    Log.Debug("StartMatchmakingMessage");
                    var queue = Queue.FirstOrDefault(x => x.GameId == mess.GameId &&
                                                     x.GameMode.Equals(mess.GameMode, StringComparison.InvariantCultureIgnoreCase) &&
                                                     x.GameVersion.Major == mess.GameVersion.Major &&
                                                     x.OctgnVersion.CompareTo(mess.OctgnVersion) == 0);
                    if (queue == null)
                    {
                        Log.Debug("Creating queue");
                        // Create queue if doesn't exist
                        queue = new MatchmakingQueue(this, mess.GameId, mess.GameName, mess.GameMode, mess.MaxPlayers, mess.GameVersion, mess.OctgnVersion);
                        Queue.Add(queue);
                        queue.Start();
                    }

                    // if User is queued, drop him/her from previous queue
                    // Don't drop them if they're in this queue
                    foreach (var q in Queue.Where(x => x != queue))
                    {
                        q.Dequeue(mess.From);
                    }

                    // Add user to queue
                    queue.Enqueue(mess.From);

                    // Send user a message
                    Messanger.Send(new StartMatchmakingResponse(mess.RequestId, mess.From, queue.QueueId));

                    // Done with it.
                }
                catch (Exception e)
                {
                    Log.Error("StartMatchmakingMessage", e);
                }
            }
        }
Пример #26
0
        public bool Login(LoginData data, out string result)
        {
            var login = _accountFacade.GetUser(data.Login);

            if (login == null)
            {
                result = Messanger.Get(EMessages.UserDoesntExist);
                return(false);
            }
            if (!login.PassHash.SequenceEqual(data.PasswordHash ?? GetSha1Hash(data.Password)))
            {
                result = Messanger.Get(EMessages.IncorrectUserPassword);
                return(false);
            }

            //запись в cookie(AuthCookie)
            //data.User = login;
            FormsAuthentication.SetAuthCookie(login.Id.ToString(), data.RememberMe);
            result = string.Empty;
            return(true);
        }
Пример #27
0
        private void ButtonAuthorization_Click(object sender, RoutedEventArgs e)
        {
            DBconnection dBconnection = new DBconnection();

            dBconnection.ConnectDB();
            if (dBconnection.IsConnect())
            {
                string query  = $"SELECT DISTINCT * FROM Account WHERE login = '******' AND pass = '******';";
                var    result = dBconnection.SelectQuery(query);
                if (result.Read())
                {
                    Messanger messanger = new Messanger(InputLogin.Text);
                    messanger.Show();
                    this.Close();
                }
                else
                {
                    LabelCheck.Foreground = Brushes.Red;
                    LabelCheck.Text       = "Логин или пароль неверный";
                }
            }
        }
Пример #28
0
      public void OnStart()
      {
          // Initialaze some processes...
          Messanger.Send("Initialization process was started");

          // Create scene controller
          //TODO: Create scene controller

          // Create game controller
          var gameControl = new GameControl();

          Messanger.Send("Game controller was created");

          gameControl.CreateMap();

          // Create data controller
          //TODO: Create data controller

          // Create sound controller
          //TODO: Create sound controller

          //
      }
Пример #29
0
        public StartMatchmakingResponse JoinMatchmakingQueue(Game game, GameMode mode, int msTimeout = 10000)
        {
            var req = new StartMatchmakingRequest(game.Id, mode.Name, game.Name, game.Version, mode.PlayerCount, typeof(MatchmakingCog).Assembly.GetName().Version, _client.Config.MatchamkingBotUser.JidUser);
            var mut = new AutoResetEvent(false);
            using (var mess = new Messanger())
            {
                mess.OnResetXmpp(_xmpp);
                StartMatchmakingResponse resp = null;
                mess.Map<StartMatchmakingResponse>(x =>
                {
                    if (x.RequestId == req.RequestId)
                        resp = x;
                    mut.Set();
                });

                mess.Send(req);
                if (!mut.WaitOne(msTimeout))
                {
                    return null;
                }
                return resp;
            }
        }
Пример #30
0
        public void ShowCustomMessage()
        {
            Messages messages = new Messages(UtilityTestClass.NormalTestXMLFilePath);

            UtilityLibrary.Messanger messanger = new Messanger(UtilityTestClass.NormalTestXMLFilePath);
            DialogResult             dialogResult;

            //異常系
            //存在していないIDを指定
            bool isThrownError = false;

            try
            {
                dialogResult = messanger.ShowCustomMessage("0000", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            catch
            {
                isThrownError = true;
            }

            //MessageType = C以外を指定
            isThrownError = false;
            try
            {
                dialogResult = messanger.ShowCustomMessage("0001", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            catch
            {
                isThrownError = true;
            }

            Assert.AreEqual(true, isThrownError);

            //正常系
            dialogResult = messanger.ShowCustomMessage("0005", MessageBoxButtons.OK, MessageBoxIcon.Information);
            Assert.AreEqual(dialogResult, DialogResult.OK);
        }
Пример #31
0
 public void Start()
 {
     Messanger.Send("Update process was started");
 }
Пример #32
0
 public void Drop(IDropInfo dropInfo)
 {
     DropHandler.Drop(dropInfo);
     Messanger.Write();
     SpiritListDropEvent?.Invoke();
 }
Пример #33
0
        /// <summary>
        /// 获取用户信息
        /// </summary>
        /// <returns></returns>
        public Contact GetUserInfo()
        {
            string html = this.userCookie.Html;
            Match u1 = new Regex("首页</a>&nbsp;\\|<a href=\"(?<key>.*?)\">个人主页</a", RegexOptions.None).Match(html);
            if (u1.Success)
            {
                html = Url.PostGetCookieAndHtml(new NameValueCollection(), u1.Groups["key"].Value.Replace("&amp;", "&"), Encoding.UTF8, new System.Net.CookieContainer(), new System.Net.CookieCollection(), "").Html;
                u1 = new Regex("></a></td><td><a href=\"(?<key>.*?)\">详细资料</a", RegexOptions.None).Match(html);
                if (u1.Success)
                {
                    html = Url.PostGetCookieAndHtml(new NameValueCollection(), u1.Groups["key"].Value.Replace("&amp;", "&"), Encoding.UTF8, new System.Net.CookieContainer(), new System.Net.CookieCollection(), "").Html;
                }

            }

            Contact c = new Contact();
            c.WebSite = new List<string>();
            c.Messanger = new List<Messanger>();
            c.Phone = new List<PhoneNumber>();

            c.NickName = this.UserName;

            c.Email = this.UserName;

            //姓名
            Match m_ChineseName = new Regex("<title>[\\s\\S]*?-(?<key>.*?)</title>", RegexOptions.None).Match(html);
            if (m_ChineseName.Success)
            {
                c.Name = m_ChineseName.Groups["key"].Value.Trim();
            }

            //头像
            c.Photo = html.FindText("<img width=\"100\" align=\"center\" alt=\"\" src=\"", "\"></a></td></tr>");

            //性别
            Match m_Sex = new Regex("性别:(?<key>.*?)<br />", RegexOptions.None).Match(html);
            if (m_Sex.Success)
            {
                string sex = m_Sex.Groups["key"].Value.Trim();
                switch (sex)
                {
                    case "男":
                        c.Sex = e_Sex.男;
                        break;
                    case "女":
                        c.Sex = e_Sex.女;
                        break;
                    default:
                        c.Sex = e_Sex.保密;
                        break;
                }
            }

            //生日
            Match m_Birth = new Regex("生日:(?<key>.*?)<", RegexOptions.None).Match(html);
            if (m_Birth.Success)
            {
                string bitrh = m_Birth.Groups["key"].Value.Replace("年", "-").Replace("月", "-").Replace("日", "");
                c.BirthDay = bitrh.ToDateTime();
            }

            //地址
            Match m_Address = new Regex("家乡:(?<key>.*?)<br />", RegexOptions.None).Match(html);
            if (m_Address.Success)
            {
                Address a = new Address();
                a.AddressType = e_AddressType.老家;
                a.Country = "中国";
                a.address = m_Address.Groups["key"].Value;

                c.Address = a;
            }

            //QQ
            Match m_QQ = new Regex("QQ:(?<key>.*?)<br />", RegexOptions.None).Match(html);
            if (m_QQ.Success)
            {
                Messanger qq = new Messanger();
                qq.MessagnerType = e_Messanger.QQ;
                qq.MessangerNumber = m_QQ.Groups["key"].Value;

                c.Messanger.Add(qq);
            }

            //MSN
            Match m_MSN = new Regex("MSN:(?<key>.*?)<br />", RegexOptions.None).Match(html);
            if (m_MSN.Success)
            {
                Messanger msn = new Messanger();
                msn.MessagnerType = e_Messanger.MSN;
                msn.MessangerNumber = m_MSN.Groups["key"].Value;

                c.Messanger.Add(msn);
            }

            //手机
            Match m_Mobile = new Regex("手机号码:(?<key>.*?)<br />", RegexOptions.None).Match(html);
            if (m_Mobile.Success)
            {
                PhoneNumber p = new PhoneNumber();
                p.PhoneType = e_PhoneType.手机;
                p.Number = m_Mobile.Groups["key"].Value;

                c.Phone.Add(p);
            }

            //个人网站
            Match m_Site = new Regex("个人网站:(?<key>.*?)</div>", RegexOptions.None).Match(html);
            if (m_Site.Success)
            {
                c.WebSite.Add(m_Site.Groups["key"].Value);
            }
            return c;
        }
Пример #34
0
 protected override void OnStopped()
 {
     Messanger.UnRegister <List <IAppServer> >();
     Messanger.UnRegister <PermformanceDataEventArgs>();
     base.OnStopped();
 }
Пример #35
0
 static void Main(string[] args)
 {
     Messanger messanger = new Messanger(new UniversalViewerInterpreter(), new XMLSender());
     messanger.PassNextMessage();
 }