Esempio n. 1
0
        static PatchTests()
        {
            var currentDirectory = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);

            MainLibPath      = Path.GetFullPath(Path.Combine(currentDirectory, @"..\..\..\..\..\..\.."));
            LibTestsPath     = Path.Combine(MainLibPath, "tests");
            RepositoriesPath = Path.GetFullPath(Path.Combine(MainLibPath, @".."));

            foreach (var pack in Packs)
            {
                AssemblyLoader.AddPackageRepositories(pack);
            }

            // Also add the "vl-libs" folder. The folder that contains our library.
            AssemblyLoader.AddPackageRepositories(RepositoriesPath);


            if (SynchronizationContext.Current == null)
            {
                SynchronizationContext.SetSynchronizationContext(new WindowsFormsSynchronizationContext());
            }


            Session = new VLSession("gamma", SynchronizationContext.Current, includeUserPackages: false)
            {
                CheckSolution           = false,
                IgnoreDynamicEnumErrors = true,
                NoCache        = true,
                KeepTargetCode = false
            };
        }
Esempio n. 2
0
        public HDEHost()
        {
            FUseAppdata = Environment.GetCommandLineArgs().Contains("/appdata");

            // Set vvvv.exe path
            ExePath = Path.GetFullPath(Path.Combine(Path.GetDirectoryName((typeof(HDEHost).Assembly.Location)), @"..\.."));

            //add repository paths from commandline
            //from commandline
            var repoArg             = "/package-repositories";
            var packageRepositories = ExtractPaths(repoArg);

            AssemblyLoader.AddPackageRepositories(packageRepositories);

            //the built-in one
            if (Directory.Exists(PacksPath))
            {
                AssemblyLoader.AddPackageRepository(PacksPath);
            }
            //the one where the user is supposed to install packages to share it between vvvversions
            if (FUseAppdata)
            {
                if (Directory.Exists(UserPacksPath))
                {
                    AssemblyLoader.AddPackageRepository(UserPacksPath);
                }
            }
            //the legacy path
            if (Directory.Exists(UserPacksPathLegacy))
            {
                AssemblyLoader.AddPackageRepository(UserPacksPathLegacy);
            }

            // Set name to vvvv thread for easier debugging.
            Thread.CurrentThread.Name = "vvvv";

            // Create a windows forms sync context (FileSystemWatcher runs asynchronously).
            SynchronizationContext.SetSynchronizationContext(new MySynchronizationContext());

            // Register at least one ICommandHistory for top level element ISolution
            var mappingRegistry = new MappingRegistry();

            mappingRegistry.RegisterMapping <ISolution, ICommandHistory, CommandHistory>(MapInstantiation.PerInstanceAndItsChilds);

            var location = Shell.CallerPath.ConcatPath(@"..\..\lib\nodes\plugins").ConcatPath("Solution.sln");

            Solution = new Solution(location, mappingRegistry);

            EnumManager.SetHDEHost(this);

            Logger = new DefaultLogger();

            IORegistry = new IORegistry();

            // Will tell Windows Forms that a message loop is indeed running
            Application.RegisterMessageLoop(IsSendingMessages);
        }
Esempio n. 3
0
        public HDEHost()
        {
            // Set vvvv.exe path
            ExePath = Path.GetFullPath(Path.Combine(Path.GetDirectoryName((typeof(HDEHost).Assembly.Location)), @"..\.."));

            //add repository paths from commandline
            //from commandline
            var repoArg = "/package-repositories";

            var packageRepositories = AssemblyLoader.ParseCommandLine(repoArg);

            //from args.txt
            var argsFile = Path.Combine(ExePath, "args.txt");

            if (File.Exists(argsFile))
            {
                var args         = File.ReadAllText(argsFile).Trim('\r', '\n', ' ').Split(' ');
                var sourcesIndex = Array.IndexOf(args, repoArg);
                if (sourcesIndex >= 0 && args.Length > sourcesIndex + 1)
                {
                    var sourcesString = args[sourcesIndex + 1].Trim('"');
                    var repoPaths     = sourcesString.Split(new[] { ';' }, StringSplitOptions.RemoveEmptyEntries);
                    for (int i = 0; i < repoPaths.Length; i++)
                    {
                        repoPaths[i] = repoPaths[i].Trim('"', '\\');
                    }

                    packageRepositories = packageRepositories.Union(repoPaths).ToArray();
                }
            }

            //make relative paths absolute
            for (int i = 0; i < packageRepositories.Length; i++)
            {
                if (Path.IsPathRooted(packageRepositories[i]))
                {
                    packageRepositories[i] = Path.Combine(ExePath, packageRepositories[i]);
                }
            }

            AssemblyLoader.AddPackageRepositories(packageRepositories);

            //the built-in one
            if (Directory.Exists(PacksPath))
            {
                AssemblyLoader.AddPackageRepository(PacksPath);
            }
            //the one where the user is supposed to install packages
            if (Directory.Exists(UserPacksPatch))
            {
                AssemblyLoader.AddPackageRepository(UserPacksPatch);
            }


            // Set name to vvvv thread for easier debugging.
            Thread.CurrentThread.Name = "vvvv";

            // Create a windows forms sync context (FileSystemWatcher runs asynchronously).
            SynchronizationContext.SetSynchronizationContext(new MySynchronizationContext());

            // Register at least one ICommandHistory for top level element ISolution
            var mappingRegistry = new MappingRegistry();

            mappingRegistry.RegisterMapping <ISolution, ICommandHistory, CommandHistory>(MapInstantiation.PerInstanceAndItsChilds);

            var location = Shell.CallerPath.ConcatPath(@"..\..\lib\nodes\plugins").ConcatPath("Solution.sln");

            Solution = new Solution(location, mappingRegistry);

            EnumManager.SetHDEHost(this);

            Logger = new DefaultLogger();

            IORegistry = new IORegistry();

            // Will tell Windows Forms that a message loop is indeed running
            Application.RegisterMessageLoop(IsSendingMessages);
        }
Esempio n. 4
0
        public HDEHost()
        {
            // Set vvvv.exe path
            ExePath = Path.GetFullPath(Path.Combine(Path.GetDirectoryName((typeof(HDEHost).Assembly.Location)), @"..\.."));

            //add repository paths from commandline
            //from commandline
            var repoArg             = "/package-repositories";
            var packageRepositories = AssemblyLoader.ParseCommandLine(repoArg);

            //from args.txt
            var argsFile = Path.Combine(ExePath, "args.txt");

            if (File.Exists(argsFile))
            {
                var args      = File.ReadAllText(argsFile);
                var repoPaths = args.Split(new string[] { "\r", "\r\n", "\n" }, StringSplitOptions.RemoveEmptyEntries)
                                .Where(l => l.StartsWith(repoArg))
                                .SelectMany(r => r.Substring(repoArg.Length + 1).Trim('"').Split(';'));

                packageRepositories = packageRepositories.Union(repoPaths).ToArray();
            }

            AssemblyLoader.AddPackageRepositories(packageRepositories);

            //the built-in one
            if (Directory.Exists(PacksPath))
            {
                AssemblyLoader.AddPackageRepository(PacksPath);
            }
            //the one where the user is supposed to install packages
            if (Directory.Exists(UserPacksPatch))
            {
                AssemblyLoader.AddPackageRepository(UserPacksPatch);
            }


            // Set name to vvvv thread for easier debugging.
            Thread.CurrentThread.Name = "vvvv";

            // Create a windows forms sync context (FileSystemWatcher runs asynchronously).
            SynchronizationContext.SetSynchronizationContext(new MySynchronizationContext());

            // Register at least one ICommandHistory for top level element ISolution
            var mappingRegistry = new MappingRegistry();

            mappingRegistry.RegisterMapping <ISolution, ICommandHistory, CommandHistory>(MapInstantiation.PerInstanceAndItsChilds);

            var location = Shell.CallerPath.ConcatPath(@"..\..\lib\nodes\plugins").ConcatPath("Solution.sln");

            Solution = new Solution(location, mappingRegistry);

            EnumManager.SetHDEHost(this);

            Logger = new DefaultLogger();

            IORegistry = new IORegistry();

            // Will tell Windows Forms that a message loop is indeed running
            Application.RegisterMessageLoop(IsSendingMessages);
        }