コード例 #1
0
        private void MoveAndHide()
        {
            var directory = SelectedItemPaths.FirstOrDefault();
            var frm       = new frmMain(directory);

            frm.ShowDialog();
            //MessageBox.Show("Hello from Documents Reclaimer");
        }
コード例 #2
0
        private void DoLogin()
        {
            string      path  = SelectedItemPaths.FirstOrDefault();
            RepoStorage store = P4EXPProgram.getRepoStorage(path);

            lock (store)
            {
                // force the login dialog
                store.ClearReconnect();
                P4EXPProgram.Connect(path, true);
            }
        }
        private uint ParseSteamAppId()
        {
            try
            {
                var fileAddress = SelectedItemPaths.FirstOrDefault();

                if (!string.IsNullOrWhiteSpace(fileAddress) &&
                    File.Exists(fileAddress) &&
                    new FileInfo(fileAddress).Length < 1024)
                {
                    var fileContent = File.ReadAllText(fileAddress);

                    if (!fileContent.Contains(@"[InternetShortcut]"))
                    {
                        return(0);
                    }

                    var steamUrlPattern = @"steam://rungameid/";
                    var urlIndex        = fileContent.IndexOf(steamUrlPattern, StringComparison.InvariantCultureIgnoreCase);

                    if (urlIndex < 0)
                    {
                        return(0);
                    }

                    var nextLine = fileContent.IndexOf(@"\r", urlIndex + steamUrlPattern.Length,
                                                       StringComparison.InvariantCultureIgnoreCase);

                    if (nextLine < 0)
                    {
                        nextLine = fileContent.Length - 1;
                    }

                    var appIdString = fileContent.Substring(urlIndex + steamUrlPattern.Length,
                                                            nextLine - urlIndex - steamUrlPattern.Length);
                    uint appId;

                    if (uint.TryParse(appIdString, out appId))
                    {
                        return(appId);
                    }
                }
            }
            catch
            {
                // ignored
            }

            return(0);
        }
コード例 #4
0
        protected override ContextMenuStrip CreateMenu()
        {
            var menuStrip = new ContextMenuStrip();
            var item      = new ToolStripMenuItem("Copy VSIX ID to Clipboard");

            item.Click += (sender, args) =>
            {
                string path = SelectedItemPaths.FirstOrDefault();
                if (string.IsNullOrEmpty(path))
                {
                    return;
                }

                IInstallableExtension vsix = ExtensionManagerService.CreateInstallableExtension(path);

                Clipboard.SetText(vsix.Header.Identifier);
            };

            menuStrip.Items.Add(item);
            return(menuStrip);
        }
コード例 #5
0
        private void CopyFilesToSubfolder(object sender, EventArgs e)
        {
            //System.Diagnostics.Debugger.Break();
            string firstSelectedFile = SelectedItemPaths.FirstOrDefault();

            if (string.IsNullOrEmpty(firstSelectedFile))
            {
                return;
            }
            string        currentDirPath = (new FileInfo(firstSelectedFile)).DirectoryName;
            string        newDirName     = Path.GetRandomFileName();
            string        newDirPath     = Path.Combine(currentDirPath, newDirName);
            DirectoryInfo newDir         = Directory.CreateDirectory(newDirPath);

            foreach (string filePath in SelectedItemPaths)
            {
                FileInfo fileInfo    = new FileInfo(filePath);
                string   newFilePath = Path.Combine(fileInfo.DirectoryName, newDirName, fileInfo.Name);
                File.Copy(filePath, newFilePath);
            }
            SelectItemInExplorer(IntPtr.Zero, newDirPath, true);
        }
コード例 #6
0
        private ToolStripMenuItem CreateProfileMenu(Profile profile)
        {
            var profileMenu = new ToolStripMenuItem(profile.Name, new ProfileIcon(profile).ToBitmap(16, 16));

            profileMenu.DropDownItems.Add(new ToolStripMenuItem(Language.Run, null,
                                                                (sender, args) =>
                                                                HeliosDisplayManagement.Open(HeliosStartupAction.SwitchProfile, profile,
                                                                                             SelectedItemPaths.FirstOrDefault())));
            profileMenu.DropDownItems.Add(new ToolStripMenuItem(Language.Run_as_administrator, Shield.SmallIcon,
                                                                (sender, args) =>
                                                                HeliosDisplayManagement.Open(HeliosStartupAction.SwitchProfile, profile,
                                                                                             SelectedItemPaths.FirstOrDefault(), true)));
            profileMenu.DropDownItems.Add(new ToolStripSeparator());
            profileMenu.DropDownItems.Add(new ToolStripMenuItem(Language.Create_Shortcut, null,
                                                                (sender, args) =>
                                                                HeliosDisplayManagement.Open(HeliosStartupAction.CreateShortcut, profile,
                                                                                             SelectedItemPaths.FirstOrDefault())));

            return(profileMenu);
        }
コード例 #7
0
        private void DoLogOff()
        {
            string path = SelectedItemPaths.FirstOrDefault();

            P4EXPProgram.LogOff(path);
        }
コード例 #8
0
        private void DoShowInP4V()
        {
            string path = SelectedItemPaths.FirstOrDefault();

            P4EXPProgram.OpenInP4V(buildSelectedList());
        }
コード例 #9
0
        private void DoPendingChanges()
        {
            string path = SelectedItemPaths.FirstOrDefault();

            P4EXPProgram.PendingChangelists(path);
        }
コード例 #10
0
        private void DoHelp()
        {
            string path = SelectedItemPaths.FirstOrDefault();

            P4EXPProgram.Help();
        }
コード例 #11
0
        private void DoPreferences()
        {
            string path = SelectedItemPaths.FirstOrDefault();

            P4EXPProgram.Preferences();
        }
コード例 #12
0
        private void DoStartP4V()
        {
            string path = SelectedItemPaths.FirstOrDefault();

            P4EXPProgram.StartP4V(path);
        }
コード例 #13
0
        /// <summary>
        /// Shows the connetion info dialog.
        /// </summary>
        private void DoConnectionInfo()
        {
            string path = SelectedItemPaths.FirstOrDefault();

            P4EXPProgram.ConnectionInfo(path);
        }