Ejemplo n.º 1
0
 private void btnCreateTokens_Click(object sender, EventArgs e)
 {
     btnCreateTokens.Enabled = false;
     if (Directory.Exists(combatTokenFruaPath))
     {
         string[] files = Directory.GetFiles(combatTokenFruaPath, "*.pcx");
         foreach (string file in files)
         {
             try
             {
                 string filename = Path.GetFileName(file);
                 string filenameNoExt = Path.GetFileNameWithoutExtension(file);
                 if ((filename.EndsWith(".pcx")) || (filename.EndsWith(".PCX")))
                 {
                     imagepcx = new ImagePcx(file);
                     Bitmap toSave = createCombatToken(imagepcx.PcxImage);
                     toSave.MakeTransparent(Color.FromArgb(255, 0, 227));
                     toSave.MakeTransparent(Color.FromArgb(255, 0, 255));
                     toSave.MakeTransparent(Color.FromArgb(103, 247, 159));
                     toSave.MakeTransparent(Color.FromArgb(100, 244, 156));
                     toSave.MakeTransparent(Color.FromArgb(tranR, tranG, tranB));
                     toSave.RotateFlip(RotateFlipType.RotateNoneFlipX);
                     toSave.Save(combatTokenIB2Path + "\\tkn_" + filenameNoExt.ToLower() + ".png", System.Drawing.Imaging.ImageFormat.Png);
                     if (chkIncludePropsFromTokens.Checked)
                     {
                         toSave = createPropFromCombatToken(imagepcx.PcxImage);
                         toSave.MakeTransparent(Color.FromArgb(255, 0, 227));
                         toSave.MakeTransparent(Color.FromArgb(255, 0, 255));
                         toSave.MakeTransparent(Color.FromArgb(103, 247, 159));
                         toSave.MakeTransparent(Color.FromArgb(100, 244, 156));
                         toSave.MakeTransparent(Color.FromArgb(tranR, tranG, tranB));
                         toSave.RotateFlip(RotateFlipType.RotateNoneFlipX);
                         toSave.Save(propTokenIB2Path + "\\prp_" + filenameNoExt.ToLower() + ".png", System.Drawing.Imaging.ImageFormat.Png);
                     }
                 }
             }
             catch (Exception ex)
             {
                 MessageBox.Show("Error While Creating Tokens: " + ex.ToString());
             }
         }
     }
     else
     {
         MessageBox.Show("Tokens Source directory does not exist");
     }
     btnCreateTokens.Enabled = true;
 }
Ejemplo n.º 2
0
 private void btnCreateTiles_Click(object sender, EventArgs e)
 {
     btnCreateTiles.Enabled = false;
     if (Directory.Exists(tilesFruaPath))
     {
         string[] files = Directory.GetFiles(tilesFruaPath, "*.pcx");
         foreach (string file in files)
         {
             try
             {
                 string filename = Path.GetFileName(file);
                 string filenameNoExt = Path.GetFileNameWithoutExtension(file);
                 if ((filename.EndsWith(".pcx")) || (filename.EndsWith(".PCX")))
                 {
                     imagepcx = new ImagePcx(file);
                     if (makeTileDown(imagepcx.PcxImage)) //make two versions, up and down
                     {
                         //at top
                         Bitmap toSave = createTile(imagepcx.PcxImage, true);
                         toSave.MakeTransparent(Color.FromArgb(255, 0, 227));
                         toSave.MakeTransparent(Color.FromArgb(103, 247, 159));
                         toSave.MakeTransparent(Color.FromArgb(128, 255, 128));
                         toSave.MakeTransparent(Color.FromArgb(252, 100, 252));
                         toSave.Save(tilesIB2Path + "\\t_" + filenameNoExt.ToLower() + "_U.png", System.Drawing.Imaging.ImageFormat.Png);
                         //at bottom
                         toSave = createTile(imagepcx.PcxImage, false);
                         toSave.MakeTransparent(Color.FromArgb(255, 0, 227));
                         toSave.MakeTransparent(Color.FromArgb(103, 247, 159));
                         toSave.MakeTransparent(Color.FromArgb(128, 255, 128));
                         toSave.MakeTransparent(Color.FromArgb(252, 100, 252));
                         toSave.Save(tilesIB2Path + "\\t_" + filenameNoExt.ToLower() + "_D.png", System.Drawing.Imaging.ImageFormat.Png);
                     }
                     else
                     {
                         Bitmap toSave = createTile(imagepcx.PcxImage, true);
                         toSave.MakeTransparent(Color.FromArgb(255, 0, 227));
                         toSave.MakeTransparent(Color.FromArgb(103, 247, 159));
                         toSave.MakeTransparent(Color.FromArgb(128, 255, 128));
                         toSave.MakeTransparent(Color.FromArgb(252, 100, 252));
                         toSave.Save(tilesIB2Path + "\\t_" + filenameNoExt.ToLower() + ".png", System.Drawing.Imaging.ImageFormat.Png);
                     }
                 }
             }
             catch (Exception ex)
             {
                 MessageBox.Show("Error While Creating Tiles: " + ex.ToString());
             }
         }
     }
     else
     {
         MessageBox.Show("Tile Source directory does not exist");
     }
     btnCreateTiles.Enabled = true;
 }