コード例 #1
0
        /// <summary>
        /// methode permettant de charger toutes les fiches présentent dans la table de nom de fiche de jeu
        /// </summary>
        /// <param name="stockage"></param>
        /// <returns></returns>
        public FicheDeJeu[] chargerToutesLesFiches(IStockage stockage)
        {
            FicheDeJeu[] fichesDeJeu = new FicheDeJeu[nomsFiche.Count];


            for (int i = 0; i < nomsFiche.Count; i++)
            {
                fichesDeJeu[i] = stockage.SelectionnerUneFiche(nomsFiche[i]);
            }
            fiches = new List <FicheDeJeu>(fichesDeJeu);
            return(fichesDeJeu);
        }
コード例 #2
0
        public static FicheDeJeu creerFiche(ManageurDeJeu manager)
        {
            FicheDeJeu      fiche     = null;
            Age             age       = null;
            ObjectifTableau objectifs = null;

            Console.Write("Entrez le nom du jeu : ");
            String titre = Console.ReadLine();

            Console.Write("Entrez les rêgles du jeu : ");
            String regle = Console.ReadLine();

            Console.Write("Entrez l'âge Minimun pour jouer au jeu : ");
            String tmpAgeMin = Console.ReadLine();

            Console.Write("Entrez l'age maximum pour jouer au jeu : ");
            String tmpAgeMax = Console.ReadLine();

            Console.Write("Entrez la durée du jeu(en minutes) : ");
            String tmpduree = Console.ReadLine();

            Console.WriteLine("1. Petit jeu ");
            Console.WriteLine("2. Grand jeu ");
            Console.WriteLine("3. Veillée");
            Console.WriteLine("4. Activité Manuel");
            Console.Write("Saisissez la catégorie du jeu : ");
            String tmpcateg = Console.ReadLine();

            Console.Write("Saisissez l'objectif 1 : ");
            String obj1 = Console.ReadLine();

            Console.Write("Saisissez l'objectif 2 : ");
            String obj2 = Console.ReadLine();

            try
            {
                int  ageMin = Convert.ToInt32(tmpAgeMin);
                int  ageMax = Convert.ToInt32(tmpAgeMax);
                int  duree  = Convert.ToInt32(tmpduree);
                uint categ  = Convert.ToUInt32(tmpcateg);
                objectifs = new ObjectifTableau(obj1, obj2);
                age       = new Age(ageMin, ageMax);
                fiche     = manager.creerJeu(titre, regle, age, duree, categ, objectifs);
            }
            catch (Exception)
            {
                Console.WriteLine("Erreur de parsing");
            }
            return(fiche);
        }
コード例 #3
0
        /// <summary>
        /// Fonction : stocker une fiche dans un fichier XML
        /// Le fichier créé porte le nom du jeu
        /// </summary>
        /// <param name="fiche">La fiche de jeu a stocker</param>
        public void StockerUneFiche(FicheDeJeu fiche)
        {
            FicheDeJeuXML     myObject = new FicheDeJeuXML(fiche);
            var               ds       = new DataContractSerializer(typeof(FicheDeJeuXML), new Type[] { typeof(ObjectifTableau) });
            XmlWriterSettings settings = new XmlWriterSettings()
            {
                Indent = false
            };

            using (XmlWriter w = XmlWriter.Create(fiche.nom + ".xml", settings))
                ds.WriteObject(w, myObject);
            // System.Diagnostics.Process.Start(fiche.nom+".xml");
            // Console.ReadLine();
        }
コード例 #4
0
 /// <summary>
 /// constructeur de la classe
 /// </summary>
 public FicheDeJeuXML()
 {
     this.ficheDeJeu = new FicheDeJeu();
 }
コード例 #5
0
 public void avantSerialisation(StreamingContext sc)
 {
     this.ficheDeJeu = new FicheDeJeu();
 }
コード例 #6
0
 /// <summary>
 /// Constructeur de Fiche de jeu XML (pour la sérialisastion)
 /// </summary>
 /// <param name="ficheDeJeu"> une fiche de jeu qui sert de référencement</param>
 public FicheDeJeuXML(FicheDeJeu ficheDeJeu)
 {
     this.ficheDeJeu = ficheDeJeu;
 }
コード例 #7
0
        /// <summary>
        /// methode main de la classe pour test fonctionnel
        /// </summary>
        /// <param name="args"></param>
        static void Main(string[] args)
        {
            IStockage     i       = new StockageInterneXML();
            ManageurDeJeu manager = new ManageurDeJeu();

            string lu        = null;
            int    luconvert = 0;

            Console.WriteLine("---------------Menu------------");
            Console.WriteLine("1. Créer une fiche de Jeu");
            Console.WriteLine("2. Charger les fiches local et les afficher");
            Console.WriteLine("3. Charger les fiches local et les afficher trié par categorie");
            Console.WriteLine("0. Quitter le programme");
            Console.WriteLine();
            Console.WriteLine("Choix : ");
            lu = Console.ReadLine();
            try
            {
                luconvert = Convert.ToInt32(lu);
            }
            catch (Exception)
            {
                Console.WriteLine("Erreur de parsing");
            }
            while (luconvert != 0)
            {
                switch (luconvert)
                {
                case 1:
                    FicheDeJeu fiche = null;
                    fiche = creerFiche(manager);
                    Console.WriteLine();
                    Console.WriteLine("------Sous-Menu------");
                    Console.WriteLine("1. Afficher fiche");
                    Console.WriteLine("2. Sauvegarder Fiche en local");
                    Console.WriteLine("0. Revenir au menu principal");
                    Console.WriteLine();
                    Console.WriteLine("Choix : ");
                    lu = Console.ReadLine();
                    try
                    {
                        luconvert = Convert.ToInt32(lu);
                    }
                    catch (Exception)
                    {
                        Console.WriteLine("Erreur de parsing");
                    }
                    while (luconvert != 0)
                    {
                        switch (luconvert)
                        {
                        case 1:
                            fiche.ToString();
                            break;

                        case 2:
                            i.StockerUneFiche(fiche);
                            break;

                        default:
                            Console.WriteLine("erreur saisi");
                            break;
                        }
                        Console.WriteLine();
                        Console.WriteLine("------Sous-Menu------");
                        Console.WriteLine("1. Afficher fiche");
                        Console.WriteLine("2. Sauvegarder Fiche en local");
                        Console.WriteLine();
                        Console.WriteLine("Choix : ");
                        lu = Console.ReadLine();
                        try
                        {
                            luconvert = Convert.ToInt32(lu);
                        }
                        catch (Exception)
                        {
                            Console.WriteLine("Erreur de parsing");
                        }
                    }
                    break;

                case 2:
                    FicheDeJeu[] mesFiches = manager.chargerToutesLesFiches(i);
                    for (int cpt = 0; cpt < mesFiches.Length; cpt++)
                    {
                        Console.WriteLine("fiche n°" + cpt + " : " + mesFiches[cpt].nom);
                    }
                    if (mesFiches.Length == 0)
                    {
                        Console.WriteLine("aucune fiche enregistré - Attention les fiches ne peuvent être chargé que dans la même session dans laquelle elle a été enregistré.");
                    }
                    break;

                case 3:
                    List <FicheDeJeu> listeTrieParCateg = manager.rechercheParCateg(1);
                    for (int x = 0; x < listeTrieParCateg.Count; x++)
                    {
                        Console.WriteLine("fiche n°" + x + " : " + listeTrieParCateg[x].nom + "categ : " + listeTrieParCateg[x].categ);
                    }
                    if (listeTrieParCateg.Capacity == 0)
                    {
                        Console.WriteLine("aucune fiche enregistré - Attention les fiches ne peuvent être chargé que dans la même session dans laquelle elle a été enregistré.");
                    }
                    break;

                default:
                    Console.WriteLine("Erreur dans la commande. Merci de retaper");
                    break;
                }
                Console.WriteLine("---------------Menu------------");
                Console.WriteLine("1. Créer une fiche de Jeu");
                Console.WriteLine("2. Charger les fiches local et les afficher");
                Console.WriteLine("3. Charger les fiches local et les afficher trié par categorie");
                Console.WriteLine("0. Quitter le programme");
                Console.WriteLine();
                Console.WriteLine("Choix : ");
                lu = Console.ReadLine();
                try
                {
                    luconvert = Convert.ToInt32(lu);
                }
                catch (Exception)
                {
                    Console.WriteLine("Erreur de parsing");
                }
            }
        }
コード例 #8
0
 int IStockage.ModifierUneFiche(FicheDeJeu nom)
 {
     throw new NotImplementedException();
 }
コード例 #9
0
 int IStockage.SupprimerUneFiche(FicheDeJeu nom)
 {
     throw new NotImplementedException();
 }
コード例 #10
0
 public int ModifierUneFiche(FicheDeJeu nom)
 {
     return(0);
 }
コード例 #11
0
 public int SupprimerUneFiche(FicheDeJeu nom)
 {
     return(0);
 }
コード例 #12
0
 public void StockerUneFiche(FicheDeJeu fiche)
 {
 }