public UserListRow(PnlUserList parent, GPG.Multiplayer.Quazal.User user, UserListStyles style, UserListCategories initialCategory) { this.PlayerAwards = null; this.PlayerStatus = null; this.mCategory = UserListCategories.Online; this.mPreviousRow = null; this.mNextRow = null; this.mIsSelected = false; this.LastCategory = null; this.ClanRankImage = null; this.Award1Image = null; this.Award2Image = null; this.Award3Image = null; this.AvatarImage = null; this.StatusImage = null; this.ClanLabelBounds = null; this.mParent = parent; this.mUser = user; this.mStyle = style; this.mCategory = initialCategory; this.Parent.MouseMove += new MouseEventHandler(this.Parent_MouseMove); this.Parent.MouseDown += new MouseEventHandler(this.Parent_MouseDown); this.Parent.MouseUp += new MouseEventHandler(this.Parent_MouseUp); this.BindToUser(this.User); }
public PnlToolDownloadOptions(GPG.Multiplayer.Client.Vaulting.Tools.Tool tool) { int index; this.components = null; this.InitializeComponent(); this.comboBoxReleaseQual.Items.Add(new MultiVal<string, string>(Loc.Get("<LOC>Any"), "<LOC>Any")); this.comboBoxReleaseQual.Items.Add(new MultiVal<string, string>(Loc.Get("<LOC>Unspecified"), "<LOC>Unspecified")); this.comboBoxReleaseQual.Items.Add(new MultiVal<string, string>(Loc.Get("<LOC>Untested"), "<LOC>Untested")); this.comboBoxReleaseQual.Items.Add(new MultiVal<string, string>(Loc.Get("<LOC>Alpha"), "<LOC>Alpha")); this.comboBoxReleaseQual.Items.Add(new MultiVal<string, string>(Loc.Get("<LOC>Beta"), "<LOC>Beta")); this.comboBoxReleaseQual.Items.Add(new MultiVal<string, string>(Loc.Get("<LOC>Release"), "<LOC>Release")); this.gpgTextBoxDev.Text = tool.DeveloperName; if (tool.Quality == null) { index = 0; } else { index = this.comboBoxReleaseQual.Items.IndexOf(tool.Quality); } if (index < 0) { index = 0; } this.comboBoxReleaseQual.SelectedIndex = index; this.mTool = tool; this.CriteriaChanged(null, null); }
public SearchResultEntry(GPG.Multiplayer.Client.SolutionsLib.Solution solution) { this.InitializeComponent(); this.mSolution = solution; this.gpgLabelLink.Text = string.Format("{0} - {1}", solution.ID, solution.Title); this.Unselect(); }
public PnlVideoUploadOptions(GPG.Multiplayer.Client.Vaulting.Videos.Video video) { this.InitializeComponent(); this.comboBoxQuality.Items.Add(new MultiVal<string, string>(Loc.Get("<LOC>Unspecified"), "<LOC>Unspecified")); this.comboBoxQuality.Items.Add(new MultiVal<string, string>(Loc.Get("<LOC>Low"), "<LOC>Low")); this.comboBoxQuality.Items.Add(new MultiVal<string, string>(Loc.Get("<LOC>Medium"), "<LOC>Medium")); this.comboBoxQuality.Items.Add(new MultiVal<string, string>(Loc.Get("<LOC>High"), "<LOC>High")); this.comboBoxQuality.SelectedIndex = 0; for (int i = 0; i < this.comboBoxQuality.Items.Count; i++) { if ((this.comboBoxQuality.Items[i] as MultiVal<string, string>).Value2 == video.Quality) { this.comboBoxQuality.SelectedIndex = i; break; } } this.gpgLabelVideoFormat.Text = video.VideoFormat; this.numericUpDownHours.Value = video.LengthHours; this.numericUpDownMinutes.Value = video.LengthMinutes; this.numericUpDownMinutes.Value = video.LengthSeconds; this.mVideo = video; base.Disposed += new EventHandler(this.PnlVideoDetailsView_Disposed); GPG.Multiplayer.Client.Vaulting.Videos.Video.PreviewImageLoaded += new EventHandler(this.Video_PreviewImageLoaded); this.VideoAttributeChanged(null, null); this.gpgTextBoxPreview_TextChanged(null, null); }
public DialogCreator(INotificationService notificationService, IPasswordManager passwordManager, ISyncService syncService, GPG gpg) { this.notificationService = notificationService ?? throw new ArgumentNullException(nameof(notificationService)); this.passwordManager = passwordManager ?? throw new ArgumentNullException(nameof(passwordManager)); this.syncService = syncService; this.gpg = gpg; }
/// <summary> /// Loads all required resources. /// </summary> protected void Initialise() { EmbeddedResources.Load(); CreateNotifyIcon(); LoadConfigFile(); #if DEBUG Log.Initialise(); #else if (ConfigManager.Config.CreateLogFile) { Log.Initialise(); } #endif Log.Send("------------------------------"); Log.Send($"Starting pass-winmenu {Version}"); Log.Send("------------------------------"); AssignHotkeys(hotkeys); var gpg = new GPG(); gpg.FindGpgInstallation(ConfigManager.Config.Gpg.GpgPath); if (ConfigManager.Config.Gpg.GpgAgent.Config.AllowConfigManagement) { gpg.UpdateAgentConfig(ConfigManager.Config.Gpg.GpgAgent.Config.Keys); } passwordManager = new PasswordManager(ConfigManager.Config.PasswordStore.Location, EncryptedFileExtension, gpg); passwordManager.PinentryFixEnabled = ConfigManager.Config.Gpg.PinentryFix; if (ConfigManager.Config.Git.UseGit) { try { if (ConfigManager.Config.Git.SyncMode == SyncMode.NativeGit) { git = new Git(ConfigManager.Config.PasswordStore.Location, ConfigManager.Config.Git.GitPath); } else { git = new Git(ConfigManager.Config.PasswordStore.Location); } } catch (RepositoryNotFoundException) { // Password store doesn't appear to be a Git repository. // Git support will be disabled. } catch (TypeInitializationException e) when(e.InnerException is DllNotFoundException) { ShowErrorWindow("The git2 DLL could not be found. Git support will be disabled."); } catch (Exception e) { ShowErrorWindow($"Failed to open the password store Git repository ({e.GetType().Name}: {e.Message}). Git support will be disabled."); } } }
public PasswordManager(string passwordStore, string encryptedFileExtension, GPG crypto) { var normalised = Helpers.NormaliseDirectory(passwordStore); PasswordStore = new DirectoryInfo(normalised); EncryptedFileExtension = encryptedFileExtension; Crypto = crypto; }
public ValidSigMessage(string[] arguments) : base(StatusMessageType.ValidSig) { sigFingerprint = arguments[0].ToUpperInvariant(); sigTime = GPG.ParseTimestamp(arguments[2]); sigExpiration = GPG.ParseNullableTimestamp(arguments[3]); keyType = GPG.ParseKeyType(arguments[6]); hashAlgo = GPG.ParseHashAlgorithm(arguments[7]); primaryFingerprint = arguments[9].ToUpperInvariant(); }
public PasswordManager(string passwordStore, string encryptedFileExtension, GPG gpg) { var normalised = Helpers.NormaliseDirectory(passwordStore); passwordStoreDirectory = new DirectoryInfo(normalised); EncryptedFileExtension = encryptedFileExtension; Gpg = gpg; }
public PnlVideoDetailsView(GPG.Multiplayer.Client.Vaulting.Videos.Video video) { this.InitializeComponent(); base.Disposed += new EventHandler(this.PnlVideoDetailsView_Disposed); GPG.Multiplayer.Client.Vaulting.Videos.Video.PreviewImageLoaded += new EventHandler(this.Video_PreviewImageLoaded); this.gpgLabelVideoFormat.Text = video.VideoFormat; this.gpgLabelLength.Text = video.LengthDisplay; this.gpgLabelQuality.Text = video.QualityDisplay; this.pictureBoxPreview.Image = video.PreviewImage128; this.mVideo = video; }
/// <summary> /// Loads all required resources. /// </summary> private void Initialise() { #if DEBUG Log.Initialise(); #else if (ConfigManager.Config.CreateLogFile) { Log.Initialise(); } #endif // Load compiled-in resources. EmbeddedResources.Load(); Log.Send("------------------------------"); Log.Send($"Starting pass-winmenu {Version}"); Log.Send("------------------------------"); // Set the security protocol to TLS 1.2 only. // We only use this for update checking (Git push over HTTPS is not handled by .NET). ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12; // Create the notification service first, so it's available if initialisation fails. notificationService = Notifications.Create(); // Now load the configuration options that we'll need // to continue initialising the rest of the applications. LoadConfigFile(); // Create the GPG wrapper. gpg = new GPG(); gpg.FindGpgInstallation(ConfigManager.Config.Gpg.GpgPath); if (ConfigManager.Config.Gpg.GpgAgent.Config.AllowConfigManagement) { gpg.UpdateAgentConfig(ConfigManager.Config.Gpg.GpgAgent.Config.Keys); } // Create the Git wrapper, if enabled. InitialiseGit(ConfigManager.Config.Git, ConfigManager.Config.PasswordStore.Location); // Initialise the internal password manager. passwordManager = new PasswordManager(ConfigManager.Config.PasswordStore.Location, EncryptedFileExtension, gpg); passwordManager.PinentryFixEnabled = ConfigManager.Config.Gpg.PinentryFix; clipboard = new ClipboardHelper(); dialogCreator = new DialogCreator(notificationService, passwordManager, git, gpg); InitialiseUpdateChecker(); actionDispatcher = new ActionDispatcher(notificationService, passwordManager, dialogCreator, clipboard, git, updateChecker); notificationService.AddMenuActions(actionDispatcher); // Assign our hotkeys. hotkeys = new HotkeyManager(); AssignHotkeys(hotkeys); }
public void Decrypt_CallsGpg() { var transportMock = new Mock <IGpgTransport>(); transportMock.Setup(t => t.CallGpg(It.IsAny <string>(), null)).Returns(GetSuccessResult); var gpg = new GPG(transportMock.Object, Mock.Of <IGpgAgent>(), StubGpgResultVerifier.AlwaysValid, new GpgConfig()); gpg.Decrypt("file"); transportMock.Verify(t => t.CallGpg(It.IsAny <string>(), null), Times.Once); }
public void Encrypt_NullRecipients_CallsGpg() { var transportMock = new Mock <IGpgTransport>(); transportMock.Setup(t => t.CallGpg(It.IsNotNull <string>(), It.IsNotNull <string>())).Returns(GetSuccessResult); var gpg = new GPG(transportMock.Object, Mock.Of <IGpgAgent>(), StubGpgResultVerifier.AlwaysValid, new GpgConfig()); gpg.Encrypt("data", "file", null); transportMock.Verify(t => t.CallGpg(It.IsNotNull <string>(), It.IsNotNull <string>()), Times.Once); }
public PnlToolDetailsView(GPG.Multiplayer.Client.Vaulting.Tools.Tool tool) { this.InitializeComponent(); this.gpgLabelWebsite.Font = new Font(Program.Settings.StylePreferences.MasterFont, FontStyle.Underline); this.gpgLabelWebsite.ForeColor = Program.Settings.Chat.Links.WebColor; this.gpgLabelWebsite.Cursor = Cursors.Hand; this.gpgLabelDeveloper.Text = tool.DeveloperName; this.gpgLabelExeName.Text = tool.ExeName; this.gpgLabelNumberFiles.Text = tool.NumberOfFiles.ToString(); this.gpgLabelQuality.Text = tool.QualityDisplay; this.gpgLabelWebsite.Text = tool.Website; this.mTool = tool; }
public ClanView(GPG.Multiplayer.Client.Clans.Clan clan, MappedObjectList<ClanMember> members, string name, bool isPlayerName) { this.mClan = clan; this.mMembers = members; if (isPlayerName) { this.mPlayerName = name; } else { this.mClanName = name; } }
public PnlModUploadOptions(GPG.Multiplayer.Client.Vaulting.Mods.Mod mod) { this.InitializeComponent(); this.mMod = mod; this.gpgLabelCopyright.Text = mod.Copyright; this.gpgLabelDeveloper.Text = mod.DeveloperName; this.gpgLabelExclusive.Text = this.ParseBool(mod.Exclusive); this.gpgLabelFileCount.Text = mod.NumberOfFiles.ToString(); this.gpgLabelGuid.Text = mod.Guid; this.gpgLabelUIOnly.Text = this.ParseBool(mod.UIOnly.Value); this.gpgLabelWebsite.Text = mod.Website; this.pictureBoxPreview.Image = mod.PreviewImage50; }
public void StartAgent_NoSecretKeys_ThrowsGpgError() { var transportMock = new Mock <IGpgTransport>(); transportMock.Setup( t => t.CallGpg(It.IsNotNull <string>(), It.IsAny <string>())) .Returns(new GpgResultBuilder() .WithStdout("") .Build()); var gpg = new GPG(transportMock.Object, Mock.Of <IGpgAgent>(), StubGpgResultVerifier.AlwaysValid, new GpgConfig()); Should.Throw <GpgError>(() => gpg.StartAgent()); }
public AttributeMessage(string[] arguments) : base(StatusMessageType.Attribute) { length = int.Parse(arguments[1]); type = (OpenPGPAttributeType)int.Parse(arguments[2]); creation = GPG.ParseNullableTimestamp(arguments[5]); expiration = GPG.ParseNullableTimestamp(arguments[6]); int flags = int.Parse(arguments[7]); primary = (flags & 1) != 0; revoked = (flags & 2) != 0; expired = (flags & 4) != 0; }
public void Decrypt_ReturnsFileContent(string fileContent) { var transportMock = new Mock <IGpgTransport>(); transportMock.Setup( t => t.CallGpg(It.IsNotNull <string>(), null)) .Returns(new GpgResultBuilder() .WithStdout(fileContent) .Build()); var gpg = new GPG(transportMock.Object, Mock.Of <IGpgAgent>(), StubGpgResultVerifier.AlwaysValid, new GpgConfig()); var decryptedContent = gpg.Decrypt("file"); decryptedContent.ShouldBe(fileContent); }
public void GetVersion_ReturnsFirstOutputLine() { var transportMock = new Mock <IGpgTransport>(); transportMock.Setup( t => t.CallGpg(It.IsNotNull <string>(), It.IsAny <string>())) .Returns(new GpgResultBuilder() .WithStdout("GPG version 1.0\r\nmore info") .Build()); var gpg = new GPG(transportMock.Object, Mock.Of <IGpgAgent>(), StubGpgResultVerifier.AlwaysValid, new GpgConfig()); var version = gpg.GetVersion(); version.ShouldBe("GPG version 1.0"); }
public void StartAgent_CallsListSecretKeys() { var transportMock = new Mock <IGpgTransport>(); transportMock.Setup( t => t.CallGpg(It.IsNotNull <string>(), It.IsAny <string>())) .Returns(new GpgResultBuilder() .WithStdout("secret keys") .Build()); var gpg = new GPG(transportMock.Object, Mock.Of <IGpgAgent>(), StubGpgResultVerifier.AlwaysValid, new GpgConfig()); gpg.StartAgent(); transportMock.Verify(t => t.CallGpg(It.IsRegex("--list-secret-keys"), null), Times.Once); }
public PnlVideoDownloadOptions(GPG.Multiplayer.Client.Vaulting.Videos.Video video) { this.InitializeComponent(); this.comboBoxQuality.Items.Add(new MultiVal<string, string>(Loc.Get("<LOC>Any"), "<LOC>Any")); this.comboBoxQuality.Items.Add(new MultiVal<string, string>(Loc.Get("<LOC>Low"), "<LOC>Low")); this.comboBoxQuality.Items.Add(new MultiVal<string, string>(Loc.Get("<LOC>Medium"), "<LOC>Medium")); this.comboBoxQuality.Items.Add(new MultiVal<string, string>(Loc.Get("<LOC>High"), "<LOC>High")); this.comboBoxQuality.SelectedIndex = 0; this.comboBoxFormat.Items.Add(Loc.Get("<LOC>Any")); foreach (string str in video.ContentType.FileExtensions) { this.comboBoxFormat.Items.Add(str); } this.comboBoxFormat.SelectedIndex = 0; this.mVideo = video; }
public void StartAgent_ChecksAgentAlive() { var transportMock = new Mock <IGpgTransport>(); transportMock.Setup( t => t.CallGpg(It.IsNotNull <string>(), It.IsAny <string>())) .Returns(new GpgResultBuilder() .WithStdout("secret keys") .Build()); var agentMock = new Mock <IGpgAgent>(); var gpg = new GPG(transportMock.Object, agentMock.Object, StubGpgResultVerifier.AlwaysValid, new GpgConfig()); gpg.StartAgent(); agentMock.Verify(a => a.EnsureAgentResponsive(), Times.Once); }
public ErrorSigMessage(string[] arguments) : base(StatusMessageType.ErrorSig) { keyId = arguments[0].ToUpperInvariant(); keyType = GPG.ParseKeyType(arguments[1]); hashAlgo = GPG.ParseHashAlgorithm(arguments[2]); timestamp = GPG.ParseTimestamp(arguments[4]); int reason = int.Parse(arguments[5]); if (reason == 4) { unsupportedAlgo = true; } else if (reason == 9) { missingKey = true; } }
public PnlAwardDegree(GPG.Multiplayer.Statistics.Award award, int currentDegree) { this.InitializeComponent(); this.gpgLabelDescription.Text = award.AchievementDescription; if (award.AwardDegree <= currentDegree) { this.gpgLabelDescription.ForeColor = Color.FromArgb(220, 220, 220); } else if (award.AwardDegree == (currentDegree + 1)) { this.gpgLabelDescription.ForeColor = Color.FromArgb(0xcc, 0xcc, 0xff); this.gpgLabelDescription.Font = new Font(this.gpgLabelDescription.Font, FontStyle.Bold); } else { this.gpgLabelDescription.ForeColor = Color.Gray; } this.mAward = award; this.mCurrentDegree = currentDegree; }
public PnlToolUploadOptions(GPG.Multiplayer.Client.Vaulting.Tools.Tool tool) { this.InitializeComponent(); this.comboBoxReleaseQual.Items.Add(new MultiVal<string, string>(Loc.Get("<LOC>Unspecified"), "<LOC>Unspecified")); this.comboBoxReleaseQual.Items.Add(new MultiVal<string, string>(Loc.Get("<LOC>Untested"), "<LOC>Untested")); this.comboBoxReleaseQual.Items.Add(new MultiVal<string, string>(Loc.Get("<LOC>Alpha"), "<LOC>Alpha")); this.comboBoxReleaseQual.Items.Add(new MultiVal<string, string>(Loc.Get("<LOC>Beta"), "<LOC>Beta")); this.comboBoxReleaseQual.Items.Add(new MultiVal<string, string>(Loc.Get("<LOC>Release"), "<LOC>Release")); this.comboBoxReleaseQual.SelectedIndex = 0; if ((tool.LocalFilePath != null) && (tool.LocalFilePath.Length > 0)) { if (tool.LocalFilePath.EndsWith(".zip")) { this.gpgRadioButtonExeDir.Enabled = false; this.gpgRadioButtonExeDirSubs.Enabled = false; this.gpgRadioButtonExeOnly.Enabled = false; } else { this.gpgRadioButtonExeDir.Enabled = true; this.gpgRadioButtonExeDirSubs.Enabled = true; this.gpgRadioButtonExeOnly.Enabled = true; } } this.gpgTextBoxExePath.Text = tool.ExeName; this.gpgTextBoxVolunteer.Text = tool.DownloadVolunteerEffort; this.gpgTextBoxDeveloper.Text = tool.DeveloperName; this.gpgTextBoxWebsite.Text = tool.Website; for (int i = 0; i < this.comboBoxReleaseQual.Items.Count; i++) { if ((this.comboBoxReleaseQual.Items[i] as MultiVal<string, string>).Value2 == tool.Quality) { this.comboBoxReleaseQual.SelectedIndex = i; break; } } this.mTool = tool; this.ToolAttributeChanged(null, null); }
private static extern bool GetWindowRect(IntPtr hWnd, out GPG.Multiplayer.Client.RECT lpRect);
public PnlModDownloadOptions(GPG.Multiplayer.Client.Vaulting.Mods.Mod mod) { this.InitializeComponent(); this.mMod = mod; this.CriteriaChanged(null, null); }
public void BindToClanMember(GPG.Multiplayer.Client.Clans.ClanMember member) { this.BindToClanMember(member, this.Category); }
public void BindToClanMember(GPG.Multiplayer.Client.Clans.ClanMember member, UserListCategories initialCategory) { this.mClanMember = member; this.mCategory = initialCategory; try { if (!member.Online) { this.NameColor = Program.Settings.Chat.Appearance.UnavailableColor; this.NameFont = DefaultFont; } else { this.NameColor = Program.Settings.Chat.Appearance.DefaultColor; this.NameFont = DefaultFont; } this.ClanRankImage = member.GetRanking().Image; if (member.Online) { this.PlayerStatus = UserStatus.None; } else { this.PlayerStatus = UserStatus.Offline; } if (this.PlayerStatus != null) { this.StatusImage = this.PlayerStatus.Icon; } } catch (Exception exception) { ErrorLog.WriteLine(exception); } }
public void BindToUser(GPG.Multiplayer.Quazal.User user) { this.BindToUser(user, this.Category); }
public void BindToUser(GPG.Multiplayer.Quazal.User user, UserListCategories initialCategory) { this.mUser = user; this.mCategory = initialCategory; this.Award1Image = null; this.Award2Image = null; this.Award3Image = null; try { this.NameColor = Program.Settings.Chat.Appearance.DefaultColor; this.NameFont = DefaultFont; this.PlayerAwards = new PlayerDisplayAwards(user); if (!AvatarCache.ContainsKey(this.PlayerAwards.Avatar.ID)) { AvatarCache[this.PlayerAwards.Avatar.ID] = DrawUtil.CopyImage(this.PlayerAwards.Avatar.Image); } this.AvatarImage = AvatarCache[this.PlayerAwards.Avatar.ID]; if (this.PlayerAwards.Award1Specified) { this.Award1Image = this.PlayerAwards.Award1.SmallImage; } if (this.PlayerAwards.Award2Specified) { this.Award2Image = this.PlayerAwards.Award2.SmallImage; } if (this.PlayerAwards.Award3Specified) { this.Award3Image = this.PlayerAwards.Award3.SmallImage; } if (!(((!user.IsAway && !user.IsDND) && !user.IsIgnored) && user.Online)) { this.NameColor = Program.Settings.Chat.Appearance.UnavailableColor; this.NameFont = DefaultFont; } else if (user.IsAdmin || ((Chatroom.InChatroom && !Chatroom.Current.IsPersistent) && user.IsChannelOperator)) { this.NameColor = Program.Settings.Chat.Appearance.AdminColor; this.NameFont = AdminFont; } else if (user.IsModerator) { this.NameColor = Program.Settings.Chat.Appearance.ModeratorColor; this.NameFont = Program.Settings.Chat.Appearance.ModeratorFont; } else { this.NameColor = Program.Settings.Chat.Appearance.DefaultColor; this.NameFont = DefaultFont; } if (this.NameColor == Color.Empty) { this.NameColor = Program.Settings.Chat.Appearance.DefaultColor; } if (this.NameFont == null) { this.NameFont = DefaultFont; } this.PlayerStatus = UserStatus.GetStatus(user); if (this.PlayerStatus != null) { this.StatusImage = this.PlayerStatus.Icon; } } catch (Exception exception) { ErrorLog.WriteLine(exception); } }