public override int GetHashCode() { unchecked { return(((InterceptorType != null ? InterceptorType.GetHashCode() : 0) * 397) ^ (Bindings != null ? Bindings.GetHashCode() : 0)); } }
protected override ClassDeclarationSyntax ResolveConstructors(ClassDeclarationSyntax cls, object context) { foreach (IConstructorInfo ctor in InterceptorType.GetPublicConstructors()) { cls = ResolveConstructor(cls, context, ctor); } return cls; }
public override IInterceptor Create(IServiceProvider serviceProvider) { var constructor = InterceptorType.GetConstructors().FirstOrDefault(); if (constructor == null) { throw new ArgumentNullException(InterceptorType.FullName, "No found ctor."); } return((IInterceptor)constructor.GetReflector().InvokerFromService(serviceProvider)); }
public MethodBinding(string name = null, InterceptorType interceptor = InterceptorType.RestHttpInterceptor, HttpMethod httpMethod = HttpMethod.Post, string controller = null) { InterceptorType = InterceptorType; Name = name; HttpMethod = httpMethod; Controller = controller; }
private static void addInterception(InterceptorType type, string Location, string Number) { switch (type) { case InterceptorType.foo: Console.WriteLine("bind foo"); break; case InterceptorType.bar: Console.WriteLine("bind bar"); break; default: Console.WriteLine("default bind zee"); break; } }
private string ReplaceForInterceptor(InterceptorType interceptorType) { switch (interceptorType) { case InterceptorType.LineInterceptor: return("{line}"); case InterceptorType.FinishInterceptor: return("{exitCode}"); case InterceptorType.TimerInterceptor: return(null); default: throw new ArgumentException($"Cannot find {interceptorType.ToString()}"); } }
public void AddInterceptor(IRawInterceptor interceptor, InterceptorType interceptorType = InterceptorType.Pre) { if (interceptorType == InterceptorType.Pre) { _preInterceptors.Add(interceptor); } else if (interceptorType == InterceptorType.Post) { _postInterceptors.Add(interceptor); } else if (interceptorType == InterceptorType.Unhandled) { _unhandledInterceptors.Add(interceptor); } else if (interceptorType == InterceptorType.Aborted) { _abortedInterceptors.Add(interceptor); } }
public static bool Start(Computer cpu, RecordFile cfile, InterceptorType type, bool rmCfile, string bcIP, int bcPort, string path) { if (Initialize(cpu)) { string command = String.Format("cd dev_utilities && ./interceptor.sh -r {0} {1} {2} {3} {4} {5} {6} {7} {8} {9} {10} {11} &", type.ToString(), cfile.ID, cfile.Count, cfile.Band, cfile.ARFCN, cfile.Frequency, cfile.SampleRate, cfile.Rx, rmCfile ? 1 : 0, bcIP, bcPort, path); shellStream.WriteLine(command); #if (DEBUG) string feedback = shellStream.Expect("root", new TimeSpan(0, 0, 10)); #endif sshClient.Disconnect(); return(true); } else { return(false); } }
public override int GetHashCode() { return(InterceptorType.GetHashCode()); }
public BaseInterceptorAttribute(InterceptorType action) { Action = action; }
protected override string ResolveClassName(object context) => $"Proxy_{InterceptorType.GetMD5HashCode()}";
/// <summary> /// ctor /// </summary> /// <param name="type"></param> public AspectAttribute(InterceptorType type) { AspectType = type; }
public RecordLockAttribute(InterceptorType action) : base(action) { }
private Process RunInterceptor(string name, Dictionary <string, string> data, InterceptorType interceptorType) { string typeInterceptor = interceptorType.ToString(); //string replace = ReplaceForInterceptor(interceptorType); var pi = new ProcessStartInfo(FullPath); string wd = FolderToExecute; if (string.IsNullOrWhiteSpace(wd)) { wd = Path.GetDirectoryName(Path.GetFullPath(Name)); } string arguments = Arguments; if (string.IsNullOrWhiteSpace(arguments)) { arguments = ReplaceForInterceptor(interceptorType); } foreach (var item in data) { arguments = arguments.Replace(item.Key, item.Value); } pi.Arguments = arguments; //Console.WriteLine($"!!!!!!!!!!!!start {pi.FileName} with {arguments}"); pi.RedirectStandardError = InterceptOutput; pi.RedirectStandardOutput = InterceptOutput; pi.WorkingDirectory = wd; pi.UseShellExecute = !InterceptOutput; pi.CreateNoWindow = InterceptOutput; var p = new Process() { StartInfo = pi }; p.EnableRaisingEvents = InterceptOutput; p.Start(); if (InterceptOutput) { p.BeginOutputReadLine(); p.BeginErrorReadLine(); p.OutputDataReceived += (sender, args) => { Console.WriteLine($"Interceptor {typeInterceptor}: {name} => {args.Data}"); }; p.ErrorDataReceived += (sender, args) => { Console.WriteLine($"Interceptor {typeInterceptor}: {name} ERROR => {args.Data}"); }; p.Exited += (sender, args) => { Console.WriteLine($"Interceptor {typeInterceptor}: {name} exited "); }; } return(p); }
public Interceptor(InterceptorType interceptorType) { InterceptorType = interceptorType; }