Ejemplo n.º 1
0
        /// <summary>
        /// Will start the browser process.
        /// </summary>
        public static void Start()
        {
            var dir         = AppDomain.CurrentDomain.BaseDirectory;
            var missingDeps = DependencyChecker.CheckDependencies(true, false, dir, string.Empty, Path.Combine(dir, "CefSharp.BrowserSubprocess.exe"));

            if (missingDeps?.Count > 0)
            {
                Logger.LogInfo($"Missing dependancies:{missingDeps.Aggregate((r, s) => $"{r}, {s}")}");
            }

            var directory = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);

            directory = directory != null && directory.EndsWith("\\") ? directory : $"{directory}\\";

            var settings = new CefSettings();

            settings.RegisterScheme(new CefCustomScheme
            {
                SchemeName           = "custom",
                SchemeHandlerFactory = new SchemeHandlerFactory(directory)
            });

            settings.CefCommandLineArgs.Add("disable-gpu", "1");
            Cef.Initialize(settings, true, null);
        }
Ejemplo n.º 2
0
        public void DependencyCheckerCheckDependenciesTest()
        {
            log.Info("-----------------------------DependencyChecker CheckDependencies-----------------------------");

            // Test setup
            string MyPlugin1 = Path.Combine(Directory.GetCurrentDirectory(), "TapPackages/MyPlugin1.TapPackage");
            string MyPlugin2 = Path.Combine(Directory.GetCurrentDirectory(), "TapPackages/MyPlugin2.1.2.37-alpha.715+164e6f81.TapPackage");
            string MyPlugin3 = Path.Combine(Directory.GetCurrentDirectory(), "TapPackages/MyPlugin3.TapPackage");

            // No dependencies
            EventTraceListener listener = new EventTraceListener();
            string             errors   = "";

            listener.MessageLogged += events => errors += Environment.NewLine + String.Join(Environment.NewLine, events.Select(m => m.Message));
            Log.AddListener(listener);
            Installation installation = new Installation(Directory.GetCurrentDirectory());
            var          issues       = DependencyChecker.CheckDependencies(installation, new string[] { MyPlugin1, MyPlugin2 });

            Log.RemoveListener(listener);
            Assert.IsTrue(issues == DependencyChecker.Issue.None, errors);
            log.Info("No dependencies - SUCCESS");

            // Dependency on plugin
            issues = DependencyChecker.CheckDependencies(installation, new string[] { MyPlugin1, MyPlugin2, MyPlugin3 });
            Assert.IsTrue(issues == DependencyChecker.Issue.BrokenPackages, "Dependency on plugin");
            log.Info("Dependency on plugin - SUCCESS");
        }
Ejemplo n.º 3
0
        public void TestDependencyChecker()
        {
            var installation          = MockInstallation.GetInstallation();
            var noConflictingVersions = MockInstallation.GetConflictingFiles();

            // GetConflictingFiles has conflicting files, but no conflicting versions, so this should return None.
            var issue = DependencyChecker.CheckDependencies(installation, noConflictingVersions);

            Assert.AreEqual(DependencyChecker.Issue.None, issue);

            // Conflicting has no conflicting files, but conflicting versions, so this should return BrokenPackages.
            var conflictingVersion = MockInstallation.GetConflictingVersion();

            issue = DependencyChecker.CheckDependencies(installation, conflictingVersion);
            Assert.AreEqual(DependencyChecker.Issue.BrokenPackages, issue);
        }