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(); }
/// <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; } }
/// <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; }
/// <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; } }
/// <summary> /// Creation of the boardHandler /// </summary> private BoardHandler() { this.Board = XmlDataAccess.XMLDeserializeObject <Board>(Config.filePath_XmlBoard); }