Example #1
0
        public void OpenFile(string path)
        {
            bool opened = true;

            string ext = path.Split('.')[path.Split('.').Length - 1];

            switch (ext)
            {
            case "txt":
                if (Shiftorium.UpgradeInstalled("textpad_open"))
                {
                    var txt = new TextPad();
                    txt.LoadFile(path);
                    AppearanceManager.SetupWindow(txt);
                }
                else
                {
                    opened = false;
                }
                break;

            case "pic":
            case "png":
            case "jpg":
            case "bmp":

                break;

            case "wav":
            case "mp3":

                break;

            case "lua":

                break;

            case "py":

                break;

            case "skn":

                break;

            case "mfs":
                Utils.MountPersistent(path);
                string mount = (Utils.Mounts.Count - 1).ToString() + ":";
                OpenDirectory(mount);
                break;

            default:
                opened = false;
                break;
            }
            if (opened == false)
            {
                Infobox.Show("File Skimmer - Can't open file", "File Skimmer can't find an application to open this file!");
            }
        }
Example #2
0
        private void btnconfirm_Click(object sender, RoutedEventArgs e)
        {
            if (!string.IsNullOrWhiteSpace(txtfilename.Text))
            {
                if (!txtfilename.Text.EndsWith(filter.SelectedItem.ToString()))
                {
                    txtfilename.Text += filter.SelectedItem.ToString();
                }

                switch (OpenerStyle)
                {
                case FileOpenerStyle.Open:
                    if (Utils.FileExists(currentFolder + "/" + txtfilename.Text))
                    {
                        Callback?.Invoke(currentFolder + "/" + txtfilename.Text);
                        AppearanceManager.Close(this);
                    }
                    else
                    {
                        Infobox.Show("File not found", $"The file {currentFolder}/{txtfilename.Text} was not found.");
                    }
                    break;

                case FileOpenerStyle.Save:
                    Callback?.Invoke(currentFolder + "/" + txtfilename.Text);
                    AppearanceManager.Close(this);
                    break;
                }
            }
            else
            {
                Infobox.Show("File Skimmer", "Please provide a filename.");
            }
        }
Example #3
0
        private void btnbuy_Click_1(object sender, RoutedEventArgs e)
        {
            var upg = this.DataContext as ShiftoriumUpgrade;

            Shiftorium.Silent = true;
            if (Shiftorium.Buy(upg.ID, upg.Cost) == true)
            {
                btnbuy.Visibility = Visibility.Collapsed;
                Setup();
            }
            else
            {
                Infobox.Show("Shiftorium", $"You do not have enough Codepoints to buy this upgrade. You need {upg.Cost - SaveSystem.CurrentSave.Codepoints} more.");
            }
        }