1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace GDNXFD.Alert.Interpreter
- {
- public class CodeTemplate
- {
- public const string Outline = @"
- using System;
- using GDNXFD.Data;
- namespace GDNXFD.Alert.Interpreter
- {{
- public class {0} : AlertRuleInterpreter
- {{
- public {0}(AlertRule alertRule) : base(alertRule) {{ }}
- public override bool Interpret(string objectId, AlertObjectType objectType)
- {{
- {1}
- {2}
- }}
- {3}
- }}
- }}
- ";
- public const string AIDeclare = "double {0} = dataProvider.FindAIValue(\"{0}\",objectId,objectType, ref dataInfo);";
- public const string DIDeclare = "bool {0} = dataProvider.FindDIValue(\"{0}\",objectId,objectType, ref dataInfo);";
- public const string ReturnStatement = "return {0};";
- public const string SustainMethod = @"
- public bool Sustain_{0}(string objectId, AlertObjectType objectType, int duration, int interval = 60)
- {{
- DateTime tEnd = DateTime.Now;
- DateTime tStart = DateTime.Now.AddSeconds(0 - duration);
- {1}
- for (int i = 0; i<{2}; i++)
- {{
- if ({3})
- continue;
- else
- return false;
- }}
- return true;
- }}";
- public const string AIsDeclare = "double[] {0} = dataProvider.FindAIHistorySnap(\"{0}\", objectId, objectType, tStart, tEnd, interval);";
- public const string DIsDeclare = "bool[] {0} = dataProvider.FindDIHistorySnap(\"{0}\", objectId, objectType, tStart, tEnd, interval);";
- public const string BoolSustainDeclare = "bool bool{0} = {1};";
- public const string SustainCallString = "Sustain_{0}(objectId, objectType, {1},{2})";
- }
- }
|