add RMSE method, MatchCount option
This commit is contained in:
parent
6b37c1c326
commit
fd78232340
9 changed files with 910 additions and 829 deletions
|
@ -13,7 +13,7 @@ using System.Runtime.InteropServices;
|
|||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("supAutoSplit")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2021 sup39[サポミク]")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2021-2022 sup39[サポミク]")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
|
|
|
@ -12,157 +12,161 @@ using OpenCvSharp;
|
|||
|
||||
namespace LiveSplit.SupAutoSplit {
|
||||
public sealed class Component : LogicComponent {
|
||||
public override string ComponentName => "supAutoSplit";
|
||||
private UI.Settings Settings { get; set; }
|
||||
private LiveSplitState State { get; set; }
|
||||
private TimerModel Model { get; }
|
||||
public override string ComponentName => "supAutoSplit";
|
||||
private UI.Settings Settings { get; set; }
|
||||
private LiveSplitState State { get; set; }
|
||||
private TimerModel Model { get; }
|
||||
|
||||
public Component(LiveSplitState state) {
|
||||
Settings = new UI.Settings();
|
||||
State = state;
|
||||
Model = new TimerModel {
|
||||
CurrentState = state
|
||||
};
|
||||
public Component(LiveSplitState state) {
|
||||
// TODO
|
||||
Environment.SetEnvironmentVariable("OPENCV_VIDEOIO_MSMF_ENABLE_HW_TRANSFORMS", "0", EnvironmentVariableTarget.User);
|
||||
Settings = new UI.Settings();
|
||||
State = state;
|
||||
Model = new TimerModel {
|
||||
CurrentState = state
|
||||
};
|
||||
|
||||
ContextMenuControls = new Dictionary<string, Action> {
|
||||
{ "Start supAutoSplit", Start }
|
||||
};
|
||||
}
|
||||
ContextMenuControls = new Dictionary<string, Action> {
|
||||
{ "Start supAutoSplit", Start }
|
||||
};
|
||||
}
|
||||
|
||||
private Thread captureThread;
|
||||
private List<MatchHandler> handlersAll;
|
||||
private List<MatchHandler> handlers;
|
||||
private volatile bool handlerReady = false;
|
||||
private void UpdateHandlers(object sender, EventArgs e) {
|
||||
handlers = handlersAll.Where(h => h.Reset(State)).ToList();
|
||||
handlerReady = true;
|
||||
}
|
||||
private void UpdateHandlers_Reset(object sender, TimerPhase e) => UpdateHandlers(null, null);
|
||||
private void Start() {
|
||||
ContextMenuControls.Clear();
|
||||
ContextMenuControls.Add("Reload supAutoSplit", Reload);
|
||||
ContextMenuControls.Add("Stop supAutoSplit", Stop);
|
||||
private Thread captureThread;
|
||||
private List<MatchHandler> handlersAll;
|
||||
private List<MatchHandler> handlers;
|
||||
private volatile bool handlerReady = false;
|
||||
private void UpdateHandlers(object sender, EventArgs e) {
|
||||
handlers = handlersAll.Where(h => h.Reset(State)).ToList();
|
||||
handlerReady = true;
|
||||
}
|
||||
private void UpdateHandlers_Reset(object sender, TimerPhase e) => UpdateHandlers(null, null);
|
||||
private void Start() {
|
||||
ContextMenuControls.Clear();
|
||||
ContextMenuControls.Add("Reload supAutoSplit", Reload);
|
||||
ContextMenuControls.Add("Stop supAutoSplit", Stop);
|
||||
|
||||
Reload();
|
||||
State.OnStart += UpdateHandlers;
|
||||
State.OnSplit += UpdateHandlers;
|
||||
State.OnSkipSplit += UpdateHandlers;
|
||||
State.OnUndoSplit += UpdateHandlers;
|
||||
State.OnPause += UpdateHandlers;
|
||||
State.OnResume += UpdateHandlers;
|
||||
State.OnReset += UpdateHandlers_Reset;
|
||||
Reload();
|
||||
State.OnStart += UpdateHandlers;
|
||||
State.OnSplit += UpdateHandlers;
|
||||
State.OnSkipSplit += UpdateHandlers;
|
||||
State.OnUndoSplit += UpdateHandlers;
|
||||
State.OnPause += UpdateHandlers;
|
||||
State.OnResume += UpdateHandlers;
|
||||
State.OnReset += UpdateHandlers_Reset;
|
||||
|
||||
captureThread = new Thread(() => {
|
||||
using (var capture = new VideoCapture(Settings.CaptureDevice))
|
||||
using (var window = new Window(Settings.WindowName))
|
||||
using (Mat frame = new Mat()) {
|
||||
try {
|
||||
// Stopwatch sw = new Stopwatch();
|
||||
// Stopwatch sw1 = new Stopwatch();
|
||||
// Stopwatch sw2 = new Stopwatch();
|
||||
// sw.Start();
|
||||
while (capture.Read(frame)) {
|
||||
// sw1.Restart();
|
||||
if (handlerReady) {
|
||||
foreach (var handler in handlers) {
|
||||
if (handler.Match(frame)) {
|
||||
handlerReady = false;
|
||||
handler.Action(Model);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
// sw1.Stop();
|
||||
// sw2.Restart();
|
||||
window.ShowImage(frame);
|
||||
// sw2.Stop();
|
||||
// sw.Stop();
|
||||
// Debug.WriteLine($"{sw1.ElapsedMilliseconds:#0} ({sw1.ElapsedTicks}) {sw2.ElapsedMilliseconds:#0} ({sw2.ElapsedTicks}) {sw.ElapsedMilliseconds:#0}");
|
||||
Cv2.WaitKey(1);
|
||||
// sw.Restart();
|
||||
}
|
||||
} catch (ThreadInterruptedException) {}
|
||||
}
|
||||
});
|
||||
captureThread.Start();
|
||||
}
|
||||
private void Reload() {
|
||||
handlersAll = Settings.TemplateSettings.Select(o => new MatchHandler(o)).ToList();
|
||||
UpdateHandlers(null, null);
|
||||
}
|
||||
private void Stop() {
|
||||
captureThread?.Abort();
|
||||
captureThread = null;
|
||||
captureThread = new Thread(() => {
|
||||
using (var capture = new VideoCapture(Settings.CaptureDevice))
|
||||
using (var window = new Window(Settings.WindowName))
|
||||
using (Mat frame = new Mat()) {
|
||||
try {
|
||||
// Stopwatch sw = new Stopwatch();
|
||||
// Stopwatch sw1 = new Stopwatch();
|
||||
// Stopwatch sw2 = new Stopwatch();
|
||||
// sw.Start();
|
||||
while (capture.Read(frame)) {
|
||||
// sw1.Restart();
|
||||
if (handlerReady) {
|
||||
foreach (var handler in handlers) {
|
||||
if (handler.Match(frame)) {
|
||||
handlerReady = false;
|
||||
handler.Action(Model);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
// sw1.Stop();
|
||||
// sw2.Restart();
|
||||
window.ShowImage(frame);
|
||||
// sw2.Stop();
|
||||
// sw.Stop();
|
||||
// Debug.WriteLine($"{sw1.ElapsedMilliseconds:#0} ({sw1.ElapsedTicks}) {sw2.ElapsedMilliseconds:#0} ({sw2.ElapsedTicks}) {sw.ElapsedMilliseconds:#0}");
|
||||
Cv2.WaitKey(1);
|
||||
// sw.Restart();
|
||||
}
|
||||
} catch (ThreadInterruptedException) { }
|
||||
}
|
||||
});
|
||||
captureThread.Start();
|
||||
}
|
||||
private void Reload() {
|
||||
handlersAll = Settings.TemplateSettings.Select(o => new MatchHandler(o)).ToList();
|
||||
UpdateHandlers(null, null);
|
||||
}
|
||||
private void Stop() {
|
||||
captureThread?.Abort();
|
||||
captureThread = null;
|
||||
|
||||
State.OnStart -= UpdateHandlers;
|
||||
State.OnSplit -= UpdateHandlers;
|
||||
State.OnSkipSplit -= UpdateHandlers;
|
||||
State.OnUndoSplit -= UpdateHandlers;
|
||||
State.OnPause -= UpdateHandlers;
|
||||
State.OnResume -= UpdateHandlers;
|
||||
State.OnReset -= UpdateHandlers_Reset;
|
||||
State.OnStart -= UpdateHandlers;
|
||||
State.OnSplit -= UpdateHandlers;
|
||||
State.OnSkipSplit -= UpdateHandlers;
|
||||
State.OnUndoSplit -= UpdateHandlers;
|
||||
State.OnPause -= UpdateHandlers;
|
||||
State.OnResume -= UpdateHandlers;
|
||||
State.OnReset -= UpdateHandlers_Reset;
|
||||
|
||||
ContextMenuControls.Clear();
|
||||
ContextMenuControls.Add("Start supAutoSplit", Start);
|
||||
}
|
||||
ContextMenuControls.Clear();
|
||||
ContextMenuControls.Add("Start supAutoSplit", Start);
|
||||
}
|
||||
|
||||
public override void Dispose() {
|
||||
captureThread?.Abort();
|
||||
}
|
||||
public override void Dispose() {
|
||||
captureThread?.Abort();
|
||||
}
|
||||
|
||||
public override XmlNode GetSettings(XmlDocument document) => Settings.GetSettings(document);
|
||||
public override Control GetSettingsControl(LayoutMode mode) => Settings;
|
||||
public int GetSettingsHashCode() => Settings.GetSettingsHashCode();
|
||||
public override void SetSettings(XmlNode settings) => Settings.SetSettings(settings);
|
||||
public override void Update(IInvalidator invalidator, LiveSplitState state, float width, float height, LayoutMode mode) {}
|
||||
public override XmlNode GetSettings(XmlDocument document) => Settings.GetSettings(document);
|
||||
public override Control GetSettingsControl(LayoutMode mode) => Settings;
|
||||
public int GetSettingsHashCode() => Settings.GetSettingsHashCode();
|
||||
public override void SetSettings(XmlNode settings) => Settings.SetSettings(settings);
|
||||
public override void Update(IInvalidator invalidator, LiveSplitState state, float width, float height, LayoutMode mode) { }
|
||||
}
|
||||
}
|
||||
|
||||
namespace LiveSplit.SupAutoSplit {
|
||||
class MatchHandler {
|
||||
private readonly Predicate<LiveSplitState> fEnabled;
|
||||
private readonly Rect imageRange;
|
||||
private readonly Func<Mat, double> fSim;
|
||||
private readonly Predicate<double> fMatch;
|
||||
private readonly Predicate<double> fMatchNeg;
|
||||
public Action<TimerModel> Action { get; }
|
||||
private bool ready = false;
|
||||
private readonly Predicate<LiveSplitState> fEnabled;
|
||||
private readonly Rect imageRange;
|
||||
private readonly Func<Mat, double> fSim;
|
||||
private readonly Predicate<double> fMatch;
|
||||
private readonly Predicate<double> fMatchNeg;
|
||||
public Action<TimerModel> Action { get; }
|
||||
private int ready = 0;
|
||||
private readonly int maxReady;
|
||||
private int count = 0;
|
||||
private readonly int maxCount;
|
||||
|
||||
public MatchHandler(UI.TemplateSettings settings) {
|
||||
fEnabled = settings.EnableIf;
|
||||
using (var timg = Cv2.ImRead(settings.ImagePath, ImreadModes.Unchanged)) {
|
||||
imageRange = new Rect(settings.ImageOffset, timg.Size());
|
||||
fSim = settings.MatchMethodFactory(timg);
|
||||
}
|
||||
var threshold = settings.MatchThreshold;
|
||||
var thresholdNeg = settings.MatchThresholdNeg;
|
||||
if (thresholdNeg <= 0) thresholdNeg = threshold;
|
||||
if (settings.IsActionOnPosedge) {
|
||||
fMatch = sim => sim <= threshold;
|
||||
fMatchNeg = sim => sim >= thresholdNeg;
|
||||
} else {
|
||||
fMatch = sim => sim >= threshold;
|
||||
fMatchNeg = sim => sim <= thresholdNeg;
|
||||
}
|
||||
Action = settings.MatchAction;
|
||||
}
|
||||
public MatchHandler(UI.TemplateSettings settings) {
|
||||
fEnabled = settings.EnableIf;
|
||||
using (var timg = Cv2.ImRead(settings.ImagePath, ImreadModes.Unchanged)) {
|
||||
imageRange = new Rect(settings.ImageOffset, timg.Size());
|
||||
fSim = settings.MatchMethodFactory(timg);
|
||||
}
|
||||
var threshold = settings.MatchThreshold;
|
||||
var thresholdNeg = settings.MatchThresholdNeg;
|
||||
if (thresholdNeg <= 0) thresholdNeg = threshold;
|
||||
maxReady = settings.IsActionOnPosedge ? 1 : 2;
|
||||
fMatch = sim => sim <= threshold;
|
||||
fMatchNeg = sim => sim >= thresholdNeg;
|
||||
maxCount = settings.MatchCount;
|
||||
Action = settings.MatchAction;
|
||||
}
|
||||
|
||||
public bool Reset(LiveSplitState state) {
|
||||
ready = false;
|
||||
return fEnabled(state);
|
||||
}
|
||||
public bool Match(Mat frame) {
|
||||
// Stopwatch sw = new Stopwatch();
|
||||
var fimg = frame[imageRange];
|
||||
var sim = fSim(fimg);
|
||||
// sw.Stop();
|
||||
// Debug.WriteLine($"#sim {sim} | {sw.ElapsedMilliseconds} ({sw.ElapsedTicks})");
|
||||
if (ready) {
|
||||
return fMatch(sim);
|
||||
} else if (fMatchNeg(sim)) {
|
||||
ready = true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
public bool Reset(LiveSplitState state) {
|
||||
ready = count = 0;
|
||||
return fEnabled(state);
|
||||
}
|
||||
public bool Match(Mat frame) {
|
||||
// Stopwatch sw = new Stopwatch();
|
||||
var fimg = frame[imageRange];
|
||||
var sim = fSim(fimg);
|
||||
// sw.Stop();
|
||||
// Debug.WriteLine($"#sim {sim} | {sw.ElapsedMilliseconds} ({sw.ElapsedTicks})");
|
||||
Debug.WriteLine($"#[{count}/{maxCount}] {sim} {ready}");
|
||||
if (((ready & 1) == 0 ? fMatchNeg : fMatch)(sim)) {
|
||||
if (++ready > maxReady) {
|
||||
ready = 0;
|
||||
return ++count >= maxCount;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,11 +16,11 @@ namespace LiveSplit.SupAutoSplit {
|
|||
|
||||
public string UpdateName => ComponentName;
|
||||
|
||||
public string XMLURL => "https://301.sup39.ml/LiveSplit/supAutoSplit.xml"; // TODO
|
||||
public string XMLURL => "https://link.sup39.dev/LiveSplit/supAutoSplit.xml"; // TODO
|
||||
|
||||
public string UpdateURL => "https://301.sup39.ml/LiveSplit/supAutoSplit/update"; // TODO
|
||||
public string UpdateURL => "https://link.sup39.dev/LiveSplit/supAutoSplit/update"; // TODO
|
||||
|
||||
public Version Version => Version.Parse("0.1.0");
|
||||
public Version Version => Version.Parse("0.1.1");
|
||||
|
||||
public IComponent Create(LiveSplitState state) => new Component(state);
|
||||
}
|
||||
|
|
|
@ -15,110 +15,119 @@ namespace LiveSplit.SupAutoSplit {
|
|||
using MatchMethodFactory = Func<Mat, Func<Mat, double>>;
|
||||
|
||||
class MatchTemplate {
|
||||
static public readonly ListItem<EnableIfFactory>[] EnableIfFactories = {
|
||||
("Index", "Split Index in range", arg => {
|
||||
var testers = arg.Split(',').Select(s => {
|
||||
string[] ns = arg.Split(':');
|
||||
if (ns.Length == 0 || ns.Length > 3) return null;
|
||||
int start = 0, end = int.MaxValue, step = 1;
|
||||
if (ns[0] != "" && !int.TryParse(ns[0], out start)) return null;
|
||||
if (ns.Length == 1) return start < 0 ?
|
||||
(Func<int, int, bool>)((idx, len) => idx == len + start) :
|
||||
((idx, len) => idx==start);
|
||||
if (ns[1] != "" && !int.TryParse(ns[1], out end)) return null;
|
||||
if (ns.Length == 3 && ns[2] != "" && (!int.TryParse(ns[2], out step) || step==0)) return null;
|
||||
return (idx, len) => {
|
||||
int start1 = start<0 ? start+len : start;
|
||||
int end1 = end<0 ? end+len : end;
|
||||
return start1 <= idx && idx < end1 && (idx-start1)%step == 0;
|
||||
};
|
||||
}).Where(s => s!=null).ToList();
|
||||
return state => testers.Any(f => f(state.CurrentSplitIndex, state.Run.Count));
|
||||
}),
|
||||
("Name", "Split Name matches", arg => {
|
||||
try {
|
||||
var re = new Regex(arg);
|
||||
return state => state.CurrentSplit == null ? false : re.IsMatch(state.CurrentSplit.Name);
|
||||
} catch {
|
||||
// not regex
|
||||
return state => state.CurrentSplit == null ? false : state.CurrentSplit.Name == arg;
|
||||
}
|
||||
}),
|
||||
};
|
||||
static public readonly string[] EnableIfItems = EnableIfFactories.Select(e => e.text).ToArray();
|
||||
static public readonly ListItem<MatchAction>[] MatchActions = {
|
||||
("Start", "Start", model => model.Start()),
|
||||
("Split", "Split", model => model.Split()),
|
||||
("Skip", "Skip Split", model => model.SkipSplit()),
|
||||
("Undo", "Undo Split", model => model.UndoSplit()),
|
||||
("Reset", "Reset", model => model.Reset()),
|
||||
("Pause", "Pause", model => model.Pause()),
|
||||
};
|
||||
static public readonly string[] MatchActionItems = MatchActions.Select(e => e.text).ToArray();
|
||||
static public readonly ListItem<EnableIfFactory>[] EnableIfFactories = {
|
||||
("Index", "Split Index in range", arg => {
|
||||
var testers = arg.Split(',').Select(s => {
|
||||
string[] ns = s.Split(':');
|
||||
if (ns.Length == 0 || ns.Length > 3) return null;
|
||||
int start = 0, end = int.MaxValue, step = 1;
|
||||
if (ns[0] != "" && !int.TryParse(ns[0], out start)) return null;
|
||||
if (ns.Length == 1) return start < 0 ?
|
||||
(Func<int, int, bool>)((idx, len) => idx == len + start) :
|
||||
((idx, len) => idx==start);
|
||||
if (ns[1] != "" && !int.TryParse(ns[1], out end)) return null;
|
||||
if (ns.Length == 3 && ns[2] != "" && (!int.TryParse(ns[2], out step) || step==0)) return null;
|
||||
return (idx, len) => {
|
||||
int start1 = start<0 ? start+len : start;
|
||||
int end1 = end<0 ? end+len : end;
|
||||
return start1 <= idx && idx < end1 && (idx-start1)%step == 0;
|
||||
};
|
||||
}).Where(s => s!=null).ToList();
|
||||
return state => testers.Any(f => f(state.CurrentSplitIndex, state.Run.Count));
|
||||
}),
|
||||
("Name", "Split Name matches", arg => {
|
||||
try {
|
||||
var re = new Regex(arg);
|
||||
return state => state.CurrentSplit == null ? false : re.IsMatch(state.CurrentSplit.Name);
|
||||
} catch {
|
||||
// not regex
|
||||
return state => state.CurrentSplit == null ? false : state.CurrentSplit.Name == arg;
|
||||
}
|
||||
}),
|
||||
};
|
||||
static public readonly string[] EnableIfItems = EnableIfFactories.Select(e => e.text).ToArray();
|
||||
static public readonly ListItem<MatchAction>[] MatchActions = {
|
||||
("Start", "Start", model => model.Start()),
|
||||
("Split", "Split", model => model.Split()),
|
||||
("Skip", "Skip Split", model => model.SkipSplit()),
|
||||
("Undo", "Undo Split", model => model.UndoSplit()),
|
||||
("Reset", "Reset", model => model.Reset()),
|
||||
("Pause", "Pause", model => model.Pause()),
|
||||
};
|
||||
static public readonly string[] MatchActionItems = MatchActions.Select(e => e.text).ToArray();
|
||||
|
||||
static public readonly ListItem<bool>[] ActionTimings = {
|
||||
("Posedge", "Posedge: First Match after unmatch", true),
|
||||
("Negedge", "Negedge: First Unmatch after match", false),
|
||||
};
|
||||
static public readonly string[] ActionTimingItems = ActionTimings.Select(e => e.text).ToArray();
|
||||
static public readonly ListItem<bool>[] ActionTimings = {
|
||||
("Posedge", "Posedge: First Match after unmatch", true),
|
||||
("Negedge", "Negedge: First Unmatch after match", false),
|
||||
};
|
||||
static public readonly string[] ActionTimingItems = ActionTimings.Select(e => e.text).ToArray();
|
||||
|
||||
static public readonly ListItem<MatchMethodFactory>[] MatchMethodFactories = {
|
||||
("COSINE", "1 - Cosine Similarity", timg => {
|
||||
Mat[] bchs = timg.Split();
|
||||
Mat mask = bchs[3];
|
||||
Array.Resize(ref bchs, 3);
|
||||
Mat[] bimg = bchs.Select(m => (Mat)m.BitwiseAnd(mask)).ToArray();
|
||||
var b1 = Math.Sqrt(bimg.Select(m => m.Norm(NormTypes.L2SQR, mask)).Sum());
|
||||
return frame => {
|
||||
Mat[] fimg = frame.Split();
|
||||
var f1 = Math.Sqrt(fimg.Select(m => m.Norm(NormTypes.L2SQR, mask)).Sum());
|
||||
var fb = fimg.Zip(bimg, (mf, mb) => mf.Dot(mb)).Sum();
|
||||
fimg.ForEach(m => m.Release());
|
||||
return 1-fb/f1/b1;
|
||||
};
|
||||
}),
|
||||
("SQDIFF_NORM", "Normalized Squared Difference", timg => {
|
||||
Mat[] bimg = timg.Split();
|
||||
Mat mask = bimg[3];
|
||||
Array.Resize(ref bimg, 3);
|
||||
var b1 = Math.Sqrt(bimg.Select(m => m.Norm(NormTypes.L2SQR, mask)).Sum());
|
||||
return frame => {
|
||||
Mat[] fimg = frame.Split();
|
||||
var f1 = Math.Sqrt(fimg.Select(m => m.Norm(NormTypes.L2SQR, mask)).Sum());
|
||||
var d2 = fimg.Zip(bimg, (mf, mb) => Cv2.Norm(mf, mb, NormTypes.L2SQR, mask)).Sum();
|
||||
fimg.ForEach(m => m.Release());
|
||||
return d2/f1/b1;
|
||||
};
|
||||
}),
|
||||
("V128_BINARY", "V128 Binary Classification: MAX(R,G,B)<128 or not", timg => {
|
||||
Mat bimg;
|
||||
{
|
||||
Mat[] chs = timg.Split();
|
||||
if (chs.Length == 3) {
|
||||
using (Mat v = RGB2V(chs))
|
||||
bimg = v.LessThan(128);
|
||||
} else {
|
||||
bimg = chs[0].LessThan(128);
|
||||
}
|
||||
chs.ForEach(m => m.Release());
|
||||
}
|
||||
return frame => {
|
||||
Mat[] chs = frame.Split();
|
||||
using (Mat v = RGB2V(chs)) {
|
||||
chs.ForEach(ch => ch.Release());
|
||||
using (Mat fimg = v.LessThan(128))
|
||||
return Cv2.Mean(fimg.NotEquals(bimg)).ToDouble()/255.0;
|
||||
}
|
||||
};
|
||||
}),
|
||||
};
|
||||
static public readonly string[] MatchMethodItems = MatchMethodFactories.Select(e => e.text).ToArray();
|
||||
static public readonly ListItem<MatchMethodFactory>[] MatchMethodFactories = {
|
||||
("COSINE", "1 - Cosine Similarity", timg => {
|
||||
Mat[] bchs = timg.Split();
|
||||
Mat mask = bchs[3];
|
||||
Array.Resize(ref bchs, 3);
|
||||
Mat[] bimg = bchs.Select(m => (Mat)m.BitwiseAnd(mask)).ToArray();
|
||||
var b1 = Math.Sqrt(bimg.Select(m => m.Norm(NormTypes.L2SQR, mask)).Sum());
|
||||
return frame => {
|
||||
Mat[] fimg = frame.Split();
|
||||
var f1 = Math.Sqrt(fimg.Select(m => m.Norm(NormTypes.L2SQR, mask)).Sum());
|
||||
var fb = fimg.Zip(bimg, (mf, mb) => mf.Dot(mb)).Sum();
|
||||
fimg.ForEach(m => m.Release());
|
||||
return 1-fb/f1/b1;
|
||||
};
|
||||
}),
|
||||
("SQDIFF_NORM", "Normalized Squared Difference", timg => {
|
||||
Mat[] bimg = timg.Split();
|
||||
Mat mask = bimg[3];
|
||||
Array.Resize(ref bimg, 3);
|
||||
var b1 = Math.Sqrt(bimg.Select(m => m.Norm(NormTypes.L2SQR, mask)).Sum());
|
||||
return frame => {
|
||||
Mat[] fimg = frame.Split();
|
||||
var f1 = Math.Sqrt(fimg.Select(m => m.Norm(NormTypes.L2SQR, mask)).Sum());
|
||||
var d2 = fimg.Zip(bimg, (mf, mb) => Cv2.Norm(mf, mb, NormTypes.L2SQR, mask)).Sum();
|
||||
fimg.ForEach(m => m.Release());
|
||||
return d2/f1/b1;
|
||||
};
|
||||
}),
|
||||
("RMSE", "Root Mean Squared Error", timg => {
|
||||
Mat[] bimgs = timg.Split();
|
||||
Mat bimg = new Mat();
|
||||
Mat mask = bimgs[3];
|
||||
Array.Resize(ref bimgs, 3);
|
||||
Cv2.Merge(bimgs, bimg);
|
||||
var div = Math.Sqrt(3*bimg.Total())*255.0;
|
||||
return fimg => Math.Sqrt(Cv2.Norm(fimg, bimg, NormTypes.L2SQR, mask))/div;
|
||||
}),
|
||||
("V128_BINARY", "V128 Binary Classification: MAX(R,G,B)<128 or not", timg => {
|
||||
Mat bimg;
|
||||
{
|
||||
Mat[] chs = timg.Split();
|
||||
if (chs.Length == 3) {
|
||||
using (Mat v = RGB2V(chs))
|
||||
bimg = v.LessThan(128);
|
||||
} else {
|
||||
bimg = chs[0].LessThan(128);
|
||||
}
|
||||
chs.ForEach(m => m.Release());
|
||||
}
|
||||
return frame => {
|
||||
Mat[] chs = frame.Split();
|
||||
using (Mat v = RGB2V(chs)) {
|
||||
chs.ForEach(ch => ch.Release());
|
||||
using (Mat fimg = v.LessThan(128))
|
||||
return Cv2.Mean(fimg.NotEquals(bimg)).ToDouble()/255.0;
|
||||
}
|
||||
};
|
||||
}),
|
||||
};
|
||||
static public readonly string[] MatchMethodItems = MatchMethodFactories.Select(e => e.text).ToArray();
|
||||
|
||||
static public Mat RGB2V(Mat[] chs) {
|
||||
Mat m = new Mat();
|
||||
Cv2.Max(chs[0], chs[1], m);
|
||||
Cv2.Max(m, chs[2], m);
|
||||
return m;
|
||||
}
|
||||
static public Mat RGB2V(Mat[] chs) {
|
||||
Mat m = new Mat();
|
||||
Cv2.Max(chs[0], chs[1], m);
|
||||
Cv2.Max(m, chs[2], m);
|
||||
return m;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,79 +14,86 @@ using SupExtension;
|
|||
|
||||
namespace LiveSplit.SupAutoSplit.UI {
|
||||
public partial class Settings : UserControl {
|
||||
public int CaptureDevice = 0; // TODO
|
||||
public string WindowName = "supAutoSplit"; // TODO
|
||||
public List<TemplateSettings> TemplateSettings { get; set; } = new List<TemplateSettings>();
|
||||
public int CaptureDevice = 0; // TODO
|
||||
public string WindowName = "supAutoSplit"; // TODO
|
||||
public List<TemplateSettings> TemplateSettings { get; set; } = new List<TemplateSettings>();
|
||||
|
||||
public Settings() {
|
||||
InitializeComponent();
|
||||
}
|
||||
public XmlNode GetSettings(XmlDocument document) {
|
||||
var parent = document.CreateElement("Settings");
|
||||
CreateSettingsNode(document, parent);
|
||||
return parent;
|
||||
}
|
||||
public int GetSettingsHashCode() {
|
||||
return CreateSettingsNode(null, null);
|
||||
}
|
||||
public int CreateSettingsNode(XmlDocument document, XmlElement parent) {
|
||||
var hashCode =
|
||||
SettingsHelper.CreateSetting(document, parent, "Version", "1.0.0");
|
||||
// profile TODO
|
||||
var profileRoot = document?.CreateElement("Profile", parent);
|
||||
SettingsHelper.CreateSetting(document, profileRoot, "Name", "SMS Any%");
|
||||
// templates
|
||||
var templatesRoot = document?.CreateElement("Templates", profileRoot);
|
||||
foreach (var ts in TemplateSettings) {
|
||||
XmlElement templateParent = document?.CreateElement("Template", templatesRoot);
|
||||
hashCode ^= ts.CreateSettingsNode(document, templateParent);
|
||||
}
|
||||
// return
|
||||
return hashCode;
|
||||
}
|
||||
public Settings() {
|
||||
InitializeComponent();
|
||||
}
|
||||
public XmlNode GetSettings(XmlDocument document) {
|
||||
var parent = document.CreateElement("Settings");
|
||||
CreateSettingsNode(document, parent);
|
||||
return parent;
|
||||
}
|
||||
public int GetSettingsHashCode() {
|
||||
return CreateSettingsNode(null, null);
|
||||
}
|
||||
public int CreateSettingsNode(XmlDocument document, XmlElement parent) {
|
||||
var hashCode =
|
||||
SettingsHelper.CreateSetting(document, parent, "Version", "1.0.0");
|
||||
// profile TODO
|
||||
var profileRoot = document?.CreateElement("Profile", parent);
|
||||
SettingsHelper.CreateSetting(document, profileRoot, "Name", "SMS Any%");
|
||||
// templates
|
||||
var templatesRoot = document?.CreateElement("Templates", profileRoot);
|
||||
foreach (var ts in TemplateSettings) {
|
||||
XmlElement templateParent = document?.CreateElement("Template", templatesRoot);
|
||||
hashCode ^= ts.CreateSettingsNode(document, templateParent);
|
||||
}
|
||||
// return
|
||||
return hashCode;
|
||||
}
|
||||
|
||||
public void SetSettings(XmlNode settings) {
|
||||
if (settings == null) return;
|
||||
// profile
|
||||
var profileRoot = settings["Profile"];
|
||||
if (profileRoot == null) return;
|
||||
// template
|
||||
var templatesRoot = profileRoot["Templates"];
|
||||
if (templatesRoot == null) return;
|
||||
public void SetSettings(XmlNode settings) {
|
||||
if (settings == null) return;
|
||||
// profile
|
||||
var profileRoot = settings["Profile"];
|
||||
if (profileRoot == null) return;
|
||||
// template
|
||||
var templatesRoot = profileRoot["Templates"];
|
||||
if (templatesRoot == null) return;
|
||||
|
||||
// reset RowStyles
|
||||
var rs = tlpTemplates.RowStyles[0];
|
||||
tlpTemplates.RowStyles.Clear();
|
||||
tlpTemplates.RowStyles.Add(rs);
|
||||
// remove UI
|
||||
foreach (var ts in TemplateSettings) {
|
||||
tlpTemplates.Controls.Remove(ts);
|
||||
}
|
||||
tlpTemplates.RowCount = 1;
|
||||
// reinit TemplateSettings[]
|
||||
TemplateSettings.Clear();
|
||||
foreach (var templateParent in templatesRoot.ChildNodes) {
|
||||
AddTemplateSettings((XmlElement)templateParent);
|
||||
}
|
||||
}
|
||||
// reset RowStyles
|
||||
var rs = tlpTemplates.RowStyles[0];
|
||||
tlpTemplates.RowStyles.Clear();
|
||||
tlpTemplates.RowStyles.Add(rs);
|
||||
// remove UI
|
||||
foreach (var ts in TemplateSettings) {
|
||||
tlpTemplates.Controls.Remove(ts);
|
||||
}
|
||||
tlpTemplates.RowCount = 1;
|
||||
// reinit TemplateSettings[]
|
||||
TemplateSettings.Clear();
|
||||
foreach (var templateParent in templatesRoot.ChildNodes) {
|
||||
AddTemplateSettings((XmlElement)templateParent);
|
||||
}
|
||||
}
|
||||
|
||||
private void BtnAddTemplate_Click(object sender, EventArgs e) {
|
||||
AddTemplateSettings(null);
|
||||
}
|
||||
private void AddTemplateSettings(XmlElement settings) {
|
||||
var irow = tlpTemplates.RowCount;
|
||||
tlpTemplates.RowCount = irow + 1;
|
||||
tlpTemplates.RowStyles.Add(new RowStyle(SizeType.AutoSize));
|
||||
var v = new TemplateSettings(settings, o => {
|
||||
tlpTemplates.Controls.Remove(o);
|
||||
tlpTemplates.RowCount = irow;
|
||||
tlpTemplates.RowStyles.RemoveAt(irow);
|
||||
TemplateSettings.Remove(o);
|
||||
});
|
||||
// tlpTemplates.RowStyles.Add(new RowStyle(SizeType.Absolute, v.Height));
|
||||
// v.Width = tlpTemplates.Width;
|
||||
tlpTemplates.Controls.Add(v, 0, irow);
|
||||
TemplateSettings.Add(v);
|
||||
}
|
||||
private void BtnAddTemplate_Click(object sender, EventArgs e) {
|
||||
AddTemplateSettings(null);
|
||||
}
|
||||
private void AddTemplateSettings(XmlElement settings) {
|
||||
var irow = tlpTemplates.RowCount;
|
||||
tlpTemplates.RowCount = irow + 1;
|
||||
tlpTemplates.RowStyles.Insert(0, new RowStyle(SizeType.AutoSize));
|
||||
var v = new TemplateSettings(settings, o => {
|
||||
tlpTemplates.Controls.Remove(o);
|
||||
var irowD = tlpTemplates.RowCount - 1;
|
||||
tlpTemplates.RowCount = irowD;
|
||||
tlpTemplates.RowStyles.RemoveAt(0); // remove 1 TemplateSettings RowStyle
|
||||
TemplateSettings.Remove(o);
|
||||
// move button to the last row
|
||||
tlpTemplates.Controls.Remove(btnAddTemplate);
|
||||
tlpTemplates.Controls.Add(btnAddTemplate, 0, irowD - 1);
|
||||
});
|
||||
// move button to the last row
|
||||
tlpTemplates.Controls.Remove(btnAddTemplate);
|
||||
tlpTemplates.Controls.Add(btnAddTemplate, 0, irow);
|
||||
// add new template view
|
||||
tlpTemplates.Controls.Add(v, 0, irow - 1);
|
||||
TemplateSettings.Add(v);
|
||||
// TODO scroll to bottom
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,386 +23,435 @@
|
|||
/// コード エディターで変更しないでください。
|
||||
/// </summary>
|
||||
private void InitializeComponent() {
|
||||
this.ofdTemplate = new System.Windows.Forms.OpenFileDialog();
|
||||
this.gpbRoot = new System.Windows.Forms.GroupBox();
|
||||
this.tableLayoutPanel3 = new System.Windows.Forms.TableLayoutPanel();
|
||||
this.ttbThresholdNeg = new System.Windows.Forms.TextBox();
|
||||
this.cbbEnableIf = new System.Windows.Forms.ComboBox();
|
||||
this.cbbActionTiming = new System.Windows.Forms.ComboBox();
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
this.ttbThreshold = new System.Windows.Forms.TextBox();
|
||||
this.label10 = new System.Windows.Forms.Label();
|
||||
this.label7 = new System.Windows.Forms.Label();
|
||||
this.label5 = new System.Windows.Forms.Label();
|
||||
this.label4 = new System.Windows.Forms.Label();
|
||||
this.label2 = new System.Windows.Forms.Label();
|
||||
this.cbbAction = new System.Windows.Forms.ComboBox();
|
||||
this.ttbName = new System.Windows.Forms.TextBox();
|
||||
this.label9 = new System.Windows.Forms.Label();
|
||||
this.cbbMethod = new System.Windows.Forms.ComboBox();
|
||||
this.flowLayoutPanel3 = new System.Windows.Forms.FlowLayoutPanel();
|
||||
this.label12 = new System.Windows.Forms.Label();
|
||||
this.ttbOffsetX = new System.Windows.Forms.TextBox();
|
||||
this.label11 = new System.Windows.Forms.Label();
|
||||
this.ttbOffsetY = new System.Windows.Forms.TextBox();
|
||||
this.label13 = new System.Windows.Forms.Label();
|
||||
this.btnImage = new System.Windows.Forms.Button();
|
||||
this.ttbEnableIfArg = new System.Windows.Forms.TextBox();
|
||||
this.btnRemove = new System.Windows.Forms.Button();
|
||||
this.label3 = new System.Windows.Forms.Label();
|
||||
this.label6 = new System.Windows.Forms.Label();
|
||||
this.gpbRoot.SuspendLayout();
|
||||
this.tableLayoutPanel3.SuspendLayout();
|
||||
this.flowLayoutPanel3.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// ofdTemplate
|
||||
//
|
||||
this.ofdTemplate.Filter = "Image Files|*.bmp;*.pbm;*.pgm;*.ppm;*.sr;*.ras;*.jpeg;*.jpg;*.jpe;*.jp2;*.tiff;*." +
|
||||
this.components = new System.ComponentModel.Container();
|
||||
this.ofdTemplate = new System.Windows.Forms.OpenFileDialog();
|
||||
this.gpbRoot = new System.Windows.Forms.GroupBox();
|
||||
this.tableLayoutPanel3 = new System.Windows.Forms.TableLayoutPanel();
|
||||
this.label8 = new System.Windows.Forms.Label();
|
||||
this.ttbThresholdNeg = new System.Windows.Forms.TextBox();
|
||||
this.cbbEnableIf = new System.Windows.Forms.ComboBox();
|
||||
this.cbbActionTiming = new System.Windows.Forms.ComboBox();
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
this.ttbThreshold = new System.Windows.Forms.TextBox();
|
||||
this.label10 = new System.Windows.Forms.Label();
|
||||
this.label7 = new System.Windows.Forms.Label();
|
||||
this.label5 = new System.Windows.Forms.Label();
|
||||
this.label4 = new System.Windows.Forms.Label();
|
||||
this.label2 = new System.Windows.Forms.Label();
|
||||
this.cbbAction = new System.Windows.Forms.ComboBox();
|
||||
this.ttbName = new System.Windows.Forms.TextBox();
|
||||
this.label9 = new System.Windows.Forms.Label();
|
||||
this.cbbMethod = new System.Windows.Forms.ComboBox();
|
||||
this.flowLayoutPanel3 = new System.Windows.Forms.FlowLayoutPanel();
|
||||
this.label12 = new System.Windows.Forms.Label();
|
||||
this.ttbOffsetX = new System.Windows.Forms.TextBox();
|
||||
this.label11 = new System.Windows.Forms.Label();
|
||||
this.ttbOffsetY = new System.Windows.Forms.TextBox();
|
||||
this.label13 = new System.Windows.Forms.Label();
|
||||
this.btnImage = new System.Windows.Forms.Button();
|
||||
this.ttbEnableIfArg = new System.Windows.Forms.TextBox();
|
||||
this.btnRemove = new System.Windows.Forms.Button();
|
||||
this.label3 = new System.Windows.Forms.Label();
|
||||
this.label6 = new System.Windows.Forms.Label();
|
||||
this.nudMatchCount = new System.Windows.Forms.NumericUpDown();
|
||||
this.templateSettingsBindingSource = new System.Windows.Forms.BindingSource(this.components);
|
||||
this.gpbRoot.SuspendLayout();
|
||||
this.tableLayoutPanel3.SuspendLayout();
|
||||
this.flowLayoutPanel3.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.nudMatchCount)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.templateSettingsBindingSource)).BeginInit();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// ofdTemplate
|
||||
//
|
||||
this.ofdTemplate.Filter = "Image Files|*.bmp;*.pbm;*.pgm;*.ppm;*.sr;*.ras;*.jpeg;*.jpg;*.jpe;*.jp2;*.tiff;*." +
|
||||
"tif;*.png";
|
||||
//
|
||||
// gpbRoot
|
||||
//
|
||||
this.gpbRoot.AutoSize = true;
|
||||
this.gpbRoot.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
|
||||
this.gpbRoot.Controls.Add(this.tableLayoutPanel3);
|
||||
this.gpbRoot.DataBindings.Add(new System.Windows.Forms.Binding("Text", this, "TemplateTitle", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged));
|
||||
this.gpbRoot.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.gpbRoot.Location = new System.Drawing.Point(0, 0);
|
||||
this.gpbRoot.Name = "gpbRoot";
|
||||
this.gpbRoot.Size = new System.Drawing.Size(434, 314);
|
||||
this.gpbRoot.TabIndex = 16;
|
||||
this.gpbRoot.TabStop = false;
|
||||
this.gpbRoot.Text = "Template: ";
|
||||
//
|
||||
// tableLayoutPanel3
|
||||
//
|
||||
this.tableLayoutPanel3.ColumnCount = 3;
|
||||
this.tableLayoutPanel3.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
|
||||
this.tableLayoutPanel3.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 126F));
|
||||
this.tableLayoutPanel3.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
|
||||
this.tableLayoutPanel3.Controls.Add(this.ttbThresholdNeg, 1, 8);
|
||||
this.tableLayoutPanel3.Controls.Add(this.cbbEnableIf, 1, 1);
|
||||
this.tableLayoutPanel3.Controls.Add(this.cbbActionTiming, 1, 3);
|
||||
this.tableLayoutPanel3.Controls.Add(this.label1, 0, 2);
|
||||
this.tableLayoutPanel3.Controls.Add(this.ttbThreshold, 1, 7);
|
||||
this.tableLayoutPanel3.Controls.Add(this.label10, 0, 7);
|
||||
this.tableLayoutPanel3.Controls.Add(this.label7, 0, 0);
|
||||
this.tableLayoutPanel3.Controls.Add(this.label5, 0, 5);
|
||||
this.tableLayoutPanel3.Controls.Add(this.label4, 0, 4);
|
||||
this.tableLayoutPanel3.Controls.Add(this.label2, 0, 1);
|
||||
this.tableLayoutPanel3.Controls.Add(this.cbbAction, 1, 2);
|
||||
this.tableLayoutPanel3.Controls.Add(this.ttbName, 1, 0);
|
||||
this.tableLayoutPanel3.Controls.Add(this.label9, 0, 6);
|
||||
this.tableLayoutPanel3.Controls.Add(this.cbbMethod, 1, 6);
|
||||
this.tableLayoutPanel3.Controls.Add(this.flowLayoutPanel3, 1, 5);
|
||||
this.tableLayoutPanel3.Controls.Add(this.btnImage, 1, 4);
|
||||
this.tableLayoutPanel3.Controls.Add(this.ttbEnableIfArg, 2, 1);
|
||||
this.tableLayoutPanel3.Controls.Add(this.btnRemove, 2, 9);
|
||||
this.tableLayoutPanel3.Controls.Add(this.label3, 0, 3);
|
||||
this.tableLayoutPanel3.Controls.Add(this.label6, 0, 8);
|
||||
this.tableLayoutPanel3.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.tableLayoutPanel3.Location = new System.Drawing.Point(3, 18);
|
||||
this.tableLayoutPanel3.Name = "tableLayoutPanel3";
|
||||
this.tableLayoutPanel3.RowCount = 10;
|
||||
this.tableLayoutPanel3.RowStyles.Add(new System.Windows.Forms.RowStyle());
|
||||
this.tableLayoutPanel3.RowStyles.Add(new System.Windows.Forms.RowStyle());
|
||||
this.tableLayoutPanel3.RowStyles.Add(new System.Windows.Forms.RowStyle());
|
||||
this.tableLayoutPanel3.RowStyles.Add(new System.Windows.Forms.RowStyle());
|
||||
this.tableLayoutPanel3.RowStyles.Add(new System.Windows.Forms.RowStyle());
|
||||
this.tableLayoutPanel3.RowStyles.Add(new System.Windows.Forms.RowStyle());
|
||||
this.tableLayoutPanel3.RowStyles.Add(new System.Windows.Forms.RowStyle());
|
||||
this.tableLayoutPanel3.RowStyles.Add(new System.Windows.Forms.RowStyle());
|
||||
this.tableLayoutPanel3.RowStyles.Add(new System.Windows.Forms.RowStyle());
|
||||
this.tableLayoutPanel3.RowStyles.Add(new System.Windows.Forms.RowStyle());
|
||||
this.tableLayoutPanel3.Size = new System.Drawing.Size(428, 293);
|
||||
this.tableLayoutPanel3.TabIndex = 2;
|
||||
//
|
||||
// ttbThresholdNeg
|
||||
//
|
||||
this.tableLayoutPanel3.SetColumnSpan(this.ttbThresholdNeg, 2);
|
||||
this.ttbThresholdNeg.DataBindings.Add(new System.Windows.Forms.Binding("Text", this, "MatchThresholdNegStr", true));
|
||||
this.ttbThresholdNeg.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.ttbThresholdNeg.Location = new System.Drawing.Point(97, 239);
|
||||
this.ttbThresholdNeg.Name = "ttbThresholdNeg";
|
||||
this.ttbThresholdNeg.Size = new System.Drawing.Size(328, 22);
|
||||
this.ttbThresholdNeg.TabIndex = 28;
|
||||
//
|
||||
// cbbEnableIf
|
||||
//
|
||||
this.cbbEnableIf.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.cbbEnableIf.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||
this.cbbEnableIf.FormattingEnabled = true;
|
||||
this.cbbEnableIf.Location = new System.Drawing.Point(97, 31);
|
||||
this.cbbEnableIf.Name = "cbbEnableIf";
|
||||
this.cbbEnableIf.Size = new System.Drawing.Size(120, 20);
|
||||
this.cbbEnableIf.TabIndex = 26;
|
||||
//
|
||||
// cbbActionTiming
|
||||
//
|
||||
this.tableLayoutPanel3.SetColumnSpan(this.cbbActionTiming, 2);
|
||||
this.cbbActionTiming.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.cbbActionTiming.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||
this.cbbActionTiming.FormattingEnabled = true;
|
||||
this.cbbActionTiming.Location = new System.Drawing.Point(97, 85);
|
||||
this.cbbActionTiming.Name = "cbbActionTiming";
|
||||
this.cbbActionTiming.Size = new System.Drawing.Size(328, 20);
|
||||
this.cbbActionTiming.TabIndex = 25;
|
||||
//
|
||||
// label1
|
||||
//
|
||||
this.label1.AutoSize = true;
|
||||
this.label1.Location = new System.Drawing.Point(3, 59);
|
||||
this.label1.Margin = new System.Windows.Forms.Padding(3);
|
||||
this.label1.Name = "label1";
|
||||
this.label1.Padding = new System.Windows.Forms.Padding(3);
|
||||
this.label1.Size = new System.Drawing.Size(45, 18);
|
||||
this.label1.TabIndex = 22;
|
||||
this.label1.Text = "Action:";
|
||||
//
|
||||
// ttbThreshold
|
||||
//
|
||||
this.tableLayoutPanel3.SetColumnSpan(this.ttbThreshold, 2);
|
||||
this.ttbThreshold.DataBindings.Add(new System.Windows.Forms.Binding("Text", this, "MatchThresholdStr", true));
|
||||
this.ttbThreshold.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.ttbThreshold.Location = new System.Drawing.Point(97, 211);
|
||||
this.ttbThreshold.Name = "ttbThreshold";
|
||||
this.ttbThreshold.Size = new System.Drawing.Size(328, 22);
|
||||
this.ttbThreshold.TabIndex = 8;
|
||||
//
|
||||
// label10
|
||||
//
|
||||
this.label10.AutoSize = true;
|
||||
this.label10.Location = new System.Drawing.Point(3, 211);
|
||||
this.label10.Margin = new System.Windows.Forms.Padding(3);
|
||||
this.label10.Name = "label10";
|
||||
this.label10.Padding = new System.Windows.Forms.Padding(3);
|
||||
this.label10.Size = new System.Drawing.Size(87, 18);
|
||||
this.label10.TabIndex = 17;
|
||||
this.label10.Text = "Max Difference:";
|
||||
//
|
||||
// label7
|
||||
//
|
||||
this.label7.AutoSize = true;
|
||||
this.label7.Location = new System.Drawing.Point(3, 3);
|
||||
this.label7.Margin = new System.Windows.Forms.Padding(3);
|
||||
this.label7.Name = "label7";
|
||||
this.label7.Padding = new System.Windows.Forms.Padding(3);
|
||||
this.label7.Size = new System.Drawing.Size(41, 18);
|
||||
this.label7.TabIndex = 14;
|
||||
this.label7.Text = "Name:";
|
||||
//
|
||||
// label5
|
||||
//
|
||||
this.label5.AutoSize = true;
|
||||
this.label5.Location = new System.Drawing.Point(3, 157);
|
||||
this.label5.Margin = new System.Windows.Forms.Padding(3);
|
||||
this.label5.Name = "label5";
|
||||
this.label5.Padding = new System.Windows.Forms.Padding(3);
|
||||
this.label5.Size = new System.Drawing.Size(88, 18);
|
||||
this.label5.TabIndex = 6;
|
||||
this.label5.Text = "Template Offset:";
|
||||
//
|
||||
// label4
|
||||
//
|
||||
this.label4.AutoSize = true;
|
||||
this.label4.Location = new System.Drawing.Point(3, 111);
|
||||
this.label4.Margin = new System.Windows.Forms.Padding(3);
|
||||
this.label4.Name = "label4";
|
||||
this.label4.Padding = new System.Windows.Forms.Padding(3);
|
||||
this.label4.Size = new System.Drawing.Size(57, 18);
|
||||
this.label4.TabIndex = 5;
|
||||
this.label4.Text = "Template:";
|
||||
//
|
||||
// label2
|
||||
//
|
||||
this.label2.AutoSize = true;
|
||||
this.label2.Location = new System.Drawing.Point(3, 31);
|
||||
this.label2.Margin = new System.Windows.Forms.Padding(3);
|
||||
this.label2.Name = "label2";
|
||||
this.label2.Padding = new System.Windows.Forms.Padding(3);
|
||||
this.label2.Size = new System.Drawing.Size(57, 18);
|
||||
this.label2.TabIndex = 4;
|
||||
this.label2.Text = "Enable If:";
|
||||
//
|
||||
// cbbAction
|
||||
//
|
||||
this.tableLayoutPanel3.SetColumnSpan(this.cbbAction, 2);
|
||||
this.cbbAction.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.cbbAction.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||
this.cbbAction.FormattingEnabled = true;
|
||||
this.cbbAction.Location = new System.Drawing.Point(97, 59);
|
||||
this.cbbAction.Name = "cbbAction";
|
||||
this.cbbAction.Size = new System.Drawing.Size(328, 20);
|
||||
this.cbbAction.TabIndex = 3;
|
||||
//
|
||||
// ttbName
|
||||
//
|
||||
this.tableLayoutPanel3.SetColumnSpan(this.ttbName, 2);
|
||||
this.ttbName.DataBindings.Add(new System.Windows.Forms.Binding("Text", this, "TemplateName", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged));
|
||||
this.ttbName.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.ttbName.Location = new System.Drawing.Point(97, 3);
|
||||
this.ttbName.Name = "ttbName";
|
||||
this.ttbName.Size = new System.Drawing.Size(328, 22);
|
||||
this.ttbName.TabIndex = 1;
|
||||
//
|
||||
// label9
|
||||
//
|
||||
this.label9.AutoSize = true;
|
||||
this.label9.Location = new System.Drawing.Point(3, 185);
|
||||
this.label9.Margin = new System.Windows.Forms.Padding(3);
|
||||
this.label9.Name = "label9";
|
||||
this.label9.Padding = new System.Windows.Forms.Padding(3);
|
||||
this.label9.Size = new System.Drawing.Size(82, 18);
|
||||
this.label9.TabIndex = 16;
|
||||
this.label9.Text = "Match Method:";
|
||||
//
|
||||
// cbbMethod
|
||||
//
|
||||
this.tableLayoutPanel3.SetColumnSpan(this.cbbMethod, 2);
|
||||
this.cbbMethod.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.cbbMethod.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||
this.cbbMethod.FormattingEnabled = true;
|
||||
this.cbbMethod.Location = new System.Drawing.Point(97, 185);
|
||||
this.cbbMethod.Name = "cbbMethod";
|
||||
this.cbbMethod.Size = new System.Drawing.Size(328, 20);
|
||||
this.cbbMethod.TabIndex = 7;
|
||||
//
|
||||
// flowLayoutPanel3
|
||||
//
|
||||
this.flowLayoutPanel3.AutoSize = true;
|
||||
this.tableLayoutPanel3.SetColumnSpan(this.flowLayoutPanel3, 2);
|
||||
this.flowLayoutPanel3.Controls.Add(this.label12);
|
||||
this.flowLayoutPanel3.Controls.Add(this.ttbOffsetX);
|
||||
this.flowLayoutPanel3.Controls.Add(this.label11);
|
||||
this.flowLayoutPanel3.Controls.Add(this.ttbOffsetY);
|
||||
this.flowLayoutPanel3.Controls.Add(this.label13);
|
||||
this.flowLayoutPanel3.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.flowLayoutPanel3.Location = new System.Drawing.Point(94, 154);
|
||||
this.flowLayoutPanel3.Margin = new System.Windows.Forms.Padding(0);
|
||||
this.flowLayoutPanel3.Name = "flowLayoutPanel3";
|
||||
this.flowLayoutPanel3.Size = new System.Drawing.Size(334, 28);
|
||||
this.flowLayoutPanel3.TabIndex = 18;
|
||||
//
|
||||
// label12
|
||||
//
|
||||
this.label12.Anchor = System.Windows.Forms.AnchorStyles.Left;
|
||||
this.label12.AutoSize = true;
|
||||
this.label12.Location = new System.Drawing.Point(3, 8);
|
||||
this.label12.Margin = new System.Windows.Forms.Padding(3, 3, 0, 3);
|
||||
this.label12.Name = "label12";
|
||||
this.label12.Size = new System.Drawing.Size(9, 12);
|
||||
this.label12.TabIndex = 19;
|
||||
this.label12.Text = "(";
|
||||
//
|
||||
// ttbOffsetX
|
||||
//
|
||||
this.ttbOffsetX.DataBindings.Add(new System.Windows.Forms.Binding("Text", this, "ImageOffsetXStr", true));
|
||||
this.ttbOffsetX.Location = new System.Drawing.Point(15, 3);
|
||||
this.ttbOffsetX.Name = "ttbOffsetX";
|
||||
this.ttbOffsetX.Size = new System.Drawing.Size(48, 22);
|
||||
this.ttbOffsetX.TabIndex = 5;
|
||||
//
|
||||
// label11
|
||||
//
|
||||
this.label11.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.label11.AutoSize = true;
|
||||
this.label11.Location = new System.Drawing.Point(66, 13);
|
||||
this.label11.Margin = new System.Windows.Forms.Padding(0, 3, 0, 3);
|
||||
this.label11.Name = "label11";
|
||||
this.label11.Size = new System.Drawing.Size(11, 12);
|
||||
this.label11.TabIndex = 17;
|
||||
this.label11.Text = ", ";
|
||||
//
|
||||
// ttbOffsetY
|
||||
//
|
||||
this.ttbOffsetY.DataBindings.Add(new System.Windows.Forms.Binding("Text", this, "ImageOffsetYStr", true));
|
||||
this.ttbOffsetY.Location = new System.Drawing.Point(80, 3);
|
||||
this.ttbOffsetY.Name = "ttbOffsetY";
|
||||
this.ttbOffsetY.Size = new System.Drawing.Size(48, 22);
|
||||
this.ttbOffsetY.TabIndex = 6;
|
||||
//
|
||||
// label13
|
||||
//
|
||||
this.label13.Anchor = System.Windows.Forms.AnchorStyles.Left;
|
||||
this.label13.AutoSize = true;
|
||||
this.label13.Location = new System.Drawing.Point(131, 8);
|
||||
this.label13.Margin = new System.Windows.Forms.Padding(0, 3, 3, 3);
|
||||
this.label13.Name = "label13";
|
||||
this.label13.Size = new System.Drawing.Size(9, 12);
|
||||
this.label13.TabIndex = 20;
|
||||
this.label13.Text = ")";
|
||||
//
|
||||
// btnImage
|
||||
//
|
||||
this.btnImage.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
|
||||
this.tableLayoutPanel3.SetColumnSpan(this.btnImage, 2);
|
||||
this.btnImage.Location = new System.Drawing.Point(97, 111);
|
||||
this.btnImage.Name = "btnImage";
|
||||
this.btnImage.Size = new System.Drawing.Size(40, 40);
|
||||
this.btnImage.TabIndex = 4;
|
||||
this.btnImage.UseVisualStyleBackColor = true;
|
||||
this.btnImage.Click += new System.EventHandler(this.BtnTemplate_Click);
|
||||
//
|
||||
// ttbEnableIfArg
|
||||
//
|
||||
this.ttbEnableIfArg.DataBindings.Add(new System.Windows.Forms.Binding("Text", this, "EnableIfArg", true));
|
||||
this.ttbEnableIfArg.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.ttbEnableIfArg.Location = new System.Drawing.Point(223, 31);
|
||||
this.ttbEnableIfArg.Name = "ttbEnableIfArg";
|
||||
this.ttbEnableIfArg.Size = new System.Drawing.Size(202, 22);
|
||||
this.ttbEnableIfArg.TabIndex = 2;
|
||||
//
|
||||
// btnRemove
|
||||
//
|
||||
this.btnRemove.AutoSize = true;
|
||||
this.btnRemove.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
|
||||
this.btnRemove.Dock = System.Windows.Forms.DockStyle.Right;
|
||||
this.btnRemove.Location = new System.Drawing.Point(325, 267);
|
||||
this.btnRemove.Name = "btnRemove";
|
||||
this.btnRemove.Size = new System.Drawing.Size(100, 23);
|
||||
this.btnRemove.TabIndex = 23;
|
||||
this.btnRemove.TabStop = false;
|
||||
this.btnRemove.Text = "Remove Template";
|
||||
this.btnRemove.UseVisualStyleBackColor = true;
|
||||
this.btnRemove.Click += new System.EventHandler(this.BtnRemove_Click);
|
||||
//
|
||||
// label3
|
||||
//
|
||||
this.label3.AutoSize = true;
|
||||
this.label3.Location = new System.Drawing.Point(3, 85);
|
||||
this.label3.Margin = new System.Windows.Forms.Padding(3);
|
||||
this.label3.Name = "label3";
|
||||
this.label3.Padding = new System.Windows.Forms.Padding(3);
|
||||
this.label3.Size = new System.Drawing.Size(82, 18);
|
||||
this.label3.TabIndex = 24;
|
||||
this.label3.Text = "Action Timing:";
|
||||
//
|
||||
// label6
|
||||
//
|
||||
this.label6.AutoSize = true;
|
||||
this.label6.Location = new System.Drawing.Point(3, 239);
|
||||
this.label6.Margin = new System.Windows.Forms.Padding(3);
|
||||
this.label6.Name = "label6";
|
||||
this.label6.Padding = new System.Windows.Forms.Padding(3);
|
||||
this.label6.Size = new System.Drawing.Size(88, 18);
|
||||
this.label6.TabIndex = 27;
|
||||
this.label6.Text = "Ready Min Diff:";
|
||||
//
|
||||
// TemplateSettings
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.Controls.Add(this.gpbRoot);
|
||||
this.Name = "TemplateSettings";
|
||||
this.Size = new System.Drawing.Size(434, 314);
|
||||
this.gpbRoot.ResumeLayout(false);
|
||||
this.tableLayoutPanel3.ResumeLayout(false);
|
||||
this.tableLayoutPanel3.PerformLayout();
|
||||
this.flowLayoutPanel3.ResumeLayout(false);
|
||||
this.flowLayoutPanel3.PerformLayout();
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
//
|
||||
// gpbRoot
|
||||
//
|
||||
this.gpbRoot.AutoSize = true;
|
||||
this.gpbRoot.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
|
||||
this.gpbRoot.Controls.Add(this.tableLayoutPanel3);
|
||||
this.gpbRoot.DataBindings.Add(new System.Windows.Forms.Binding("Text", this, "TemplateTitle", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged));
|
||||
this.gpbRoot.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.gpbRoot.Location = new System.Drawing.Point(0, 0);
|
||||
this.gpbRoot.Name = "gpbRoot";
|
||||
this.gpbRoot.Size = new System.Drawing.Size(434, 318);
|
||||
this.gpbRoot.TabIndex = 16;
|
||||
this.gpbRoot.TabStop = false;
|
||||
this.gpbRoot.Text = "Template: ";
|
||||
//
|
||||
// tableLayoutPanel3
|
||||
//
|
||||
this.tableLayoutPanel3.ColumnCount = 3;
|
||||
this.tableLayoutPanel3.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
|
||||
this.tableLayoutPanel3.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 126F));
|
||||
this.tableLayoutPanel3.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
|
||||
this.tableLayoutPanel3.Controls.Add(this.label8, 0, 9);
|
||||
this.tableLayoutPanel3.Controls.Add(this.ttbThresholdNeg, 1, 8);
|
||||
this.tableLayoutPanel3.Controls.Add(this.cbbEnableIf, 1, 1);
|
||||
this.tableLayoutPanel3.Controls.Add(this.cbbActionTiming, 1, 3);
|
||||
this.tableLayoutPanel3.Controls.Add(this.label1, 0, 2);
|
||||
this.tableLayoutPanel3.Controls.Add(this.ttbThreshold, 1, 7);
|
||||
this.tableLayoutPanel3.Controls.Add(this.label10, 0, 7);
|
||||
this.tableLayoutPanel3.Controls.Add(this.label7, 0, 0);
|
||||
this.tableLayoutPanel3.Controls.Add(this.label5, 0, 5);
|
||||
this.tableLayoutPanel3.Controls.Add(this.label4, 0, 4);
|
||||
this.tableLayoutPanel3.Controls.Add(this.label2, 0, 1);
|
||||
this.tableLayoutPanel3.Controls.Add(this.cbbAction, 1, 2);
|
||||
this.tableLayoutPanel3.Controls.Add(this.ttbName, 1, 0);
|
||||
this.tableLayoutPanel3.Controls.Add(this.label9, 0, 6);
|
||||
this.tableLayoutPanel3.Controls.Add(this.cbbMethod, 1, 6);
|
||||
this.tableLayoutPanel3.Controls.Add(this.flowLayoutPanel3, 1, 5);
|
||||
this.tableLayoutPanel3.Controls.Add(this.btnImage, 1, 4);
|
||||
this.tableLayoutPanel3.Controls.Add(this.ttbEnableIfArg, 2, 1);
|
||||
this.tableLayoutPanel3.Controls.Add(this.btnRemove, 2, 10);
|
||||
this.tableLayoutPanel3.Controls.Add(this.label3, 0, 3);
|
||||
this.tableLayoutPanel3.Controls.Add(this.label6, 0, 8);
|
||||
this.tableLayoutPanel3.Controls.Add(this.nudMatchCount, 1, 9);
|
||||
this.tableLayoutPanel3.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.tableLayoutPanel3.Location = new System.Drawing.Point(3, 15);
|
||||
this.tableLayoutPanel3.Name = "tableLayoutPanel3";
|
||||
this.tableLayoutPanel3.RowCount = 11;
|
||||
this.tableLayoutPanel3.RowStyles.Add(new System.Windows.Forms.RowStyle());
|
||||
this.tableLayoutPanel3.RowStyles.Add(new System.Windows.Forms.RowStyle());
|
||||
this.tableLayoutPanel3.RowStyles.Add(new System.Windows.Forms.RowStyle());
|
||||
this.tableLayoutPanel3.RowStyles.Add(new System.Windows.Forms.RowStyle());
|
||||
this.tableLayoutPanel3.RowStyles.Add(new System.Windows.Forms.RowStyle());
|
||||
this.tableLayoutPanel3.RowStyles.Add(new System.Windows.Forms.RowStyle());
|
||||
this.tableLayoutPanel3.RowStyles.Add(new System.Windows.Forms.RowStyle());
|
||||
this.tableLayoutPanel3.RowStyles.Add(new System.Windows.Forms.RowStyle());
|
||||
this.tableLayoutPanel3.RowStyles.Add(new System.Windows.Forms.RowStyle());
|
||||
this.tableLayoutPanel3.RowStyles.Add(new System.Windows.Forms.RowStyle());
|
||||
this.tableLayoutPanel3.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F));
|
||||
this.tableLayoutPanel3.Size = new System.Drawing.Size(428, 300);
|
||||
this.tableLayoutPanel3.TabIndex = 2;
|
||||
//
|
||||
// label8
|
||||
//
|
||||
this.label8.AutoSize = true;
|
||||
this.label8.Location = new System.Drawing.Point(3, 253);
|
||||
this.label8.Margin = new System.Windows.Forms.Padding(3);
|
||||
this.label8.Name = "label8";
|
||||
this.label8.Padding = new System.Windows.Forms.Padding(3);
|
||||
this.label8.Size = new System.Drawing.Size(78, 18);
|
||||
this.label8.TabIndex = 29;
|
||||
this.label8.Text = "Match Count:";
|
||||
//
|
||||
// ttbThresholdNeg
|
||||
//
|
||||
this.tableLayoutPanel3.SetColumnSpan(this.ttbThresholdNeg, 2);
|
||||
this.ttbThresholdNeg.DataBindings.Add(new System.Windows.Forms.Binding("Text", this, "MatchThresholdNegStr", true));
|
||||
this.ttbThresholdNeg.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.ttbThresholdNeg.Location = new System.Drawing.Point(105, 228);
|
||||
this.ttbThresholdNeg.Name = "ttbThresholdNeg";
|
||||
this.ttbThresholdNeg.Size = new System.Drawing.Size(320, 19);
|
||||
this.ttbThresholdNeg.TabIndex = 28;
|
||||
//
|
||||
// cbbEnableIf
|
||||
//
|
||||
this.cbbEnableIf.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.cbbEnableIf.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||
this.cbbEnableIf.FormattingEnabled = true;
|
||||
this.cbbEnableIf.Location = new System.Drawing.Point(105, 28);
|
||||
this.cbbEnableIf.Name = "cbbEnableIf";
|
||||
this.cbbEnableIf.Size = new System.Drawing.Size(120, 20);
|
||||
this.cbbEnableIf.TabIndex = 26;
|
||||
//
|
||||
// cbbActionTiming
|
||||
//
|
||||
this.tableLayoutPanel3.SetColumnSpan(this.cbbActionTiming, 2);
|
||||
this.cbbActionTiming.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.cbbActionTiming.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||
this.cbbActionTiming.FormattingEnabled = true;
|
||||
this.cbbActionTiming.Location = new System.Drawing.Point(105, 80);
|
||||
this.cbbActionTiming.Name = "cbbActionTiming";
|
||||
this.cbbActionTiming.Size = new System.Drawing.Size(320, 20);
|
||||
this.cbbActionTiming.TabIndex = 25;
|
||||
//
|
||||
// label1
|
||||
//
|
||||
this.label1.AutoSize = true;
|
||||
this.label1.Location = new System.Drawing.Point(3, 54);
|
||||
this.label1.Margin = new System.Windows.Forms.Padding(3);
|
||||
this.label1.Name = "label1";
|
||||
this.label1.Padding = new System.Windows.Forms.Padding(3);
|
||||
this.label1.Size = new System.Drawing.Size(46, 18);
|
||||
this.label1.TabIndex = 22;
|
||||
this.label1.Text = "Action:";
|
||||
//
|
||||
// ttbThreshold
|
||||
//
|
||||
this.tableLayoutPanel3.SetColumnSpan(this.ttbThreshold, 2);
|
||||
this.ttbThreshold.DataBindings.Add(new System.Windows.Forms.Binding("Text", this, "MatchThresholdStr", true));
|
||||
this.ttbThreshold.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.ttbThreshold.Location = new System.Drawing.Point(105, 203);
|
||||
this.ttbThreshold.Name = "ttbThreshold";
|
||||
this.ttbThreshold.Size = new System.Drawing.Size(320, 19);
|
||||
this.ttbThreshold.TabIndex = 8;
|
||||
//
|
||||
// label10
|
||||
//
|
||||
this.label10.AutoSize = true;
|
||||
this.label10.Location = new System.Drawing.Point(3, 203);
|
||||
this.label10.Margin = new System.Windows.Forms.Padding(3);
|
||||
this.label10.Name = "label10";
|
||||
this.label10.Padding = new System.Windows.Forms.Padding(3);
|
||||
this.label10.Size = new System.Drawing.Size(91, 18);
|
||||
this.label10.TabIndex = 17;
|
||||
this.label10.Text = "Max Difference:";
|
||||
//
|
||||
// label7
|
||||
//
|
||||
this.label7.AutoSize = true;
|
||||
this.label7.Location = new System.Drawing.Point(3, 3);
|
||||
this.label7.Margin = new System.Windows.Forms.Padding(3);
|
||||
this.label7.Name = "label7";
|
||||
this.label7.Padding = new System.Windows.Forms.Padding(3);
|
||||
this.label7.Size = new System.Drawing.Size(42, 18);
|
||||
this.label7.TabIndex = 14;
|
||||
this.label7.Text = "Name:";
|
||||
//
|
||||
// label5
|
||||
//
|
||||
this.label5.AutoSize = true;
|
||||
this.label5.Location = new System.Drawing.Point(3, 152);
|
||||
this.label5.Margin = new System.Windows.Forms.Padding(3);
|
||||
this.label5.Name = "label5";
|
||||
this.label5.Padding = new System.Windows.Forms.Padding(3);
|
||||
this.label5.Size = new System.Drawing.Size(96, 18);
|
||||
this.label5.TabIndex = 6;
|
||||
this.label5.Text = "Template Offset:";
|
||||
//
|
||||
// label4
|
||||
//
|
||||
this.label4.AutoSize = true;
|
||||
this.label4.Location = new System.Drawing.Point(3, 106);
|
||||
this.label4.Margin = new System.Windows.Forms.Padding(3);
|
||||
this.label4.Name = "label4";
|
||||
this.label4.Padding = new System.Windows.Forms.Padding(3);
|
||||
this.label4.Size = new System.Drawing.Size(60, 18);
|
||||
this.label4.TabIndex = 5;
|
||||
this.label4.Text = "Template:";
|
||||
//
|
||||
// label2
|
||||
//
|
||||
this.label2.AutoSize = true;
|
||||
this.label2.Location = new System.Drawing.Point(3, 28);
|
||||
this.label2.Margin = new System.Windows.Forms.Padding(3);
|
||||
this.label2.Name = "label2";
|
||||
this.label2.Padding = new System.Windows.Forms.Padding(3);
|
||||
this.label2.Size = new System.Drawing.Size(58, 18);
|
||||
this.label2.TabIndex = 4;
|
||||
this.label2.Text = "Enable If:";
|
||||
//
|
||||
// cbbAction
|
||||
//
|
||||
this.tableLayoutPanel3.SetColumnSpan(this.cbbAction, 2);
|
||||
this.cbbAction.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.cbbAction.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||
this.cbbAction.FormattingEnabled = true;
|
||||
this.cbbAction.Location = new System.Drawing.Point(105, 54);
|
||||
this.cbbAction.Name = "cbbAction";
|
||||
this.cbbAction.Size = new System.Drawing.Size(320, 20);
|
||||
this.cbbAction.TabIndex = 3;
|
||||
//
|
||||
// ttbName
|
||||
//
|
||||
this.tableLayoutPanel3.SetColumnSpan(this.ttbName, 2);
|
||||
this.ttbName.DataBindings.Add(new System.Windows.Forms.Binding("Text", this, "TemplateName", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged));
|
||||
this.ttbName.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.ttbName.Location = new System.Drawing.Point(105, 3);
|
||||
this.ttbName.Name = "ttbName";
|
||||
this.ttbName.Size = new System.Drawing.Size(320, 19);
|
||||
this.ttbName.TabIndex = 1;
|
||||
//
|
||||
// label9
|
||||
//
|
||||
this.label9.AutoSize = true;
|
||||
this.label9.Location = new System.Drawing.Point(3, 177);
|
||||
this.label9.Margin = new System.Windows.Forms.Padding(3);
|
||||
this.label9.Name = "label9";
|
||||
this.label9.Padding = new System.Windows.Forms.Padding(3);
|
||||
this.label9.Size = new System.Drawing.Size(85, 18);
|
||||
this.label9.TabIndex = 16;
|
||||
this.label9.Text = "Match Method:";
|
||||
//
|
||||
// cbbMethod
|
||||
//
|
||||
this.tableLayoutPanel3.SetColumnSpan(this.cbbMethod, 2);
|
||||
this.cbbMethod.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.cbbMethod.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||
this.cbbMethod.FormattingEnabled = true;
|
||||
this.cbbMethod.Location = new System.Drawing.Point(105, 177);
|
||||
this.cbbMethod.Name = "cbbMethod";
|
||||
this.cbbMethod.Size = new System.Drawing.Size(320, 20);
|
||||
this.cbbMethod.TabIndex = 7;
|
||||
//
|
||||
// flowLayoutPanel3
|
||||
//
|
||||
this.flowLayoutPanel3.AutoSize = true;
|
||||
this.tableLayoutPanel3.SetColumnSpan(this.flowLayoutPanel3, 2);
|
||||
this.flowLayoutPanel3.Controls.Add(this.label12);
|
||||
this.flowLayoutPanel3.Controls.Add(this.ttbOffsetX);
|
||||
this.flowLayoutPanel3.Controls.Add(this.label11);
|
||||
this.flowLayoutPanel3.Controls.Add(this.ttbOffsetY);
|
||||
this.flowLayoutPanel3.Controls.Add(this.label13);
|
||||
this.flowLayoutPanel3.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.flowLayoutPanel3.Location = new System.Drawing.Point(102, 149);
|
||||
this.flowLayoutPanel3.Margin = new System.Windows.Forms.Padding(0);
|
||||
this.flowLayoutPanel3.Name = "flowLayoutPanel3";
|
||||
this.flowLayoutPanel3.Size = new System.Drawing.Size(326, 25);
|
||||
this.flowLayoutPanel3.TabIndex = 18;
|
||||
//
|
||||
// label12
|
||||
//
|
||||
this.label12.Anchor = System.Windows.Forms.AnchorStyles.Left;
|
||||
this.label12.AutoSize = true;
|
||||
this.label12.Location = new System.Drawing.Point(3, 6);
|
||||
this.label12.Margin = new System.Windows.Forms.Padding(3, 3, 0, 3);
|
||||
this.label12.Name = "label12";
|
||||
this.label12.Size = new System.Drawing.Size(9, 12);
|
||||
this.label12.TabIndex = 19;
|
||||
this.label12.Text = "(";
|
||||
//
|
||||
// ttbOffsetX
|
||||
//
|
||||
this.ttbOffsetX.DataBindings.Add(new System.Windows.Forms.Binding("Text", this, "ImageOffsetXStr", true));
|
||||
this.ttbOffsetX.Location = new System.Drawing.Point(15, 3);
|
||||
this.ttbOffsetX.Name = "ttbOffsetX";
|
||||
this.ttbOffsetX.Size = new System.Drawing.Size(48, 19);
|
||||
this.ttbOffsetX.TabIndex = 5;
|
||||
//
|
||||
// label11
|
||||
//
|
||||
this.label11.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.label11.AutoSize = true;
|
||||
this.label11.Location = new System.Drawing.Point(66, 10);
|
||||
this.label11.Margin = new System.Windows.Forms.Padding(0, 3, 0, 3);
|
||||
this.label11.Name = "label11";
|
||||
this.label11.Size = new System.Drawing.Size(11, 12);
|
||||
this.label11.TabIndex = 17;
|
||||
this.label11.Text = ", ";
|
||||
//
|
||||
// ttbOffsetY
|
||||
//
|
||||
this.ttbOffsetY.DataBindings.Add(new System.Windows.Forms.Binding("Text", this, "ImageOffsetYStr", true));
|
||||
this.ttbOffsetY.Location = new System.Drawing.Point(80, 3);
|
||||
this.ttbOffsetY.Name = "ttbOffsetY";
|
||||
this.ttbOffsetY.Size = new System.Drawing.Size(48, 19);
|
||||
this.ttbOffsetY.TabIndex = 6;
|
||||
//
|
||||
// label13
|
||||
//
|
||||
this.label13.Anchor = System.Windows.Forms.AnchorStyles.Left;
|
||||
this.label13.AutoSize = true;
|
||||
this.label13.Location = new System.Drawing.Point(131, 6);
|
||||
this.label13.Margin = new System.Windows.Forms.Padding(0, 3, 3, 3);
|
||||
this.label13.Name = "label13";
|
||||
this.label13.Size = new System.Drawing.Size(9, 12);
|
||||
this.label13.TabIndex = 20;
|
||||
this.label13.Text = ")";
|
||||
//
|
||||
// btnImage
|
||||
//
|
||||
this.btnImage.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
|
||||
this.tableLayoutPanel3.SetColumnSpan(this.btnImage, 2);
|
||||
this.btnImage.Location = new System.Drawing.Point(105, 106);
|
||||
this.btnImage.Name = "btnImage";
|
||||
this.btnImage.Size = new System.Drawing.Size(40, 40);
|
||||
this.btnImage.TabIndex = 4;
|
||||
this.btnImage.UseVisualStyleBackColor = true;
|
||||
this.btnImage.Click += new System.EventHandler(this.BtnTemplate_Click);
|
||||
//
|
||||
// ttbEnableIfArg
|
||||
//
|
||||
this.ttbEnableIfArg.DataBindings.Add(new System.Windows.Forms.Binding("Text", this, "EnableIfArg", true));
|
||||
this.ttbEnableIfArg.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.ttbEnableIfArg.Location = new System.Drawing.Point(231, 28);
|
||||
this.ttbEnableIfArg.Name = "ttbEnableIfArg";
|
||||
this.ttbEnableIfArg.Size = new System.Drawing.Size(194, 19);
|
||||
this.ttbEnableIfArg.TabIndex = 2;
|
||||
//
|
||||
// btnRemove
|
||||
//
|
||||
this.btnRemove.AutoSize = true;
|
||||
this.btnRemove.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
|
||||
this.btnRemove.Dock = System.Windows.Forms.DockStyle.Right;
|
||||
this.btnRemove.Location = new System.Drawing.Point(318, 278);
|
||||
this.btnRemove.Name = "btnRemove";
|
||||
this.btnRemove.Size = new System.Drawing.Size(107, 19);
|
||||
this.btnRemove.TabIndex = 23;
|
||||
this.btnRemove.TabStop = false;
|
||||
this.btnRemove.Text = "Remove Template";
|
||||
this.btnRemove.UseVisualStyleBackColor = true;
|
||||
this.btnRemove.Click += new System.EventHandler(this.BtnRemove_Click);
|
||||
//
|
||||
// label3
|
||||
//
|
||||
this.label3.AutoSize = true;
|
||||
this.label3.Location = new System.Drawing.Point(3, 80);
|
||||
this.label3.Margin = new System.Windows.Forms.Padding(3);
|
||||
this.label3.Name = "label3";
|
||||
this.label3.Padding = new System.Windows.Forms.Padding(3);
|
||||
this.label3.Size = new System.Drawing.Size(84, 18);
|
||||
this.label3.TabIndex = 24;
|
||||
this.label3.Text = "Action Timing:";
|
||||
//
|
||||
// label6
|
||||
//
|
||||
this.label6.AutoSize = true;
|
||||
this.label6.Location = new System.Drawing.Point(3, 228);
|
||||
this.label6.Margin = new System.Windows.Forms.Padding(3);
|
||||
this.label6.Name = "label6";
|
||||
this.label6.Padding = new System.Windows.Forms.Padding(3);
|
||||
this.label6.Size = new System.Drawing.Size(90, 18);
|
||||
this.label6.TabIndex = 27;
|
||||
this.label6.Text = "Ready Min Diff:";
|
||||
//
|
||||
// nudMatchCount
|
||||
//
|
||||
this.nudMatchCount.Location = new System.Drawing.Point(105, 253);
|
||||
this.nudMatchCount.Maximum = new decimal(new int[] {
|
||||
2147483647,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
this.nudMatchCount.Minimum = new decimal(new int[] {
|
||||
1,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
this.nudMatchCount.Name = "nudMatchCount";
|
||||
this.nudMatchCount.Size = new System.Drawing.Size(60, 19);
|
||||
this.nudMatchCount.TabIndex = 30;
|
||||
this.nudMatchCount.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
|
||||
this.nudMatchCount.Value = new decimal(new int[] {
|
||||
1,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
//
|
||||
// templateSettingsBindingSource
|
||||
//
|
||||
this.templateSettingsBindingSource.DataSource = typeof(LiveSplit.SupAutoSplit.UI.TemplateSettings);
|
||||
//
|
||||
// TemplateSettings
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.Controls.Add(this.gpbRoot);
|
||||
this.Name = "TemplateSettings";
|
||||
this.Size = new System.Drawing.Size(434, 318);
|
||||
this.gpbRoot.ResumeLayout(false);
|
||||
this.tableLayoutPanel3.ResumeLayout(false);
|
||||
this.tableLayoutPanel3.PerformLayout();
|
||||
this.flowLayoutPanel3.ResumeLayout(false);
|
||||
this.flowLayoutPanel3.PerformLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.nudMatchCount)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.templateSettingsBindingSource)).EndInit();
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
|
@ -435,5 +484,8 @@
|
|||
private System.Windows.Forms.ComboBox cbbEnableIf;
|
||||
private System.Windows.Forms.TextBox ttbThresholdNeg;
|
||||
private System.Windows.Forms.Label label6;
|
||||
private System.Windows.Forms.Label label8;
|
||||
private System.Windows.Forms.NumericUpDown nudMatchCount;
|
||||
private System.Windows.Forms.BindingSource templateSettingsBindingSource;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,163 +20,169 @@ namespace LiveSplit.SupAutoSplit.UI {
|
|||
using MatchMethodFactory = Func<Mat, Func<Mat, double>>;
|
||||
|
||||
public partial class TemplateSettings : UserControl {
|
||||
internal Action<TemplateSettings> RemoveHandler;
|
||||
internal Action<TemplateSettings> RemoveHandler;
|
||||
|
||||
#region Parameters
|
||||
public string TemplateName { get; set; }
|
||||
public string TemplateTitle => $"Template: {TemplateName}";
|
||||
#region Parameters
|
||||
public string TemplateName { get; set; }
|
||||
public string TemplateTitle => $"Template: {TemplateName}";
|
||||
|
||||
public int EnableIfISel { get; set; } = 0;
|
||||
public string EnableIfArg { get; set; }
|
||||
private ListItem<EnableIfFactory> EnableIfSel => MatchTemplate.EnableIfFactories[EnableIfISel];
|
||||
private bool IsActionStart => matchActionISel == 0; // start
|
||||
public Predicate<LiveSplitState> EnableIf => IsActionStart ? (state => state.CurrentSplitIndex == -1): EnableIfSel.value(EnableIfArg);
|
||||
public int EnableIfISel { get; set; } = 0;
|
||||
public string EnableIfArg { get; set; }
|
||||
private ListItem<EnableIfFactory> EnableIfSel => MatchTemplate.EnableIfFactories[EnableIfISel];
|
||||
private bool IsActionStart => matchActionISel == 0; // start
|
||||
public Predicate<LiveSplitState> EnableIf => IsActionStart ? (state => state.CurrentSplitIndex == -1) : EnableIfSel.value(EnableIfArg);
|
||||
|
||||
private int matchActionISel;
|
||||
public int MatchActionISel {
|
||||
get => matchActionISel;
|
||||
set {
|
||||
matchActionISel = value;
|
||||
// Start => Disable Arg
|
||||
cbbEnableIf.Enabled = ttbEnableIfArg.Enabled = !IsActionStart;
|
||||
}
|
||||
}
|
||||
private ListItem<MatchAction> MatchActionSel => MatchTemplate.MatchActions[MatchActionISel];
|
||||
public MatchAction MatchAction => MatchActionSel.value;
|
||||
private int matchActionISel;
|
||||
public int MatchActionISel {
|
||||
get => matchActionISel;
|
||||
set {
|
||||
matchActionISel = value;
|
||||
// Start => Disable Arg
|
||||
cbbEnableIf.Enabled = ttbEnableIfArg.Enabled = !IsActionStart;
|
||||
}
|
||||
}
|
||||
private ListItem<MatchAction> MatchActionSel => MatchTemplate.MatchActions[MatchActionISel];
|
||||
public MatchAction MatchAction => MatchActionSel.value;
|
||||
|
||||
public int ActionTimingISel { get; set; } = 1;
|
||||
private ListItem<bool> ActionTimingSel => MatchTemplate.ActionTimings[ActionTimingISel];
|
||||
public bool IsActionOnPosedge => ActionTimingSel.value;
|
||||
public int ActionTimingISel { get; set; } = 1;
|
||||
private ListItem<bool> ActionTimingSel => MatchTemplate.ActionTimings[ActionTimingISel];
|
||||
public bool IsActionOnPosedge => ActionTimingSel.value;
|
||||
|
||||
private string _imagePath;
|
||||
public string ImagePath {
|
||||
get => _imagePath;
|
||||
set {
|
||||
try {
|
||||
if (value != "") {
|
||||
var img = Image.FromFile(value);
|
||||
var h0 = btnImage.Height;
|
||||
var h = Math.Max(11, Math.Min(66, img.Height));
|
||||
btnImage.Height = h;
|
||||
btnImage.Width = h * img.Width / img.Height;
|
||||
btnImage.BackgroundImage = img;
|
||||
// adjust this.Height
|
||||
Height += h - h0;
|
||||
}
|
||||
_imagePath = value;
|
||||
} catch {
|
||||
_imagePath = "";
|
||||
}
|
||||
}
|
||||
}
|
||||
private string _imagePath;
|
||||
public string ImagePath {
|
||||
get => _imagePath;
|
||||
set {
|
||||
try {
|
||||
if (value != "") {
|
||||
var img = Image.FromFile(value);
|
||||
var h0 = btnImage.Height;
|
||||
var h = Math.Max(11, Math.Min(66, img.Height));
|
||||
btnImage.Height = h;
|
||||
btnImage.Width = h * img.Width / img.Height;
|
||||
btnImage.BackgroundImage = img;
|
||||
// adjust this.Height
|
||||
Height += h - h0;
|
||||
}
|
||||
_imagePath = value;
|
||||
} catch {
|
||||
_imagePath = "";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private int ImageOffsetX;
|
||||
private int ImageOffsetY;
|
||||
public string ImageOffsetXStr {
|
||||
get => ImageOffsetX.ToString();
|
||||
set => int.TryParse(value, out ImageOffsetX);
|
||||
}
|
||||
public string ImageOffsetYStr {
|
||||
get => ImageOffsetY.ToString();
|
||||
set => int.TryParse(value, out ImageOffsetY);
|
||||
}
|
||||
public OpenCvSharp.Point ImageOffset => new OpenCvSharp.Point(ImageOffsetX, ImageOffsetY);
|
||||
private int ImageOffsetX;
|
||||
private int ImageOffsetY;
|
||||
public string ImageOffsetXStr {
|
||||
get => ImageOffsetX.ToString();
|
||||
set => int.TryParse(value, out ImageOffsetX);
|
||||
}
|
||||
public string ImageOffsetYStr {
|
||||
get => ImageOffsetY.ToString();
|
||||
set => int.TryParse(value, out ImageOffsetY);
|
||||
}
|
||||
public OpenCvSharp.Point ImageOffset => new OpenCvSharp.Point(ImageOffsetX, ImageOffsetY);
|
||||
|
||||
public int MatchMethodISel { get; set; }
|
||||
private ListItem<MatchMethodFactory> MatchMethodSel => MatchTemplate.MatchMethodFactories[MatchMethodISel];
|
||||
public MatchMethodFactory MatchMethodFactory => MatchMethodSel.value;
|
||||
public int MatchMethodISel { get; set; }
|
||||
private ListItem<MatchMethodFactory> MatchMethodSel => MatchTemplate.MatchMethodFactories[MatchMethodISel];
|
||||
public MatchMethodFactory MatchMethodFactory => MatchMethodSel.value;
|
||||
|
||||
private double matchThreshold;
|
||||
public double MatchThreshold => matchThreshold;
|
||||
public string MatchThresholdStr {
|
||||
get => MatchThreshold.ToString();
|
||||
set => double.TryParse(value, out matchThreshold);
|
||||
}
|
||||
private double matchThreshold;
|
||||
public double MatchThreshold => matchThreshold;
|
||||
public string MatchThresholdStr {
|
||||
get => MatchThreshold.ToString();
|
||||
set => double.TryParse(value, out matchThreshold);
|
||||
}
|
||||
|
||||
private double matchThresholdNeg;
|
||||
public double MatchThresholdNeg => matchThresholdNeg;
|
||||
public string MatchThresholdNegStr {
|
||||
get => MatchThresholdNeg.ToString();
|
||||
set => double.TryParse(value, out matchThresholdNeg);
|
||||
}
|
||||
#endregion
|
||||
private double matchThresholdNeg;
|
||||
public double MatchThresholdNeg => matchThresholdNeg;
|
||||
public string MatchThresholdNegStr {
|
||||
get => MatchThresholdNeg.ToString();
|
||||
set => double.TryParse(value, out matchThresholdNeg);
|
||||
}
|
||||
|
||||
public TemplateSettings(XmlElement settings, Action<TemplateSettings> removeHandler) {
|
||||
RemoveHandler = removeHandler;
|
||||
public int MatchCount { get; set; }
|
||||
#endregion
|
||||
|
||||
InitializeComponent();
|
||||
SetSettings(settings);
|
||||
public TemplateSettings(XmlElement settings, Action<TemplateSettings> removeHandler) {
|
||||
RemoveHandler = removeHandler;
|
||||
|
||||
cbbEnableIf.DataSource = MatchTemplate.EnableIfItems;
|
||||
cbbEnableIf.DataBindings.Add("SelectedIndex", this, "EnableIfISel", false, DataSourceUpdateMode.OnPropertyChanged);
|
||||
cbbAction.DataSource = MatchTemplate.MatchActionItems;
|
||||
cbbAction.DataBindings.Add("SelectedIndex", this, "MatchActionISel", false, DataSourceUpdateMode.OnPropertyChanged);
|
||||
cbbActionTiming.DataSource = MatchTemplate.ActionTimingItems;
|
||||
cbbActionTiming.DataBindings.Add("SelectedIndex", this, "ActionTimingISel", false, DataSourceUpdateMode.OnPropertyChanged);
|
||||
cbbMethod.DataSource = MatchTemplate.MatchMethodItems;
|
||||
cbbMethod.DataBindings.Add("SelectedIndex", this, "MatchMethodISel", false, DataSourceUpdateMode.OnPropertyChanged);
|
||||
}
|
||||
InitializeComponent();
|
||||
SetSettings(settings);
|
||||
|
||||
private void BtnTemplate_Click(object sender, EventArgs e) {
|
||||
if (ofdTemplate.ShowDialog() == DialogResult.OK)
|
||||
ImagePath = ofdTemplate.FileName;
|
||||
}
|
||||
private void BtnRemove_Click(object sender, EventArgs e) {
|
||||
RemoveHandler(this);
|
||||
}
|
||||
cbbEnableIf.DataSource = MatchTemplate.EnableIfItems;
|
||||
cbbEnableIf.DataBindings.Add("SelectedIndex", this, "EnableIfISel", false, DataSourceUpdateMode.OnPropertyChanged);
|
||||
cbbAction.DataSource = MatchTemplate.MatchActionItems;
|
||||
cbbAction.DataBindings.Add("SelectedIndex", this, "MatchActionISel", false, DataSourceUpdateMode.OnPropertyChanged);
|
||||
cbbActionTiming.DataSource = MatchTemplate.ActionTimingItems;
|
||||
cbbActionTiming.DataBindings.Add("SelectedIndex", this, "ActionTimingISel", false, DataSourceUpdateMode.OnPropertyChanged);
|
||||
cbbMethod.DataSource = MatchTemplate.MatchMethodItems;
|
||||
cbbMethod.DataBindings.Add("SelectedIndex", this, "MatchMethodISel", false, DataSourceUpdateMode.OnPropertyChanged);
|
||||
|
||||
internal int CreateSettingsNode(XmlDocument document, XmlElement parent) {
|
||||
var hashCode =
|
||||
SettingsHelper.CreateSetting(document, parent, "Name", TemplateName) ^
|
||||
SettingsHelper.CreateSetting(document, parent, "EnableIf", EnableIfSel.key) ^
|
||||
SettingsHelper.CreateSetting(document, parent, "EnableIfArg", EnableIfArg) ^
|
||||
SettingsHelper.CreateSetting(document, parent, "Action", MatchActionSel.key) ^
|
||||
SettingsHelper.CreateSetting(document, parent, "ActionOn", ActionTimingSel.key) ^
|
||||
SettingsHelper.CreateSetting(document, parent, "Image", ImagePath) ^
|
||||
SettingsHelper.CreateSetting(document, parent, "OffsetX", ImageOffsetX) ^
|
||||
SettingsHelper.CreateSetting(document, parent, "OffsetY", ImageOffsetY) ^
|
||||
SettingsHelper.CreateSetting(document, parent, "Method", MatchMethodSel.key) ^
|
||||
SettingsHelper.CreateSetting(document, parent, "Threshold", MatchThreshold);
|
||||
SettingsHelper.CreateSetting(document, parent, "ThresholdNeg", MatchThresholdNeg);
|
||||
return hashCode;
|
||||
}
|
||||
private void SetSettings(XmlElement settings) {
|
||||
TemplateName = SettingsHelper.ParseString(settings?["Name"], "");
|
||||
EnableIfISel = SupSettingsHelper.ParseListISel(settings?["EnableIf"], MatchTemplate.EnableIfFactories, 0);
|
||||
EnableIfArg = SettingsHelper.ParseString(settings?["EnableIfArg"], "");
|
||||
MatchActionISel = SupSettingsHelper.ParseListISel(settings?["Action"], MatchTemplate.MatchActions, 1);
|
||||
ActionTimingISel = SupSettingsHelper.ParseListISel(settings?["ActionOn"], MatchTemplate.ActionTimings, 0);
|
||||
ImagePath = SettingsHelper.ParseString(settings?["Image"], "");
|
||||
ImageOffsetX = SettingsHelper.ParseInt(settings?["OffsetX"], 0);
|
||||
ImageOffsetY = SettingsHelper.ParseInt(settings?["OffsetY"], 0);
|
||||
MatchMethodISel = SupSettingsHelper.ParseListISel(settings?["Method"], MatchTemplate.MatchMethodFactories, 0);
|
||||
matchThreshold = SettingsHelper.ParseDouble(settings?["Threshold"], 0);
|
||||
matchThresholdNeg = SettingsHelper.ParseDouble(settings?["ThresholdNeg"], 0);
|
||||
}
|
||||
nudMatchCount.DataBindings.Add("Value", this, "MatchCount", true, DataSourceUpdateMode.OnPropertyChanged);
|
||||
}
|
||||
|
||||
private void BtnTemplate_Click(object sender, EventArgs e) {
|
||||
if (ofdTemplate.ShowDialog() == DialogResult.OK)
|
||||
ImagePath = ofdTemplate.FileName;
|
||||
}
|
||||
private void BtnRemove_Click(object sender, EventArgs e) {
|
||||
RemoveHandler(this);
|
||||
}
|
||||
|
||||
internal int CreateSettingsNode(XmlDocument document, XmlElement parent) {
|
||||
var hashCode =
|
||||
SettingsHelper.CreateSetting(document, parent, "Name", TemplateName) ^
|
||||
SettingsHelper.CreateSetting(document, parent, "EnableIf", EnableIfSel.key) ^
|
||||
SettingsHelper.CreateSetting(document, parent, "EnableIfArg", EnableIfArg) ^
|
||||
SettingsHelper.CreateSetting(document, parent, "Action", MatchActionSel.key) ^
|
||||
SettingsHelper.CreateSetting(document, parent, "ActionOn", ActionTimingSel.key) ^
|
||||
SettingsHelper.CreateSetting(document, parent, "Image", ImagePath) ^
|
||||
SettingsHelper.CreateSetting(document, parent, "OffsetX", ImageOffsetX) ^
|
||||
SettingsHelper.CreateSetting(document, parent, "OffsetY", ImageOffsetY) ^
|
||||
SettingsHelper.CreateSetting(document, parent, "Method", MatchMethodSel.key) ^
|
||||
SettingsHelper.CreateSetting(document, parent, "Threshold", MatchThreshold);
|
||||
SettingsHelper.CreateSetting(document, parent, "ThresholdNeg", MatchThresholdNeg);
|
||||
SettingsHelper.CreateSetting(document, parent, "MatchCount", MatchCount);
|
||||
return hashCode;
|
||||
}
|
||||
private void SetSettings(XmlElement settings) {
|
||||
TemplateName = SettingsHelper.ParseString(settings?["Name"], "");
|
||||
EnableIfISel = SupSettingsHelper.ParseListISel(settings?["EnableIf"], MatchTemplate.EnableIfFactories, 0);
|
||||
EnableIfArg = SettingsHelper.ParseString(settings?["EnableIfArg"], "");
|
||||
MatchActionISel = SupSettingsHelper.ParseListISel(settings?["Action"], MatchTemplate.MatchActions, 1);
|
||||
ActionTimingISel = SupSettingsHelper.ParseListISel(settings?["ActionOn"], MatchTemplate.ActionTimings, 0);
|
||||
ImagePath = SettingsHelper.ParseString(settings?["Image"], "");
|
||||
ImageOffsetX = SettingsHelper.ParseInt(settings?["OffsetX"], 0);
|
||||
ImageOffsetY = SettingsHelper.ParseInt(settings?["OffsetY"], 0);
|
||||
MatchMethodISel = SupSettingsHelper.ParseListISel(settings?["Method"], MatchTemplate.MatchMethodFactories, 0);
|
||||
matchThreshold = SettingsHelper.ParseDouble(settings?["Threshold"], 0);
|
||||
matchThresholdNeg = SettingsHelper.ParseDouble(settings?["ThresholdNeg"], 0);
|
||||
MatchCount = SettingsHelper.ParseInt(settings?["MatchCount"], 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
namespace SupExtension {
|
||||
public struct ListItem<V> {
|
||||
public string key;
|
||||
public string text;
|
||||
public V value;
|
||||
public string key;
|
||||
public string text;
|
||||
public V value;
|
||||
|
||||
public static implicit operator ListItem<V>((string, V) arg) =>
|
||||
new ListItem<V>() { key = arg.Item1, text = arg.Item1, value = arg.Item2 };
|
||||
public static implicit operator ListItem<V>((string, string, V) arg) =>
|
||||
new ListItem<V>() { key = arg.Item1, text = arg.Item2, value = arg.Item3 };
|
||||
public static implicit operator ListItem<V>((string, V) arg) =>
|
||||
new ListItem<V>() { key = arg.Item1, text = arg.Item1, value = arg.Item2 };
|
||||
public static implicit operator ListItem<V>((string, string, V) arg) =>
|
||||
new ListItem<V>() { key = arg.Item1, text = arg.Item2, value = arg.Item3 };
|
||||
}
|
||||
public static class SupArray {
|
||||
public static int FindIndex<T>(this T[] self, Predicate<T> match) =>
|
||||
Array.FindIndex(self, match);
|
||||
public static int FindIndex<T>(this T[] self, Predicate<T> match) =>
|
||||
Array.FindIndex(self, match);
|
||||
}
|
||||
static class SupSettingsHelper {
|
||||
internal static int ParseListISel<T>(XmlElement element, ListItem<T>[] items, int defaultValue=-1) {
|
||||
var key = SettingsHelper.ParseString(element);
|
||||
if (key == null) return defaultValue;
|
||||
var index = Array.FindIndex(items, o => o.key == key);
|
||||
return index == -1 ? defaultValue : index;
|
||||
}
|
||||
internal static int ParseListISel<T>(XmlElement element, ListItem<T>[] items, int defaultValue = -1) {
|
||||
var key = SettingsHelper.ParseString(element);
|
||||
if (key == null) return defaultValue;
|
||||
var index = Array.FindIndex(items, o => o.key == key);
|
||||
return index == -1 ? defaultValue : index;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -120,4 +120,7 @@
|
|||
<metadata name="ofdTemplate.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 17</value>
|
||||
</metadata>
|
||||
<metadata name="templateSettingsBindingSource.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>138, 17</value>
|
||||
</metadata>
|
||||
</root>
|
|
@ -35,7 +35,7 @@
|
|||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="LiveSplit.Core">
|
||||
<HintPath>..\..\..\..\..\..\Software\LiveSplit\LiveSplit.Core.dll</HintPath>
|
||||
<HintPath>..\..\..\..\Software\LiveSplit\LiveSplit.Core.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="OpenCvSharp, Version=1.0.0.0, Culture=neutral, PublicKeyToken=6adad1e807fea099, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\OpenCvSharp4.4.5.3.20210817\lib\net461\OpenCvSharp.dll</HintPath>
|
||||
|
@ -76,7 +76,7 @@
|
|||
<Reference Include="System.Net.Http" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="UpdateManager">
|
||||
<HintPath>..\..\..\..\..\..\Software\LiveSplit\UpdateManager.dll</HintPath>
|
||||
<HintPath>..\..\..\..\Software\LiveSplit\UpdateManager.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
|
@ -122,8 +122,8 @@
|
|||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<PropertyGroup>
|
||||
<PathMap>$(MSBuildProjectDirectory)\$(IntermediateOutputPath)=.</PathMap>
|
||||
<PostBuildEvent>copy $(TargetDir)$(TargetFileName) C:\Software\LiveSplit\Components\</PostBuildEvent>
|
||||
<!-- <PathMap>$(MSBuildProjectDirectory)\$(IntermediateOutputPath)=.</PathMap> -->
|
||||
<PostBuildEvent>copy $(TargetDir)$(TargetFileName) C:\Users\sup39\Software\LiveSplit\Components\</PostBuildEvent>
|
||||
</PropertyGroup>
|
||||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
||||
<PropertyGroup>
|
||||
|
|
Loading…
Reference in a new issue