diff --git a/PCK-Studio/Forms/CreditsForm.Designer.cs b/PCK-Studio/Forms/ContributorsForm.Designer.cs similarity index 60% rename from PCK-Studio/Forms/CreditsForm.Designer.cs rename to PCK-Studio/Forms/ContributorsForm.Designer.cs index 97229cae..1fdb6b58 100644 --- a/PCK-Studio/Forms/CreditsForm.Designer.cs +++ b/PCK-Studio/Forms/ContributorsForm.Designer.cs @@ -1,6 +1,6 @@ namespace PckStudio.Forms { - partial class CreditsForm + partial class ContributorsForm { /// /// Required designer variable. @@ -28,88 +28,47 @@ /// private void InitializeComponent() { - System.Windows.Forms.PictureBox pictureBox1; MetroFramework.Controls.MetroLabel metroLabel1; MetroFramework.Controls.MetroLabel metroLabel2; - MetroFramework.Controls.MetroLabel metroLabel3; - MetroFramework.Controls.MetroLabel metroLabel4; MetroFramework.Controls.MetroLabel metroLabel5; MetroFramework.Controls.MetroLabel metroLabel6; - System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(CreditsForm)); + System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ContributorsForm)); this.folderBrowserDialog1 = new System.Windows.Forms.FolderBrowserDialog(); this.buildLabel = new MetroFramework.Controls.MetroLabel(); - pictureBox1 = new System.Windows.Forms.PictureBox(); + this.contributorsLayoutPanel = new System.Windows.Forms.FlowLayoutPanel(); metroLabel1 = new MetroFramework.Controls.MetroLabel(); metroLabel2 = new MetroFramework.Controls.MetroLabel(); - metroLabel3 = new MetroFramework.Controls.MetroLabel(); - metroLabel4 = new MetroFramework.Controls.MetroLabel(); metroLabel5 = new MetroFramework.Controls.MetroLabel(); metroLabel6 = new MetroFramework.Controls.MetroLabel(); - ((System.ComponentModel.ISupportInitialize)(pictureBox1)).BeginInit(); this.SuspendLayout(); // - // pictureBox1 - // - pictureBox1.BackColor = System.Drawing.Color.Transparent; - pictureBox1.Enabled = false; - pictureBox1.Image = global::PckStudio.Properties.Resources.Splash; - pictureBox1.Location = new System.Drawing.Point(4, 5); - pictureBox1.Margin = new System.Windows.Forms.Padding(0, 0, 11, 0); - pictureBox1.Name = "pictureBox1"; - pictureBox1.Size = new System.Drawing.Size(550, 293); - pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; - pictureBox1.TabIndex = 0; - pictureBox1.TabStop = false; - // // metroLabel1 // metroLabel1.AutoSize = true; metroLabel1.Enabled = false; - metroLabel1.Location = new System.Drawing.Point(4, 301); + metroLabel1.Location = new System.Drawing.Point(23, 475); metroLabel1.Name = "metroLabel1"; - metroLabel1.Size = new System.Drawing.Size(250, 19); + metroLabel1.Size = new System.Drawing.Size(168, 19); metroLabel1.TabIndex = 1; - metroLabel1.Text = "Restored and maintained by PhoenixARC"; + metroLabel1.Text = "Maintained by PhoenixARC"; metroLabel1.Theme = MetroFramework.MetroThemeStyle.Dark; // // metroLabel2 // metroLabel2.AutoSize = true; metroLabel2.Enabled = false; - metroLabel2.Location = new System.Drawing.Point(314, 301); + metroLabel2.Location = new System.Drawing.Point(23, 456); metroLabel2.Name = "metroLabel2"; - metroLabel2.Size = new System.Drawing.Size(269, 19); + metroLabel2.Size = new System.Drawing.Size(368, 19); metroLabel2.TabIndex = 2; - metroLabel2.Text = "Utilizing the Nobledez Website by Newagent"; + metroLabel2.Text = "Originally created and developed by jam1garner && Nobledez"; metroLabel2.Theme = MetroFramework.MetroThemeStyle.Dark; // - // metroLabel3 - // - metroLabel3.AutoSize = true; - metroLabel3.Enabled = false; - metroLabel3.Location = new System.Drawing.Point(314, 339); - metroLabel3.Name = "metroLabel3"; - metroLabel3.Size = new System.Drawing.Size(212, 19); - metroLabel3.TabIndex = 3; - metroLabel3.Text = "3D skin renderer by Łukasz Rejman"; - metroLabel3.Theme = MetroFramework.MetroThemeStyle.Dark; - // - // metroLabel4 - // - metroLabel4.AutoSize = true; - metroLabel4.Enabled = false; - metroLabel4.Location = new System.Drawing.Point(314, 320); - metroLabel4.Name = "metroLabel4"; - metroLabel4.Size = new System.Drawing.Size(199, 19); - metroLabel4.TabIndex = 4; - metroLabel4.Text = "3D renderer found by Newagent"; - metroLabel4.Theme = MetroFramework.MetroThemeStyle.Dark; - // // metroLabel5 // metroLabel5.AutoSize = true; metroLabel5.Enabled = false; - metroLabel5.Location = new System.Drawing.Point(4, 320); + metroLabel5.Location = new System.Drawing.Point(397, 456); metroLabel5.Name = "metroLabel5"; metroLabel5.Size = new System.Drawing.Size(300, 19); metroLabel5.TabIndex = 5; @@ -120,7 +79,7 @@ // metroLabel6.AutoSize = true; metroLabel6.Enabled = false; - metroLabel6.Location = new System.Drawing.Point(4, 339); + metroLabel6.Location = new System.Drawing.Point(397, 475); metroLabel6.Name = "metroLabel6"; metroLabel6.Size = new System.Drawing.Size(203, 19); metroLabel6.TabIndex = 6; @@ -132,40 +91,46 @@ this.buildLabel.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(12)))), ((int)(((byte)(34)))), ((int)(((byte)(56))))); this.buildLabel.Enabled = false; this.buildLabel.ForeColor = System.Drawing.SystemColors.Control; - this.buildLabel.Location = new System.Drawing.Point(314, 30); + this.buildLabel.Location = new System.Drawing.Point(473, 6); this.buildLabel.Name = "buildLabel"; - this.buildLabel.Size = new System.Drawing.Size(212, 171); + this.buildLabel.Size = new System.Drawing.Size(212, 54); this.buildLabel.TabIndex = 7; this.buildLabel.Text = "Build Information"; this.buildLabel.TextAlign = System.Drawing.ContentAlignment.TopRight; this.buildLabel.Theme = MetroFramework.MetroThemeStyle.Dark; this.buildLabel.WrapToLine = true; // - // CreditsForm + // contributorsLayoutPanel + // + this.contributorsLayoutPanel.AutoScroll = true; + this.contributorsLayoutPanel.Location = new System.Drawing.Point(23, 63); + this.contributorsLayoutPanel.Name = "contributorsLayoutPanel"; + this.contributorsLayoutPanel.Size = new System.Drawing.Size(684, 390); + this.contributorsLayoutPanel.TabIndex = 8; + // + // ContributorsForm // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(585, 364); + this.ClientSize = new System.Drawing.Size(730, 500); + this.Controls.Add(this.contributorsLayoutPanel); this.Controls.Add(this.buildLabel); this.Controls.Add(metroLabel6); this.Controls.Add(metroLabel1); this.Controls.Add(metroLabel5); - this.Controls.Add(metroLabel4); - this.Controls.Add(metroLabel3); this.Controls.Add(metroLabel2); - this.Controls.Add(pictureBox1); - this.DisplayHeader = false; + this.ForeColor = System.Drawing.SystemColors.ButtonHighlight; this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); this.MaximizeBox = false; + this.MaximumSize = new System.Drawing.Size(730, 500); this.MinimizeBox = false; - this.Name = "CreditsForm"; - this.Padding = new System.Windows.Forms.Padding(20, 30, 20, 20); + this.MinimumSize = new System.Drawing.Size(730, 500); + this.Name = "ContributorsForm"; this.Resizable = false; this.ShadowType = MetroFramework.Forms.MetroFormShadowType.DropShadow; - this.Style = MetroFramework.MetroColorStyle.Black; - this.Text = "programInfo"; + this.Style = MetroFramework.MetroColorStyle.Silver; + this.Text = "Contributors"; this.Theme = MetroFramework.MetroThemeStyle.Dark; - ((System.ComponentModel.ISupportInitialize)(pictureBox1)).EndInit(); this.ResumeLayout(false); this.PerformLayout(); @@ -175,5 +140,6 @@ private System.Windows.Forms.FolderBrowserDialog folderBrowserDialog1; private MetroFramework.Controls.MetroLabel buildLabel; + private System.Windows.Forms.FlowLayoutPanel contributorsLayoutPanel; } } \ No newline at end of file diff --git a/PCK-Studio/Forms/ContributorsForm.cs b/PCK-Studio/Forms/ContributorsForm.cs new file mode 100644 index 00000000..b4bf59ed --- /dev/null +++ b/PCK-Studio/Forms/ContributorsForm.cs @@ -0,0 +1,44 @@ +using System; +using System.Linq; +using System.Threading.Tasks; +using System.Windows.Forms; +using MetroFramework.Forms; +using PckStudio.Internal; +using PckStudio.ToolboxItems; + +namespace PckStudio.Forms +{ + public partial class ContributorsForm : MetroForm + { + public ContributorsForm() + { + InitializeComponent(); +#if false + Task.Run(GetContributors); +#endif + string buildConfig = ""; +#if BETA + buildConfig = "Beta"; +#elif DEBUG + buildConfig = "Debug"; +#elif RELEASE + buildConfig = "Release"; +#else + buildConfig = "unknown"; +#endif + buildLabel.Text = $"Verion: {Application.ProductVersion}\nBuild Config: {buildConfig}\nBranch: {CommitInfo.BranchName}@{CommitInfo.CommitHash}"; + } + + protected override void OnLoad(EventArgs e) + { + base.OnLoad(e); + foreach (var contributorsName in ApplicationScope.Contributors) + { + if (InvokeRequired) + Invoke(() => contributorsLayoutPanel.Controls.Add(new GithubUserPanel(contributorsName))); + else + contributorsLayoutPanel.Controls.Add(new GithubUserPanel(contributorsName)); + } + } + } +} diff --git a/PCK-Studio/Forms/CreditsForm.resx b/PCK-Studio/Forms/ContributorsForm.resx similarity index 99% rename from PCK-Studio/Forms/CreditsForm.resx rename to PCK-Studio/Forms/ContributorsForm.resx index b7a2f32a..70546ba1 100644 --- a/PCK-Studio/Forms/CreditsForm.resx +++ b/PCK-Studio/Forms/ContributorsForm.resx @@ -117,21 +117,12 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - False - False False - - False - - - False - False diff --git a/PCK-Studio/Forms/CreditsForm.cs b/PCK-Studio/Forms/CreditsForm.cs deleted file mode 100644 index df2c386c..00000000 --- a/PCK-Studio/Forms/CreditsForm.cs +++ /dev/null @@ -1,26 +0,0 @@ -using System; -using System.Windows.Forms; -using MetroFramework.Forms; -using PckStudio.Internal; - -namespace PckStudio.Forms -{ - public partial class CreditsForm : MetroForm - { - public CreditsForm() - { - InitializeComponent(); - string buildConfig = ""; -#if BETA - buildConfig = "Beta"; -#elif DEBUG - buildConfig = "Debug"; -#elif RELEASE - buildConfig = "Release"; -#else - buildConfig = "unknown"; -#endif - buildLabel.Text = $"Verion: {Application.ProductVersion}\nBuild Config: {buildConfig}\nBranch: {CommitInfo.BranchName}@{CommitInfo.CommitHash}"; - } - } -} diff --git a/PCK-Studio/Internal/ApplicationScope.cs b/PCK-Studio/Internal/ApplicationScope.cs index 21ee70e9..dfa04d9f 100644 --- a/PCK-Studio/Internal/ApplicationScope.cs +++ b/PCK-Studio/Internal/ApplicationScope.cs @@ -7,6 +7,8 @@ using PckStudio.Extensions; using System.Globalization; using PckStudio.Internal.Json; using PckStudio.Internal.Misc; +using System.Threading.Tasks; +using System.Windows.Forms; namespace PckStudio.Internal { @@ -14,6 +16,8 @@ namespace PckStudio.Internal { public static FileCacher DataCacher { get; private set; } + public static Octokit.RepositoryContributor[] Contributors { get; private set; } + private static Image[] _entityImages; public static Image[] EntityImages => _entityImages; @@ -41,8 +45,17 @@ namespace PckStudio.Internal _ = Tiles.PaintingImageList; SettingsManager.Initialize(); CultureInfo.CurrentCulture = CultureInfo.InvariantCulture; + Task.Run(GetContributors); } Profiler.Stop(); } + + internal static void GetContributors() + { + var ghClient = new Octokit.GitHubClient(new Octokit.ProductHeaderValue(Application.ProductName + "Credits")); + var allContributorsAct = ghClient.Repository.GetAllContributors("PhoenixARC", "-PCK-Studio"); + allContributorsAct.Wait(); + Contributors = allContributorsAct.Result.ToArray(); + } } } \ No newline at end of file diff --git a/PCK-Studio/MainForm.cs b/PCK-Studio/MainForm.cs index 5154e2de..fc4bc306 100644 --- a/PCK-Studio/MainForm.cs +++ b/PCK-Studio/MainForm.cs @@ -1703,7 +1703,7 @@ namespace PckStudio private void aboutToolStripMenuItem_Click(object sender, EventArgs e) { - using CreditsForm info = new CreditsForm(); + using ContributorsForm info = new ContributorsForm(); info.ShowDialog(this); } diff --git a/PCK-Studio/PckStudio.csproj b/PCK-Studio/PckStudio.csproj index 2332b391..95545a07 100644 --- a/PCK-Studio/PckStudio.csproj +++ b/PCK-Studio/PckStudio.csproj @@ -133,6 +133,12 @@ + + Form + + + ContributorsForm.cs + @@ -159,6 +165,12 @@ Component + + UserControl + + + GithubUserPanel.cs + Component @@ -429,14 +441,11 @@ - - Form - - - CreditsForm.cs - + + ContributorsForm.cs + CemuPanel.cs @@ -566,14 +575,14 @@ AudioEditor.cs Designer - - CreditsForm.cs - PublicResXFileCodeGenerator Designer Resources.Designer.cs + + GithubUserPanel.cs + @@ -627,7 +636,6 @@ - @@ -707,6 +715,9 @@ 13.0.3 + + 12.0.0 + 4.5.0 diff --git a/PCK-Studio/Properties/Resources.Designer.cs b/PCK-Studio/Properties/Resources.Designer.cs index cbb4dd6a..27cbbf9d 100644 --- a/PCK-Studio/Properties/Resources.Designer.cs +++ b/PCK-Studio/Properties/Resources.Designer.cs @@ -1039,16 +1039,6 @@ namespace PckStudio.Properties { } } - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - public static System.Drawing.Bitmap Splash { - get { - object obj = ResourceManager.GetObject("Splash", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - /// /// Looks up a localized resource of type System.Drawing.Bitmap. /// diff --git a/PCK-Studio/Properties/Resources.resx b/PCK-Studio/Properties/Resources.resx index 302b7724..bc72525c 100644 --- a/PCK-Studio/Properties/Resources.resx +++ b/PCK-Studio/Properties/Resources.resx @@ -283,9 +283,6 @@ ..\Resources\atlases\explosion.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Resources\Splash.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - ..\Resources\external\WiiU.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a diff --git a/PCK-Studio/Resources/Splash.png b/PCK-Studio/Resources/Splash.png deleted file mode 100644 index 5b1a9b19..00000000 Binary files a/PCK-Studio/Resources/Splash.png and /dev/null differ diff --git a/PCK-Studio/ToolboxItems/GithubUserPanel.Designer.cs b/PCK-Studio/ToolboxItems/GithubUserPanel.Designer.cs new file mode 100644 index 00000000..43aa9849 --- /dev/null +++ b/PCK-Studio/ToolboxItems/GithubUserPanel.Designer.cs @@ -0,0 +1,90 @@ +namespace PckStudio.ToolboxItems +{ + partial class GithubUserPanel + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Component Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.userPictureBox = new System.Windows.Forms.PictureBox(); + this.userNameLabel = new MetroFramework.Controls.MetroLabel(); + this.aboutButton = new MetroFramework.Controls.MetroButton(); + ((System.ComponentModel.ISupportInitialize)(this.userPictureBox)).BeginInit(); + this.SuspendLayout(); + // + // userPictureBox + // + this.userPictureBox.BackColor = System.Drawing.Color.Transparent; + this.userPictureBox.Location = new System.Drawing.Point(8, 34); + this.userPictureBox.Name = "userPictureBox"; + this.userPictureBox.Size = new System.Drawing.Size(100, 100); + this.userPictureBox.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom; + this.userPictureBox.TabIndex = 0; + this.userPictureBox.TabStop = false; + // + // userNameLabel + // + this.userNameLabel.FontSize = MetroFramework.MetroLabelSize.Tall; + this.userNameLabel.Location = new System.Drawing.Point(8, 6); + this.userNameLabel.Name = "userNameLabel"; + this.userNameLabel.Size = new System.Drawing.Size(100, 25); + this.userNameLabel.TabIndex = 0; + this.userNameLabel.Text = "user name"; + this.userNameLabel.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + this.userNameLabel.Theme = MetroFramework.MetroThemeStyle.Dark; + // + // aboutButton + // + this.aboutButton.Location = new System.Drawing.Point(8, 140); + this.aboutButton.Name = "aboutButton"; + this.aboutButton.Size = new System.Drawing.Size(100, 23); + this.aboutButton.TabIndex = 0; + this.aboutButton.Text = "about button"; + this.aboutButton.Theme = MetroFramework.MetroThemeStyle.Dark; + this.aboutButton.UseSelectable = true; + // + // GithubUserPanel + // + this.Controls.Add(this.userPictureBox); + this.Controls.Add(this.aboutButton); + this.Controls.Add(this.userNameLabel); + this.MaximumSize = new System.Drawing.Size(115, 170); + this.MinimumSize = new System.Drawing.Size(115, 170); + this.Name = "GithubUserPanel"; + this.Padding = new System.Windows.Forms.Padding(5); + this.Size = new System.Drawing.Size(115, 170); + this.Theme = MetroFramework.MetroThemeStyle.Dark; + ((System.ComponentModel.ISupportInitialize)(this.userPictureBox)).EndInit(); + this.ResumeLayout(false); + + } + + #endregion + + private System.Windows.Forms.PictureBox userPictureBox; + private MetroFramework.Controls.MetroLabel userNameLabel; + private MetroFramework.Controls.MetroButton aboutButton; + } +} diff --git a/PCK-Studio/ToolboxItems/GithubUserPanel.cs b/PCK-Studio/ToolboxItems/GithubUserPanel.cs new file mode 100644 index 00000000..31c026d4 --- /dev/null +++ b/PCK-Studio/ToolboxItems/GithubUserPanel.cs @@ -0,0 +1,78 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Diagnostics; +using System.Linq; +using System.Text; +using Octokit; +using MetroFramework.Controls; +using System.Drawing; +using System.Net; +using System.IO; +using System.Threading.Tasks; +using PckStudio.Internal; +using System.Drawing.Imaging; + +namespace PckStudio.ToolboxItems +{ + public partial class GithubUserPanel : MetroUserControl + { + private Author _contributor; + + public GithubUserPanel() + { + InitializeComponent(); + } + + public GithubUserPanel(Author contributor) : this() + { + _contributor = contributor; + } + + protected override void OnLoad(EventArgs e) + { + base.OnLoad(e); + if (DesignMode) + return; + + Visible = false; + Task.Run(LoadAuthor); + } + + private void LoadAuthor() + { + string cacheKey = Convert.ToBase64String(Encoding.Default.GetBytes(_contributor.AvatarUrl)); + + if (!ApplicationScope.DataCacher.HasFileCached(cacheKey)) + { + using (WebClient webClient = new WebClient()) + { + Stream avatarImgStream = webClient.OpenRead(_contributor.AvatarUrl); + MemoryStream ms = new MemoryStream(); + new Bitmap(avatarImgStream).Save(ms, ImageFormat.Png); + avatarImgStream.Flush(); + avatarImgStream.Dispose(); + ApplicationScope.DataCacher.Cache(ms.ToArray(), cacheKey); + } + } + + Image avatarUserImg = Image.FromFile(ApplicationScope.DataCacher.GetCachedFilepath(cacheKey)); + + Action setUiElements = () => + { + userPictureBox.Image = avatarUserImg; + userNameLabel.Text = _contributor.Login; + aboutButton.Text = "Github profile"; + aboutButton.Click += (s, e) => Process.Start(_contributor.HtmlUrl); + Visible = true; + }; + + if (InvokeRequired) + { + Invoke(setUiElements); + return; + } + setUiElements(); + } + } +} diff --git a/PCK-Studio/ToolboxItems/GithubUserPanel.resx b/PCK-Studio/ToolboxItems/GithubUserPanel.resx new file mode 100644 index 00000000..1af7de15 --- /dev/null +++ b/PCK-Studio/ToolboxItems/GithubUserPanel.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file