/// <summary> /// Creates a new feed from a source component, a destination component, and an /// option. /// </summary> /// <param name="source">The source box</param> /// <param name="destination">The destination box</param> /// <param name="option">The option to use. All or Last.</param> public KastFeed(KastComponent source, KastBox destination, KastFeedOption option) { Source = source; Destination = destination; Option = option; Name = ""; }
/// <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 (); } }
/// <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 (); } }
/// <summary> /// Removes the component from the list of Active Components. /// </summary> /// <param name="component">The component to remove from the system</param> public void RemoveComponent(KastComponent component) { if (component is KastBox) ActiveBoxes.Remove (component as KastBox); else if (component is KastFeed) Feeds.Remove(component as KastFeed); else if (component is KastHook) Hooks.Remove (component as KastHook); Components.Remove (component); }
/// <summary> /// Add a new KastComponent to the list of active components /// </summary> /// <param name="component">The component to add</param> public void AddComponent(KastComponent component) { if (component is KastBox) ActiveBoxes.Add (component as KastBox); else if (component is KastFeed) Feeds.Add (component as KastFeed); else if (component is KastHook) Hooks.Add (component as KastHook); Components.Add (component); Log.Log (MasterConfig.Get("message_added")); }
/// <summary> /// Make the Source the Destination, and vice-versa /// </summary> public void Flip() { if (Source is KastFuture || Destination is KastFuture) return; var temp = Source as KastBox; Source = Destination; Destination = temp; }