Ejemplo n.º 1
0
        private void PopulateStartMenu()
        {
            var toAdd        = new List <ToolStripItem>();
            var pluginPath   = InstallDirectoryHelper.GetPluginPath();
            var allExes      = InstallDirectoryHelper.KoikatuDirectory.GetFiles("*.exe", SearchOption.AllDirectories);
            var filteredExes = allExes.Where(x => !x.Name.Equals("bepinex.patcher.exe", StringComparison.OrdinalIgnoreCase) && !x.FullName.StartsWith(pluginPath, StringComparison.OrdinalIgnoreCase));

            foreach (var file in filteredExes.OrderBy(x => x.Name))
            {
                var item = new ToolStripMenuItem(file.Name);
                item.AutoToolTip = false;
                item.ToolTipText = file.FullName;
                item.Click      += (o, args) => { ProcessTools.SafeStartProcess(file.FullName); };
                toAdd.Add(item);
            }
            this.SafeInvoke(() => startTheGameToolStripMenuItem.DropDownItems.AddRange(toAdd.ToArray()));
        }
Ejemplo n.º 2
0
        private void PopulateStartMenu()
        {
            var toAdd        = new List <ToolStripItem>();
            var pluginPath   = InstallDirectoryHelper.PluginPath.FullName;
            var allExes      = InstallDirectoryHelper.GameDirectory.GetFiles("*.exe", SearchOption.AllDirectories);
            var exeBlacklist = new[] { "UnityCrashHandler64.exe", "bepinex.patcher.exe", "Unity3DCompressor.exe", "KKManager.exe", "StandaloneUpdater.exe" };
            var filteredExes = allExes.Where(x => !exeBlacklist.Contains(x.Name, StringComparer.OrdinalIgnoreCase) && !x.FullName.StartsWith(pluginPath, StringComparison.OrdinalIgnoreCase));

            var first = true;

            foreach (var folder in filteredExes.GroupBy(x => x.DirectoryName, StringComparer.OrdinalIgnoreCase).OrderBy(x => x.Key, StringComparer.OrdinalIgnoreCase))
            {
                if (!first)
                {
                    toAdd.Add(new ToolStripSeparator());
                }
                first = false;

                foreach (var file in folder.OrderBy(x => x.Name, StringComparer.OrdinalIgnoreCase))
                {
                    // Trim .exe but leave other extensions
                    var trimmedName = file.Name.EndsWith(".exe", StringComparison.OrdinalIgnoreCase) ? file.Name.Substring(0, file.Name.Length - 4) : file.Name;
                    var item        = new ToolStripMenuItem(trimmedName);

                    item.AutoToolTip = false;
                    item.ToolTipText = file.FullName;

                    item.Click += (o, args) => { ProcessTools.SafeStartProcess(file.FullName); };

                    try { item.Image = Icon.ExtractAssociatedIcon(file.FullName)?.ToBitmap(); }
                    catch { item.Image = null; }

                    toAdd.Add(item);
                }
            }

            this.SafeInvoke(() =>
            {
                foreach (var item in toAdd)
                {
                    startTheGameToolStripMenuItem.DropDownItems.Add(item);
                }
            });
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Returns null if no updates were found, else returns if user clicked yes
        /// </summary>
        public static async Task <bool?> CheckForUpdatesAndShowDialog()
        {
            var isUpdateAvailable = await IsUpdateAvailable();

            if (isUpdateAvailable != true)
            {
                return(null);
            }

            if (MessageBox.Show("A new version of KKManager is available. Do you want to go to the download page?", "New version is available",
                                MessageBoxButtons.YesNo, MessageBoxIcon.Information, MessageBoxDefaultButton.Button2) == DialogResult.Yes)
            {
                return(ProcessTools.SafeStartProcess(_latestReleaseUrl) != null);
            }
            else
            {
                return(false);
            }
        }
Ejemplo n.º 4
0
 private void kKManagerToolStripMenuItem_Click(object sender, EventArgs e)
 {
     ProcessTools.SafeStartProcess(Program.ProgramLocation);
 }
Ejemplo n.º 5
0
 private void scenesToolStripMenuItem_Click(object sender, EventArgs e)
 {
     ProcessTools.SafeStartProcess(Path.Combine(InstallDirectoryHelper.KoikatuDirectory.FullName, "UserData\\Studio\\scene"));
 }
Ejemplo n.º 6
0
 private void installDirectoryToolStripMenuItem_Click(object sender, EventArgs e)
 {
     ProcessTools.SafeStartProcess(InstallDirectoryHelper.KoikatuDirectory.FullName);
 }
Ejemplo n.º 7
0
 private void charactersToolStripMenuItem_Click(object sender, EventArgs e)
 {
     ProcessTools.SafeStartProcess(Path.Combine(InstallDirectoryHelper.GameDirectory.FullName, "UserData\\chara"));
 }