mirror of
https://github.com/claunia/cuetools.net.git
synced 2025-12-16 18:14:25 +00:00
CUETools: removed reference to CSScriptLibrary which triggers false-positive
in Avast, so custom scripts are no longer supported.
This commit is contained in:
@@ -148,62 +148,16 @@ namespace CUETools.Processor
|
||||
language = Thread.CurrentThread.CurrentUICulture.Name;
|
||||
|
||||
scripts = new Dictionary<string, CUEToolsScript>();
|
||||
scripts.Add("default", new CUEToolsScript("default", true,
|
||||
new CUEAction[] { CUEAction.Verify, CUEAction.Encode },
|
||||
"return processor.Go();"));
|
||||
scripts.Add("only if found", new CUEToolsScript("only if found", true,
|
||||
new CUEAction[] { CUEAction.Verify },
|
||||
@"if (processor.ArVerify.AccResult != HttpStatusCode.OK)
|
||||
return processor.WriteReport();
|
||||
return processor.Go();"));
|
||||
scripts.Add("fix offset", new CUEToolsScript("fix offset", true,
|
||||
new CUEAction[] { CUEAction.Encode },
|
||||
@"if (processor.ArVerify.AccResult != HttpStatusCode.OK)
|
||||
return processor.WriteReport();
|
||||
processor.WriteOffset = 0;
|
||||
processor.Action = CUEAction.Verify;
|
||||
string status = processor.Go();
|
||||
uint tracksMatch;
|
||||
int bestOffset;
|
||||
processor.FindBestOffset(processor.Config.fixOffsetMinimumConfidence, !processor.Config.fixOffsetToNearest, out tracksMatch, out bestOffset);
|
||||
if (tracksMatch * 100 < processor.Config.fixOffsetMinimumTracksPercent * processor.TrackCount)
|
||||
return status;
|
||||
processor.WriteOffset = bestOffset;
|
||||
processor.Action = CUEAction.Encode;
|
||||
//MessageBox.Show(null, processor.AccurateRipLog, " + "\"Done\"" + @"MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
return processor.Go();
|
||||
"));
|
||||
scripts.Add("encode if verified", new CUEToolsScript("encode if verified", true,
|
||||
new CUEAction[] { CUEAction.Encode },
|
||||
@"if (processor.ArVerify.AccResult != HttpStatusCode.OK)
|
||||
return processor.WriteReport();
|
||||
processor.Action = CUEAction.Verify;
|
||||
string status = processor.Go();
|
||||
uint tracksMatch;
|
||||
int bestOffset;
|
||||
processor.FindBestOffset(processor.Config.encodeWhenConfidence, false, out tracksMatch, out bestOffset);
|
||||
if (tracksMatch * 100 < processor.Config.encodeWhenPercent * processor.TrackCount || (processor.Config.encodeWhenZeroOffset && bestOffset != 0))
|
||||
return status;
|
||||
processor.Action = CUEAction.Encode;
|
||||
return processor.Go();
|
||||
"));
|
||||
scripts.Add("repair", new CUEToolsScript("repair", true,
|
||||
new CUEAction[] { CUEAction.Encode },
|
||||
@"
|
||||
processor.UseCUEToolsDB();
|
||||
processor.Action = CUEAction.Verify;
|
||||
if (processor.CTDB.DBStatus != null)
|
||||
return CTDB.DBStatus;
|
||||
processor.Go();
|
||||
processor.CTDB.DoVerify();
|
||||
if (!processor.CTDB.Verify.HasErrors)
|
||||
return ""nothing to fix"";
|
||||
if (!processor.CTDB.Verify.CanRecover)
|
||||
return ""cannot fix"";
|
||||
processor._useCUEToolsDBFix = true;
|
||||
processor.Action = CUEAction.Encode;
|
||||
return processor.Go();
|
||||
"));
|
||||
scripts.Add("default", new CUEToolsScript("default",
|
||||
new CUEAction[] { CUEAction.Verify, CUEAction.Encode }));
|
||||
scripts.Add("only if found", new CUEToolsScript("only if found",
|
||||
new CUEAction[] { CUEAction.Verify }));
|
||||
scripts.Add("fix offset", new CUEToolsScript("fix offset",
|
||||
new CUEAction[] { CUEAction.Encode }));
|
||||
scripts.Add("encode if verified", new CUEToolsScript("encode if verified",
|
||||
new CUEAction[] { CUEAction.Encode }));
|
||||
scripts.Add("repair", new CUEToolsScript("repair",
|
||||
new CUEAction[] { CUEAction.Encode }));
|
||||
defaultVerifyScript = "default";
|
||||
defaultEncodeScript = "default";
|
||||
}
|
||||
@@ -322,7 +276,6 @@ return processor.Go();
|
||||
foreach (KeyValuePair<string, CUEToolsScript> script in scripts)
|
||||
{
|
||||
sw.Save(string.Format("CustomScript{0}Name", nScripts), script.Key);
|
||||
sw.SaveText(string.Format("CustomScript{0}Code", nScripts), script.Value.code);
|
||||
int nCondition = 0;
|
||||
foreach (CUEAction action in script.Value.conditions)
|
||||
sw.Save(string.Format("CustomScript{0}Condition{1}", nScripts, nCondition++), (int)action);
|
||||
@@ -495,31 +448,6 @@ return processor.Go();
|
||||
}
|
||||
}
|
||||
|
||||
int totalScripts = sr.LoadInt32("CustomScripts", 0, null) ?? 0;
|
||||
for (int nScripts = 0; nScripts < totalScripts; nScripts++)
|
||||
{
|
||||
string name = sr.Load(string.Format("CustomScript{0}Name", nScripts));
|
||||
string code = sr.Load(string.Format("CustomScript{0}Code", nScripts));
|
||||
List<CUEAction> conditions = new List<CUEAction>();
|
||||
int totalConditions = sr.LoadInt32(string.Format("CustomScript{0}Conditions", nScripts), 0, null) ?? 0;
|
||||
for (int nCondition = 0; nCondition < totalConditions; nCondition++)
|
||||
conditions.Add((CUEAction)sr.LoadInt32(string.Format("CustomScript{0}Condition{1}", nScripts, nCondition), 0, null));
|
||||
CUEToolsScript script;
|
||||
if (!scripts.TryGetValue(name, out script))
|
||||
{
|
||||
if (name != "submit")
|
||||
scripts.Add(name, new CUEToolsScript(name, false, conditions, code));
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!script.builtin)
|
||||
{
|
||||
script.code = code;
|
||||
script.conditions = conditions;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
defaultVerifyScript = sr.Load("DefaultVerifyScript") ?? "default";
|
||||
defaultEncodeScript = sr.Load("DefaultVerifyAndConvertScript") ?? "default";
|
||||
|
||||
|
||||
@@ -8,7 +8,6 @@ using System.IO;
|
||||
using System.Net;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using CSScriptLibrary;
|
||||
using CUETools.AccurateRip;
|
||||
using CUETools.CDImage;
|
||||
using CUETools.CTDB;
|
||||
@@ -4274,9 +4273,6 @@ namespace CUETools.Processor
|
||||
|
||||
public string ExecuteScript(CUEToolsScript script)
|
||||
{
|
||||
if (!script.builtin)
|
||||
return ExecuteScript(script.code);
|
||||
|
||||
switch (script.name)
|
||||
{
|
||||
case "default":
|
||||
@@ -4363,30 +4359,6 @@ namespace CUETools.Processor
|
||||
return "internal error";
|
||||
}
|
||||
|
||||
public string ExecuteScript(string script)
|
||||
{
|
||||
AsmHelper helper = CompileScript(script);
|
||||
return (string)helper.Invoke("*.Execute", this);
|
||||
}
|
||||
|
||||
public static AsmHelper CompileScript(string script)
|
||||
{
|
||||
//CSScript.GlobalSettings.InMemoryAsssembly = true;
|
||||
//CSScript.GlobalSettings.HideAutoGeneratedFiles =
|
||||
//CSScript.CacheEnabled = false;
|
||||
return new AsmHelper(CSScript.LoadCode("using System; using System.Windows.Forms; using System.Net; using CUETools.Processor; using CUETools.Codecs; using CUETools.AccurateRip; public class Script { "
|
||||
+ "public static string Execute(CUESheet processor) { \r\n"
|
||||
+ script
|
||||
+ "\r\n } "
|
||||
+ " }", null, true));
|
||||
}
|
||||
|
||||
public static bool TryCompileScript(string script)
|
||||
{
|
||||
AsmHelper helper = CompileScript(script);
|
||||
return helper != null;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Events
|
||||
|
||||
@@ -57,10 +57,6 @@
|
||||
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="CSScriptLibrary.v1.1, Version=2.3.2.0, Culture=neutral">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\ThirdParty\CSScriptLibrary.v1.1.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Drawing" />
|
||||
|
||||
@@ -5,20 +5,16 @@ namespace CUETools.Processor
|
||||
public class CUEToolsScript
|
||||
{
|
||||
public string name { get; set; }
|
||||
public bool builtin;
|
||||
public List<CUEAction> conditions;
|
||||
public string code;
|
||||
|
||||
public CUEToolsScript(string _name, bool _builtin, IEnumerable<CUEAction> _conditions, string _code)
|
||||
public CUEToolsScript(string _name, IEnumerable<CUEAction> _conditions)
|
||||
{
|
||||
name = _name;
|
||||
builtin = _builtin;
|
||||
conditions = new List<CUEAction>();
|
||||
foreach (CUEAction condition in _conditions)
|
||||
{
|
||||
conditions.Add(condition);
|
||||
}
|
||||
code = _code;
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
|
||||
16
CUETools/frmCUETools.Designer.cs
generated
16
CUETools/frmCUETools.Designer.cs
generated
@@ -100,6 +100,7 @@ namespace JDP {
|
||||
this.txtPreGapLength = new System.Windows.Forms.MaskedTextBox();
|
||||
this.labelDataTrack = new System.Windows.Forms.Label();
|
||||
this.txtDataTrackLength = new System.Windows.Forms.MaskedTextBox();
|
||||
this.textBoxOffset = new System.Windows.Forms.TextBox();
|
||||
this.panelGo = new System.Windows.Forms.Panel();
|
||||
this.btnConvert = new System.Windows.Forms.Button();
|
||||
this.btnStop = new System.Windows.Forms.Button();
|
||||
@@ -128,7 +129,6 @@ namespace JDP {
|
||||
this.updateLocalDatabaseToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.locateInExplorerToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.backgroundWorkerAddToLocalDB = new System.ComponentModel.BackgroundWorker();
|
||||
this.textBoxOffset = new System.Windows.Forms.TextBox();
|
||||
this.toolStripContainer1.BottomToolStripPanel.SuspendLayout();
|
||||
this.toolStripContainer1.ContentPanel.SuspendLayout();
|
||||
this.toolStripContainer1.TopToolStripPanel.SuspendLayout();
|
||||
@@ -833,6 +833,13 @@ namespace JDP {
|
||||
this.txtDataTrackLength.TextMaskFormat = System.Windows.Forms.MaskFormat.IncludePromptAndLiterals;
|
||||
this.toolTip1.SetToolTip(this.txtDataTrackLength, resources.GetString("txtDataTrackLength.ToolTip"));
|
||||
//
|
||||
// textBoxOffset
|
||||
//
|
||||
resources.ApplyResources(this.textBoxOffset, "textBoxOffset");
|
||||
this.textBoxOffset.Name = "textBoxOffset";
|
||||
this.textBoxOffset.TextChanged += new System.EventHandler(this.textBoxOffset_TextChanged);
|
||||
this.textBoxOffset.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.textBoxOffset_KeyPress);
|
||||
//
|
||||
// panelGo
|
||||
//
|
||||
this.panelGo.Controls.Add(this.btnConvert);
|
||||
@@ -1042,13 +1049,6 @@ namespace JDP {
|
||||
this.backgroundWorkerAddToLocalDB.DoWork += new System.ComponentModel.DoWorkEventHandler(this.backgroundWorkerAddToLocalDB_DoWork);
|
||||
this.backgroundWorkerAddToLocalDB.RunWorkerCompleted += new System.ComponentModel.RunWorkerCompletedEventHandler(this.backgroundWorkerAddToLocalDB_RunWorkerCompleted);
|
||||
//
|
||||
// textBoxOffset
|
||||
//
|
||||
resources.ApplyResources(this.textBoxOffset, "textBoxOffset");
|
||||
this.textBoxOffset.Name = "textBoxOffset";
|
||||
this.textBoxOffset.TextChanged += new System.EventHandler(this.textBoxOffset_TextChanged);
|
||||
this.textBoxOffset.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.textBoxOffset_KeyPress);
|
||||
//
|
||||
// frmCUETools
|
||||
//
|
||||
resources.ApplyResources(this, "$this");
|
||||
|
||||
@@ -1025,7 +1025,7 @@ namespace JDP
|
||||
if (outputExists.Count == 0)
|
||||
{
|
||||
cueSheet.UsePregapForFirstTrackInSingleFile = _usePregapForFirstTrackInSingleFile && !outputAudio;
|
||||
if (script == null || (script.builtin && script.name == "default"))
|
||||
if (script == null || script.name == "default")
|
||||
{
|
||||
status = cueSheet.Go();
|
||||
if (cueSheet.Config.advanced.CTDBSubmit
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
95
CUETools/frmSettings.Designer.cs
generated
95
CUETools/frmSettings.Designer.cs
generated
@@ -164,14 +164,6 @@ namespace JDP
|
||||
this.tabPage4 = new System.Windows.Forms.TabPage();
|
||||
this.grpHDCD = new System.Windows.Forms.GroupBox();
|
||||
this.chkHDCDDetect = new System.Windows.Forms.CheckBox();
|
||||
this.tabPage5 = new System.Windows.Forms.TabPage();
|
||||
this.richTextBoxScript = new System.Windows.Forms.RichTextBox();
|
||||
this.buttonScriptCompile = new System.Windows.Forms.Button();
|
||||
this.groupBoxScriptConditions = new System.Windows.Forms.GroupBox();
|
||||
this.listViewScriptConditions = new System.Windows.Forms.ListView();
|
||||
this.columnHeader6 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
|
||||
this.listViewScripts = new System.Windows.Forms.ListView();
|
||||
this.columnHeader5 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
|
||||
this.tabPage7 = new System.Windows.Forms.TabPage();
|
||||
this.propertyGrid1 = new System.Windows.Forms.PropertyGrid();
|
||||
this.labelFormatDecoder = new System.Windows.Forms.Label();
|
||||
@@ -217,8 +209,6 @@ namespace JDP
|
||||
this.panel2.SuspendLayout();
|
||||
this.tabPage4.SuspendLayout();
|
||||
this.grpHDCD.SuspendLayout();
|
||||
this.tabPage5.SuspendLayout();
|
||||
this.groupBoxScriptConditions.SuspendLayout();
|
||||
this.tabPage7.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
@@ -668,7 +658,6 @@ namespace JDP
|
||||
this.tabControl1.Controls.Add(this.tabPageEncoders);
|
||||
this.tabControl1.Controls.Add(this.tabPage11);
|
||||
this.tabControl1.Controls.Add(this.tabPage4);
|
||||
this.tabControl1.Controls.Add(this.tabPage5);
|
||||
this.tabControl1.Controls.Add(this.tabPage7);
|
||||
this.tabControl1.HotTrack = true;
|
||||
this.tabControl1.Multiline = true;
|
||||
@@ -1316,80 +1305,6 @@ namespace JDP
|
||||
this.chkHDCDDetect.UseVisualStyleBackColor = true;
|
||||
this.chkHDCDDetect.CheckedChanged += new System.EventHandler(this.chkHDCDDetect_CheckedChanged);
|
||||
//
|
||||
// tabPage5
|
||||
//
|
||||
this.tabPage5.BackColor = System.Drawing.SystemColors.Control;
|
||||
this.tabPage5.Controls.Add(this.richTextBoxScript);
|
||||
this.tabPage5.Controls.Add(this.buttonScriptCompile);
|
||||
this.tabPage5.Controls.Add(this.groupBoxScriptConditions);
|
||||
this.tabPage5.Controls.Add(this.listViewScripts);
|
||||
resources.ApplyResources(this.tabPage5, "tabPage5");
|
||||
this.tabPage5.Name = "tabPage5";
|
||||
//
|
||||
// richTextBoxScript
|
||||
//
|
||||
this.richTextBoxScript.AcceptsTab = true;
|
||||
this.richTextBoxScript.DetectUrls = false;
|
||||
resources.ApplyResources(this.richTextBoxScript, "richTextBoxScript");
|
||||
this.richTextBoxScript.Name = "richTextBoxScript";
|
||||
//
|
||||
// buttonScriptCompile
|
||||
//
|
||||
resources.ApplyResources(this.buttonScriptCompile, "buttonScriptCompile");
|
||||
this.buttonScriptCompile.Name = "buttonScriptCompile";
|
||||
this.buttonScriptCompile.UseVisualStyleBackColor = true;
|
||||
this.buttonScriptCompile.Click += new System.EventHandler(this.buttonScriptCompile_Click);
|
||||
//
|
||||
// groupBoxScriptConditions
|
||||
//
|
||||
this.groupBoxScriptConditions.Controls.Add(this.listViewScriptConditions);
|
||||
resources.ApplyResources(this.groupBoxScriptConditions, "groupBoxScriptConditions");
|
||||
this.groupBoxScriptConditions.Name = "groupBoxScriptConditions";
|
||||
this.groupBoxScriptConditions.TabStop = false;
|
||||
//
|
||||
// listViewScriptConditions
|
||||
//
|
||||
this.listViewScriptConditions.BackColor = System.Drawing.SystemColors.Control;
|
||||
this.listViewScriptConditions.BorderStyle = System.Windows.Forms.BorderStyle.None;
|
||||
this.listViewScriptConditions.CheckBoxes = true;
|
||||
this.listViewScriptConditions.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
|
||||
this.columnHeader6});
|
||||
this.listViewScriptConditions.FullRowSelect = true;
|
||||
this.listViewScriptConditions.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.None;
|
||||
resources.ApplyResources(this.listViewScriptConditions, "listViewScriptConditions");
|
||||
this.listViewScriptConditions.MultiSelect = false;
|
||||
this.listViewScriptConditions.Name = "listViewScriptConditions";
|
||||
this.listViewScriptConditions.UseCompatibleStateImageBehavior = false;
|
||||
this.listViewScriptConditions.View = System.Windows.Forms.View.Details;
|
||||
//
|
||||
// columnHeader6
|
||||
//
|
||||
resources.ApplyResources(this.columnHeader6, "columnHeader6");
|
||||
//
|
||||
// listViewScripts
|
||||
//
|
||||
this.listViewScripts.BackColor = System.Drawing.SystemColors.Control;
|
||||
this.listViewScripts.BorderStyle = System.Windows.Forms.BorderStyle.None;
|
||||
this.listViewScripts.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
|
||||
this.columnHeader5});
|
||||
this.listViewScripts.FullRowSelect = true;
|
||||
this.listViewScripts.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.None;
|
||||
this.listViewScripts.HideSelection = false;
|
||||
this.listViewScripts.LabelEdit = true;
|
||||
resources.ApplyResources(this.listViewScripts, "listViewScripts");
|
||||
this.listViewScripts.MultiSelect = false;
|
||||
this.listViewScripts.Name = "listViewScripts";
|
||||
this.listViewScripts.UseCompatibleStateImageBehavior = false;
|
||||
this.listViewScripts.View = System.Windows.Forms.View.Details;
|
||||
this.listViewScripts.AfterLabelEdit += new System.Windows.Forms.LabelEditEventHandler(this.listViewScripts_AfterLabelEdit);
|
||||
this.listViewScripts.BeforeLabelEdit += new System.Windows.Forms.LabelEditEventHandler(this.listViewScripts_BeforeLabelEdit);
|
||||
this.listViewScripts.ItemSelectionChanged += new System.Windows.Forms.ListViewItemSelectionChangedEventHandler(this.listViewScripts_ItemSelectionChanged);
|
||||
this.listViewScripts.KeyDown += new System.Windows.Forms.KeyEventHandler(this.listViewScripts_KeyDown);
|
||||
//
|
||||
// columnHeader5
|
||||
//
|
||||
resources.ApplyResources(this.columnHeader5, "columnHeader5");
|
||||
//
|
||||
// tabPage7
|
||||
//
|
||||
this.tabPage7.BackColor = System.Drawing.SystemColors.Control;
|
||||
@@ -1495,8 +1410,6 @@ namespace JDP
|
||||
this.tabPage4.PerformLayout();
|
||||
this.grpHDCD.ResumeLayout(false);
|
||||
this.grpHDCD.PerformLayout();
|
||||
this.tabPage5.ResumeLayout(false);
|
||||
this.groupBoxScriptConditions.ResumeLayout(false);
|
||||
this.tabPage7.ResumeLayout(false);
|
||||
this.ResumeLayout(false);
|
||||
|
||||
@@ -1581,14 +1494,6 @@ namespace JDP
|
||||
private System.Windows.Forms.CheckBox checkBoxFormatAllowLossy;
|
||||
private System.Windows.Forms.ComboBox comboFormatLossyEncoder;
|
||||
private System.Windows.Forms.Label labelFormatLossyEncoder;
|
||||
private System.Windows.Forms.TabPage tabPage5;
|
||||
private System.Windows.Forms.GroupBox groupBoxScriptConditions;
|
||||
private System.Windows.Forms.ListView listViewScripts;
|
||||
private System.Windows.Forms.ColumnHeader columnHeader5;
|
||||
private System.Windows.Forms.ListView listViewScriptConditions;
|
||||
private System.Windows.Forms.ColumnHeader columnHeader6;
|
||||
private System.Windows.Forms.Button buttonScriptCompile;
|
||||
private System.Windows.Forms.RichTextBox richTextBoxScript;
|
||||
private System.Windows.Forms.GroupBox groupBox4;
|
||||
private System.Windows.Forms.GroupBox groupBox5;
|
||||
private System.Windows.Forms.Label label2;
|
||||
|
||||
@@ -138,17 +138,6 @@ namespace JDP
|
||||
comboBoxFormatTagger.Items.Add(CUEToolsTagger.TagLibSharp);
|
||||
comboBoxFormatTagger.Items.Add(CUEToolsTagger.APEv2);
|
||||
comboBoxFormatTagger.Items.Add(CUEToolsTagger.ID3v2);
|
||||
foreach (KeyValuePair<string, CUEToolsScript> script in _config.scripts)
|
||||
{
|
||||
ListViewItem item = new ListViewItem(script.Key);
|
||||
item.Tag = script.Value;
|
||||
listViewScripts.Items.Add(item);
|
||||
}
|
||||
ComponentResourceManager resources = new ComponentResourceManager(typeof(frmCUETools));
|
||||
listViewScriptConditions.Items.Add(resources.GetString("rbActionVerify.Text").Replace("&", ""));
|
||||
listViewScriptConditions.Items.Add(resources.GetString("rbActionEncode.Text").Replace("&", ""));
|
||||
listViewScriptConditions.Items[0].Tag = CUEAction.Verify;
|
||||
listViewScriptConditions.Items[1].Tag = CUEAction.Encode;
|
||||
|
||||
if (m_encoder != null)
|
||||
{
|
||||
@@ -196,8 +185,6 @@ namespace JDP
|
||||
{
|
||||
if (listViewFormats.SelectedIndices.Count > 0)
|
||||
listViewFormats.Items[listViewFormats.SelectedIndices[0]].Selected = false;
|
||||
if (listViewScripts.SelectedItems.Count > 0)
|
||||
listViewScripts.SelectedItems[0].Selected = false;
|
||||
|
||||
_reducePriority = chkReducePriority.Checked;
|
||||
_config.checkForUpdates = checkBoxCheckForUpdates.Checked;
|
||||
@@ -305,8 +292,6 @@ namespace JDP
|
||||
{
|
||||
if (listViewFormats.SelectedItems.Count > 0)
|
||||
listViewFormats.SelectedItems[0].Selected = false;
|
||||
if (listViewScripts.SelectedItems.Count > 0)
|
||||
listViewScripts.SelectedItems[0].Selected = false;
|
||||
}
|
||||
|
||||
private void listViewFormats_BeforeLabelEdit(object sender, LabelEditEventArgs e)
|
||||
@@ -555,172 +540,6 @@ namespace JDP
|
||||
labelDecoderExtension.ImageKey = "." + (string)comboBoxDecoderExtension.SelectedItem;
|
||||
}
|
||||
|
||||
private void listViewScripts_BeforeLabelEdit(object sender, LabelEditEventArgs e)
|
||||
{
|
||||
CUEToolsScript script = (CUEToolsScript)listViewScripts.Items[e.Item].Tag;
|
||||
if (script.builtin)
|
||||
e.CancelEdit = true;
|
||||
}
|
||||
|
||||
private void listViewScripts_AfterLabelEdit(object sender, LabelEditEventArgs e)
|
||||
{
|
||||
CUEToolsScript script;
|
||||
if (e.Label == null || _config.scripts.TryGetValue(e.Label, out script))
|
||||
{
|
||||
e.CancelEdit = true;
|
||||
return;
|
||||
}
|
||||
script = (CUEToolsScript)listViewScripts.Items[e.Item].Tag;
|
||||
if (script.builtin)
|
||||
{
|
||||
e.CancelEdit = true;
|
||||
return;
|
||||
}
|
||||
_config.scripts.Remove(script.name);
|
||||
script.name = e.Label;
|
||||
_config.scripts.Add(script.name, script);
|
||||
}
|
||||
|
||||
private void listViewScripts_KeyDown(object sender, KeyEventArgs e)
|
||||
{
|
||||
switch (e.KeyCode)
|
||||
{
|
||||
case Keys.Insert:
|
||||
{
|
||||
CUEToolsScript script;
|
||||
if (_config.scripts.TryGetValue("new", out script))
|
||||
return;
|
||||
script = new CUEToolsScript("new", false, new CUEAction[] {}, "");
|
||||
_config.scripts.Add("new", script);
|
||||
ListViewItem item = new ListViewItem(script.name);
|
||||
item.Tag = script;
|
||||
listViewScripts.Items.Add(item);
|
||||
item.BeginEdit();
|
||||
break;
|
||||
}
|
||||
case Keys.Delete:
|
||||
{
|
||||
if (listViewScripts.SelectedItems.Count <= 0)
|
||||
return;
|
||||
CUEToolsScript script = (CUEToolsScript)listViewScripts.SelectedItems[0].Tag;
|
||||
if (script.builtin)
|
||||
return;
|
||||
_config.scripts.Remove(script.name);
|
||||
listViewScripts.Items.Remove(listViewScripts.SelectedItems[0]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void listViewScripts_ItemSelectionChanged(object sender, ListViewItemSelectionChangedEventArgs e)
|
||||
{
|
||||
if (e.IsSelected)
|
||||
{
|
||||
CUEToolsScript script = (CUEToolsScript)e.Item.Tag;
|
||||
if (script == null) return;
|
||||
foreach (ListViewItem item in listViewScriptConditions.Items)
|
||||
item.Checked = script.conditions.Contains((CUEAction)item.Tag);
|
||||
groupBoxScriptConditions.Visible = true;
|
||||
richTextBoxScript.Text = script.code;
|
||||
richTextBoxScript.Visible = true;
|
||||
buttonScriptCompile.Visible = true;
|
||||
|
||||
groupBoxScriptConditions.Enabled =
|
||||
buttonScriptCompile.Enabled =
|
||||
!script.builtin;
|
||||
richTextBoxScript.ReadOnly = script.builtin;
|
||||
}
|
||||
else
|
||||
{
|
||||
CUEToolsScript script = (CUEToolsScript)e.Item.Tag;
|
||||
if (script == null) return;
|
||||
if (!script.builtin)
|
||||
{
|
||||
script.conditions.Clear();
|
||||
foreach (ListViewItem item in listViewScriptConditions.Items)
|
||||
if (item.Checked)
|
||||
script.conditions.Add((CUEAction)item.Tag);
|
||||
script.code = richTextBoxScript.Text;
|
||||
}
|
||||
groupBoxScriptConditions.Visible = false;
|
||||
richTextBoxScript.Visible = false;
|
||||
buttonScriptCompile.Visible = false;
|
||||
}
|
||||
}
|
||||
|
||||
private static int WordLength(string text, int pos)
|
||||
{
|
||||
if (pos >= text.Length)
|
||||
return 1;
|
||||
if ((text[pos] >= 'a' && text[pos] <= 'z') ||
|
||||
(text[pos] >= 'A' && text[pos] <= 'Z') ||
|
||||
(text[pos] == '_'))
|
||||
{
|
||||
for (int len = 1; len < text.Length - pos; len++)
|
||||
{
|
||||
bool ok = (text[pos + len] >= 'a' && text[pos + len] <= 'z') ||
|
||||
(text[pos + len] >= 'A' && text[pos + len] <= 'Z') ||
|
||||
(text[pos + len] == '_');
|
||||
if (!ok)
|
||||
return len;
|
||||
}
|
||||
return text.Length - pos;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
private void buttonScriptCompile_Click(object sender, EventArgs e)
|
||||
{
|
||||
richTextBoxScript.SelectAll();
|
||||
richTextBoxScript.SelectionColor = richTextBoxScript.ForeColor;
|
||||
richTextBoxScript.DeselectAll();
|
||||
try
|
||||
{
|
||||
CUESheet.TryCompileScript(richTextBoxScript.Text);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
using (StringWriter sw = new StringWriter())
|
||||
{
|
||||
using (StringReader sr = new StringReader(ex.Message))
|
||||
{
|
||||
string lineStr;
|
||||
while ((lineStr = sr.ReadLine()) != null)
|
||||
{
|
||||
string[] s = { ".tmp(" };
|
||||
string[] n = lineStr.Split(s, 2, StringSplitOptions.None);
|
||||
if (n.Length == 2)
|
||||
{
|
||||
string[] n2 = n[1].Split(")".ToCharArray(), 2);
|
||||
if (n2.Length == 2)
|
||||
{
|
||||
string[] n3 = n2[0].Split(",".ToCharArray(), 2);
|
||||
int row, col;
|
||||
if (n3.Length == 2 && int.TryParse(n3[0], out row) && int.TryParse(n3[1], out col) && row > 1)
|
||||
{
|
||||
int pos = richTextBoxScript.GetFirstCharIndexFromLine(row - 2);
|
||||
if (pos >= 0)
|
||||
{
|
||||
pos += col - 1;
|
||||
richTextBoxScript.Select(pos, WordLength(richTextBoxScript.Text, pos));
|
||||
richTextBoxScript.SelectionColor = Color.Red;
|
||||
richTextBoxScript.DeselectAll();
|
||||
}
|
||||
}
|
||||
}
|
||||
sw.WriteLine("({0}", n[1]);
|
||||
}
|
||||
else
|
||||
sw.WriteLine("{0}", lineStr);
|
||||
}
|
||||
}
|
||||
MessageBox.Show(this, sw.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
return;
|
||||
}
|
||||
MessageBox.Show(this, "Script compiled successfully.", "Ok", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
}
|
||||
|
||||
private void buttonEncoderAdd_Click(object sender, EventArgs e)
|
||||
{
|
||||
encodersBindingSource.AddNew();
|
||||
|
||||
@@ -3920,168 +3920,6 @@
|
||||
<data name=">>tabPage4.ZOrder" xml:space="preserve">
|
||||
<value>6</value>
|
||||
</data>
|
||||
<data name="richTextBoxScript.Font" type="System.Drawing.Font, System.Drawing">
|
||||
<value>Courier New, 8pt</value>
|
||||
</data>
|
||||
<data name="richTextBoxScript.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>144, 110</value>
|
||||
</data>
|
||||
<data name="richTextBoxScript.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>382, 167</value>
|
||||
</data>
|
||||
<data name="richTextBoxScript.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>28</value>
|
||||
</data>
|
||||
<data name="richTextBoxScript.Text" xml:space="preserve">
|
||||
<value />
|
||||
</data>
|
||||
<data name="richTextBoxScript.Visible" type="System.Boolean, mscorlib">
|
||||
<value>False</value>
|
||||
</data>
|
||||
<data name="richTextBoxScript.WordWrap" type="System.Boolean, mscorlib">
|
||||
<value>False</value>
|
||||
</data>
|
||||
<data name=">>richTextBoxScript.Name" xml:space="preserve">
|
||||
<value>richTextBoxScript</value>
|
||||
</data>
|
||||
<data name=">>richTextBoxScript.Type" xml:space="preserve">
|
||||
<value>System.Windows.Forms.RichTextBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name=">>richTextBoxScript.Parent" xml:space="preserve">
|
||||
<value>tabPage5</value>
|
||||
</data>
|
||||
<data name=">>richTextBoxScript.ZOrder" xml:space="preserve">
|
||||
<value>0</value>
|
||||
</data>
|
||||
<data name="buttonScriptCompile.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
|
||||
<value>NoControl</value>
|
||||
</data>
|
||||
<data name="buttonScriptCompile.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>422, 19</value>
|
||||
</data>
|
||||
<data name="buttonScriptCompile.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>75, 23</value>
|
||||
</data>
|
||||
<data name="buttonScriptCompile.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>27</value>
|
||||
</data>
|
||||
<data name="buttonScriptCompile.Text" xml:space="preserve">
|
||||
<value>Compile</value>
|
||||
</data>
|
||||
<data name="buttonScriptCompile.Visible" type="System.Boolean, mscorlib">
|
||||
<value>False</value>
|
||||
</data>
|
||||
<data name=">>buttonScriptCompile.Name" xml:space="preserve">
|
||||
<value>buttonScriptCompile</value>
|
||||
</data>
|
||||
<data name=">>buttonScriptCompile.Type" xml:space="preserve">
|
||||
<value>System.Windows.Forms.Button, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name=">>buttonScriptCompile.Parent" xml:space="preserve">
|
||||
<value>tabPage5</value>
|
||||
</data>
|
||||
<data name=">>buttonScriptCompile.ZOrder" xml:space="preserve">
|
||||
<value>1</value>
|
||||
</data>
|
||||
<data name="columnHeader6.Width" type="System.Int32, mscorlib">
|
||||
<value>200</value>
|
||||
</data>
|
||||
<data name="listViewScriptConditions.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>6, 20</value>
|
||||
</data>
|
||||
<data name="listViewScriptConditions.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>249, 77</value>
|
||||
</data>
|
||||
<data name="listViewScriptConditions.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>2</value>
|
||||
</data>
|
||||
<data name=">>listViewScriptConditions.Name" xml:space="preserve">
|
||||
<value>listViewScriptConditions</value>
|
||||
</data>
|
||||
<data name=">>listViewScriptConditions.Type" xml:space="preserve">
|
||||
<value>System.Windows.Forms.ListView, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name=">>listViewScriptConditions.Parent" xml:space="preserve">
|
||||
<value>groupBoxScriptConditions</value>
|
||||
</data>
|
||||
<data name=">>listViewScriptConditions.ZOrder" xml:space="preserve">
|
||||
<value>0</value>
|
||||
</data>
|
||||
<data name="groupBoxScriptConditions.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>144, 7</value>
|
||||
</data>
|
||||
<data name="groupBoxScriptConditions.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>261, 101</value>
|
||||
</data>
|
||||
<data name="groupBoxScriptConditions.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>2</value>
|
||||
</data>
|
||||
<data name="groupBoxScriptConditions.Text" xml:space="preserve">
|
||||
<value>Conditions</value>
|
||||
</data>
|
||||
<data name="groupBoxScriptConditions.Visible" type="System.Boolean, mscorlib">
|
||||
<value>False</value>
|
||||
</data>
|
||||
<data name=">>groupBoxScriptConditions.Name" xml:space="preserve">
|
||||
<value>groupBoxScriptConditions</value>
|
||||
</data>
|
||||
<data name=">>groupBoxScriptConditions.Type" xml:space="preserve">
|
||||
<value>System.Windows.Forms.GroupBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name=">>groupBoxScriptConditions.Parent" xml:space="preserve">
|
||||
<value>tabPage5</value>
|
||||
</data>
|
||||
<data name=">>groupBoxScriptConditions.ZOrder" xml:space="preserve">
|
||||
<value>2</value>
|
||||
</data>
|
||||
<data name="columnHeader5.Width" type="System.Int32, mscorlib">
|
||||
<value>120</value>
|
||||
</data>
|
||||
<data name="listViewScripts.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>6, 6</value>
|
||||
</data>
|
||||
<data name="listViewScripts.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>124, 271</value>
|
||||
</data>
|
||||
<data name="listViewScripts.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>1</value>
|
||||
</data>
|
||||
<data name=">>listViewScripts.Name" xml:space="preserve">
|
||||
<value>listViewScripts</value>
|
||||
</data>
|
||||
<data name=">>listViewScripts.Type" xml:space="preserve">
|
||||
<value>System.Windows.Forms.ListView, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name=">>listViewScripts.Parent" xml:space="preserve">
|
||||
<value>tabPage5</value>
|
||||
</data>
|
||||
<data name=">>listViewScripts.ZOrder" xml:space="preserve">
|
||||
<value>3</value>
|
||||
</data>
|
||||
<data name="tabPage5.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>4, 22</value>
|
||||
</data>
|
||||
<data name="tabPage5.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>535, 291</value>
|
||||
</data>
|
||||
<data name="tabPage5.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>8</value>
|
||||
</data>
|
||||
<data name="tabPage5.Text" xml:space="preserve">
|
||||
<value>Scripts</value>
|
||||
</data>
|
||||
<data name=">>tabPage5.Name" xml:space="preserve">
|
||||
<value>tabPage5</value>
|
||||
</data>
|
||||
<data name=">>tabPage5.Type" xml:space="preserve">
|
||||
<value>System.Windows.Forms.TabPage, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name=">>tabPage5.Parent" xml:space="preserve">
|
||||
<value>tabControl1</value>
|
||||
</data>
|
||||
<data name=">>tabPage5.ZOrder" xml:space="preserve">
|
||||
<value>7</value>
|
||||
</data>
|
||||
<data name="propertyGrid1.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>8, 6</value>
|
||||
</data>
|
||||
@@ -4128,7 +3966,7 @@
|
||||
<value>tabControl1</value>
|
||||
</data>
|
||||
<data name=">>tabPage7.ZOrder" xml:space="preserve">
|
||||
<value>8</value>
|
||||
<value>7</value>
|
||||
</data>
|
||||
<data name="tabControl1.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>0, 0</value>
|
||||
@@ -4280,18 +4118,6 @@
|
||||
<data name=">>columnHeader1.Type" xml:space="preserve">
|
||||
<value>System.Windows.Forms.ColumnHeader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name=">>columnHeader6.Name" xml:space="preserve">
|
||||
<value>columnHeader6</value>
|
||||
</data>
|
||||
<data name=">>columnHeader6.Type" xml:space="preserve">
|
||||
<value>System.Windows.Forms.ColumnHeader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name=">>columnHeader5.Name" xml:space="preserve">
|
||||
<value>columnHeader5</value>
|
||||
</data>
|
||||
<data name=">>columnHeader5.Type" xml:space="preserve">
|
||||
<value>System.Windows.Forms.ColumnHeader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name=">>columnHeader2.Name" xml:space="preserve">
|
||||
<value>columnHeader2</value>
|
||||
</data>
|
||||
|
||||
Reference in New Issue
Block a user