示例#1
0
 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));
        }
示例#4
0
 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;
            }
        }
示例#6
0
        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()}");
            }
        }
示例#7
0
 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);
     }
 }
示例#8
0
        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);
            }
        }
示例#9
0
 public override int GetHashCode()
 {
     return(InterceptorType.GetHashCode());
 }
示例#10
0
 public BaseInterceptorAttribute(InterceptorType action)
 {
     Action = action;
 }
示例#11
0
 protected override string ResolveClassName(object context) => $"Proxy_{InterceptorType.GetMD5HashCode()}";
示例#12
0
 /// <summary>
 /// ctor
 /// </summary>
 /// <param name="type"></param>
 public AspectAttribute(InterceptorType type)
 {
     AspectType = type;
 }
示例#13
0
 public RecordLockAttribute(InterceptorType action) : base(action)
 {
 }
示例#14
0
        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);
        }
示例#15
0
 public Interceptor(InterceptorType interceptorType)
 {
     InterceptorType = interceptorType;
 }