Ejemplo n.º 1
0
        public Release(Release other)
        {
            Name        = other.Name;
            Footsite    = other.Footsite;
            ProductLink = other.ProductLink;
            Category    = other.Category;

            foreach (string keyWord in other.KeyWords)
            {
                KeyWords.Add(keyWord);
            }

            Style       = other.Style;
            GlobalProxy = other.GlobalProxy != null ? new Proxy(other.GlobalProxy) : null;

            foreach (ReleaseCheckoutProfile profile in other.Profiles)
            {
                Profiles.Add(new ReleaseCheckoutProfile(profile));
            }

            foreach (Proxy proxy in other.Proxies)
            {
                Proxies.Add(new Proxy(proxy));
            }
        }
Ejemplo n.º 2
0
 private void UpdateProxyList()
 {
     Proxies.Clear();
     Proxies.Add(new ProxyViewModel());
     foreach (ProxyInfo proxyInfo in _proxyRegistry.Proxies)
     {
         Proxies.Add(new ProxyViewModel(proxyInfo));
     }
 }
Ejemplo n.º 3
0
 public void Add(Proxy proxy)
 {
     lock (Proxies)
     {
         Proxies.Add(proxy);
         LastUpdated.Add(proxy.Session.Id, new Record());
     }
     SessionRepository.AddSession(proxy.Session);
 }
Ejemplo n.º 4
0
 public void Init()
 {
     foreach (var result in ParaGenerator.Generate())
     {
         var p = new Proxy();
         p.UnsafeDictDeserialize(result);
         Proxies.Add(p);
     }
     ;
 }
Ejemplo n.º 5
0
        private void Update()
        {
            Proxies.Clear();

            foreach (Proxy proxy in m_model)
            {
                Proxies.Add(new ProxyTestableViewModel()
                {
                    Model    = proxy,
                    TestSite = SelectedSite
                });

                Proxies.Last().GetLocation.Execute(null);
            }
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Adds a Trinity proxy to the current cluster configuration.
        /// </summary>
        /// <param name="proxy">A <see cref="Trinity.Network.ServerInfo"/> instance that represent a proxy.</param>
        public static void AddProxy(ServerInfo proxy)
        {
            bool found = false;

            for (int i = 0; i < Servers.Count; i++)
            {
                if (Proxies[i].Id == proxy.Id)
                {
                    Proxies[i].Instances.Add(proxy);
                    found = true;
                    break;
                }
            }

            if (!found)
            {
                Proxies.Add(new AvailabilityGroup(proxy.Id, proxy));
            }
        }
Ejemplo n.º 7
0
        private void NotifyCollectionChangedHandler(object sender, NotifyCollectionChangedEventArgs args)
        {
            if (args.Action == NotifyCollectionChangedAction.Add)
            {
                foreach (Proxy proxy in args.NewItems)
                {
                    Proxies.Add(new ProxyTestableViewModel()
                    {
                        Model    = proxy,
                        TestSite = SelectedSite
                    });

                    Proxies.Last().GetLocation.Execute(null);
                }
            }
            else if (args.Action == NotifyCollectionChangedAction.Remove)
            {
                foreach (Proxy proxy in args.OldItems)
                {
                    foreach (ProxyTestableViewModel proxyTestableViewModel in Proxies.Where(p => p.Model == proxy)
                             .ToList())
                    {
                        Proxies.Remove(proxyTestableViewModel);
                        proxyTestableViewModel.CancelTest();
                        proxyTestableViewModel.CancelGetLocation();
                    }
                }
            }
            else if (args.Action == NotifyCollectionChangedAction.Replace)
            {
                ProxyTestableViewModel proxyTestableViewModel = Proxies[args.NewStartingIndex];
                proxyTestableViewModel.CancelTest();
                proxyTestableViewModel.CancelGetLocation();
                proxyTestableViewModel.Model = args.NewItems[0] as Proxy;
                proxyTestableViewModel.GetLocation.Execute(null);
            }
        }
Ejemplo n.º 8
0
        public void ProcessMethod(MethodDef method)
        {
            for (int i = 0; i < method.Body.Instructions.Count; i++)
            {
                var instr = method.Body.Instructions[i];
                if (instr.OpCode == OpCodes.Call)
                {
                    var target = (IMethod)instr.Operand;
                    if (!target.ResolveMethodDefThrow().IsPublic || target.ResolveMethodDef().Name.StartsWith("get_") || target.ResolveMethodDef().Name.StartsWith("set_"))
                    {
                        continue;
                    }


                    MethodSig sig = CreateProxySignature(target);
                    Tuple <MethodDef, TypeDef> value;
                    var key = new Tuple <Code, TypeDef, IMethod>(instr.OpCode.Code, method.DeclaringType, target);
                    if (!Proxies.TryGetValue(key, out value))
                    {
                        var proxy = new MethodDefUser(Runtime.GetRandomName(), sig);
                        proxy.Attributes     = MethodAttributes.PrivateScope | MethodAttributes.Static;
                        proxy.ImplAttributes = MethodImplAttributes.Managed | MethodImplAttributes.IL;
                        method.DeclaringType.Methods.Add(proxy);
                        var type = CreateDelegateType(sig);

                        proxy.Body = new CilBody();

                        if (!target.ResolveMethodDef().IsStatic)
                        {
                            proxy.Body.Instructions.Add(Instruction.Create(OpCodes.Ldarg_0));
                            proxy.Body.Instructions.Add(Instruction.Create(OpCodes.Dup));
                            proxy.Body.Instructions.Add(Instruction.Create(OpCodes.Ldftn, target));
                            proxy.Body.Instructions.Add(Instruction.Create(OpCodes.Newobj, type.FindMethod(".ctor")));
                            for (int x = 1; x < proxy.Parameters.Count; x++)
                            {
                                proxy.Body.Instructions.Add(Instruction.Create(OpCodes.Ldarg, proxy.Parameters[x]));
                            }
                            proxy.Body.Instructions.Add(Instruction.Create(OpCodes.Callvirt, type.FindMethod("Invoke")));
                            proxy.Body.Instructions.Add(Instruction.Create(OpCodes.Ret));
                        }
                        else
                        {
                            proxy.Body.Instructions.Add(Instruction.Create(OpCodes.Ldnull));
                            proxy.Body.Instructions.Add(Instruction.Create(OpCodes.Ldftn, target));
                            proxy.Body.Instructions.Add(Instruction.Create(OpCodes.Newobj, type.FindMethod(".ctor")));
                            for (int x = 0; x < proxy.Parameters.Count; x++)
                            {
                                proxy.Body.Instructions.Add(Instruction.Create(OpCodes.Ldarg, proxy.Parameters[x]));
                            }
                            proxy.Body.Instructions.Add(Instruction.Create(OpCodes.Callvirt, type.FindMethod("Invoke")));
                            proxy.Body.Instructions.Add(Instruction.Create(OpCodes.Ret));
                        }



                        AddedDelegates.Add(type.Rid);
                        value = new Tuple <MethodDef, TypeDef>(proxy, type);
                        Proxies.Add(key, value);
                    }

                    instr.Operand = value.Item1;
                }
            }
        }