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()
|
||||
|
||||
Reference in New Issue
Block a user