示例#1
0
        /// <summary>
        /// Get a default netgraph
        /// </summary>
        /// <returns>The default graph</returns>
        public static NetGraphDocument GetDefault()
        {
            NetGraphDocument doc = new NetGraphDocument();

            ClientEndpointConfig client = doc.AddClient("Client");
            ServerEndpointConfig server = doc.AddServer("Server");

            LogPacketConfig logout = doc.AddLog("LogOut");
            LogPacketConfig login  = doc.AddLog("LogIn");

            server.AddEdge(server, logout, client, login, server);

            return(doc);
        }
示例#2
0
        private void BuildDefaultProxyNetgraph(NetGraphDocument document)
        {
            List <BaseNodeConfig> nodes = new List <BaseNodeConfig>();

            ServerEndpointConfig server = new ServerEndpointConfig();

            server.Label = "SERVER";
            server.X     = 80;
            server.Y     = 150;
            nodes.Add(server);

            ClientEndpointConfig client = new ClientEndpointConfig();

            client.Label = "CLIENT";
            client.X     = 280;
            client.Y     = 150;
            nodes.Add(client);

            LogPacketConfig logout = new LogPacketConfig();

            logout.Label = "LOGOUT";
            logout.X     = 180;
            logout.Y     = 60;
            logout.Color = ColorValue.Pink;
            logout.Tag   = "Out";
            nodes.Add(logout);

            LogPacketConfig login = new LogPacketConfig();

            login.Label = "LOGIN";
            login.X     = 180;
            login.Y     = 240;
            login.Color = ColorValue.Powderblue;
            login.Tag   = "In";
            nodes.Add(login);

            List <LineConfig> lines = new List <LineConfig>();

            lines.Add(new LineConfig(server, logout, false, null, false));
            lines.Add(new LineConfig(logout, client, false, null, false));
            lines.Add(new LineConfig(client, login, false, null, false));
            lines.Add(new LineConfig(login, server, false, null, false));


            document.UpdateGraph(nodes.ToArray(), lines.ToArray());
        }