Advertisement
fruffl

fruffi config

Aug 14th, 2011
155
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 6.83 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5.  
  6. namespace Fruffi.Bot
  7. {
  8.     struct ConfigsServer
  9.     {
  10.         private string   __Uri;
  11.         private int      __Port;
  12.         private string   __Password;
  13.  
  14.         public string Uri { get { return this.__Uri; } }
  15.         public int Port { get { return this.__Port; } }
  16.         public string Password { get { return this.__Password; } }
  17.  
  18.         public ConfigsServer(string uri, int port, string password)
  19.         {
  20.             this.__Uri = uri;
  21.             this.__Port = port;
  22.             this.__Password = password;
  23.         }
  24.     }
  25.  
  26.     struct ConfigsNick
  27.     {
  28.         private string   __Name;
  29.         private string   __Nick;
  30.         private string   __AltNick;
  31.         private string   __Ident;
  32.         private string   __Vhost;
  33.         private string   __Password;
  34.         private bool     __IsInvisble;
  35.         private bool     __IsAlternate;
  36.  
  37.         public string Name { get { return this.__Name; } }
  38.         public string Nick { get { return this.__Nick; } }
  39.         public string AltNick { get { return this.__AltNick; } }
  40.         public string Ident { get { return this.__Ident; } }
  41.         public string Vhost { get { return this.__Vhost; } }
  42.         public string Password { get { return this.__Password; } }
  43.         public bool isInvisible { get { return this.__IsInvisble; } set { this.__IsInvisble = value; } }
  44.         public bool isAlternate { get { return this.__IsAlternate; } set { this.__IsAlternate = value; } }
  45.  
  46.         public ConfigsNick
  47.         (
  48.             string name,
  49.             string nick,
  50.             string altnick,
  51.             string ident,
  52.             string vhost,
  53.             string password,
  54.             bool is_invisble,
  55.             bool is_alternate
  56.         )
  57.         {
  58.             this.__Name = name;
  59.             this.__Nick = nick;
  60.             this.__AltNick = altnick;
  61.             this.__Ident = ident;
  62.             this.__Vhost = vhost;
  63.             this.__Password = password;
  64.             this.__IsInvisble = is_invisble;
  65.             this.__IsAlternate = is_alternate;
  66.         }
  67.     }
  68.  
  69.     struct ConfigsSocket
  70.     {
  71.         private string   __Encoding;
  72.  
  73.         public string Encoding { get { return this.__Encoding; } }
  74.  
  75.         public ConfigsSocket(string encoding)
  76.         {
  77.             this.__Encoding = encoding;
  78.         }
  79.     }
  80.  
  81.     struct ConfigsHome
  82.     {
  83.         private string   __Channel;
  84.         private string   __Key;
  85.         private string   __Password;
  86.  
  87.         public string Channel { get { return this.__Channel; } }
  88.         public string Key { get { return this.__Key; } }
  89.         public string Password { get { return this.__Password; } }
  90.  
  91.         public ConfigsHome(string channel, string key, string password)
  92.         {
  93.             this.__Channel = channel;
  94.             this.__Key = key;
  95.             this.__Password = password;
  96.         }
  97.     }
  98.  
  99.     struct ConfigsAccess
  100.     {
  101.         private string __Password;
  102.  
  103.         public string Password { get { return this.__Password; } }
  104.  
  105.         public ConfigsAccess(string password)
  106.         {
  107.             this.__Password = password;
  108.         }
  109.     }
  110.  
  111.     struct ConfigsOwner
  112.     {
  113.         private string   __Nick;
  114.         private string   __Ident;
  115.         private string   __AltNick;
  116.         private string   __AltIdent;
  117.         private string   __Vhost;
  118.  
  119.         public string Nick { get { return this.__Nick; } set { this.__Nick = value; } }
  120.         public string Altnick { get { return this.__AltNick; } set { this.__AltNick = value; } }
  121.         public string Ident { get { return this.__Ident; } }
  122.         public string AltIdent { get { return this.__AltIdent; } }
  123.         public string Vhost { get { return this.__Vhost; } }
  124.  
  125.         public ConfigsOwner
  126.         (
  127.             string nick,
  128.             string ident,
  129.             string altnick,
  130.             string altident,
  131.             string vhost
  132.         )
  133.         {
  134.             this.__Nick = nick;
  135.             this.__Ident = ident;
  136.             this.__AltNick = altnick;
  137.             this.__AltIdent = altident;
  138.             this.__Vhost = vhost;
  139.         }
  140.     }
  141.  
  142.     class Configs
  143.     {
  144.         private ConfigsSocket __Socket;
  145.         private ConfigsServer   __Server;
  146.         private ConfigsNick     __Nick;
  147.         private ConfigsHome     __Home;
  148.         private ConfigsAccess   __Access;
  149.         private ConfigsOwner    __Owner;
  150.  
  151.         public ConfigsSocket Socket { get { return this.__Socket; } }
  152.         public ConfigsServer Server { get { return this.__Server; } }
  153.         public ConfigsNick Nick { get { return this.__Nick; } }
  154.         public ConfigsHome Home { get { return this.__Home; } }
  155.         public ConfigsAccess Access { get { return this.__Access; } }
  156.         public ConfigsOwner Owner { get { return this.__Owner; } }
  157.  
  158.         public Configs()
  159.         {
  160.             this.loadManifest();
  161.         }
  162.  
  163.         private void loadManifest()
  164.         {
  165.             this.__Socket = new ConfigsSocket
  166.                 (
  167.                     Properties.Settings.Default.__socketEncoding
  168.                 );
  169.  
  170.             this.__Server = new ConfigsServer
  171.                 (
  172.                     Properties.Settings.Default.__serverUri,
  173.                     Properties.Settings.Default.__serverPort,
  174.                     Properties.Settings.Default.__serverPassword
  175.                 );
  176.  
  177.             this.__Nick = new ConfigsNick
  178.                 (
  179.                     Properties.Settings.Default.__nickName,
  180.                     Properties.Settings.Default.__nickNick,
  181.                     Properties.Settings.Default.__nickAlternate,
  182.                     Properties.Settings.Default.__nickIdent,
  183.                     Properties.Settings.Default.__nickVhost,
  184.                     Properties.Settings.Default.__nickPassword,
  185.                     Properties.Settings.Default.__nickIsInvisible,
  186.                     Properties.Settings.Default.__nickIsAlternate
  187.                  );
  188.  
  189.             this.__Home = new ConfigsHome
  190.                 (
  191.                     Properties.Settings.Default.__homeChannel,
  192.                     Properties.Settings.Default.__homeKey,                
  193.                     Properties.Settings.Default.__homePassword
  194.                 );
  195.  
  196.             this.__Access = new ConfigsAccess
  197.                 (
  198.                     Properties.Settings.Default.__accessPassword
  199.                 );
  200.  
  201.             this.__Owner = new ConfigsOwner
  202.                 (
  203.                     Properties.Settings.Default.__ownerNick,
  204.                     Properties.Settings.Default.__ownerIdent,
  205.                     Properties.Settings.Default.__ownerNickAlternate,
  206.                     Properties.Settings.Default.__ownerIdentAlternate,
  207.                     Properties.Settings.Default.__ownerVhost
  208.                 );
  209.         }
  210.     }
  211. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement