public void SetAxosoftProxy(Proxy axosoftProxy)
		{
			AxosoftProxy = axosoftProxy;

			// set Axosoft host label
			AxosoftHostLabel.Text = new Uri(Program.Settings.Url).Host;

			GetProjects();
			if (Projects.Count == 0)
			{
				// there are no projects. ask the user if they want to create a new project.
				var dialogResult = MessageBox.Show(
					"Your Axosoft database has no projects. To use this example, you will need to create a project. Would you like to create a new project called \"API Example Project\" now?",
					"Create an Axosoft scrum project",
					MessageBoxButtons.YesNo,
					MessageBoxIcon.Question);

				if (dialogResult == DialogResult.Yes)
				{
					var project = new Project
					{
						Name = "API Example Project"
					};

					AxosoftProxy.Projects.Create(project);
					GetProjects();
				}
				else
				{
					Application.Exit();
					return;
				}
			}
			GetItems();
		}
        /// <summary>
        /// <c>AssembleDocument</c> assembles (creates) a document from the given template, answers and settings.
        /// </summary>
        /// <param name="template">An instance of the Template class, from which the document will be assembled.</param>
        /// <param name="answers">The set of answers that will be applied to the template to assemble the document</param>
        /// <param name="settings">settings that will be used to assemble the document. 
        /// These settings include the assembled document format (file extension), markup syntax, how to display fields with unanswered variables, etc</param>
        /// <param name="logRef">A string to display in logs related to this request.</param>
        /// <returns>returns information about the assembled document, the document type, the unanswered variables, the resulting answers, etc.</returns>
        public AssembleDocumentResult AssembleDocument(Template template, TextReader answers, AssembleDocumentSettings settings, string logRef)
        {
            // Validate input parameters, creating defaults as appropriate.
            string logStr = logRef == null ? string.Empty : logRef;

            if (template == null)
                throw new ArgumentNullException("template", string.Format(@"WebService.Services.AssembleDocument: the ""template"" parameter passed in was null, logRef: {0}", logStr));

            if (settings == null)
                settings = new AssembleDocumentSettings();

            AssembleDocumentResult result = null;
            AssemblyResult asmResult = null;

            using (Proxy client = new Proxy(_endPointName))
            {
                OutputFormat outputFormat = ConvertFormat(settings.Format);
                AssemblyOptions assemblyOptions = ConvertOptions(settings);
                string fileName = GetRelativePath(template.GetFullPath());
                asmResult = client.AssembleDocument(
                    fileName,
                    answers == null ? null : new BinaryObject[] { Util.GetBinaryObjectFromTextReader(answers) }, // answers
                    outputFormat,
                    assemblyOptions,
                    null);
                SafeCloseClient(client, logRef);
            }

            if (asmResult != null)
            {
                result = Util.ConvertAssemblyResult(template, asmResult, settings.Format);
            }

            return result;
        }
Пример #3
0
        private void PopulateVersionInfo( string libraryUrl, string documentName, Proxy.NavigatorRef.ItemKind kind )
        {
            this.Items.Clear( );
            FileIconManager iconManager = new FileIconManager( this.SmallImageList, this.LargeImageList );

            int versionCount = Proxy.ArtifactProxy.GetVersionCount( libraryUrl, documentName );
            int i = 0;
            for( i = 0; i < versionCount; ++i )
            {
                string versionLabel = Proxy.ArtifactProxy.GetVersionLabel( libraryUrl, documentName, i );

                VersionInfo info = new VersionInfo( i, versionLabel );

                ListViewItem item = new ListViewItem( documentName );
                ListViewItem.ListViewSubItem subItem = new ListViewItem.ListViewSubItem( item, versionLabel );

                item.Tag = info;
                SetIcon( iconManager, item, documentName, kind );
                item.SubItems.Add( subItem );
                this.versionInfo = info;
                this.Items.Add( item );
            }

            this.Items[ i - 1 ].Selected = true;
        }
Пример #4
0
        public ConClient(Proxy proxy, Client client)
        {
            _toConnect = client;
            _proxy = proxy;
            currentServ = _proxy.defServer;
            lastRealm = "Nexus";
            Save(currentServ);

            _vault.IsFromArena = false;
            _vault.GameId = -5;
            _vault.Host = "localhost"; // (reconnect.Host == "" ? _proxy.getRemoteAddress(client) : reconnect.Host);
            _vault.Port = 2050;
            _vault.Key = new byte[0];
            _vault.KeyTime = 0;
            _vault.Name = "{\"text\":\"server.vault\"}";
            _vault.Send = true;

            _yard.IsFromArena = false;
            _yard.GameId = 3235;
            _yard.Host = "localhost"; // (reconnect.Host == "" ? _proxy.getRemoteAddress(client) : reconnect.Host);
            _yard.Port = 2050;
            _yard.Key = new byte[0];
            _yard.KeyTime = 0;
            _yard.Name = "Pet Yard";
            _yard.Send = true;

            _ghall.IsFromArena = false;
            _ghall.GameId = 3244;
            _ghall.Host = "localhost"; // (reconnect.Host == "" ? _proxy.getRemoteAddress(client) : reconnect.Host);
            _ghall.Port = 2050;
            _ghall.Key = new byte[0];
            _ghall.KeyTime = 0;
            _ghall.Name = "Guild Hall";
            _ghall.Send = true;
        }
Пример #5
0
 public void Initialize(Proxy proxy)
 {
     proxy.HookPacket(PacketType.UPDATE, OnUpdate);
     proxy.HookPacket(PacketType.MAPINFO, GetMapInfo);
     proxy.HookPacket(PacketType.CREATESUCCESS, OnEnterMap);
     initialized = false;
 }
Пример #6
0
 public void Initialize(Proxy proxy)
 {
     proxy.HookPacket(PacketType.UPDATE, OnUpdate);
     proxy.HookPacket(PacketType.NEWTICK, OnUpdate);
     proxy.ClientConnected += (client) => _fame.Add(client, -1);
     proxy.ClientDisconnected += (client) => _fame.Remove(client);
 }
Пример #7
0
        static void Main(string[] args)
        {
            int port;
             int maxPackageLength;

             var settings = Settings.Load();

             ParseArgs(args, out port, out maxPackageLength);

             Console.WriteLine("Ember+ Proxy v{0} (GlowDTD v{1} - EmBER v{2}) started.",
                           typeof(Program).Assembly.GetName().Version,
                           GlowReader.UshortVersionToString(EmberLib.Glow.GlowDtd.Version),
                           GlowReader.UshortVersionToString(EmberLib.EmberEncoding.Version));

             using(var proxy = new Proxy(settings.EndPoints, maxPackageLength))
             {
            proxy.Connect();

            using(var listener = new Provider.GlowListener(port, maxPackageLength, proxy))
            {
               Console.WriteLine("Listening on port {0}. Press enter to quit...", port);
               Console.ReadLine();
            }
             }
        }
Пример #8
0
        public Proxy.IRelationship CreateRelationship(TransactionFramework.ISoapTransactionLink transactionLink, Guid domainId, Guid rootMapId, Dictionary<Proxy.ConnectionType, Proxy.INode> nodes, Proxy.RelationshipType relationshipType, string originalId)
        {
            FacadeRelationship facadeRelationship = new FacadeRelationship();

            InProcess.InProcessRelationship relationship = new InProcess.InProcessRelationship(MapManager);
            relationship.OriginLink = transactionLink;
            relationship.Facade = facadeRelationship;
            relationship.Id = Guid.NewGuid();
            relationship.DomainId = domainId;
            relationship.RootMapId = rootMapId;
            relationship.RelationshipType = relationshipType;
            relationship.OriginalId = originalId;
            relationship.Status = Proxy.LoadState.Full;

            facadeRelationship.BaseRelationship = relationship;

            foreach (KeyValuePair<Proxy.ConnectionType, Proxy.INode> relationshipContext in nodes)
            {
                Proxy.ConnectionSet connection = Proxy.ConnectionSetFactory.Instance.GetConnection(relationshipContext.Value, facadeRelationship, relationshipContext.Key);

                Proxy.INodeManager newRelationshipNodes = relationship.Nodes;
                newRelationshipNodes.Load(connection);

                Proxy.IRelationshipManager nodeRelationships = relationshipContext.Value.Relationships;
                nodeRelationships.Load(connection);
            }

            InProcessRelationships.Add(transactionLink, facadeRelationship);

            return facadeRelationship;
        }
Пример #9
0
        public void SendAndReceive()
        {
            using (var context = NetMQContext.Create())
            using (var front = context.CreateRouterSocket())
            using (var back = context.CreateDealerSocket())
            {
                front.Bind("inproc://frontend");
                back.Bind("inproc://backend");

                var proxy = new Proxy(front, back);
                Task.Factory.StartNew(proxy.Start);

                using (var client = context.CreateRequestSocket())
                using (var server = context.CreateResponseSocket())
                {
                    client.Connect("inproc://frontend");
                    server.Connect("inproc://backend");

                    client.SendFrame("hello");
                    Assert.AreEqual("hello", server.ReceiveFrameString());
                    server.SendFrame("reply");
                    Assert.AreEqual("reply", client.ReceiveFrameString());
                }

                proxy.Stop();
            }
        }
Пример #10
0
 public void Initialize(Proxy proxy)
 {
     proxy.HookPacket<HelloPacket>(OnHelloPacket);
     proxy.HookPacket<MapInfoPacket>(OnMapInfoPacket);
     proxy.HookPacket<UpdatePacket>(OnUpdatePacket);
     proxy.HookPacket<NewTickPacket>(OnNewTickPacket);
 }
Пример #11
0
        public override object ProvideValue(IServiceProvider serviceProvider)
        {
            var pvt = serviceProvider as IProvideValueTarget;
            if (pvt == null)
            {
                return null;
            }

            _frameworkElement = pvt.TargetObject as FrameworkElement;
            if (_frameworkElement == null)
            {
                return this;
            }

            _target = pvt.TargetProperty as DependencyProperty;
            if (_target == null)
            {
                return this;
            }

            _frameworkElement.DataContextChanged += FrameworkElement_DataContextChanged;

            var proxy = new Proxy();
            var binding = new Binding()
            {
                Source = proxy,
                Path = new PropertyPath("Value")
            };

            // Make sure we don't leak subscriptions
            _frameworkElement.Unloaded += (e, v) => _subscription.Dispose();

            return binding.ProvideValue(serviceProvider);
        }
Пример #12
0
		private void LoginButton_Click(object sender, EventArgs e)
		{
			var axosoftProxy = new Proxy
			{
				Url = Program.Settings.Url,
				ClientId = Program.Settings.ClientId,
				ClientSecret = Program.Settings.ClientSecret
			};

			try
			{
				axosoftProxy.ObtainAccessTokenFromUsernamePassword
				(
					username: LoginIdText.Text,
					password: PasswordText.Text,
					scope: ScopeEnum.ReadWrite
				);
			}
			catch (AxosoftAPIException<ErrorResponse> ex)
			{
				MessageBox.Show(
					"An error occurred when obtaining access token from Axosoft: " + ex.Message,
					"Error obtaining access token",
					MessageBoxButtons.OK,
					MessageBoxIcon.Error);
			}

			if (!string.IsNullOrWhiteSpace(axosoftProxy.AccessToken))
			{
				LoggedIn(this, new LoginEventArgs(axosoftProxy));
			}
		}
Пример #13
0
 public InternetOptionsItem()
 {
     timeout = InternetClient.DefaultTimeout;
     currentEncoding = Encoding.GetEncoding("shift_jis");
     boardTableSourceUrl = "http://menu.2ch.net/bbsmenu.html";
     Proxy = new Proxy();
 }
Пример #14
0
        static void Main(string[] args)
        {
            IPAddress ip = null;
            int port = 0;

            var p = new OptionSet()
            .Add("a|address=", v => ip = IPAddress.Parse(v))
            .Add("p|port=", v => port = int.Parse(v));

            p.Parse(args);

            var proxy = new Proxy
            {
                ListenToIp = ip,
                ListenOnPort = port
            };
            proxy.Start();

            Console.WriteLine("Proxy is started ans listening on {0}:{1}", proxy.ListenToIp, proxy.ListenOnPort);
            Console.WriteLine("Press 'Q' to stop the proxy");

            while (true)
            {
                if (Console.KeyAvailable)
                {
                    var key = Console.ReadKey(true);
                    if (key.Key == ConsoleKey.Q)
                    {
                        proxy.Stop();
                        Console.WriteLine("Proxy is stopped");
                        break;
                    }
                }
            }
        }
Пример #15
0
        private async void FrmMainMetro_Load(object sender, EventArgs e)
        {
			Action[] workers =
			{
				GameData.Load,

				// suppress obsolete warnings here
#pragma warning disable 618
				Serializer.SerializeServers,
                Serializer.SerializeGameObjects,
                Serializer.SerializePacketIds,
                Serializer.SerializePacketTypes,
#pragma warning restore 618

				InitPackets,
                InitSettings
            };

            await Task.Run(() =>
            {
                Parallel.ForEach(workers, (worker) =>
                {
                    //try
                    {
                        worker.Invoke();
                    }/*
                    catch (Exception ex)
                    {
                        MessageBox.Show(
                            "There was an error while initializing K Relay.\n" +
                            "Please make sure:\n" +
                            "- All files are extracted and in the same directory\n" +
                            "- AntiVirus is not blocking K Relay's connection\n" +
                            "- Another proxy isn't running on your computer\n\n" +
                            "You can try to restart your computer and see if the issue is fixed.\n" +
                            "Additional info is as follows:\n\n" + ex,
                            "K Relay", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        Environment.Exit(ex.HResult);
                    }*/
                });
            });

            _proxy = new Proxy();
            _proxy.ProxyListenStarted += _ => SetStatus("Running", Color.Green);
            _proxy.ProxyListenStopped += _ => SetStatus("Stopped", Color.Red);
            InitPlugins();

			//if (Serializer.Servers.ContainsKey((string)lstServers.SelectedItem))
			if (GameData.Servers.Map.Where(s => s.Value.Name == (string)lstServers.SelectedItem).Any())
				//Proxy.DefaultServer = Serializer.GetServerByFullName((string)lstServers.SelectedItem);
				Proxy.DefaultServer = GameData.Servers.ByName((string)lstServers.SelectedItem).Address;
			else
				PluginUtils.Log("K Relay", "Default server wasn't found, using USWest.");

            PluginUtils.Log("K Relay", "Initialization complete.");

            if (Config.Default.StartProxyByDefault)
                btnToggleProxy_Click(null, null);
        }
Пример #16
0
 public SharePointView( Proxy.NavigatorRef.Item item )
 {
     if( item.Kind != Proxy.NavigatorRef.ItemKind.View )
         throw new ArgumentException( "Item must be of ItemKind.View" );
     this.guid = item.Guid;
     this.title = item.Title;
     this.url = item.Url;
 }
Пример #17
0
        protected override INiIsolationClient CreateWindow()
        {
            var window = new Proxy(this);

            ErrorUtil.ThrowOnFailure(window.Initialize());

            return window;
        }
Пример #18
0
 public Client(Proxy proxy, TcpClient client)
 {
     _proxy = proxy;
     _clientConnection = client;
     _clientStream = _clientConnection.GetStream();
     _clientConnection.NoDelay = true;
     BeginRead(0, 4, true);
 }
Пример #19
0
        public void NodesAndRelationshipBuildEventArgs(Proxy.NodesEventArgs eventArgs, IDictionary<Guid, ServerObjects.Node> nodes, IDictionary<Guid, ServerObjects.Relationship> relationships)
        {
            foreach (ServerObjects.Node serviceNode in nodes.Values)
            {
                Proxy.INode proxyNode = NodeManager.FindNode(serviceNode);

                eventArgs.Nodes.Add(proxyNode.Id, proxyNode);
            }

            foreach (ServerObjects.Relationship serviceRelationship in relationships.Values)
            {
                RelationshipManager.CreateRelationship(serviceRelationship);
            }

            foreach (ServerObjects.Node serviceNode in nodes.Values)
            {
                Proxy.INode proxyNode = NodeManager.FindNode(serviceNode);

                SoapNode soapNode = proxyNode as SoapNode;

                /// Not all the nodes that are stored in the NodeManager are SoapNodes, some are FacadeNodes. In this scenario we want to check if they have an inner SoapNode and use that instead.
                if (soapNode == null)
                {
                    if (proxyNode is FacadeNode)
                    {
                        FacadeNode facadeNode = proxyNode as FacadeNode;
                        soapNode = facadeNode.BaseNode as SoapNode;
                    }
                }

                if (soapNode != null)
                {
                    soapNode.LoadNode(RelationshipManager);
                }
            }

            foreach (ServerObjects.Relationship serviceRelationship in relationships.Values)
            {
                Proxy.IRelationship proxyRelationship = RelationshipManager.FindRelationship(serviceRelationship);

                SoapRelationship soapRelationship = proxyRelationship as SoapRelationship;

                /// Not all the relationships that are stored in the RelationshipManager are SoapRelationships, some are FacadeRelationships. In this scenario we want to check if they have an inner SoapRelationship and use that instead.
                if (soapRelationship == null)
                {
                    if (proxyRelationship is FacadeRelationship)
                    {
                        FacadeRelationship facadeRelationship = proxyRelationship as FacadeRelationship;
                        soapRelationship = facadeRelationship.BaseRelationship as SoapRelationship;
                    }
                }

                if (soapRelationship != null)
                {
                    soapRelationship.LoadRelationship(NodeManager);
                }
            }
        }
Пример #20
0
        public DocumentationTests()
        {
            var processes = System.Diagnostics.Process.GetProcessesByName("Moksy.Host");
            Assert.AreEqual(1, processes.Length, "Moksy.Host is not running. Right click the Moksy.Host project, add 10011 to the Debug / Command Line Arguments and then run Moksy.Host without a debugger. Then try to run this test again. ");

            Proxy = new Proxy(PortNumber);
            Assert.IsTrue(Proxy.Start(), string.Format("Moksy could not start. Try to manually launch 'Moksy.Host.exe {0}' from the Command Line. ", PortNumber));
            Proxy.DeleteAll();
        }
Пример #21
0
 public void Initialize(Proxy proxy)
 {
     _proxy = proxy;
     proxy.HookPacket(PacketType.RECONNECT, OnReconnect);
     proxy.HookPacket(PacketType.CREATESUCCESS, OnCreateSuccess);
     proxy.HookCommand("connect", OnConnectCommand);
     proxy.HookCommand("recon", OnReconnectCommand);
     proxy.HookCommand("drecon", OnDReconnectCommand);
 }
Пример #22
0
        public WebUI(Proxy proxy, ConnectionManager connectionManager)
        {
            this.proxy = proxy;
            this.connectionManager = connectionManager;

            if (webUI != null)
                throw new InvalidOperationException ("There can only be one WebUI");
            webUI = this;
        }
		public OAuthController()
		{
			axosoftProxy = new Proxy
			{
				Url = MvcApplication.Settings.Url,
				ClientId = MvcApplication.Settings.ClientId,
				ClientSecret = MvcApplication.Settings.ClientSecret
			};
		}
Пример #24
0
        public AdvancedSearchDialog( string url, Proxy.NavigatorRef.Navigator navigator )
        {
            if( navigator == null || string.IsNullOrEmpty( url ) )
                throw new ArgumentException( );

            this.url = url;
            this.navigator = navigator;
            InitializeComponent( );
        }
        public override void HandlePacket(Proxy proxy)
        {
            // Interact with the remote server
            proxy.RemoteSharedKey = new byte[16];
            RandomNumberGenerator random = RandomNumberGenerator.Create();
            random.GetBytes(proxy.RemoteSharedKey);

            AsnKeyParser keyParser = new AsnKeyParser(PublicKey);
            var key = keyParser.ParseRSAPublicKey();

            var cryptoService = new RSACryptoServiceProvider();
            cryptoService.ImportParameters(key);
            byte[] encryptedSharedSecret = cryptoService.Encrypt(proxy.RemoteSharedKey, false);
            byte[] encryptedVerify = cryptoService.Encrypt(VerifyToken, false);

            // Construct an 0xFC packet to send the server
            proxy.RemoteEncryptionResponse = new byte[] { 0xFC }
                .Concat(DataUtility.CreateInt16((short)encryptedSharedSecret.Length))
                .Concat(encryptedSharedSecret)
                .Concat(DataUtility.CreateInt16((short)encryptedVerify.Length))
                .Concat(encryptedVerify).ToArray();

            if (ServerId != "-")
            {
                // Generate session hash
                byte[] hashData = Encoding.ASCII.GetBytes(ServerId)
                    .Concat(proxy.RemoteSharedKey)
                    .Concat(PublicKey).ToArray();
                var hash = Cryptography.JavaHexDigest(hashData);
                var webClient = new WebClient();
                string result = webClient.DownloadString("http://session.minecraft.net/game/joinserver.jsp?user="******"&sessionId=" + Uri.EscapeUriString(proxy.Settings.UserSession) +
                    "&serverId=" + Uri.EscapeUriString(hash));
                if (result != "OK")
                    Console.WriteLine("Warning: Unable to login as user " + proxy.Settings.Username + ", expect mixed results.");
            }

            // Interact with the local client
            var verifyToken = new byte[4];
            var csp = new RNGCryptoServiceProvider();
            csp.GetBytes(verifyToken);

            AsnKeyBuilder.AsnMessage encodedKey = AsnKeyBuilder.PublicKeyToX509(Proxy.ServerKey);

            // Construct an 0xFD to send the client
            byte[] localPacket = new[] { PacketId }
                .Concat(DataUtility.CreateString("-"))
                .Concat(DataUtility.CreateInt16((short)encodedKey.GetBytes().Length))
                .Concat(encodedKey.GetBytes())
                .Concat(DataUtility.CreateInt16((short)verifyToken.Length))
                .Concat(verifyToken).ToArray();
            proxy.LocalSocket.BeginSend(localPacket, 0, localPacket.Length, SocketFlags.None, null, null);

            base.HandlePacket(proxy);
        }
Пример #26
0
        public void Can_Utilize_Custom_Interceptors_Example_Of_How_To_Extend_MethodWrapper()
        {
            var wrapper = new CustomWrapper();
            var proxy = new Proxy<IFoo>()
                .InterceptMethod(f => f.Return())
                .With(wrapper)
                .Save();

            Assert.Equal(-1, proxy.Return());
        }
Пример #27
0
 public void Attach(Proxy proxy)
 {
     _proxy = proxy;
     proxy.HookPacket<CreateSuccessPacket>(OnCreateSuccess);
     proxy.HookPacket<MapInfoPacket>(OnMapInfo);
     proxy.HookPacket<UpdatePacket>(OnUpdate);
     proxy.HookPacket<NewTickPacket>(OnNewTick);
     proxy.HookPacket<PlayerShootPacket>(OnPlayerShoot);
     proxy.HookPacket<MovePacket>(OnMove);
 }
Пример #28
0
        public ServiceDynamicProxy(Proxy serviceProxy, Type serviceInterface)
        {
            if (!(serviceInterface.IsInterface && typeof(IROService).IsAssignableFrom(serviceInterface)))
            {
                throw new ArgumentException("Provided type should be an interface inherited from the RemObjects.SDK.IROInterface interface", "serviceInterface");
            }

            this._serviceProxy = serviceProxy;
            this._serviceInterface = serviceInterface;
            this._methodCache = new MethodDefinitionCache(serviceInterface);
        }
Пример #29
0
        public void Initialize(Proxy proxy)
        {
            proxy.ClientConnected += (c) => _states.Add(c, new LootState());
            proxy.ClientDisconnected += (c) => _states.Remove(c);

            proxy.HookPacket(PacketType.MOVE, OnMove);
            proxy.HookPacket(PacketType.UPDATE, OnUpdate);
            proxy.HookPacket(PacketType.NEWTICK, OnNewTick);
            proxy.HookPacket(PacketType.QUESTOBJID, OnQuestObjId);
            proxy.HookCommand("loothelper", OnLootHelperCommand);
        }
Пример #30
0
        public Client(GlowListener host, Socket socket, int maxPackageLength, Proxy proxy)
        {
            Host = host;
             Socket = socket;
             MaxPackageLength = maxPackageLength;
             Proxy = proxy;

             _reader = new GlowReader(GlowReader_RootReady, GlowReader_KeepAliveRequestReceived);
             _reader.Error += GlowReader_Error;
             _reader.FramingError += GlowReader_FramingError;
        }