示例#1
0
 private void ICOurl_TextChanged(object sender, EventArgs e)
 {
     if (urltext != null && !string.IsNullOrWhiteSpace(ICOurl.Text))
     {
         try
         {
             using (Stream stream = new WebClient().OpenRead(ICOurl.Text))
                 using (Bitmap bitmap = new Bitmap(stream))
                 {
                     if (bitmap != null)
                     {
                         bitmap.Save(temppath + @"tempORIGINAL.png");
                         ImagingHelper.ConvertToIcon(temppath + @"tempORIGINAL.png", temppath + @"temp.ico");
                         ICOpic.Image = ImagingHelper.ICONbox;
                         ICOpic.Image.Save(temppath + @"temp.png");
                     }
                 }
         }
         catch
         {
             MessageForm.Error("URL provided isn't an image...");
         }
         Shortcutbox.Focus();
     }
 }
示例#2
0
        private void HistoryBtn_Click(object sender, EventArgs e)
        {
            createshortbtn.Enabled = false;
            using (var History = new HistoryForm())
            {
                History.ShowDialog();

                if (History.ShortCuteIndex != -1)
                {
                    var ShortCute = XmlDocSC.ShortCutes[History.ShortCuteIndex];
                    SelectedShortCuteHis = History.ShortCuteIndex;
                    History.Dispose();

                    Shortcutbox.Text = ShortCute.Name;
                    TempString       = ShortCute.Image;
                    ICOpic_MouseClick(null, null);
                    TempString = ShortCute.EmuPath;
                    EmuBrow_Click(null, null);
                    TempString = ShortCute.GamePath;
                    GameBrow_Click(null, null);
                }

                createshortbtn.Enabled = true;
            }

            Shortcutbox.Focus();
            Shortcutbox.SelectionStart = Shortcutbox.Text.Length;
        }
示例#3
0
        private async void ICOpic_MouseClick(object sender, MouseEventArgs e)
        {
            if (TempString == null)
            {
                if (clicked)
                {
                    return;
                }
                clicked = true;
                await Task.Delay(SystemInformation.DoubleClickTime);

                if (!clicked)
                {
                    return;
                }
                clicked = false;
            }

            //Process click
            var file = TempString != null ? TempString : FileDialog(Path.Combine(Environment.GetEnvironmentVariable("USERPROFILE"), "Downloads"), "PNG/JPG Image (*.png; *.jpg; *.jpeg *.tiff *.bmp)|*.png;*.jpg;*.jpeg;*.tiff;*.bmp");

            TempString = null;

            if (file != null && File.Exists(file))
            {
                File.Copy(file, temppath + "tempORIGINAL.png", true);
                ImagingHelper.ConvertToIcon(temppath + "tempORIGINAL.png", temppath + @"temp.ico");
                ICOpic.Image = ImagingHelper.ICONbox;
                ICOpic.Image.Save(temppath + @"temp.png");
            }

            Shortcutbox.Focus();
        }
示例#4
0
        private void GameBrow_Click(object sender, EventArgs e)
        {
            string GamesPath = "C:\\";

            if (Emulatorcb_HasSelectedItem)
            {
                if (SelectedEmu.TryGetGamesPath() != "" && SelectedEmu.GamesPath != null)
                {
                    GamesPath = SelectedEmu.GamesPath;
                }
                else if (!string.IsNullOrWhiteSpace(Gdirbox.Text) && Directory.Exists(Path.GetDirectoryName(Gdirbox.Text)))
                {
                    GamesPath = Path.GetDirectoryName(Gdirbox.Text);
                }
                else if (Edirbox.Text != "")
                {
                    GamesPath = Edirbox.Text;
                }

                var file = TempString != null ? TempString : FileDialog(GamesPath, SelectedEmu.Gamesfilters);
                TempString = null;

                if (file != null && File.Exists(file))
                {
                    Gdirbox.Text = file;
                }
            }
            else
            {
                MessageForm.Info("Emulator must be selected!");
            }

            Shortcutbox.Focus();
        }
示例#5
0
        private void Emulatorcb_SelectedIndexChanged(object sender, EventArgs e)
        {
            string tempedir = Edirbox.Text;

            Edirbox.Text     = null;
            label6.Text      = SelectedEmu.Description;
            label6.ForeColor = SelectedEmu.Cdesc;
            Edirbox.Text     = SelectedEmu.Path();
            if (tempedir != Edirbox.Text)
            {
                Gdirbox.Text = null;
            }

            if (!string.IsNullOrWhiteSpace(Edirbox.Text) && Directory.Exists(Edirbox.Text) && !Directory.Exists(Edirbox.Text + @"ShortCutes"))
            {
                Directory.CreateDirectory(Edirbox.Text + @"ShortCutes");
                MessageForm.Info("To avoid Anti-Virus problems with ShortCutes please exclude this path folder:\n\n" +
                                 Edirbox.Text + "ShortCutes\n\nDouble click on this text to copy path folder to clipboard", Edirbox.Text + "ShortCutes");
            }

            if (Directory.Exists(Edirbox.Text + "ShortCutes"))
            {
                OpenFolder.Show();
            }
            else
            {
                OpenFolder.Hide();
            }

            Shortcutbox.Focus();
        }
示例#6
0
        private void ClearSCSelected_Click(object sender, EventArgs e)
        {
            SelectedShortCuteHis = -1;
            Shortcutbox.Text     = null;
            Gdirbox.Text         = null;
            ICOpic.Image         = null;

            Shortcutbox.Focus();
        }
示例#7
0
        private void CreateShortCute_Click(object sender, EventArgs e)
        {
            string code;

            if (!Edirbox.Text.EndsWith(@"\") && !string.IsNullOrWhiteSpace(Edirbox.Text))
            {
                Edirbox.Text += @"\";
            }

            if (!Emulatorcb_HasSelectedItem)
            {
                MessageForm.Error("Emulator must be selected!");
            }
            else if (string.IsNullOrWhiteSpace(Shortcutbox.Text))
            {
                MessageForm.Error("Shortcut name cannot be empty");
            }
            else if (!File.Exists(Edirbox.Text + SelectedEmu.Exe))
            {
                MessageForm.Error("Emulator doesn't exist in the specified path\nCheck if the path or the selected emulator is correct");
            }
            else if (!File.Exists(Gdirbox.Text))
            {
                MessageForm.Error("Game file doesn't exist in the specified path");
            }
            else if (ICOpic.Image == null)
            {
                MessageForm.Error("Select a picture to continue");
            }
            else
            {
                if (Gdirbox.Text.Contains(Edirbox.Text, StringComparison.OrdinalIgnoreCase))
                {
                    code = Roslyn_FormCode(Gdirbox.Text.Replace(Edirbox.Text, @""));
                }
                else
                {
                    code = Roslyn_FormCode(Gdirbox.Text);
                }

                Compile(code);

                ICOpic.Image = null;
                Gdirbox.Text = Shortcutbox.Text = null;
            }
            Shortcutbox.Focus();
        }
示例#8
0
        private void EmuBrow_Click(object sender, EventArgs e)
        {
            string EmuDir = "C:\\";

            if (Edirbox.Text != "")
            {
                EmuDir = Edirbox.Text;
            }

            var file = TempString != null ? TempString : FileDialog(EmuDir, "Executable File (*.exe)|*.exe");

            TempString = null;

            if (file != null)
            {
                bool exists = false;
                foreach (var emu in EmulatorsList)
                {
                    if (emu.Exe.ToLower() == Path.GetFileName(file).ToLower())
                    {
                        if (File.Exists(file))
                        {
                            emu.Path(Path.GetDirectoryName(file) + @"\");
                        }
                        emulatorcb.SelectedIndex = EmulatorsList.IndexOf(emu);
                        Emulatorcb_SelectedIndexChanged(null, null);
                        exists = true;
                        break;
                    }
                }

                if (exists == false)
                {
                    MessageForm.Info("The emulator isn't supported yet. You can contribute to make it compatible on GitHub (Haruki1707/ShortCutes repo)" +
                                     "\n\n!!!This also may occur because you changed the emulator executable name." +
                                     "Make sure you are using the original emulator name!!!");
                }
            }

            Shortcutbox.Focus();
        }
示例#9
0
 private void Shortcutbox_Focus(object sender, EventArgs e)
 {
     Shortcutbox.Focus();
 }