Ejemplo n.º 1
0
 public ExposedNodeService(IInternalExposedNodeService exposedNodeService, ProxyNodeInfoFactory proxyNodeInfoFactory)
 {
     FExposedNodeService   = exposedNodeService;
     FProxyNodeInfoFactory = proxyNodeInfoFactory;
     FExposedNodeListener  = new ExposedNodeListener(this, proxyNodeInfoFactory);
     FExposedNodeService.Subscribe(FExposedNodeListener);
 }
Ejemplo n.º 2
0
        public ProxyNodeInfoFactory(IInternalNodeInfoFactory nodeInfoFactory)
        {
            FFactory            = nodeInfoFactory;
            FInternalToProxyMap = new Dictionary <INodeInfo, ProxyNodeInfo>();
            FProxyToInternalMap = new Dictionary <INodeInfo, INodeInfo>();

            foreach (var nodeInfo in nodeInfoFactory.NodeInfos)
            {
                NodeInfoAddedCB(nodeInfo);
            }

            nodeInfoFactory.AddListener(this);

            FVVVVThread = Thread.CurrentThread;

            Instance = this;
        }
Ejemplo n.º 3
0
        public void Initialize(IVVVVHost vvvvHost, INodeBrowserHost nodeBrowserHost, IWindowSwitcherHost windowSwitcherHost, IKommunikatorHost kommunikatorHost)
        {
            // Used for Windows Forms message loop
            FIsRunning = true;

            //set blackbox mode?
            this.IsBlackBoxMode = vvvvHost.IsBlackBoxMode;

            // Set VVVV45 to this running vvvv.exe
            Environment.SetEnvironmentVariable(ENV_VVVV, Path.GetFullPath(Shell.CallerPath.ConcatPath("..").ConcatPath("..")));

            FVVVVHost       = vvvvHost;
            NodeInfoFactory = new ProxyNodeInfoFactory(vvvvHost.NodeInfoFactory);

            FVVVVHost.AddMouseClickListener(this);
            FVVVVHost.AddNodeSelectionListener(this);
            FVVVVHost.AddWindowListener(this);
            FVVVVHost.AddWindowSelectionListener(this);
            FVVVVHost.AddComponentModeListener(this);
            FVVVVHost.AddEnumListener(this);

            NodeInfoFactory.NodeInfoUpdated += factory_NodeInfoUpdated;

            // Route log messages to vvvv
            Logger.AddLogger(new VVVVLogger(FVVVVHost));

            DeviceService = new DeviceService(vvvvHost.DeviceService);
            MainLoop      = new MainLoop(vvvvHost.MainLoop);

            ExposedNodeService = new ExposedNodeService(vvvvHost.ExposedNodeService, NodeInfoFactory);

            NodeBrowserHost    = new ProxyNodeBrowserHost(nodeBrowserHost, NodeInfoFactory);
            WindowSwitcherHost = windowSwitcherHost;
            KommunikatorHost   = kommunikatorHost;

            //do not add the entire directory for faster startup
            var catalog = new AggregateCatalog();

            catalog.Catalogs.Add(new AssemblyCatalog(typeof(HDEHost).Assembly.Location));
            catalog.Catalogs.Add(new AssemblyCatalog(typeof(NodeCollection).Assembly.Location));
            //allow plugin writers to add their own factories (deprecated, see below)
            var factoriesPath = ExePath.ConcatPath(@"lib\factories");

            if (Directory.Exists(factoriesPath))
            {
                catalog.Catalogs.Add(new DirectoryCatalog(factoriesPath));
            }

            //register custom assembly resolvers which look also in the PACK_NAME/core and PACK_NAME/core/[x86|x64] folders
            AppDomain.CurrentDomain.AssemblyResolve += CurrentDomain_AssemblyResolve;
            AppDomain.CurrentDomain.ReflectionOnlyAssemblyResolve += CurrentDomain_ReflectionOnlyAssemblyResolve;

            //search for packs, add factories dir to this catalog, add core dir to assembly search path,
            //add nodes to nodes search path
            var packsPath = Path.Combine(ExePath, "packs");

            if (Directory.Exists(packsPath))
            {
                LoadFactoriesFromLegacyPackages(packsPath, catalog);
            }
            //new package loading system
            LoadFactoriesFromPackages(catalog);

            Container = new CompositionContainer(catalog);
            Container.ComposeParts(this);

            PluginFactory.AddFile(ExePath.ConcatPath(@"lib\nodes\plugins\VVVV.Nodes.dll"));

            //Get node infos from core plugins here to avoid looping all node infos
            var windowSwitcherNodeInfo = GetNodeInfo(WINDOW_SWITCHER);
            var kommunikatorNodeInfo   = GetNodeInfo(KOMMUNIKATOR);
            var nodeBrowserNodeInfo    = GetNodeInfo(NODE_BROWSER);

            foreach (var factory in AddonFactories)
            {
                if (factory is PatchFactory)
                {
                    NodeCollection.Add(string.Empty, ExePath.ConcatPath(@"lib\nodes\native\"), factory, true, false);
                }
            }

            //now instantiate a NodeBrowser, a Kommunikator and a WindowSwitcher
            FWindowSwitcher = PluginFactory.CreatePlugin(windowSwitcherNodeInfo, null);
            FKommunikator   = PluginFactory.CreatePlugin(kommunikatorNodeInfo, null);
            FNodeBrowser    = PluginFactory.CreatePlugin(nodeBrowserNodeInfo, null);

            this.IsBoygroupClient = FVVVVHost.IsBoygroupClient;
            if (IsBoygroupClient)
            {
                this.BoygroupServerIP = FVVVVHost.BoygroupServerIP;
            }

            var clockport = 3334;

            try
            {
                if (Environment.CommandLine.Contains("/clockport"))
                {
                    var env = Environment.GetCommandLineArgs();
                    var idx = Array.IndexOf(env, "/clockport") + 1;
                    clockport = int.Parse(env[idx]);
                }
            }
            catch (Exception)
            {
                throw new Exception("Could not parse clockport, make sure you have the right syntax, e.g. '/clockport 3344' ");
            }

            //start time server of client
            FNetTimeSync = IsBoygroupClient ? new UDPTimeClient(BoygroupServerIP, clockport) : new UDPTimeServer(clockport);
            FNetTimeSync.Start();

            //now that all basics are set up, see if there are any node search paths to add
            //from the installed packs
            if (Directory.Exists(packsPath))
            {
                LoadNodesFromLegacyPackages(packsPath);
            }
            LoadNodesFromPackages();
        }
Ejemplo n.º 4
0
        public void Initialize(IVVVVHost vvvvHost, INodeBrowserHost nodeBrowserHost, IWindowSwitcherHost windowSwitcherHost, IKommunikatorHost kommunikatorHost)
        {
            // Set VVVV45 to this running vvvv.exe
            Environment.SetEnvironmentVariable(ENV_VVVV, Path.GetFullPath(Shell.CallerPath.ConcatPath("..").ConcatPath("..")));

            FVVVVHost       = vvvvHost;
            NodeInfoFactory = new ProxyNodeInfoFactory(vvvvHost.NodeInfoFactory);

            FVVVVHost.AddMouseClickListener(this);
            FVVVVHost.AddNodeSelectionListener(this);
            FVVVVHost.AddWindowListener(this);
            FVVVVHost.AddWindowSelectionListener(this);

            NodeInfoFactory.NodeInfoUpdated += factory_NodeInfoUpdated;

            // Route log messages to vvvv
            Logger.AddLogger(new VVVVLogger(FVVVVHost));

            DeviceService = new DeviceService(vvvvHost.DeviceService);
            MainLoop      = new MainLoop(vvvvHost.MainLoop);

            ExposedNodeService = new ExposedNodeService(vvvvHost.ExposedNodeService, NodeInfoFactory);

            NodeBrowserHost    = new ProxyNodeBrowserHost(nodeBrowserHost, NodeInfoFactory);
            WindowSwitcherHost = windowSwitcherHost;
            KommunikatorHost   = kommunikatorHost;

            //do not add the entire directory for faster startup
            var catalog = new AggregateCatalog();

            catalog.Catalogs.Add(new AssemblyCatalog(typeof(HDEHost).Assembly.Location));
            catalog.Catalogs.Add(new AssemblyCatalog(typeof(NodeCollection).Assembly.Location));
            //allow plugin writers to add their own factories
            var factoriesPath = ExePath.ConcatPath(@"lib\factories");

            if (Directory.Exists(factoriesPath))
            {
                catalog.Catalogs.Add(new DirectoryCatalog(factoriesPath));
            }
            Container = new CompositionContainer(catalog);
            Container.ComposeParts(this);

            //NodeCollection.AddJob(Shell.CallerPath.Remove(Shell.CallerPath.LastIndexOf(@"bin\managed")));
            PluginFactory.AddFile(ExePath.ConcatPath(@"lib\nodes\plugins\VVVV.Nodes.dll"));
//            PluginFactory.AddFile(ExePath.ConcatPath(@"lib\nodes\plugins\Kommunikator.dll"));
//            PluginFactory.AddFile(ExePath.ConcatPath(@"lib\nodes\plugins\NodeBrowser.dll"));
//            PluginFactory.AddFile(ExePath.ConcatPath(@"lib\nodes\plugins\NodeCollector.dll"));
//            PluginFactory.AddFile(ExePath.ConcatPath(@"lib\nodes\plugins\WindowSwitcher.dll"));

            //Get node infos from core plugins here to avoid looping all node infos
            var windowSwitcherNodeInfo = GetNodeInfo(WINDOW_SWITCHER);
            var kommunikatorNodeInfo   = GetNodeInfo(KOMMUNIKATOR);
            var nodeBrowserNodeInfo    = GetNodeInfo(NODE_BROWSER);

            foreach (var factory in AddonFactories)
            {
                if (factory is PatchFactory)
                {
                    NodeCollection.Add(string.Empty, ExePath.ConcatPath(@"lib\nodes\native\"), factory, true, false);
                }
            }

            //now instantiate a NodeBrowser, a Kommunikator and a WindowSwitcher
            FWindowSwitcher = PluginFactory.CreatePlugin(windowSwitcherNodeInfo, null);
            FKommunikator   = PluginFactory.CreatePlugin(kommunikatorNodeInfo, null);
            FNodeBrowser    = PluginFactory.CreatePlugin(nodeBrowserNodeInfo, null);

            this.IsBoygroupClient = FVVVVHost.IsBoygroupClient;
            if (IsBoygroupClient)
            {
                this.BoygroupServerIP = FVVVVHost.BoygroupServerIP;
            }


            //start time server of client
            FNetTimeSync = IsBoygroupClient ? new UDPTimeClient(BoygroupServerIP, 3334) : new UDPTimeServer(3334);
            FNetTimeSync.Start();
        }
Ejemplo n.º 5
0
        public void Initialize(IVVVVHost vvvvHost, INodeBrowserHost nodeBrowserHost, IWindowSwitcherHost windowSwitcherHost, IKommunikatorHost kommunikatorHost)
        {
            //set blackbox mode?
            this.IsBlackBoxMode = vvvvHost.IsBlackBoxMode;

            // Set VVVV45 to this running vvvv.exe
            Environment.SetEnvironmentVariable(ENV_VVVV, Path.GetFullPath(Shell.CallerPath.ConcatPath("..").ConcatPath("..")));

            FVVVVHost       = vvvvHost;
            NodeInfoFactory = new ProxyNodeInfoFactory(vvvvHost.NodeInfoFactory);

            FVVVVHost.AddMouseClickListener(this);
            FVVVVHost.AddNodeSelectionListener(this);
            FVVVVHost.AddWindowListener(this);
            FVVVVHost.AddWindowSelectionListener(this);
            FVVVVHost.AddComponentModeListener(this);

            NodeInfoFactory.NodeInfoUpdated += factory_NodeInfoUpdated;

            // Route log messages to vvvv
            Logger.AddLogger(new VVVVLogger(FVVVVHost));

            DeviceService = new DeviceService(vvvvHost.DeviceService);
            MainLoop      = new MainLoop(vvvvHost.MainLoop);

            ExposedNodeService = new ExposedNodeService(vvvvHost.ExposedNodeService, NodeInfoFactory);

            NodeBrowserHost    = new ProxyNodeBrowserHost(nodeBrowserHost, NodeInfoFactory);
            WindowSwitcherHost = windowSwitcherHost;
            KommunikatorHost   = kommunikatorHost;

            //do not add the entire directory for faster startup
            var catalog = new AggregateCatalog();

            catalog.Catalogs.Add(new AssemblyCatalog(typeof(HDEHost).Assembly.Location));
            catalog.Catalogs.Add(new AssemblyCatalog(typeof(NodeCollection).Assembly.Location));
            //allow plugin writers to add their own factories (deprecated, see below)
            var factoriesPath = ExePath.ConcatPath(@"lib\factories");

            if (Directory.Exists(factoriesPath))
            {
                catalog.Catalogs.Add(new DirectoryCatalog(factoriesPath));
            }

            //search for packs, add factories dir to this catalog, add core dir to assembly search path,
            //add nodes to nodes search path
            var packsDirInfo = new DirectoryInfo(Path.Combine(ExePath, "packs"));

            if (packsDirInfo.Exists)
            {
                AppDomain.CurrentDomain.AssemblyResolve += new ResolveEventHandler(CurrentDomain_AssemblyResolve);
                AppDomain.CurrentDomain.ReflectionOnlyAssemblyResolve += CurrentDomain_ReflectionOnlyAssemblyResolve;
                foreach (var packDirInfo in packsDirInfo.GetDirectories())
                {
                    var packDir     = packDirInfo.FullName;
                    var coreDirInfo = new DirectoryInfo(Path.Combine(packDir, "core"));
                    if (coreDirInfo.Exists)
                    {
                        FAssemblySearchPaths.Add(coreDirInfo.FullName);
                        var platformDir = IntPtr.Size == 4 ? "x86" : "x64";
                        var platformDependentCorDirInfo = new DirectoryInfo(Path.Combine(coreDirInfo.FullName, platformDir));
                        if (platformDependentCorDirInfo.Exists)
                        {
                            FAssemblySearchPaths.Add(platformDependentCorDirInfo.FullName);
                        }
                    }
                    var factoriesDirInfo = new DirectoryInfo(Path.Combine(packDir, "factories"));
                    if (factoriesDirInfo.Exists)
                    {
                        catalog.Catalogs.Add(new DirectoryCatalog(factoriesDirInfo.FullName));
                    }
                    // We look for nodes later
                }
            }

            Container = new CompositionContainer(catalog);
            Container.ComposeParts(this);

            //NodeCollection.AddJob(Shell.CallerPath.Remove(Shell.CallerPath.LastIndexOf(@"bin\managed")));
            PluginFactory.AddFile(ExePath.ConcatPath(@"lib\nodes\plugins\VVVV.Nodes.dll"));
//            PluginFactory.AddFile(ExePath.ConcatPath(@"lib\nodes\plugins\Kommunikator.dll"));
//            PluginFactory.AddFile(ExePath.ConcatPath(@"lib\nodes\plugins\NodeBrowser.dll"));
//            PluginFactory.AddFile(ExePath.ConcatPath(@"lib\nodes\plugins\NodeCollector.dll"));
//            PluginFactory.AddFile(ExePath.ConcatPath(@"lib\nodes\plugins\WindowSwitcher.dll"));

            //Get node infos from core plugins here to avoid looping all node infos
            var windowSwitcherNodeInfo = GetNodeInfo(WINDOW_SWITCHER);
            var kommunikatorNodeInfo   = GetNodeInfo(KOMMUNIKATOR);
            var nodeBrowserNodeInfo    = GetNodeInfo(NODE_BROWSER);

            foreach (var factory in AddonFactories)
            {
                if (factory is PatchFactory)
                {
                    NodeCollection.Add(string.Empty, ExePath.ConcatPath(@"lib\nodes\native\"), factory, true, false);
                }
            }

            //now instantiate a NodeBrowser, a Kommunikator and a WindowSwitcher
            FWindowSwitcher = PluginFactory.CreatePlugin(windowSwitcherNodeInfo, null);
            FKommunikator   = PluginFactory.CreatePlugin(kommunikatorNodeInfo, null);
            FNodeBrowser    = PluginFactory.CreatePlugin(nodeBrowserNodeInfo, null);

            this.IsBoygroupClient = FVVVVHost.IsBoygroupClient;
            if (IsBoygroupClient)
            {
                this.BoygroupServerIP = FVVVVHost.BoygroupServerIP;
            }


            //start time server of client
            FNetTimeSync = IsBoygroupClient ? new UDPTimeClient(BoygroupServerIP, 3334) : new UDPTimeServer(3334);
            FNetTimeSync.Start();

            //now that all basics are set up, see if there are any node search paths to add
            //from the installed packs
            if (packsDirInfo.Exists)
            {
                foreach (var packDirInfo in packsDirInfo.GetDirectories())
                {
                    var packDir      = packDirInfo.FullName;
                    var nodesDirInfo = new DirectoryInfo(Path.Combine(packDir, "nodes"));
                    if (nodesDirInfo.Exists)
                    {
                        NodeCollection.AddJob(nodesDirInfo.FullName, true);
                    }
                }
            }
        }
Ejemplo n.º 6
0
 public ExposedNodeListener(ExposedNodeService exposedNodeService, ProxyNodeInfoFactory proxyNodeInfoFactory)
 {
     FExposedNodeService   = exposedNodeService;
     FProxyNodeInfoFactory = proxyNodeInfoFactory;
 }
Ejemplo n.º 7
0
 public ProxyNodeBrowserHost(INodeBrowserHost nodeBrowserHost, ProxyNodeInfoFactory nodeInfoFactory)
 {
     FNodeBrowserHost = nodeBrowserHost;
     FNodeInfoFactory = nodeInfoFactory;
 }