protected ProxyObjectReference(SerializationInfo info, StreamingContext context)
		{
			// Deserialize the base type using its assembly qualified name
			string qualifiedName = info.GetString("__baseType");
			_baseType = System.Type.GetType(qualifiedName, true, false);

			// Rebuild the list of interfaces
			var interfaceList = new List<System.Type>();
			int interfaceCount = info.GetInt32("__baseInterfaceCount");
			for (int i = 0; i < interfaceCount; i++)
			{
				string keyName = string.Format("__baseInterface{0}", i);
				string currentQualifiedName = info.GetString(keyName);
				System.Type interfaceType = System.Type.GetType(currentQualifiedName, true, false);

				interfaceList.Add(interfaceType);
			}

			// Reconstruct the proxy
			var factory = new ProxyFactory();
			System.Type proxyType = factory.CreateProxyType(_baseType, interfaceList.ToArray());

			// Initialize the proxy with the deserialized data
			var args = new object[] {info, context};
			_proxy = (IProxy) Activator.CreateInstance(proxyType, args);
		}
Esempio n. 2
0
 public virtual void RegisteProxy(string proxyName, IProxy proxy)
 {
     if (!HasProxy(proxyName))
     {
         _proxyMap[proxyName] = proxy;
     }
 }
Esempio n. 3
0
        /// <summary>
        /// Initializes a new instance of the ProxyObjectReference class.
        /// </summary>
        /// <param name="info">The <see cref="SerializationInfo"/> class that contains the serialized data.</param>
        /// <param name="context">The <see cref="StreamingContext"/> that describes the serialization state.</param>
        protected ProxyObjectReference(SerializationInfo info, StreamingContext context)
        {
            // Deserialize the base type using its assembly qualified name
            string qualifiedName = info.GetString("__baseType");
            _baseType = Type.GetType(qualifiedName, true, false);

            // Rebuild the list of interfaces
            List<Type> interfaceList = new List<Type>();
            int interfaceCount = info.GetInt32("__baseInterfaceCount");
            for (int i = 0; i < interfaceCount; i++)
            {
                string keyName = string.Format("__baseInterface{0}", i);
                string currentQualifiedName = info.GetString(keyName);
                Type interfaceType = Type.GetType(currentQualifiedName, true, false);

                interfaceList.Add(interfaceType);
            }

            // Reconstruct the proxy
            ProxyFactory factory = new ProxyFactory();
            Type proxyType = factory.CreateProxyType(_baseType, interfaceList.ToArray());
            _proxy = (IProxy)Activator.CreateInstance(proxyType);

            IInterceptor interceptor = (IInterceptor)info.GetValue("__interceptor", typeof(IInterceptor));
            _proxy.Interceptor = interceptor;
        }
Esempio n. 4
0
		/// <summary>
		/// Visits a <see cref="DocNodeProxy"/> and applies the modifications to the document path of that proxy.
		/// </summary>
		/// <param name="proxy">The <see cref="DocNodeProxy"/> to modify.</param>
		/// <param name="owner">The instance that owns the proxy.</param>
		/// <param name="propertyName">Name of the property that accesses the proxy in this instance.</param>
		public void Visit(IProxy proxy, object owner, string propertyName)
		{
			if (null == proxy)
				return;

			var docPath = proxy.DocumentPath;

			// the _itemRelocationDictionary has first priority
			if (_itemRelocationDictionary != null && _itemRelocationDictionary.Count > 0)
			{
				for (int i = docPath.Count; i >= 2; --i)
				{
					var subPath = docPath.SubPath(0, i);
					AbsoluteDocumentPath replacePath;
					if (_itemRelocationDictionary.TryGetValue(subPath, out replacePath))
					{
						proxy.ReplacePathParts(subPath, replacePath, (IDocumentLeafNode)owner);
						return;
					}
				}
			}

			// the pathReplacementDictionary has 2nd priority
			foreach (var levelEntry in _pathPartReplacementDictionary)
			{
				foreach (var entry in levelEntry)
				{
					if (proxy.ReplacePathParts(entry.Key, entry.Value, (IDocumentLeafNode)owner))
						return;
				}
			}
		}
        public ReturnValueTests()
        {
            this.interceptor = new Mock<IDynamicInterceptor>();
            this.BindInterceptorCollection(this.interceptor.Object);

            this.testee = this.Kernel.Get<IProxy>();
        }
Esempio n. 6
0
 public CommandLine(IProxy prx)
 {
     _proxy = prx;
     prx.ListenerStarted += (o, e) => Console.WriteLine("Started {0}", e.Listener);
     prx.ListenerStopped += (o, e) => Console.WriteLine("Stopped {0}", e.Listener);
     prx.UserDeleted += (o, e) => Console.WriteLine("User{0} successfully removed.", e.Username);
     prx.UserCreated += (o, e) => Console.WriteLine("User {0} successfully added.", e.Username);
     _commands = new Dictionary<String, ProxyCommand>
                     {
                         {"help", new ProxyCommand {Action = ShowHelp, HelpString = "Shows this help message"}},
                         {
                             "uptime",
                             new ProxyCommand
                                 {
                                     Action = ShowUpTime,
                                     HelpString = "Shows the uptime of the proxy server"
                                 }
                         },
                         //{"version", new ProxyCommand{Action=ShowVersion, HelpString="Prints the version of this program"}},
                         {"listusers", new ProxyCommand {Action = ShowUsers, HelpString = "Lists all users"}},
                         {
                             "adduser",
                             new ProxyCommand {Action = ShowAddUser, HelpString = "Adds a user to the user list"}
                         },
                         {
                             "deluser",
                             new ProxyCommand
                                 {
                                     Action = ShowDeleteUser,
                                     HelpString = "Deletes a user from the user list"
                                 }
                         },
                         {
                             "listlisteners",
                             new ProxyCommand {Action = ShowListeners, HelpString = "Lists all the listeners"}
                         },
                         {
                             "addlistener",
                             new ProxyCommand {Action = ShowAddListener, HelpString = "Adds a new listener"}
                         },
                         {
                             "dellistener",
                             new ProxyCommand {Action = ShowDelListener, HelpString = "Deletes a listener"}
                         },
                         {
                             "listeners",
                             new ProxyCommand
                                 {
                                     Action = ShowAvailableListeners,
                                     HelpString = "List available listeners"
                                 }
                         },
                         {"exit", new ProxyCommand {Action = () => { }, HelpString = "Exit the application"}},
                         {
                             "save",
                             new ProxyCommand {Action = () => _proxy.SaveData(), HelpString = "Save configuration"}
                         },
                     };
 }
Esempio n. 7
0
		/// <summary>
		/// Register an <c>IProxy</c> with the <c>Model</c>
		/// </summary>
		/// <param name="proxy">An <c>IProxy</c> to be held by the <c>Model</c></param>
		/// <remarks>This method is thread safe and needs to be thread safe in all implementations.</remarks>
		public virtual void RegisterProxy(IProxy proxy)
		{
			lock (m_syncRoot)
			{
				m_proxyMap[proxy.ProxyName] = proxy;
			}

			proxy.OnRegister();
		}
Esempio n. 8
0
        public App()
        {
            DispatcherHelper.Initialize();
            _proxy = new ProxyImplement();

            VMLocator = new ViewModelLocator();
            VMLocator.RegisterInstance(_proxy);
            VMLocator.RegisterInstance(new ProxyImplement());
        }
Esempio n. 9
0
 public ClientActionContext(IProxy proxy, Type contract, MethodInfo action, object[] parameters)
     : base(contract, action, parameters)
 {
     Proxy = proxy;
     Request = new HttpRequestMessage();
     if (Parameters != null)
     {
         RequestAborted = Parameters.OfType<CancellationToken>().FirstOrDefault();
     }
 }
        public ProxyContact(int factory, IProxy proxy)
        {
            deliverData = (a, b) => Table.Deliver(this, a, b);
            deliverPing = () => Table.DeliverPing(this);

            this.factoryKey = factory;
            this.ProxyInstance = proxy;

            if (proxy != null)
                proxy.Bind(deliverPing, deliverData);
        }
Esempio n. 11
0
 protected override void OnStart(string[] args)
 {
     Proxy.Updater.Updater.Update();
     Assembly ass = Assembly.Load("Mentalis");
     Type tp = ass.GetType("Org.Mentalis.Proxy.Proxy");
     string dir = Environment.CurrentDirectory;
     if (!dir.Substring(dir.Length - 1, 1).Equals(@"\"))
         dir += @"\";
     object obj = Activator.CreateInstance(tp, dir + "config.xml");
     prx = (IProxy)obj;
     prx.Run();
 }
Esempio n. 12
0
 public MainPresenter(IMainForm view)
 {
     this.view = view;
     this.proxy = new Proxy();
     view.LoadAllTables += view_LoadAllTables;
     view.SaveAllTables += SaveAllTables;
     view.AddNewPlayer += view_AddNewPlayer;
     view.AddNewTransaction += view_AddNewTransaction;
     view.AddNewCombat += view_AddNewCombat;
     view.AddNewHit += view_AddNewHit;
     view.EditTransactionCell += view_EditTransactionCell;
     view.EditCombatCell += view_EditCombatCell;
 }
Esempio n. 13
0
 public ClientActionContext(IProxy proxy, Type contract, MethodInfo action, object[] parameters)
     : base(contract, action, parameters)
 {
     Proxy = proxy;
     Request = new HttpRequestMessage();
     if (ActionMetadata.CancellationTokenIndex >= 0 && parameters != null)
     {
         var cancellation = parameters[ActionMetadata.CancellationTokenIndex];
         if (cancellation is CancellationToken)
         {
             RequestAborted = (CancellationToken) cancellation;
         }
     }
 }
Esempio n. 14
0
 public Invocation(
     object target,
     IProxy proxy,
     MethodInfo method, 
     object[] arguments,
     ProxyTargetInvocation proxyTargetInvocation,
     IInterceptor[] interceptors)
 {
     _target = target;
     _proxy = proxy;
     _method = method;
     _arguments = arguments;
     _proxyTargetInvocation = proxyTargetInvocation;
     _interceptors = interceptors;
 }
Esempio n. 15
0
		private static List<string> GetRecipientAddressList(IProxy mailItem)
		{
			int count = mailItem.GetRecipientSmtpAddressCount();
			if (count == 0)
			{
				return new List<string>();
			}

			List<string> list = new List<string>();
			for (int i = 0; i != count; ++i)
			{
				list.Add(mailItem.GetRecipientSmtpAddress(i));
			}
			return list;
		}
Esempio n. 16
0
 protected void _RegisterProxy(IProxy proxy)
 {
     if (proxy == null)
     {
         Log.Error("Module:_RegisterProxy - proxy is null");
         return;
     }
     if (_proxy != null)
     {
         Log.Error("Module:_RegisterProxy - _proxy already exist, Don't regist twice");
         return;
     }
     _proxy = proxy;
     _proxy.OnRegister();
 }
Esempio n. 17
0
		public void Start(Application app, IProxy proxy)
		{
			try
			{
				if (!start)
				{
					start = true;
					ConfigureControllers(app);
				}
				InjectObjects(app, proxy);
			}
			catch (Exception e)
			{
				Debug.WriteLine("[ERROR]: " + e.StackTrace);
			}
		}
Esempio n. 18
0
		internal bool ExecuteSendLinkAction(IProxy mailItem, RequestManager requestManager)
		{
            throw new NotImplementedException("SendLink is not supported for Lotus Notes");
            //Interop.Logging.Logger.LogInfo("Executing Send Link Process");
            //try
            //{
            //    Attachment[] processedAttachments = requestManager.EnforceResponse.ModifiedRequest.Attachments;
            //    if (processedAttachments.Length == 0)
            //    {
            //        Interop.Logging.Logger.LogInfo("No files to upload");
            //        return true;
            //    }

            //    string id = Guid.NewGuid().ToString();
            //    List<SendLinkInfo> filesToUpload = GetFilesToUpload(processedAttachments, id);
            //    List<string> emailAddresses = GetRecipientAddressList(mailItem);
            //    string subject = ConvertLineFeed2WhiteSpace(mailItem.GetSubject()).TrimEnd();

            //    // Upload to the cloud
            //    var sendLinkAction = GetSendLinkAction(requestManager.Response);
            //    var storageLinks = GetStorageLinks(requestManager.Response, sendLinkAction);
            //    storageLinks.Authenticate();
            //    List<SendLinkInfo> filesUploaded = RetrieveLinks(storageLinks, sendLinkAction, requestManager.Response, filesToUpload, emailAddresses, subject, id);

            //    // Update proxy for Notes extension manager
            //    UpdateProxyForSendLink(mailItem, GetSendLinkText(), filesUploaded, id);

            //    return true;
            //}
            //catch (StorageUnavailableException ex)
            //{
            //    // note, the class name for Notes window is SWT_Window0 however class name is not unique to notes (most SWT framework apps will have this class name)
            //    WsMessage.ShowMessage(IntPtr.Zero, Resources.PleaseCheckYourInternetConnection, MessageButtons.WsOK, MessageBranding.WsProtect,
            //                             MessageType.WsErrorIcon, Resources.UnableToConnectToSendLink, -1);
            //    throw new AbortSendLinkException(ex.Message);
            //}
            //catch (Exception e)
            //{
            //    Interop.Logging.Logger.LogError(e);
            //    throw;
            //}
		}
Esempio n. 19
0
		public static object GetProperty(IProxy proxy, string propertyName, Type propertyType, object refValue)
		{
#if NPDEBUG
			Console.Write(propertyType.ToString());
#endif
			bool cancel = false;
			IInterceptor interceptor = proxy.GetInterceptor();
			if (interceptor.Notification != Notification.Disabled)
			{
				if (interceptor != null)
				{
					interceptor.NotifyPropertyGet(proxy, propertyName, ref refValue, ref cancel);
				}
				if (cancel)
				{
					return GetDefaultValue(propertyType);
				}
				if (interceptor != null)
				{
					interceptor.NotifyReadProperty(proxy, propertyName, refValue);
				}
			}
			return refValue;
		}
Esempio n. 20
0
 private void InternalDisconnect()
 {
     if (_proxy != null)
     {
         _proxy.ConnectionLost -= OnConnectionLost;
         _proxy.Disconnect();
         _proxy = null;
     }
 }
Esempio n. 21
0
 public AsyncSession(IProxy remote)
 {
     Remote = remote;
 }
Esempio n. 22
0
 public void RegisterInstance(IProxy proxy)
 {
     if (!SimpleIoc.Default.IsRegistered<IProxy>())
         SimpleIoc.Default.Register<IProxy>(() => proxy);
 }
Esempio n. 23
0
        public static Object NewInstance(IProxy proxy, Type clsType, Type objInterface)
        {
            Object objectInstance = Activator.CreateInstance(clsType);

            return(proxy.NewProxyInstance(objectInstance, objInterface, new ProxyHandler(objectInstance)));
        }
Esempio n. 24
0
 public DesignDataService(IProxy proxy)
 {
     _proxy = proxy;
 }
Esempio n. 25
0
 public void RegisterProxy(IProxy proxy)
 {
     this.m_model.RegisterProxy(proxy);
 }
Esempio n. 26
0
 public void RegisterProxy(string proxyName, IProxy proxy)
 {
     proxyDispatcher?.Register(proxyName, proxy);
 }
Esempio n. 27
0
 /// <summary>
 /// Register an <c>IProxy</c> with the <c>Model</c>.
 /// </summary>
 /// <param name="proxy">proxy an <c>IProxy</c> to be held by the <c>Model</c>.</param>
 public virtual void RegisterProxy(IProxy proxy)
 {
     proxy.InitializeNotifier(multitonKey);
     proxyMap[proxy.ProxyName] = proxy;
     proxy.OnRegister();
 }
Esempio n. 28
0
 public SecurityRoles(IProxy client) : base("security_roles", client)
 {
 }
Esempio n. 29
0
 public JobsApiService(IProxy proxy)
 {
     _proxy = proxy;
 }
Esempio n. 30
0
 public void RegisterProxy(IProxy proxy)
 {
     GetModel.RegisterProxy(proxy);
 }
Esempio n. 31
0
 /// <summary>
 /// 通过proxyName获取proxy
 /// </summary>
 /// <param name="proxyName"></param>
 /// <returns></returns>
 public IProxy RetrieveProxy(string proxyName)
 {
     IProxy proxy = HasProxy(proxyName) ? proxyMap[proxyName] : null ;
     return proxy;
 }
Esempio n. 32
0
 /// <summary>
 /// 注册Proxy
 /// </summary>
 /// <param name="proxy"></param>
 public void RegisterProxy(IProxy proxy)
 {
     proxyMap[proxy.proxyName] = proxy;
     proxy.OnRegister();
 }  
Esempio n. 33
0
        public void Connect(int connectTimeout)
        {
            if (m_isConnected)
                throw new JSchException("session is already connected");

            m_io = new IO();
            if (m_random == null)
                try
                {
                    Class c = Class.ForName(getConfig("random"));
                    m_random = (Random)(c.Instance());
                }
                catch (Exception e)
                {
                    throw e;
                }

            Packet.setRandom(m_random);
            try
            {
                int i, j;
                if (m_proxy == null)
                {
                    m_proxy = m_jsch.getProxy(m_host);
                    if (m_proxy != null)
                        lock (m_proxy)
                        {
                            m_proxy.close();
                        }
                }

                if (m_proxy == null)
                {
                    Stream In;
                    Stream Out;
                    if (m_socket_factory == null)
                    {
                        m_socket = Util.createSocket(m_host, m_port, connectTimeout);
                        In = m_socket.getInputStream();
                        Out = m_socket.getOutputStream();
                    }
                    else
                    {
                        m_socket = m_socket_factory.createSocket(m_host, m_port);
                        In = m_socket_factory.getInputStream(m_socket);
                        Out = m_socket_factory.getOutputStream(m_socket);
                    }
                    //if(timeout>0){ socket.setSoTimeout(timeout); }
                    m_socket.setTcpNoDelay(true);
                    m_io.setInputStream(In);
                    m_io.setOutputStream(Out);
                }
                else
                    lock (m_proxy)
                    {
                        m_proxy.connect(m_socket_factory, m_host, m_port, connectTimeout);
                        m_io.setInputStream(m_proxy.InputStream);
                        m_io.setOutputStream(m_proxy.OutputStream);
                        m_socket = m_proxy.Socket;
                    }

                if (connectTimeout > 0 && m_socket != null)
                    m_socket.setSoTimeout(connectTimeout);

                m_isConnected = true;

                while (true)
                {

                    i = 0;
                    j = 0;
                    while (i < m_buf.m_buffer.Length)
                    {
                        j = m_io.getByte();
                        if (j < 0)
                            break;
                        m_buf.m_buffer[i] = (byte)j; i++;
                        if (j == 10)
                            break;
                    }
                    if (j < 0)
                        throw new JSchException("connection is closed by foreign host");

                    if (m_buf.m_buffer[i - 1] == '\n')
                    {
                        i--;
                        if (m_buf.m_buffer[i - 1] == '\r')
                            i--;
                    }

                    if (i > 4
                    && (i != m_buf.m_buffer.Length)
                    && (m_buf.m_buffer[0] != 'S' || m_buf.m_buffer[1] != 'S' || m_buf.m_buffer[2] != 'H' || m_buf.m_buffer[3] != '-')
                        )
                        continue;

                    if (i == m_buf.m_buffer.Length
                    || i < 7    // SSH-1.99 or SSH-2.0
                    || (m_buf.m_buffer[4] == '1' && m_buf.m_buffer[6] != '9')  // SSH-1.5
                        )
                        throw new JSchException("invalid server's version String");
                    break;
                }

                m_server_version = new byte[i];
                Array.Copy(m_buf.m_buffer, 0, m_server_version, 0, i);
                {
                    // Some Cisco devices will miss to read '\n' if it is sent separately.
                    byte[] foo = new byte[m_client_version.Length + 1];
                    Array.Copy(m_client_version, 0, foo, 0, m_client_version.Length);
                    foo[foo.Length - 1] = (byte)'\n';
                    m_io.put(foo, 0, foo.Length);
                }

                m_buf = read(m_buf);
                if (m_buf.m_buffer[5] != SSH_MSG_KEXINIT)
                    throw new JSchException("invalid protocol: " + m_buf.m_buffer[5]);

                KeyExchange kex = receive_kexinit(m_buf);

                while (true)
                {
                    m_buf = read(m_buf);
                    if (kex.getState() == m_buf.m_buffer[5])
                    {
                        bool result = kex.next(m_buf);
                        if (!result)
                        {
                            m_in_kex = false;
                            throw new JSchException("verify: " + result);
                        }
                    }
                    else
                    {
                        m_in_kex = false;
                        throw new JSchException("invalid protocol(kex): " + m_buf.m_buffer[5]);
                    }
                    if (kex.getState() == KeyExchange.STATE_END)
                        break;
                }

                try
                {
                    checkHost(m_host, kex);
                }
                catch (JSchException ee)
                {
                    m_in_kex = false;
                    throw ee;
                }

                send_newkeys();

                // receive SSH_MSG_NEWKEYS(21)
                m_buf = read(m_buf);
                if (m_buf.m_buffer[5] == SSH_MSG_NEWKEYS)
                    receive_newkeys(m_buf, kex);
                else
                {
                    m_in_kex = false;
                    throw new JSchException("invalid protocol(newkyes): " + m_buf.m_buffer[5]);
                }

                bool auth = false;
                bool auth_cancel = false;

                UserAuthNone usn = new UserAuthNone(m_userinfo);
                auth = usn.start(this);

                string methods = null;
                if (!auth)
                {
                    methods = usn.getMethods();
                    if (methods != null)
                        methods = methods.ToLowerInvariant();
                    else
                        methods = "publickey,password,keyboard-interactive";
                }

                while (true)
                {
                    while (!auth && methods != null && methods.Length > 0)
                    {
                        UserAuth us = null;
                        if (methods.StartsWith("publickey"))
                        {
                            lock (m_jsch.Identities)
                            {
                                if (m_jsch.Identities.Count > 0)
                                    us = new UserAuthPublicKey(m_userinfo);
                            }
                        }
                        else if (methods.StartsWith("keyboard-interactive"))
                        {
                            if (m_userinfo is UIKeyboardInteractive)
                                us = new UserAuthKeyboardInteractive(m_userinfo);
                        }
                        else if (methods.StartsWith("password"))
                            us = new UserAuthPassword(m_userinfo);

                        if (us != null)
                        {
                            try
                            {
                                auth = us.start(this);
                                auth_cancel = false;
                            }
                            catch (JSchAuthCancelException)
                            {
                                auth_cancel = true;
                            }
                            catch (JSchPartialAuthException ex)
                            {
                                methods = ex.getMethods();
                                auth_cancel = false;
                                continue;
                            }
                            catch (RuntimeException ee)
                            {
                                throw ee;
                            }
                            catch (Exception ee)
                            {
                                Console.WriteLine("ee: " + ee); // SSH_MSG_DISCONNECT: 2 Too many authentication failures
                            }
                        }

                        if (!auth)
                        {
                            int comma = methods.IndexOf(",");
                            if (comma == -1)
                                break;
                            methods = methods.Substring(comma + 1);
                        }
                    }
                    break;
                }

                if (connectTimeout > 0 || m_timeout > 0)
                    m_socket.setSoTimeout(m_timeout);

                if (auth)
                {
                    m_isAuthed = true;
                    m_connectThread = new Thread(this);
                    m_connectThread.Name = "Connect thread " + m_host + " session";
                    m_connectThread.Start();
                    return;
                }
                if (auth_cancel)
                    throw new JSchException("Auth cancel");
                throw new JSchException("Auth fail");
            }
            catch (Exception e)
            {
                m_in_kex = false;
                if (m_isConnected)
                {
                    try
                    {
                        m_packet.reset();
                        m_buf.putByte((byte)SSH_MSG_DISCONNECT);
                        m_buf.putInt(3);
                        m_buf.putString(e.ToString());
                        m_buf.putString("en");
                        write(m_packet);
                        disconnect();
                    }
                    catch (Exception)
                    { }
                }
                m_isConnected = false;

                if (e is RuntimeException)
                    throw (RuntimeException)e;
                if (e is JSchException)
                    throw (JSchException)e;
                throw new JSchException("Session.connect: " + e);
            }
        }
Esempio n. 34
0
 // The ProxyConfiguration and Proxy will be injected the the DI framework
 public HomeController(IProxyConfiguration proxyConfiguration, IProxy proxy)
 {
     this.injectedProxyConfiguration = proxyConfiguration;
     this.injectedProxy = proxy;
 }
 public GreaterThanValidator(ValidationPipe pipe, IProxy argument, IErrorStringProvider errorProvider, IBoolProxy isEnforced,
                             IValueConverter valueConverter, bool strictValidation, bool validatesOnTargetUpdated)
     : base(pipe, argument, errorProvider, isEnforced, valueConverter, strictValidation, validatesOnTargetUpdated)
 {
 }
Esempio n. 36
0
		public ProxyException(IProxy proxy, string message) : base(message)
		{
			Proxy = proxy;
		}
Esempio n. 37
0
 public MockInfo(IProxy proxy)
 {
     this.proxy = proxy ?? throw new ArgumentNullException(nameof(proxy));
     proxy.Behaviors.CollectionChanged += OnBehaviorsChanged;
 }
Esempio n. 38
0
 public WebService()
 {
     proxy = ProxyFactory.CreateProxy();
     bo    = proxy.CreateObject <SmartBox.Console.Bo.AppCenter.AppCenterBO>();
 }
Esempio n. 39
0
 public override void RegisterProxy(IProxy proxy)
 {
     base.RegisterProxy(proxy);
 }
Esempio n. 40
0
 // ReSharper disable once InconsistentNaming
 private HandleResult OnConnect(IAgent sender, IntPtr connId, IProxy proxy)
 {
     AddLog($"OnConnect({connId})");
     return(HandleResult.Ok);
 }
Esempio n. 41
0
 public void UnregisterProxy(IProxy proxy)
 {
     ModelManager.GetInstance().UnregisterProxy(proxy);
 }
Esempio n. 42
0
 public Handler(string name, IProxy proxy)
 {
     m_handlerName = name;
     Proxy         = proxy;
 }
Esempio n. 43
0
 public Defects(IProxy client) : base("defects", client)
 {
 }
Esempio n. 44
0
        protected virtual void InitializeTest(int iteration = -1, [CallerMemberName] string testName = "")
        {
            if (string.IsNullOrWhiteSpace(testName))
            {
                throw new ArgumentNullException(nameof(testName));
            }

            lock (_syncpoint)
            {
                if (_initialized)
                {
                    throw new InvalidOperationException("Test already initialized.");
                }

                _iteration = iteration;

                InitializeTestPaths(testName);

                var projectDirectory = Path.Combine(_solutionDirectory, _projectDirectory);
                var options          = new ProxyOptions(Translate(TestMode), _solutionDirectory, projectDirectory)
                {
                    FauxPrefixPath = FauxDataSolutionPath,
                    FauxResultPath = FauxDataResultPath,
                    FauxHomePath   = FauxDataHomePath,
                };

                if (_proxy is null)
                {
                    _proxy = Test.Proxy.Create(Context, options);
                }

                switch (TestMode)
                {
                case UnitTestMode.Capture:
                {
                    _proxy.Data.ResultPath  = Path.Combine(projectDirectory, TestResultDirectoryName);
                    _proxy.Data.DisplayName = _testName;
                }
                break;

                case UnitTestMode.Replay:
                {
                    using (var readableStream = File.Open(_testDataFile, FileMode.Open, FileAccess.Read, FileShare.Read))
                    {
                        _proxy.ReadTestData(readableStream);
                    }

                    _proxy.Data.ResultPath = FauxDataResultPath;
                }
                break;

                case UnitTestMode.NoProxy:
                    break;

                default:
                    throw new InvalidOperationException($"`{TestMode}` is an undefined value for `{typeof(UnitTestMode).FullName}`.");
                }

                _initialized = true;
            }
        }
 public WebService()
 {
     proxy = ProxyFactory.CreateProxy();
     bo = proxy.CreateObject<SmartBox.Console.Bo.AppCenter.AppCenterBO>();
 }
Esempio n. 46
0
		private void UpdateProxyForSendLink(IProxy mailItem, string message, List<SendLinkInfo> uploadedFiles, string id)
		{
			mailItem.SetLinkMessage(message);

			foreach (SendLinkInfo sli in uploadedFiles)
			{
				if (0 != mailItem.ContainsAttachment(sli.ContentId))
				{
					//Update existing
					global::Interop.Workshare.Client.NotesProxy.Attachment proxyAttachment = mailItem.GetAttachmentById(sli.ContentId);
					proxyAttachment.SetLink(string.IsNullOrEmpty(sli.Link) ? "" : sli.Link);
					proxyAttachment.SetProcessStatus(AttachmentProcessStatus.ProcessStatus_ReplaceWithLink);
					
					// The displayname of the first item can change if there is a single link for the collection
					proxyAttachment.SetDisplayName(string.IsNullOrEmpty(sli.DisplayName) ? "" : sli.DisplayName);
				}
			}

			if (ShouldAttachSendLinkContentFile())
			{
				SendLinkInfo sli = CreateSendLinkContentFile(uploadedFiles, id);
				global::Interop.Workshare.Client.NotesProxy.Attachment proxyAttachment = new global::Interop.Workshare.Client.NotesProxy.Attachment();
				proxyAttachment.SetFileName(sli.FilePath);
				proxyAttachment.SetDisplayName(sli.DisplayName);
				proxyAttachment.SetProcessStatus(AttachmentProcessStatus.ProcessStatus_New);
				proxyAttachment.SetContentId(Guid.NewGuid().ToString("B")); //B = 32 digits separated by hyphens, enclosed in brace
				proxyAttachment.SetContentItemIndex(-1); // -1 = At end of message
				mailItem.AddAttachment(proxyAttachment);
			}
		}
 public DiBusinessLibrary(IDbProvider dbProvider, IProxy proxy, ILoggingComponent logger)
 {
     _dbProvider = dbProvider;
     _proxy = proxy;
     _logger = logger;
 }
    public void bar()
    {
        IProxy proxyObj = Helper.GetProxyInstance(1);

        proxyObj.Foo();
    }
Esempio n. 49
0
        public bool Connect(string address, string name, string password)
        {
            if (address == null)
                throw new ArgumentNullException("address");
            if (name == null)
                throw new ArgumentNullException("name");

            if (Version == null)
            {
                Log.Default.WriteLine(LogLevels.Error, "Cannot connect, version is not set");
                return false;
            }

            if (_proxy != null)
            {
                Log.Default.WriteLine(LogLevels.Error, "Proxy already created, must disconnect before reconnecting");
                return false;
            }

            try
            {
                _proxy = _factory.CreateProxy(this, address);
                _proxy.ConnectionLost += OnConnectionLost;

                Name = name;

                _proxy.Do(x => x.AdminConnect(Version, name, password));

                return true;
            }
            catch(Exception ex)
            {
                Log.Default.WriteLine(LogLevels.Error, "Problem in Connect. Exception:{0}", ex.ToString());
                return false;
            }
        }
Esempio n. 50
0
 public virtual void RegisterProxy(IProxy proxy)
 {
     model.RegisterProxy(proxy);
 }
Esempio n. 51
0
 public void RegisterProxy(IProxy proxy)
 {
     Model.Instance.RegisterProxy(proxy);
 }
Esempio n. 52
0
 public OrdersRepository(ICompanyContext ctx, IProxy <ICompanyContext, EF.Example.Order> proxy = null) : base(ctx, proxy)
 {
 }
Esempio n. 53
0
 public void setProxy(IProxy proxy)
 {
     this.m_proxy = proxy;
 }
Esempio n. 54
0
 public ClientsRepository(ICompanyContext ctx, IProxy <ICompanyContext, EF.Example.Customer> proxy = null) : base(ctx, proxy)
 {
 }
Esempio n. 55
0
        public void disconnect()
        {
            if (!m_isConnected)
                return;

            Channel.disconnect(this);
            m_isConnected = false;
            PortWatcher.delPort(this);
            ChannelForwardedTCPIP.delPort(this);

            lock (m_connectThread)
            {
                m_connectThread.yield();
                m_connectThread.Interrupt();
                m_connectThread = null;
            }
            m_thread = null;
            try
            {
                if (m_io != null)
                {
                    if (m_io.m_ins != null)
                        m_io.m_ins.Close();
                    if (m_io.m_outs != null)
                        m_io.m_outs.Close();
                    if (m_io.m_outs_ext != null)
                        m_io.m_outs_ext.Close();
                }
                if (m_proxy == null)
                {
                    if (m_socket != null)
                        m_socket.Close();
                }
                else
                {
                    lock (m_proxy)
                    {
                        m_proxy.close();
                    }
                    m_proxy = null;
                }
            }
            catch { }

            m_io = null;
            m_socket = null;
            m_jsch.removeSession(this);
        }
Esempio n. 56
0
 public ProductsRepository(ICompanyContext ctx, IProxy <ICompanyContext, EF.Example.Product> proxy = null) : base(ctx, proxy)
 {
 }
Esempio n. 57
0
 public Features(IProxy client) : base("features", client)
 {
 }
Esempio n. 58
0
 public SenderFactory(Client client, IProxy proxy) : base(client, proxy)
 {
 }
Esempio n. 59
0
 public void RegisterProxy(IProxy prox)
 {
     m_model.RegisterProxy(prox);
 }
Esempio n. 60
0
 protected BasePresentationService(string instance)
 {
     this.proxy = new Proxy(instance);
 }