├── Ps4-Pkg-Sender ├── delivery.ico ├── Resources │ ├── Error.wav │ └── Complete.wav ├── Extensions │ ├── StringExtensions.cs │ ├── ControlExtensions.cs │ └── IntegerExtenstions.cs ├── packages.config ├── Enums │ ├── TaskType.cs │ ├── TransferStatus.cs │ └── PkgType.cs ├── Controls │ ├── Theming │ │ ├── Options │ │ │ ├── Interfaces │ │ │ │ └── IControlSample.cs │ │ │ ├── ConfigOptions │ │ │ │ ├── BigLabelOption.cs │ │ │ │ ├── SmallLabelOption.cs │ │ │ │ ├── TextboxOption.cs │ │ │ │ ├── GroupboxOption.cs │ │ │ │ ├── CheckboxOption.cs │ │ │ │ ├── FormOption.cs │ │ │ │ ├── ProgressbarOption.cs │ │ │ │ ├── LabelOption.cs │ │ │ │ ├── FontedOption.cs │ │ │ │ ├── ButtonOption.cs │ │ │ │ ├── LinkLabelOption.cs │ │ │ │ ├── NumericUpDownOption.cs │ │ │ │ ├── ListViewOption.cs │ │ │ │ ├── ContextMenuOption.cs │ │ │ │ └── EditableOption.cs │ │ │ ├── Setting │ │ │ │ └── CurrentSettings.cs │ │ │ ├── OptionsSample.cs │ │ │ ├── SelectableOption.cs │ │ │ └── ControlSamples │ │ │ │ ├── FormSample.cs │ │ │ │ ├── ContextMenuSample.cs │ │ │ │ ├── ProgressbarSample.cs │ │ │ │ ├── GroupboxSample.cs │ │ │ │ ├── LabelSample.cs │ │ │ │ ├── CheckboxSample.cs │ │ │ │ ├── NumericUpDownSample.cs │ │ │ │ ├── TextboxSample.cs │ │ │ │ ├── LinkLabelSample.cs │ │ │ │ ├── ButtonSample.cs │ │ │ │ └── ListViewSample.cs │ │ └── CustomMenuStripRenderer.cs │ ├── CustomListView.cs │ ├── CustomProgressBar.cs │ ├── CustomContextMenu.cs │ ├── FlatNumericUpDown.cs │ └── Sorting │ │ └── ListViewColumnSorter.cs ├── Properties │ ├── Settings.settings │ ├── Settings.Designer.cs │ ├── AssemblyInfo.cs │ ├── Resources.Designer.cs │ └── Resources.resx ├── Json │ ├── Ps4DataPayload.cs │ ├── SoundSettings.cs │ ├── AppSettings.cs │ ├── Ps4Progress.cs │ ├── Converters │ │ └── DictionaryConverter.cs │ └── ThemeSettings.cs ├── Ps4 │ ├── PkgTransferProgress.cs │ ├── DataTrasmittedProgress.cs │ ├── PkgInfo.cs │ ├── PkgTransfer.cs │ └── Server.cs ├── Models │ ├── QueueItemInfo.cs │ └── FileRenameInfo.cs ├── Exceptions │ ├── ServerInitializationException.cs │ ├── SkipItemException.cs │ └── RPIErrorThrownException.cs ├── Utilities │ ├── PkgTypeComparator.cs │ ├── Logger.cs │ ├── HttpUtil.cs │ ├── ProcessUtil.cs │ ├── ReflectionUtil.cs │ ├── TimeFormatUtil.cs │ └── NodeJSUtil.cs ├── Program.cs ├── WinApi │ └── Win32Api.cs ├── App.config ├── AddServerIpForm.cs ├── UI │ ├── ListViewThemeItem.cs │ ├── ThemeValues.cs │ ├── ThemeItem.cs │ └── Themer.cs ├── Services │ ├── Service.cs │ └── FileRenameService.cs ├── SettingsForm.cs ├── QueueItem.cs ├── AddServerIpForm.Designer.cs ├── AddServerIpForm.resx ├── AppearanceOptionsForm.resx ├── SettingsForm.resx ├── SettingsForm.Designer.cs └── AppearanceOptionsForm.cs ├── Ps4-Pkg-Sender.sln ├── README.md ├── .gitattributes └── .gitignore /Ps4-Pkg-Sender/delivery.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/objects/Ps4-Pkg-Sender/master/Ps4-Pkg-Sender/delivery.ico -------------------------------------------------------------------------------- /Ps4-Pkg-Sender/Resources/Error.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/objects/Ps4-Pkg-Sender/master/Ps4-Pkg-Sender/Resources/Error.wav -------------------------------------------------------------------------------- /Ps4-Pkg-Sender/Resources/Complete.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/objects/Ps4-Pkg-Sender/master/Ps4-Pkg-Sender/Resources/Complete.wav -------------------------------------------------------------------------------- /Ps4-Pkg-Sender/Extensions/StringExtensions.cs: -------------------------------------------------------------------------------- 1 | namespace Ps4_Pkg_Sender.Extensions { 2 | public static class StringExtensions { 3 | 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /Ps4-Pkg-Sender/packages.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /Ps4-Pkg-Sender/Enums/TaskType.cs: -------------------------------------------------------------------------------- 1 | namespace Ps4_Pkg_Sender.Enums { 2 | public enum TaskType { 3 | Queued, 4 | Sending, 5 | Installed, 6 | Uninstalling, 7 | Finished, 8 | Timed_Out, 9 | Failed 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /Ps4-Pkg-Sender/Controls/Theming/Options/Interfaces/IControlSample.cs: -------------------------------------------------------------------------------- 1 | using System.Windows.Forms; 2 | 3 | namespace Ps4_Pkg_Sender.Controls.Theming.Options.Interfaces { 4 | public interface IControlSample { 5 | Control GetSampleControl(); 6 | void Dispose(); 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /Ps4-Pkg-Sender/Properties/Settings.settings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Ps4-Pkg-Sender/Controls/Theming/Options/ConfigOptions/BigLabelOption.cs: -------------------------------------------------------------------------------- 1 | namespace Ps4_Pkg_Sender.Controls.Theming.Options.ConfigOptions { 2 | public class BigLabelOption : LabelOption{ 3 | public BigLabelOption() : base() { 4 | this.DisplayText = "Big Labels"; 5 | } 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /Ps4-Pkg-Sender/Controls/Theming/Options/ConfigOptions/SmallLabelOption.cs: -------------------------------------------------------------------------------- 1 | namespace Ps4_Pkg_Sender.Controls.Theming.Options.ConfigOptions { 2 | public class SmallLabelOption : LabelOption{ 3 | public SmallLabelOption() : base() { 4 | this.DisplayText = "Small Labels"; 5 | } 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /Ps4-Pkg-Sender/Enums/TransferStatus.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace Ps4_Pkg_Sender.Enums { 8 | public enum TransferStatus { 9 | RequestingPkgSend, 10 | InProgress, 11 | Completed 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /Ps4-Pkg-Sender/Json/Ps4DataPayload.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json; 2 | using System.Collections.Generic; 3 | 4 | namespace Ps4_Pkg_Sender.Json { 5 | public class Ps4DataPayload { 6 | [JsonProperty("type")] 7 | public string Type; 8 | 9 | [JsonProperty("packages")] 10 | public string[] Packages; 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /Ps4-Pkg-Sender/Controls/Theming/Options/Setting/CurrentSettings.cs: -------------------------------------------------------------------------------- 1 | using System.Drawing; 2 | 3 | namespace Ps4_Pkg_Sender.Controls.Theming.Options.Setting { 4 | public class CurrentSettings { 5 | public Color BackColor { get; set; } 6 | public Color ForeColor { get; set; } 7 | public Font Font { get; set; } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /Ps4-Pkg-Sender/Controls/Theming/Options/ConfigOptions/TextboxOption.cs: -------------------------------------------------------------------------------- 1 | using Ps4_Pkg_Sender.Controls.Theming.Options.ControlSamples; 2 | 3 | namespace Ps4_Pkg_Sender.Controls.Theming.Options.ConfigOptions { 4 | public class TextboxOption : FontedOption { 5 | public TextboxOption() : base("Textboxes", new TextboxSample()) { 6 | } 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /Ps4-Pkg-Sender/Controls/Theming/Options/ConfigOptions/GroupboxOption.cs: -------------------------------------------------------------------------------- 1 | using Ps4_Pkg_Sender.Controls.Theming.Options.ControlSamples; 2 | 3 | namespace Ps4_Pkg_Sender.Controls.Theming.Options.ConfigOptions { 4 | public class GroupboxOption : FontedOption { 5 | public GroupboxOption() : base("Groupboxes", new GroupboxSample()) { 6 | } 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /Ps4-Pkg-Sender/Ps4/PkgTransferProgress.cs: -------------------------------------------------------------------------------- 1 | using Ps4_Pkg_Sender.Enums; 2 | 3 | namespace Ps4_Pkg_Sender.Ps4 { 4 | public class PkgTransferProgress { 5 | public TransferStatus TransferStatus { get; set; } 6 | public DataTrasmittedProgress DataTrasmittedProgress { get; set; } 7 | public long TimeLeft { get; set; } = -1; 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /Ps4-Pkg-Sender/Models/QueueItemInfo.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json; 2 | using Ps4_Pkg_Sender.Ps4; 3 | 4 | namespace Ps4_Pkg_Sender.Models { 5 | public class QueueItemInfo { 6 | 7 | [JsonProperty("PkgInfo")] 8 | public PkgInfo PkgInfo { get; set; } 9 | 10 | [JsonProperty("Uninstall")] 11 | public bool Uninstall { get; set; } 12 | 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /Ps4-Pkg-Sender/Controls/Theming/Options/ConfigOptions/CheckboxOption.cs: -------------------------------------------------------------------------------- 1 | using System.Linq; 2 | using Ps4_Pkg_Sender.Controls.Theming.Options.ControlSamples; 3 | 4 | namespace Ps4_Pkg_Sender.Controls.Theming.Options.ConfigOptions { 5 | public class CheckboxOption : FontedOption { 6 | public CheckboxOption() : base("Checkboxes", new CheckboxSample()) { 7 | 8 | } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /Ps4-Pkg-Sender/Exceptions/ServerInitializationException.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace Ps4_Pkg_Sender.Exceptions { 8 | public class ServerInitializationException : Exception { 9 | public ServerInitializationException(string message) : base(message) { 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /Ps4-Pkg-Sender/Controls/Theming/Options/ConfigOptions/FormOption.cs: -------------------------------------------------------------------------------- 1 | using Ps4_Pkg_Sender.Controls.Theming.Options.ControlSamples; 2 | 3 | namespace Ps4_Pkg_Sender.Controls.Theming.Options.ConfigOptions { 4 | public class FormOption : EditableOption { 5 | public FormOption() : base("Forms", new FormSample(), new SelectableOption("BackColor", "Back Color", SelectableOption.OptionType.Color)) { 6 | 7 | } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /Ps4-Pkg-Sender/Models/FileRenameInfo.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json; 2 | 3 | namespace Ps4_Pkg_Sender.Models { 4 | public class FileRenameInfo { 5 | [JsonProperty("CurrentName")] 6 | public string CurrentName { get; set; } 7 | 8 | [JsonProperty("WantedName")] 9 | public string WantedName { get; set; } 10 | 11 | [JsonProperty("CurrentPath")] 12 | public string CurrentPath { get; set; } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /Ps4-Pkg-Sender/Utilities/PkgTypeComparator.cs: -------------------------------------------------------------------------------- 1 | using Ps4_Pkg_Sender.Enums; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace Ps4_Pkg_Sender.Utilities { 9 | public class PkgTypeComparator : IComparable { 10 | public int CompareTo(PkgType other) { 11 | throw new NotImplementedException(); 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /Ps4-Pkg-Sender/Extensions/ControlExtensions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Windows.Forms; 3 | 4 | namespace Ps4_Pkg_Sender.Extensions { 5 | public static class ControlExtensions { 6 | public static void InvokeIfRequired(this Control control, Action action) { 7 | if (control.InvokeRequired) { 8 | control.Invoke(action); 9 | } else { 10 | action?.Invoke(); 11 | } 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /Ps4-Pkg-Sender/Extensions/IntegerExtenstions.cs: -------------------------------------------------------------------------------- 1 | namespace Ps4_Pkg_Sender.Extensions { 2 | public static class IntegerExtenstions { 3 | 4 | public static string SecondsToHumanReadableTime(this int timeInSeconds, bool minimalFormat) { 5 | return Utilities.TimeFormatUtil.GetCountdownFormat(timeInSeconds,minimalFormat); 6 | } 7 | 8 | public static long ToMilliseconds(this int num) { 9 | return num * 1000; 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /Ps4-Pkg-Sender/Controls/Theming/Options/ConfigOptions/ProgressbarOption.cs: -------------------------------------------------------------------------------- 1 | using Ps4_Pkg_Sender.Controls.Theming.Options.ControlSamples; 2 | 3 | namespace Ps4_Pkg_Sender.Controls.Theming.Options.ConfigOptions { 4 | public class ProgressbarOption : FontedOption { 5 | public ProgressbarOption(): base("Progressbars", new ProgressbarSample()) { 6 | InsertSelectableItemBeforeEnd(new SelectableOption("FontColor", "Font Color", SelectableOption.OptionType.Color)); 7 | } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /Ps4-Pkg-Sender/Controls/Theming/Options/OptionsSample.cs: -------------------------------------------------------------------------------- 1 | using Ps4_Pkg_Sender.Controls.Theming.Options.Interfaces; 2 | using Ps4_Pkg_Sender.Controls.Theming.Options.Setting; 3 | using System.Drawing; 4 | 5 | namespace Ps4_Pkg_Sender.Controls.Theming.Options { 6 | public class OptionsSample { 7 | protected RenderOption RenderOption { get; set; } 8 | 9 | private IControlSample _controlSample; 10 | 11 | public OptionsSample(IControlSample controlSample) { 12 | this._controlSample = controlSample; 13 | } 14 | 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Ps4-Pkg-Sender/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Threading.Tasks; 5 | using System.Windows.Forms; 6 | 7 | namespace Ps4_Pkg_Sender { 8 | static class Program { 9 | /// 10 | /// The main entry point for the application. 11 | /// 12 | [STAThread] 13 | static void Main() { 14 | Application.EnableVisualStyles(); 15 | Application.SetCompatibleTextRenderingDefault(false); 16 | Application.Run(new MainForm()); 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /Ps4-Pkg-Sender/Controls/Theming/Options/ConfigOptions/LabelOption.cs: -------------------------------------------------------------------------------- 1 | using Ps4_Pkg_Sender.Controls.Theming.Options.ControlSamples; 2 | 3 | namespace Ps4_Pkg_Sender.Controls.Theming.Options.ConfigOptions { 4 | public class LabelOption : FontedOption { 5 | protected LabelOption() : base("Labels", new LabelSample()) { 6 | 7 | } 8 | 9 | public LabelOption(string name) : base(name,new LabelSample()){ 10 | 11 | } 12 | 13 | public LabelOption(string name, string sampleText) : base (name,new LabelSample() { Text = sampleText }) { 14 | 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /Ps4-Pkg-Sender/Controls/Theming/Options/ConfigOptions/FontedOption.cs: -------------------------------------------------------------------------------- 1 | using System.Linq; 2 | using Ps4_Pkg_Sender.Controls.Theming.Options.Interfaces; 3 | 4 | namespace Ps4_Pkg_Sender.Controls.Theming.Options.ConfigOptions { 5 | public class FontedOption : EditableOption { 6 | public FontedOption(string displayText, IControlSample controlSample) : base(displayText, controlSample) { 7 | this.SelectableOptions.Add(new SelectableOption("Font", SelectableOption.OptionType.Font)); 8 | this.FontOption = SelectableOptions.Last(); 9 | this.HasFont = true; 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /Ps4-Pkg-Sender/Exceptions/SkipItemException.cs: -------------------------------------------------------------------------------- 1 | using Ps4_Pkg_Sender.Enums; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace Ps4_Pkg_Sender.Exceptions { 9 | public class SkipItemException : Exception { 10 | public TaskType TaskType { get; internal set; } 11 | public SkipItemException(TaskType taskType) { 12 | this.TaskType = taskType; 13 | } 14 | 15 | public SkipItemException(TaskType taskType, string message):base(message){ 16 | this.TaskType = taskType; 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /Ps4-Pkg-Sender/Controls/Theming/Options/ConfigOptions/ButtonOption.cs: -------------------------------------------------------------------------------- 1 | using Ps4_Pkg_Sender.Controls.Theming.Options.ControlSamples; 2 | 3 | namespace Ps4_Pkg_Sender.Controls.Theming.Options.ConfigOptions { 4 | public class ButtonOption : FontedOption { 5 | public ButtonOption() : base("Buttons", new ButtonSample()) { 6 | InsertSelectableItemBeforeEnd(new SelectableOption("FlatAppearance.MouseOverBackColor", "Hover Color", SelectableOption.OptionType.Color)); 7 | InsertSelectableItemBeforeEnd(new SelectableOption("FlatAppearance.MouseDownBackColor", "Click Color", SelectableOption.OptionType.Color)); 8 | } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /Ps4-Pkg-Sender/WinApi/Win32Api.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Runtime.InteropServices; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | using System.Windows.Forms; 8 | 9 | namespace Ps4_Pkg_Sender.WinApi { 10 | public static class Win32Api { 11 | // offset of window style value 12 | public static int GWL_STYLE = -16; 13 | 14 | // window style constants for scrollbars 15 | public static int WS_VSCROLL = 0x00200000; 16 | public static int WS_HSCROLL = 0x00100000; 17 | 18 | [DllImport("user32.dll", SetLastError = true)] 19 | public static extern int GetWindowLong(IntPtr hWnd, int nIndex); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Ps4-Pkg-Sender/Controls/Theming/Options/ConfigOptions/LinkLabelOption.cs: -------------------------------------------------------------------------------- 1 | using Ps4_Pkg_Sender.Controls.Theming.Options.ControlSamples; 2 | 3 | namespace Ps4_Pkg_Sender.Controls.Theming.Options.ConfigOptions { 4 | public class LinkLabelOption : FontedOption { 5 | public LinkLabelOption() : base("Link Labels", new LinkLabelSample()) { 6 | InsertSelectableItemBeforeEnd(new SelectableOption("LinkColor", "Link Color", SelectableOption.OptionType.Color)); 7 | InsertSelectableItemBeforeEnd(new SelectableOption("VisitedLinkColor", "Visited Link Color", SelectableOption.OptionType.Color)); 8 | InsertSelectableItemBeforeEnd(new SelectableOption("ActiveLinkColor", "Active Link Color", SelectableOption.OptionType.Color)); 9 | } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /Ps4-Pkg-Sender/Controls/Theming/Options/ConfigOptions/NumericUpDownOption.cs: -------------------------------------------------------------------------------- 1 | using Ps4_Pkg_Sender.Controls.Theming.Options.ControlSamples; 2 | 3 | namespace Ps4_Pkg_Sender.Controls.Theming.Options.ConfigOptions { 4 | public class NumericUpDownOption : FontedOption { 5 | public NumericUpDownOption() : base("NumericUpDowns", new NumericUpDownSample()) { 6 | InsertSelectableItemBeforeEnd(new SelectableOption("BorderColor", "Border Color", SelectableOption.OptionType.Color)); 7 | InsertSelectableItemBeforeEnd(new SelectableOption("ButtonArrowColor", "Button Arrow Color", SelectableOption.OptionType.Color)); 8 | InsertSelectableItemBeforeEnd(new SelectableOption("ButtonHighlightColor", "Button Highlight Color", SelectableOption.OptionType.Color)); 9 | } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /Ps4-Pkg-Sender/App.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /Ps4-Pkg-Sender/Json/SoundSettings.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json; 2 | using System.IO; 3 | 4 | namespace Ps4_Pkg_Sender.Json { 5 | public class SoundSettings { 6 | 7 | [JsonProperty("PlayQueueFinishSound")] 8 | public bool PlayQueueFinishSound { get; set; } 9 | 10 | [JsonProperty("PlayErrorSound")] 11 | public bool PlaySoundOnError{ get; set; } 12 | 13 | public static void PlayCompleteSound() { 14 | PlaySound(Properties.Resources.Complete); 15 | } 16 | 17 | public static void PlayErrorSound() { 18 | PlaySound(Properties.Resources.Error); 19 | } 20 | 21 | private static void PlaySound(Stream stream) { 22 | using (System.Media.SoundPlayer snd = new System.Media.SoundPlayer(stream)) { 23 | snd.Play(); 24 | } 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /Ps4-Pkg-Sender/Json/AppSettings.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json; 2 | 3 | namespace Ps4_Pkg_Sender.Json { 4 | public class AppSettings { 5 | [JsonProperty("ServerIP")] 6 | public string ServerIP { get; set; } 7 | [JsonProperty("Ps4IP")] 8 | public string Ps4IP { get; set; } 9 | 10 | [JsonProperty("RecursiveSearch")] 11 | public bool RecursiveSearch { get; set; } 12 | 13 | [JsonProperty("SkipInstallCheck")] 14 | public bool SkipInstallCheck { get; set; } 15 | 16 | [JsonProperty("ProgressCheckDelay")] 17 | public int ProgressCheckDelay { get; set; } = 10; 18 | 19 | [JsonProperty("SoundSettings")] 20 | public SoundSettings SoundSettings { get; set; } = new SoundSettings(); 21 | 22 | [JsonIgnore] 23 | public readonly string CustomIPsFile = "ipaddys.txt"; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /Ps4-Pkg-Sender/Ps4/DataTrasmittedProgress.cs: -------------------------------------------------------------------------------- 1 | namespace Ps4_Pkg_Sender.Ps4 { 2 | public class DataTrasmittedProgress { 3 | public DataTrasmittedProgress(long lengthTotal, long transferredTotal, long restSecTotal) { 4 | this.LengthTotal = lengthTotal; 5 | this.TotalTransmitted= transferredTotal; 6 | this.SecondsLeft = restSecTotal; 7 | } 8 | 9 | public long SecondsLeft { get; set; } 10 | public long TotalTransmitted { get; set; } 11 | public long LengthTotal { get; set; } 12 | 13 | public int GetPercentageComplete() { 14 | return (int)((100f / LengthTotal) * TotalTransmitted); 15 | } 16 | 17 | public bool ExceedsTotalLength() { 18 | if(LengthTotal == 0) { 19 | return false; 20 | } 21 | return TotalTransmitted >= LengthTotal; 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Ps4-Pkg-Sender/Controls/Theming/Options/ConfigOptions/ListViewOption.cs: -------------------------------------------------------------------------------- 1 | using Ps4_Pkg_Sender.Controls.Theming.Options.ControlSamples; 2 | using Ps4_Pkg_Sender.Controls.Theming.Options.Interfaces; 3 | using Ps4_Pkg_Sender.UI; 4 | 5 | namespace Ps4_Pkg_Sender.Controls.Theming.Options.ConfigOptions { 6 | public class ListViewOption : FontedOption { 7 | public ListViewOption() : base("ListViews", new ListViewSample()) { 8 | this.SelectableOptions[0].DisplayText = "Font Color"; 9 | InsertSelectableItemBeforeEnd(new SelectableOption(ListViewThemeItem.ColBackColorStr, "Column Back Color", SelectableOption.OptionType.Color)); 10 | InsertSelectableItemBeforeEnd(new SelectableOption(ListViewThemeItem.ColLinesColorStr, "Column Lines Color", SelectableOption.OptionType.Color)); 11 | InsertSelectableItemBeforeEnd(new SelectableOption(ListViewThemeItem.ColFontColorStr, "Column Font Color", SelectableOption.OptionType.Color)); 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /Ps4-Pkg-Sender/Controls/Theming/Options/SelectableOption.cs: -------------------------------------------------------------------------------- 1 | namespace Ps4_Pkg_Sender.Controls.Theming.Options { 2 | public class SelectableOption { 3 | public enum OptionType { 4 | Color, 5 | Font 6 | } 7 | 8 | public OptionType Type { get; private set; } 9 | public string DisplayText { get; set; } 10 | public string PropertyName { get; private set; } 11 | public object Value { get; set; } 12 | 13 | public SelectableOption(string propertyName, string displayText, OptionType optionType) { 14 | this.DisplayText = displayText; 15 | this.PropertyName = propertyName; 16 | this.Type = optionType; 17 | } 18 | 19 | public SelectableOption(string propertyName, OptionType optionType) { 20 | this.DisplayText = propertyName; 21 | this.PropertyName = propertyName; 22 | this.Type = optionType; 23 | } 24 | 25 | 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /Ps4-Pkg-Sender/Controls/Theming/CustomMenuStripRenderer.cs: -------------------------------------------------------------------------------- 1 | using System.Windows.Forms; 2 | 3 | namespace Ps4_Pkg_Sender.Controls.Theming { 4 | public class CustomMenuStripRenderer : ToolStripProfessionalRenderer{ 5 | CustomContextMenu customContextMenu; 6 | 7 | public CustomMenuStripRenderer(CustomContextMenu customContextMenu, ProfessionalColorTable colorTable) : base(colorTable) { 8 | this.customContextMenu = customContextMenu; 9 | } 10 | 11 | protected override void OnRenderArrow(ToolStripArrowRenderEventArgs e) { 12 | if (e.Item.Selected) { 13 | e.ArrowColor = customContextMenu.ArrowFocusColor; 14 | } else { 15 | e.ArrowColor = customContextMenu.ArrowColor; 16 | } 17 | base.OnRenderArrow(e); 18 | } 19 | 20 | protected override void OnRenderToolStripBorder(ToolStripRenderEventArgs e) { 21 | base.OnRenderToolStripBorder(e); 22 | } 23 | 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /Ps4-Pkg-Sender/Controls/Theming/Options/ConfigOptions/ContextMenuOption.cs: -------------------------------------------------------------------------------- 1 | using Ps4_Pkg_Sender.Controls.Theming.Options.ControlSamples; 2 | 3 | namespace Ps4_Pkg_Sender.Controls.Theming.Options.ConfigOptions { 4 | public class ContextMenuOption : FontedOption{ 5 | public ContextMenuOption() : base("ContextMenu",new ContextMenuSample()) { 6 | InsertSelectableItemBeforeEnd(new SelectableOption("FocusColor", "Focus Color", SelectableOption.OptionType.Color)); 7 | InsertSelectableItemBeforeEnd(new SelectableOption("BorderColor", "Border Color", SelectableOption.OptionType.Color)); 8 | InsertSelectableItemBeforeEnd(new SelectableOption("LeftSideBackColor", "Left Side Color", SelectableOption.OptionType.Color)); 9 | InsertSelectableItemBeforeEnd(new SelectableOption("ArrowColor", "Arrow Color", SelectableOption.OptionType.Color)); 10 | InsertSelectableItemBeforeEnd(new SelectableOption("ArrowFocusColor", "Arrow Focus Color", SelectableOption.OptionType.Color)); 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /Ps4-Pkg-Sender/Controls/Theming/Options/ControlSamples/FormSample.cs: -------------------------------------------------------------------------------- 1 | using Ps4_Pkg_Sender.Controls.Theming.Options.Interfaces; 2 | using System; 3 | using System.Drawing; 4 | using System.Windows.Forms; 5 | 6 | namespace Ps4_Pkg_Sender.Controls.Theming.Options.ControlSamples { 7 | public class FormSample : IControlSample, IDisposable { 8 | public Color BackColor { get { return _backColor; } set { _backColor = value; _form.BackColor = value; } } 9 | 10 | private Color _backColor; 11 | private Form _form; 12 | 13 | public FormSample() { 14 | this._form = new Form() { 15 | BackColor = Color.FromArgb(30, 30, 30), 16 | Text = "Example Form", 17 | Dock = DockStyle.Fill, 18 | TopLevel = false, 19 | }; 20 | _form.Show(); 21 | } 22 | 23 | public Control GetSampleControl() { 24 | return _form; 25 | } 26 | 27 | public void Dispose() { 28 | _form?.Dispose(); 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /Ps4-Pkg-Sender/AddServerIpForm.cs: -------------------------------------------------------------------------------- 1 | using Ps4_Pkg_Sender.UI; 2 | using System; 3 | using System.Windows.Forms; 4 | 5 | namespace Ps4_Pkg_Sender { 6 | public partial class AddServerIpForm : Form { 7 | 8 | public string IP { get; internal set; } 9 | public AddServerIpForm() { 10 | InitializeComponent(); 11 | } 12 | 13 | public static bool IsValidIP(string ip) { 14 | return !String.IsNullOrEmpty(ip) && System.Text.RegularExpressions.Regex.IsMatch(ip, @"\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}"); 15 | } 16 | 17 | private void buttonAddIp_Click(object sender, EventArgs e) { 18 | if (IsValidIP(textBoxIP.Text)) { 19 | this.IP = textBoxIP.Text; 20 | this.DialogResult = DialogResult.OK; 21 | } else { 22 | MessageBox.Show(this, "Please enter a valid ip!"); 23 | } 24 | } 25 | 26 | private void AddServerIpForm_Load(object sender, EventArgs e) { 27 | Themer.ApplyTheme(this); 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /Ps4-Pkg-Sender/Utilities/Logger.cs: -------------------------------------------------------------------------------- 1 | namespace Ps4_Pkg_Sender.Utilities { 2 | //A fake, simple logger with no logger levels 3 | //The lazy way 4 | public static class Logger { 5 | 6 | 7 | public enum Type { 8 | StandardOutput, 9 | StandardError, 10 | DebugOutput 11 | } 12 | public static readonly bool DebugOutput = true; 13 | 14 | public static void WriteLine(string message, Type outputType) { 15 | 16 | if (!DebugOutput && outputType != Type.DebugOutput) { 17 | return; 18 | } 19 | 20 | switch (outputType) { 21 | case Type.DebugOutput: 22 | System.Diagnostics.Debug.WriteLine(message); 23 | break; 24 | case Type.StandardOutput: 25 | System.Console.WriteLine(message); 26 | break; 27 | 28 | case Type.StandardError: 29 | System.Console.Error.WriteLine(message); 30 | break; 31 | } 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /Ps4-Pkg-Sender/Properties/Settings.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.42000 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace Ps4_Pkg_Sender.Properties { 12 | 13 | 14 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 15 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] 16 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { 17 | 18 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); 19 | 20 | public static Settings Default { 21 | get { 22 | return defaultInstance; 23 | } 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /Ps4-Pkg-Sender/Controls/Theming/Options/ControlSamples/ContextMenuSample.cs: -------------------------------------------------------------------------------- 1 | using Ps4_Pkg_Sender.Controls.Theming.Options.Interfaces; 2 | using System; 3 | using System.Windows.Forms; 4 | 5 | namespace Ps4_Pkg_Sender.Controls.Theming.Options.ControlSamples { 6 | public class ContextMenuSample : IControlSample, IDisposable { 7 | 8 | 9 | CustomContextMenu contextMenuStrip; 10 | 11 | public ContextMenuSample() { 12 | contextMenuStrip = new CustomContextMenu(); 13 | contextMenuStrip.AutoClose = false; 14 | contextMenuStrip.Items.Add("Queue"); 15 | var parentItem = new ToolStripMenuItem("Parent"); 16 | parentItem.DropDownItems.Add("Child"); 17 | var index = contextMenuStrip.Items.Add(parentItem); 18 | contextMenuStrip.TopLevel = false; 19 | contextMenuStrip.Closing += (s,e) => e.Cancel = true; 20 | contextMenuStrip.Visible = true; 21 | contextMenuStrip.Show(); 22 | } 23 | 24 | 25 | public Control GetSampleControl() { 26 | return contextMenuStrip; 27 | } 28 | 29 | public void Dispose() { 30 | 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /Ps4-Pkg-Sender.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 15 4 | VisualStudioVersion = 15.0.28307.1082 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Ps4-Pkg-Sender", "Ps4-Pkg-Sender\Ps4-Pkg-Sender.csproj", "{51D50794-97EC-462D-9B70-236396D47623}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Any CPU = Debug|Any CPU 11 | Release|Any CPU = Release|Any CPU 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {51D50794-97EC-462D-9B70-236396D47623}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 15 | {51D50794-97EC-462D-9B70-236396D47623}.Debug|Any CPU.Build.0 = Debug|Any CPU 16 | {51D50794-97EC-462D-9B70-236396D47623}.Release|Any CPU.ActiveCfg = Release|Any CPU 17 | {51D50794-97EC-462D-9B70-236396D47623}.Release|Any CPU.Build.0 = Release|Any CPU 18 | EndGlobalSection 19 | GlobalSection(SolutionProperties) = preSolution 20 | HideSolutionNode = FALSE 21 | EndGlobalSection 22 | GlobalSection(ExtensibilityGlobals) = postSolution 23 | SolutionGuid = {184ABA3E-0D71-43FD-BDBC-CA00A56A77D4} 24 | EndGlobalSection 25 | EndGlobal 26 | -------------------------------------------------------------------------------- /Ps4-Pkg-Sender/Json/Ps4Progress.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json; 2 | 3 | namespace Ps4_Pkg_Sender.Json { 4 | public class Ps4Progress { 5 | 6 | [JsonProperty("status")] 7 | public string Status; 8 | 9 | [JsonProperty("bits")] 10 | public int Bits; 11 | 12 | [JsonProperty("error")] 13 | public int Error; 14 | 15 | [JsonProperty("length")] 16 | public long Length; 17 | 18 | [JsonProperty("transferred")] 19 | public long Transferred; 20 | 21 | [JsonProperty("length_total")] 22 | public long LengthTotal; 23 | 24 | [JsonProperty("transferred_total")] 25 | public long TransferredTotal; 26 | 27 | [JsonProperty("num_index")] 28 | public int NumIndex; 29 | 30 | [JsonProperty("num_total")] 31 | public int NumTotal; 32 | 33 | [JsonProperty("rest_sec")] 34 | public long RestSec; 35 | 36 | [JsonProperty("rest_sec_total")] 37 | public long RestSecTotal; 38 | 39 | [JsonProperty("preparing_percent")] 40 | public int PreparingPercent; 41 | 42 | [JsonProperty("local_copy_percent")] 43 | public int LocalCopyPercent; 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /Ps4-Pkg-Sender/Utilities/HttpUtil.cs: -------------------------------------------------------------------------------- 1 | using Ps4_Pkg_Sender.Json; 2 | using System.Net; 3 | 4 | namespace Ps4_Pkg_Sender.Utilities { 5 | public class HttpUtil { 6 | 7 | public static string Get(string url) { 8 | using (WebClient client = new WebClient()) { 9 | client.Encoding = System.Text.Encoding.UTF8; 10 | return client.DownloadString(url); 11 | } 12 | } 13 | 14 | public static string Post(string url, string data) { 15 | using (WebClient client = new WebClient()) { 16 | client.Encoding = System.Text.Encoding.UTF8; 17 | return client.UploadString(url, data); 18 | } 19 | } 20 | 21 | public static string GetInstallJson(string[] pkgs, string ip,int port) { 22 | var json = new Ps4DataPayload(); 23 | var temp = pkgs.Clone() as string[]; 24 | for(int i = 0; i < temp.Length; ++i) { 25 | temp[i] = $"http://{ip}:{port}/{temp[i]}"; 26 | } 27 | json.Packages = temp; 28 | json.Type = "direct"; 29 | return Newtonsoft.Json.JsonConvert.SerializeObject(json); 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /Ps4-Pkg-Sender/Utilities/ProcessUtil.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Diagnostics; 3 | using System.Management; 4 | 5 | namespace Ps4_Pkg_Sender.Utilities { 6 | public class ProcessUtil { 7 | public static void KillProcessAndChildren(int pid) { 8 | // Cannot close 'system idle process'. 9 | if (pid == 0) { 10 | return; 11 | } 12 | 13 | ManagementObjectSearcher searcher = new ManagementObjectSearcher 14 | ("Select * From Win32_Process Where ParentProcessID=" + pid); 15 | ManagementObjectCollection moc = searcher.Get(); 16 | foreach (ManagementObject mo in moc) { 17 | KillProcessAndChildren(Convert.ToInt32(mo["ProcessID"])); 18 | } 19 | try { 20 | Process proc = Process.GetProcessById(pid); 21 | if (!proc.HasExited) { 22 | Console.WriteLine("Trying to kill process: " + proc.Id + ":" + proc.ProcessName); 23 | proc.Kill(); 24 | } 25 | 26 | } catch (ArgumentException) { // Process already exited. 27 | } catch (Exception e) { //Incase anything else happens 28 | } 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /Ps4-Pkg-Sender/UI/ListViewThemeItem.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Drawing; 3 | 4 | namespace Ps4_Pkg_Sender.UI { 5 | public class ListViewThemeItem : ThemeItem { 6 | public const string ColFontColorStr = "ColumnFontColor"; 7 | public const string ColBackColorStr = "ColumnBackColor"; 8 | public const string ColLinesColorStr = "ColumnLinesColor"; 9 | public const string FontStr = "Font"; 10 | public ListViewThemeItem() : base("ListViews", 11 | new KeyValuePair("BackColor", Color.FromArgb(30, 30, 30)), 12 | new KeyValuePair("ForeColor", Color.White)) { 13 | Values.Add(ColFontColorStr, Color.White); 14 | Values.Add(ColBackColorStr, Color.FromArgb(30,30, 30, 30)); 15 | Values.Add(ColLinesColorStr, Color.Gray); 16 | Values.Add(FontStr, new Font("Microsoft Sans Serif",11.25f,FontStyle.Regular)); 17 | } 18 | 19 | public Font Font => Values[FontStr] as Font; 20 | public Color ColumnFontColor => (Color)Values[ColFontColorStr]; 21 | public Color ColumnBackColor => (Color)Values[ColBackColorStr]; 22 | public Color ColumnLinesColor => (Color)Values[ColLinesColorStr]; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Ps4-Pkg-Sender/Utilities/ReflectionUtil.cs: -------------------------------------------------------------------------------- 1 | using System.Linq; 2 | using System.Reflection; 3 | 4 | namespace Ps4_Pkg_Sender.Utilities { 5 | public static class ReflectionUtil { 6 | public static void ChangeVaue(object obj, string propertyName, object newValue) { 7 | if (propertyName.IndexOf('.') != -1) { 8 | var dotSplit = propertyName.Split('.'); 9 | object parentObject = obj; 10 | for (int i = 0; i < dotSplit.Length - 1; i++) { 11 | PropertyInfo propertyInfo = parentObject.GetType().GetProperty(dotSplit[i]); 12 | if (propertyInfo == null) { 13 | return; 14 | } 15 | parentObject = propertyInfo.GetValue(parentObject); 16 | } 17 | 18 | PropertyInfo targetPropertyInfo = parentObject.GetType().GetProperty(dotSplit.Last()); 19 | if (targetPropertyInfo != null) { 20 | targetPropertyInfo.SetValue(parentObject, newValue); 21 | } 22 | } else { 23 | var property = obj.GetType().GetProperty(propertyName); 24 | property.SetValue(obj, newValue); 25 | } 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /Ps4-Pkg-Sender/Controls/Theming/Options/ControlSamples/ProgressbarSample.cs: -------------------------------------------------------------------------------- 1 | using Ps4_Pkg_Sender.Controls.Theming.Options.Interfaces; 2 | using System; 3 | using System.Drawing; 4 | using System.Windows.Forms; 5 | 6 | namespace Ps4_Pkg_Sender.Controls.Theming.Options.ControlSamples { 7 | public class ProgressbarSample : IControlSample, IDisposable { 8 | public Color ForeColor { get { return _foreColor; } set { _foreColor = value; _progrssBar.ForeColor = value; } } 9 | public Color BackColor { get { return _backColor; } set { _backColor = value; _progrssBar.BackColor = value; } } 10 | public Font Font { get { return _font; } set { _font = value; _progrssBar.Font = _font; } } 11 | 12 | CustomProgressBar _progrssBar; 13 | private Color _foreColor; 14 | private Color _backColor; 15 | private Font _font; 16 | public ProgressbarSample() { 17 | _progrssBar = new CustomProgressBar() { 18 | Size = new Size(260, 50), 19 | Value = 50, 20 | ExtraText = "5min 24sec" 21 | }; 22 | } 23 | 24 | public void Dispose() { 25 | _font?.Dispose(); 26 | _progrssBar?.Dispose(); 27 | } 28 | 29 | public Control GetSampleControl() { 30 | return _progrssBar; 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /Ps4-Pkg-Sender/Controls/Theming/Options/ControlSamples/GroupboxSample.cs: -------------------------------------------------------------------------------- 1 | using Ps4_Pkg_Sender.Controls.Theming.Options.Interfaces; 2 | using System; 3 | using System.Drawing; 4 | using System.Windows.Forms; 5 | 6 | namespace Ps4_Pkg_Sender.Controls.Theming.Options.ControlSamples { 7 | public class GroupboxSample : IControlSample, IDisposable { 8 | public Color ForeColor { get { return _foreColor; } set { _foreColor = value; _groupbox.ForeColor = value; } } 9 | public Color BackColor { get { return _backColor; } set { _backColor = value; _groupbox.BackColor = value; } } 10 | public Font Font { get { return _font; } set { _font = value; _groupbox.Font = _font; } } 11 | public string Text { get { return _text; } set { _text = value; _groupbox.Text = _text; } } 12 | 13 | private string _text; 14 | private Color _foreColor; 15 | private Color _backColor; 16 | private Font _font; 17 | private GroupBox _groupbox; 18 | 19 | public GroupboxSample() { 20 | this._groupbox = new GroupBox() { 21 | Text = "GroupBox", 22 | BackColor = Color.White, 23 | ForeColor = Color.Black, 24 | }; 25 | } 26 | 27 | public Control GetSampleControl() { 28 | return _groupbox; 29 | } 30 | 31 | public void Dispose() { 32 | _font?.Dispose(); 33 | _groupbox?.Dispose(); 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /Ps4-Pkg-Sender/Controls/Theming/Options/ControlSamples/LabelSample.cs: -------------------------------------------------------------------------------- 1 | using Ps4_Pkg_Sender.Controls.Theming.Options.Interfaces; 2 | using System; 3 | using System.Drawing; 4 | using System.Windows.Forms; 5 | 6 | namespace Ps4_Pkg_Sender.Controls.Theming.Options.ControlSamples { 7 | public class LabelSample : IControlSample, IDisposable{ 8 | public Color ForeColor { get { return _foreColor; } set { _foreColor = value; _label.ForeColor = value; } } 9 | public Color BackColor { get { return _backColor; } set { _backColor = value; _label.BackColor = value; } } 10 | public Font Font { get { return _font; } set { _font = value; _label.Font = _font; } } 11 | public string Text { get { return _text; } set { _text = value;_label.Text = _text; } } 12 | 13 | private string _text; 14 | private Color _foreColor; 15 | private Color _backColor; 16 | private Font _font; 17 | private Label _label; 18 | public LabelSample() { 19 | this._label = new Label() { 20 | Text = "Sample Message", 21 | TextAlign = ContentAlignment.MiddleCenter, 22 | ForeColor = Color.White, 23 | AutoSize = true 24 | }; 25 | } 26 | 27 | public Control GetSampleControl() { 28 | return _label; 29 | } 30 | 31 | public void Dispose() { 32 | _font?.Dispose(); 33 | _label?.Dispose(); 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /Ps4-Pkg-Sender/Controls/Theming/Options/ControlSamples/CheckboxSample.cs: -------------------------------------------------------------------------------- 1 | using Ps4_Pkg_Sender.Controls.Theming.Options.Interfaces; 2 | using System; 3 | using System.Drawing; 4 | using System.Windows.Forms; 5 | 6 | namespace Ps4_Pkg_Sender.Controls.Theming.Options.ControlSamples { 7 | public class CheckboxSample : IControlSample, IDisposable { 8 | public Color ForeColor { get { return _foreColor; } set { _foreColor = value; _checkBox.ForeColor = value; } } 9 | public Color BackColor { get { return _backColor; } set { _backColor = value; _checkBox.BackColor = value; } } 10 | public Font Font { get { return _font; } set { _font = value; _checkBox.Font = _font; } } 11 | 12 | CheckBox _checkBox; 13 | private Color _foreColor; 14 | private Color _backColor; 15 | private Font _font; 16 | public CheckboxSample() { 17 | _checkBox = new CheckBox() { 18 | Text = "Sample Checkbox", 19 | CheckAlign = ContentAlignment.MiddleLeft, 20 | Checked = true, 21 | FlatStyle = FlatStyle.Flat, 22 | UseVisualStyleBackColor = true, 23 | TextAlign = ContentAlignment.MiddleLeft, 24 | }; 25 | } 26 | 27 | public void Dispose() { 28 | _font?.Dispose(); 29 | _checkBox?.Dispose(); 30 | } 31 | 32 | public Control GetSampleControl() { 33 | return _checkBox; 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /Ps4-Pkg-Sender/Controls/Theming/Options/ControlSamples/NumericUpDownSample.cs: -------------------------------------------------------------------------------- 1 | using Ps4_Pkg_Sender.Controls.Theming.Options.Interfaces; 2 | using System; 3 | using System.Drawing; 4 | using System.Windows.Forms; 5 | 6 | namespace Ps4_Pkg_Sender.Controls.Theming.Options.ControlSamples { 7 | public class NumericUpDownSample : IControlSample, IDisposable { 8 | public Color ForeColor { get { return _foreColor; } set { _foreColor = value; numericUpDown.ForeColor = value; } } 9 | public Color BackColor { get { return _backColor; } set { _backColor = value; numericUpDown.BackColor = value; } } 10 | public Font Font { get { return _font; } set { _font = value; numericUpDown.Font = _font; } } 11 | public string Text { get { return _text; } set { _text = value; numericUpDown.Text = _text; } } 12 | 13 | private string _text; 14 | private Color _foreColor; 15 | private Color _backColor; 16 | private Font _font; 17 | private FlatNumericUpDown numericUpDown; 18 | public NumericUpDownSample() { 19 | this.numericUpDown = new FlatNumericUpDown() { 20 | ForeColor = Color.White, 21 | AutoSize = true, 22 | BorderStyle = BorderStyle.FixedSingle 23 | }; 24 | } 25 | 26 | public Control GetSampleControl() { 27 | return numericUpDown; 28 | } 29 | 30 | public void Dispose() { 31 | _font?.Dispose(); 32 | numericUpDown?.Dispose(); 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /Ps4-Pkg-Sender/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("Ps4-Pkg-Sender")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("Ps4-Pkg-Sender")] 13 | [assembly: AssemblyCopyright("Copyright © 2020 FrostySo")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("F9502445-857C-45ED-AF3C-DC358F2A3FC5")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.8.0")] 37 | -------------------------------------------------------------------------------- /Ps4-Pkg-Sender/UI/ThemeValues.cs: -------------------------------------------------------------------------------- 1 | using System.Drawing; 2 | 3 | namespace Ps4_Pkg_Sender.UI { 4 | public class ThemeValues { 5 | 6 | public ThemeItem BigLabels = new ThemeItem("BigLabels"); 7 | public ThemeItem SmallLabels = new ThemeItem("SmallLabels"); 8 | public ThemeItem Checkboxes = new ThemeItem("Checkboxs"); 9 | public ThemeItem ConnectedLabel = new ThemeItem("ConnectedLabel"); 10 | public ThemeItem DisconnectedLabel = new ThemeItem("DisconnectedLabel"); 11 | 12 | public ThemeItem ProgressBar = new ThemeItem("Progressbars", 13 | new System.Collections.Generic.KeyValuePair("BackColor",Color.Empty), 14 | new System.Collections.Generic.KeyValuePair("ForeColor",Color.Empty), 15 | new System.Collections.Generic.KeyValuePair("SecondsLeftColor",Color.Empty) 16 | ); 17 | 18 | public ThemeItem LinkLabels = new ThemeItem("LinkLabels", 19 | new System.Collections.Generic.KeyValuePair("BackColor", Color.Transparent), 20 | new System.Collections.Generic.KeyValuePair("ForeColor", SystemColors.ButtonHighlight), 21 | new System.Collections.Generic.KeyValuePair("LinkColor", Color.White), 22 | new System.Collections.Generic.KeyValuePair("VisitedLinkColor", SystemColors.ButtonHighlight), 23 | new System.Collections.Generic.KeyValuePair("Font", new Font("Microsoft Sans Serif",9f,FontStyle.Bold)) 24 | ); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /Ps4-Pkg-Sender/Controls/Theming/Options/ControlSamples/TextboxSample.cs: -------------------------------------------------------------------------------- 1 | using Ps4_Pkg_Sender.Controls.Theming.Options.Interfaces; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Drawing; 5 | using System.Linq; 6 | using System.Text; 7 | using System.Threading.Tasks; 8 | using System.Windows.Forms; 9 | 10 | namespace Ps4_Pkg_Sender.Controls.Theming.Options.ControlSamples { 11 | public class TextboxSample : IControlSample, IDisposable { 12 | public Color ForeColor { get { return _foreColor; } set { _foreColor = value; _textbox.ForeColor = value; } } 13 | public Color BackColor { get { return _backColor; } set { _backColor = value; _textbox.BackColor = value; } } 14 | public Font Font { get { return _font; } set { _font = value; _textbox.Font = _font; } } 15 | public string Text { get { return _text; } set { _text = value; _textbox.Text = _text; } } 16 | 17 | private string _text; 18 | private Color _foreColor; 19 | private Color _backColor; 20 | private Font _font; 21 | private TextBox _textbox; 22 | 23 | public TextboxSample() { 24 | this._textbox = new TextBox() { 25 | Text = "127.0.0.1", 26 | TextAlign = HorizontalAlignment.Left, 27 | BackColor = Color.White, 28 | ForeColor = Color.Black, 29 | }; 30 | } 31 | 32 | public Control GetSampleControl() { 33 | return _textbox; 34 | } 35 | 36 | public void Dispose() { 37 | _font?.Dispose(); 38 | _textbox?.Dispose(); 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /Ps4-Pkg-Sender/Controls/Theming/Options/ControlSamples/LinkLabelSample.cs: -------------------------------------------------------------------------------- 1 | using Ps4_Pkg_Sender.Controls.Theming.Options.Interfaces; 2 | using System; 3 | using System.Drawing; 4 | using System.Windows.Forms; 5 | 6 | namespace Ps4_Pkg_Sender.Controls.Theming.Options.ControlSamples { 7 | public class LinkLabelSample : IControlSample, IDisposable { 8 | public Color ForeColor { get { return _foreColor; } set { _foreColor = value; _linkLabel.ForeColor = value; } } 9 | public Color BackColor { get { return _backColor; } set { _backColor = value; _linkLabel.BackColor = value; } } 10 | public Color HoverColor { get { return _linkColor; } set { _linkColor = value; _linkLabel.LinkColor = value; } } 11 | public Color VisitedLinkcolor { get { return _visitedLinkColor; } set { _visitedLinkColor = value; _linkLabel.VisitedLinkColor= value; } } 12 | public Font Font { get { return _font; } set { _font = value; _linkLabel.Font = _font; } } 13 | 14 | LinkLabel _linkLabel; 15 | private Color _foreColor; 16 | private Color _backColor; 17 | private Color _visitedLinkColor; 18 | private Color _linkColor; 19 | private Font _font; 20 | 21 | public LinkLabelSample() { 22 | _linkLabel = new LinkLabel() { 23 | Text = "Sample Label", 24 | FlatStyle = FlatStyle.Flat, 25 | TextAlign = ContentAlignment.MiddleCenter, 26 | Size = new Size(139, 28) 27 | }; 28 | } 29 | 30 | public void Dispose() { 31 | _font?.Dispose(); 32 | _linkLabel?.Dispose(); 33 | } 34 | 35 | public Control GetSampleControl() { 36 | return _linkLabel; 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /Ps4-Pkg-Sender/Services/Service.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading; 6 | using System.Threading.Tasks; 7 | 8 | namespace Ps4_Pkg_Sender.Services { 9 | public abstract class Service { 10 | public abstract string Name { get; } 11 | 12 | protected CancellationTokenSource cancellationToken = new CancellationTokenSource(); 13 | 14 | public bool IsRunning { get; private set; } = false; 15 | 16 | public bool RunSyncThread { get; set; } = true; 17 | 18 | protected int SleepDelay = 1000; 19 | public virtual void StartService() { 20 | 21 | if (RunSyncThread) { 22 | var thread = new Thread(() => { 23 | ServiceThread(); 24 | }); 25 | thread.IsBackground = true; 26 | thread.Start(); 27 | } 28 | 29 | IsRunning = true; 30 | Console.WriteLine($"Starting service: {Name}"); 31 | } 32 | 33 | public virtual void StopService() { 34 | Console.WriteLine($"Stopping service: {Name}"); 35 | IsRunning = false; 36 | cancellationToken.Cancel(); 37 | } 38 | 39 | protected abstract void ServiceAction(); 40 | 41 | public virtual void OnServiceStop() { 42 | 43 | } 44 | 45 | public void ServiceThread() { 46 | while (!cancellationToken.IsCancellationRequested) { 47 | try { 48 | ServiceAction(); 49 | Thread.Sleep(SleepDelay); 50 | } catch (Exception e) { 51 | Console.WriteLine($"{Name} service: {e.StackTrace.ToString()}"); 52 | } 53 | } 54 | } 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /Ps4-Pkg-Sender/Exceptions/RPIErrorThrownException.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace Ps4_Pkg_Sender.Exceptions { 5 | public class RPIErrorThrownException : Exception { 6 | 7 | private static Dictionary ErrorCodesDictionary = new Dictionary(); 8 | 9 | static RPIErrorThrownException() { 10 | ErrorCodesDictionary.Add(0x80990019, Ps4ErrorCode.SCE_BGFT_ERROR_TASK_NOENT); 11 | ErrorCodesDictionary.Add(0x80990004, Ps4ErrorCode.SCE_BGFT_ERROR_INVALID_ARGUMENT); 12 | ErrorCodesDictionary.Add(0x80990015, Ps4ErrorCode.SCE_BGFT_ERROR_TASK_DUPLICATED); 13 | ErrorCodesDictionary.Add(0x80020016, Ps4ErrorCode.SCE_KERNEL_ERROR_EINVAL); 14 | } 15 | 16 | public enum Ps4ErrorCode { 17 | SCE_BGFT_ERROR_TASK_NOENT, 18 | SCE_BGFT_ERROR_INVALID_ARGUMENT, 19 | SCE_BGFT_ERROR_TASK_DUPLICATED, 20 | SCE_KERNEL_ERROR_EINVAL, 21 | UNKNOWN 22 | } 23 | 24 | public long ErrorCode { get; internal set; } 25 | 26 | public Ps4ErrorCode StatusCode { get; internal set; } 27 | 28 | public RPIErrorThrownException(long errorCode) : base(GetMessage(errorCode)) { 29 | this.ErrorCode = errorCode; 30 | this.StatusCode = GetErrorCode(errorCode); 31 | } 32 | 33 | private static string GetMessage(long errorCode) { 34 | try { 35 | return GetErrorCode(errorCode).ToString(); 36 | } catch { 37 | return "unkown error code"; 38 | } 39 | } 40 | 41 | private static Ps4ErrorCode GetErrorCode(long errorCode) { 42 | try { 43 | return ErrorCodesDictionary[errorCode]; 44 | } catch { 45 | return Ps4ErrorCode.UNKNOWN; 46 | } 47 | } 48 | 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /Ps4-Pkg-Sender/Controls/Theming/Options/ControlSamples/ButtonSample.cs: -------------------------------------------------------------------------------- 1 | using Ps4_Pkg_Sender.Controls.Theming.Options.Interfaces; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Drawing; 5 | using System.Linq; 6 | using System.Text; 7 | using System.Threading.Tasks; 8 | using System.Windows.Forms; 9 | 10 | namespace Ps4_Pkg_Sender.Controls.Theming.Options.ControlSamples { 11 | public class ButtonSample : IControlSample, IDisposable { 12 | public Color ForeColor { get { return _foreColor; } set { _foreColor = value; _button.ForeColor = value; } } 13 | public Color BackColor { get { return _backColor; } set { _backColor = value; _button.BackColor = value; } } 14 | public Color HoverColor { get { return _hovercolor; } set { _hovercolor = value; _button.FlatAppearance.MouseOverBackColor = value; } } 15 | public Color ClickColor { get { return _clickColor; } set { _clickColor = value; _button.FlatAppearance.MouseDownBackColor = value; } } 16 | public Font Font { get { return _font; } set { _font = value; _button.Font = _font; } } 17 | 18 | Button _button; 19 | private Color _foreColor; 20 | private Color _backColor; 21 | private Color _clickColor; 22 | private Color _hovercolor; 23 | private Font _font; 24 | public ButtonSample() { 25 | _button = new Button() { 26 | Text = "Sample button", 27 | FlatStyle = FlatStyle.Flat, 28 | UseVisualStyleBackColor = true, 29 | TextAlign = ContentAlignment.MiddleCenter, 30 | Size = new Size(139, 28) 31 | }; 32 | _button.FlatAppearance.BorderSize = 0; 33 | } 34 | 35 | public void Dispose() { 36 | _font?.Dispose(); 37 | _button?.Dispose(); 38 | } 39 | 40 | public Control GetSampleControl() { 41 | return _button; 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /Ps4-Pkg-Sender/Enums/PkgType.cs: -------------------------------------------------------------------------------- 1 | using PS4_Tools; 2 | 3 | namespace Ps4_Pkg_Sender.Enums { 4 | 5 | public enum PkgType { 6 | Unknown, 7 | Game = 6, 8 | Additional_Content = 7, 9 | Patch = 8, 10 | Addon_Theme, 11 | } 12 | 13 | public static class Parser { //Just C# things 14 | 15 | public static PkgType Parse(string name) { 16 | switch (name) { 17 | case "Patch": 18 | return PkgType.Patch; 19 | case "Game": 20 | return PkgType.Game; 21 | case "Addon_Theme": 22 | return PkgType.Addon_Theme; 23 | default: 24 | return PkgType.Unknown; 25 | } 26 | } 27 | 28 | public static string ToDisplayText(this PkgType pkgType) { 29 | var pkgTypeDisplayText = pkgType.ToString(); 30 | switch (pkgType) { 31 | case PkgType.Additional_Content: 32 | pkgTypeDisplayText = "Addon"; 33 | break; 34 | 35 | case PkgType.Addon_Theme: 36 | pkgTypeDisplayText = "Addon Theme"; 37 | break; 38 | } 39 | return pkgTypeDisplayText; 40 | } 41 | 42 | public static PkgType Parse(PKG.SceneRelated.PKGType pKG_Type) { 43 | switch (pKG_Type) { 44 | case PKG.SceneRelated.PKGType.Patch: 45 | return PkgType.Patch; 46 | case PKG.SceneRelated.PKGType.Game: 47 | return PkgType.Game; 48 | case PKG.SceneRelated.PKGType.Addon_Theme: 49 | return PkgType.Additional_Content; 50 | // return PkgType.Addon_Theme; 51 | case PKG.SceneRelated.PKGType.App: 52 | return PkgType.Game; 53 | default: 54 | return PkgType.Unknown; 55 | } 56 | } 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /Ps4-Pkg-Sender/Utilities/TimeFormatUtil.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Ps4_Pkg_Sender.Utilities { 4 | public class TimeFormatUtil { 5 | 6 | private static string FormatDay(double days, bool minimal) { 7 | return FormatTime(days, minimal ? "d" : "day"); 8 | } 9 | 10 | private static string FormatHour(double hours, bool minimal) { 11 | return FormatTime(hours, minimal ? "h" : "hr"); 12 | } 13 | 14 | private static string FormatMinutes(double minutes, bool minimal) { 15 | return FormatTime(minutes, minimal ? "m" : "min"); 16 | } 17 | 18 | private static string FormatSeconds(double seconds, bool minimal) { 19 | return FormatTime(seconds, minimal ? "s" : "sec"); 20 | } 21 | 22 | private static string FormatTime(double x, String nonPlural) { 23 | //Checks whether or not a plural should be added 24 | string str = nonPlural; 25 | if (x > 1) 26 | str += "s"; 27 | 28 | return $"{x} {str} "; 29 | } 30 | 31 | public static String GetCountdownFormat(double timeInSeconds, bool minimalFormat) { 32 | var duration = TimeSpan.FromSeconds(timeInSeconds); 33 | long days = duration.Days; 34 | long hours = duration.Hours; 35 | int minutes = duration.Minutes; 36 | int seconds = duration.Seconds; 37 | String timeString = ""; 38 | if (days > 0) { 39 | timeString += FormatDay(days, minimalFormat); 40 | } 41 | if (hours > 0) { 42 | timeString += FormatHour(hours, minimalFormat); 43 | } 44 | if (minutes > 0) { 45 | timeString += FormatMinutes(minutes, minimalFormat); 46 | } 47 | if (seconds > 0) { 48 | timeString += FormatSeconds(seconds, minimalFormat); 49 | } 50 | return timeString; 51 | } 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /Ps4-Pkg-Sender/Utilities/NodeJSUtil.cs: -------------------------------------------------------------------------------- 1 | using System.Diagnostics; 2 | using System.Linq; 3 | using System.Text.RegularExpressions; 4 | 5 | namespace Ps4_Pkg_Sender.Utilities { 6 | public static class NodeJSUtil { 7 | 8 | public static Process[] GetNodeProcesses() { 9 | return Process.GetProcesses() 10 | .Where(n => n.ProcessName.ToLower().Equals("node")) 11 | .ToArray(); 12 | } 13 | 14 | public static bool IsNodeJsInstalled() { 15 | return ExecuteCMD("npm", "npm "); 16 | } 17 | 18 | public static bool IsHttpServerInstalled() { 19 | return ExecuteCMD("http-server -v", @"^v\d+.\d+.\d+"); 20 | } 21 | 22 | public static bool InstallHttpServer() { 23 | return ExecuteCMD("npm install http-server -g", @"added \d+ packages|\+ http-server"); 24 | } 25 | 26 | public static void KillAllNodeJSInstances() { 27 | GetNodeProcesses().ToList().ForEach(p => { 28 | p.Kill(); 29 | Logger.WriteLine($"Killed node process {p.Id}",Logger.Type.DebugOutput); 30 | }); 31 | } 32 | 33 | private static bool ExecuteCMD(string argument,string expectedOutputRegexPattern, bool strict = false) { 34 | var cmdProcess = new Process(); 35 | cmdProcess.StartInfo.FileName = "cmd.exe"; 36 | cmdProcess.StartInfo.Arguments = $"/C {argument}"; 37 | cmdProcess.StartInfo.UseShellExecute = false; 38 | cmdProcess.StartInfo.CreateNoWindow = true; 39 | cmdProcess.StartInfo.RedirectStandardOutput = true; 40 | cmdProcess.Start(); 41 | cmdProcess.WaitForExit(); 42 | var item = cmdProcess.StandardOutput.ReadToEnd(); 43 | if (item == null) return false; 44 | var regexOptions = RegexOptions.Multiline | RegexOptions.CultureInvariant; 45 | if (!strict) { 46 | regexOptions |= RegexOptions.IgnoreCase; 47 | } 48 | return Regex.IsMatch(item, expectedOutputRegexPattern, regexOptions); 49 | } 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /Ps4-Pkg-Sender/UI/ThemeItem.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json; 2 | using Ps4_Pkg_Sender.Json.Converters; 3 | using System.Collections.Generic; 4 | using System.Drawing; 5 | 6 | namespace Ps4_Pkg_Sender.UI { 7 | public class ThemeItem { 8 | public string Name { get; private set; } 9 | 10 | public class ThemeItempropertyInfo { 11 | 12 | public string DisplayText { get; set; } 13 | public string PropertyName { get; set; } 14 | public Controls.Theming.Options.SelectableOption.OptionType OptionType { get; set; } 15 | 16 | public ThemeItempropertyInfo(string displayText, string propertyName, Controls.Theming.Options.SelectableOption.OptionType optionType) { 17 | this.PropertyName = propertyName; 18 | this.DisplayText = displayText; 19 | this.OptionType = optionType; 20 | } 21 | 22 | public ThemeItempropertyInfo(string propertyName, Controls.Theming.Options.SelectableOption.OptionType optionType) { 23 | this.PropertyName = propertyName; 24 | this.DisplayText = propertyName; 25 | this.OptionType = optionType; 26 | } 27 | } 28 | 29 | [JsonIgnore] 30 | public Color ForeColor => (Color)Values["ForeColor"]; 31 | 32 | [JsonIgnore] 33 | public Color BackColor => (Color)Values["BackColor"]; 34 | 35 | [JsonProperty("Values")] 36 | [JsonConverter(typeof(DictionaryConverter))] 37 | public readonly Dictionary Values = new Dictionary(); 38 | public ThemeItem(string name) { 39 | this.Name = name; 40 | Values.Add($"BackColor",Color.Transparent); 41 | Values.Add($"ForeColor",Color.Empty); 42 | Values.Add($"Font", new Font("Microsoft Sans Serif", 9f, FontStyle.Regular)); 43 | } 44 | 45 | public ThemeItem(string name, params KeyValuePair[] keyValuePairs) { 46 | this.Name = name; 47 | foreach(var kvp in keyValuePairs) { 48 | Values.Add(kvp.Key, kvp.Value); 49 | } 50 | } 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Ps4 Package Sender 2 | 3 | ![The Tool](https://frostyso.github.io/imgs/pkgsender.png) 4 | 5 | This Tool Sends Pkg files to your PS4! 6 | 7 | It can send: 8 | - Games 9 | - Patches 10 | - DLC's 11 | 12 | [Download](https://mega.nz/folder/nItDhAoB#lTtL1qp2SZg1YQBlJdD5-A) 13 | 14 | Feedback is apperciated. You can make an issue about any problems you have or if it works well (so I know). 15 | 16 | ## Requirements 17 | - [.Net Framework 4.6](https://www.microsoft.com/en-nz/download/details.aspx?id=48130) 18 | - [Node.js](https://nodejs.org/) 19 | - Node.js http-server (see below for installation) 20 | 21 | Once Node JS is installed, open up cmd and paste this command in 22 | 23 | `npm install http-server -g` 24 | 25 | ## How to Use 26 | The order of which you import the pkg files does not matter. The program will automatically install in this order 27 | 28 | Games -> Patches -> DLC -> Themes 29 | 30 | It will also automatically combine multi-part patches if the formatting follows the standard sony naming convention. 31 | 32 | Using it is as easy as 33 | ``` 34 | Start the pkg installer on your ps4 35 | Drag and drop your pkg files (or folders) to the GUI. 36 | Pick your server ip 37 | Pick your PS4 IP 38 | Wait for connection status to say connected 39 | Process the queue! 40 | ``` 41 | **Note:** You can enable Recursive Search and drag a bunch of folders in 42 | 43 | ## Basic Features 44 | Recursive Search: If a folder is imported, with this option ticked, all sub-folders will be searched for pkg files. 45 | 46 | Context Menu Options 47 | 48 | - Requeue Item(s) 49 | - Mark As Theme (If you are installing/uninstalling a theme use this to mark it as a theme) 50 | - Mark For Uninstall 51 | - Clear All 52 | 53 | 54 | ### Known problems 55 | Installing themes is bugged for multi-part themes. This is a problem with the package installer itself, not the package sender 56 | 57 | ### Credits 58 | [xXxTheDarkprogramerxXx](https://github.com/xXxTheDarkprogramerxXx) for the [PS4 Tools](https://github.com/xXxTheDarkprogramerxXx/PS4_Tools) library 59 | 60 | [flatz](https://github.com/flatz/) for the [ps4_remote_pkg_installer](https://github.com/flatz/ps4_remote_pkg_installer) api 61 | 62 | ## Contributers 63 | [CodGmer](https://github.com/CodGmer) Fixed nodejs detection to work with the more recent node & npm versions 64 | -------------------------------------------------------------------------------- /Ps4-Pkg-Sender/SettingsForm.cs: -------------------------------------------------------------------------------- 1 | using Ps4_Pkg_Sender.UI; 2 | using System; 3 | using System.Diagnostics; 4 | using System.Drawing; 5 | using System.Windows.Forms; 6 | 7 | namespace Ps4_Pkg_Sender { 8 | public partial class SettingsForm : Form { 9 | MainForm _mainForm; 10 | public SettingsForm(MainForm mainForm) { 11 | this._mainForm = mainForm; 12 | InitializeComponent(); 13 | this.flatNumericUpDownCheckDelay.Value = MainForm.Settings.ProgressCheckDelay; 14 | this.checkBoxFinishedQueueSound.Checked= MainForm.Settings.SoundSettings.PlayQueueFinishSound; 15 | this.checkBoxPlayOnError.Checked= MainForm.Settings.SoundSettings.PlaySoundOnError; 16 | } 17 | 18 | private void SettingsForm_Load(object sender, EventArgs e) { 19 | Themer.ApplyTheme(this); 20 | } 21 | 22 | private void linkLabelThemeOptions_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { 23 | var appearanceOptionsForm = new AppearanceOptionsForm(); 24 | if(appearanceOptionsForm.ShowDialog() == DialogResult.OK) { 25 | Themer.ApplyTheme(appearanceOptionsForm.ThemeSettings,_mainForm); 26 | Themer.ApplyTheme(appearanceOptionsForm.ThemeSettings,this); 27 | Themer.SaveTheme(); 28 | } 29 | } 30 | 31 | private void flatNumericUpDownCheckDelay_ValueChanged(object sender, EventArgs e) { 32 | MainForm.Settings.ProgressCheckDelay = (int)flatNumericUpDownCheckDelay.Value; 33 | } 34 | 35 | private void SettingsForm_FormClosing(object sender, FormClosingEventArgs e) { 36 | MainForm.Settings.SoundSettings.PlaySoundOnError = checkBoxPlayOnError.Checked; 37 | MainForm.Settings.SoundSettings.PlayQueueFinishSound = checkBoxFinishedQueueSound.Checked; 38 | _mainForm.SaveSettings(); 39 | } 40 | 41 | private void button1_MouseEnter(object sender, EventArgs e) { 42 | button1.Cursor = Cursors.Hand; 43 | } 44 | 45 | private void button1_MouseLeave(object sender, EventArgs e) { 46 | button1.Cursor = Cursors.Default; 47 | } 48 | 49 | private void button1_Click(object sender, EventArgs e) { 50 | Process.Start("https://github.com/FrostySo/Ps4-Pkg-Sender"); 51 | } 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /Ps4-Pkg-Sender/Services/FileRenameService.cs: -------------------------------------------------------------------------------- 1 | using Ps4_Pkg_Sender.Models; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.IO; 5 | 6 | namespace Ps4_Pkg_Sender.Services { 7 | public class FileRenameService : Service { 8 | public override string Name => "File renaming service"; 9 | 10 | public Queue FileRenameQueue { get; private set; } = new Queue(); 11 | 12 | public bool HasPendingItems() { 13 | return FileRenameQueue.Count > 0; 14 | } 15 | 16 | protected override void ServiceAction() { 17 | if(HasPendingItems()) { 18 | var renameInfo = FileRenameQueue.Dequeue(); 19 | if(renameInfo != null){ 20 | var pathName = System.IO.Path.GetFileName(renameInfo.CurrentPath); 21 | if(pathName != renameInfo.WantedName) { 22 | try { 23 | File.Move(renameInfo.CurrentPath, $"{Path.GetDirectoryName(renameInfo.CurrentPath)}\\{renameInfo.WantedName}"); 24 | } catch (UnauthorizedAccessException e) { 25 | //handle it, maybe one day >_> 26 | }catch(FileNotFoundException e) { 27 | //for future handles, if needed 28 | } 29 | } 30 | }; 31 | } 32 | } 33 | 34 | public bool Rename(FileRenameInfo renameInfo) { 35 | var pathName = System.IO.Path.GetFileName(renameInfo.CurrentPath); 36 | if (pathName != renameInfo.WantedName) { 37 | try { 38 | var newNamePath = $"{Path.GetDirectoryName(renameInfo.CurrentPath)}\\{renameInfo.WantedName}"; 39 | File.Move(renameInfo.CurrentPath, newNamePath); 40 | //flip them for later 41 | //so we can rename them back to original 42 | var tempWantedName = renameInfo.WantedName; 43 | renameInfo.WantedName = renameInfo.CurrentName; 44 | renameInfo.CurrentName = tempWantedName; 45 | renameInfo.CurrentPath = newNamePath; 46 | return true; 47 | }catch { 48 | return false; 49 | } 50 | } else { 51 | return true; 52 | } 53 | } 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /Ps4-Pkg-Sender/Controls/CustomListView.cs: -------------------------------------------------------------------------------- 1 | using System.Drawing; 2 | using System.Windows.Forms; 3 | 4 | namespace Ps4_Pkg_Sender.Controls { 5 | public class CustomListView : ListView{ 6 | 7 | public CustomListView() { 8 | this.SetStyle(ControlStyles.OptimizedDoubleBuffer, true); 9 | this.OwnerDraw = true; 10 | } 11 | 12 | public Color ColumnLinesColor { get { return _columnLinesColor; } set { _columnLinesColor = value; Invalidate(); Refresh(); } } 13 | public Color ColumnBackColor { get { return _columnBackColor; } set { _columnBackColor = value; Invalidate(); Refresh(); } } 14 | public Color ColumnFontColor { get { return _columnsFontColor; } set { _columnsFontColor = value; Invalidate(); Refresh(); } } 15 | 16 | Color _columnsFontColor= Color.White; 17 | Color _columnLinesColor = Color.Gray; 18 | Color _columnBackColor = Color.FromArgb(30, 30, 30, 30); 19 | 20 | protected override void OnDrawColumnHeader(DrawListViewColumnHeaderEventArgs e) { 21 | Color columnColor = _columnBackColor; 22 | 23 | using (System.Drawing.Drawing2D.LinearGradientBrush GradientBrush = new System.Drawing.Drawing2D.LinearGradientBrush(e.Bounds, columnColor, columnColor, 270)) { 24 | e.Graphics.FillRectangle(GradientBrush, e.Bounds); 25 | } 26 | 27 | Color linesColor = _columnLinesColor; 28 | using (var brush = new SolidBrush(linesColor)) { 29 | using (var pen = new Pen(brush)) { 30 | var offset = -1; 31 | var bounds = e.Bounds; 32 | e.Graphics.DrawLine(pen, bounds.X, bounds.Y + bounds.Height + offset, bounds.X + bounds.Width, bounds.Y + bounds.Height + offset); 33 | e.Graphics.DrawLine(pen, bounds.X, bounds.Y, bounds.X + bounds.Width, bounds.Y); 34 | e.Graphics.DrawLine(pen, bounds.X, bounds.Y, bounds.X, bounds.Y + bounds.Height); 35 | } 36 | } 37 | TextRenderer.DrawText(e.Graphics, e.Header.Text, this.Font, e.Bounds, _columnsFontColor, TextFormatFlags.HorizontalCenter | TextFormatFlags.VerticalCenter | TextFormatFlags.EndEllipsis); 38 | } 39 | 40 | protected override void OnDrawSubItem(DrawListViewSubItemEventArgs e) { 41 | e.DrawDefault = true; 42 | base.OnDrawSubItem(e); 43 | } 44 | 45 | protected override void OnDrawItem(DrawListViewItemEventArgs e) { 46 | e.DrawDefault = true; 47 | base.OnDrawItem(e); 48 | } 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /Ps4-Pkg-Sender/Ps4/PkgInfo.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json; 2 | using Ps4_Pkg_Sender.Enums; 3 | using System.Collections.Generic; 4 | 5 | namespace Ps4_Pkg_Sender.Ps4 { 6 | public class PkgInfo : System.IComparable, IComparer{ 7 | 8 | [JsonProperty("Title")] 9 | public string Title { get; set; } 10 | 11 | [JsonProperty("Type")] 12 | public PkgType Type { get; set; } 13 | 14 | [JsonProperty("TitleID")] 15 | public string TitleID { get; set; } 16 | 17 | [JsonProperty("ContentID")] 18 | public string ContentID { get; set; } 19 | 20 | [JsonProperty("Version")] 21 | public string Version { get; set; } 22 | 23 | [JsonProperty("FilePath")] 24 | public string FilePath { get; set; } 25 | 26 | [JsonProperty("PatchSegments")] 27 | public string[] PatchSegments { get; set; } 28 | 29 | private string NameFromFile(string filePath) { 30 | return System.IO.Path.GetFileName(filePath); 31 | } 32 | 33 | public string[] GetFilePaths() { 34 | var filePathList = new List(); 35 | filePathList.Add(NameFromFile(FilePath)); 36 | if (PatchSegments != null) { 37 | filePathList.AddRange(PatchSegments); 38 | } 39 | return filePathList.ToArray(); 40 | } 41 | 42 | private static readonly SortedList PriorityOrder = new SortedList{ 43 | {PkgType.Game,0}, 44 | {PkgType.Patch,1}, 45 | {PkgType.Additional_Content,2}, 46 | {PkgType.Addon_Theme,3}, 47 | {PkgType.Unknown,4 } 48 | }; 49 | 50 | 51 | public int CompareTo(PkgInfo other) { 52 | return Comparer.Default.Compare(PriorityOrder[this.Type], PriorityOrder[other.Type]); 53 | } 54 | 55 | public int Compare(PkgInfo x, PkgInfo y) { 56 | return Comparer.Default.Compare(PriorityOrder[x.Type], PriorityOrder[y.Type]); 57 | } 58 | 59 | public override int GetHashCode() { 60 | var hashCode = -783403272; 61 | hashCode = hashCode * -1521134295 + EqualityComparer.Default.GetHashCode(Title); 62 | hashCode = hashCode * -1521134295 + Type.GetHashCode(); 63 | hashCode = hashCode * -1521134295 + EqualityComparer.Default.GetHashCode(TitleID); 64 | hashCode = hashCode * -1521134295 + EqualityComparer.Default.GetHashCode(ContentID); 65 | hashCode = hashCode * -1521134295 + EqualityComparer.Default.GetHashCode(Version); 66 | return hashCode; 67 | } 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | ############################################################################### 2 | # Set default behavior to automatically normalize line endings. 3 | ############################################################################### 4 | * text=auto 5 | 6 | ############################################################################### 7 | # Set default behavior for command prompt diff. 8 | # 9 | # This is need for earlier builds of msysgit that does not have it on by 10 | # default for csharp files. 11 | # Note: This is only used by command line 12 | ############################################################################### 13 | #*.cs diff=csharp 14 | 15 | ############################################################################### 16 | # Set the merge driver for project and solution files 17 | # 18 | # Merging from the command prompt will add diff markers to the files if there 19 | # are conflicts (Merging from VS is not affected by the settings below, in VS 20 | # the diff markers are never inserted). Diff markers may cause the following 21 | # file extensions to fail to load in VS. An alternative would be to treat 22 | # these files as binary and thus will always conflict and require user 23 | # intervention with every merge. To do so, just uncomment the entries below 24 | ############################################################################### 25 | #*.sln merge=binary 26 | #*.csproj merge=binary 27 | #*.vbproj merge=binary 28 | #*.vcxproj merge=binary 29 | #*.vcproj merge=binary 30 | #*.dbproj merge=binary 31 | #*.fsproj merge=binary 32 | #*.lsproj merge=binary 33 | #*.wixproj merge=binary 34 | #*.modelproj merge=binary 35 | #*.sqlproj merge=binary 36 | #*.wwaproj merge=binary 37 | 38 | ############################################################################### 39 | # behavior for image files 40 | # 41 | # image files are treated as binary by default. 42 | ############################################################################### 43 | #*.jpg binary 44 | #*.png binary 45 | #*.gif binary 46 | 47 | ############################################################################### 48 | # diff behavior for common document formats 49 | # 50 | # Convert binary document formats to text before diffing them. This feature 51 | # is only available from the command line. Turn it on by uncommenting the 52 | # entries below. 53 | ############################################################################### 54 | #*.doc diff=astextplain 55 | #*.DOC diff=astextplain 56 | #*.docx diff=astextplain 57 | #*.DOCX diff=astextplain 58 | #*.dot diff=astextplain 59 | #*.DOT diff=astextplain 60 | #*.pdf diff=astextplain 61 | #*.PDF diff=astextplain 62 | #*.rtf diff=astextplain 63 | #*.RTF diff=astextplain 64 | -------------------------------------------------------------------------------- /Ps4-Pkg-Sender/QueueItem.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json; 2 | using Ps4_Pkg_Sender.Enums; 3 | using Ps4_Pkg_Sender.Extensions; 4 | using Ps4_Pkg_Sender.Models; 5 | using System.Windows.Forms; 6 | 7 | namespace Ps4_Pkg_Sender { 8 | public class QueueItem : System.IComparable{ 9 | 10 | public ListViewItem ListViewItem { get; } 11 | 12 | public TaskType TaskType { get; set; } 13 | 14 | public Models.FileRenameInfo FileRenameInfo { get; set; } 15 | 16 | public QueueItemInfo Info { get; private set; } = new QueueItemInfo(); 17 | 18 | private ListView _listView; 19 | public QueueItem(ListViewItem listViewItem, ListView listView, Ps4.PkgInfo pkgInfo) { 20 | this.ListViewItem = listViewItem; 21 | this.TaskType = TaskType.Queued; 22 | Info.PkgInfo = pkgInfo; 23 | this._listView = listView; 24 | } 25 | 26 | public QueueItem(ListViewItem listViewItem,Ps4.PkgInfo pkgInfo) { 27 | this.ListViewItem = listViewItem; 28 | this.TaskType = TaskType.Queued; 29 | Info.PkgInfo = pkgInfo; 30 | } 31 | 32 | public QueueItem(ListViewItem listViewItem, ListView listView, QueueItemInfo queueItemInfo) { 33 | this.ListViewItem = listViewItem; 34 | Info = queueItemInfo; 35 | this.TaskType = TaskType.Queued; 36 | this._listView = listView; 37 | } 38 | 39 | public void UpdateType(Enums.PkgType pkgType) { 40 | if(_listView != null) { 41 | UpdateType(pkgType, _listView); 42 | } 43 | } 44 | 45 | public void UpdateType(Enums.PkgType pkgType,ListView listView) { 46 | 47 | listView.InvokeIfRequired(() => ListViewItem.SubItems[2].Text = pkgType.ToDisplayText()); 48 | Info.PkgInfo.Type = pkgType; 49 | } 50 | 51 | public void UpdateTask(TaskType taskType) { 52 | if(_listView != null) { 53 | UpdateTask(taskType, null, _listView); 54 | } 55 | } 56 | 57 | public void UpdateTask(TaskType taskType, ListView listView) { 58 | UpdateTask(taskType, null, listView); 59 | } 60 | 61 | public void UpdateTask(TaskType taskType, string text, ListView listView) { 62 | var str = $"{taskType.ToString()}"; 63 | if (!string.IsNullOrEmpty(text)) { 64 | str += $" - {text}"; 65 | } 66 | listView.InvokeIfRequired(() => ListViewItem.SubItems[3].Text = str); 67 | this.TaskType = taskType; 68 | } 69 | 70 | public int CompareTo(QueueItem other) { 71 | return Info.PkgInfo.CompareTo(other.Info.PkgInfo); 72 | } 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /Ps4-Pkg-Sender/Controls/Theming/Options/ControlSamples/ListViewSample.cs: -------------------------------------------------------------------------------- 1 | using Ps4_Pkg_Sender.Controls.Theming.Options.Interfaces; 2 | using System; 3 | using System.Drawing; 4 | using System.Windows.Forms; 5 | 6 | namespace Ps4_Pkg_Sender.Controls.Theming.Options.ControlSamples { 7 | public class ListViewSample : IControlSample, IDisposable { 8 | public Color ForeColor { get { return _foreColor; } set { _foreColor = value; _listView.ForeColor = value; } } 9 | public Color BackColor { get { return _backColor; } set { _backColor = value; _listView.BackColor = value; } } 10 | public Font Font { get { return _font; } set { _font = value; _listView.Font = _font; } } 11 | 12 | CustomListView _listView; 13 | private Color _foreColor; 14 | private Color _backColor; 15 | private Font _font; 16 | public ListViewSample() { 17 | var s = new UI.ListViewThemeItem(); 18 | 19 | _listView = new CustomListView() { 20 | ColumnBackColor = s.ColumnBackColor, 21 | ForeColor = s.ForeColor, 22 | BackColor = s.BackColor, 23 | ColumnLinesColor = s.ColumnLinesColor, 24 | ColumnFontColor = s.ColumnFontColor, 25 | Dock = DockStyle.Fill, 26 | View = View.Details, 27 | HeaderStyle = ColumnHeaderStyle.Nonclickable, 28 | AllowColumnReorder = false, 29 | FullRowSelect = true, 30 | }; 31 | _listView.ColumnWidthChanging += _listView_ColumnWidthChanging; 32 | 33 | _listView.Columns.Add("Title",145); 34 | _listView.Columns.Add("Status",143); 35 | var item = new ListViewItem("Ratchet and Clank"); 36 | item.SubItems.Add("Queued"); 37 | _listView.Items.AddRange(new ListViewItem[]{ 38 | CreateRow("Ratchet and Clank","Queued"), 39 | CreateRow("God of War","Sending"), 40 | CreateRow("Little Big Planet 3","Sent"), 41 | }); 42 | } 43 | 44 | private ListViewItem CreateRow(string title, string status) { 45 | var item = new ListViewItem(title); 46 | item.SubItems.Add(status); 47 | 48 | return item; 49 | } 50 | 51 | private void _listView_ColumnWidthChanging(object sender, ColumnWidthChangingEventArgs e) { 52 | e.NewWidth = this._listView.Columns[e.ColumnIndex].Width; 53 | e.Cancel = true; 54 | } 55 | 56 | public void Dispose() { 57 | _font?.Dispose(); 58 | _listView?.Dispose(); 59 | } 60 | 61 | public Control GetSampleControl() { 62 | return _listView; 63 | } 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /Ps4-Pkg-Sender/Controls/CustomProgressBar.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | using System.Drawing; 5 | using System.IO; 6 | using System.Linq; 7 | using System.Text; 8 | using System.Threading.Tasks; 9 | using System.Windows.Forms; 10 | 11 | namespace Ps4_Pkg_Sender.Controls { 12 | public class CustomProgressBar : ProgressBar{ 13 | 14 | [Description("The Font of the text")] 15 | public Font Font { 16 | get { return font; } 17 | set { 18 | font = value; 19 | Invalidate(); 20 | } 21 | } 22 | 23 | [Category("ProgressBar")] 24 | [Description("The Font Color of the progress bar text")] 25 | public Color FontColor { 26 | get { return _fontColor; } 27 | set { 28 | _fontColor = value; 29 | Invalidate(); 30 | } 31 | } 32 | 33 | private Color _fontColor = Color.White; 34 | 35 | private Font font = new System.Drawing.Font("Microsoft Sans Serif", 11.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); 36 | 37 | public long SecondsRemaining { get; set; } = 0; 38 | 39 | public string ExtraText { get; set; } = null; 40 | 41 | public CustomProgressBar() { 42 | this.BackColor = Color.Gray; 43 | this.ForeColor = Color.FromArgb(223, 116, 12); 44 | this.SetStyle(ControlStyles.UserPaint, true); 45 | this.SetStyle(ControlStyles.OptimizedDoubleBuffer, true); 46 | } 47 | 48 | public void ResetProgressBar() { 49 | this.Value = 0; 50 | this.SecondsRemaining = 0; 51 | } 52 | 53 | protected override void OnPaint(PaintEventArgs e) { 54 | Rectangle rec = e.ClipRectangle; 55 | 56 | rec.Width = (int)(rec.Width * ((double)Value / Maximum)) - 4; 57 | if (ProgressBarRenderer.IsSupported) 58 | ProgressBarRenderer.DrawHorizontalBar(e.Graphics, e.ClipRectangle); 59 | Rectangle rect = new Rectangle(new Point(0, 0), new Size(Maximum, rec.Height)); 60 | 61 | using (var backColorBrush = new SolidBrush(BackColor)) { 62 | e.Graphics.FillRectangle(backColorBrush, 0, 0, Width, rect.Height); 63 | } 64 | 65 | using (var foreColoreBrush = new SolidBrush(ForeColor)) { 66 | e.Graphics.FillRectangle(foreColoreBrush, 0, 0, rec.Width, rec.Height); 67 | } 68 | 69 | StringFormat sf = new StringFormat(); 70 | sf.LineAlignment = StringAlignment.Center; 71 | sf.Alignment = StringAlignment.Center; 72 | String estimatedTime = SecondsRemaining > 0 ? $"- Time left: {Utilities.TimeFormatUtil.GetCountdownFormat(SecondsRemaining,false)}" : ""; 73 | if (ExtraText != null) { 74 | estimatedTime += ExtraText; 75 | } 76 | 77 | using (var fontColorBrush = new SolidBrush(_fontColor)) { 78 | e.Graphics.DrawString($"{this.Value}% {estimatedTime}", this.font, fontColorBrush, this.Width / 2, this.Height / 2, sf); 79 | } 80 | } 81 | } 82 | } 83 | -------------------------------------------------------------------------------- /Ps4-Pkg-Sender/Controls/Theming/Options/ConfigOptions/EditableOption.cs: -------------------------------------------------------------------------------- 1 | using Ps4_Pkg_Sender.Controls.Theming.Options.Interfaces; 2 | using Ps4_Pkg_Sender.UI; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Drawing; 6 | using System.Windows.Forms; 7 | 8 | namespace Ps4_Pkg_Sender.Controls.Theming.Options { 9 | public class EditableOption : IDisposable { 10 | 11 | //Had a change of mind so this was the easier way :( 12 | public bool HasFont { get; protected set; } 13 | public SelectableOption FontOption { get; protected set; } 14 | 15 | public string DisplayText { get; protected set; } 16 | public IControlSample ControlSample { get; private set; } 17 | public IReadOnlyList AllSelectableOptions => SelectableOptions; 18 | 19 | protected List SelectableOptions = new List(); 20 | 21 | public ThemeItem ThemeItem { get; set; } 22 | 23 | public EditableOption(string displayText, IControlSample controlSample){ 24 | this.DisplayText = displayText; 25 | this.ControlSample = controlSample; 26 | SelectableOptions.AddRange(new SelectableOption[] { 27 | new SelectableOption("ForeColor","Fore Color",SelectableOption.OptionType.Color), 28 | new SelectableOption("BackColor","Back Color", SelectableOption.OptionType.Color), 29 | }); 30 | } 31 | 32 | public EditableOption(string displayText, IControlSample controlSample, params SelectableOption[] selectableOptions) { 33 | this.DisplayText = displayText; 34 | this.ControlSample = controlSample; 35 | this.SelectableOptions.AddRange(selectableOptions); 36 | } 37 | 38 | protected void InsertSelectableItemBeforeEnd(SelectableOption selectableOption) { 39 | this.SelectableOptions.Insert(SelectableOptions.Count - 1, selectableOption); 40 | } 41 | 42 | public void UpdateControlSample(Size panelSize) { 43 | var control = ControlSample.GetSampleControl(); 44 | if(control != null) { 45 | foreach(var option in SelectableOptions) { 46 | if (option.Value == null) continue; 47 | Utilities.ReflectionUtil.ChangeVaue(control, option.PropertyName, option.Value); 48 | } 49 | } 50 | CenterControl(control,panelSize); 51 | } 52 | 53 | 54 | private void CenterControl(Control control,Size panelSize) { 55 | control.Location = new Point( 56 | panelSize.Width / 2 - control.Width / 2, 57 | panelSize.Height / 2 - control.Height / 2 58 | ); 59 | } 60 | 61 | public void LoadSetting() { 62 | if (ThemeItem == null) return; 63 | foreach (var selectableOption in SelectableOptions) { 64 | if (ThemeItem.Values.ContainsKey(selectableOption.PropertyName)) { 65 | selectableOption.Value = ThemeItem.Values[selectableOption.PropertyName]; 66 | } 67 | } 68 | } 69 | 70 | public void SaveSetting() { 71 | if (ThemeItem == null) return; 72 | foreach (var selectableOption in SelectableOptions) { 73 | if (ThemeItem.Values.ContainsKey(selectableOption.PropertyName)) { 74 | ThemeItem.Values[selectableOption.PropertyName] = selectableOption.Value; 75 | } 76 | } 77 | } 78 | 79 | 80 | 81 | public void Dispose() { 82 | ControlSample.Dispose(); 83 | } 84 | } 85 | } 86 | -------------------------------------------------------------------------------- /Ps4-Pkg-Sender/Properties/Resources.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.42000 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace Ps4_Pkg_Sender.Properties { 12 | using System; 13 | 14 | 15 | /// 16 | /// A strongly-typed resource class, for looking up localized strings, etc. 17 | /// 18 | // This class was auto-generated by the StronglyTypedResourceBuilder 19 | // class via a tool like ResGen or Visual Studio. 20 | // To add or remove a member, edit your .ResX file then rerun ResGen 21 | // with the /str option, or rebuild your VS project. 22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")] 23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 25 | internal class Resources { 26 | 27 | private static global::System.Resources.ResourceManager resourceMan; 28 | 29 | private static global::System.Globalization.CultureInfo resourceCulture; 30 | 31 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] 32 | internal Resources() { 33 | } 34 | 35 | /// 36 | /// Returns the cached ResourceManager instance used by this class. 37 | /// 38 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 39 | internal static global::System.Resources.ResourceManager ResourceManager { 40 | get { 41 | if (object.ReferenceEquals(resourceMan, null)) { 42 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Ps4_Pkg_Sender.Properties.Resources", typeof(Resources).Assembly); 43 | resourceMan = temp; 44 | } 45 | return resourceMan; 46 | } 47 | } 48 | 49 | /// 50 | /// Overrides the current thread's CurrentUICulture property for all 51 | /// resource lookups using this strongly typed resource class. 52 | /// 53 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 54 | internal static global::System.Globalization.CultureInfo Culture { 55 | get { 56 | return resourceCulture; 57 | } 58 | set { 59 | resourceCulture = value; 60 | } 61 | } 62 | 63 | /// 64 | /// Looks up a localized resource of type System.IO.UnmanagedMemoryStream similar to System.IO.MemoryStream. 65 | /// 66 | internal static System.IO.UnmanagedMemoryStream Complete { 67 | get { 68 | return ResourceManager.GetStream("Complete", resourceCulture); 69 | } 70 | } 71 | 72 | /// 73 | /// Looks up a localized resource of type System.IO.UnmanagedMemoryStream similar to System.IO.MemoryStream. 74 | /// 75 | internal static System.IO.UnmanagedMemoryStream Error { 76 | get { 77 | return ResourceManager.GetStream("Error", resourceCulture); 78 | } 79 | } 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /Ps4-Pkg-Sender/AddServerIpForm.Designer.cs: -------------------------------------------------------------------------------- 1 | namespace Ps4_Pkg_Sender { 2 | partial class AddServerIpForm { 3 | /// 4 | /// Required designer variable. 5 | /// 6 | private System.ComponentModel.IContainer components = null; 7 | 8 | /// 9 | /// Clean up any resources being used. 10 | /// 11 | /// true if managed resources should be disposed; otherwise, false. 12 | protected override void Dispose(bool disposing) { 13 | if (disposing && (components != null)) { 14 | components.Dispose(); 15 | } 16 | base.Dispose(disposing); 17 | } 18 | 19 | #region Windows Form Designer generated code 20 | 21 | /// 22 | /// Required method for Designer support - do not modify 23 | /// the contents of this method with the code editor. 24 | /// 25 | private void InitializeComponent() { 26 | this.textBoxIP = new System.Windows.Forms.TextBox(); 27 | this.label1 = new System.Windows.Forms.Label(); 28 | this.buttonAddIp = new System.Windows.Forms.Button(); 29 | this.SuspendLayout(); 30 | // 31 | // textBoxIP 32 | // 33 | this.textBoxIP.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 34 | | System.Windows.Forms.AnchorStyles.Right))); 35 | this.textBoxIP.Location = new System.Drawing.Point(106, 24); 36 | this.textBoxIP.Name = "textBoxIP"; 37 | this.textBoxIP.Size = new System.Drawing.Size(318, 20); 38 | this.textBoxIP.TabIndex = 0; 39 | // 40 | // label1 41 | // 42 | this.label1.AutoSize = true; 43 | this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); 44 | this.label1.ForeColor = System.Drawing.Color.White; 45 | this.label1.Location = new System.Drawing.Point(12, 23); 46 | this.label1.Name = "label1"; 47 | this.label1.Size = new System.Drawing.Size(88, 20); 48 | this.label1.TabIndex = 4; 49 | this.label1.Tag = "Big"; 50 | this.label1.Text = "Server IP:"; 51 | // 52 | // buttonAddIp 53 | // 54 | this.buttonAddIp.Anchor = System.Windows.Forms.AnchorStyles.None; 55 | this.buttonAddIp.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(223)))), ((int)(((byte)(116)))), ((int)(((byte)(12))))); 56 | this.buttonAddIp.BackgroundImageLayout = System.Windows.Forms.ImageLayout.None; 57 | this.buttonAddIp.FlatAppearance.BorderSize = 0; 58 | this.buttonAddIp.FlatStyle = System.Windows.Forms.FlatStyle.Flat; 59 | this.buttonAddIp.ForeColor = System.Drawing.Color.White; 60 | this.buttonAddIp.Location = new System.Drawing.Point(174, 51); 61 | this.buttonAddIp.Name = "buttonAddIp"; 62 | this.buttonAddIp.Size = new System.Drawing.Size(95, 25); 63 | this.buttonAddIp.TabIndex = 5; 64 | this.buttonAddIp.Text = "Add"; 65 | this.buttonAddIp.UseVisualStyleBackColor = false; 66 | this.buttonAddIp.Click += new System.EventHandler(this.buttonAddIp_Click); 67 | // 68 | // AddServerIpForm 69 | // 70 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 71 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 72 | this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(30)))), ((int)(((byte)(30)))), ((int)(((byte)(30))))); 73 | this.ClientSize = new System.Drawing.Size(436, 79); 74 | this.Controls.Add(this.buttonAddIp); 75 | this.Controls.Add(this.label1); 76 | this.Controls.Add(this.textBoxIP); 77 | this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow; 78 | this.Name = "AddServerIpForm"; 79 | this.Text = "AddServerIpForm"; 80 | this.Load += new System.EventHandler(this.AddServerIpForm_Load); 81 | this.ResumeLayout(false); 82 | this.PerformLayout(); 83 | 84 | } 85 | 86 | #endregion 87 | private System.Windows.Forms.Label label1; 88 | private System.Windows.Forms.Button buttonAddIp; 89 | private System.Windows.Forms.TextBox textBoxIP; 90 | } 91 | } -------------------------------------------------------------------------------- /Ps4-Pkg-Sender/UI/Themer.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json; 2 | using Ps4_Pkg_Sender.Controls; 3 | using Ps4_Pkg_Sender.Json; 4 | using System; 5 | using System.Collections.Generic; 6 | using System.IO; 7 | using System.Linq; 8 | using System.Reflection; 9 | using System.Windows.Forms; 10 | 11 | namespace Ps4_Pkg_Sender.UI { 12 | public class Themer { 13 | 14 | const string ThemeFile = "themesettings.json"; 15 | public static ThemeSettings ThemeSettings = new ThemeSettings(); 16 | 17 | public static void LoadTheme() { 18 | if (File.Exists(ThemeFile)) { 19 | try { 20 | ThemeSettings = JsonConvert.DeserializeObject(File.ReadAllText(ThemeFile)); 21 | } catch { 22 | 23 | } 24 | } 25 | } 26 | 27 | public static bool SaveTheme() { 28 | try { 29 | File.WriteAllText(ThemeFile,JsonConvert.SerializeObject(ThemeSettings, Formatting.Indented)); 30 | return true; 31 | } catch { 32 | 33 | } 34 | return false; 35 | } 36 | 37 | 38 | public static void ApplyTheme(ThemeSettings themeSettings,Form form) { 39 | form.SuspendLayout(); 40 | ApplyThemeToLabel(form,themeSettings.BigLabels,"Big"); 41 | ApplyThemeToLabel(form, themeSettings.SmallLabels, "Small"); 42 | ApplyThemeToLabel(form, themeSettings.ConnectedLabel, "cLabel"); 43 | ApplyThemeTo(form, themeSettings.Checkboxes); 44 | ApplyThemeTo(form, themeSettings.ProgressBar); 45 | ApplyThemeTo