コード例 #1
0
        public DifficultySelector(Point start, int startingDiff)
        {
            InitializeComponent();
            ControlBox = false;
            var tools = new NemoTools();

            try
            {
                diffNoPart.Image = tools.NemoLoadImage(Application.StartupPath + "\\res\\nopart.png");
                diff0.Image      = tools.NemoLoadImage(Application.StartupPath + "\\res\\diff0.png");
                diff1.Image      = tools.NemoLoadImage(Application.StartupPath + "\\res\\diff1.png");
                diff2.Image      = tools.NemoLoadImage(Application.StartupPath + "\\res\\diff2.png");
                diff3.Image      = tools.NemoLoadImage(Application.StartupPath + "\\res\\diff3.png");
                diff4.Image      = tools.NemoLoadImage(Application.StartupPath + "\\res\\diff4.png");
                diff5.Image      = tools.NemoLoadImage(Application.StartupPath + "\\res\\diff5.png");
                diff6.Image      = tools.NemoLoadImage(Application.StartupPath + "\\res\\diff6.png");
            }
            catch
            {
                MessageBox.Show("Looks like one or more of the images I use are missing.\nPlease re-download this program and don't delete\nthe 'res' folder next time.",
                                "Missing Files", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
            Difficulty    = startingDiff;
            StartLocation = start;
        }
コード例 #2
0
ファイル: FileSelector.cs プロジェクト: i0brendan0/MagmaLite2
        private void lstFiles_SelectedIndexChanged(object sender, EventArgs e)
        {
            var file = folder + lstFiles.SelectedItem;

            if (!File.Exists(file))
            {
                MessageBox.Show("Couldn't find that file!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return;
            }

            var fileSize = new FileInfo(file);
            var info     = "";

            if (extension == ".png_xbox")
            {
                var png = Application.StartupPath + "\\bin\\temp.png";
                Tools.DeleteFile(png);
                if (!Tools.ConvertRBImage(file, png))
                {
                    return;
                }

                var img = Tools.NemoLoadImage(png);
                picImage.Image = img;
                info           = "Dimensions: " + img.Height + "x" + img.Width;
            }

            if (extension == ".mogg")
            {
                var bytes = File.ReadAllBytes(file);

                info = "Encrypted? " + (bytes[0] == 0x0A ? "No" : "Yes (0x" + bytes[0].ToString("X2") + ")");
            }

            var size = "Size: ";

            if (fileSize.Length >= 1048576)
            {
                size = size + (Math.Round((double)fileSize.Length / 1048576, 2)) + " MB";
            }
            else
            {
                size = size + (Math.Round((double)fileSize.Length / 1024, 2)) + " KB";
            }

            lblInformation.Text = size + (string.IsNullOrEmpty(info) ? "" : "   |   " + info);

            if (starting)
            {
                return;
            }

            timer1.Enabled   = false;
            lblTimer.Visible = false;
        }
コード例 #3
0
        private void cboCharacter_SelectedIndexChanged(object sender, EventArgs e)
        {
            btnExportChar.Enabled  = cboCharacter.SelectedIndex > -1;
            btnReplaceChar.Enabled = cboCharacter.SelectedIndex > -1 && !isWii;

            if (cboCharacter.SelectedIndex < 0)
            {
                return;
            }

            var image = ImageFolder + "character_" + (cboCharacter.SelectedIndex + 1) + ".png";

            picCharacter.Image = Tools.NemoLoadImage(image);
        }
コード例 #4
0
ファイル: CONCreator.cs プロジェクト: earlye/CON-Tools
 private void GetImage(String file, PictureBox box)
 {
     if (picWorking.Visible)
     {
         return;
     }
     try
     {
         string contentImage = null;
         //if not passed a string path for the image
         //show dialog box to find one
         if (string.IsNullOrWhiteSpace(file))
         {
             var openFileDialog1 = new OpenFileDialog
             {
                 Filter           = "Image Files|*.bmp;*.jpg;*.jpeg;*.png",
                 Title            = "Select an image",
                 InitialDirectory = Application.StartupPath + "\\res\\thumbs"
             };
             if (openFileDialog1.ShowDialog() == DialogResult.OK)
             {
                 contentImage        = openFileDialog1.FileName;
                 Tools.CurrentFolder = Path.GetDirectoryName(openFileDialog1.FileName);
             }
         }
         else
         {
             //if file is not blank, then use that for the image
             if ((file.Contains(".jpg") || file.Contains(".bmp") ||
                  file.Contains(".png") || file.Contains(".jpeg")) && !file.Contains(".png_xbox") && !file.Contains(".png_wii"))
             {
                 contentImage = file;
             }
             else
             {
                 return;
             }
         }
         if (string.IsNullOrWhiteSpace(contentImage))
         {
             return;
         }
         var thumbnail = Tools.NemoLoadImage(contentImage);
         if (thumbnail.Width == 64 && thumbnail.Height == 64)
         {
             box.Image = thumbnail;
             return;
         }
         var newimage = Path.GetTempPath() + Path.GetFileNameWithoutExtension(contentImage) + ".png";
         Tools.ResizeImage(contentImage, 64, "png", newimage);
         if (File.Exists(newimage))
         {
             box.Image = Tools.NemoLoadImage(newimage);
         }
         Tools.DeleteFile(newimage);
     }
     catch (Exception iSuck)
     {
         MessageBox.Show("Error: " + iSuck.Message);
     }
 }
コード例 #5
0
ファイル: RBAConverter.cs プロジェクト: earlye/CON-Tools
        private bool makeCON(string rba)
        {
            if (backgroundWorker1.CancellationPending)
            {
                return(false);
            }
            var con = txtFolder.Text + "\\" + Path.GetFileNameWithoutExtension(rba).Replace("_rb3con", "") + "_rb3con";

            Tools.DeleteFile(con);
            var xsession = new CreateSTFS {
                HeaderData = { TitleID = 0x45410914 }
            };

            xsession.HeaderData.Title_Package = "Rock Band 3";
            xsession.HeaderData.SetLanguage(Languages.English);
            xsession.HeaderData.Publisher          = "";
            xsession.STFSType                      = STFSType.Type0;
            xsession.HeaderData.ThisType           = PackageType.SavedGame;
            xsession.HeaderData.PackageImageBinary = rB3IconTool.Checked || string.IsNullOrWhiteSpace(thumbnail) || !File.Exists(thumbnail) ?
                                                     Resources.RB3.ImageToBytes(ImageFormat.Png) : Tools.NemoLoadImage(thumbnail).ImageToBytes(ImageFormat.Png);
            xsession.HeaderData.ContentImageBinary = Resources.RB3.ImageToBytes(ImageFormat.Png);
            xsession.HeaderData.MakeAnonymous();
            var bOk = PackageCheckFiles(xsession);

            if (bOk)
            {
                bOk = PackageCreate(con, xsession);
            }
            if (bOk)
            {
                bOk = Tools.UnlockCON(con);
            }
            if (!bOk)
            {
                return(false);
            }
            Tools.SignCON(con);
            return(true);
        }
コード例 #6
0
        private void getImage(String file, PictureBox box)
        {
            if (picWorking.Visible)
            {
                return;
            }

            try
            {
                string contentImage;

                //if not passed a string path for the image
                //show dialog box to find one
                if (string.IsNullOrWhiteSpace(file))
                {
                    var openFileDialog1 = new OpenFileDialog
                    {
                        Filter           = "Image Files|*.bmp;*.jpg;*.jpeg;*.png",
                        Title            = "Select a Package image",
                        InitialDirectory = Application.StartupPath + "\\res\\thumbs"
                    };
                    if (openFileDialog1.ShowDialog() != DialogResult.OK)
                    {
                        return;
                    }
                    contentImage        = openFileDialog1.FileName;
                    Tools.CurrentFolder = Path.GetDirectoryName(openFileDialog1.FileName);
                }
                else
                {
                    //if file is not blank, then use that for the image

                    if ((file.Contains(".jpg") || file.Contains(".bmp") ||
                         file.Contains(".png") || file.Contains(".jpeg")) && !file.Contains(".png_xbox") && !file.Contains(".png_wii"))
                    {
                        contentImage = file;
                    }
                    else
                    {
                        Log("That's not a valid image file");
                        return;
                    }
                }

                if (string.IsNullOrWhiteSpace(contentImage))
                {
                    return;
                }

                var thumbnail = Tools.NemoLoadImage(contentImage);
                if (thumbnail.Width == 64 && thumbnail.Height == 64)
                {
                    box.Image = thumbnail;
                    Log(box.Name.Replace("pic", "") + " Image changed successfully");
                    xPackage.Header.ContentImageBinary = picContent.Image.ImageToBytes(ImageFormat.Png);
                    xPackage.Header.PackageImageBinary = picPackage.Image.ImageToBytes(ImageFormat.Png);
                    ShowChanges(true);
                    return;
                }

                var newimage = Path.GetTempPath() + Path.GetFileNameWithoutExtension(contentImage) + ".png";
                Tools.ResizeImage(contentImage, 64, "png", newimage);

                if (File.Exists(newimage))
                {
                    box.Image = Tools.NemoLoadImage(newimage);
                    xPackage.Header.ContentImageBinary = picContent.Image.ImageToBytes(ImageFormat.Png);
                    xPackage.Header.PackageImageBinary = picPackage.Image.ImageToBytes(ImageFormat.Png);
                }
                Tools.DeleteFile(newimage);
                Log(box.Name.Replace("pic", "") + " Image changed successfully");
                ShowChanges(true);
            }
            catch
            {
                Log("Error loading image ... try again.");
            }
        }