public Bot(ApiClientInteface api_client, BotRunnerInterface runner, LoggerInterface logger = null) { this.runner = runner; this.api_client = api_client; this.update_handlers = new List <UpdateHandlerInterface>(); this.logger = logger ?? new NullLogger(); }
void setup() { slider.maxValue = Start_Screen.sliderLength; reader = new BasicEmotivReader(device, false); Application.runInBackground = true; ssvepOn(); createTestArray(); //Creates the timeline and timeline checkpoints timelineCheckPoints = new long[(ect.Length + 2)][]; timeline = new Timeline <IEmotivState>(); for (int i = 0; i < ect.Length; i++) { timelineCheckPoints[i] = new long[2]; } //Starts reading from the device reader.OnRead += (e) => timeline.Register(e); reader.StartReading(); incrementSlider = true; accuracyLogger = new CsvLogger("Accuracy.csv"); accuracyLogger.add(Start_Screen.profile); accuracyFalsePositiveLogger = new CsvLogger("AccuracyFalsePositiveLogger.csv"); Activate(); }
static void Main(string[] args) { logeri = SingletonL.SingletonL.GetSingleton(ConfigurationManager.AppSettings["FilePath"]); Checking checking = new Checking(logeri); checking.proces(); Console.ReadKey(); }
public static void SetLogger <T>(T outputter) where T : LoggerInterface, new() { LogAdapter.s_impl = outputter; }
//private static LoggerInterface logger = new EmptyLogger(); public void SetLogger(LoggerInterface logger) { Logger.logger = logger; }
public Checking(LoggerInterface logeri) { this.logeri = logeri; }
public static void LogStart(LoggerInterface appLogger) { AppLogger = appLogger; }
public static void registerInterface(LoggerInterface logInterface) { Logger.logInterface = logInterface; }
public Database(string path, KeyValidator <TKey> keyValidator, long offset = 0, long pageSize = 0, bool sortable = true, LoggerInterface logger = null) { if (typeof(T).GetFields(BindingFlags.NonPublic).Any(f => !f.FieldType.IsValueType)) { throw new Exception("Structure fields can be only value type."); } valueSize = Marshal.SizeOf <T>(); fileSize = new FileInfo(path).Length; if ((fileSize - offset) % valueSize != 0) { throw new Exception("Database is corrupted."); } validateKey = keyValidator; this.sortable = sortable; this.pageSize = pageSize - pageSize % valueSize; this.offset = offset; this.path = path; this.logger = logger ?? new LoggerInterface(); this.progress = new ProgressLogger(this.logger); accessor = new MemoryAccessor(path, 0, this.pageSize); idIsIndex = typeof(T).GetCustomAttribute <IdIsIndexAttribute>() != null; if (!idIsIndex) { var idField = typeof(T).GetFields(BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public).First(f => f.GetCustomAttribute <IdAttribute>() != null); if (idField.GetCustomAttribute <FixedBufferAttribute>() != null) { if (typeof(TKey) == typeof(string)) { getKey = i => (TKey)(object)GetKeyString(accessor, i, idField.GetCustomAttribute <FixedBufferAttribute>().Length); setKey = (TKey key, ref T val) => SetKeyString((string)(object)key, ref val); } else if (typeof(TKey) == typeof(Array)) { getKey = i => (TKey)(object)GetKeyArray(accessor, i, idField.GetCustomAttribute <FixedBufferAttribute>().Length, idField.GetCustomAttribute <FixedBufferAttribute>().ElementType); setKey = (TKey key, ref T val) => SetKeyArray((Array)(object)key, ref val); } else { throw new Exception("Fixed array key field should be String or Array."); } } else { getKey = i => GetKey(accessor, i); setKey = (TKey key, ref T val) => SetKey(key, ref val); } keyOffset = Marshal.OffsetOf <T>(idField.Name).ToInt32(); } else { getKey = i => typeof(TKey) == typeof(long) ? (TKey)(object)i : throw new ArgumentException("Index of IdIsIndex table should be long."); setKey = (TKey key, ref T val) => throw new InvalidOperationException("Unable to set key for IdIsIndex database."); keyOffset = 0; } }
public static void SetAppLogger(LoggerInterface appLogger) { AppLogger = appLogger; }
static LogAdapter() { LogAdapter.s_impl = new DefaultLogger(); }