Exemplo n.º 1
0
        /// <summary>
        /// Initialize the Program given an IP Adress and a port.
        /// </summary>
        /// <param name="address">The address to listen to</param>
        /// <param name="port">The port to listen to</param>
        public Program(KastConfiguration master, Logger logger)
        {
            MainServitor = new Servitor (IPAddress.Parse(master.Get("server_address")),
                int.Parse(master.Get("server_port")));
            Log = logger;
            MasterConfig = master;
            Relay = new KastRelay (master, logger);

            // Tick delay is read in seconds
            TickDelay = (int) double.Parse(master.Get("settings_tick_delay"))*(1000);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Create a new KastFeed from a source, destination, and configuration
        /// </summary>
        /// <param name="source">The source box</param>
        /// <param name="destination">The destination box</param>
        /// <param name="config">The configuratin</param>
        public KastFeed(KastComponent source, KastComponent destination, KastConfiguration config)
        {
            Source = source;
            Destination = destination;

            try {
                Option = BuildKastFeedOption(config.Get("option"));
                Name = config.Get("name");
            }catch(Exception e){
                Defaults ();
            }
        }
Exemplo n.º 3
0
 /// <summary>
 /// Build a KastHook using a KastConfiguration
 /// </summary>
 /// <param name="box">The box to capture.</param> 
 /// <param name="target">The string that will make this hook fire</param>
 /// <param name="config">Configuration assets, such as name and option.</param>
 public KastHook(KastComponent box, string target, KastConfiguration config, KastConfiguration masterConfig)
 {
     Box = box;
     Target = target;
     MasterConfig = masterConfig;
     Log = new Logger (masterConfig.Get("log"));
     try {
         Option = this.BuildKastHookOption(config.Get("option"));
         Name = config.Get("name");
     }catch(Exception e){
         Defaults ();
     }
 }
Exemplo n.º 4
0
        /// <summary>
        /// Build the Box using a process name and configuration
        /// </summary>
        /// <param name="procName">The name of the process</param>
        /// <param name="kc">The KastConfiguration for this Box. Accepts: args, name</param>
        public KastBox(string procName, KastConfiguration kc, KastConfiguration masterConfig, Logger log)
        {
            ProcessName = procName;
            MasterConfig = masterConfig;
            Buffer = new List<string> ();
            ProcessArguments = new List<string> ();
            Log = log;
            try{
                if(kc.Has("args"))
                    ProcessArguments = Sections.EscapeSplit(kc.Get("args"), ',');

                Name = kc.Get("name");
            }catch(Exception e){
                Defaults ();
            }
        }
Exemplo n.º 5
0
        /// <summary>
        /// Makes a KastHook using an existing Box and a string target.
        /// </summary>
        /// <param name="box">Box.</param>
        /// <param name="target">Target.</param>
        /// <param name="option">The option to use</param> 
        public KastHook(KastBox box, string target, KastHookOption option, KastConfiguration masterConfig)
        {
            Box = box;
            Target = target;
            Option = option;

            Name = "";

            MasterConfig = masterConfig;
            Log = new Logger (masterConfig.Get("log"));
        }
Exemplo n.º 6
0
        /// <summary>
        /// Until the project is mature, I will be using this to test the program
        /// </summary>
        public static void Test()
        {
            //*
            KastConfiguration master = new KastConfiguration ();
            master = new KastConfiguration(KastConfiguration.DefaultConfiguration ());

            Logger log = new Logger (master.Get("server_log"));

            Kast.Server.Program server = new Kast.Server.Program (master, log);
            Kast.Client.Program client = new Kast.Client.Program (master, log);

            // The server is running now
            new Thread (new ThreadStart (server.Start)).Start ();

            client.SendData ("box gshfdkgj sdgfjk");

            Console.WriteLine ("Successful test");
            //*/
        }
Exemplo n.º 7
0
 /// <summary>
 /// Create a new Server, listening to the
 /// default port of 4206.
 /// <param name="master">The master configuration to use</param>
 /// </summary>
 public Program(KastConfiguration master)
 {
     MainServitor = new Servitor();
     Relay = new KastRelay(master, new Logger(master.Get("log")));
     TickDelay = 1000;
 }