public void GetLogGroupsTest()
        {
            var files = new[]
            {
                "C:\\Crawling.log.20140905.135957.txt",
                "D:\\Crawling.log.20140905.txt",
                "log.20140905.135957.txt",
                "E:\\assaasd\\log.20140905.txt",
                "readme.12324.txt",
                "Search.log.20140905.135957.txt",
                "Search.log.20140905.txt",
                "WebDAV.log.20140905.135957.txt",
                "WebDAV.log.20140905.txt"
            };
            var results  = InstanceHelperEx.GetLogGroups(files).OrderBy(x => x).Select(x => x.ToLower()).ToArray();
            var expected = new[]
            {
                "crawling.log", "log", "search.log", "webdav.log"
            }.OrderBy(x => x).ToArray();

            Assert.AreEqual(results.Count(), expected.Count());
            for (int i = 0; i < expected.Count(); ++i)
            {
                Assert.AreEqual(expected[i], results[i]);
            }
        }
Beispiel #2
0
        public void OnClick(Window mainWindow, Instance instance)
        {
            Assert.ArgumentNotNull(mainWindow, nameof(mainWindow));
            Assert.IsNotNull(instance, nameof(instance));

            InstanceHelperEx.OpenInBrowserAsAdmin(instance, mainWindow, VirtualPath, Browser, _Params);
        }
        public void OnClick(Window mainWindow, Instance instance)
        {
            Assert.ArgumentNotNull(mainWindow, "mainWindow");

            Assert.IsNotNull(instance, "instance");

            InstanceHelperEx.OpenInBrowserAsAdmin(instance, mainWindow, this.VirtualPath, this.Browser, this.Params);
        }
Beispiel #4
0
        public void OnClick(Window mainWindow, Instance instance)
        {
            Assert.ArgumentNotNull(mainWindow, nameof(mainWindow));
            Assert.IsNotNull(instance, nameof(instance));

            Analytics.TrackEvent("LogInAdmin");

            InstanceHelperEx.OpenInBrowserAsAdmin(instance, mainWindow, this.VirtualPath, this.Browser, this.Params);
        }
        public static void OpenToolbox(InstallModulesWizardArgs args)
        {
            if (!InstanceHelperEx.PreheatInstance(args.Instance, args.WizardWindow))
            {
                return;
            }

            InstanceHelperEx.BrowseInstance(args.Instance, args.WizardWindow, "/sitecore/admin", true);
        }
Beispiel #6
0
        public void OnClick(Window mainWindow, Instance instance)
        {
            Assert.ArgumentNotNull(mainWindow, "mainWindow");

            if (instance != null)
            {
                InstanceHelperEx.OpenCurrentLogFile(instance, mainWindow, this.logFileType);
            }
        }
Beispiel #7
0
        public static void FinishAction([NotNull] InstallModulesWizardArgs args)
        {
            Assert.ArgumentNotNull(args, nameof(args));

            var instance = args.Instance;

            Assert.IsNotNull(instance, nameof(instance));

            InstanceHelperEx.OpenInBrowserAsAdmin(instance, MainWindow.Instance);
        }
Beispiel #8
0
        public static void LoginAdmin([NotNull] ReinstallWizardArgs args)
        {
            Assert.ArgumentNotNull(args, nameof(args));

            var instance = args.Instance;

            Assert.IsNotNull(instance, nameof(instance));

            InstanceHelperEx.OpenInBrowserAsAdmin(instance, MainWindow.Instance);
        }
    public void OnClick(Window mainWindow, Instance instance)
    {
      Assert.ArgumentNotNull(mainWindow, nameof(mainWindow));

      Analytics.TrackEvent("OpenLog");

      if (instance != null)
      {
        InstanceHelperEx.OpenCurrentLogFile(instance, mainWindow, this.logFileType);
      }
    }
Beispiel #10
0
        public void OnClick(Window mainWindow, Instance instance)
        {
            if (instance != null)
            {
                if (!InstanceHelperEx.PreheatInstance(instance, mainWindow))
                {
                    return;
                }

                InstanceHelperEx.BrowseInstance(instance, mainWindow, this.VirtualPath, true, this.Browser, this.Params);
            }
        }
Beispiel #11
0
        protected virtual void OnContextMenuInstanceEntryClick(object sender, InstanceEntryClickArgs e)
        {
            MouseClickInformation clickInfo = e.ClickInformation;

            if (clickInfo.OnlyLeftMouseButtonPressed)
            {
                bool     useBackendBrowser = TrayPluginSettingsManager.OpenPagesInBackendBrowser;
                string   suffix            = TrayPluginSettingsManager.PageToRunOnClick;
                Instance instance          = e.Instance;
                InstanceHelperEx.BrowseInstance(instance, MainWindow.Instance, suffix, !useBackendBrowser);
            }
        }
        public void OnClick(Window mainWindow, Instance instance)
        {
            Analytics.TrackEvent("Browse");

            if (instance != null)
            {
                if (!InstanceHelperEx.PreheatInstance(instance, mainWindow))
                {
                    return;
                }

                InstanceHelperEx.BrowseInstance(instance, mainWindow, VirtualPath, true, Browser, _Params);
            }
        }
        public void OnClick(Window mainWindow, Instance instance)
        {
            if (!EnvironmentHelper.CheckSqlServer())
            {
                return;
            }

            if (instance == null)
            {
                return;
            }

            var path = Path.Combine(instance.WebRootPath, @"sitecore\admin\toolbox");

            if (!FileSystem.FileSystem.Local.Directory.Exists(path))
            {
                var product = Product.GetFilePackageProduct(Path.Combine(ApplicationManager.DefaultPackages, PackageName)) ?? Product.GetFilePackageProduct(Path.Combine(ApplicationManager.FilePackagesFolder, PackageName));
                if (product == null)
                {
                    WindowHelper.HandleError("The " + PackageName + " package cannot be found in either the .\\File Packages folder or %appdata%\\Sitecore\\Sitecore Instance Manager\\Custom Packages one", false, null, this);
                    return;
                }

                var products = new[] { product };
                var args     = new InstallModulesArgs(instance, products);
                PipelineManager.StartPipeline("installmodules", args, isAsync: false);
            }

            if (!FileSystem.FileSystem.Local.Directory.Exists(path))
            {
                return;
            }

            if (this.bypassSecurity)
            {
                InstanceHelperEx.OpenInBrowserAsAdmin(instance, mainWindow, @"/sitecore/admin");
            }
            else
            {
                InstanceHelperEx.BrowseInstance(instance, mainWindow, @"/sitecore/admin", false);
            }
        }
 public static void OpenSitecoreClient(InstallModulesWizardArgs args)
 {
     InstanceHelperEx.BrowseInstance(args.Instance, args.WizardWindow, "/sitecore", false);
 }
 public static void OpenBrowser(InstallModulesWizardArgs args)
 {
     InstanceHelperEx.BrowseInstance(args.Instance, args.WizardWindow, string.Empty, true);
 }
Beispiel #16
0
        public static int Main(string[] args)
        {
            if (args.Length == 1)
            {
                if (args[0] == "--install")
                {
                    return((int)ShellExtension.Install(true));
                }
                if (args[0] == "--uninstall")
                {
                    return((int)ShellExtension.Uninstall(true));
                }
            }

            int i;

            var files = new List <string>(args.Length);

            if (args.Length == 1 && args[0] == "--pipe")
            {
                var reader = new StreamReader(Console.OpenStandardInput(), Encoding.UTF8);

                string path;
                while (true)
                {
                    path = reader.ReadLine();
                    if (string.IsNullOrEmpty(path))
                    {
                        break;
                    }

                    if (Check(path))
                    {
                        files.Add(path);
                    }
                }
            }
            else
            {
                for (i = 0; i < args.Length; ++i)
                {
                    if (Check(args[i]))
                    {
                        files.Add(args[i]);
                    }
                }
            }

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            using (Instance = new InstanceHelperEx(KISBO_MUTEX_NAME))
            {
                if (Instance.IsInstance)
                {
                    var frm = new SearchWindow();
                    Instance.DataReceived += frm.AddFile;
                    Instance.Ready();

                    frm.AddFile(files);

                    Application.Run(frm);
                }
                else
                {
                    if (files.Count > 0)
                    {
                        byte[] data;
                        var    sb = new StringBuilder(4096);
                        for (i = 0; i < args.Length; ++i)
                        {
                            if (i > 0)
                            {
                                sb.Append('\n');
                            }
                            sb.Append(args[i]);
                        }

                        data = Encoding.UTF8.GetBytes(sb.ToString());

                        Instance.Send(data);
                    }
                    else
                    {
                        Instance.Send(new byte[1] {
                            0
                        });
                    }
                }
            }

            return(0);
        }