diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..1ff0c42 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,63 @@ +############################################################################### +# Set default behavior to automatically normalize line endings. +############################################################################### +* text=auto + +############################################################################### +# Set default behavior for command prompt diff. +# +# This is need for earlier builds of msysgit that does not have it on by +# default for csharp files. +# Note: This is only used by command line +############################################################################### +#*.cs diff=csharp + +############################################################################### +# Set the merge driver for project and solution files +# +# Merging from the command prompt will add diff markers to the files if there +# are conflicts (Merging from VS is not affected by the settings below, in VS +# the diff markers are never inserted). Diff markers may cause the following +# file extensions to fail to load in VS. An alternative would be to treat +# these files as binary and thus will always conflict and require user +# intervention with every merge. To do so, just uncomment the entries below +############################################################################### +#*.sln merge=binary +#*.csproj merge=binary +#*.vbproj merge=binary +#*.vcxproj merge=binary +#*.vcproj merge=binary +#*.dbproj merge=binary +#*.fsproj merge=binary +#*.lsproj merge=binary +#*.wixproj merge=binary +#*.modelproj merge=binary +#*.sqlproj merge=binary +#*.wwaproj merge=binary + +############################################################################### +# behavior for image files +# +# image files are treated as binary by default. +############################################################################### +#*.jpg binary +#*.png binary +#*.gif binary + +############################################################################### +# diff behavior for common document formats +# +# Convert binary document formats to text before diffing them. This feature +# is only available from the command line. Turn it on by uncommenting the +# entries below. +############################################################################### +#*.doc diff=astextplain +#*.DOC diff=astextplain +#*.docx diff=astextplain +#*.DOCX diff=astextplain +#*.dot diff=astextplain +#*.DOT diff=astextplain +#*.pdf diff=astextplain +#*.PDF diff=astextplain +#*.rtf diff=astextplain +#*.RTF diff=astextplain diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..5cb02e8 --- /dev/null +++ b/.gitignore @@ -0,0 +1,347 @@ +.vscode/* +!.vscode/settings.json +!.vscode/tasks.json +!.vscode/launch.json +!.vscode/extensions.json + +## Ignore Visual Studio temporary files, build results, and +## files generated by popular Visual Studio add-ons. +## +## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore + +# User-specific files +*.rsuser +*.suo +*.user +*.userosscache +*.sln.docstates + +# User-specific files (MonoDevelop/Xamarin Studio) +*.userprefs + +# Build results +[Dd]ebug/ +[Dd]ebugPublic/ +[Rr]elease/ +[Rr]eleases/ +x64/ +x86/ +[Aa][Rr][Mm]/ +[Aa][Rr][Mm]64/ +bld/ +[Bb]in/ +[Oo]bj/ +[Ll]og/ + +# Visual Studio 2015/2017 cache/options directory +.vs/ +# Uncomment if you have tasks that create the project's static files in wwwroot +#wwwroot/ + +# Visual Studio 2017 auto generated files +Generated\ Files/ + +# MSTest test Results +[Tt]est[Rr]esult*/ +[Bb]uild[Ll]og.* + +# NUNIT +*.VisualState.xml +TestResult.xml + +# Build Results of an ATL Project +[Dd]ebugPS/ +[Rr]eleasePS/ +dlldata.c + +# Benchmark Results +BenchmarkDotNet.Artifacts/ + +# .NET Core +project.lock.json +project.fragment.lock.json +artifacts/ + +# StyleCop +StyleCopReport.xml + +# Files built by Visual Studio +*_i.c +*_p.c +*_h.h +*.ilk +*.meta +*.obj +*.iobj +*.pch +*.pdb +*.ipdb +*.pgc +*.pgd +*.rsp +*.sbr +*.tlb +*.tli +*.tlh +*.tmp +*.tmp_proj +*_wpftmp.csproj +*.log +*.vspscc +*.vssscc +.builds +*.pidb +*.svclog +*.scc + +# Chutzpah Test files +_Chutzpah* + +# Visual C++ cache files +ipch/ +*.aps +*.ncb +*.opendb +*.opensdf +*.sdf +*.cachefile +*.VC.db +*.VC.VC.opendb + +# Visual Studio profiler +*.psess +*.vsp +*.vspx +*.sap + +# Visual Studio Trace Files +*.e2e + +# TFS 2012 Local Workspace +$tf/ + +# Guidance Automation Toolkit +*.gpState + +# ReSharper is a .NET coding add-in +_ReSharper*/ +*.[Rr]e[Ss]harper +*.DotSettings.user + +# JustCode is a .NET coding add-in +.JustCode + +# TeamCity is a build add-in +_TeamCity* + +# DotCover is a Code Coverage Tool +*.dotCover + +# AxoCover is a Code Coverage Tool +.axoCover/* +!.axoCover/settings.json + +# Visual Studio code coverage results +*.coverage +*.coveragexml + +# NCrunch +_NCrunch_* +.*crunch*.local.xml +nCrunchTemp_* + +# MightyMoose +*.mm.* +AutoTest.Net/ + +# Web workbench (sass) +.sass-cache/ + +# Installshield output folder +[Ee]xpress/ + +# DocProject is a documentation generator add-in +DocProject/buildhelp/ +DocProject/Help/*.HxT +DocProject/Help/*.HxC +DocProject/Help/*.hhc +DocProject/Help/*.hhk +DocProject/Help/*.hhp +DocProject/Help/Html2 +DocProject/Help/html + +# Click-Once directory +publish/ + +# Publish Web Output +*.[Pp]ublish.xml +*.azurePubxml +# Note: Comment the next line if you want to checkin your web deploy settings, +# but database connection strings (with potential passwords) will be unencrypted +*.pubxml +*.publishproj + +# Microsoft Azure Web App publish settings. Comment the next line if you want to +# checkin your Azure Web App publish settings, but sensitive information contained +# in these scripts will be unencrypted +PublishScripts/ + +# NuGet Packages +*.nupkg +# The packages folder can be ignored because of Package Restore +**/[Pp]ackages/* +# except build/, which is used as an MSBuild target. +!**/[Pp]ackages/build/ +# Uncomment if necessary however generally it will be regenerated when needed +#!**/[Pp]ackages/repositories.config +# NuGet v3's project.json files produces more ignorable files +*.nuget.props +*.nuget.targets + +# Microsoft Azure Build Output +csx/ +*.build.csdef + +# Microsoft Azure Emulator +ecf/ +rcf/ + +# Windows Store app package directories and files +AppPackages/ +BundleArtifacts/ +Package.StoreAssociation.xml +_pkginfo.txt +*.appx + +# Visual Studio cache files +# files ending in .cache can be ignored +*.[Cc]ache +# but keep track of directories ending in .cache +!?*.[Cc]ache/ + +# Others +ClientBin/ +~$* +*~ +*.dbmdl +*.dbproj.schemaview +*.jfm +*.pfx +*.publishsettings +orleans.codegen.cs + +# Including strong name files can present a security risk +# (https://github.com/github/gitignore/pull/2483#issue-259490424) +#*.snk + +# Since there are multiple workflows, uncomment next line to ignore bower_components +# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) +#bower_components/ +# ASP.NET Core default setup: bower directory is configured as wwwroot/lib/ and bower restore is true +**/wwwroot/lib/ + +# RIA/Silverlight projects +Generated_Code/ + +# Backup & report files from converting an old project file +# to a newer Visual Studio version. Backup files are not needed, +# because we have git ;-) +_UpgradeReport_Files/ +Backup*/ +UpgradeLog*.XML +UpgradeLog*.htm +ServiceFabricBackup/ +*.rptproj.bak + +# SQL Server files +*.mdf +*.ldf +*.ndf + +# Business Intelligence projects +*.rdl.data +*.bim.layout +*.bim_*.settings +*.rptproj.rsuser + +# Microsoft Fakes +FakesAssemblies/ + +# GhostDoc plugin setting file +*.GhostDoc.xml + +# Node.js Tools for Visual Studio +.ntvs_analysis.dat +node_modules/ + +# Visual Studio 6 build log +*.plg + +# Visual Studio 6 workspace options file +*.opt + +# Visual Studio 6 auto-generated workspace file (contains which files were open etc.) +*.vbw + +# Visual Studio LightSwitch build output +**/*.HTMLClient/GeneratedArtifacts +**/*.DesktopClient/GeneratedArtifacts +**/*.DesktopClient/ModelManifest.xml +**/*.Server/GeneratedArtifacts +**/*.Server/ModelManifest.xml +_Pvt_Extensions + +# Paket dependency manager +.paket/paket.exe +paket-files/ + +# FAKE - F# Make +.fake/ + +# JetBrains Rider +.idea/ +*.sln.iml + +# CodeRush personal settings +.cr/personal + +# Python Tools for Visual Studio (PTVS) +__pycache__/ +*.pyc + +# Cake - Uncomment if you are using it +# tools/** +# !tools/packages.config + +# Tabs Studio +*.tss + +# Telerik's JustMock configuration file +*.jmconfig + +# BizTalk build output +*.btp.cs +*.btm.cs +*.odx.cs +*.xsd.cs + +# OpenCover UI analysis results +OpenCover/ + +# Azure Stream Analytics local run output +ASALocalRun/ + +# MSBuild Binary and Structured Log +*.binlog + +# NVidia Nsight GPU debugger configuration file +*.nvuser + +# MFractors (Xamarin productivity tool) working folder +.mfractor/ + +# Local History for Visual Studio +.localhistory/ + +# BeatPulse healthcheck temp database +healthchecksdb diff --git a/ClaimIt.sln b/ClaimIt.sln new file mode 100644 index 0000000..a0cd452 --- /dev/null +++ b/ClaimIt.sln @@ -0,0 +1,33 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.28307.271 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ClaimIt", "Windows\ClaimIt\ClaimIt.csproj", "{EA7183C8-6767-42C2-8083-02BA9FD43C99}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{3CBACAE4-6D6C-4624-9861-AFAD1B2A43DE}" + ProjectSection(SolutionItems) = preProject + .gitattributes = .gitattributes + .gitignore = .gitignore + linux\claimpms.sh = linux\claimpms.sh + LICENSE = LICENSE + EndProjectSection +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {EA7183C8-6767-42C2-8083-02BA9FD43C99}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {EA7183C8-6767-42C2-8083-02BA9FD43C99}.Debug|Any CPU.Build.0 = Debug|Any CPU + {EA7183C8-6767-42C2-8083-02BA9FD43C99}.Release|Any CPU.ActiveCfg = Release|Any CPU + {EA7183C8-6767-42C2-8083-02BA9FD43C99}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {EAD016C1-3C37-41CC-B4BE-E2C392E33637} + EndGlobalSection +EndGlobal diff --git a/Windows/ClaimIt/ClaimIt.csproj b/Windows/ClaimIt/ClaimIt.csproj new file mode 100644 index 0000000..4c39e6f --- /dev/null +++ b/Windows/ClaimIt/ClaimIt.csproj @@ -0,0 +1,120 @@ + + + + + Debug + AnyCPU + {EA7183C8-6767-42C2-8083-02BA9FD43C99} + WinExe + ClaimIt + ClaimIt + v4.5 + 512 + true + false + + publish\ + true + Disk + false + Foreground + 7 + Days + false + false + true + 1 + 1.0.0.%2a + false + true + true + + + AnyCPU + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + false + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + false + + + 69883B134EDA276A0355AD8725C803A49B787A2C + + + ClaimIt_TemporaryKey.pfx + + + true + + + true + + + + + + + + + + + + + + + + + Form + + + Form1.cs + + + + + Form1.cs + + + ResXFileCodeGenerator + Resources.Designer.cs + Designer + + + True + Resources.resx + True + + + + + SettingsSingleFileGenerator + Settings.Designer.cs + + + True + Settings.settings + True + + + + + False + .NET Framework 3.5 SP1 + false + + + + \ No newline at end of file diff --git a/Windows/ClaimIt/Form1.Designer.cs b/Windows/ClaimIt/Form1.Designer.cs new file mode 100644 index 0000000..14a28e6 --- /dev/null +++ b/Windows/ClaimIt/Form1.Designer.cs @@ -0,0 +1,278 @@ +namespace ClaimIt +{ + partial class Form1 + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.lbAbout = new System.Windows.Forms.ListBox(); + this.llSourceCode = new System.Windows.Forms.LinkLabel(); + this.llLicense = new System.Windows.Forms.LinkLabel(); + this.llDownload = new System.Windows.Forms.LinkLabel(); + this.panel1 = new System.Windows.Forms.Panel(); + this.LWStatus = new System.Windows.Forms.ListView(); + this.columnHeader1 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); + this.mtbIPAddress = new System.Windows.Forms.MaskedTextBox(); + this.lblStatus = new System.Windows.Forms.Label(); + this.btnClaimIt = new System.Windows.Forms.Button(); + this.lblPMSIP = new System.Windows.Forms.Label(); + this.tbPlexTvPassword2 = new System.Windows.Forms.TextBox(); + this.lblPlexTVPassword2 = new System.Windows.Forms.Label(); + this.tbPlexTvPassword = new System.Windows.Forms.TextBox(); + this.tbPlexTVName = new System.Windows.Forms.TextBox(); + this.lblPlexTVPassword = new System.Windows.Forms.Label(); + this.lblPlexTvLoginName = new System.Windows.Forms.Label(); + this.panel1.SuspendLayout(); + this.SuspendLayout(); + // + // lbAbout + // + this.lbAbout.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.lbAbout.FormattingEnabled = true; + this.lbAbout.ItemHeight = 16; + this.lbAbout.Items.AddRange(new object[] { + "Welcome to ClaimIt", + "This will hopefully assist you in Claiming a Plex Media Server, in case the offic" + + "ial methods doesn\'t work", + " ", + "Note that this is a free utillity, so if you paid for it, you where scammed!", + "If this utillity was NOT dowloaded from the GitHub link below, then please abort " + + "this, and then downlowd from the link below!", + " ", + "This Utillity will ask you for your plex.tv credentials, which might a concern fo" + + "r a you, but we need it to authenticate towards plex.tv", + " ", + "If you wants to check out the sourcecode, then please review the sourcecode at th" + + "e link provided below", + " ", + "Claimit was made by:", + "* dane22, a Plex community member\n", + "* Mark Walker/ZiGGiMoN, a Plex hobbyist"}); + this.lbAbout.Location = new System.Drawing.Point(12, 12); + this.lbAbout.Name = "lbAbout"; + this.lbAbout.Size = new System.Drawing.Size(982, 132); + this.lbAbout.TabIndex = 1; + this.lbAbout.TabStop = false; + // + // llSourceCode + // + this.llSourceCode.AutoSize = true; + this.llSourceCode.Location = new System.Drawing.Point(12, 150); + this.llSourceCode.Name = "llSourceCode"; + this.llSourceCode.Size = new System.Drawing.Size(86, 17); + this.llSourceCode.TabIndex = 2; + this.llSourceCode.TabStop = true; + this.llSourceCode.Text = "SourceCode"; + this.llSourceCode.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.LlSourceCode_LinkClicked); + // + // llLicense + // + this.llLicense.AutoSize = true; + this.llLicense.Location = new System.Drawing.Point(104, 150); + this.llLicense.Name = "llLicense"; + this.llLicense.Size = new System.Drawing.Size(57, 17); + this.llLicense.TabIndex = 3; + this.llLicense.TabStop = true; + this.llLicense.Text = "License"; + this.llLicense.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.LlLicense_LinkClicked); + // + // llDownload + // + this.llDownload.AutoSize = true; + this.llDownload.Location = new System.Drawing.Point(167, 150); + this.llDownload.Name = "llDownload"; + this.llDownload.Size = new System.Drawing.Size(70, 17); + this.llDownload.TabIndex = 4; + this.llDownload.TabStop = true; + this.llDownload.Text = "Download"; + this.llDownload.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.LlDownload_LinkClicked); + // + // panel1 + // + this.panel1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.panel1.Controls.Add(this.LWStatus); + this.panel1.Controls.Add(this.mtbIPAddress); + this.panel1.Controls.Add(this.lblStatus); + this.panel1.Controls.Add(this.btnClaimIt); + this.panel1.Controls.Add(this.lblPMSIP); + this.panel1.Controls.Add(this.tbPlexTvPassword2); + this.panel1.Controls.Add(this.lblPlexTVPassword2); + this.panel1.Controls.Add(this.tbPlexTvPassword); + this.panel1.Controls.Add(this.tbPlexTVName); + this.panel1.Controls.Add(this.lblPlexTVPassword); + this.panel1.Controls.Add(this.lblPlexTvLoginName); + this.panel1.Location = new System.Drawing.Point(15, 188); + this.panel1.Name = "panel1"; + this.panel1.Size = new System.Drawing.Size(979, 351); + this.panel1.TabIndex = 5; + // + // LWStatus + // + this.LWStatus.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { + this.columnHeader1}); + this.LWStatus.LabelWrap = false; + this.LWStatus.Location = new System.Drawing.Point(398, 46); + this.LWStatus.Name = "LWStatus"; + this.LWStatus.Size = new System.Drawing.Size(547, 244); + this.LWStatus.TabIndex = 12; + this.LWStatus.TabStop = false; + this.LWStatus.UseCompatibleStateImageBehavior = false; + this.LWStatus.View = System.Windows.Forms.View.Details; + // + // columnHeader1 + // + this.columnHeader1.Text = ""; + this.columnHeader1.Width = 900; + // + // mtbIPAddress + // + this.mtbIPAddress.Location = new System.Drawing.Point(21, 268); + this.mtbIPAddress.Mask = "###.###.###.###"; + this.mtbIPAddress.Name = "mtbIPAddress"; + this.mtbIPAddress.Size = new System.Drawing.Size(113, 22); + this.mtbIPAddress.TabIndex = 4; + // + // lblStatus + // + this.lblStatus.AutoSize = true; + this.lblStatus.Location = new System.Drawing.Point(395, 17); + this.lblStatus.Name = "lblStatus"; + this.lblStatus.Size = new System.Drawing.Size(52, 17); + this.lblStatus.TabIndex = 10; + this.lblStatus.Text = "Status:"; + // + // btnClaimIt + // + this.btnClaimIt.Location = new System.Drawing.Point(21, 311); + this.btnClaimIt.Name = "btnClaimIt"; + this.btnClaimIt.Size = new System.Drawing.Size(75, 23); + this.btnClaimIt.TabIndex = 5; + this.btnClaimIt.Text = "&ClaimIt"; + this.btnClaimIt.UseVisualStyleBackColor = true; + this.btnClaimIt.Click += new System.EventHandler(this.BtnClaimIt_Click); + // + // lblPMSIP + // + this.lblPMSIP.AutoSize = true; + this.lblPMSIP.Location = new System.Drawing.Point(18, 228); + this.lblPMSIP.Name = "lblPMSIP"; + this.lblPMSIP.Size = new System.Drawing.Size(246, 17); + this.lblPMSIP.TabIndex = 6; + this.lblPMSIP.Text = "IP Address of your Plex Media Server:"; + // + // tbPlexTvPassword2 + // + this.tbPlexTvPassword2.Location = new System.Drawing.Point(21, 185); + this.tbPlexTvPassword2.Name = "tbPlexTvPassword2"; + this.tbPlexTvPassword2.PasswordChar = '*'; + this.tbPlexTvPassword2.Size = new System.Drawing.Size(306, 22); + this.tbPlexTvPassword2.TabIndex = 3; + // + // lblPlexTVPassword2 + // + this.lblPlexTVPassword2.AutoSize = true; + this.lblPlexTVPassword2.Location = new System.Drawing.Point(18, 150); + this.lblPlexTVPassword2.Name = "lblPlexTVPassword2"; + this.lblPlexTVPassword2.Size = new System.Drawing.Size(177, 17); + this.lblPlexTVPassword2.TabIndex = 4; + this.lblPlexTVPassword2.Text = "plex.tv password repeated:"; + // + // tbPlexTvPassword + // + this.tbPlexTvPassword.Location = new System.Drawing.Point(21, 116); + this.tbPlexTvPassword.Name = "tbPlexTvPassword"; + this.tbPlexTvPassword.PasswordChar = '*'; + this.tbPlexTvPassword.Size = new System.Drawing.Size(306, 22); + this.tbPlexTvPassword.TabIndex = 2; + // + // tbPlexTVName + // + this.tbPlexTVName.Location = new System.Drawing.Point(21, 46); + this.tbPlexTVName.Name = "tbPlexTVName"; + this.tbPlexTVName.Size = new System.Drawing.Size(306, 22); + this.tbPlexTVName.TabIndex = 1; + // + // lblPlexTVPassword + // + this.lblPlexTVPassword.AutoSize = true; + this.lblPlexTVPassword.Location = new System.Drawing.Point(18, 83); + this.lblPlexTVPassword.Name = "lblPlexTVPassword"; + this.lblPlexTVPassword.Size = new System.Drawing.Size(116, 17); + this.lblPlexTVPassword.TabIndex = 1; + this.lblPlexTVPassword.Text = "plex.tv password:"; + // + // lblPlexTvLoginName + // + this.lblPlexTvLoginName.AutoSize = true; + this.lblPlexTvLoginName.Location = new System.Drawing.Point(18, 17); + this.lblPlexTvLoginName.Name = "lblPlexTvLoginName"; + this.lblPlexTvLoginName.Size = new System.Drawing.Size(125, 17); + this.lblPlexTvLoginName.TabIndex = 0; + this.lblPlexTvLoginName.Text = "plex.tv login name:"; + // + // Form1 + // + this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(1006, 555); + this.Controls.Add(this.panel1); + this.Controls.Add(this.llDownload); + this.Controls.Add(this.llLicense); + this.Controls.Add(this.llSourceCode); + this.Controls.Add(this.lbAbout); + this.Name = "Form1"; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; + this.Text = "Form1"; + this.Load += new System.EventHandler(this.Form1_Load); + this.panel1.ResumeLayout(false); + this.panel1.PerformLayout(); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + private System.Windows.Forms.ListBox lbAbout; + private System.Windows.Forms.LinkLabel llSourceCode; + private System.Windows.Forms.LinkLabel llLicense; + private System.Windows.Forms.LinkLabel llDownload; + private System.Windows.Forms.Panel panel1; + private System.Windows.Forms.TextBox tbPlexTvPassword; + private System.Windows.Forms.TextBox tbPlexTVName; + private System.Windows.Forms.Label lblPlexTVPassword; + private System.Windows.Forms.Label lblPlexTvLoginName; + private System.Windows.Forms.TextBox tbPlexTvPassword2; + private System.Windows.Forms.Label lblPlexTVPassword2; + private System.Windows.Forms.Button btnClaimIt; + private System.Windows.Forms.Label lblPMSIP; + private System.Windows.Forms.Label lblStatus; + private System.Windows.Forms.MaskedTextBox mtbIPAddress; + private System.Windows.Forms.ListView LWStatus; + private System.Windows.Forms.ColumnHeader columnHeader1; + } +} \ No newline at end of file diff --git a/Windows/ClaimIt/Form1.cs b/Windows/ClaimIt/Form1.cs new file mode 100644 index 0000000..0aa797c --- /dev/null +++ b/Windows/ClaimIt/Form1.cs @@ -0,0 +1,326 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Windows.Forms; + +using System.Net; +using System.Xml; + + + +namespace ClaimIt +{ + public partial class Form1 : Form + { + + #region Parameters + + private string PMSID { get; set; } + private string PMSUsr { get; set; } + private string PMSPwd { get; set; } + private string PMSUsrToken { get; set; } + private string PMSClaimItToken { get; set; } + private string PMSIPAddr { get; set; } + + #endregion + + public Form1() + { + InitializeComponent(); + // Hide column headers + LWStatus.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.None; + } + + private void LlSourceCode_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) + { + try + { + VisitClaimIt(); + } + catch (Exception) + { + UpdateStatus("Unable to open link to Github: https://github.com/ukdtom/ClaimIt ", Color.Red); + } + } + + private void VisitClaimIt() + { + // Change the color of the link text by setting LinkVisited + // to true. + llSourceCode.LinkVisited = true; + //Call the Process.Start method to open the default browser + //with a URL: + System.Diagnostics.Process.Start("https://github.com/ukdtom/ClaimIt"); + } + + private void VisitLicense() + { + // Change the color of the link text by setting LinkVisited + // to true. + llLicense.LinkVisited = true; + //Call the Process.Start method to open the default browser + //with a URL: + System.Diagnostics.Process.Start("https://github.com/ukdtom/ClaimIt/blob/master/LICENSE"); + } + + private void VisitDownload() + { + // Change the color of the link text by setting LinkVisited + // to true. + llDownload.LinkVisited = true; + //Call the Process.Start method to open the default browser + //with a URL: + System.Diagnostics.Process.Start("https://github.com/ukdtom/ClaimIt/releases/latest"); + } + + private void Form1_Load(object sender, EventArgs e) + { + this.Text = Application.ProductName + " Version: " + Application.ProductVersion; + this.mtbIPAddress.ValidatingType = typeof(System.Net.IPAddress); + UpdateStatus("Idle...", Color.Gray); + } + + private void LlLicense_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) + { + try + { + VisitLicense(); + } + catch (Exception) + { + UpdateStatus("Unable to open link to Github: https://github.com/ukdtom/ClaimIt/blob/master/LICENSE ", Color.Red); + } + } + + private void LlDownload_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) + { + try + { + VisitDownload(); + } + catch (Exception) + { + UpdateStatus("Unable to open link to Github: https://github.com/ukdtom/ClaimIt/releases/latest", Color.Red); + } + } + + private Boolean ComparePwd() + { + UpdateStatus("Checking entered passwords match", Color.Gray); + if (this.tbPlexTvPassword.Text == this.tbPlexTvPassword2.Text) + { + UpdateStatus("Password checked...OK", Color.Green); + PMSPwd = this.tbPlexTvPassword.Text; + return true; + } + else + { + UpdateStatus("Password checked...ERROR...Passwords entered didn't match", Color.Red); + return false; + } + } + + private ListViewItem LWItem( string ItemText, System.Drawing.Color Color) + { + ListViewItem LWItemEntry = new ListViewItem + { + Text = ItemText, + ForeColor = Color + }; + return LWItemEntry; + } + + private void FatalError() + { + UpdateStatus("FATAL ERROR.....Job Aborted", Color.Red); + } + + private Boolean GetPMSIdentifier() + { + try + { + UpdateStatus("Fetching Identifier from PMS", Color.Gray); + string url = "http://" + PMSIPAddr + ":32400/identity"; + HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url); + HttpWebResponse response = (HttpWebResponse)request.GetResponse(); + if ((int)response.StatusCode == 200) + { + XmlDocument xmlDoc = new XmlDocument(); + xmlDoc.Load(response.GetResponseStream()); + PMSID = xmlDoc.DocumentElement.GetAttribute("machineIdentifier"); + UpdateStatus("Got PMS Identifier as: " + PMSID, Color.Green); + return true; + } + else + { + UpdateStatus("PROBLEM: Getting PMS Identifier.....Job Aborted", Color.Red); + UpdateStatus("http status was: " + response.StatusCode.ToString(), Color.Red); + return false; + } + } + catch (Exception ex) + { + UpdateStatus("PROBLEM: Getting PMS Identifier.....Job Aborted", Color.Red); + UpdateStatus("Error was: " + ex.Message, Color.Red); + return false; + } + } + + private Boolean GetUserToken() + { + try + { + string url = string.Format("https://plex.tv/api/v2/users/signin?login={0}&password={1}&X-Plex-Client-Identifier=ClaimIt-{2}", PMSUsr, PMSPwd, PMSID); + HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url); + request.Method = "POST"; + HttpWebResponse response = (HttpWebResponse)request.GetResponse(); + if ((int)response.StatusCode < 300) + { + XmlDocument xmlDoc = new XmlDocument(); + xmlDoc.Load(response.GetResponseStream()); + PMSUsrToken = xmlDoc.DocumentElement.GetAttribute("authToken"); + UpdateStatus("Got plex.tv User Token as: ", Color.Green); + return true; + } + else + { + UpdateStatus("PROBLEM: getting plex.tv Authentication Token.....Job Aborted", Color.Red); + UpdateStatus("http status was: " + response.StatusCode.ToString(), Color.Red); + return false; + } + } + catch (Exception ex) + { + UpdateStatus("PROBLEM: getting plex.tv Authentication Token.....Job Aborted", Color.Red); + UpdateStatus("Error was: " + ex.Message, Color.Red); + return false; + } + } + + private Boolean GetClaimToken() + { + try + { + string url = string.Format("https://plex.tv/api/claim/token?X-Plex-Token={0}&X-Plex-Client-Identifier=ClaimIt-{1}", PMSUsrToken, PMSID); + HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url); + HttpWebResponse response = (HttpWebResponse)request.GetResponse(); + if ((int)response.StatusCode == 200) + { + XmlDocument xmlDoc = new XmlDocument(); + xmlDoc.Load(response.GetResponseStream()); + PMSClaimItToken = xmlDoc.DocumentElement.GetAttribute("token"); + UpdateStatus("Got Claim Token as: " + PMSClaimItToken, Color.Green); + return true; + } + else + { + UpdateStatus("PROBLEM: getting plex.tv Claim Token.....Job Aborted", Color.Red); + UpdateStatus("http status was: " + response.StatusCode.ToString(), Color.Red); + return false; + } + } + catch (Exception ex) + { + UpdateStatus("PROBLEM: Getting PMS Claim Token.....Job Aborted", Color.Red); + UpdateStatus("Error was: " + ex.Message, Color.Red); + return false; + } + } + + private Boolean ClaimIt() + { + try + { + string url = string.Format("http://{0}:32400/myplex/claim?token={1}&X-Plex-Client-Identifier=ClaimIt-{2}&X-Plex-Token={3}", PMSIPAddr, PMSClaimItToken, PMSID, PMSUsrToken); + + HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url); + request.Method = "POST"; + HttpWebResponse response = (HttpWebResponse)request.GetResponse(); + if ((int)response.StatusCode == 200) + { + return true; + } + else + { + UpdateStatus("PROBLEM: Can't claim PMS.....Job Aborted", Color.Red); + UpdateStatus("http status was: " + response.StatusCode.ToString(), Color.Red); + return false; + } + } + catch (Exception ex) + { + UpdateStatus("PROBLEM: Can't Claim PMS.....Job Aborted", Color.Red); + UpdateStatus("Error was: " + ex.Message, Color.Red); + UpdateStatus("If status code is 401, then most likely the PMS was already claimed, and belongs to somebody else!", Color.Red); + UpdateStatus("If this really is your server, then see: https://support.plex.tv/articles/204281528-why-am-i-locked-out-of-server-settings-and-how-do-i-get-in/", Color.Red); + return false; + } + } + + private void UpdateStatus(string status, Color color) + { + // Add item with correct color + this.LWStatus.Items.Add(LWItem(status, color)); + // Make sure it's visible + LWStatus.Items[LWStatus.Items.Count - 1].EnsureVisible(); + } + + private void BtnClaimIt_Click(object sender, EventArgs e) + { + Cursor.Current = Cursors.WaitCursor; + PMSUsr = this.tbPlexTVName.Text; + PMSPwd = this.tbPlexTvPassword.Text; + PMSIPAddr = mtbIPAddress.Text.Replace(" ", ""); + // Get IP of PC running this + IPAddress[] localIPs = Dns.GetHostAddresses(Dns.GetHostName()); + foreach (var IP in localIPs) + { + this.LWStatus.Items.Add(LWItem("This app is running on IP: " + IP.ToString(), Color.Gray)); + } + UpdateStatus("PMS IP: " + PMSIPAddr, Color.Gray); + UpdateStatus("Starting to work...", Color.Gray); + if (ComparePwd()) + { + if (GetPMSIdentifier()) + { + if (GetUserToken()) + { + if (GetClaimToken()) + { + if (ClaimIt()) + { + UpdateStatus("All Done", Color.Green); + UpdateStatus(string.Format("Please close your browser, reopen, and browse to http://{0}:32400/web", PMSIPAddr), Color.Green); + } + else + { + FatalError(); + } + } + else + { + FatalError(); + } + } + else + { + FatalError(); + } + } + else + { + FatalError(); + } + } + else + { + FatalError(); + } + Cursor.Current = Cursors.Default; + } + } +} diff --git a/Windows/ClaimIt/Form1.resx b/Windows/ClaimIt/Form1.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/Windows/ClaimIt/Form1.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/Windows/ClaimIt/Program.cs b/Windows/ClaimIt/Program.cs new file mode 100644 index 0000000..69450ba --- /dev/null +++ b/Windows/ClaimIt/Program.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Windows.Forms; + +namespace ClaimIt +{ + static class Program + { + /// + /// The main entry point for the application. + /// + [STAThread] + static void Main() + { + Application.EnableVisualStyles(); + Application.SetCompatibleTextRenderingDefault(false); + Application.Run(new Form1()); + } + } +} diff --git a/Windows/ClaimIt/Properties/AssemblyInfo.cs b/Windows/ClaimIt/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..c747e0f --- /dev/null +++ b/Windows/ClaimIt/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("ClaimIt")] +[assembly: AssemblyDescription("Will Claim a Plex Media Server")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("Community, Created by dane22, a Plex Community Member")] +[assembly: AssemblyProduct("ClaimIt")] +[assembly: AssemblyCopyright("https://github.com/ukdtom/ClaimIt/blob/master/LICENSE")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("ea7183c8-6767-42c2-8083-02ba9fd43c99")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Windows/ClaimIt/Properties/Resources.Designer.cs b/Windows/ClaimIt/Properties/Resources.Designer.cs new file mode 100644 index 0000000..a950657 --- /dev/null +++ b/Windows/ClaimIt/Properties/Resources.Designer.cs @@ -0,0 +1,63 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace ClaimIt.Properties { + using System; + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resources { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("ClaimIt.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + } +} diff --git a/Windows/ClaimIt/Properties/Resources.resx b/Windows/ClaimIt/Properties/Resources.resx new file mode 100644 index 0000000..af7dbeb --- /dev/null +++ b/Windows/ClaimIt/Properties/Resources.resx @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/Windows/ClaimIt/Properties/Settings.Designer.cs b/Windows/ClaimIt/Properties/Settings.Designer.cs new file mode 100644 index 0000000..929afd5 --- /dev/null +++ b/Windows/ClaimIt/Properties/Settings.Designer.cs @@ -0,0 +1,26 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace ClaimIt.Properties { + + + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.9.0.0")] + internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { + + private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); + + public static Settings Default { + get { + return defaultInstance; + } + } + } +} diff --git a/Windows/ClaimIt/Properties/Settings.settings b/Windows/ClaimIt/Properties/Settings.settings new file mode 100644 index 0000000..3964565 --- /dev/null +++ b/Windows/ClaimIt/Properties/Settings.settings @@ -0,0 +1,7 @@ + + + + + + + diff --git a/Windows/ClaimIt/app.config b/Windows/ClaimIt/app.config new file mode 100644 index 0000000..51278a4 --- /dev/null +++ b/Windows/ClaimIt/app.config @@ -0,0 +1,3 @@ + + + diff --git a/linux/claimpms.sh b/linux/claimpms.sh index 6ac0d66..1c28a17 100644 --- a/linux/claimpms.sh +++ b/linux/claimpms.sh @@ -7,6 +7,7 @@ # * IP Address of your unclaimed Plex Media Server # # Made by dane22, a Plex community member +# Mark Walker/ZiGGiMoN, a Plex hobbyist #************************************************************************ #************************************************************************ @@ -154,6 +155,7 @@ echo "* * IP Address of your unclaimed Plex Media Server" echo "*" echo "*" echo "* Made by dane22, a Plex community member" +echo "* And Mark Walker/ZiGGiMoN, a Plex hobbyist" echo "************************************************************************"