Ejemplo n.º 1
0
        public void Initialize(string registrySettingsPath, IContentEditorLogger logger, IContentTarget contentTarget, ISettingsProvider settingsProvider)
        {
            try
            {
                GlobalEditorOptions.Init(contentTarget, settingsProvider);
                HtmlEditorControl.AllowCachedEditor();

                Assembly assembly = Assembly.GetExecutingAssembly();
                ApplicationEnvironment.Initialize(assembly, Path.GetDirectoryName(assembly.Location), registrySettingsPath, contentTarget.ProductName);
                ContentSourceManager.Initialize(false);

                Trace.Listeners.Clear();
                if (logger != null)
                {
                    _logger = new RedirectionLogger(logger);

                    Trace.Listeners.Add(_logger);
                }

#if DEBUG
                Trace.Listeners.Add(new DefaultTraceListener());
#endif
            }
            catch (Exception e)
            {
                Trace.Fail("Failed to initialize Shared Canvas: " + e);
                Trace.Flush();
                throw;
            }
        }
Ejemplo n.º 2
0
        public void TestBlueSky_InitializeWebBrowserFilePath()
        {
            // pre-conditions
            Assert.IsNull(Environment.WebBrowserFilePath);

            // exercise
            MockEnvironmentProperties.ProgId = "IE.HTTP";
            Environment.Initialize();

            // mid-conditions
            Assert.AreEqual("iexplore.exe", Environment.WebBrowserFilePath);

            // exercise
            MockEnvironmentProperties.ProgId = "FirefoxURL";
            Environment.Initialize();

            // mid-conditions
            Assert.AreEqual("firefox.exe", Environment.WebBrowserFilePath);

            // exercise
            MockEnvironmentProperties.ProgId = "ChromeHTML";
            Environment.Initialize();

            // mid-conditions
            Assert.AreEqual(@"C:\Program Files\Google\Chrome\Application\chrome.exe", Environment.WebBrowserFilePath);

            // exercise
            MockEnvironmentProperties.ProgId = "OperaStable";
            Environment.Initialize();

            // mid-conditions
            Assert.AreEqual("opera.exe", Environment.WebBrowserFilePath);

            // exercise
            MockEnvironmentProperties.ProgId = "SafariHTML";
            Environment.Initialize();

            // mid-conditions
            Assert.AreEqual("safari.exe", Environment.WebBrowserFilePath);

            // exercise
            MockEnvironmentProperties.ProgId = "AppXq0fevzme2pys62n3e0fbqa7peapykr8v";
            Environment.Initialize();

            // post-conditions
            Assert.AreEqual(@"C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe", Environment.WebBrowserFilePath);
        }
Ejemplo n.º 3
0
        public void SetUp()
        {
            ApplicationEnvironment.Initialize();

            tempDir = new DirectoryInfo(Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString()));
            CreateBlogPost(blogId1, "1", "foo");
            CreateBlogPost(blogId1, "2", "bar");
            CreateBlogPost(blogId2, "1", "baz");
            CreateBlogPost(blogId2, "", "boo");
        }
    public static void Menu_DownloadLatestDugite()
    {
        LogHelper.LogAdapter = new UnityLogAdapter();

        var extensionInstallPath = Application.dataPath.ToSPath().Parent;

        var unityEnv = TheEnvironment.instance.Environment;
        var env      = new ApplicationEnvironment(unityEnv);

        env.Initialize(extensionInstallPath, unityEnv);
        var platform = new Platform(env);

        platform.Initialize();

        env.InitializeRepository();

        var installer = new GitInstaller.GitInstallDetails(env.RepositoryPath, env);
        var manifest  = DugiteReleaseManifest.Load(platform.TaskManager, installer.GitManifest, installer.GitManifestFeed, platform.Environment);

        var cts          = new CancellationTokenSource();
        var downloader   = new Downloader(platform.TaskManager, cts.Token);
        var downloadPath = env.RepositoryPath.Combine("downloads");

        foreach (var asset in manifest.Assets)
        {
            downloadPath.Combine(asset.Url.Filename).DeleteIfExists();
            downloader.QueueDownload(asset.Url, downloadPath, retryCount: 3);
        }

        downloader.Progress(p => {
            platform.TaskManager.RunInUI(() => {
                if (EditorUtility.DisplayCancelableProgressBar(p.Message, p.InnerProgress?.InnerProgress?.Message ?? p.InnerProgress?.Message ?? p.Message,
                                                               p.Percentage))
                {
                    cts.Cancel();
                }
            });
        }).FinallyInUI((success, ex) => {
            EditorUtility.ClearProgressBar();
            if (success)
            {
                EditorUtility.DisplayDialog("Download done", downloadPath, "Ok");
            }
            else
            {
                EditorUtility.DisplayDialog("Error!", ex.GetExceptionMessageShort(), "Ok");
            }
        }).Start();
    }
Ejemplo n.º 5
0
        private static void InitializeApplicationEnvironment()
        {
            // initialize application environment
            ApplicationEnvironment.Initialize();
            ApplicationEnvironment.ProductName_Short     = "Writer";
            ApplicationEnvironment.ProductDisplayVersion = String.Format(
                CultureInfo.InvariantCulture,
                Res.Get(StringId.ProductDisplayVersion),
                ApplicationEnvironment.ProductVersion
                );

            if (PlatformHelper.RunningOnWin7OrHigher())
            {
                TaskbarManager.Instance.ApplicationId = ApplicationEnvironment.TaskbarApplicationId;
            }
        }
Ejemplo n.º 6
0
        public static void Main(string[] args)
        {
            try
            {
                // initialize application environment
                ApplicationEnvironment.Initialize();

                //RsdServiceDescription rsdService = RsdServiceDetector.DetectFromRsdUrl("http://localhost/test/foo.rsd", 10000);
                //Trace.WriteLine(rsdService.EditingTemplateLink);

                Application.Run(new TestForm());

                // launch blogging form
                //WeblogConfigurationWizardController.Add(Win32WindowImpl.DesktopWin32Window);
                //WeblogConfigurationWizardController.Edit(Win32WindowImpl.DesktopWin32Window, BlogSettings.DefaultBlogId);
            }
            catch (Exception ex)
            {
                UnexpectedErrorMessage.Show(ex);
            }
        }
 public static void Main(string[] args)
 {
     ApplicationEnvironment.Initialize();
     Application.Run(new TestAutoDetection());
 }
Ejemplo n.º 8
0
        static int Main(string[] args)
        {
            try
            {
                ChangeErrorColors(ConsoleColor.Red);

                BlogRunnerCommandLineOptions options = new BlogRunnerCommandLineOptions();
                options.Parse(args, true);

                try
                {
                    if (options.GetFlagValue(BlogRunnerCommandLineOptions.OPTION_VERBOSE, false))
                    {
                        Debug.Listeners.Add(new ConsoleTraceListener(true));
                    }

                    string        providersPath = Path.GetFullPath((string)options.GetValue(BlogRunnerCommandLineOptions.OPTION_PROVIDERS, null));
                    string        configPath    = Path.GetFullPath((string)options.GetValue(BlogRunnerCommandLineOptions.OPTION_CONFIG, null));
                    string        outputPath    = Path.GetFullPath((string)options.GetValue(BlogRunnerCommandLineOptions.OPTION_OUTPUT, providersPath));
                    List <string> providerIds   = new List <string>(options.UnnamedArgs);
                    string        errorLogPath  = (string)options.GetValue(BlogRunnerCommandLineOptions.OPTION_ERRORLOG, null);
                    if (errorLogPath != null)
                    {
                        errorLogPath = Path.GetFullPath(errorLogPath);
                        Console.SetError(new CompositeTextWriter(
                                             Console.Error,
                                             File.CreateText(errorLogPath)));
                    }

                    ApplicationEnvironment.Initialize(Assembly.GetExecutingAssembly(),
                                                      Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles), @"\Windows Live\Writer\"));
                    ApplicationDiagnostics.VerboseLogging = true;

                    var config    = Config.Load(configPath, providersPath);
                    var providers = new XmlDocument();
                    providers.Load(providersPath);


                    foreach (XmlElement provider in providers.SelectNodes("/providers/provider"))
                    {
                        string providerId = provider.SelectSingleNode("id/text()").Value;
                        string clientType = provider.SelectSingleNode("clientType/text()").Value;

                        if (providerIds.Count > 0 && !providerIds.Contains(providerId))
                        {
                            continue;
                        }

                        Provider p = config.GetProviderById(providerId);
                        if (p == null)
                        {
                            continue;
                        }

                        p.ClientType = clientType;

                        TestResultImpl results = new TestResultImpl();

                        Blog b = p.Blog;
                        if (b != null)
                        {
                            Console.Write(provider.SelectSingleNode("name/text()").Value);
                            Console.Write(" (");
                            Console.Write(b.HomepageUrl);
                            Console.WriteLine(")");

                            List <Test> tests = new List <Test>();
                            AddTests(tests);
                            TestRunner tr = new TestRunner(tests);
                            tr.RunTests(p, b, provider);
                        }
                    }

                    using (XmlTextWriter xw = new XmlTextWriter(outputPath, Encoding.UTF8))
                    {
                        xw.Formatting  = Formatting.Indented;
                        xw.Indentation = 1;
                        xw.IndentChar  = '\t';
                        providers.WriteTo(xw);
                    }
                    return(0);
                }
                catch (Exception e)
                {
                    Console.Error.WriteLine(e.ToString());
                    return(1);
                }
                finally
                {
                    if (options.GetFlagValue(BlogRunnerCommandLineOptions.OPTION_PAUSE, false))
                    {
                        Console.WriteLine();
                        Console.WriteLine();
                        Console.Write("Press any key to continue...");
                        Console.ReadKey(true);
                    }
                }
            }
            catch (Exception e)
            {
                Console.Error.WriteLine(e.ToString());
                return(1);
            }
        }