コード例 #1
0
        private void SaveBtn_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
        {
            string name = tbTempName.Text;

            if (string.IsNullOrWhiteSpace(name))
            {
                MessageBox.Show("Bitte gib erst einen Namen für das Template ein.");
                return;
            }

            //if (false)
            //{
            //    MessageBox.Show("Der Template-Name darf keine Sonderzeichen enthalten.");
            //    return;
            //}

            TakeCurrentTemplate(name);

            if (CurrentTemplate != null)
            {
                if (!string.IsNullOrEmpty(CurrentTemplate.TemplateName))
                {
                    Program.SerializeClass(DirectoryManager.FileTemplates(CurrentTemplate.TemplateName + ".xml"), CurrentTemplate, typeof(Template));
                }
            }

            MessageBox.Show(CurrentTemplate.TemplateName + ".xml gespeichert.");

            ShowPreview();
        }
コード例 #2
0
        private void DrawCardpicture(Card data, Template t)
        {
            RectangleF bounce = new RectangleF(t.CardPicAreaX, t.CardPicAreaY, t.CardPicAreaWidth, t.CardPicAreaHeight);

            Bitmap b;
            string path = "";

            if (File.Exists(DirectoryManager.FileResources(DirectoryManager.CustomFolders.Pics, data.CardID + ".jpg")))
            {
                path = DirectoryManager.FileResources(DirectoryManager.CustomFolders.Pics, data.CardID + ".jpg");
            }
            else if (File.Exists(DirectoryManager.FileResources(DirectoryManager.CustomFolders.Pics, data.CardID + ".png")))
            {
                path = DirectoryManager.FileResources(DirectoryManager.CustomFolders.Pics, data.CardID + ".png");
            }

            if (path != "")
            {
                b = new Bitmap(path);
                if (b != null)
                {
                    g.DrawImage(b, bounce);
                }
            }
        }
コード例 #3
0
        public static void Run(string[] args)
        {
            AppDomain.CurrentDomain.UnhandledException += OnUnhandledException;

            DirectoryManager.CreateDirectorys();

            for (int i = 0; i != args.Length; ++i)
            {
                if (args[i].EndsWith(".cdb"))
                {
                    FileInfo info = new FileInfo(args[i]);
                    if (info.Exists)
                    {
                        DbPath = args[i];
                    }
                }
            }

            Config = new Configurations();
            if (!File.Exists(DirectoryManager.FileData("config.xml")))
            {
                SerializeClass(DirectoryManager.FileData("config.xml"), Config, typeof(Configurations));
            }
            else
            {
                Config = (Configurations)DeserializeClass(DirectoryManager.FileData("config.xml"), typeof(Configurations));
            }

            MainWin = new MainWindow();
            MainWin.Show();
        }
コード例 #4
0
 private void CreateFile()
 {
     try
     {
         FullBitmap.Save(DirectoryManager.FileResults(CardData.CardID + ".jpg"), ImageFormat.Jpeg);
         Program.MainWin.Write(CardData.CardID + ".jpg wurde erstellt.");
     }
     catch (Exception ex)
     {
         Program.MainWin.Write(ex.Message);
     }
 }
コード例 #5
0
        private static void OnUnhandledException(object sender, UnhandledExceptionEventArgs e)
        {
            Exception exception = e.ExceptionObject as Exception ?? new Exception();

            System.IO.File.WriteAllText(
                DirectoryManager.FileErrors(DateTime.UtcNow.ToString("yyyy-MM-dd_HH-mm-ss") + ".txt"),
                exception.ToString());

            MessageBox.Show(exception.Message);

            Console.WriteLine(exception.ToString());
        }
コード例 #6
0
        private void CreateFile(Card data, int count)
        {
            if (Temp == null)
            {
                return;
            }

            Template t = Temp;

            bmp = CreateBitmap(data, t);

            try
            {
                bmp.Save(DirectoryManager.FileResults(data.CardID + ".jpg"), ImageFormat.Jpeg);
                Program.MainWin.Write(count + "/" + Program.CardManager.Cardlist.Count + " || " +
                                      data.CardID + ".jpg was created.");
            }
            catch (Exception ex)
            {
                Program.MainWin.Write(ex.Message);
            }
        }
コード例 #7
0
        private void BeginInit(Template t)
        {
            if (isInit)
            {
                return;
            }

            #region Init Backgrounds
            if (File.Exists(DirectoryManager.FileResources(DirectoryManager.CustomFolders.Cardtype, t.Cardtype_Normal)))
            {
                bg_normal = new Bitmap(DirectoryManager.FileResources(DirectoryManager.CustomFolders.Cardtype, t.Cardtype_Normal));
            }

            if (File.Exists(DirectoryManager.FileResources(DirectoryManager.CustomFolders.Cardtype, t.Cardtype_Xyz)))
            {
                bg_xyz = new Bitmap(DirectoryManager.FileResources(DirectoryManager.CustomFolders.Cardtype, t.Cardtype_Xyz));
            }

            if (File.Exists(DirectoryManager.FileResources(DirectoryManager.CustomFolders.Cardtype, t.Cardtype_Synchro)))
            {
                bg_synchro = new Bitmap(DirectoryManager.FileResources(DirectoryManager.CustomFolders.Cardtype, t.Cardtype_Synchro));
            }

            if (File.Exists(DirectoryManager.FileResources(DirectoryManager.CustomFolders.Cardtype, t.Cardtype_Effect)))
            {
                bg_effect = new Bitmap(DirectoryManager.FileResources(DirectoryManager.CustomFolders.Cardtype, t.Cardtype_Effect));
            }

            if (File.Exists(DirectoryManager.FileResources(DirectoryManager.CustomFolders.Cardtype, t.Cardtype_Ritual)))
            {
                bg_ritual = new Bitmap(DirectoryManager.FileResources(DirectoryManager.CustomFolders.Cardtype, t.Cardtype_Ritual));
            }

            if (File.Exists(DirectoryManager.FileResources(DirectoryManager.CustomFolders.Cardtype, t.Cardtype_Fusion)))
            {
                bg_fusion = new Bitmap(DirectoryManager.FileResources(DirectoryManager.CustomFolders.Cardtype, t.Cardtype_Fusion));
            }

            if (File.Exists(DirectoryManager.FileResources(DirectoryManager.CustomFolders.Cardtype, t.Cardtype_Spellcard)))
            {
                bg_spell = new Bitmap(DirectoryManager.FileResources(DirectoryManager.CustomFolders.Cardtype, t.Cardtype_Spellcard));
            }

            if (File.Exists(DirectoryManager.FileResources(DirectoryManager.CustomFolders.Cardtype, t.Cardtype_Trapcard)))
            {
                bg_trap = new Bitmap(DirectoryManager.FileResources(DirectoryManager.CustomFolders.Cardtype, t.Cardtype_Trapcard));
            }

            if (File.Exists(DirectoryManager.FileResources(DirectoryManager.CustomFolders.Cardtype, t.Cardtype_Pendulum)))
            {
                bg_pendulum = new Bitmap(DirectoryManager.FileResources(DirectoryManager.CustomFolders.Cardtype, t.Cardtype_Pendulum));
            }

            if (File.Exists(DirectoryManager.FileResources(DirectoryManager.CustomFolders.Cardtype, t.Cardtype_Token)))
            {
                bg_token = new Bitmap(DirectoryManager.FileResources(DirectoryManager.CustomFolders.Cardtype, t.Cardtype_Token));
            }
            #endregion

            #region Init Attributes
            if (File.Exists(DirectoryManager.FileResources(DirectoryManager.CustomFolders.Attribute, t.AttributeDark)))
            {
                aDark = new Bitmap(DirectoryManager.FileResources(DirectoryManager.CustomFolders.Attribute, t.AttributeDark));
            }

            if (File.Exists(DirectoryManager.FileResources(DirectoryManager.CustomFolders.Attribute, t.AttributeLight)))
            {
                aLight = new Bitmap(DirectoryManager.FileResources(DirectoryManager.CustomFolders.Attribute, t.AttributeLight));
            }

            if (File.Exists(DirectoryManager.FileResources(DirectoryManager.CustomFolders.Attribute, t.AttributeFire)))
            {
                aFire = new Bitmap(DirectoryManager.FileResources(DirectoryManager.CustomFolders.Attribute, t.AttributeFire));
            }

            if (File.Exists(DirectoryManager.FileResources(DirectoryManager.CustomFolders.Attribute, t.AttributeWater)))
            {
                aWater = new Bitmap(DirectoryManager.FileResources(DirectoryManager.CustomFolders.Attribute, t.AttributeWater));
            }

            if (File.Exists(DirectoryManager.FileResources(DirectoryManager.CustomFolders.Attribute, t.AttributeWind)))
            {
                aWind = new Bitmap(DirectoryManager.FileResources(DirectoryManager.CustomFolders.Attribute, t.AttributeWind));
            }

            if (File.Exists(DirectoryManager.FileResources(DirectoryManager.CustomFolders.Attribute, t.AttributeEarth)))
            {
                aEarth = new Bitmap(DirectoryManager.FileResources(DirectoryManager.CustomFolders.Attribute, t.AttributeEarth));
            }

            if (File.Exists(DirectoryManager.FileResources(DirectoryManager.CustomFolders.Attribute, t.AttributeDivine)))
            {
                aDivine = new Bitmap(DirectoryManager.FileResources(DirectoryManager.CustomFolders.Attribute, t.AttributeDivine));
            }

            if (File.Exists(DirectoryManager.FileResources(DirectoryManager.CustomFolders.Attribute, t.AttributeSpell)))
            {
                aSpell = new Bitmap(DirectoryManager.FileResources(DirectoryManager.CustomFolders.Attribute, t.AttributeSpell));
            }

            if (File.Exists(DirectoryManager.FileResources(DirectoryManager.CustomFolders.Attribute, t.AttributeTrap)))
            {
                aTrap = new Bitmap(DirectoryManager.FileResources(DirectoryManager.CustomFolders.Attribute, t.AttributeTrap));
            }
            #endregion

            #region Init Level and Rank
            if (File.Exists(DirectoryManager.FileResources(DirectoryManager.CustomFolders.Level, t.LevelPicture)))
            {
                imgLevel = new Bitmap(DirectoryManager.FileResources(DirectoryManager.CustomFolders.Level, t.LevelPicture));
            }

            if (File.Exists(DirectoryManager.FileResources(DirectoryManager.CustomFolders.Level, t.RankPicture)))
            {
                imgRank = new Bitmap(DirectoryManager.FileResources(DirectoryManager.CustomFolders.Level, t.RankPicture));
            }

            #endregion

            #region
            bNormal   = new SolidBrush(Color.FromArgb(t.Cardname_Color_Normal[0], t.Cardname_Color_Normal[1], t.Cardname_Color_Normal[2]));
            bEffect   = new SolidBrush(Color.FromArgb(t.Cardname_Color_NormalEffect[0], t.Cardname_Color_NormalEffect[1], t.Cardname_Color_NormalEffect[2]));
            bToken    = new SolidBrush(Color.FromArgb(t.Cardname_Color_Token[0], t.Cardname_Color_Token[1], t.Cardname_Color_Token[2]));
            bRitual   = new SolidBrush(Color.FromArgb(t.Cardname_Color_Ritual[0], t.Cardname_Color_Ritual[1], t.Cardname_Color_Ritual[2]));
            bFusion   = new SolidBrush(Color.FromArgb(t.Cardname_Color_Fusion[0], t.Cardname_Color_Fusion[1], t.Cardname_Color_Fusion[2]));
            bSynchro  = new SolidBrush(Color.FromArgb(t.Cardname_Color_Synchro[0], t.Cardname_Color_Synchro[1], t.Cardname_Color_Synchro[2]));
            bXyz      = new SolidBrush(Color.FromArgb(t.Cardname_Color_Xyz[0], t.Cardname_Color_Xyz[1], t.Cardname_Color_Xyz[2]));
            bPendulum = new SolidBrush(Color.FromArgb(t.Cardname_Color_Pendulum[0], t.Cardname_Color_Pendulum[1], t.Cardname_Color_Pendulum[2]));
            bSpell    = new SolidBrush(Color.FromArgb(t.Cardname_Color_Spell[0], t.Cardname_Color_Spell[1], t.Cardname_Color_Spell[2]));
            bTrap     = new SolidBrush(Color.FromArgb(t.Cardname_Color_Trap[0], t.Cardname_Color_Trap[1], t.Cardname_Color_Trap[2]));
            #endregion

            #region Fonts
            pfc = new PrivateFontCollection();

            fam_Cardname  = LoadFontFamily(GetFontPath(t.Cardname_Fontname));
            font_Cardname = new Font(fam_Cardname, t.Cardname_Fontsize);

            fam_Typ  = LoadFontFamily(GetFontPath(t.Monstertype_Fontname));
            font_Typ = new Font(fam_Typ, t.Monstertype_Fontsize);

            fam_Desc  = LoadFontFamily(GetFontPath(t.Desc_Fontname));
            font_Desc = new Font(fam_Desc, t.Desc_Fontsize);

            fam_Stats  = LoadFontFamily(GetFontPath(t.Stats_Fontname));
            font_Stats = new Font(fam_Stats, t.Stats_Fontsize);
            #endregion

            isInit = true;
        }
コード例 #8
0
 private string GetFontPath(string font)
 {
     return(DirectoryManager.FileResources(DirectoryManager.CustomFolders.Fonts, font));
 }