Initial commit
This commit is contained in:
63
.gitattributes
vendored
Normal file
63
.gitattributes
vendored
Normal file
@@ -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
|
||||
363
.gitignore
vendored
Normal file
363
.gitignore
vendored
Normal file
@@ -0,0 +1,363 @@
|
||||
## 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
|
||||
|
||||
# Mono auto generated files
|
||||
mono_crash.*
|
||||
|
||||
# Build results
|
||||
[Dd]ebug/
|
||||
[Dd]ebugPublic/
|
||||
[Rr]elease/
|
||||
[Rr]eleases/
|
||||
x64/
|
||||
x86/
|
||||
[Ww][Ii][Nn]32/
|
||||
[Aa][Rr][Mm]/
|
||||
[Aa][Rr][Mm]64/
|
||||
bld/
|
||||
[Bb]in/
|
||||
[Oo]bj/
|
||||
[Oo]ut/
|
||||
[Ll]og/
|
||||
[Ll]ogs/
|
||||
|
||||
# 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
|
||||
nunit-*.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/
|
||||
|
||||
# ASP.NET Scaffolding
|
||||
ScaffoldingReadMe.txt
|
||||
|
||||
# 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
|
||||
|
||||
# TeamCity is a build add-in
|
||||
_TeamCity*
|
||||
|
||||
# DotCover is a Code Coverage Tool
|
||||
*.dotCover
|
||||
|
||||
# AxoCover is a Code Coverage Tool
|
||||
.axoCover/*
|
||||
!.axoCover/settings.json
|
||||
|
||||
# Coverlet is a free, cross platform Code Coverage Tool
|
||||
coverage*.json
|
||||
coverage*.xml
|
||||
coverage*.info
|
||||
|
||||
# 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
|
||||
# NuGet Symbol Packages
|
||||
*.snupkg
|
||||
# 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
|
||||
*.appxbundle
|
||||
*.appxupload
|
||||
|
||||
# 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/
|
||||
|
||||
# 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
|
||||
*- [Bb]ackup.rdl
|
||||
*- [Bb]ackup ([0-9]).rdl
|
||||
*- [Bb]ackup ([0-9][0-9]).rdl
|
||||
|
||||
# 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/
|
||||
|
||||
# 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
|
||||
|
||||
# Backup folder for Package Reference Convert tool in Visual Studio 2017
|
||||
MigrationBackup/
|
||||
|
||||
# Ionide (cross platform F# VS Code tools) working folder
|
||||
.ionide/
|
||||
|
||||
# Fody - auto-generated XML schema
|
||||
FodyWeavers.xsd
|
||||
22
Shackle.sln
Normal file
22
Shackle.sln
Normal file
@@ -0,0 +1,22 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 17
|
||||
VisualStudioVersion = 17.12.35506.116 d17.12
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Shackle", "Shackle\Shackle.csproj", "{77DD112B-641D-4774-92EC-824564601F8B}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{77DD112B-641D-4774-92EC-824564601F8B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{77DD112B-641D-4774-92EC-824564601F8B}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{77DD112B-641D-4774-92EC-824564601F8B}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{77DD112B-641D-4774-92EC-824564601F8B}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
BIN
Shackle/8p5oo8p5oo8p5oo.ico
Normal file
BIN
Shackle/8p5oo8p5oo8p5oo.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 960 KiB |
155
Shackle/DynamicDescriptor.cs
Normal file
155
Shackle/DynamicDescriptor.cs
Normal file
@@ -0,0 +1,155 @@
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace UnshackleGUI
|
||||
{
|
||||
/// <summary>
|
||||
/// This is the object assigned to PropertyGrid.SelectedObject
|
||||
/// It correctly implements ICustomTypeDescriptor.
|
||||
/// </summary>
|
||||
public class DynamicObject : ICustomTypeDescriptor
|
||||
{
|
||||
private readonly Dictionary<string, object> _values;
|
||||
private readonly List<UnshackleParameter> _defs;
|
||||
|
||||
public DynamicObject(Dictionary<string, object> values, List<UnshackleParameter> defs)
|
||||
{
|
||||
_values = values;
|
||||
_defs = defs;
|
||||
}
|
||||
|
||||
public PropertyDescriptorCollection GetProperties()
|
||||
{
|
||||
return new DynamicCustomTypeDescriptor(_values, _defs).GetProperties();
|
||||
}
|
||||
|
||||
public PropertyDescriptorCollection GetProperties(Attribute[] attributes)
|
||||
{
|
||||
return GetProperties();
|
||||
}
|
||||
|
||||
public object GetPropertyOwner(PropertyDescriptor pd) => this;
|
||||
|
||||
public AttributeCollection GetAttributes() => AttributeCollection.Empty;
|
||||
public string GetClassName() => nameof(DynamicObject);
|
||||
public string GetComponentName() => null;
|
||||
public TypeConverter GetConverter() => null;
|
||||
public EventDescriptor GetDefaultEvent() => null;
|
||||
public PropertyDescriptor GetDefaultProperty() => null;
|
||||
public object GetEditor(Type editorBaseType) => null;
|
||||
public EventDescriptorCollection GetEvents() => EventDescriptorCollection.Empty;
|
||||
public EventDescriptorCollection GetEvents(Attribute[] attributes) => EventDescriptorCollection.Empty;
|
||||
}
|
||||
|
||||
internal class DynamicCustomTypeDescriptor : CustomTypeDescriptor
|
||||
{
|
||||
private readonly Dictionary<string, object> _values;
|
||||
private readonly List<UnshackleParameter> _defs;
|
||||
private PropertyDescriptorCollection _cache;
|
||||
|
||||
public DynamicCustomTypeDescriptor(Dictionary<string, object> values, List<UnshackleParameter> defs)
|
||||
{
|
||||
_values = values;
|
||||
_defs = defs;
|
||||
}
|
||||
|
||||
public override PropertyDescriptorCollection GetProperties()
|
||||
{
|
||||
return GetProperties(null);
|
||||
}
|
||||
|
||||
public override PropertyDescriptorCollection GetProperties(Attribute[] attributes)
|
||||
{
|
||||
if (_cache == null)
|
||||
{
|
||||
var props = new List<PropertyDescriptor>();
|
||||
|
||||
foreach (var def in _defs)
|
||||
{
|
||||
props.Add(new DynamicPropertyDescriptor(def, _values));
|
||||
}
|
||||
|
||||
_cache = new PropertyDescriptorCollection(props.ToArray());
|
||||
}
|
||||
|
||||
return _cache;
|
||||
}
|
||||
}
|
||||
|
||||
internal class DynamicPropertyDescriptor : PropertyDescriptor
|
||||
{
|
||||
private readonly UnshackleParameter _parameter;
|
||||
private readonly Dictionary<string, object> _values;
|
||||
|
||||
public DynamicPropertyDescriptor(UnshackleParameter parameter, Dictionary<string, object> values)
|
||||
: base(parameter.Name, null)
|
||||
{
|
||||
_parameter = parameter;
|
||||
_values = values;
|
||||
}
|
||||
|
||||
public override string Category => _parameter.Category;
|
||||
|
||||
// IMPORTANT FIX
|
||||
public override Type ComponentType => typeof(object);
|
||||
|
||||
public override bool IsReadOnly => false;
|
||||
|
||||
public override Type PropertyType =>
|
||||
_parameter.Type switch
|
||||
{
|
||||
"Bool" => typeof(bool),
|
||||
"Number" => typeof(int),
|
||||
_ => typeof(string)
|
||||
};
|
||||
|
||||
public override TypeConverter Converter =>
|
||||
(_parameter.Type == "Selection" && _parameter.Options != null)
|
||||
? new StandardValuesConverter(_parameter.Options)
|
||||
: base.Converter;
|
||||
|
||||
public override object GetValue(object component)
|
||||
{
|
||||
return _values.ContainsKey(_parameter.Name)
|
||||
? _values[_parameter.Name]
|
||||
: _parameter.Default;
|
||||
}
|
||||
|
||||
public override void SetValue(object component, object value)
|
||||
{
|
||||
_values[_parameter.Name] = value;
|
||||
|
||||
OnValueChanged(component, EventArgs.Empty);
|
||||
|
||||
// Force grid refresh
|
||||
TypeDescriptor.Refresh(component);
|
||||
}
|
||||
|
||||
public override bool CanResetValue(object component) => true;
|
||||
|
||||
public override void ResetValue(object component)
|
||||
{
|
||||
_values[_parameter.Name] = _parameter.Default;
|
||||
}
|
||||
|
||||
public override bool ShouldSerializeValue(object component) => true;
|
||||
}
|
||||
|
||||
internal class StandardValuesConverter : TypeConverter
|
||||
{
|
||||
private readonly List<string> _values;
|
||||
|
||||
public StandardValuesConverter(List<string> values)
|
||||
{
|
||||
_values = values;
|
||||
}
|
||||
|
||||
public override bool GetStandardValuesSupported(ITypeDescriptorContext context) => true;
|
||||
|
||||
public override bool GetStandardValuesExclusive(ITypeDescriptorContext context) => true;
|
||||
|
||||
public override StandardValuesCollection GetStandardValues(ITypeDescriptorContext context)
|
||||
{
|
||||
return new StandardValuesCollection(_values);
|
||||
}
|
||||
}
|
||||
}
|
||||
240
Shackle/MainForm.Designer.cs
generated
Normal file
240
Shackle/MainForm.Designer.cs
generated
Normal file
@@ -0,0 +1,240 @@
|
||||
namespace UnshackleGUI
|
||||
{
|
||||
partial class MainForm
|
||||
{
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
private System.Windows.Forms.TextBox txtRootPath;
|
||||
private System.Windows.Forms.TextBox txtBinName;
|
||||
private System.Windows.Forms.ComboBox comboProfiles;
|
||||
private System.Windows.Forms.Button btnAddProfile;
|
||||
private System.Windows.Forms.Button btnRemoveProfile;
|
||||
private System.Windows.Forms.ComboBox comboService;
|
||||
private System.Windows.Forms.TextBox txtURL;
|
||||
private System.Windows.Forms.TextBox txtCommandPreview;
|
||||
private System.Windows.Forms.Button btnRun;
|
||||
private System.Windows.Forms.Button btnStop;
|
||||
private System.Windows.Forms.Button btnOpenCookies;
|
||||
private System.Windows.Forms.Button btnEditServiceConfig; // New
|
||||
private System.Windows.Forms.Button btnEditYaml;
|
||||
private System.Windows.Forms.Button btnBrowse;
|
||||
private System.Windows.Forms.Button btnClearLog;
|
||||
private System.Windows.Forms.TextBox txtLog;
|
||||
private System.Windows.Forms.PropertyGrid pgProfile;
|
||||
private System.Windows.Forms.Label lblPath;
|
||||
|
||||
protected override void Dispose(bool disposing) { if (disposing && (components != null)) components.Dispose(); base.Dispose(disposing); }
|
||||
|
||||
private void InitializeComponent()
|
||||
{
|
||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MainForm));
|
||||
txtRootPath = new TextBox();
|
||||
txtBinName = new TextBox();
|
||||
comboProfiles = new ComboBox();
|
||||
btnAddProfile = new Button();
|
||||
btnRemoveProfile = new Button();
|
||||
comboService = new ComboBox();
|
||||
txtURL = new TextBox();
|
||||
txtCommandPreview = new TextBox();
|
||||
btnRun = new Button();
|
||||
btnStop = new Button();
|
||||
btnOpenCookies = new Button();
|
||||
btnEditServiceConfig = new Button();
|
||||
btnEditYaml = new Button();
|
||||
btnBrowse = new Button();
|
||||
btnClearLog = new Button();
|
||||
txtLog = new TextBox();
|
||||
pgProfile = new PropertyGrid();
|
||||
lblPath = new Label();
|
||||
SuspendLayout();
|
||||
//
|
||||
// txtRootPath
|
||||
//
|
||||
txtRootPath.Location = new Point(12, 35);
|
||||
txtRootPath.Name = "txtRootPath";
|
||||
txtRootPath.Size = new Size(280, 27);
|
||||
txtRootPath.TabIndex = 0;
|
||||
//
|
||||
// txtBinName
|
||||
//
|
||||
txtBinName.Location = new Point(340, 35);
|
||||
txtBinName.Name = "txtBinName";
|
||||
txtBinName.Size = new Size(60, 27);
|
||||
txtBinName.TabIndex = 2;
|
||||
//
|
||||
// comboProfiles
|
||||
//
|
||||
comboProfiles.Anchor = AnchorStyles.Top | AnchorStyles.Right;
|
||||
comboProfiles.Location = new Point(1177, 35);
|
||||
comboProfiles.Name = "comboProfiles";
|
||||
comboProfiles.Size = new Size(240, 28);
|
||||
comboProfiles.TabIndex = 4;
|
||||
//
|
||||
// btnAddProfile
|
||||
//
|
||||
btnAddProfile.Anchor = AnchorStyles.Top | AnchorStyles.Right;
|
||||
btnAddProfile.Location = new Point(1422, 34);
|
||||
btnAddProfile.Name = "btnAddProfile";
|
||||
btnAddProfile.Size = new Size(35, 29);
|
||||
btnAddProfile.TabIndex = 5;
|
||||
btnAddProfile.Text = "+";
|
||||
//
|
||||
// btnRemoveProfile
|
||||
//
|
||||
btnRemoveProfile.Anchor = AnchorStyles.Top | AnchorStyles.Right;
|
||||
btnRemoveProfile.Location = new Point(1462, 34);
|
||||
btnRemoveProfile.Name = "btnRemoveProfile";
|
||||
btnRemoveProfile.Size = new Size(35, 29);
|
||||
btnRemoveProfile.TabIndex = 6;
|
||||
btnRemoveProfile.Text = "-";
|
||||
//
|
||||
// comboService
|
||||
//
|
||||
comboService.Location = new Point(12, 80);
|
||||
comboService.Name = "comboService";
|
||||
comboService.Size = new Size(100, 28);
|
||||
comboService.TabIndex = 7;
|
||||
//
|
||||
// txtURL
|
||||
//
|
||||
txtURL.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
||||
txtURL.Location = new Point(115, 80);
|
||||
txtURL.Name = "txtURL";
|
||||
txtURL.PlaceholderText = "Paste ID / URL here...";
|
||||
txtURL.Size = new Size(801, 27);
|
||||
txtURL.TabIndex = 8;
|
||||
//
|
||||
// txtCommandPreview
|
||||
//
|
||||
txtCommandPreview.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
||||
txtCommandPreview.BackColor = Color.FromArgb(20, 20, 20);
|
||||
txtCommandPreview.Font = new Font("Consolas", 10F, FontStyle.Bold);
|
||||
txtCommandPreview.ForeColor = Color.Cyan;
|
||||
txtCommandPreview.Location = new Point(12, 115);
|
||||
txtCommandPreview.Name = "txtCommandPreview";
|
||||
txtCommandPreview.Size = new Size(1130, 27);
|
||||
txtCommandPreview.TabIndex = 9;
|
||||
//
|
||||
// btnRun
|
||||
//
|
||||
btnRun.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
||||
btnRun.Location = new Point(12, 150);
|
||||
btnRun.Name = "btnRun";
|
||||
btnRun.Size = new Size(1130, 45);
|
||||
btnRun.TabIndex = 10;
|
||||
btnRun.Text = "RUN";
|
||||
//
|
||||
// btnStop
|
||||
//
|
||||
btnStop.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
||||
btnStop.BackColor = Color.Maroon;
|
||||
btnStop.Location = new Point(12, 150);
|
||||
btnStop.Name = "btnStop";
|
||||
btnStop.Size = new Size(1130, 45);
|
||||
btnStop.TabIndex = 11;
|
||||
btnStop.Text = "STOP";
|
||||
btnStop.UseVisualStyleBackColor = false;
|
||||
btnStop.Visible = false;
|
||||
//
|
||||
// btnOpenCookies
|
||||
//
|
||||
btnOpenCookies.Anchor = AnchorStyles.Top | AnchorStyles.Right;
|
||||
btnOpenCookies.Location = new Point(922, 79);
|
||||
btnOpenCookies.Name = "btnOpenCookies";
|
||||
btnOpenCookies.Size = new Size(115, 30);
|
||||
btnOpenCookies.TabIndex = 12;
|
||||
btnOpenCookies.Text = "🍪 Cookies";
|
||||
//
|
||||
// btnEditServiceConfig
|
||||
//
|
||||
btnEditServiceConfig.Anchor = AnchorStyles.Top | AnchorStyles.Right;
|
||||
btnEditServiceConfig.Location = new Point(1043, 79);
|
||||
btnEditServiceConfig.Name = "btnEditServiceConfig";
|
||||
btnEditServiceConfig.Size = new Size(99, 30);
|
||||
btnEditServiceConfig.TabIndex = 13;
|
||||
btnEditServiceConfig.Text = "⚙️ Service";
|
||||
//
|
||||
// btnEditYaml
|
||||
//
|
||||
btnEditYaml.Location = new Point(410, 34);
|
||||
btnEditYaml.Name = "btnEditYaml";
|
||||
btnEditYaml.Size = new Size(144, 29);
|
||||
btnEditYaml.TabIndex = 3;
|
||||
btnEditYaml.Text = "📝 Main Config";
|
||||
//
|
||||
// btnBrowse
|
||||
//
|
||||
btnBrowse.Location = new Point(295, 34);
|
||||
btnBrowse.Name = "btnBrowse";
|
||||
btnBrowse.Size = new Size(35, 29);
|
||||
btnBrowse.TabIndex = 1;
|
||||
btnBrowse.Text = "📂";
|
||||
//
|
||||
// btnClearLog
|
||||
//
|
||||
btnClearLog.Anchor = AnchorStyles.Top | AnchorStyles.Right;
|
||||
btnClearLog.Location = new Point(1022, 201);
|
||||
btnClearLog.Name = "btnClearLog";
|
||||
btnClearLog.Size = new Size(120, 36);
|
||||
btnClearLog.TabIndex = 14;
|
||||
btnClearLog.Text = "Clear Log";
|
||||
//
|
||||
// txtLog
|
||||
//
|
||||
txtLog.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
|
||||
txtLog.BackColor = Color.Black;
|
||||
txtLog.Font = new Font("Consolas", 9F);
|
||||
txtLog.ForeColor = Color.Lime;
|
||||
txtLog.Location = new Point(12, 243);
|
||||
txtLog.Multiline = true;
|
||||
txtLog.Name = "txtLog";
|
||||
txtLog.ScrollBars = ScrollBars.Vertical;
|
||||
txtLog.Size = new Size(1130, 550);
|
||||
txtLog.TabIndex = 15;
|
||||
//
|
||||
// pgProfile
|
||||
//
|
||||
pgProfile.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Right;
|
||||
pgProfile.CategoryForeColor = SystemColors.ActiveCaption;
|
||||
pgProfile.Location = new Point(1177, 80);
|
||||
pgProfile.Name = "pgProfile";
|
||||
pgProfile.Size = new Size(320, 713);
|
||||
pgProfile.TabIndex = 16;
|
||||
//
|
||||
// lblPath
|
||||
//
|
||||
lblPath.Location = new Point(12, 12);
|
||||
lblPath.Name = "lblPath";
|
||||
lblPath.Size = new Size(150, 23);
|
||||
lblPath.TabIndex = 17;
|
||||
lblPath.Text = "Root Path & Binary:";
|
||||
//
|
||||
// MainForm
|
||||
//
|
||||
ClientSize = new Size(1519, 808);
|
||||
Controls.Add(txtRootPath);
|
||||
Controls.Add(btnBrowse);
|
||||
Controls.Add(txtBinName);
|
||||
Controls.Add(btnEditYaml);
|
||||
Controls.Add(comboProfiles);
|
||||
Controls.Add(btnAddProfile);
|
||||
Controls.Add(btnRemoveProfile);
|
||||
Controls.Add(comboService);
|
||||
Controls.Add(txtURL);
|
||||
Controls.Add(txtCommandPreview);
|
||||
Controls.Add(btnRun);
|
||||
Controls.Add(btnStop);
|
||||
Controls.Add(btnOpenCookies);
|
||||
Controls.Add(btnEditServiceConfig);
|
||||
Controls.Add(btnClearLog);
|
||||
Controls.Add(txtLog);
|
||||
Controls.Add(pgProfile);
|
||||
Controls.Add(lblPath);
|
||||
Icon = (Icon)resources.GetObject("$this.Icon");
|
||||
MinimumSize = new Size(960, 680);
|
||||
Name = "MainForm";
|
||||
Text = "Unshackle Master GUI";
|
||||
ResumeLayout(false);
|
||||
PerformLayout();
|
||||
}
|
||||
}
|
||||
}
|
||||
375
Shackle/MainForm.cs
Normal file
375
Shackle/MainForm.cs
Normal file
@@ -0,0 +1,375 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Drawing;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace UnshackleGUI
|
||||
{
|
||||
public partial class MainForm : Form
|
||||
{
|
||||
private string _configPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "config.json");
|
||||
private string _paramsPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "params.json");
|
||||
|
||||
private AppSettings _appSettings = new AppSettings();
|
||||
private List<UnshackleParameter> _parameterDefinitions = new List<UnshackleParameter>();
|
||||
private Dictionary<string, object> _propertyValues = new Dictionary<string, object>();
|
||||
|
||||
private Process? _currentProcess;
|
||||
|
||||
public MainForm()
|
||||
{
|
||||
InitializeComponent();
|
||||
ApplyDarkTheme();
|
||||
LoadParamsAndConfig();
|
||||
|
||||
// EVENT: This updates the command line the moment a value changes
|
||||
pgProfile.PropertyValueChanged += (s, e) =>
|
||||
{
|
||||
UpdateCommandPreview();
|
||||
|
||||
if (comboProfiles.SelectedItem != null)
|
||||
{
|
||||
string selected = comboProfiles.SelectedItem.ToString();
|
||||
_appSettings.Profiles[selected] =
|
||||
new Dictionary<string, object>(_propertyValues);
|
||||
}
|
||||
|
||||
SaveConfig();
|
||||
};
|
||||
|
||||
comboService.SelectedIndexChanged += (s, e) => UpdateCommandPreview();
|
||||
txtURL.TextChanged += (s, e) => UpdateCommandPreview();
|
||||
txtBinName.TextChanged += (s, e) => UpdateCommandPreview();
|
||||
|
||||
btnRun.Click += btnRun_Click;
|
||||
btnStop.Click += btnStop_Click;
|
||||
btnBrowse.Click += btnBrowse_Click;
|
||||
btnOpenCookies.Click += btnOpenCookies_Click;
|
||||
btnEditServiceConfig.Click += btnEditServiceConfig_Click;
|
||||
btnClearLog.Click += btnClearLog_Click;
|
||||
btnEditYaml.Click += btnEditYaml_Click;
|
||||
btnAddProfile.Click += btnAddProfile_Click;
|
||||
btnRemoveProfile.Click += btnRemoveProfile_Click;
|
||||
}
|
||||
|
||||
private void LoadParamsAndConfig()
|
||||
{
|
||||
// 1. Load Parameters (Rules)
|
||||
if (File.Exists(_paramsPath))
|
||||
{
|
||||
var json = File.ReadAllText(_paramsPath);
|
||||
_parameterDefinitions = JsonConvert.DeserializeObject<List<UnshackleParameter>>(json) ?? new List<UnshackleParameter>();
|
||||
|
||||
foreach (var p in _parameterDefinitions)
|
||||
{
|
||||
// Ensure every parameter has a value in the dictionary
|
||||
if (!_propertyValues.ContainsKey(p.Name))
|
||||
_propertyValues[p.Name] = p.Default ?? "";
|
||||
}
|
||||
}
|
||||
|
||||
// 2. Load Config (Paths/Profiles)
|
||||
if (File.Exists(_configPath))
|
||||
{
|
||||
var json = File.ReadAllText(_configPath);
|
||||
_appSettings = JsonConvert.DeserializeObject<AppSettings>(json) ?? new AppSettings();
|
||||
txtRootPath.Text = _appSettings.RootPath;
|
||||
txtBinName.Text = _appSettings.BinaryName;
|
||||
}
|
||||
|
||||
if (_appSettings.Profiles == null || _appSettings.Profiles.Count == 0)
|
||||
{
|
||||
_appSettings.Profiles = new Dictionary<string, Dictionary<string, object>>();
|
||||
_appSettings.Profiles["Default"] = new Dictionary<string, object>(_propertyValues);
|
||||
}
|
||||
|
||||
comboProfiles.DataSource = null;
|
||||
comboProfiles.DataSource = _appSettings.Profiles.Keys.ToList();
|
||||
|
||||
comboProfiles.SelectedIndexChanged += (s, e) =>
|
||||
{
|
||||
if (comboProfiles.SelectedItem == null) return;
|
||||
|
||||
string selected = comboProfiles.SelectedItem.ToString();
|
||||
|
||||
if (_appSettings.Profiles.TryGetValue(selected, out var values))
|
||||
{
|
||||
_propertyValues = new Dictionary<string, object>(values);
|
||||
|
||||
pgProfile.SelectedObject =
|
||||
new DynamicObject(_propertyValues, _parameterDefinitions);
|
||||
|
||||
UpdateCommandPreview();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// 3. Bind to Grid using the FIXED Descriptor
|
||||
pgProfile.SelectedObject = new DynamicObject(_propertyValues, _parameterDefinitions);
|
||||
|
||||
|
||||
RefreshFolders();
|
||||
UpdateCommandPreview();
|
||||
}
|
||||
|
||||
private void UpdateCommandPreview()
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.Append($"{txtBinName.Text} run unshackle dl ");
|
||||
|
||||
foreach (var p in _parameterDefinitions)
|
||||
{
|
||||
if (!_propertyValues.TryGetValue(p.Name, out object val)) continue;
|
||||
|
||||
// Handle Booleans
|
||||
if (p.Type == "Bool" && val is bool b && b)
|
||||
{
|
||||
sb.Append($"{p.Flag} ");
|
||||
}
|
||||
// Handle Text/Selection/Numbers
|
||||
else if (p.Type != "Bool" && val != null)
|
||||
{
|
||||
string sVal = val.ToString();
|
||||
// Skip empty, "any", or "0" (for default bitrates)
|
||||
if (!string.IsNullOrWhiteSpace(sVal) && sVal != "any" && sVal != "0")
|
||||
{
|
||||
if (sVal.Contains(" ")) sVal = $"\"{sVal}\"";
|
||||
sb.Append($"{p.Flag} {sVal} ");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sb.Append($"{comboService.Text} {txtURL.Text}");
|
||||
txtCommandPreview.Text = sb.ToString();
|
||||
}
|
||||
|
||||
private void btnEditServiceConfig_Click(object? sender, EventArgs e)
|
||||
{
|
||||
string yamlPath = Path.Combine(txtRootPath.Text, "unshackle", "services", comboService.Text, "config.yaml");
|
||||
if (File.Exists(yamlPath))
|
||||
Process.Start(new ProcessStartInfo(yamlPath) { UseShellExecute = true });
|
||||
else
|
||||
MessageBox.Show($"No config.yaml found for {comboService.Text}");
|
||||
}
|
||||
|
||||
private async void btnRun_Click(object? sender, EventArgs e)
|
||||
{
|
||||
string finalCmd = txtCommandPreview.Text;
|
||||
if (string.IsNullOrWhiteSpace(finalCmd)) return;
|
||||
|
||||
ToggleUI(true);
|
||||
txtLog.AppendText($"> Executing: {finalCmd}{Environment.NewLine}");
|
||||
|
||||
try { await Task.Run(() => RunCli(finalCmd)); }
|
||||
catch (Exception ex) { AppendLog($"[ERROR]: {ex.Message}"); }
|
||||
finally { ToggleUI(false); }
|
||||
}
|
||||
|
||||
private void RunCli(string cmd)
|
||||
{
|
||||
ProcessStartInfo psi = new ProcessStartInfo
|
||||
{
|
||||
FileName = "cmd.exe",
|
||||
// /c = Run command and then terminate
|
||||
// chcp 65001 = Force console to use UTF-8 encoding
|
||||
// && = Run the actual command immediately after setting encoding
|
||||
Arguments = $"/c chcp 65001 && {cmd}",
|
||||
WorkingDirectory = txtRootPath.Text,
|
||||
RedirectStandardOutput = true,
|
||||
RedirectStandardError = true,
|
||||
UseShellExecute = false,
|
||||
CreateNoWindow = true,
|
||||
StandardOutputEncoding = Encoding.UTF8
|
||||
};
|
||||
|
||||
// Ensure Python scripts know to use UTF-8
|
||||
psi.EnvironmentVariables["PYTHONIOENCODING"] = "utf-8";
|
||||
|
||||
using (_currentProcess = Process.Start(psi))
|
||||
{
|
||||
if (_currentProcess == null) return;
|
||||
|
||||
_currentProcess.OutputDataReceived += (s, e) =>
|
||||
{
|
||||
// Filter out the noisy "Active code page: 65001" message from CMD
|
||||
if (!string.IsNullOrEmpty(e.Data) && !e.Data.Contains("Active code page"))
|
||||
AppendLog(e.Data);
|
||||
};
|
||||
|
||||
_currentProcess.ErrorDataReceived += (s, e) => AppendLog(e.Data);
|
||||
|
||||
_currentProcess.BeginOutputReadLine();
|
||||
_currentProcess.BeginErrorReadLine();
|
||||
_currentProcess.WaitForExit();
|
||||
}
|
||||
}
|
||||
|
||||
private void AppendLog(string? text)
|
||||
{
|
||||
if (string.IsNullOrEmpty(text)) return;
|
||||
this.BeginInvoke(new Action(() => { txtLog.AppendText(text + Environment.NewLine); }));
|
||||
}
|
||||
|
||||
private void ApplyDarkTheme()
|
||||
{
|
||||
this.BackColor = Color.FromArgb(30, 30, 30);
|
||||
this.ForeColor = Color.White;
|
||||
foreach (Control c in this.Controls) UpdateControlTheme(c);
|
||||
}
|
||||
|
||||
private void UpdateControlTheme(Control c)
|
||||
{
|
||||
c.BackColor = Color.FromArgb(45, 45, 48);
|
||||
c.ForeColor = Color.White;
|
||||
if (c is TextBox tb) tb.BorderStyle = BorderStyle.FixedSingle;
|
||||
if (c is Button btn) { btn.FlatStyle = FlatStyle.Flat; btn.FlatAppearance.BorderColor = Color.Gray; }
|
||||
if (c is PropertyGrid pg)
|
||||
{
|
||||
pg.BackColor = Color.FromArgb(37, 37, 38);
|
||||
pg.ViewBackColor = Color.FromArgb(37, 37, 38);
|
||||
pg.ViewForeColor = Color.White;
|
||||
pg.LineColor = Color.FromArgb(45, 45, 48);
|
||||
}
|
||||
foreach (Control child in c.Controls) UpdateControlTheme(child);
|
||||
}
|
||||
|
||||
private void SaveConfig()
|
||||
{
|
||||
_appSettings.RootPath = txtRootPath.Text;
|
||||
_appSettings.BinaryName = txtBinName.Text;
|
||||
File.WriteAllText(_configPath, JsonConvert.SerializeObject(_appSettings, Formatting.Indented));
|
||||
}
|
||||
|
||||
private void RefreshFolders()
|
||||
{
|
||||
comboService.Items.Clear();
|
||||
string path = Path.Combine(txtRootPath.Text, "unshackle", "services");
|
||||
if (Directory.Exists(path))
|
||||
{
|
||||
var dirs = Directory.GetDirectories(path).Select(Path.GetFileName).ToArray();
|
||||
comboService.Items.AddRange(dirs.Cast<object>().ToArray());
|
||||
if (comboService.Items.Count > 0) comboService.SelectedIndex = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void ComboProfiles_SelectedIndexChanged(object? sender, EventArgs e)
|
||||
{
|
||||
if (comboProfiles.SelectedItem == null) return;
|
||||
|
||||
string selected = comboProfiles.SelectedItem.ToString();
|
||||
|
||||
if (_appSettings.Profiles.TryGetValue(selected, out var values))
|
||||
{
|
||||
_propertyValues = new Dictionary<string, object>(values);
|
||||
|
||||
pgProfile.SelectedObject =
|
||||
new DynamicObject(_propertyValues, _parameterDefinitions);
|
||||
|
||||
UpdateCommandPreview();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void btnAddProfile_Click(object? sender, EventArgs e)
|
||||
{
|
||||
string name = Microsoft.VisualBasic.Interaction.InputBox(
|
||||
"Enter profile name:",
|
||||
"New Profile",
|
||||
"NewProfile");
|
||||
|
||||
if (string.IsNullOrWhiteSpace(name))
|
||||
return;
|
||||
|
||||
if (_appSettings.Profiles.ContainsKey(name))
|
||||
{
|
||||
MessageBox.Show("Profile already exists.");
|
||||
return;
|
||||
}
|
||||
|
||||
// Clone current settings into new profile
|
||||
_appSettings.Profiles[name] =
|
||||
new Dictionary<string, object>(_propertyValues);
|
||||
|
||||
comboProfiles.DataSource = null;
|
||||
comboProfiles.DataSource = _appSettings.Profiles.Keys.ToList();
|
||||
comboProfiles.SelectedItem = name;
|
||||
|
||||
SaveConfig();
|
||||
}
|
||||
|
||||
private void btnRemoveProfile_Click(object? sender, EventArgs e)
|
||||
{
|
||||
if (comboProfiles.SelectedItem == null)
|
||||
return;
|
||||
|
||||
string selected = comboProfiles.SelectedItem.ToString();
|
||||
|
||||
if (selected == "Default")
|
||||
{
|
||||
MessageBox.Show("Default profile cannot be deleted.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!_appSettings.Profiles.ContainsKey(selected))
|
||||
return;
|
||||
|
||||
_appSettings.Profiles.Remove(selected);
|
||||
|
||||
comboProfiles.DataSource = null;
|
||||
comboProfiles.DataSource = _appSettings.Profiles.Keys.ToList();
|
||||
|
||||
comboProfiles.SelectedIndex = 0;
|
||||
|
||||
SaveConfig();
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void ToggleUI(bool r) => this.BeginInvoke(new Action(() => { btnRun.Enabled = !r; btnStop.Visible = r; }));
|
||||
private void btnStop_Click(object? sender, EventArgs e) { _currentProcess?.Kill(true); }
|
||||
private void btnClearLog_Click(object? sender, EventArgs e) => txtLog.Clear();
|
||||
private void btnBrowse_Click(object? sender, EventArgs e)
|
||||
{
|
||||
using (var fbd = new FolderBrowserDialog()) if (fbd.ShowDialog() == DialogResult.OK) { txtRootPath.Text = fbd.SelectedPath; SaveConfig(); RefreshFolders(); }
|
||||
}
|
||||
private void btnOpenCookies_Click(object? sender, EventArgs e)
|
||||
{
|
||||
string p = Path.Combine(txtRootPath.Text, "unshackle", "cookies", comboService.Text);
|
||||
Directory.CreateDirectory(p); Process.Start("explorer.exe", p);
|
||||
}
|
||||
private void btnEditYaml_Click(object? sender, EventArgs e)
|
||||
{
|
||||
string yamlPath = Path.Combine(txtRootPath.Text, "unshackle/unshackle.yaml");
|
||||
if (File.Exists(yamlPath)) Process.Start(new ProcessStartInfo(yamlPath) { UseShellExecute = true });
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// --- DATA MODELS ---
|
||||
public class AppSettings
|
||||
{
|
||||
public string RootPath { get; set; } = @"C:\DEVINE\unshackle";
|
||||
public string BinaryName { get; set; } = "uv";
|
||||
|
||||
public Dictionary<string, Dictionary<string, object>> Profiles { get; set; }
|
||||
= new Dictionary<string, Dictionary<string, object>>();
|
||||
}
|
||||
|
||||
public class UnshackleParameter
|
||||
{
|
||||
public string Flag { get; set; } = "";
|
||||
public string Name { get; set; } = "";
|
||||
public string Type { get; set; } = "Text";
|
||||
public List<string>? Options { get; set; }
|
||||
public object? Default { get; set; }
|
||||
public string Category { get; set; } = "Misc";
|
||||
}
|
||||
}
|
||||
16507
Shackle/MainForm.resx
Normal file
16507
Shackle/MainForm.resx
Normal file
File diff suppressed because it is too large
Load Diff
19
Shackle/Program.cs
Normal file
19
Shackle/Program.cs
Normal file
@@ -0,0 +1,19 @@
|
||||
using UnshackleGUI;
|
||||
|
||||
namespace Shackle
|
||||
{
|
||||
internal static class Program
|
||||
{
|
||||
/// <summary>
|
||||
/// The main entry point for the application.
|
||||
/// </summary>
|
||||
[STAThread]
|
||||
static void Main()
|
||||
{
|
||||
// To customize application configuration such as set high DPI settings or default font,
|
||||
// see https://aka.ms/applicationconfiguration.
|
||||
ApplicationConfiguration.Initialize();
|
||||
Application.Run(new MainForm());
|
||||
}
|
||||
}
|
||||
}
|
||||
63
Shackle/Properties/Resources.Designer.cs
generated
Normal file
63
Shackle/Properties/Resources.Designer.cs
generated
Normal file
@@ -0,0 +1,63 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// 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.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace Shackle.Properties {
|
||||
using System;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// A strongly-typed resource class, for looking up localized strings, etc.
|
||||
/// </summary>
|
||||
// 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", "17.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() {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the cached ResourceManager instance used by this class.
|
||||
/// </summary>
|
||||
[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("Shackle.Properties.Resources", typeof(Resources).Assembly);
|
||||
resourceMan = temp;
|
||||
}
|
||||
return resourceMan;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Overrides the current thread's CurrentUICulture property for all
|
||||
/// resource lookups using this strongly typed resource class.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Globalization.CultureInfo Culture {
|
||||
get {
|
||||
return resourceCulture;
|
||||
}
|
||||
set {
|
||||
resourceCulture = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
101
Shackle/Properties/Resources.resx
Normal file
101
Shackle/Properties/Resources.resx
Normal file
@@ -0,0 +1,101 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 1.3
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">1.3</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1">this is my long string</data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
[base64 mime encoded serialized .NET Framework object]
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
[base64 mime encoded string representing a byte array form of the .NET Framework object]
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>1.3</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.3500.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.3500.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
||||
26
Shackle/Properties/Settings.Designer.cs
generated
Normal file
26
Shackle/Properties/Settings.Designer.cs
generated
Normal file
@@ -0,0 +1,26 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// 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.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace Shackle.Properties {
|
||||
|
||||
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.12.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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
6
Shackle/Properties/Settings.settings
Normal file
6
Shackle/Properties/Settings.settings
Normal file
@@ -0,0 +1,6 @@
|
||||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
|
||||
<Profiles>
|
||||
<Profile Name="(Default)" />
|
||||
</Profiles>
|
||||
</SettingsFile>
|
||||
75
Shackle/Shackle.csproj
Normal file
75
Shackle/Shackle.csproj
Normal file
@@ -0,0 +1,75 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<TargetFramework>net8.0-windows</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<UseWindowsForms>true</UseWindowsForms>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
|
||||
<PublishSingleFile>true</PublishSingleFile>
|
||||
|
||||
<SelfContained>false</SelfContained>
|
||||
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
|
||||
<IncludeNativeLibrariesForSelfExtract>true</IncludeNativeLibrariesForSelfExtract>
|
||||
|
||||
<EnableCompressionInSingleFile>false</EnableCompressionInSingleFile>
|
||||
<PublishReadyToRun>false</PublishReadyToRun>
|
||||
|
||||
<DebugType>none</DebugType>
|
||||
|
||||
<PackageIcon>8p5oo8p5oo8p5oo.png</PackageIcon>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
||||
<PackageReference Include="System.Resources.Extensions" Version="8.0.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Update="Properties\Resources.Designer.cs">
|
||||
<DesignTime>True</DesignTime>
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Resources.resx</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Update="Properties\Settings.Designer.cs">
|
||||
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Settings.settings</DependentUpon>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Update="Properties\Resources.resx">
|
||||
<Generator>ResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Update="8p5oo8p5oo8p5oo.ico">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
<Pack>True</Pack>
|
||||
<PackagePath>\</PackagePath>
|
||||
</None>
|
||||
<None Update="8p5oo8p5oo8p5oo.png">
|
||||
<Pack>True</Pack>
|
||||
<PackagePath>\</PackagePath>
|
||||
</None>
|
||||
<None Update="config.json">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="params.json">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="Properties\Settings.settings">
|
||||
<Generator>SettingsSingleFileGenerator</Generator>
|
||||
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="Properties\PublishProfiles\" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
7
Shackle/config.json
Normal file
7
Shackle/config.json
Normal file
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"RootPath": "C:\\DEVINE\\unshackle",
|
||||
"BinaryName": "uv",
|
||||
"Profiles": {
|
||||
"Default": {}
|
||||
}
|
||||
}
|
||||
226
Shackle/params.json
Normal file
226
Shackle/params.json
Normal file
@@ -0,0 +1,226 @@
|
||||
[
|
||||
{
|
||||
"Flag": "-p",
|
||||
"Name": "Profile",
|
||||
"Type": "Text",
|
||||
"Default": "",
|
||||
"Category": "1. Account"
|
||||
},
|
||||
{
|
||||
"Flag": "--proxy",
|
||||
"Name": "Proxy",
|
||||
"Type": "Text",
|
||||
"Default": "",
|
||||
"Category": "1. Account"
|
||||
},
|
||||
{
|
||||
"Flag": "-q",
|
||||
"Name": "Quality",
|
||||
"Type": "Selection",
|
||||
"Options": [ "2160", "1080", "720", "480" ],
|
||||
"Default": "2160",
|
||||
"Category": "2. Video"
|
||||
},
|
||||
{
|
||||
"Flag": "-v",
|
||||
"Name": "VideoCodec",
|
||||
"Type": "Selection",
|
||||
"Options": [
|
||||
"any",
|
||||
"avc",
|
||||
"h.264",
|
||||
"hevc",
|
||||
"h.265",
|
||||
"vc1",
|
||||
"vc-1",
|
||||
"vp8",
|
||||
"vp9",
|
||||
"av1"
|
||||
],
|
||||
"Default": "any",
|
||||
"Category": "2. Video"
|
||||
},
|
||||
{
|
||||
"Flag": "-r",
|
||||
"Name": "Range",
|
||||
"Type": "Selection",
|
||||
"Options": ["any", "sdr", "hlg", "hdr10", "hdr10p", "dv", "hybrid" ],
|
||||
"Default": "sdr",
|
||||
"Category": "2. Video"
|
||||
},
|
||||
{
|
||||
"Flag": "-vb",
|
||||
"Name": "VideoBitrate",
|
||||
"Type": "Number",
|
||||
"Default": 0,
|
||||
"Category": "2. Video"
|
||||
},
|
||||
{
|
||||
"Flag": "-a",
|
||||
"Name": "AudioCodec",
|
||||
"Type": "Selection",
|
||||
"Options": [
|
||||
"any",
|
||||
"aac",
|
||||
"ac3",
|
||||
"ec3",
|
||||
"ac4",
|
||||
"opus",
|
||||
"ogg",
|
||||
"dts",
|
||||
"alac",
|
||||
"flac"
|
||||
],
|
||||
"Default": "any",
|
||||
"Category": "3. Audio"
|
||||
},
|
||||
{
|
||||
"Flag": "-ab",
|
||||
"Name": "AudioBitrate",
|
||||
"Type": "Number",
|
||||
"Default": 0,
|
||||
"Category": "3. Audio"
|
||||
},
|
||||
{
|
||||
"Flag": "-c",
|
||||
"Name": "Channels",
|
||||
"Type": "Text",
|
||||
"Default": "",
|
||||
"Category": "3. Audio"
|
||||
},
|
||||
{
|
||||
"Flag": "--noatmos",
|
||||
"Name": "NoAtmos",
|
||||
"Type": "Bool",
|
||||
"Default": false,
|
||||
"Category": "3. Audio"
|
||||
},
|
||||
{
|
||||
"Flag": "-w",
|
||||
"Name": "WantedEpisodes",
|
||||
"Type": "Text",
|
||||
"Default": "",
|
||||
"Category": "4. Selection"
|
||||
},
|
||||
{
|
||||
"Flag": "-l",
|
||||
"Name": "Language",
|
||||
"Type": "Text",
|
||||
"Default": "en,orig",
|
||||
"Category": "4. Selection"
|
||||
},
|
||||
{
|
||||
"Flag": "--latest-episode",
|
||||
"Name": "LatestOnly",
|
||||
"Type": "Bool",
|
||||
"Default": false,
|
||||
"Category": "4. Selection"
|
||||
},
|
||||
{
|
||||
"Flag": "-sl",
|
||||
"Name": "SubtitleLang",
|
||||
"Type": "Text",
|
||||
"Default": "",
|
||||
"Category": "4. Selection"
|
||||
},
|
||||
{
|
||||
"Flag": "-fs",
|
||||
"Name": "ForcedSubs",
|
||||
"Type": "Bool",
|
||||
"Default": false,
|
||||
"Category": "4. Selection"
|
||||
},
|
||||
{
|
||||
"Flag": "--sub-format",
|
||||
"Name": "SubFormat",
|
||||
"Type": "Selection",
|
||||
"Options": [
|
||||
"any",
|
||||
"subrip",
|
||||
"srt",
|
||||
"substationalpha",
|
||||
"ssa",
|
||||
"substationalphav4",
|
||||
"ass",
|
||||
"timedtextmarkuplang",
|
||||
"ttml",
|
||||
"webvtt",
|
||||
"vtt",
|
||||
"sami",
|
||||
"smi",
|
||||
"microdvd",
|
||||
"sub",
|
||||
"mpl2",
|
||||
"tmp",
|
||||
"fttml",
|
||||
"stpp",
|
||||
"fvtt",
|
||||
"wvtt"
|
||||
],
|
||||
"Default": "any",
|
||||
"Category": "5. Formatting"
|
||||
},
|
||||
{
|
||||
"Flag": "--tag",
|
||||
"Name": "GroupTag",
|
||||
"Type": "Text",
|
||||
"Default": "",
|
||||
"Category": "5. Formatting"
|
||||
},
|
||||
{
|
||||
"Flag": "-V",
|
||||
"Name": "VideoOnly",
|
||||
"Type": "Bool",
|
||||
"Default": false,
|
||||
"Category": "6. Filters"
|
||||
},
|
||||
{
|
||||
"Flag": "-A",
|
||||
"Name": "AudioOnly",
|
||||
"Type": "Bool",
|
||||
"Default": false,
|
||||
"Category": "6. Filters"
|
||||
},
|
||||
{
|
||||
"Flag": "-S",
|
||||
"Name": "SubsOnly",
|
||||
"Type": "Bool",
|
||||
"Default": false,
|
||||
"Category": "6. Filters"
|
||||
},
|
||||
{
|
||||
"Flag": "--list",
|
||||
"Name": "ListTracks",
|
||||
"Type": "Bool",
|
||||
"Default": false,
|
||||
"Category": "7. Debug/DryRun"
|
||||
},
|
||||
{
|
||||
"Flag": "--slow",
|
||||
"Name": "SlowMode",
|
||||
"Type": "Bool",
|
||||
"Default": false,
|
||||
"Category": "8. Engine"
|
||||
},
|
||||
{
|
||||
"Flag": "--workers",
|
||||
"Name": "Workers",
|
||||
"Type": "Number",
|
||||
"Default": 0,
|
||||
"Category": "8. Engine"
|
||||
},
|
||||
{
|
||||
"Flag": "--no-mux",
|
||||
"Name": "NoMux",
|
||||
"Type": "Bool",
|
||||
"Default": false,
|
||||
"Category": "8. Engine"
|
||||
},
|
||||
{
|
||||
"Flag": "--best-available",
|
||||
"Name": "BestAvailable",
|
||||
"Type": "Bool",
|
||||
"Default": true,
|
||||
"Category": "8. Engine"
|
||||
}
|
||||
]
|
||||
Reference in New Issue
Block a user