Exemplo n.º 1
0
        public DefaultEnvironment()
        {
            if (IsWindows)
            {
                LocalAppData  = GetSpecialFolder(Environment.SpecialFolder.LocalApplicationData).ToNPath();
                CommonAppData = GetSpecialFolder(Environment.SpecialFolder.CommonApplicationData).ToNPath();
            }
            else if (IsMac)
            {
                LocalAppData = NPath.HomeDirectory.Combine("Library", "Application Support");
                // there is no such thing on the mac that is guaranteed to be user accessible (/usr/local might not be)
                CommonAppData = GetSpecialFolder(Environment.SpecialFolder.ApplicationData).ToNPath();
            }
            else
            {
                LocalAppData  = GetSpecialFolder(Environment.SpecialFolder.LocalApplicationData).ToNPath();
                CommonAppData = GetSpecialFolder(Environment.SpecialFolder.ApplicationData).ToNPath();
            }

            UserCachePath   = LocalAppData.Combine(ApplicationInfo.ApplicationName);
            SystemCachePath = CommonAppData.Combine(ApplicationInfo.ApplicationName);
            if (IsMac)
            {
                LogPath = NPath.HomeDirectory.Combine("Library/Logs").Combine(ApplicationInfo.ApplicationName).Combine(logFile);
            }
            else
            {
                LogPath = UserCachePath.Combine(logFile);
            }
            LogPath.EnsureParentDirectoryExists();
            GitDefaultInstallation = new GitInstaller.GitInstallDetails(UserCachePath, this);
        }
Exemplo n.º 2
0
        public IntegrationTestEnvironment(ICacheContainer cacheContainer,
                                          NPath repoPath,
                                          NPath solutionDirectory,
                                          CreateEnvironmentOptions options = null,
                                          bool enableTrace          = false,
                                          bool initializeRepository = true)
        {
            this.enableTrace = enableTrace;

            options = options ?? new CreateEnvironmentOptions(NPath.SystemTemp.Combine(ApplicationInfo.ApplicationName, "IntegrationTests"));

            defaultEnvironment = new DefaultEnvironment(cacheContainer);
            defaultEnvironment.FileSystem.SetCurrentDirectory(repoPath);

            var environmentPath = options.UserProfilePath;

            LocalAppData    = environmentPath.Combine("User");
            UserCachePath   = LocalAppData.Combine("Cache");
            CommonAppData   = environmentPath.Combine("System");
            SystemCachePath = CommonAppData.Combine("Cache");

            var installPath = solutionDirectory.Parent.Parent.Parent.Combine("src", "com.unity.git.api", "Api");

            Initialize(UnityVersion, installPath, solutionDirectory, NPath.Default, repoPath.Combine("Assets"));

            InitializeRepository(initializeRepository ? (NPath?)repoPath : null);

            GitDefaultInstallation = new GitInstaller.GitInstallDetails(UserCachePath, this);

            if (enableTrace)
            {
                logger.Trace("EnvironmentPath: \"{0}\" SolutionDirectory: \"{1}\" ExtensionInstallPath: \"{2}\"",
                             environmentPath, solutionDirectory, ExtensionInstallPath);
            }
        }
        void Logoff()
        {
            (int rc, string output) = RunAggregatorCommand($"logoff --verbose");
            bool isEmpty = Directory.GetFiles(LocalAppData.GetDirectory(), "*.dat").IsNullOrEmpty();

            Assert.Equal(0, rc);
            Assert.DoesNotContain("] Failed!", output);
            Assert.True(isEmpty);
        }
Exemplo n.º 4
0
        public UnityEnvironment(string applicationName, string logFile = DefaultLogFilename)
        {
            ApplicationName = applicationName;

            LocalAppData    = GetFolder(Folders.LocalApplicationData);
            CommonAppData   = GetFolder(Folders.CommonApplicationData);
            UserCachePath   = LocalAppData.Combine(ApplicationName);
            SystemCachePath = CommonAppData.Combine(ApplicationName);
            LogPath         = GetFolder(Folders.Logs).Combine(ApplicationName, logFile);
        }
        public ApplicationEnvironment(string applicationName = null) : base(applicationName ?? ApplicationInfo.ApplicationName)
        {
            LocalAppData  = GetFolder(Folders.LocalApplicationData);
            CommonAppData = GetFolder(Folders.CommonApplicationData);

            UserCachePath   = LocalAppData.Combine(ApplicationName).EnsureDirectoryExists();
            SystemCachePath = CommonAppData.Combine(ApplicationName).EnsureDirectoryExists();

            LogPath = GetFolder(Folders.Logs).Combine(ApplicationName).EnsureDirectoryExists().Combine(logFile);
            GitDefaultInstallation = new GitInstaller.GitInstallDetails(UserCachePath, this);
        }
        public IntegrationTestEnvironment(SPath testPath, SPath sharedTestPath, string applicationName)
        {
            Guard.ArgumentNotNull(applicationName, nameof(applicationName));

            ApplicationName = applicationName;

            this.sharedTestEnvironmentPath = sharedTestPath.Combine("git-unity-test-environment").EnsureDirectoryExists();
            this.testPath = testPath.Combine("SystemData").EnsureDirectoryExists();

            LocalAppData  = GetFolder(Folders.LocalApplicationData);
            CommonAppData = GetFolder(Folders.CommonApplicationData);

            UserCachePath   = LocalAppData.Combine(applicationName).EnsureDirectoryExists();
            SystemCachePath = CommonAppData.Combine(applicationName).EnsureDirectoryExists();

            LogPath = GetFolder(Folders.Logs).Combine(applicationName).EnsureDirectoryExists().Combine(logFile);
            GitDefaultInstallation = new GitInstaller.GitInstallDetails(sharedTestEnvironmentPath, this);
        }
Exemplo n.º 7
0
        public static List<MyUserControl1> SearchFor(LocalAppData AppData, string SearchTerm)
        {
            string SearchForTerm = SearchTerm.ToUpper();
            List<MyUserControl1> Result = new List<MyUserControl1>();
            foreach (CardObj Card in AppData.AllCardData)
            {
                foreach (string CardTag in Card.TagsList)
                {
                    string CardTagString = CardTag.ToUpper();

                    if (CardTagString.Contains(SearchForTerm))
                    {
                        MyUserControl1 tmp_control = new MyUserControl1(600, 400, Card);
                        tmp_control.HorizontalAlignment = Windows.UI.Xaml.HorizontalAlignment.Left;
                        tmp_control.VerticalAlignment = Windows.UI.Xaml.VerticalAlignment.Top;
                        Result.Add(tmp_control);
                    }
                }
            }

            return Result;
        }
Exemplo n.º 8
0
        public SettingsForm(LocalAppData appData)
        {
            SelectedAppData = appData;

            InitializeComponent();

            SuspendLayout();

            Icon = CacheData.GetSystemIcon(ImageResourceSymbol.SystemControl);

            foreach (TabPage tab in tabCtrl.TabPages)
            {
                tab.BackColor = Settings.Window.Colors.BaseDark;
            }

            locationBtn.BackgroundImage = CacheData.GetSystemImage(ImageResourceSymbol.Directory);
            fileTypes.AutoVerticalScrollBar();
            fileTypes.MaxLength = short.MaxValue;
            fileTypesMenu.EnableAnimation();
            fileTypesMenu.SetFixedSingle();
            associateBtn.Image = CacheData.GetSystemImage(ImageResourceSymbol.Uac);
            try
            {
                restoreFileTypesBtn.Image = new Bitmap(28, 16);
                using (var g = Graphics.FromImage(restoreFileTypesBtn.Image))
                {
                    g.DrawImage(CacheData.GetSystemImage(ImageResourceSymbol.Uac), 0, 0);
                    g.DrawImage(CacheData.GetSystemImage(ImageResourceSymbol.Undo), 12, 0);
                }
            }
            catch (Exception ex) when(ex.IsCaught())
            {
                restoreFileTypesBtn.Image      = CacheData.GetSystemImage(ImageResourceSymbol.Uac);
                restoreFileTypesBtn.ImageAlign = ContentAlignment.MiddleLeft;
                restoreFileTypesBtn.Text       = Resources.LeftArrow;
                if (restoreFileTypesBtn.Image != null)
                {
                    restoreFileTypesBtn.TextAlign = ContentAlignment.MiddleRight;
                }
            }

            previewBg.BackColor = Settings.Window.Colors.BaseDark;
            if (Settings.Window.BackgroundImage != default)
            {
                var width  = (int)Math.Round(Settings.Window.BackgroundImage.Width * .65d) + 1;
                var height = (int)Math.Round(Settings.Window.BackgroundImage.Height * .65d) + 1;
                previewBg.BackgroundImage       = Settings.Window.BackgroundImage.Redraw(width, height);
                previewBg.BackgroundImageLayout = Settings.Window.BackgroundImageLayout;
                previewLogoBox.BackColor        = Color.Transparent;
            }
            previewLogoBox.Image = Resources.Logo128px.Redraw(previewLogoBox.Height, previewLogoBox.Height);
            var exeImage = CacheData.GetSystemImage(ImageResourceSymbol.Application);

            if (exeImage != null)
            {
                previewSmallImgList.Images.Add(exeImage);
                previewSmallImgList.Images.Add(exeImage);
            }
            exeImage = CacheData.GetSystemImage(ImageResourceSymbol.Application, true);
            if (exeImage != null)
            {
                previewLargeImgList.Images.Add(exeImage);
                previewLargeImgList.Images.Add(exeImage);
            }
            previewAppList.StateImageList = Settings.Window.LargeImages ? previewLargeImgList : previewSmallImgList;
            previewAppList.View           = Settings.Window.LargeImages ? View.Tile : View.List;

            foreach (var btn in new[] { saveBtn, exitBtn })
            {
                btn.BackColor = Settings.Window.Colors.Button;
                btn.ForeColor = Settings.Window.Colors.ButtonText;
                btn.FlatAppearance.MouseDownBackColor = Settings.Window.Colors.Button;
                btn.FlatAppearance.MouseOverBackColor = Settings.Window.Colors.ButtonHover;
            }

            var comparer = new AlphaNumericComparer <object>();
            var appNames = CacheData.CurrentAppInfo.Select(x => x.Name).Cast <object>().OrderBy(x => x, comparer).ToArray();

            appsBox.Items.AddRange(appNames);

            appsBox.SelectedItem = SelectedAppData?.Name;
            if (appsBox.SelectedIndex < 0)
            {
                appsBox.SelectedIndex = 0;
            }

            appDirs.AutoVerticalScrollBar();
            addToShellBtn.Image  = CacheData.GetSystemImage(ImageResourceSymbol.Uac);
            rmFromShellBtn.Image = CacheData.GetSystemImage(ImageResourceSymbol.Uac);

            ResumeLayout(false);
        }
Exemplo n.º 9
0
        public SettingsForm(LocalAppData appData)
        {
            SelectedAppData = appData;

            InitializeComponent();

            Icon = CacheData.GetSystemIcon(ResourcesEx.IconIndex.SystemControl);

            foreach (TabPage tab in tabCtrl.TabPages)
            {
                tab.BackColor = Settings.Window.Colors.BaseDark;
            }

            locationBtn.BackgroundImage = CacheData.GetSystemImage(ResourcesEx.IconIndex.Directory);
            fileTypes.AutoVerticalScrollBar();
            fileTypes.MaxLength = short.MaxValue;
            fileTypesMenu.EnableAnimation();
            fileTypesMenu.SetFixedSingle();
            associateBtn.Image = CacheData.GetSystemImage(ResourcesEx.IconIndex.Uac);
            try
            {
                restoreFileTypesBtn.Image = new Bitmap(28, 16);
                using (var g = Graphics.FromImage(restoreFileTypesBtn.Image))
                {
                    g.DrawImage(CacheData.GetSystemImage(ResourcesEx.IconIndex.Uac), 0, 0);
                    g.DrawImage(CacheData.GetSystemImage(ResourcesEx.IconIndex.Undo), 12, 0);
                }
            }
            catch
            {
                restoreFileTypesBtn.Image      = CacheData.GetSystemImage(ResourcesEx.IconIndex.Uac);
                restoreFileTypesBtn.ImageAlign = ContentAlignment.MiddleLeft;
                restoreFileTypesBtn.Text       = @"<=";
                if (restoreFileTypesBtn.Image != null)
                {
                    restoreFileTypesBtn.TextAlign = ContentAlignment.MiddleRight;
                }
            }

            previewBg.BackColor = Settings.Window.Colors.BaseDark;
            if (Settings.Window.BackgroundImage != default(Image))
            {
                var width  = (int)Math.Round(Settings.Window.BackgroundImage.Width * .65d) + 1;
                var height = (int)Math.Round(Settings.Window.BackgroundImage.Height * .65d) + 1;
                previewBg.BackgroundImage       = Settings.Window.BackgroundImage.Redraw(width, height);
                previewBg.BackgroundImageLayout = Settings.Window.BackgroundImageLayout;
                previewLogoBox.BackColor        = Color.Transparent;
            }
            previewLogoBox.Image = Resources.Logo128px.Redraw(previewLogoBox.Height, previewLogoBox.Height);
            var exeImage = CacheData.GetSystemImage(ResourcesEx.IconIndex.ExeFile);

            if (exeImage != null)
            {
                previewSmallImgList.Images.Add(exeImage);
                previewSmallImgList.Images.Add(exeImage);
            }
            exeImage = CacheData.GetSystemImage(ResourcesEx.IconIndex.ExeFile, true);
            if (exeImage != null)
            {
                previewLargeImgList.Images.Add(exeImage);
                previewLargeImgList.Images.Add(exeImage);
            }
            previewAppList.StateImageList = Settings.Window.LargeImages ? previewLargeImgList : previewSmallImgList;
            previewAppList.View           = Settings.Window.LargeImages ? View.Tile : View.List;

            foreach (var btn in new[] { saveBtn, exitBtn })
            {
                btn.BackColor = Settings.Window.Colors.Button;
                btn.ForeColor = Settings.Window.Colors.ButtonText;
                btn.FlatAppearance.MouseDownBackColor = Settings.Window.Colors.Button;
                btn.FlatAppearance.MouseOverBackColor = Settings.Window.Colors.ButtonHover;
            }

            var comparer = new Comparison.AlphanumericComparer();
            var appNames = CacheData.CurrentAppInfo.Select(x => x.Name).Cast <object>().OrderBy(x => x, comparer).ToArray();

            appsBox.Items.AddRange(appNames);

            appsBox.SelectedItem = SelectedAppData?.Name;
            if (appsBox.SelectedIndex < 0)
            {
                appsBox.SelectedIndex = 0;
            }

            appDirs.AutoVerticalScrollBar();
            addToShellBtn.Image  = CacheData.GetSystemImage(ResourcesEx.IconIndex.Uac);
            rmFromShellBtn.Image = CacheData.GetSystemImage(ResourcesEx.IconIndex.Uac);

            tabCtrl.ResumeLayout(false);
            tabPage1.ResumeLayout(false);
            tabPage1.PerformLayout();
            fileTypesTableLayout.ResumeLayout(false);
            fileTypesTableLayout.PerformLayout();
            fileTypesButtonFlowLayout.ResumeLayout(false);
            fileTypesMenu.ResumeLayout(false);
            startArgsTableLayout.ResumeLayout(false);
            startArgsTableLayout.PerformLayout();
            tabPage2.ResumeLayout(false);
            tabPage2.PerformLayout();
            previewMainColor.ResumeLayout(false);
            previewBg.ResumeLayout(false);
            ((ISupportInitialize)previewLogoBox).EndInit();
            previewAppListPanel.ResumeLayout(false);
            ((ISupportInitialize)opacityNum).EndInit();
            ((ISupportInitialize)fadeInNum).EndInit();
            tabPage3.ResumeLayout(false);
            topControlTableLayout.ResumeLayout(false);
            topControlTableLayout.PerformLayout();
            buttonFlowLayout.ResumeLayout(false);
            ((ISupportInitialize)pictureBox1).EndInit();
            panel1.ResumeLayout(false);
            exitBtnPanel.ResumeLayout(false);
            saveBtnPanel.ResumeLayout(false);
            ResumeLayout(false);
        }