public void CmdRequestProfiles(NetworkConnectionToClient sender = null) { if (IsAdmin(sender, out var player)) { ProfileMessage.Send(player.GameObject); } }
private bool ClickToAddFriendAt(ProfileMessage profile, int x, int y, Filter filter) { ZaloHelper.Output($"!đã nhấn vào bạn: {profile.Name}"); TouchAt(x, y);//TOUCH TO ROW_INDEX Delay(2000); //I''m on profile page var info = GrabProfileInfo(profile.Name); ZaloHelper.CopyProfile(ref profile, info); string reason; if (!filter.IsValidProfile(profile, out reason)) { ZaloHelper.Output("Bỏ qua bạn này, lý do: " + reason); TouchAtIconTopLeft(); //GoBack to friendList return(false); } if (!info.IsAddedToFriend) { return(AddFriendViaIconButton(profile, filter)); } else { ZaloHelper.Output($"!yêu cầu kết bạn: {profile.Name} bị từ hủy. Lý do: đã có tên trong cơ sở dữ liệu"); TouchAtIconTopLeft(); //GoBack to friendList return(false); } }
public ProfileMessage GetProfile(string fileImage, ScreenInfo screenSize) { try { var infoRect = DetectTemplate(fileImage, $@".\ImageData\{screenSize.Name}\template\profile_info_pattern_template.png").First(); var iconAddFriendPositions = DetectTemplate(fileImage, $@".\ImageData\{screenSize.Name}\template\add_friend_pattern_template.png"); var bitmap = new Bitmap(fileImage); var rowHeight = screenSize.ProfileInfoRowHeight; var startX = infoRect.Right; var sizeWidth = screenSize.WorkingRect.Right - startX - 20; var profile = new ProfileMessage() { IsAddedToFriend = !iconAddFriendPositions.Any() }; var textProfile = GetVietnameseText(bitmap.Clone(new Rectangle(startX, infoRect.Y, sizeWidth, rowHeight * 4), bitmap.PixelFormat)); var infoTexts = textProfile.Split("\r\n".ToArray()).Where(x => !string.IsNullOrWhiteSpace(x)).ToArray(); profile.Name = infoTexts.ElementAtOrDefault(0)?.Trim(); profile.BirthdayText = infoTexts.ElementAtOrDefault(1)?.Trim(); profile.Gender = infoTexts.ElementAtOrDefault(2)?.Trim(); profile.PhoneNumber = infoTexts.ElementAtOrDefault(3)?.Trim(); return(profile); } catch (Exception ex) { return(new ProfileMessage()); } }
public void LogActivityCount(ProfileMessage profile, string account, LogType logtype) { var item = LogActivitySet.FirstOrDefault(x => x.Date == TodayText && account == x.Account); if (item == null) { LogActivitySet.Add(new LogActivityDto { Date = TodayText, Account = account }); } SaveChanges(); item = LogActivitySet.First(x => x.Date == TodayText && account == x.Account); switch (logtype) { case LogType.AddedFriend: item.AddedFriendCount++; break; case LogType.MessageFriend: item.PostFriendCount++; break; case LogType.MessageToStranger: item.PostStrangerCount++; break; } SaveChanges(); }
private static void ParseAlgorithmTypes(ProfileMessage myProfileMessage, ProfileMessage otherProfileMessage, out KeyExchangeAlgorithmType keyExchangeAlgorithmType, out KeyDerivationAlgorithmType keyDerivationAlgorithmType, out CryptoAlgorithmType cryptoAlgorithmType, out HashAlgorithmType hashAlgorithmType) { keyExchangeAlgorithmType = EnumHelper.GetOverlappedMaxValue(myProfileMessage.KeyExchangeAlgorithmTypes, otherProfileMessage.KeyExchangeAlgorithmTypes) ?? throw new OmniSecureConnectionException("key exchange algorithm does not match."); keyDerivationAlgorithmType = EnumHelper.GetOverlappedMaxValue(myProfileMessage.KeyDerivationAlgorithmTypes, otherProfileMessage.KeyDerivationAlgorithmTypes) ?? throw new OmniSecureConnectionException("key derivation algorithm does not match."); cryptoAlgorithmType = EnumHelper.GetOverlappedMaxValue(myProfileMessage.CryptoAlgorithmTypes, otherProfileMessage.CryptoAlgorithmTypes) ?? throw new OmniSecureConnectionException("Crypto algorithm does not match."); hashAlgorithmType = EnumHelper.GetOverlappedMaxValue(myProfileMessage.HashAlgorithmTypes, otherProfileMessage.HashAlgorithmTypes) ?? throw new OmniSecureConnectionException("Hash algorithm does not match."); }
private void AddFriend(int numberOfAction, Filter filter) { ZaloHelper.Output($"!bắt đầu thêm bạn. số bạn yêu cầu tối đa trong ngày hôm nay là {numberOfAction}"); var countSuccess = 0; string[] profilesPage1 = null; string[] profilesPage2 = null; ZaloHelper.Output("!đang tìm thông tin các bạn"); var friendNotAdded = GetPositionAccountNotAdded(x => profilesPage1 = x).OrderByDescending(x => x.Point.Y); var stack = new Stack <FriendPositionMessage>(friendNotAdded); profilesPage1.ToList().ForEach(x => ZaloHelper.Output($"!tìm thấy bạn trên màn hình: {x}")); ZaloHelper.Output($"!--------------------"); friendNotAdded.ToList().ForEach(x => ZaloHelper.Output($"!các bạn chưa được gửi lời mời: {x.Name}")); while (countSuccess < numberOfAction) { while (stack.Count == 0) { ZaloHelper.Output("!đang cuộn danh sách bạn"); ScrollList(9); ZaloHelper.Output("!đang tìm thông tin các bạn"); friendNotAdded = (GetPositionAccountNotAdded(x => profilesPage2 = x)).OrderByDescending(x => x.Point.Y); stack = new Stack <FriendPositionMessage>(friendNotAdded); profilesPage1.ToList().ForEach(x => ZaloHelper.Output($"!tìm thấy bạn trên màn hình: {x}")); ZaloHelper.Output($"!--------------------"); friendNotAdded.ToList().ForEach(x => ZaloHelper.Output($"!các bạn chưa được gửi lời mời: {x.Name}")); profilesPage2.ToList().ForEach(x => ZaloHelper.Output($"!tìm thấy bạn trên màn hình: {x}")); if (!profilesPage2.Except(profilesPage1).Any()) { ZaloHelper.Output("!hết bạn trong danh sách."); return; } profilesPage1 = profilesPage2; } Delay(2000); var pointRowFriend = stack.Pop(); var profile = new ProfileMessage { Name = pointRowFriend.Name, Location = filter.Locations }; if (Screen.InfoRect.Contains(pointRowFriend.Point) && ClickToAddFriendAt(profile, pointRowFriend.Point, filter)) { DbContext.AddProfile(profile, Settings.User.Username); countSuccess++; ZaloHelper.Output($"!yêu cầu kết bạn [{countSuccess}]: {profile.Name} bị thành công."); } } }
public static void CopyProfile(ref ProfileMessage profile, ProfileMessage info) { profile.BirthdayText = info.BirthdayText; profile.Gender = info.Gender; profile.IsAddedToFriend = info.IsAddedToFriend; profile.Name = string.IsNullOrWhiteSpace(profile.Name) ? info.Name : profile.Name; profile.PhoneNumber = info.PhoneNumber; }
public void CmdRequestProfiles(string adminId, string adminToken, NetworkConnectionToClient sender = null) { if (IsAdmin(adminId, adminToken, sender) == false) { return; } var admin = PlayerList.Instance.GetAdmin(adminId, adminToken); ProfileMessage.Send(admin); }
public void CmdRequestProfiles(string adminId, string adminToken) { if (IsAdmin(adminId, adminToken) == false) { return; } var admin = PlayerList.Instance.GetAdmin(adminId, adminToken); ProfileMessage.Send(admin); }
public static ZaloMessage[] GetZalomessages(ProfileMessage profile, Filter filter) { if (profile.GenderValue() == Gender.Male) { return(ParseZaloMessage(filter.TextGreetingForMale)); } else { return(ParseZaloMessage(filter.TextGreetingForFemale)); } }
public void CmdDeleteProfile(string adminId, string adminToken, string profileName, NetworkConnectionToClient sender = null) { if (IsAdmin(adminId, adminToken, sender) == false) return; if (ProfileManager.runningProfile || ProfileManager.runningMemoryProfile) return; string path = Directory.GetCurrentDirectory() + "/Profiles/" + profileName; if (File.Exists(path)) { File.Delete(path); } ProfileMessage.SendToApplicable(); }
public void AddLogMessageSentToFriend(ProfileMessage profile, string account, string textGreeting) { LogMessageSentToFriendSet.Add(new LogMessageSentToFriendDto { BirthdayText = profile.BirthdayText, Gender = profile.Gender == "Nam" ? Gender.Male : Gender.Female, MessageText = textGreeting, Name = profile.Name, Location = profile.Location, PhoneNumber = profile.PhoneNumber, Account = account }); LogActivityCount(profile, account, LogType.MessageFriend); }
private byte[] ComputeHash(ProfileMessage profileMessage, OmniAgreementPublicKey agreementPublicKey, HashAlgorithmType hashAlgorithm) { var verificationMessage = new VerificationMessage(profileMessage, agreementPublicKey); if (hashAlgorithm == HashAlgorithmType.Sha2_256) { using var bytesPipe = new BytesPipe(); verificationMessage.Export(bytesPipe.Writer, _bytesPool); return(Sha2_256.ComputeHash(bytesPipe.Reader.GetSequence())); } throw new NotSupportedException(nameof(hashAlgorithm)); }
private IEnumerator RunPorfile(int frameCount) { while (frameCount > 0) { frameCount--; yield return(null); } runningProfile = false; Profiler.enabled = false; Profiler.enableBinaryLog = true; Profiler.logFile = ""; ProfileMessage.SendToApplicable(); }
private bool AddFriendViaIconButton(ProfileMessage profile, Filter filter) { ZaloHelper.Output($"!tiến hành gửi yêu cầu kết bạn: {profile.Name}"); //Wait to navigate to profiles TouchAtIconBottomRight(); //Touch to AddFriends //Wait to Navigate to new windows Delay(3000); var proccessedDialog = ProcessIfShowDialogWaitRequestedFriendConfirm(); if (proccessedDialog) { ZaloHelper.Output($"!yêu cầu kết bạn: {profile.Name} bị từ chối. Lý do: đã gửi yêu cầu rồi"); TouchAtIconTopLeft(); //GoBack to friendList return(false); } TouchAt(Screen.AddFriendScreenGreetingTextField); var textGreeting = ZaloHelper.GetZalomessages(profile, filter)?.FirstOrDefault(x => x.Type == ZaloMessageType.Text)?.Value; if (!string.IsNullOrWhiteSpace(textGreeting)) { ZaloHelper.Output($"!gửi: {textGreeting}"); SendText(textGreeting); if (Settings.IsDebug) { TouchAtIconTopLeft(); } else { TouchAt(Screen.AddFriendScreenOkButton); //TouchToAddFriend, zalo auto goto profile after sent } } else { TouchAtIconTopLeft(); //GoBack to profile } Delay(300); TouchAtIconTopLeft(); //GoBack to friendList DbContext.LogAddFriend(profile, Settings.User.Username, textGreeting); return(true); }
public static ProfileMessage Send(GameObject recipient) { var profileList = new ProfileEntryDataList(); profileList.Profiles = GetAllProfiles(); var data = JsonUtility.ToJson(profileList); ProfileMessage msg = new ProfileMessage { Recipient = recipient.GetComponent <NetworkIdentity>().netId, JsonData = data }; msg.SendTo(recipient); return(msg); }
private void PageState(ProfileMessage profileMessage) { switch (profileMessage.Reason) { case Messages.Enums.ProfileMessageReason.Register: NavigationService.NavigateTo("/Views/Register.xaml"); NavigationService.RemoveBackEntry(); break; case Messages.Enums.ProfileMessageReason.Login: NavigationService.NavigateTo("/Views/Login.xaml?pagestate=inapp"); NavigationService.RemoveBackEntry(); break; case Messages.Enums.ProfileMessageReason.GoBack: NavigationService.GoBack(); break; } }
public void LogAddFriend(ProfileMessage profile, string account, string textGreeting) { LogRequestAddFriendSet.Add(new LogRequestAddFriendDto { BirthdayText = profile.BirthdayText, Gender = profile.Gender == "Nam" ? Gender.Male : Gender.Female, MessageText = textGreeting, Name = profile.Name, Location = profile.Location, PhoneNumber = profile.PhoneNumber, Account = account }); SaveChanges(); LogActivityCount(profile, account, LogType.AddedFriend); AddProfile(profile, account); }
public void CmdDeleteProfile(string adminId, string adminToken, string profileName) { if (IsAdmin(adminId, adminToken) == false) { return; } if (runningProfile) { return; } string path = Directory.GetCurrentDirectory() + "/Profiles/" + profileName; if (File.Exists(path)) { File.Delete(path); } ProfileMessage.SendToApplicable(); }
private void ProfileReceived(ProfileMessage profile) { if (this.disposed) { return; } EntryViewModel entry = null; this.pendingEntries.TryGetValue(profile.Id, out entry); if (entry == null) { return; } this.pendingEntries.Remove(profile.Id); entry.End = entry.Start + profile.Duration; entry.Results = profile.Results != null?profile.Results.AsDataView() : null; }
private async ValueTask <ProfileMessage> ExchangeProfileMessageAsync(ProfileMessage myProfileMessage, CancellationToken cancellationToken = default) { var enqueueTask = _connection.Sender.SendAsync(myProfileMessage, cancellationToken).AsTask(); var dequeueTask = _connection.Receiver.ReceiveAsync <ProfileMessage>(cancellationToken).AsTask(); await Task.WhenAll(enqueueTask, dequeueTask); var otherProfileMessage = dequeueTask.Result; if (otherProfileMessage is null) { throw new NullReferenceException(); } if (myProfileMessage.AuthenticationType != otherProfileMessage.AuthenticationType) { throw new OmniSecureConnectionException("AuthenticationType does not match."); } return(otherProfileMessage); }
private IEnumerator RunPorfile(int frameCount) { while (frameCount > 0) { frameCount--; yield return(null); } runningProfile = false; Profiler.enabled = false; Profiler.enableBinaryLog = true; Profiler.logFile = ""; UpdateManager.Instance.Profile = false; if (CustomNetworkManager.IsServer) { ProfileMessage.SendToApplicable(); } }
public void AddProfile(ProfileMessage profile, string account, bool isFriend = false) { try { ProfileSet.Add(new ProfileDto { BirthdayText = profile.BirthdayText, Gender = profile.Gender == "Nam" ? Gender.Male : Gender.Female, Name = profile.Name, PhoneNumber = profile.PhoneNumber, Location = profile.Location, Account = account, IsFriend = isFriend }); SaveChanges(); } catch (Exception ex) { _log.Error(ex); } }
public void SearchFriendInContactList() { try { GotoPage(Activity.MainTab); Delay(1000); TouchAt(Screen.HomeScreenFriendTab); Delay(1000); ZaloHelper.Output("Đang phân tích dữ liệu"); var fileCapture = CaptureScreenNow(); var friends = ZaloImageProcessing.GetFriendProfileList(fileCapture, Screen); ZaloHelper.OutputLine(); friends.ToList().ForEach(x => ZaloHelper.Output(x.Name)); ZaloHelper.OutputLine(); var stack = new Stack <FriendPositionMessage>(friends.Where(x => !string.IsNullOrWhiteSpace(x.Name)).OrderByDescending(x => x.Point.Y)); var profilesPage1 = stack.Select(x => x.Name).ToArray(); while (true) { while (stack.Count == 0) { ScrollList(9); ZaloHelper.Output("Đang phân tích dữ liệu màn hình"); fileCapture = CaptureScreenNow(); friends = ZaloImageProcessing.GetFriendProfileList(fileCapture, Screen); ZaloHelper.OutputLine(); friends.ToList().ForEach(x => ZaloHelper.Output(x.Name)); ZaloHelper.OutputLine(); stack = new Stack <FriendPositionMessage>(friends.OrderByDescending(x => x.Point.Y)); var profilesPage2 = stack.Select(x => x.Name).ToArray(); if (!profilesPage2.Except(profilesPage1).Any()) { ZaloHelper.Output("Hết danh sách"); return; } profilesPage1 = profilesPage2; } Delay(2000); var rowFriend = stack.Pop(); if (DbContext.ProfileSet.FirstOrDefault(x => x.Name == rowFriend.Name && x.Account == Settings.User.Username) != null) { ZaloHelper.Output($"Thu nhập thông tin bạn {rowFriend.Name} rồi"); continue; } if (!Screen.InfoRect.Contains(rowFriend.Point)) { continue; } TouchAt(rowFriend.Point); Delay(2000); //GrabInfomation TouchAtIconTopRight(); Delay(1000); TouchAt(Screen.ChatScreenProfileAvartar); Delay(2000); var profile = new ProfileMessage() { Name = rowFriend.Name }; var infoGrab = GrabProfileInfo(profile.Name); ZaloHelper.CopyProfile(ref profile, infoGrab); TouchAtIconTopLeft(); //Back to chat screen Delay(400); TouchAtIconTopLeft(); //Close sidebar Delay(400); TouchAtIconTopLeft(); //Goback friend list Delay(400); DbContext.AddProfile(profile, Settings.User.Username, true); Delay(400); } } catch (Exception ex) { _log.Error(ex); } finally { ZaloHelper.SendCompletedTaskSignal(); } }
// ReSharper disable once UnusedMember.Local private bool ClickToAddFriendAtRowPosition(ProfileMessage profile, int position, Filter filter) => ClickToAddFriendAt(profile, Screen.MenuPoint.Y * 2, (position - 1) * Screen.FriendRowHeight + Screen.FriendRowHeight / 2 + Screen.HeaderHeight, filter);
private bool ClickToAddFriendAt(ProfileMessage profile, ScreenPoint point, Filter filter) => ClickToAddFriendAt(profile, point.X, point.Y, filter);
private static void Register() { ProfileMessage.Send(Messages.Enums.ProfileMessageReason.Register); }
private static void Login() { ProfileMessage.Send(Messages.Enums.ProfileMessageReason.Login); }
private static void GoBack() { ProfileMessage.Send(Messages.Enums.ProfileMessageReason.GoBack); }
public static bool IsValidProfile(this Filter filter, ProfileMessage profile, out string reason) { reason = null; if (!string.IsNullOrWhiteSpace(filter.FilterAgeRange)) { var ages = filter.FilterAgeRange.Split(";-=_ ".ToArray()); var from = int.Parse(ages[0]); var to = int.Parse(ages[1]); DateTime date; if (DateTime.TryParse(profile.BirthdayText, out date) && date.Year >= 1930) { var profileAge = DateTime.Now.Year - date.Year; if (from <= profileAge && profileAge <= to) { } else { reason = $"Độ tuổi {profileAge} không trong khoảng [{from}-{to}]"; return(false); } } else if (!filter.FilterAgeRangeAcceptIfHidden) { reason = "Không thấy tuổi"; return(false); } } if (filter.GenderSelection != GenderSelection.Both) { if (filter.GenderSelection == GenderSelection.OnlyMale && profile.GenderValue() != Gender.Male) { reason = $"Yêu cầu chọn nam, nhưng kết quả trả về là nữ"; return(false); } if (filter.GenderSelection == GenderSelection.OnlyFemale && profile.GenderValue() != Gender.Female) { reason = $"Yêu cầu chọn nữ, nhưng kết quả trả về là nam"; return(false); } } if (!string.IsNullOrWhiteSpace(filter.ExcludePhoneNumbers)) { var phoneNumbers = filter.ExcludePhoneNumbers.Split(";".ToArray()); if (phoneNumbers.Contains(profile.PhoneNumber)) { reason = "Số đt có trong danh sách loại trừ"; return(false); } } if (!string.IsNullOrWhiteSpace(filter.Locations)) { } return(true); }