Exemplo n.º 1
0
 public PSTMsgParserData(string pstfile, NodeID entryid, string exportdir)
 {
     this.SaveAsTypes = SaveAsType.Msg; // | SaveAsType.Xml | SaveAsType.Html;
     this.SaveAttachments = false;
     if(!string.IsNullOrEmpty(pstfile))
         this.PSTFile = pstfile;
     this.ExportDirectory = exportdir;
     this.SaveEmbeddedMsgs = false;
     this.FolderPath = string.Empty;
     this.Pst2MsgCompatible = false;
 }
Exemplo n.º 2
0
 public PSTMsgParser(string pstfile, NodeID entryid, string exportdir)
 {
     this.SaveAsTypes = SaveAsType.Msg; // | SaveAsType.Xml | SaveAsType.Html;
     this.SaveAttachments = false;
     this.ProcessedMsgs = new List<NodeID>();
     this.PSTFile = pstfile;
     this.ExportDirectory = exportdir;
     this.SaveEmbeddedMsgs = false;
     this.ParentMsg = "0";
     this.FolderPath = string.Empty;
     this.Pst2MsgCompatible = false;
 }
Exemplo n.º 3
0
        static public void GetConnectionInfo(int hostId, int connectionId, out string address, out int port, out NetworkID network, out NodeID dstNode, out byte error)
        {
            ulong  netw;
            ushort node;

            address = GetConnectionInfo(hostId, connectionId, out port, out netw, out node, out error);
            network = (NetworkID)netw;
            dstNode = (NodeID)node;
        }
 public static int ConnectToNetworkPeer(int hostId, string address, int port, int exceptionConnectionId, int relaySlotId, NetworkID network, SourceID source, NodeID node, out byte error)
 {
     return(NetworkTransport.ConnectToNetworkPeer(hostId, address, port, exceptionConnectionId, relaySlotId, network, source, node, 0, 0f, out error));
 }
Exemplo n.º 5
0
 public Coroutine DropConnection(NetworkID netId, NodeID dropNodeId, int requestDomain, BasicResponseDelegate callback)
 {
     return(DropConnection(new DropConnectionRequest {
         networkId = netId, nodeId = dropNodeId, domain = requestDomain
     }, callback));
 }
Exemplo n.º 6
0
Arquivo: Utils.cs Projeto: Astn/ekati
 public static Primitive DataId(NodeID id)
 {
     return(new (id));
 }
 public static extern void ConnectAsNetworkHost(int hostId, string address, int port, NetworkID network, SourceID source, NodeID node, out byte error);
 public void CustomOnMatchJoined(JoinMatchResponse response)
 {
     OnMatchJoined(response);
     _networkID = response.networkId;
     _nodeID = response.nodeId;
 }
Exemplo n.º 9
0
    /// <summary>
    /// Handles actions related to the folders.
    /// </summary>
    /// <param name="argument">Argument related to the folder action</param>
    /// <param name="forceReload">Indicates if load should be forced</param>
    private void HandleFolderAction(string argument, bool forceReload)
    {
        NodeID = ValidationHelper.GetString(argument, string.Empty);

        // Reload content tree if necessary
        if (forceReload)
        {
            InitializeFileSystemTree();

            // Fill with new info
            treeFileSystem.DefaultPath       = NodeID;
            treeFileSystem.ExpandDefaultPath = true;

            treeFileSystem.ReloadData();
            pnlUpdateTree.Update();

            ScriptManager.RegisterStartupScript(Page, typeof(Page), "EnsureTopWindow", "if (self.focus) { self.focus(); }", true);
        }

        ColorizeLastSelectedRow();

        // Get parent node ID info
        string parentId = string.Empty;

        if (FullStartingPath.ToLowerCSafe() != NodeID.ToLowerCSafe())
        {
            try
            {
                parentId = (DirectoryInfo.New(NodeID)).Parent.FullName;
            }
            // Access denied to parent
            catch (SecurityException)
            {
            }
        }

        menuElem.ShowParentButton = !String.IsNullOrEmpty(parentId);
        menuElem.NodeParentID     = parentId;

        fileSystemView.Config = Config;

        // Load new data
        if ((Config.ShowFolders) && (NodeID.LastIndexOfCSafe('\\') != -1))
        {
            fileSystemView.StartingPath = NodeID.Substring(0, argument.LastIndexOfCSafe('\\') + 1);
        }

        fileSystemView.StartingPath = NodeID;

        // Set the editing possibilities
        var canEdit = !StorageHelper.IsZippedFilePath(fileSystemView.StartingPath);

        if (!canEdit)
        {
            fileSystemView.AllowEdit = false;
        }

        menuElem.AllowNew = canEdit;

        // Reload view control's content
        fileSystemView.Reload();
        pnlUpdateView.Update();

        InitializeMenuElem();
        menuElem.UpdateActionsMenu();
        folderActions.Update();
        pnlUpdateMenu.Update();

        ClearActionElems();
    }
Exemplo n.º 10
0
 internal void InternalListenRelay(string relayIp, int relayPort, NetworkID netGuid, SourceID sourceId, NodeID nodeId, int listenPort)
 {
     if (this.m_hostTopology == null)
       {
     ConnectionConfig defaultConfig = new ConnectionConfig();
     int num1 = (int) defaultConfig.AddChannel(QosType.Reliable);
     int num2 = (int) defaultConfig.AddChannel(QosType.Unreliable);
     this.m_hostTopology = new HostTopology(defaultConfig, 8);
       }
       this.m_ServerId = NetworkTransport.AddHost(this.m_hostTopology, listenPort);
       if (LogFilter.logDebug)
     Debug.Log((object) ("Server Host Slot Id: " + (object) this.m_ServerId));
       NetworkServer.Update();
       byte error;
       NetworkTransport.ConnectAsNetworkHost(this.m_ServerId, relayIp, relayPort, netGuid, sourceId, nodeId, out error);
       this.m_RelaySlotId = 0;
       if (LogFilter.logDebug)
     Debug.Log((object) ("Relay Slot Id: " + (object) this.m_RelaySlotId));
       if ((int) error != 0)
     Debug.Log((object) ("ListenRelay Error: " + (object) error));
       NetworkServer.s_Active = true;
       this.m_MessageHandlers.RegisterHandlerSafe((short) 35, new NetworkMessageDelegate(this.OnClientReadyMessage));
       this.m_MessageHandlers.RegisterHandlerSafe((short) 5, new NetworkMessageDelegate(this.OnCommandMessage));
       this.m_MessageHandlers.RegisterHandlerSafe((short) 6, new NetworkMessageDelegate(NetworkTransform.HandleTransform));
       this.m_MessageHandlers.RegisterHandlerSafe((short) 40, new NetworkMessageDelegate(NetworkAnimator.OnAnimationServerMessage));
       this.m_MessageHandlers.RegisterHandlerSafe((short) 41, new NetworkMessageDelegate(NetworkAnimator.OnAnimationParametersServerMessage));
       this.m_MessageHandlers.RegisterHandlerSafe((short) 42, new NetworkMessageDelegate(NetworkAnimator.OnAnimationTriggerServerMessage));
 }
Exemplo n.º 11
0
 public static int ConnectToNetworkPeer(int hostId, string address, int port, int exceptionConnectionId, int relaySlotId, NetworkID network, SourceID source, NodeID node, out byte error)
 {
     return NetworkTransport.ConnectToNetworkPeer(hostId, address, port, exceptionConnectionId, relaySlotId, network, source, node, 0, 0.0f, out error);
 }
Exemplo n.º 12
0
 //Relay ----
 static public void ConnectAsNetworkHost(int hostId, string address, int port, NetworkID network, SourceID source, NodeID node, out byte error)
 {
     ConnectAsNetworkHostInternal(hostId, address, port, (ulong)network, (ulong)source, (ushort)node, out error);
 }
Exemplo n.º 13
0
 static public int ConnectToNetworkPeer(int hostId, string address, int port, int exceptionConnectionId, int relaySlotId, NetworkID network, SourceID source, NodeID node, int bytesPerSec, float bucketSizeFactor, out byte error)
 {
     return(ConnectToNetworkPeerInternal(hostId, address, port, exceptionConnectionId, relaySlotId, (ulong)network, (ulong)source, (ushort)node, bytesPerSec, bucketSizeFactor, out error));
 }
Exemplo n.º 14
0
        static void Main(string[] args)
        {
            // string path =
            // @"C:\Users\wasonj\Documents\RobotRaconteur2\bin_devel\out_debug\NET\Native\RobotRaconteurNETNative.dll";

            // Environment.SetEnvironmentVariable("PATH", Path.GetDirectoryName(path) + ";" +
            // Environment.GetEnvironmentVariable("PATH"));

            string exepath = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location);

            MultiDimArrayTest.testdatapath = System.IO.Path.Combine(exepath, System.IO.Path.Combine("..", "testdata"));

            RobotRaconteurNode.s.SetExceptionHandler(delegate(Exception e) { Console.WriteLine(e.ToString()); });

            string command = "loopback";

            if (args.Length >= 1)
            {
                command = args[0];
            }

            if (command == "loopback")
            {
                RobotRaconteurNode.s.SetLogLevelFromEnvVariable();

                TcpTransport t = new TcpTransport();
                t.StartServer(2323);
                t.EnableNodeDiscoveryListening();
                t.EnableNodeAnnounce();

                RobotRaconteurNode.s.RegisterTransport(t);

                RobotRaconteurNode.s.RegisterServiceType(
                    new com.robotraconteur.testing.TestService1.com__robotraconteur__testing__TestService1Factory());
                RobotRaconteurNode.s.RegisterServiceType(
                    new com.robotraconteur.testing.TestService2.com__robotraconteur__testing__TestService2Factory());

                // MultiDimArrayTest.Test();

                RobotRaconteurTestServiceSupport sup = new RobotRaconteurTestServiceSupport();
                sup.RegisterServices(t);

                int count = 1;

                if (args.Length >= 2)
                {
                    count = int.Parse(args[1]);
                }

                for (int i = 0; i < count; i++)
                {
                    ServiceTestClient c = new ServiceTestClient();
                    c.RunFullTest("tcp://localhost:2323/{0}/RobotRaconteurTestService",
                                  "tcp://localhost:2323/{0}/RobotRaconteurTestService_auth");
                    // System.Threading.Thread.Sleep(100);
                }

                /* c = new ServiceTestClient();
                 * c.RunFullTest("tcp://localhost:2323/{0}/RobotRaconteurTestService",
                 * "tcp://localhost:2323/{0}/RobotRaconteurTestService_auth"); System.Threading.Thread.Sleep(1000);*/

                /*System.Threading.Thread.Sleep(10000);
                 *
                 * ServiceInfo2[] services = RobotRaconteurNode.s.FindServiceByType("RobotRaconteurTestService.testroot", new
                 * string[] { "tcp" });*/

                try
                {
                    object o = RobotRaconteurNode.s.ConnectService("tcp://localhost:2323/{0}/RobotRaconteurTestService");
                }
                catch
                {}

                // System.Threading.Thread.Sleep(17000);

                RobotRaconteurNode.s.Shutdown();
                Console.WriteLine("Test completed");
                return;
            }

            if (command == "loopback2")
            {
                RobotRaconteurNode.s.SetLogLevelFromEnvVariable();

                using (var setup = new ServerNodeSetup("com.robotraconteur.testing.TestService2", 4565,
                                                       RobotRaconteurNodeSetupFlags.ENABLE_TCP_TRANSPORT |
                                                       RobotRaconteurNodeSetupFlags.TCP_TRANSPORT_START_SERVER))
                {
                    // MultiDimArrayTest.Test();

                    RobotRaconteurTestServiceSupport2 sup = new RobotRaconteurTestServiceSupport2();
                    sup.RegisterServices(setup.TcpTransport);

                    ServiceTestClient2 c = new ServiceTestClient2();
                    c.RunFullTest("rr+tcp://localhost:4565/?service=RobotRaconteurTestService2");
                }
                Console.WriteLine("Test completed");
                return;
            }

            if (command == "loopback3")
            {
                RobotRaconteurNode.s.SetLogLevelFromEnvVariable();

                using (var setup = new ServerNodeSetup("com.robotraconteur.testing.TestService3", 4567,
                                                       RobotRaconteurNodeSetupFlags.ENABLE_TCP_TRANSPORT |
                                                       RobotRaconteurNodeSetupFlags.TCP_TRANSPORT_START_SERVER))
                {
                    RobotRaconteurTestServiceSupport3 sup = new RobotRaconteurTestServiceSupport3();
                    sup.RegisterServices();

                    ServiceTestClient3 c = new ServiceTestClient3();
                    c.RunFullTest("rr+tcp://localhost:4567/?service=RobotRaconteurTestService3");
                }
                Console.WriteLine("Test completed");
                return;
            }

            if (command == "client")
            {
                RobotRaconteurNode.s.SetLogLevelFromEnvVariable();

                string url      = args[1];
                string url_auth = args[2];

                TcpTransport t = new TcpTransport();
                t.EnableNodeDiscoveryListening();
                RobotRaconteurNode.s.RegisterTransport(t);

                LocalTransport t2 = new LocalTransport();
                RobotRaconteurNode.s.RegisterTransport(t2);

                HardwareTransport t4 = new HardwareTransport();
                RobotRaconteurNode.s.RegisterTransport(t4);

                RobotRaconteurNode.s.RegisterServiceType(
                    new com.robotraconteur.testing.TestService1.com__robotraconteur__testing__TestService1Factory());
                RobotRaconteurNode.s.RegisterServiceType(
                    new com.robotraconteur.testing.TestService2.com__robotraconteur__testing__TestService2Factory());

                // MultiDimArrayTest.Test();

                RobotRaconteurTestServiceSupport sup = new RobotRaconteurTestServiceSupport();
                sup.RegisterServices(t);

                int count = 1;

                if (args.Length >= 4)
                {
                    count = int.Parse(args[3]);
                }

                for (int i = 0; i < count; i++)
                {
                    ServiceTestClient c = new ServiceTestClient();
                    c.RunFullTest(url, url_auth);
                    // System.Threading.Thread.Sleep(100);
                }

                RobotRaconteurNode.s.Shutdown();
                Console.WriteLine("Test completed");
                return;
            }

            if (command == "client2")
            {
                RobotRaconteurNode.s.SetLogLevelFromEnvVariable();

                string url = args[1];

                TcpTransport t = new TcpTransport();

                t.EnableNodeDiscoveryListening();

                RobotRaconteurNode.s.RegisterTransport(t);

                RobotRaconteurNode.s.RegisterServiceType(
                    new com.robotraconteur.testing.TestService3.com__robotraconteur__testing__TestService3Factory());

                // MultiDimArrayTest.Test();

                RobotRaconteurTestServiceSupport2 sup = new RobotRaconteurTestServiceSupport2();
                sup.RegisterServices(t);

                ServiceTestClient2 c = new ServiceTestClient2();
                c.RunFullTest(url);

                RobotRaconteurNode.s.Shutdown();
                Console.WriteLine("Test completed");
                return;
            }

            if (command == "client3")
            {
                RobotRaconteurNode.s.SetLogLevelFromEnvVariable();

                string url = args[1];

                TcpTransport t = new TcpTransport();

                t.EnableNodeDiscoveryListening();

                RobotRaconteurNode.s.RegisterTransport(t);

                RobotRaconteurNode.s.RegisterServiceType(
                    new com.robotraconteur.testing.TestService5.com__robotraconteur__testing__TestService5Factory());

                ServiceTestClient3 c = new ServiceTestClient3();
                c.RunFullTest(url);

                RobotRaconteurNode.s.Shutdown();
                Console.WriteLine("Test completed");
                return;
            }

            if (command == "server")
            {
                RobotRaconteurNode.s.SetLogLevelFromEnvVariable();

                int port;
                if (args[1] == "sharer")
                {
                    port = -1;
                }
                else
                {
                    port = Int32.Parse(args[1]);
                }
                string name = args[2];

                LocalTransport t2 = new LocalTransport();
                RobotRaconteurNode.s.RegisterTransport(t2);
                t2.StartServerAsNodeName(name);

                TcpTransport t = new TcpTransport();
                t.EnableNodeAnnounce();
                if (port > 0)
                {
                    t.StartServer(port);
                }
                else
                {
                    t.StartServerUsingPortSharer();
                }

                try
                {
                    t.LoadTlsNodeCertificate();
                }
                catch (Exception)
                {
                    Console.WriteLine("warning: Could not load local node certificate");
                }

                RobotRaconteurNode.s.RegisterTransport(t);

                RobotRaconteurNode.s.RegisterServiceType(
                    new com.robotraconteur.testing.TestService1.com__robotraconteur__testing__TestService1Factory());
                RobotRaconteurNode.s.RegisterServiceType(
                    new com.robotraconteur.testing.TestService2.com__robotraconteur__testing__TestService2Factory());
                RobotRaconteurNode.s.RegisterServiceType(
                    new com.robotraconteur.testing.TestService3.com__robotraconteur__testing__TestService3Factory());
                RobotRaconteurNode.s.RegisterServiceType(
                    new com.robotraconteur.testing.TestService5.com__robotraconteur__testing__TestService5Factory());

                RobotRaconteurTestServiceSupport sup = new RobotRaconteurTestServiceSupport();
                sup.RegisterServices(t);

                RobotRaconteurTestServiceSupport2 sup2 = new RobotRaconteurTestServiceSupport2();
                sup2.RegisterServices(t);

                RobotRaconteurTestServiceSupport2 sup3 = new RobotRaconteurTestServiceSupport2();
                sup3.RegisterServices(t);

                Console.WriteLine("Server started, press enter to quit");
                Console.ReadLine();
                RobotRaconteurNode.s.Shutdown();
                Console.WriteLine("Test complete, no error detected");
                return;
            }

            if (command == "findservicebytype")
            {
                RobotRaconteurNode.s.SetLogLevelFromEnvVariable();

                string   type     = args[1];
                string[] tschemes = args[2].Split(new char[] { ',' });

                TcpTransport t = new TcpTransport();
                t.EnableNodeDiscoveryListening();
                RobotRaconteurNode.s.RegisterTransport(t);

                LocalTransport t2 = new LocalTransport();
                RobotRaconteurNode.s.RegisterTransport(t2);

                System.Threading.Thread.Sleep(6000);

                ServiceInfo2[] ret = RobotRaconteurNode.s.FindServiceByType(type, tschemes);

                foreach (ServiceInfo2 r in ret)
                {
                    print_ServiceInfo2(r);
                }

                var t1 = RobotRaconteurNode.s.AsyncFindServiceByType(type, tschemes);
                t1.Wait();
                var ret2 = t1.Result;
                {
                    foreach (ServiceInfo2 r in ret2)
                    {
                        print_ServiceInfo2(r);
                    }
                }

                System.Threading.Thread.Sleep(10000);
                RobotRaconteurNode.s.Shutdown();
                return;
            }

            if (command == "findnodebyid")
            {
                RobotRaconteurNode.s.SetLogLevelFromEnvVariable();

                NodeID   id       = new NodeID(args[1]);
                string[] tschemes = args[2].Split(new char[] { ',' });

                TcpTransport t = new TcpTransport();
                t.EnableNodeDiscoveryListening();
                RobotRaconteurNode.s.RegisterTransport(t);

                LocalTransport t2 = new LocalTransport();
                RobotRaconteurNode.s.RegisterTransport(t2);

                System.Threading.Thread.Sleep(6000);

                NodeInfo2[] ret = RobotRaconteurNode.s.FindNodeByID(id, tschemes);

                foreach (NodeInfo2 r in ret)
                {
                    print_NodeInfo2(r);
                }

                var ts1 = RobotRaconteurNode.s.AsyncFindNodeByID(id, tschemes);
                ts1.Wait();
                var ret2 = ts1.Result;
                {
                    foreach (NodeInfo2 r in ret2)
                    {
                        print_NodeInfo2(r);
                    }
                }

                System.Threading.Thread.Sleep(10000);
                RobotRaconteurNode.s.Shutdown();
                return;
            }

            if (command == "findnodebyname")
            {
                RobotRaconteurNode.s.SetLogLevelFromEnvVariable();

                string   name     = args[1];
                string[] tschemes = args[2].Split(new char[] { ',' });

                TcpTransport t = new TcpTransport();
                t.EnableNodeDiscoveryListening();
                RobotRaconteurNode.s.RegisterTransport(t);

                LocalTransport t2 = new LocalTransport();
                RobotRaconteurNode.s.RegisterTransport(t2);

                System.Threading.Thread.Sleep(6000);

                NodeInfo2[] ret = RobotRaconteurNode.s.FindNodeByName(name, tschemes);

                foreach (NodeInfo2 r in ret)
                {
                    print_NodeInfo2(r);
                }

                var ts1 = RobotRaconteurNode.s.AsyncFindNodeByName(name, tschemes);
                ts1.Wait();
                var ret2 = ts1.Result;
                {
                    foreach (NodeInfo2 r in ret2)
                    {
                        print_NodeInfo2(r);
                    }
                }

                System.Threading.Thread.Sleep(10000);
                RobotRaconteurNode.s.Shutdown();
                return;
            }

            if (command == "stresstestclient")
            {
                RobotRaconteurNode.s.SetLogLevelFromEnvVariable();

                string url1 = args[1];

                LocalTransport t2 = new LocalTransport();
                RobotRaconteurNode.s.RegisterTransport(t2);

                TcpTransport t = new TcpTransport();
                t.EnableNodeDiscoveryListening();

                RobotRaconteurNode.s.RegisterTransport(t);

                RobotRaconteurNode.s.RegisterServiceType(
                    new com.robotraconteur.testing.TestService1.com__robotraconteur__testing__TestService1Factory());
                RobotRaconteurNode.s.RegisterServiceType(
                    new com.robotraconteur.testing.TestService2.com__robotraconteur__testing__TestService2Factory());

                servicetest_count     = 0;
                servicetest_keepgoing = true;

                object         obj = RobotRaconteurNode.s.ConnectService(url1);
                async_testroot o   = (async_testroot)obj;
                testroot       o2  = (testroot)obj;
                o.async_func3(1, 2).ContinueWith(ts1 => servicetest2(o, ts1));

                Pipe <double> .PipeEndpoint p = o2.broadcastpipe.Connect(-1);
                p.PacketReceivedEvent += servicetest7;
                Wire <double> .WireConnection w  = o2.broadcastwire.Connect();
                RobotRaconteur.Timer          tt =
                    RobotRaconteurNode.s.CreateTimer(40, delegate(TimerEvent ev) { servicetest5(p, w, ev); });
                tt.Start();

                Console.WriteLine("Press enter to quit");
                Console.ReadLine();
                servicetest_keepgoing = false;
                tt.Stop();
                RobotRaconteurNode.s.Shutdown();

                return;
            }

            if (command == "latencytestclient" || command == "latencytestclient2")
            {
                RobotRaconteurNode.s.SetLogLevelFromEnvVariable();

                string url1 = args[1];

                LocalTransport t2 = new LocalTransport();
                RobotRaconteurNode.s.RegisterTransport(t2);

                TcpTransport t = new TcpTransport();
                t.EnableNodeDiscoveryListening();

                RobotRaconteurNode.s.RegisterTransport(t);

                RobotRaconteurNode.s.RegisterServiceType(
                    new com.robotraconteur.testing.TestService1.com__robotraconteur__testing__TestService1Factory());
                RobotRaconteurNode.s.RegisterServiceType(
                    new com.robotraconteur.testing.TestService2.com__robotraconteur__testing__TestService2Factory());

                servicetest_count     = 0;
                servicetest_keepgoing = true;

                object         obj = RobotRaconteurNode.s.ConnectService(url1);
                async_testroot o   = (async_testroot)obj;
                testroot       o2  = (testroot)obj;

                var o3 = o2.get_o1();

                int iters = 100000;

                var d = new double[10];

                DateTime start;
                DateTime end;

                if (command == "latencytestclient")
                {
                    start = DateTime.UtcNow;
                    for (int i = 0; i < iters; i++)
                    {
                        o3.d1 = d;
                    }
                    end = DateTime.UtcNow;
                }
                else
                {
                    start = DateTime.UtcNow;
                    for (int i = 0; i < iters; i++)
                    {
                        var dummy = o2.struct1;
                    }
                    end = DateTime.UtcNow;
                }

                var diff = (end - start).Ticks / (TimeSpan.TicksPerMillisecond / 1000);

                double period = ((double)diff) / ((double)iters);

                Console.WriteLine("Period = {0}", period);

                RobotRaconteurNode.s.Shutdown();

                return;
            }

            if (command == "peeridentity")
            {
                RobotRaconteurNode.s.SetLogLevelFromEnvVariable();

                if (args.Length < 2)
                {
                    Console.WriteLine("Usage for peeridentity:  RobotRaconteurTest peeridentity url [nodeid]");
                    return;
                }

                var url1 = args[1];
                Console.WriteLine(url1);
                var c = new TcpTransport();

                if (args.Length > 2)
                {
                    var nodeid = args[2];

                    var id = new NodeID(nodeid);

                    RobotRaconteurNode.s.NodeID = id;

                    try
                    {
                        c.LoadTlsNodeCertificate();
                    }
                    catch (Exception)
                    {
                        Console.WriteLine("warning: Could not load local node certificate");
                    }
                }

                Console.WriteLine(RobotRaconteurNode.s.NodeID);
                var c2 = new LocalTransport();

                var c5 = new HardwareTransport();

                RobotRaconteurNode.s.RegisterTransport(c);
                RobotRaconteurNode.s.RegisterTransport(c2);

                RobotRaconteurNode.s.RegisterTransport(c5);

                RobotRaconteurNode.s.RegisterServiceType(
                    new com.robotraconteur.testing.TestService1.com__robotraconteur__testing__TestService1Factory());
                RobotRaconteurNode.s.RegisterServiceType(
                    new com.robotraconteur.testing.TestService2.com__robotraconteur__testing__TestService2Factory());

                var oo = (testroot)RobotRaconteurNode.s.ConnectService(url1);
                oo.func3(1.0, 2.3);

                if (c.IsTransportConnectionSecure(oo))
                {
                    Console.WriteLine("Connection is secure");

                    if (c.IsSecurePeerIdentityVerified(oo))
                    {
                        Console.WriteLine("Peer identity is verified: " + c.GetSecurePeerIdentity(oo));
                    }
                    else
                    {
                        Console.WriteLine("Peer identity is not verified");
                    }
                }
                else
                {
                    Console.WriteLine("Connection is not secure");
                }

                RobotRaconteurNode.s.Shutdown();

                Console.WriteLine("Test completed, no errors detected");
                return;
            }

            if (command == "multidimarraytest")
            {
                MultiDimArrayTest.Test();
                RobotRaconteurNode.s.Shutdown();
                return;
            }

            if (command == "subscribertest")
            {
                RobotRaconteurNode.s.SetLogLevelFromEnvVariable();

                if (args.Length < 2)
                {
                    Console.WriteLine("Usage for subscribertest:  RobotRaconteurTest subscribertest servicetype");
                    return;
                }

                var servicetype = args[1];

                LocalTransport t2 = new LocalTransport();
                t2.EnableNodeDiscoveryListening();
                RobotRaconteurNode.s.RegisterTransport(t2);

                TcpTransport t = new TcpTransport();
                t.EnableNodeDiscoveryListening();
                RobotRaconteurNode.s.RegisterTransport(t);

                HardwareTransport t3 = new HardwareTransport();
                RobotRaconteurNode.s.RegisterTransport(t3);

                RobotRaconteurNode.s.RegisterServiceType(
                    new com.robotraconteur.testing.TestService1.com__robotraconteur__testing__TestService1Factory());
                RobotRaconteurNode.s.RegisterServiceType(
                    new com.robotraconteur.testing.TestService2.com__robotraconteur__testing__TestService2Factory());

                var subscription = RobotRaconteurNode.s.SubscribeServiceByType(new string[] { servicetype });

                subscription.ClientConnected += delegate(ServiceSubscription c, ServiceSubscriptionClientID d, object e)
                {
                    Console.WriteLine("Client connected: " + d.NodeID.ToString() + ", " + d.ServiceName);
                    testroot e1 = (testroot)e;
                    Console.WriteLine("d1 = " + e1.d1);
                };

                subscription.ClientDisconnected += delegate(ServiceSubscription c, ServiceSubscriptionClientID d, object e)
                {
                    Console.WriteLine("Client disconnected: " + d.NodeID.ToString() + ", " + d.ServiceName);
                };

                var wire_subscription = subscription.SubscribeWire <double>("broadcastwire");
                wire_subscription.WireValueChanged += delegate(WireSubscription <double> c, double d, TimeSpec e) {
                    // Console.WriteLine("Wire value changed: " + d);
                };

                var pipe_subscription = subscription.SubscribePipe <double>("broadcastpipe");
                pipe_subscription.PipePacketReceived += delegate(PipeSubscription <double> c)
                {
                    double val;
                    while (c.TryReceivePacket(out val))
                    {
                        Console.WriteLine("Received pipe packet: " + val);
                    }
                };

                System.Threading.Thread.Sleep(6000);

                var connected_clients = subscription.GetConnectedClients();

                foreach (var c in connected_clients)
                {
                    Console.WriteLine("Client: " + c.Key.NodeID + ", " + c.Key.ServiceName);
                }

                TimeSpec w1_time = null;
                double   w1_value;
                var      w1_res = wire_subscription.TryGetInValue(out w1_value);

                if (w1_res)
                {
                    Console.WriteLine("Got broadcastwire value: " + w1_value + " " + w1_time?.seconds);
                }

                Console.WriteLine("Waiting for services...");

                Console.ReadLine();

                RobotRaconteurNode.s.Shutdown();

                return;
            }

            if (command == "subscriberurltest")
            {
                RobotRaconteurNode.s.SetLogLevelFromEnvVariable();

                if (args.Length < 2)
                {
                    Console.WriteLine("Usage for subscriberurltest:  RobotRaconteurTest subscriberurltest url");
                    return;
                }

                var url = args[1];

                LocalTransport t2 = new LocalTransport();
                t2.EnableNodeDiscoveryListening();
                RobotRaconteurNode.s.RegisterTransport(t2);

                TcpTransport t = new TcpTransport();
                t.EnableNodeDiscoveryListening();
                RobotRaconteurNode.s.RegisterTransport(t);

                HardwareTransport t3 = new HardwareTransport();
                RobotRaconteurNode.s.RegisterTransport(t3);

                RobotRaconteurNode.s.RegisterServiceType(
                    new com.robotraconteur.testing.TestService1.com__robotraconteur__testing__TestService1Factory());
                RobotRaconteurNode.s.RegisterServiceType(
                    new com.robotraconteur.testing.TestService2.com__robotraconteur__testing__TestService2Factory());

                var subscription = RobotRaconteurNode.s.SubscribeService(url);

                subscription.ClientConnected += delegate(ServiceSubscription c, ServiceSubscriptionClientID d, object e)
                {
                    Console.WriteLine("Client connected: " + d.NodeID.ToString() + ", " + d.ServiceName);
                    testroot e1 = (testroot)e;
                    Console.WriteLine("d1 = " + e1.d1);
                };

                subscription.ClientDisconnected += delegate(ServiceSubscription c, ServiceSubscriptionClientID d, object e)
                {
                    Console.WriteLine("Client disconnected: " + d.NodeID.ToString() + ", " + d.ServiceName);
                };

                subscription.ClientConnectFailed +=
                    delegate(ServiceSubscription c, ServiceSubscriptionClientID d, string[] url2, Exception err)
                {
                    Console.WriteLine("Client connect failed: " + d.NodeID.ToString() + " url: " + String.Join(",", url2) +
                                      err.ToString());
                };

                subscription.AsyncGetDefaultClient(1000).ContinueWith(delegate(Task <object> res) {
                    if (res.IsFaulted)
                    {
                        Console.WriteLine("AsyncGetDefaultClient failed");
                    }
                    else if (res.Result == null)
                    {
                        Console.WriteLine("AsyncGetDefaultClient returned null");
                    }
                    else
                    {
                        Console.WriteLine($"AsyncGetDefaultClient successful: {res.Result}");
                    }
                });
                var    client2 = subscription.GetDefaultClientWait(6000);
                object client3;
                var    try_res = subscription.TryGetDefaultClientWait(out client3, 6000);
                Console.WriteLine($"try_res = {try_res}");

                var connected_clients = subscription.GetConnectedClients();

                foreach (var c in connected_clients)
                {
                    Console.WriteLine("Client: " + c.Key.NodeID + ", " + c.Key.ServiceName);
                }

                try
                {
                    Console.WriteLine(((testroot)subscription.GetDefaultClient()).d1);
                }
                catch (Exception)
                {
                    Console.WriteLine("Client not connected");
                }

                object client1;
                subscription.TryGetDefaultClient(out client1);

                Console.WriteLine("Waiting for services...");

                Console.ReadLine();

                RobotRaconteurNode.s.Shutdown();

                return;
            }

            if (command == "subscriberfiltertest")
            {
                RobotRaconteurNode.s.SetLogLevelFromEnvVariable();

                if (args.Length < 2)
                {
                    throw new Exception(
                              "Usage for subscriberfiltertest:  RobotRaconteurTest subscriberfiltertest servicetype");
                }

                var servicetype = args[1];

                var f = new ServiceSubscriptionFilter();

                if (args.Length >= 3)
                {
                    var subcommand = args[2];

                    if (subcommand == "nodeid")
                    {
                        if (args.Length < 4)
                        {
                            throw new Exception(
                                      "Usage for subscriberfiltertest:  RobotRaconteurTest subscriberfiltertest nodeid <nodeid>");
                        }

                        var n = new ServiceSubscriptionFilterNode();
                        n.NodeID = new NodeID(args[3]);
                        f.Nodes  = new ServiceSubscriptionFilterNode[] { n };
                    }

                    else if (subcommand == "nodename")
                    {
                        if (args.Length < 4)
                        {
                            throw new Exception(
                                      "Usage for subscriberfiltertest:  RobotRaconteurTest subscriberfiltertest nodename <nodename>");
                        }

                        var n = new ServiceSubscriptionFilterNode();
                        n.NodeName = args[3];
                        f.Nodes    = new ServiceSubscriptionFilterNode[] { n };
                    }
                    else if (subcommand == "nodeidscheme")
                    {
                        if (args.Length < 5)
                        {
                            throw new Exception(
                                      "Usage for subscriberfiltertest:  RobotRaconteurTest subscriberfiltertest nodeidscheme <nodeid> <schemes>");
                        }

                        var n = new ServiceSubscriptionFilterNode();
                        n.NodeID           = new NodeID(args[3]);
                        f.Nodes            = new ServiceSubscriptionFilterNode[] { n };
                        f.TransportSchemes = args[4].Split(new char[] { ',' });
                    }
                    else if (subcommand == "nodeidauth")
                    {
                        if (args.Length < 6)
                        {
                            throw new Exception(
                                      "Usage for subscriberfiltertest:  RobotRaconteurTest subscriberfiltertest nodeidauth <nodeid> <username> <password>");
                        }

                        var n = new ServiceSubscriptionFilterNode();
                        n.NodeID      = new NodeID(args[3]);
                        n.Username    = args[4];
                        n.Credentials = new Dictionary <string, object>()
                        {
                            { "password", args[5] }
                        };
                        f.Nodes = new ServiceSubscriptionFilterNode[] { n };
                    }
                    else if (subcommand == "servicename")
                    {
                        if (args.Length < 4)
                        {
                            throw new Exception(
                                      "Usage for subscriberfiltertest:  RobotRaconteurTest subscriberfiltertest servicename <servicename>");
                        }

                        var n = new ServiceSubscriptionFilterNode();
                        f.ServiceNames = new string[] { args[3] };
                    }
                    else if (subcommand == "predicate")
                    {
                        f.Predicate = delegate(ServiceInfo2 info)
                        {
                            Console.WriteLine("Predicate: " + info.NodeName);
                            return(info.NodeName == "testprog");
                        };
                    }
                    else
                    {
                        throw new Exception("Unknown subscriberfiltertest command");
                    }

                    LocalTransport t2 = new LocalTransport();
                    t2.EnableNodeDiscoveryListening();
                    RobotRaconteurNode.s.RegisterTransport(t2);

                    TcpTransport t = new TcpTransport();
                    t.EnableNodeDiscoveryListening();
                    RobotRaconteurNode.s.RegisterTransport(t);

                    HardwareTransport t3 = new HardwareTransport();
                    RobotRaconteurNode.s.RegisterTransport(t3);

                    RobotRaconteurNode.s.RegisterServiceType(
                        new com.robotraconteur.testing.TestService1.com__robotraconteur__testing__TestService1Factory());
                    RobotRaconteurNode.s.RegisterServiceType(
                        new com.robotraconteur.testing.TestService2.com__robotraconteur__testing__TestService2Factory());

                    var subscription = RobotRaconteurNode.s.SubscribeServiceByType(new string[] { servicetype }, f);

                    subscription.ClientConnected += delegate(ServiceSubscription c, ServiceSubscriptionClientID d, object e)
                    {
                        Console.WriteLine("Client connected: " + d.NodeID.ToString() + ", " + d.ServiceName);
                        testroot e1 = (testroot)e;
                        Console.WriteLine("d1 = " + e1.d1);
                    };

                    subscription.ClientDisconnected +=
                        delegate(ServiceSubscription c, ServiceSubscriptionClientID d, object e)
                    {
                        Console.WriteLine("Client disconnected: " + d.NodeID.ToString() + ", " + d.ServiceName);
                    };

                    Console.ReadLine();

                    RobotRaconteurNode.s.Shutdown();

                    return;
                }

                return;
            }

            if (command == "serviceinfo2subscribertest")
            {
                RobotRaconteurNode.s.SetLogLevelFromEnvVariable();

                if (args.Length < 2)
                {
                    Console.WriteLine("Usage for subscribertest:  RobotRaconteurTest subscribertest servicetype");
                    return;
                }

                var servicetype = args[1];

                LocalTransport t2 = new LocalTransport();
                t2.EnableNodeDiscoveryListening();
                RobotRaconteurNode.s.RegisterTransport(t2);

                TcpTransport t = new TcpTransport();
                t.EnableNodeDiscoveryListening();
                RobotRaconteurNode.s.RegisterTransport(t);

                HardwareTransport t3 = new HardwareTransport();
                RobotRaconteurNode.s.RegisterTransport(t3);

                RobotRaconteurNode.s.RegisterServiceType(
                    new com.robotraconteur.testing.TestService1.com__robotraconteur__testing__TestService1Factory());
                RobotRaconteurNode.s.RegisterServiceType(
                    new com.robotraconteur.testing.TestService2.com__robotraconteur__testing__TestService2Factory());

                var subscription = RobotRaconteurNode.s.SubscribeServiceInfo2(new string[] { servicetype });
                subscription.ServiceDetected +=
                    delegate(ServiceInfo2Subscription sub, ServiceSubscriptionClientID id, ServiceInfo2 info)
                {
                    Console.WriteLine("Service detected: " + info.NodeID.ToString() + ", " + info.Name);
                };

                subscription.ServiceLost +=
                    delegate(ServiceInfo2Subscription sub, ServiceSubscriptionClientID id, ServiceInfo2 info)
                {
                    Console.WriteLine("Service lost: " + info.NodeID.ToString() + ", " + info.Name);
                };

                System.Threading.Thread.Sleep(6000);

                var connected_clients = subscription.GetDetectedServiceInfo2();

                foreach (var c in connected_clients)
                {
                    Console.WriteLine("Client: " + c.Key.NodeID + ", " + c.Key.ServiceName);
                }

                Console.WriteLine("Waiting for services...");

                Console.ReadLine();

                RobotRaconteurNode.s.Shutdown();

                return;
            }

            if (command == "nowutc")
            {
                Console.WriteLine(RobotRaconteurNode.s.NowUTC);

                RobotRaconteurNode.s.Shutdown();
                return;
            }

            if (command == "testlogging")
            {
                var r      = new RRLogRecord();
                var node   = RobotRaconteurNode.s;
                var nodeid = node.NodeID;
                r.Node    = node;
                r.Time    = DateTime.UtcNow;
                r.Level   = LogLevel.LogLevel_Warning;
                r.Message = "This is a test warning";
                RobotRaconteurNode.s.LogRecord(r);

                RobotRaconteurNode.s.Shutdown();
                return;
            }

            if (command == "testloghandler")
            {
                var user_log_handler = new UserLogRecordHandler(x => Console.WriteLine("csharp handler: " + x.ToString()));
                RobotRaconteurNode.s.SetLogRecordHandler(user_log_handler);
                RobotRaconteurNode.s.SetLogLevel(LogLevel.LogLevel_Debug);

                TcpTransport t = new TcpTransport();
                t.StartServer(2323);

                RobotRaconteurNode.s.RegisterTransport(t);

                RobotRaconteurNode.s.RegisterServiceType(
                    new com.robotraconteur.testing.TestService1.com__robotraconteur__testing__TestService1Factory());
                RobotRaconteurNode.s.RegisterServiceType(
                    new com.robotraconteur.testing.TestService2.com__robotraconteur__testing__TestService2Factory());

                RobotRaconteurTestServiceSupport sup = new RobotRaconteurTestServiceSupport();
                sup.RegisterServices(t);
                ServiceTestClient c = new ServiceTestClient();
                c.RunFullTest("tcp://localhost:2323/{0}/RobotRaconteurTestService",
                              "tcp://localhost:2323/{0}/RobotRaconteurTestService_auth");

                RobotRaconteurNode.s.Shutdown();
                Console.WriteLine("Test completed");

                return;
            }

            if (command == "server2")
            {
                ServerNodeSetup node_setup = new ServerNodeSetup("testprog", 22222, args);
                using (node_setup)
                {
                    var t = node_setup.TcpTransport;

                    RobotRaconteurTestServiceSupport sup = new RobotRaconteurTestServiceSupport();
                    sup.RegisterServices(t);

                    RobotRaconteurTestServiceSupport2 sup2 = new RobotRaconteurTestServiceSupport2();
                    sup2.RegisterServices(t);

                    RobotRaconteurTestServiceSupport3 sup3 = new RobotRaconteurTestServiceSupport3();
                    sup3.RegisterServices();

                    Console.WriteLine("Server started, press enter to quit");
                    Console.ReadLine();
                    RobotRaconteurNode.s.Shutdown();
                    Console.WriteLine("Test complete, no error detected");
                    return;
                }
            }

            if (command == "lfsrprint")
            {
                LFSRSeqGen_Print.PrintLFSR();
                RobotRaconteurNode.s.Shutdown();
                return;
            }

            throw new Exception("Unknown command");
        }
Exemplo n.º 15
0
		public NodeStatement(NodeID nodeID)
		{
			this.nodeID = nodeID;
		}
Exemplo n.º 16
0
		public NodeStatement(string id)
		{
			nodeID = new NodeID(id);
		}
Exemplo n.º 17
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                //流程名称
                FlowName.DataSource     = WebBLL.Tbl_FlowManager.GetTbl_FlowAll();
                FlowName.DataTextField  = "FlowName";
                FlowName.DataValueField = "ID";
                FlowName.DataBind();
                FlowName.Items.Insert(0, "选择流程");

                //获取当前工作ID
                ID = Convert.ToInt32(Request.QueryString["id"]);

                //如果是项目流程发起的表单
                int projectid = WebCommon.Public.ToInt(Request.QueryString["ProjectID"]);
                if (projectid > 0)
                {
                    ID = WebCommon.Public.ToInt(WebBLL.Tbl_FlowWorkManager.GetDataTableByPage(1, 1, "projectid=" + projectid.ToString(), "id desc").Rows[0]["ID"]);
                }
                FlowWorkID.Value = ID.ToString();

                //获取当前工作内容
                WebModels.Tbl_FlowWork flowwork = WebBLL.Tbl_FlowWorkManager.GetTbl_FlowWorkById(ID);
                this.NodeLocal.Value        = WebBLL.Tbl_FlowNodeManager.GetTbl_FlowNodeById(flowwork.NodeID).NodeName;
                this.WorkName.Value         = flowwork.WorkName;
                this.FlowName.SelectedValue = flowwork.FlowID.ToString();
                this.FormContent.InnerHtml  = flowwork.FormContent;

                //获取表单常用短语
                string FromWords = "";
                foreach (WebModels.Tbl_FlowFormWord formword in WebBLL.Tbl_FlowFormWordManager.GetTbl_FlowFormWordAll())
                {
                    FromWords += "<div onclick=InputText($(this).text()) style=margin:5px>" + formword.IFW_Name + "</div>";
                }
                //向表单注册验证程序
                string LocalPwd    = WebBLL.Tbl_UserManager.GetTbl_UserByUserName(WebCommon.Public.GetUserName()).UserPwd;
                string LimitScript = "" +
                                     "$('.formctrl[disabled]').removeAttr('disabled');" +
                                     "$('.formctrl[data-node!=" + flowwork.NodeNo + "]').attr('disabled','disabled');" +
                                     "$('.formctrl[type^=text]').dblclick(function(){$(this).attr('lock','1');$$.MsgBox('常用短语', '" + FromWords + "', '关闭窗口');});" +
                                     "$('.formctrl[value=电子签名]').click(function(){$$.MsgBox('密码验证', '<input type=password id=password>', '确定:InsertSign()', '取消');});" +
                                     "function InsertSign(){" +
                                     "if($.md5($('#password').val())=='" + LocalPwd + "'){$('.formctrl[value=电子签名]').hide();$$.MsgBox(0);" +
                                     "$('.formctrl[value=电子签名]').after('<img src=" + WebBLL.Tbl_UserManager.GetTbl_UserByUserName(WebCommon.Public.GetUserName()).U_Sign + ">');" +
                                     "}else{alert('密码不正确');}}" +
                                     "function InputText(info){" +
                                     "$('.formctrl[lock=1]').val(info);$('.formctrl[lock=1]').removeAttr('lock');$$.MsgBox(0);}";
                ScriptManager.RegisterStartupScript(this, this.GetType(), "message", LimitScript, true);

                //流程的当前节点绑定
                NodeID.DataSource     = WebBLL.Tbl_FlowNodeManager.GetTbl_FlowNodesByFlowID(flowwork.FlowID);
                NodeID.DataTextField  = "NodeName";
                NodeID.DataValueField = "NodeNo";
                NodeID.DataBind();
                NodeID.Enabled       = false;
                NodeID.SelectedValue = (Convert.ToInt32(flowwork.NodeNo) + 1).ToString();
                //如果是最后一个节点那么不再跳转
                if (NodeID.SelectedValue == "1")
                {
                    NodeID.SelectedIndex = NodeID.Items.Count - 1;
                }

                //判断节点权限
                DataRow dr = WebBLL.Tbl_FlowNodeManager.GetDataTableByPage(1, 1, "flowid=" + flowwork.FlowID.ToString() + " and nodeno=" + flowwork.NodeNo, "").Rows[0];
                if (flowwork.Status == "结束")
                {
                    btn_submit.Visible = false;
                }
                if (!dr["NodeUserLimit"].ToString().Contains("允许驳回"))
                {
                    Button1.Visible = false;
                }
                if (!dr["NodeUserLimit"].ToString().Contains("允许跳过"))
                {
                    Button2.Visible = false;
                }
                if (!dr["NodeUserLimit"].ToString().Contains("允许终止"))
                {
                    Button3.Visible = false;
                }
                if (!dr["NodeUser"].ToString().Contains(WebCommon.Public.GetUserName()))
                {
                    btn_submit.Visible = false;
                }
            }
        }
Exemplo n.º 18
0
 public SearchFolder(IDBAccessor context, NodeID nodeID)
 {
     _dbContext = context;
     _propBag   = _dbContext.GetPropertyObjectByNodeId(nodeID);
 }
Exemplo n.º 19
0
 public static extern void ConnectAsNetworkHost(int hostId, string address, int port, NetworkID network, SourceID source, NodeID node, out byte error);
Exemplo n.º 20
0
 public PingResponse(TransactionID transactionId, NodeID queriedNodeId)
 {
     TransactionID = transactionId;
     QueriedNode   = queriedNodeId;
 }
Exemplo n.º 21
0
 public NodeStatement(string id)
 {
     nodeID = new NodeID(id);
 }
 public void ConnectAsNetworkHost(int hostId, string address, int port, NetworkID network, SourceID source, NodeID node, out byte error)
 {
     NetworkTransport.ConnectAsNetworkHost(hostId, address, port, network, source, node, out error);
 }
Exemplo n.º 23
0
 private void InternalListenRelay(string relayIp, int relayPort, NetworkID netGuid, SourceID sourceId, NodeID nodeId)
 {
     this.m_SimpleServerSimple.ListenRelay(relayIp, relayPort, netGuid, sourceId, nodeId);
     s_Active = true;
     this.RegisterMessageHandlers();
 }
 public void GetConnectionInfo(int hostId, int connectionId, out string address, out int port, out NetworkID network, out NodeID dstNode, out byte error)
 {
     NetworkTransport.GetConnectionInfo(hostId, connectionId, out address, out port, out network, out dstNode, out error);
 }
Exemplo n.º 25
0
Arquivo: Utils.cs Projeto: Astn/ekati
 public static int GetPartitionFromHash(int partitionCount, NodeID nid)
 {
     return(nid.Iri.GetHashCode() % partitionCount);
 }
Exemplo n.º 26
0
 public override string ToString()
 {
     //return AreaID.ToString() + "." + NodeID.ToString();
     return(StreetName.ToString() + ", " + Position.X.ToString() + ", " + Position.Y.ToString() + ", " + Position.Z.ToString() + ", " + NodeID.ToString());
 }
Exemplo n.º 27
0
        public static void GetConnectionInfo(int hostId, int connectionId, out string address, out int port, out NetworkID network, out NodeID dstNode, out byte error)
        {
            ulong  num;
            ushort num2;

            address = NetworkTransport.GetConnectionInfo(hostId, connectionId, out port, out num, out num2, out error);
            network = (NetworkID)num;
            dstNode = (NodeID)num2;
        }
Exemplo n.º 28
0
 public JoinedMatchInformation(string matchName, NetworkID unityNetworkId, NodeID unityHostNodeId)
 {
     this.matchName       = matchName;
     this.unityHostNodeId = unityHostNodeId;
     this.unityNetworkId  = unityNetworkId;
 }
Exemplo n.º 29
0
 public static extern int ConnectToNetworkPeer(int hostId, string address, int port, int exceptionConnectionId, int relaySlotId, NetworkID network, SourceID source, NodeID node, int bytesPerSec, float bucketSizeFactor, out byte error);
Exemplo n.º 30
0
 public MatchInformation(MultiplayerAPI.CreatedMatchInformation match)
 {
     this.unityHostNodeId = match.unityHostNodeId;
     this.unityNetworkId  = match.unityNetworkId;
 }
Exemplo n.º 31
0
 protected void Button1_Click(object sender, EventArgs e)
 {
     if (Page.IsValid)
     {
         string adminname = HttpContext.Current.Request.Cookies["ManageState"]["LoginName"];
         adminname = StringHelper.Base64StringDecode(adminname);
         M_CommonData CData = contentBll.GetCommonData(GeneralID);
         NodeID      = CData.NodeID;
         ModelID     = CData.ModelID;
         CData.Title = txtTitle.Text;
         int elite = ChkAudit.Checked ? 1 : 0;
         if (CData.EliteLevel == 0 && elite == 1)
         {
             if (SiteConfig.UserConfig.InfoRule > 0)
             {
                 M_UserInfo muser = buser.GetUserByName(adminname);
                 if (!muser.IsNull)
                 {
                     buser.ChangeVirtualMoney(muser.UserID, new M_UserExpHis()
                     {
                         score     = SiteConfig.UserConfig.InfoRule,
                         detail    = "修改内容:" + txtTitle.Text + "增加积分",
                         ScoreType = (int)M_UserExpHis.SType.Point
                     });
                 }
             }
         }
         CData.EliteLevel = elite;
         CData.InfoID     = "";
         CData.Template   = TxtTemplate_hid.Value;
         if (TlpView_Tlp.Count > 0)
         {
             CData.Template = TlpView_Tlp.SelectedValue;
         }
         CData.Hits        = DataConverter.CLng(txtNum.Text);
         CData.FirstNodeID = GetFriestNode(CData.NodeID);
         CData.UpDateType  = 2;
         CData.UpDateTime  = DataConverter.CDate(txtdate.Text);
         CData.Hits        = string.IsNullOrEmpty(txtNum.Text) ? 0 : DataConverter.CLng(txtNum.Text);
         CData.PdfLink     = "";
         CData.Status      = Convert.ToInt32(ddlFlow.SelectedValue.Trim());
         if (string.IsNullOrEmpty(txtAddTime.Text))
         {
             CData.CreateTime = contentBll.GetCommonData(GeneralID).CreateTime;
         }
         else
         {
             CData.CreateTime = DataConverter.CDate(txtAddTime.Text);
         }
         if (string.IsNullOrEmpty(txtInputer.Text))
         {
             CData.Inputer = contentBll.GetCommonData(GeneralID).Inputer;
         }
         else
         {
             CData.Inputer = txtInputer.Text;
         }
         CData.Status = Convert.ToInt32(ddlFlow.SelectedValue.Trim());
         string OldKey = CData.TagKey;
         //CData.TagKey = Keyword;
         CData.TopImg = "";//首页图片
         DataTable dt         = bfield.GetModelFieldList(ModelID).Tables[0];
         Call      commonCall = new Call();
         DataTable table      = commonCall.GetDTFromPage(dt, Page, ViewState, content);
         int       newID      = contentBll.AddContent(table, CData);//插入信息给两个表,主表和从表:CData-主表的模型,table-从表
         string    iscreate   = "0";
         if (quickmake.Checked == true)
         {
             B_Create CreateBll = new B_Create();
             if (createnew)
             {
                 CreateBll.createann(newID.ToString());         //发布内容页
                 CreateBll.CreateColumnByID(NodeID.ToString()); //发布栏目页
             }
             CreateBll.CreatePageIndex();                       //发布首页
             iscreate = "1";
         }
         //关键字
         B_KeyWord kll = new B_KeyWord();
         //积分
         if (SiteConfig.UserConfig.InfoRule > 0)
         {
             M_UserInfo muser = buser.GetUserByName(adminname);
             if (!muser.IsNull)
             {
                 buser.ChangeVirtualMoney(muser.UserID, new M_UserExpHis()
                 {
                     UserID    = muser.UserID,
                     detail    = "添加内容:" + txtTitle.Text + "增加积分",
                     score     = SiteConfig.UserConfig.InfoRule,
                     ScoreType = (int)M_UserExpHis.SType.Point
                 });
             }
         }
         Response.Redirect("ContentShow.aspx?gid=" + newID + "&iscreate=" + iscreate + "&nodename=" + Server.UrlEncode(nodename.Value) + "&type=add");
     }
 }
Exemplo n.º 32
0
        /// <summary>
        ///   <para>Starts a server using a relay server. This is the manual way of using the relay server, as the regular NetworkServer.Connect() will automatically use the relay server if a match exists.</para>
        /// </summary>
        /// <param name="relayIp">Relay server IP Address.</param>
        /// <param name="relayPort">Relay server port.</param>
        /// <param name="netGuid">GUID of the network to create.</param>
        /// <param name="sourceId">This server's sourceId.</param>
        /// <param name="nodeId">The node to join the network with.</param>
        public void ListenRelay(string relayIp, int relayPort, NetworkID netGuid, SourceID sourceId, NodeID nodeId)
        {
            this.Initialize();
            this.m_ServerHostId = NetworkTransport.AddHost(this.m_HostTopology, this.listenPort);
            if (LogFilter.logDebug)
            {
                Debug.Log((object)("Server Host Slot Id: " + (object)this.m_ServerHostId));
            }
            this.Update();
            byte error;

            NetworkTransport.ConnectAsNetworkHost(this.m_ServerHostId, relayIp, relayPort, netGuid, sourceId, nodeId, out error);
            this.m_RelaySlotId = 0;
            if (!LogFilter.logDebug)
            {
                return;
            }
            Debug.Log((object)("Relay Slot Id: " + (object)this.m_RelaySlotId));
        }
Exemplo n.º 33
0
    /// <summary>
    /// Returns parameters according to the upload mode.
    /// </summary>
    private string GetModeParameters()
    {
        string[] args;

        if (MediaLibraryID > 0)
        {
            // MediaLibrary mode
            args = new[]
            {
                "MediaLibraryID", MediaLibraryID.ToString(),
                "MediaFolderPath", HttpUtility.UrlEncode(MediaFolderPath),
                "MediaFileID", MediaFileID.ToString(),
                "IsMediaThumbnail", IsMediaThumbnail.ToString(),
                "MediaFileName", HttpUtility.UrlEncode(MediaFileName)
            };
            return("MediaLibraryArgs=" + GetArgumentsString(args));
        }

        if ((NodeID > 0) && (SourceType == MediaSourceEnum.Content))
        {
            // File mode
            args = new[]
            {
                "NodeID", NodeID.ToString(),
                "DocumentCulture", DocumentCulture,
                "IncludeExtension", IncludeExtension.ToString(),
                "NodeGroupID", NodeGroupID.ToString()
            };
            return("FileArgs=" + GetArgumentsString(args));
        }

        if (ObjectID > 0)
        {
            // MetaFile mode
            args = new[]
            {
                "MetaFileID", MetaFileID.ToString(),
                "ObjectID", ObjectID.ToString(),
                "SiteID", SiteID.ToString(),
                "ObjectType", ObjectType,
                "Category", Category
            };
            return("MetaFileArgs=" + GetArgumentsString(args));
        }

        if (PostForumID > 0)
        {
            // Forum attachment
            args = new[]
            {
                "PostForumID", PostForumID.ToString(),
                "PostID", PostID.ToString()
            };
            return("ForumArgs=" + GetArgumentsString(args));
        }

        if ((DocumentID > 0) || (FormGUID != Guid.Empty))
        {
            // Attachment mode
            args = new[]
            {
                "DocumentID", DocumentID.ToString(),
                "DocumentParentNodeID", DocumentParentNodeID.ToString(),
                "NodeClassName", NodeClassName,
                "AttachmentGUIDColumnName", AttachmentGUIDColumnName,
                "AttachmentGUID", AttachmentGUID.ToString(),
                "AttachmentGroupGUID", AttachmentGroupGUID.ToString(),
                "FormGUID", FormGUID.ToString(),
                "IsFieldAttachment", mIsFiledAttachment.ToString(),
                "FullRefresh", FullRefresh.ToString()
            };
            return("AttachmentArgs=" + GetArgumentsString(args));
        }
        return(String.Empty);
    }
Exemplo n.º 34
0
 public static NodeID Decode(IByteReader stream)
 {
     NodeID decodedNodeID = new NodeID();
       decodedNodeID.InnerValue = PublicKey.Decode(stream);
     return decodedNodeID;
 }
Exemplo n.º 35
0
 public static void GetConnectionInfo(int hostId, int connectionId, out string address, out int port, out NetworkID network, out NodeID dstNode, out byte error)
 {
     ulong num;
     ushort num2;
     address = GetConnectionInfo(hostId, connectionId, out port, out num, out num2, out error);
     network = (NetworkID) num;
     dstNode = (NodeID) num2;
 }
Exemplo n.º 36
0
 public static void Encode(IByteWriter stream, NodeID  encodedNodeID)
 {
     PublicKey.Encode(stream, encodedNodeID.InnerValue);
 }
Exemplo n.º 37
0
 /// <summary>
 /// 
 /// <para>
 /// UnderlyingModel.MemDoc.MemDocModelStarts a server using a relay server. This is the manual way of using the relay server, as the regular NetworkServer.Connect() will automatically  use the relay server if a UMatch exists.
 /// </para>
 /// 
 /// </summary>
 /// <param name="relayIp">Relay server IP Address.</param><param name="relayPort">Relay server port.</param><param name="netGuid">GUID of the network to create.</param><param name="sourceId">This server's sourceId.</param><param name="nodeId">The node to join the network with.</param>
 public static void ListenRelay(string relayIp, int relayPort, NetworkID netGuid, SourceID sourceId, NodeID nodeId)
 {
     NetworkServer.instance.InternalListenRelay(relayIp, relayPort, netGuid, sourceId, nodeId, 0);
 }
Exemplo n.º 38
0
        /// <summary>
        /// Starts a server using a Relay server. This is the manual way of using the Relay server, as the regular NetworkServer.Connect() will automatically use the Relay server if a match exists.
        /// </summary>
        /// <param name="relayIp">Relay server IP Address.</param>
        /// <param name="relayPort">Relay server port.</param>
        /// <param name="netGuid">GUID of the network to create.</param>
        /// <param name="sourceId">This server's sourceId.</param>
        /// <param name="nodeId">The node to join the network with.</param>
        public void ListenRelay(string relayIp, int relayPort, NetworkID netGuid, SourceID sourceId, NodeID nodeId)
        {
            Initialize();

            m_ServerHostId = NetworkManager.activeTransport.AddHost(m_HostTopology, listenPort, null);
            if (LogFilter.logDebug)
            {
                Debug.Log("Server Host Slot Id: " + m_ServerHostId);
            }

            Update();

            byte error;

            NetworkManager.activeTransport.ConnectAsNetworkHost(
                m_ServerHostId,
                relayIp,
                relayPort,
                netGuid,
                sourceId,
                nodeId,
                out error);

            m_RelaySlotId = 0;
            if (LogFilter.logDebug)
            {
                Debug.Log("Relay Slot Id: " + m_RelaySlotId);
            }
        }
Exemplo n.º 39
0
 public static extern int ConnectToNetworkPeer(int hostId, string address, int port, int exceptionConnectionId, int relaySlotId, NetworkID network, SourceID source, NodeID node, int bytesPerSec, float bucketSizeFactor, out byte error);
Exemplo n.º 40
0
        protected void Page_Load(object sender, EventArgs e)
        {
            B_ARoleAuth.CheckEx(ZLEnum.Auth.model, "NodeEdit");
            if (function.isAjax())
            {
                #region AJAX
                M_Node nodeMod = nodeBll.SelReturnModel(NodeID);
                if (NodeID < 1)
                {
                    nodeMod.ParentID = ParentID;
                }
                string action = Request.Form["action"];
                string value  = Request.Form["value"];
                int    result = M_APIResult.Success;
                switch (action)
                {
                case "nodename":
                {
                    nodeMod.NodeName = value;
                    result           = nodeBll.CheckNodeName(nodeMod) ? M_APIResult.Success : M_APIResult.Failed;
                }
                break;

                case "nodedir":
                {
                    nodeMod.NodeDir = value;
                    result          = nodeBll.CheckNodeDir(nodeMod) ? M_APIResult.Success : M_APIResult.Failed;
                }
                break;
                }
                Response.Write(result); Response.Flush(); Response.End();
                #endregion
            }
            if (!IsPostBack)
            {
                M_AdminInfo adminMod  = B_Admin.GetLogin();
                M_Node      nodeMod   = nodeBll.SelReturnModel(NodeID);
                M_Node      parentMod = nodeBll.SelReturnModel(ParentID > 0 ? ParentID : nodeMod.ParentID);
                LblNodeName.Text = parentMod.NodeName;
                if (NodeID < 1)
                {
                    Title_T.Text = "添加节点";
                    CDate_T.Text = DateTime.Now.ToString();
                    CUser_T.Text = adminMod.AdminName;
                    ModelArr    += parentMod.ContentModel;
                    function.Script(this, "BindPY();");
                }
                else
                {
                    Title_T.Text        = "修改节点";
                    Release_Btn.Visible = true;
                    #region 节点信息填充
                    if (nodeMod.IsNull)
                    {
                        function.WriteErrMsg("指定要编辑的节点不存在");
                    }
                    TxtNodeName.Text        = nodeMod.NodeName;
                    TxtNodeDir.Text         = nodeMod.NodeDir;
                    TxtNodePicUrl.Text      = nodeMod.NodePic;
                    TxtTips.Text            = nodeMod.Tips;
                    TxtMetaKeywords.Text    = nodeMod.Meta_Keywords;
                    TxtMetaDescription.Text = nodeMod.Meta_Description;
                    TxtDescription.Text     = nodeMod.Description;
                    //RBLOpenType.SelectedValue = DataConverter.CLng(node.OpenNew).ToString();
                    RBLPurviewType.SelectedValue       = nodeMod.PurviewType ? "1" : "0";
                    SiteContentAudit_Rad.SelectedValue = nodeMod.SiteContentAudit.ToString();
                    RBLCommentType.SelectedValue       = nodeMod.CommentType;
                    TxtHitsOfHot.Text = nodeMod.HitsOfHot.ToString();

                    TxtTemplate_hid.Value      = nodeMod.ListTemplateFile;
                    IndexTemplate_hid.Value    = nodeMod.IndexTemplate;
                    LastinfoTemplate_hid.Value = nodeMod.LastinfoTemplate;
                    ProposeTemplate_hid.Value  = nodeMod.ProposeTemplate;
                    HotinfoTemplate_hid.Value  = nodeMod.HotinfoTemplate;

                    ListPageHtmlEx_Rad.SelectedValue = nodeMod.ListPageHtmlEx.ToString();
                    ContentFileEx_Rad.SelectedValue  = nodeMod.ContentFileEx.ToString();
                    ListPageEx_Rad.SelectedValue     = nodeMod.ListPageEx.ToString();
                    LastinfoPageEx_Rad.SelectedValue = nodeMod.LastinfoPageEx.ToString();
                    HotinfoPageEx.SelectedValue      = nodeMod.HotinfoPageEx.ToString();
                    ProposePageEx.SelectedValue      = nodeMod.ProposePageEx.ToString();
                    DDLContentRule.SelectedValue     = nodeMod.ContentPageHtmlRule.ToString();
                    RBLPosition.SelectedValue        = nodeMod.HtmlPosition.ToString();
                    RBLItemOpenType.SelectedValue    = nodeMod.ItemOpenType.ToString();
                    function.Script(this, "SetRadVal('UrlFormat_Rad','" + nodeMod.ItemOpenTypeTrue + "');");
                    RBLOpenType.SelectedValue  = nodeMod.OpenTypeTrue.ToString();
                    TxtAddMoney.Text           = nodeMod.AddMoney.ToString();
                    TxtAddPoint.Text           = nodeMod.AddPoint.ToString();
                    ClickTimeout.SelectedValue = nodeMod.ClickTimeout.ToString();
                    txtAddExp.Text             = nodeMod.AddUserExp.ToString();
                    txtDeducExp.Text           = nodeMod.DeducUserExp.ToString();
                    ConsumeType_Hid.Value      = nodeMod.ConsumeType.ToString();
                    CDate_T.Text = nodeMod.CDate.ToString();
                    CUser_T.Text = nodeMod.CUName;
                    DataTable auitDt = nodeBll.GetNodeAuitDT(nodeMod.Purview);
                    //节点权限
                    if (auitDt != null && auitDt.Rows.Count > 0)
                    {
                        DataRow auitdr = auitDt.Rows[0];
                        SelCheck_RadioList.SelectedValue = auitdr["View"].ToString();
                        string ViewGroup    = auitdr["ViewGroup"].ToString();
                        string ViewSunGroup = auitdr["ViewSunGroup"].ToString();
                        string input        = auitdr["input"].ToString();
                        string forum        = auitdr["forum"].ToString();
                        foreach (ListItem item in ViewGroup_Chk.Items)
                        {
                            if (("," + ViewGroup + ",").Contains("," + item.Value + ","))
                            {
                                item.Selected = true;
                            }
                        }
                        foreach (ListItem item in ViewGroup2_Chk.Items)
                        {
                            if (("," + ViewSunGroup + ",").Contains("," + item.Value + ","))
                            {
                                item.Selected = true;
                            }
                        }
                        foreach (ListItem item in input_Chk.Items)
                        {
                            if (("," + input + ",").Contains("," + item.Value + ","))
                            {
                                item.Selected = true;
                            }
                        }
                        foreach (ListItem item in forum_Chk.Items)
                        {
                            if (("," + forum + ",").Contains("," + item.Value + ","))
                            {
                                item.Selected = true;
                            }
                        }
                    }
                    TxtConsumeCount.Text = nodeMod.ConsumeCount.ToString();
                    TxtConsumePoint.Text = nodeMod.ConsumePoint.ToString();
                    TxtConsumeTime.Text  = nodeMod.ConsumeTime.ToString();
                    TxtShares.Text       = nodeMod.Shares.ToString();
                    SetCustom(nodeMod.Custom);
                    ModelArr            = nodeMod.ContentModel;
                    isSimple_CH.Checked = nodeMod.Contribute == 1;
                    SafeGuard.Checked   = nodeMod.SafeGuard == 1 ? true : false;
                    #endregion
                }
                //添加工作流
                ddlState.DataSource     = bf.GetFlowAll();
                ddlState.DataTextField  = "flowName";
                ddlState.DataValueField = "id";
                ddlState.DataBind();
                ddlState.Items.Insert(0, new ListItem("不指定", "0"));
                droMod = droBll.SelByNodeID(NodeID);
                ddlState.SelectedValue = droMod == null ? "0" : droMod.FID.ToString();
                BGroup.DataSource      = bGll.GetGroupList();
                BGroup.DataBind();
                //内容模型列表
                DataTable dt = bllmodel.GetList();
                Model_RPT.DataSource = dt;
                Model_RPT.DataBind();
                //角色列表
                DataTable Rt = B_Role.SelectNodeRoleNode(NodeID);
                AdminRole_EGV.DataSource = Rt;
                AdminRole_EGV.DataBind();
                //组权限绑定
                GroupAuthDT = psll.SelByNid(NodeID);
                DataTable gpauthDT = bGll.GetGroupList();
                for (int i = 0; i < gpauthDT.Rows.Count; i++)
                {
                    ViewGroup_Chk.Items.Add(new ListItem(gpauthDT.Rows[i]["GroupName"].ToString(), gpauthDT.Rows[i]["GroupID"].ToString()));
                    ViewGroup2_Chk.Items.Add(new ListItem(gpauthDT.Rows[i]["GroupName"].ToString(), gpauthDT.Rows[i]["GroupID"].ToString()));
                    input_Chk.Items.Add(new ListItem(gpauthDT.Rows[i]["GroupName"].ToString(), gpauthDT.Rows[i]["GroupID"].ToString()));
                }
                GroupAuth_EGV.DataSource = gpauthDT;
                GroupAuth_EGV.DataBind();
                #region 互动
                DataTable dp = pll.GetPubModelPublic();
                DropDownList1.DataSource     = dp;
                DropDownList1.DataTextField  = "PubName";
                DropDownList1.DataValueField = "Pubid";
                DropDownList1.DataBind();
                DropDownList1.Items.Insert(0, new ListItem("选择绑定", "0"));
                M_Pub pp = pll.GetSelectNode(NodeID.ToString());
                if (pp.Pubid > 0)
                {
                    DropDownList1.SelectedValue = pp.Pubid.ToString();
                }
                #endregion
                string bread = "<li><a href='" + customPath2 + "Config/SiteInfo.aspx'>系统设置</a></li><li>" + (ViewMode.Equals("design") || ViewMode.Equals("child") ? "<a href='DesignNodeManage.aspx'>动力节点</a>" : "<a href='NodeManage.aspx'>节点管理</a>") + "</li>";
                bread += "<li class='active'><a href='" + Request.RawUrl + "'>" + Title_T.Text + "</a></li>";
                bread += Call.GetHelp(103);
                bread += "<div class='pull-right' style='margin-right:10px;'><a href='" + Request.RawUrl + "' title='刷新'><i class='fa fa-refresh'></i></a></div>";
                Call.SetBreadCrumb(Master, bread);
            }
        }
Exemplo n.º 41
0
 public static void GetConnectionInfo(int hostId, int connectionId, out string address, out int port, out NetworkID network, out NodeID dstNode, out byte error)
 {
     ulong network1;
       ushort dstNode1;
       address = NetworkTransport.GetConnectionInfo(hostId, connectionId, out port, out network1, out dstNode1, out error);
       network = (NetworkID) network1;
       dstNode = (NodeID) dstNode1;
 }
Exemplo n.º 42
0
 public IFolder OpenFolder(NodeID nodeID)
 {
     return(new Folder(new DifferentMockDBContext(), nodeID));
 }
Exemplo n.º 43
0
 public NodeStatement(NodeID nodeID)
 {
     this.nodeID = nodeID;
 }
Exemplo n.º 44
0
 public ISearchFolder OpenSearchFolder(NodeID nodeID)
 {
     return(new SearchFolder(new DifferentMockDBContext(), nodeID));
 }
Exemplo n.º 45
0
 public override void OnMatchCreate(CreateMatchResponse response)
 {
     base.OnMatchCreate(response);
     _networkID = response.networkId;
     _nodeID = response.nodeId;
 }
Exemplo n.º 46
0
 public IMessage OpenMessage(NodeID nodeID)
 {
     return(new Message(new DifferentMockDBContext(), nodeID));
 }