Example #1
0
        private void btnFindDuplicates_Click(object sender, EventArgs e)
        {
            for (int i = 0; i < listUrls.Items.Count; ++i)
            {
                int found = findDup(i + 1, listUrls.Items[i].Text);
                if (found >= 0)
                {
                    clearSelection();
                    listUrls.Items[i].Focused     = listUrls.Items[i].Selected = true;
                    listUrls.Items[found].Focused = listUrls.Items[found].Selected = true;

                    listUrls.EnsureVisible(i);

                    CppUtils.CenteredMessageBox(this,
                                                Properties.Resources.DUPITEM_FOUND,
                                                Application.ProductName,
                                                MessageBoxButtons.OK,
                                                MessageBoxIcon.Information);
                    return;
                }
            }

            CppUtils.CenteredMessageBox(this,
                                        Properties.Resources.NO_DUPITEM_FOUND,
                                        Application.ProductName,
                                        MessageBoxButtons.OK,
                                        MessageBoxIcon.Information);
        }
Example #2
0
        private void copyToolStripMenuItem_Click(object sender, EventArgs e)
        {
            StringBuilder sb    = new StringBuilder();
            bool          first = true;

            foreach (ListViewItem item in listUrls.SelectedItems)
            {
                if (!first)
                {
                    sb.AppendLine();
                }
                else
                {
                    first = false;
                }

                sb.Append(item.Text);
            }

            try
            {
                Clipboard.SetText(sb.ToString());
            }
            catch (Exception ex)
            {
                CppUtils.Alert(ex);
            }
        }
Example #3
0
        private void btnOK_Click(object sender, EventArgs e)
        {
            string newName = textName.Text;

            if (string.IsNullOrEmpty(newName))
            {
                CppUtils.CenteredMessageBox(this,
                                            Properties.Resources.ENTER_FILENAME,
                                            Application.ProductName,
                                            MessageBoxButtons.OK,
                                            MessageBoxIcon.Asterisk);

                return;
            }

            if (-1 != newName.IndexOfAny(Program.damemoji.ToCharArray()))
            {
                CppUtils.CenteredMessageBox(this,
                                            Properties.Resources.FOLLOWING_UNABLE_FILENAME + Environment.NewLine + Environment.NewLine + Program.damemoji,
                                            Application.ProductName,
                                            MessageBoxButtons.OK,
                                            MessageBoxIcon.Asterisk);

                return;
            }

            this.DialogResult = DialogResult.OK;
            Close();
        }
Example #4
0
        private void btnAbout_Click(object sender, EventArgs e)
        {
            StringBuilder sbMessage = new StringBuilder();

            sbMessage.AppendLine(string.Format("{0} v{1}",
                                               Application.ProductName,
                                               AmbLib.getAssemblyVersion(Assembly.GetExecutingAssembly(), 3)));
            sbMessage.AppendLine();

            sbMessage.AppendLine(AmbLib.getAssemblyCopyright(Assembly.GetExecutingAssembly()));
            sbMessage.AppendLine();

            sbMessage.AppendLine(Program.Url);
            sbMessage.AppendLine(Properties.Resources.PRESS_CTRL_OK);

            CppUtils.CenteredMessageBox(this,
                                        sbMessage.ToString(),
                                        Application.ProductName,
                                        MessageBoxButtons.OK,
                                        MessageBoxIcon.Information);

            if (CppUtils.IsCtrlPressed())
            {
                try
                {
                    Process.Start(Program.Url);
                }
                catch (Exception ex)
                {
                    CppUtils.Alert(ex);
                }
            }
        }
Example #5
0
        private void btnStart_Click(object sender, EventArgs e)
        {
            IsResultOpenURL = radioOpenUrl.Checked;
            if (IsResultOpenURL)
            {
                return;
            }


            ResultURLs = txtEnterURLs.Lines;
            foreach (string u in ResultURLs)
            {
                if (u.IndexOf('[') >= 0 && u.IndexOf(']') >= 0)
                {
                    if (DialogResult.Yes != CppUtils.CenteredMessageBox(this,
                                                                        Properties.Resources.URL_INCLUDES_BLANCKET_CONTINUE,
                                                                        Application.ProductName,
                                                                        MessageBoxButtons.YesNo,
                                                                        MessageBoxIcon.Question,
                                                                        MessageBoxDefaultButton.Button2))
                    {
                        DialogResult = DialogResult.None;
                        return;
                    }
                }
            }
        }
Example #6
0
        private void btnOK_Click(object sender, EventArgs e)
        {
            string newName = txtName.Text;

            if (string.IsNullOrEmpty(newName))
            {
                CppUtils.CenteredMessageBox(this,
                                            Properties.Resources.ENTER_FILENAME,
                                            Application.ProductName,
                                            MessageBoxButtons.OK,
                                            MessageBoxIcon.Warning);

                return;
            }

            if (-1 != newName.IndexOfAny(Program.damemoji.ToCharArray()))
            {
                showDamemojiError();
                return;
            }

            List <Control> backToEnables = disableAll();

            if (!Program.RenameIt(this, txtName.Tag.ToString(), newName))
            {
                enableAll(backToEnables);
                return;
            }
            enableAll(backToEnables);
            this.DialogResult = DialogResult.OK;
            Close();
        }
Example #7
0
        private void itemExistingFolder_Click(object sender, EventArgs e)
        {
            ToolStripMenuItem item = sender as ToolStripMenuItem;

            if (item == null)
            {
                return;
            }
            string dir = item.Tag as string;

            if (dir == null)
            {
                // LANG
                CppUtils.Fatal(dir + " is not a directory");
                return;
            }
            else if (!System.IO.Directory.Exists(dir))
            {
                if (DialogResult.Yes != CppUtils.YesOrNo(string.Format(Properties.Resources.DIR_NOT_EXIST_DO_YOU_WANT_TO_REMOVE, dir),
                                                         MessageBoxDefaultButton.Button2))
                {
                    return;
                }
                removeFromDiskDirs(dir);
                return;
            }
            moveToAndClose(dir);
        }
Example #8
0
 static void ShowHelp()
 {
     CppUtils.CenteredMessageBox(GetHelpMessage(),
                                 Application.ProductName,
                                 MessageBoxButtons.OK,
                                 MessageBoxIcon.Information);
 }
Example #9
0
        private void FormMain_FormClosed(object sender, FormClosedEventArgs e)
        {
            bool success = true;

            HashIni ini = Profile.ReadAll(IniPath);

            success &= Profile.WriteBool(SECTION_OPTION, KEY_CHECK_SINGLECLICK, chkShowSingleClick.Checked, ini);
            success &= Profile.WriteBool(SECTION_OPTION, KEY_CHECK_DOUBLECLICK, chkShowDoubleClick.Checked, ini);
            success &= Profile.WriteBool(SECTION_OPTION, KEY_CHECK_UP, chkShowUp.Checked, ini);
            success &= Profile.WriteBool(SECTION_OPTION, KEY_CHECK_DOWN, chkShowDown.Checked, ini);
            success &= Profile.WriteBool(SECTION_OPTION, KEY_CHECK_WHEEL, chkShowWheel.Checked, ini);
            success &= Profile.WriteBool(SECTION_OPTION, KEY_CHECK_MOVE, chkShowMove.Checked, ini);

            success &= AmbLib.SaveFormXYWH(this, SECTION_LOCATION, ini);

            success &= Profile.WriteInt(SECTION_OPTION, KEY_SPLITTER_DISTANCE, splitMain.SplitterDistance, ini);

            if (success)
            {
                try
                {
                    success &= Profile.WriteAll(ini, IniPath, true);
                }
                catch (Exception)
                {
                    success = false;
                }
            }

            if (!success)
            {
                CppUtils.Alert(Properties.Resources.SAVE_FAILED);
            }
        }
Example #10
0
 void FatalExit(string message, bool bExit)
 {
     CppUtils.Alert(message);
     if (bExit)
     {
         Environment.Exit(1);
     }
 }
Example #11
0
 void Info(string message)
 {
     CppUtils.CenteredMessageBox(this,
                                 message,
                                 ProductName,
                                 MessageBoxButtons.OK,
                                 MessageBoxIcon.Information);
 }
Example #12
0
 void showDamemojiError()
 {
     CppUtils.CenteredMessageBox(this,
                                 Properties.Resources.FOLLOWING_UNABLE_FILENAME + Environment.NewLine + Program.damemoji,
                                 Application.ProductName,
                                 MessageBoxButtons.OK,
                                 MessageBoxIcon.Warning);
 }
Example #13
0
 void Alert(string message)
 {
     CppUtils.CenteredMessageBox(this,
                                 message,
                                 ProductName,
                                 MessageBoxButtons.OK,
                                 MessageBoxIcon.Warning);
 }
Example #14
0
 DialogResult YesOrNo(string message)
 {
     return(CppUtils.CenteredMessageBox(this,
                                        message,
                                        ProductName,
                                        MessageBoxButtons.YesNo,
                                        MessageBoxIcon.Question));
 }
Example #15
0
 private void itemClearFolder_Click(object sender, EventArgs e)
 {
     if (DialogResult.Yes != CppUtils.YesOrNo(Properties.Resources.ARE_YOU_SURE_CLEAR_ALL_ITEMS,
                                              MessageBoxDefaultButton.Button2))
     {
         return;
     }
     DiskDirs = new string[0];
 }
Example #16
0
 static void ShowHelp()
 {
     CppUtils.CenteredMessageBox(GetHelpMessage(),
                                 string.Format("{0} ver{1}",
                                               Application.ProductName,
                                               AmbLib.getAssemblyVersion(Assembly.GetExecutingAssembly(), 3)),
                                 MessageBoxButtons.OK,
                                 MessageBoxIcon.Information);
 }
Example #17
0
        static bool preRun()
        {
            if (!FolderConfigHelper.IsFolderAccessible(ConfigDir))
            {
                CppUtils.Alert(string.Format(Properties.Resources.ALERT_DIRECTORY_UNAVAILABLE, ConfigDir));
                return(false);
            }

            return(true);
        }
Example #18
0
        private void tsmiRemoveAll_Click(object sender, EventArgs e)
        {
            if (DialogResult.Yes != CppUtils.YesOrNo(string.Format("sure all items?"),
                                                     MessageBoxDefaultButton.Button2))
            {
                return;
            }

            listMain.Items.Clear();
        }
Example #19
0
 static GfxDevice()
 {
     if (NativeSignatureResolver.IsUnityVersionOverOrEqual(MelonUtils.GetUnityVersion(), new[] { "2020.2.7", "2020.3.0", "2021.1.0" }))
     {
         // `FrameTimingManager_CUSTOM_CaptureFrameTimings()` calls `GetRealGfxDevice()` after 4 bytes.
         m_GetRealGfxDevice = (GetRealGfxDeviceDelegate)Marshal.GetDelegateForFunctionPointer(
             CppUtils.ResolveRelativeInstruction(
                 (IntPtr)((long)UnityInternals.ResolveICall("UnityEngine.FrameTimingManager::CaptureFrameTimings") + (MelonUtils.IsGame32Bit() ? 0 : 4))),
             typeof(GetRealGfxDeviceDelegate));
     }
 }
Example #20
0
 private void btnCopyPath_Click(object sender, EventArgs e)
 {
     try
     {
         Clipboard.SetText(this.txtName.Tag.ToString());
     }
     catch (Exception ex)
     {
         CppUtils.Fatal(ex.Message);
     }
 }
Example #21
0
 private void btnCopy_Click(object sender, EventArgs e)
 {
     try
     {
         Clipboard.SetText(txtName.Text);
     }
     catch (Exception ex)
     {
         CppUtils.Fatal(ex.Message);
     }
 }
Example #22
0
 private void goToWebPageToolStripMenuItem_Click(object sender, EventArgs e)
 {
     try
     {
         Process.Start("https://github.com/erasoni/SendToTools");
     }
     catch (Exception ex)
     {
         CppUtils.Fatal(ex);
     }
 }
Example #23
0
 private void openToolStripMenuItem_Click(object sender, EventArgs e)
 {
     try
     {
         Process.Start(listUrls.SelectedItems[0].Text);
     }
     catch (Exception ex)
     {
         CppUtils.CenteredMessageBox(this, ex.Message, Application.ProductName);
     }
 }
Example #24
0
        // private readonly List<string> generalExt_ = new List<string>( "bin","txt","xml");

        private void btnChangeExt_Click(object sender, EventArgs e)
        {
            try
            {
                {
                    string   src     = InputFile;
                    FileInfo srcinfo = new FileInfo(src);
                    int      extlen  = srcinfo.Extension.Length;

                    // What is this?
                    //if (extlen >= 5)
                    //    extlen = 0;

                    string srcwithoutext = srcinfo.FullName.Substring(0, srcinfo.FullName.Length - extlen);
                    string ext           = txtExt.Text;
                    ext = ext.Split(' ')[0];

                    string dstname = srcwithoutext + '.' + ext;

                    if (!option.IsSkipWarning)
                    {
                        string message = string.Format(Properties.Resources.Q_RENAME_EXTENSION,
                                                       string.IsNullOrEmpty(Path.GetExtension(src)) ? Properties.Resources.NO_EXTENSION : Path.GetExtension(src),
                                                       Path.GetExtension(dstname));
                        if (DialogResult.Yes != CppUtils.CenteredMessageBox(
                                this,
                                message,
                                Application.ProductName,
                                MessageBoxButtons.YesNo,
                                MessageBoxIcon.Question,
                                MessageBoxDefaultButton.Button2))
                        {
                            return;
                        }
                    }

                    srcinfo.MoveTo(dstname);
                    InputFile = dstname;
                    analyzefile(dstname);
                    if (option.IsCloseAfterRenaming)
                    {
                        Close();
                        return;
                    }
                }
            }
            catch (Exception ex)
            {
                CppUtils.CenteredMessageBox(ex.Message, Application.ProductName,
                                            MessageBoxButtons.OK,
                                            MessageBoxIcon.Stop);
            }
        }
Example #25
0
 private void btnOK_Click(object sender, EventArgs e)
 {
     try
     {
         Serialize(true);
     }
     catch (Exception ex)
     {
         CppUtils.Alert(ex);
         DialogResult = DialogResult.None;
     }
 }
Example #26
0
 private static IntPtr[] GetPointers(IntPtr unityplayer, int unityplayer_size, string[] possible_signatures)
 {
     foreach (string signature in possible_signatures)
     {
         IntPtr[] ptrs = CppUtils.SigscanAll(unityplayer, unityplayer_size, signature);
         if (ptrs.Length > 0)
         {
             return(ptrs);
         }
     }
     return(null);
 }
Example #27
0
        static void ShowAlert(string message)
        {
            StringBuilder sbMessage = new StringBuilder();

            sbMessage.AppendLine(message);
            sbMessage.AppendLine();
            sbMessage.AppendLine(GetHelpMessage());
            CppUtils.CenteredMessageBox(sbMessage.ToString(),
                                        Application.ProductName,
                                        MessageBoxButtons.OK,
                                        MessageBoxIcon.Warning);
        }
Example #28
0
 private void tssbInsertURLs_ButtonClick(object sender, EventArgs e)
 {
     try
     {
         string all = Clipboard.GetText();
         txtTmp.Text = all;
         foreach (string line in txtTmp.Lines)
         {
             listUrls.Items.Add(line);
         }
     }
     catch (Exception ex) { CppUtils.CenteredMessageBox(this, ex.Message, Application.ProductName); }
 }
Example #29
0
        private void FormMain_FormClosed(object sender, FormClosedEventArgs e)
        {
            HashIni ini = Profile.ReadAll(IniPath);

            AmbLib.SaveFormXYWH(this, SECTION_LOCATION, ini);
            AmbLib.SaveListViewColumnWidth(listMain, SECTION_OPTION, KEY_COLUMN_WIDTH, ini);
            AmbLib.SaveComboBox(cmbApplication, SECTION_APP_COMBO, MAX_COMBO_SAVE, ini);
            AmbLib.SaveComboBox(cmbArguments, SECTION_ARG_COMBO, MAX_COMBO_SAVE, ini);
            if (!Profile.WriteAll(ini, IniPath))
            {
                CppUtils.Alert("Failed to save ini");
            }
        }
Example #30
0
        private void btnClear_Click(object sender, EventArgs e)
        {
            if (Running)
            {
                return;
            }
            if (DialogResult.Yes != CppUtils.YesOrNo("Clear?", MessageBoxDefaultButton.Button2))
            {
                return;
            }

            ClearAllListIndicator();
        }