public Strategies_t LoadFromString(string source) { XDocument document; using (XmlReader reader = XmlReader.Create(new StringReader(source))) { document = XDocument.Load(reader, LoadOptions.SetLineInfo | LoadOptions.PreserveWhitespace); } Strategies_t strategies = LoadStrategies(document); return(strategies); }
public Strategies_t Load(string path) { _log.DebugFormat("Attempting to load strategies from file '{0}'.", path); XDocument document = XDocument.Load(path, LoadOptions.SetLineInfo | LoadOptions.PreserveWhitespace); Strategies_t strategies = LoadStrategies(document); _log.DebugFormat("{0} strategies loaded from file '{1}'.", strategies.Count, path); return(strategies); }
public Strategy_t GetStrategyByName(string providerId, string name, bool resetStrategy) { Strategies_t strategies = _strategiesDictionary[providerId]; Strategy_t strategy = strategies[name]; if (resetStrategy) { strategy.Reset(); } return(strategy); }
private Strategies_t LoadStrategies(XDocument document) { XElement element = document.Element(AtdlNamespaces.core + "Strategies"); if (element == null) { throw ThrowHelper.New <Atdl4netException>(this, ErrorMessages.StrategiesLoadFailure); } ElementFactory factory = new ElementFactory(SchemaDefinitions.Strategies_t, typeof(Strategy_t)); factory.ClassDeserialized += new System.EventHandler <ClassDeserializedEventArgs>(OnStrategyDeserialized); Strategies_t strategies = (Strategies_t)factory.DeserializeElement(element); strategies.ResolveAll(); return(strategies); }
public Strategies_t Load(Stream stream) { _log.Debug("Attempting to load strategies from stream."); XDocument document; #if NET462 document = XDocument.Load(stream, LoadOptions.SetLineInfo | LoadOptions.PreserveWhitespace); #else using (XmlReader reader = XmlReader.Create(stream)) { document = XDocument.Load(reader, LoadOptions.SetLineInfo | LoadOptions.PreserveWhitespace); } #endif Strategies_t strategies = LoadStrategies(document); _log.DebugFormat("{0} strategies loaded from stream.", strategies.Count); return(strategies); }
public StrategyCollection(Strategies_t owner) { _owner = owner; }
public void Load(string providerId, string path) { Strategies_t strategies = _strategiesReader.Load(path); _strategiesDictionary[providerId] = strategies; }
public void Load(string providerId, Stream stream) { Strategies_t strategies = _strategiesReader.Load(stream); _strategiesDictionary[providerId] = strategies; }