コード例 #1
0
ファイル: Program.cs プロジェクト: kainoj/oop
        static void Main(string[] args)
        {
            Invoker invoker = new Invoker();

            invoker.Enqueue(new HttpCommand(new GetHttp()), new string[] { "wp.pl" });
            invoker.Enqueue(new FtpCommand(new GetFtp()), new string[] { "8.8.8.8" });
            invoker.Enqueue(new CopyFileCommand(new CopyFile()), new string[] { "a.txt", "b.txt" });

            invoker.Dequeue();
            invoker.Dequeue();
            invoker.Dequeue();

            Console.WriteLine("=================");

            Console.WriteLine("\n> XML pasrse using a TEMPLATE pattern");

            DataAccessHandler xml = new XmlDataAccess();

            xml.Execute();

            // Requires a Posgress DB
            // DataAccessHandler db = new DbDataAccess();
            // db.Execute();
            Console.WriteLine("\n> XML pasrse using a STRATEGY pattern");
            XmlDataContext xml2 = new XmlDataContext(new XmlStrategy());

            xml2.Execute();
        }
コード例 #2
0
 /// <summary>
 /// Create new instance of EpisodeManager
 /// </summary>
 private FactManager()
 {
     try
     {
         this.Facts       = XmlDataAccess.XMLDeserializeObject <Facts>(Config.filePath_XmlFacts);
         this.CurrentFact = this.Facts.Stereotypes[0];
     }
     catch (Exception exp)
     {
         Console.WriteLine(string.Format("Une erreur est survenu lors de la déserialisation ! {0}", exp.Message));
         this.CurrentFact = null;
     }
 }
コード例 #3
0
        /// <summary>
        /// Cration du gestionnaire de carte
        /// </summary>
        private CardHandler()
        {
            DeckCommunity = new Deck();
            DeckCommunity = XmlDataAccess.XMLDeserializeObject <Deck>(Config.filePath_XmlCommunityCard);
            Tools.Shuffle <Card>(DeckCommunity.Cards);

            DeckChance = new Deck();
            DeckChance = XmlDataAccess.XMLDeserializeObject <Deck>(Config.filePath_XmlChanceCard);
            Tools.Shuffle <Card>(DeckChance.Cards);

            _PlayerHandler = PlayerHandler.Instance;
            _BoardHandler  = BoardHandler.Instance;
            CurrentCard    = null;
        }
コード例 #4
0
ファイル: EpisodeManager.cs プロジェクト: tonybloc/cnam-mania
 /// <summary>
 /// Create new instance of EpisodeManager
 /// </summary>
 private EpisodeManager()
 {
     try
     {
         this.Serie          = XmlDataAccess.XMLDeserializeObject <Serie>(Config.filePath_XmlStory);
         this.CurrentEpisode = this.Serie.Episodes[0];
         this.CurrentStory   = this.CurrentEpisode.Stories[0];
     }
     catch (Exception exp)
     {
         Console.WriteLine(string.Format("Une erreur est survenu lors de la déserialisation ! {0}", exp.Message));
         this.CurrentEpisode = null;
         this.CurrentStory   = null;
     }
 }
コード例 #5
0
 /// <summary>
 /// Creation of the boardHandler
 /// </summary>
 private BoardHandler()
 {
     this.Board = XmlDataAccess.XMLDeserializeObject <Board>(Config.filePath_XmlBoard);
 }