예제 #1
0
 public override void Dispose()
 {
     _dataSourceId          = ComponentId.Empty;
     _orderExectionSourceId = ComponentId.Empty;
     _manager = null;
     base.Dispose();
 }
예제 #2
0
        public virtual void Dispose()
        {
            //if (_tradeEntities != null)
            //{
            //    _tradeEntities.UnInitialize();
            //    _tradeEntities = null;
            //}

            if (_statistics != null)
            {
                _statistics.Dispose();
                _statistics = null;
            }

            _dataDelivery = null;
            _manager      = null;

            if (_provider != null)
            {
                _provider.AccountInfoUpdateEvent       -= new AccountInfoUpdateDelegate(_provider_AccountInfoUpdateEvent);
                _provider.OperationalStateChangedEvent -= new OperationalStateChangedDelegate(_provider_OperationalStatusChangedEvent);

                _provider = null;
            }
        }
예제 #3
0
        /// <summary>
        /// Runs the plugin stage with the specififed type
        /// </summary>
        /// <param name="type"></param>
        /// <param name="stage">The stage of the current processing</param>
        /// <param name="script">the script to be processed</param>
        /// <param name="sourceManager"></param>
        /// <param name="defTable">the definitions that are used</param>
        /// <returns>True if the operation completed successfully</returns>
        private bool RunPluginStage(PluginType type, ProcessStage stage, ISourceScript script,
                                    ISourceManager sourceManager, IDefinitions defTable)
        {
            List <AbstractPlugin> chain = AbstractPlugin.GetPluginsForStage(plugins, type, stage);


            bool ret = true;

            if (type == PluginType.FullScriptPlugin)
            {
                ret = RunFullScriptStage(chain, stage, script, sourceManager, defTable);
            }
            else if (type == PluginType.LinePluginBefore || type == PluginType.LinePluginAfter)
            {
                string[] src = script.GetSource();
                RunLineStage(chain, stage, src);
                script.SetSource(src);
            }
            if (!ret)
            {
                return(false);
            }


            return(true);
        }
예제 #4
0
 /// <summary>
 ///     Gets called once on each file.
 ///     Looping Through All the Files
 ///     Looping Through All the plugins
 /// </summary>
 /// <param name="script">the current source script</param>
 /// <param name="sourceManager">the current source manager</param>
 /// <param name="defTable">the current definitions</param>
 /// <returns>state of the process(if false will abort processing)</returns>
 public virtual bool OnLoad_FullScriptStage(
     ISourceScript script,
     ISourceManager sourceManager,
     IDefinitions defTable)
 {
     return(true);
 }
예제 #5
0
 /// <summary>
 ///     Gets called once on each file.
 ///     Looping Through All the Files
 ///     Looping Through All the plugins
 /// </summary>
 /// <param name="script">the current source script</param>
 /// <param name="sourceManager">the current source manager</param>
 /// <param name="defTable">the current definitions</param>
 /// <returns>state of the process(if false will abort processing)</returns>
 public override bool OnMain_FullScriptStage(
     ISourceScript script,
     ISourceManager sourceManager,
     IDefinitions defTable)
 {
     return(FullScriptStage(script, sourceManager, defTable));
 }
예제 #6
0
        public SourcesViewModel(ISourceManager sourceManager) : base("sources")
        {
            DisplayName = "Sources";

            Metadata = MappingCollection.Create(sourceManager.Metadata, source => new MetadataSourceViewModel(source));
            Content  = MappingCollection.Create(sourceManager.Content, source => new ContentSourceViewModel(source));
        }
예제 #7
0
        /// <summary>
        /// </summary>
        /// <param name="fullScriptStage">The chain for this stage</param>
        /// <param name="stage">The stage of the current processing</param>
        /// <param name="script">The script to operate on</param>
        /// <param name="sourceManager">The sourcemanager used.</param>
        /// <param name="defTable">The definitions used</param>
        /// <returns></returns>
        private bool RunFullScriptStage(
            List <AbstractPlugin> fullScriptStage, ProcessStage stage, ISourceScript script,
            ISourceManager sourceManager, IDefinitions defTable)
        {
            foreach (AbstractPlugin abstractPlugin in fullScriptStage)
            {
                bool ret = true;
                Logger.Log(LogType.Log, $"Running Plugin: {abstractPlugin}", 4);
                if (stage == ProcessStage.OnLoadStage)
                {
                    ret = abstractPlugin.OnLoad_FullScriptStage(script, sourceManager, defTable);
                }
                else if (stage == ProcessStage.OnMain)
                {
                    ret = abstractPlugin.OnMain_FullScriptStage(script, sourceManager, defTable);
                }

                if (!ret)
                {
                    Logger.Log(LogType.Error, $"Processing was aborted by Plugin: {abstractPlugin}", 1);
                    return(false);
                }
            }

            return(true);
        }
예제 #8
0
        public override bool FullScriptStage(ISourceScript file, ISourceManager sourceManager, IDefinitions defs)
        {
            if (!file.HasValueOfType <string[]>("genParams"))
            {
                return(true); //No error, we just dont have any generic parameters to replace.
            }

            string[] genParams = file.GetValueFromCache <string[]>("genParams");

            Logger.Log(PPLogType.Log, Verbosity.Level5, "Discovering Generic Keywords...");
            if (genParams != null && genParams.Length > 0)
            {
                for (int i = genParams.Length - 1; i >= 0; i--)
                {
                    Logger.Log(PPLogType.Log, Verbosity.Level6, "Replacing Keyword {0}{1} with {2} in file {3}",
                               GenericKeyword, i, genParams[i], file.GetKey());
                    Utils.ReplaceKeyWord(file.GetSource(), genParams[i],
                                         GenericKeyword + i);
                }
            }


            Logger.Log(PPLogType.Log, Verbosity.Level5, "Generic Keyword Replacement Finished");

            return(true);
        }
예제 #9
0
        /// <summary>
        ///     Runs the specified stage on the passed script
        /// </summary>
        /// <param name="stage">The stage of the current processing</param>
        /// <param name="script">the script to be processed</param>
        /// <param name="sourceManager"></param>
        /// <param name="defTable">the definitions that are used</param>
        /// <returns></returns>
        private static bool RunStages(
            PreProcessor pp,
            ProcessStage stage,
            ISourceScript script,
            ISourceManager sourceManager,
            IDefinitions defTable)
        {
            if (!pp.RunPluginStage(PluginType.LinePluginBefore, stage, script, sourceManager, defTable))
            {
                return(false);
            }

            if (stage != ProcessStage.OnFinishUp &&
                !pp.RunPluginStage(PluginType.FullScriptPlugin, stage, script, sourceManager, defTable))
            {
                return(false);
            }

            if (!pp.RunPluginStage(PluginType.LinePluginAfter, stage, script, sourceManager, defTable))
            {
                return(false);
            }

            return(true);
        }
예제 #10
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="fullScriptStage">The chain for this stage</param>
        /// <param name="stage">The stage of the current processing</param>
        /// <param name="script">The script to operate on</param>
        /// <param name="sourceManager">The sourcemanager used.</param>
        /// <param name="defTable">The definitions used</param>
        /// <returns></returns>
        private bool RunFullScriptStage(List <AbstractPlugin> fullScriptStage, ProcessStage stage, ISourceScript script,
                                        ISourceManager sourceManager, IDefinitions defTable)
        {
            foreach (AbstractPlugin abstractPlugin in fullScriptStage)
            {
                bool ret = true;
                Logger.Log(PPLogType.Log, Verbosity.Level3, "Running Plugin: {0}: {1} on file {2}", abstractPlugin,
                           stage, Path.GetFileName(script.GetFileInterface().GetKey()));
                if (stage == ProcessStage.OnLoadStage)
                {
                    ret = abstractPlugin.OnLoad_FullScriptStage(script, sourceManager, defTable);
                }
                else if (stage == ProcessStage.OnMain)
                {
                    ret = abstractPlugin.OnMain_FullScriptStage(script, sourceManager, defTable);
                }

                if (!ret)
                {
                    Logger.Log(PPLogType.Error, Verbosity.Level1, "Processing was aborted by Plugin: {0}",
                               abstractPlugin);
                    return(false);
                }
            }

            return(true);
        }
예제 #11
0
 public LibraryPageItemViewModel(IMetadata data, ISourceManager sourceManager, ReaderViewModel.Factory readerFactory, Conductor <TabViewModelBase> .Collection.OneActive conductor)
 {
     this.data          = data;
     this.readerFactory = readerFactory;
     this.conductor     = conductor;
     sourceManager.ConsumeAsync(data.Cover, SetCover);
 }
예제 #12
0
 /// <summary>
 ///
 /// </summary>
 public virtual void Dispose()
 {
     _manager           = null;
     _executionProvider = null;
     _quoteProvider     = null;
     _dataSourceId      = ComponentId.Empty;
 }
예제 #13
0
        public static void Register(ISourceManager sourceManager, IServiceLocator serviceLocator)
        {
            #region YahooServiceRegistery
            var YahooSourceName = typeof(ExchangeInterfaceYahoo).FullName;
            var sourceYahoo     = sourceManager.GetSourceByName(YahooSourceName);
            if (sourceYahoo == null)
            {
                sourceManager.AddSource(new XeGatewaySource()
                {
                    Active          = true,
                    AdditionalParms = "",
                    Endpoint        = "",
                    Name            = YahooSourceName
                });
            }
            serviceLocator.AddService((IXeService)Activator.CreateInstance(typeof(ExchangeInterfaceYahoo)));
            #endregion

            #region OandaServiceRegistery
            var OandaSourceName = typeof(ExchangeInterfaceOanda).FullName;
            var sourceOanda     = sourceManager.GetSourceByName(OandaSourceName);
            if (sourceOanda == null)
            {
                sourceManager.AddSource(new XeGatewaySource()
                {
                    Active          = true,
                    AdditionalParms = "",
                    Endpoint        = "",
                    Name            = OandaSourceName
                });
            }
            serviceLocator.AddService((IXeService)Activator.CreateInstance(typeof(ExchangeInterfaceOanda)));
            #endregion
        }
예제 #14
0
        public override bool FullScriptStage(ISourceScript file, ISourceManager sourceManager, IDefinitions defs)
        {
            if (!file.HasValueOfType <string[]>("genParams"))
            {
                return(true); //No error, we just dont have any generic parameters to replace.
            }

            string[] genParams = file.GetValueFromCache <string[]>("genParams");

            Logger.Log(LogType.Log, "Discovering Generic Keywords...", PLUGIN_MIN_SEVERITY);
            if (genParams != null && genParams.Length > 0)
            {
                for (int i = genParams.Length - 1; i >= 0; i--)
                {
                    Logger.Log(LogType.Log,
                               $"Replacing Keyword {GenericKeyword}{i} with {genParams[i]} in file {file.GetKey()}",
                               PLUGIN_MIN_SEVERITY + 1);
                    Utils.ReplaceKeyWord(file.GetSource(), genParams[i],
                                         GenericKeyword + i);
                }
            }


            Logger.Log(LogType.Log, "Generic Keyword Replacement Finished", PLUGIN_MIN_SEVERITY);

            return(true);
        }
예제 #15
0
 /// <summary>
 ///
 /// </summary>
 public PassiveOrder(ISourceManager manager, ComponentId dataSourceId, ComponentId orderExecutionSourceId)
 {
     SystemMonitor.CheckError(dataSourceId.IsEmpty == false && orderExecutionSourceId.IsEmpty == false, "Source Id not available to order.");
     _manager               = manager;
     _dataSourceId          = dataSourceId;
     _orderExectionSourceId = orderExecutionSourceId;
     _executionProvider     = manager.ObtainOrderExecutionProvider(orderExecutionSourceId, dataSourceId);
 }
예제 #16
0
 /// <summary>
 /// 
 /// </summary>
 public PassiveOrder(ISourceManager manager, ComponentId dataSourceId, ComponentId orderExecutionSourceId)
 {
     SystemMonitor.CheckError(dataSourceId.IsEmpty == false && orderExecutionSourceId.IsEmpty == false, "Source Id not available to order.");
     _manager = manager;
     _dataSourceId = dataSourceId;
     _orderExectionSourceId = orderExecutionSourceId;
     _executionProvider = manager.ObtainOrderExecutionProvider(orderExecutionSourceId, dataSourceId);
 }
예제 #17
0
 public StatisticController(StatisticManagerBase statisticManagerParam, ExtremumsManagerBase managerExParam,
                            ISourceManager sourceManagerParam, ICategoryManager categoryManagerParam, ICurrencyManager currencyManagerParam)
 {
     _statisticManager = statisticManagerParam;
     _managerEx        = managerExParam;
     _sourceManager    = sourceManagerParam;
     _categoryManager  = categoryManagerParam;
     _currencyManager  = currencyManagerParam;
 }
예제 #18
0
 public OperationController(AddOperationProcessorBase operatorProcessorParam, ISourceManager sourceManagerParam,
                            ICurrencyManager currencyManagerParam, ICategoryManager categoryManagerParam, IOperationManager operationManagerParam)
 {
     _operatorProcessor = operatorProcessorParam;
     _sourceManager     = sourceManagerParam;
     _currencyManager   = currencyManagerParam;
     _categoryManager   = categoryManagerParam;
     _operationManager  = operationManagerParam;
 }
예제 #19
0
        public bool FullScriptStage(ISourceScript file, ISourceManager todo, IDefinitions defs)
        {
            List <string> source = file.GetSource().ToList();

            foreach (var breakpoint in _breakpoints)
            {
                for (lineCount = 0; lineCount < source.Count; lineCount++)
                {
                    if (isBreaking)
                    {
                        do
                        {
                            this.Log(DebugLevel.LOGS, Verbosity.LEVEL1, "Type -dbg-continue to contine processing\nType -dbg-exit to exit the program\nType -dbg-file to list the current file from line you set the breakpoint\n-dbg-file-all to list the whole file\n-dbg-dump <pathtofile> dumps the current file source.\n-dbg-add-bp <breakpointstring>");
                            string getInput = Console.ReadLine();
                            if (getInput == "-dbg-continue")
                            {
                                isBreaking = false;
                                return(true);
                            }
                            else if (getInput == "-dbg-exit")
                            {
                                return(false);
                            }
                            else if (getInput == "-dbg-file")
                            {
                                source.TakeLast(source.Count - lineCount).ToList().ForEach(Console.WriteLine);
                            }
                            else if (getInput == "-dbg-file-all")
                            {
                                source.ForEach(Console.WriteLine);
                            }
                            else if (getInput.StartsWith("-dbg-dump "))
                            {
                                string ff = getInput.Split(" ")[1];
                                if (ff != "")
                                {
                                    File.WriteAllLines(ff, source);
                                }
                            }
                            else if (getInput.StartsWith("-dbg-add-bp "))
                            {
                                Breakpoint[] ff = Breakpoint.Parse(getInput.Split(" "), this);
                                _breakpoints.AddRange(ff);
                            }
                        } while (isBreaking);
                    }
                    if (breakpoint.Break(lineCount, file.GetKey()))
                    {
                        isBreaking = true;
                    }
                }
            }



            return(true);
        }
 public PersAccounantAddOperationProcessor(ICategoryManager categoryManagerParam, ISourceManager sourceManagerParam,
                                           ICurrencyManager currencyManagerParam,
                                           IDBManager dbManagerParam)
     : base(dbManagerParam)
 {
     _categoryManager = categoryManagerParam;
     _sourceManager   = sourceManagerParam;
     _currencyManager = currencyManagerParam;
 }
예제 #21
0
        /// <summary>
        /// Initializing all Plugins with the settings, definitions and the source manager for this compilation
        /// </summary>
        /// <param name="settings">The settings used</param>
        /// <param name="def">Definitions used</param>
        /// <param name="sourceManager">Sourcemanager used</param>
        private void InitializePlugins(Settings settings, IDefinitions def, ISourceManager sourceManager)
        {
            this.Log(DebugLevel.LOGS, Verbosity.LEVEL1, "Initializing Plugins...");
            foreach (var plugin in _plugins)
            {
                this.Log(DebugLevel.LOGS, Verbosity.LEVEL2, "Initializing Plugin: {0}", plugin.GetType().Name);

                plugin.Initialize(settings.GetSettingsWithPrefix(plugin.Prefix, plugin.IncludeGlobal), sourceManager, def);
            }
        }
예제 #22
0
        /// <summary>
        /// Constructor, allows direct order initialization.
        /// </summary>
        /// <param name="session"></param>
        /// <param name="initialize">Initialize order on construction. If init fails, exception will occur.</param>
        public ActiveOrder(ISourceManager manager, ISourceOrderExecution executionProvider,
                           ComponentId dataSourceId, bool initialize)
            : base(manager, executionProvider, dataSourceId)
        {
            State = OrderStateEnum.UnInitialized;

            if (initialize)
            {
                SystemMonitor.CheckThrow(Initialize());
            }
        }
예제 #23
0
        private bool GetISourceScript(
            ISourceManager manager,
            string statement,
            string currentPath,
            bool isInline,
            out List <ISourceScript> scripts)
        {
            string[] vars = Utils.SplitAndRemoveFirst(statement, Separator);

            scripts = new List <ISourceScript>();

            if (vars.Length != 0)
            {
                ImportResult importInfo = manager.GetComputingScheme()(vars, currentPath);

                if (!importInfo)
                {
                    Logger.Log(LogType.Error, "Invalid Include Statement", 1);

                    return(false);
                }

                string filepath = importInfo.GetString("filename");
                importInfo.RemoveEntry("filename");
                string key = importInfo.GetString("key");
                importInfo.RemoveEntry("key");
                string originalDefinedName = importInfo.GetString("definedname");
                importInfo.RemoveEntry("definedname");

                IFileContent cont = new FilePathContent(filepath, originalDefinedName);
                cont.SetKey(key);

                if (manager.TryCreateScript(out ISourceScript iss, Separator, cont, importInfo, isInline))
                {
                    scripts.Add(iss);
                }

                for (int index = scripts.Count - 1; index >= 0; index--)
                {
                    ISourceScript sourceScript = scripts[index];

                    if (sourceScript.GetFileInterface().HasValidFilepath&&
                        !Utils.FileExistsRelativeTo(currentPath, sourceScript.GetFileInterface()))
                    {
                        Logger.Log(LogType.Error, $"Could not find File: {sourceScript.GetFileInterface()}", 1);
                        scripts.RemoveAt(index);
                    }
                }

                return(true);
            }

            return(false);
        }
예제 #24
0
        /// <summary>
        /// Initializing all Plugins with the settings, definitions and the source manager for this compilation
        /// </summary>
        /// <param name="settings">The settings used</param>
        /// <param name="def">Definitions used</param>
        /// <param name="sourceManager">Sourcemanager used</param>
        private void InitializePlugins(Settings settings, IDefinitions def, ISourceManager sourceManager)
        {
            Logger.Log(LogType.Log, "Initializing Plugins...", 2);
            foreach (AbstractPlugin plugin in plugins)
            {
                Logger.Log(LogType.Log, $"Initializing Plugin: {plugin.GetType().Name}", 3);

                plugin.Initialize(settings.GetSettingsWithPrefix(plugin.Prefix, plugin.IncludeGlobal), sourceManager,
                                  def);
            }
        }
예제 #25
0
        public MemoryReaderCache(IReadOnlyList <Uri> pages, ISourceManager sourceManager)
        {
            items        = pages.Select(p => new CacheItem(sourceManager, p)).ToList();
            currentIndex = 0;

            // always start the first 3 pages on construction
            // this allows for smooth navigation right off the bat
            Start(0);
            Start(1);
            Start(2);
        }
예제 #26
0
        /// <summary>
        /// Constructor, allows direct order initialization.
        /// </summary>
        /// <param name="session"></param>
        /// <param name="initialize">Initialize order on construction. If init fails, exception will occur.</param>
        public ActiveOrder(ISourceManager manager, ISourceOrderExecution executionProvider,
            ComponentId dataSourceId, bool initialize)
            : base(manager, executionProvider, dataSourceId)
        {
            State = OrderStateEnum.UnInitialized;

            if (initialize)
            {
                SystemMonitor.CheckThrow(Initialize());
            }
        }
예제 #27
0
        /// <summary>
        /// Initializing all Plugins with the settings, definitions and the source manager for this compilation
        /// </summary>
        /// <param name="settings">The settings used</param>
        /// <param name="def">Definitions used</param>
        /// <param name="sourceManager">Sourcemanager used</param>
        private void InitializePlugins(Settings settings, IDefinitions def, ISourceManager sourceManager)
        {
            Logger.Log(PPLogType.Log, Verbosity.Level1, "Initializing Plugins...");
            foreach (AbstractPlugin plugin in plugins)
            {
                Logger.Log(PPLogType.Log, Verbosity.Level2, "Initializing Plugin: {0}", plugin.GetType().Name);

                plugin.Initialize(settings.GetSettingsWithPrefix(plugin.Prefix, plugin.IncludeGlobal), sourceManager,
                                  def);
            }
        }
예제 #28
0
        private bool GetISourceScript(ISourceManager manager, string statement, string currentPath, out List <ISourceScript> scripts)
        {
            var vars = Utils.SplitAndRemoveFirst(statement, Separator);

            //genParams = new string[0];
            scripts = new List <ISourceScript>();
            if (vars.Length != 0)
            {
                //filePath = vars[0];
                if (!manager.GetComputingScheme()(vars, currentPath, out var filepath, out var key, out var pluginCache))
                {
                    this.Log(DebugLevel.ERRORS, Verbosity.LEVEL1, "Invalid Include Statement");
                    return(false);
                }


                if (filepath.EndsWith("\\*") || filepath.EndsWith("/*"))
                {
                    string[] files = Directory.GetFiles(filepath.Substring(0, filepath.Length - 2));
                    foreach (var file in files)
                    {
                        if (manager.CreateScript(out ISourceScript iss, Separator, file, key.Replace(filepath, file), pluginCache))
                        {
                            scripts.Add(iss);
                        }
                    }
                }
                else
                {
                    if (manager.CreateScript(out ISourceScript iss, Separator, filepath, key, pluginCache))
                    {
                        scripts.Add(iss);
                    }
                }


                for (var index = scripts.Count - 1; index >= 0; index--)
                {
                    var sourceScript = scripts[index];
                    if (!Utils.FileExistsRelativeTo(currentPath, sourceScript.GetFilePath()))
                    {
                        this.Log(DebugLevel.ERRORS, Verbosity.LEVEL1, "Could not find File: {0}", currentPath);
                        scripts.RemoveAt(index);
                    }
                }


                return(true);
            }


            return(false);
        }
예제 #29
0
        /// <summary>
        ///
        /// </summary>
        public bool SetInitialParameters(ISourceManager manager,
                                         ISourceOrderExecution provider,
                                         ISourceDataDelivery dataDelivery, Symbol symbol)
        {
            _manager       = manager;
            _orderProvider = provider;
            _dataDelivery  = dataDelivery;

            _info.Symbol = symbol;

            return(true);
        }
예제 #30
0
        public bool SetInitialParameters(ISourceManager manager, ComponentId sourceSourceId, ExpertSession session)
        {
            _manager = manager;

            _sessionInfo = session.Info;

            _sourceDataDelivery = manager.ObtainDataDelivery(sourceSourceId);
            //_sourceDataDelivery.OperationalStateChangedEvent += new OperationalStateChangedDelegate(_sourceDataDelivery_OperationalStateChangedEvent);

            StatusSynchronizationSource = _sourceDataDelivery;

            return(true);
        }
예제 #31
0
        /// <summary>
        /// Initialize execution account with its owner provider.
        /// </summary>
        /// <param name="session"></param>
        public bool SetInitialParameters(ISourceManager manager, ISourceOrderExecution orderExecutionProvider, ISourceDataDelivery dataDelivery)
        {
            SystemMonitor.CheckError(_provider == null, "Order account already initialized.");

            _manager = manager;
            //why is the provider not ready
            _provider     = orderExecutionProvider;
            _dataDelivery = dataDelivery;

            SystemMonitor.CheckWarning(_manager != null && _provider != null && _dataDelivery != null, "Account not properly initialized.");

            return(true);
        }
예제 #32
0
 public EventHandler(IEventManager eventManager, ISourceManager sourceManager, ITextManager textManager,
                     ICallManager callManager, IVoiceService voiceService, IBlobManager blobManager, ITelephonyHandler telephonyHandler)
 {
     _eventManager     = eventManager;
     _sourceManager    = sourceManager;
     _textManager      = textManager;
     _callManager      = callManager;
     _voiceService     = voiceService;
     _blobManager      = blobManager;
     _telephonyHandler = telephonyHandler;
     _textConverter    = new TemplateToTextConverter();
     _audioConverter   = new AudioFileConverter();
 }
예제 #33
0
파일: Assets.cs 프로젝트: Santas/NodeAssets
        public Assets(IAssetsConfiguration config)
        {
            if (config.CompilerConfiguration == null) { throw new ArgumentException("The compilers were not configured"); }
            if (config.SourceConfiguration == null) { throw new ArgumentException("The sources were not configured"); }

            _config = config;
            _jsManager = config.SourceConfiguration.GetSourceManager(".js");
            _cssManager = config.SourceConfiguration.GetSourceManager(".css");

            if(config.RouteHandlerFunction == null)
            {
                _routeHandler = (pile, file) => new DefaultRouteHandler(pile, file, config);
            }
            else
            {
                _routeHandler = (pile, file) => config.RouteHandlerFunction(pile, file, config);
            }
        }
예제 #34
0
        /// <summary>
        /// Constructor, allows direct order initialization.
        /// </summary>
        /// <param name="session"></param>
        /// <param name="initialize">Initialize order on construction. If init fails, exception will occur.</param>
        public ActiveOrder(ISourceManager manager, ISourceOrderExecution executionProvider,
            IQuoteProvider quoteProvider, ComponentId dataSourceId, Symbol symbol, bool initialize)
        {
            _manager = manager;
            _symbol = symbol;

            _dataSourceId = dataSourceId;

            _executionProvider = executionProvider;
            _quoteProvider = quoteProvider;

            State = OrderStateEnum.UnInitialized;

            if (initialize)
            {
                SystemMonitor.CheckThrow(Initialize());
            }
        }
예제 #35
0
 /// <summary>
 /// 
 /// </summary>
 public override void Dispose()
 {
     _manager = null;
     _quoteProvider = null;
     _executionProvider = null;
 }
예제 #36
0
    private void listSources_SelectedIndexChanged(object sender, EventArgs e)
    {
      Contract.Requires(this.listAssemblies != null);
      Contract.Requires(this.listSources != null);
      Contract.Requires(this.listProjects != null);
      Contract.Requires(this.splitMain != null);

      var selectedSource = this.listSources.SelectedValue as SourceEntry;

      if (selectedSource == null)
      {
        this.selectedSourceManager = null;
      }
      else
      {
        this.selectedSourceManager = selectedSource.SourceManager;
        if (this.selectedSourceManager == null)
        {
          MessageBox.Show(String.Format("Unknown source type: \"{0}\"", selectedSource.Type));
        }
      }

      if (this.selectedSourceManager == null)
      {
        this.listProjects.DataSource = null;
      }
      else
      {
        if (this.selectedSourceManager.WorkingDirectory == null)
        {
          var workingDirectory = Path.Combine(Path.Combine(this.rootPath, "workspaces"), this.selectedSourceManager.Id);
          Directory.CreateDirectory(workingDirectory);
          this.selectedSourceManager.WorkingDirectory = workingDirectory;
        }

        this.outputDirectory = Path.Combine(Path.Combine(this.rootPath, "outputs"), this.selectedSourceManager.Id);
        Directory.CreateDirectory(this.outputDirectory);

        this.listProjects.DataSource = selectedSource.Projects;
        // todo: save selection
        this.listProjects.ClearSelected();
        if (this.listProjects.Items.Count > 0)
          this.listProjects.SelectedIndex = 0;
      }
    }
예제 #37
0
 public SourceController(ISourceManager sourceManager, ICategoryManager categoryManager)
 {
     SourceManager = sourceManager;
     CategoryManager = categoryManager;
 }
        public virtual void Dispose()
        {
            UnInitialize();

            _manager = null;

            _dataDelivery = null;

            _quote = null;

            _tickProvider = null;

            _dataBarProvider = null;

            ChangeOperationalState(OperationalStateEnum.Disposed);
        }
예제 #39
0
 public LexerTests()
 {
     _sourceManager = new SourceManager.SourceManager();
 }
        /// <summary>
        /// 
        /// </summary>
        public virtual bool SetInitialParameters(ISourceManager manager, ComponentId sourceId, ExpertSession session)
        {
            _sessionInfo = session.Info;

            _manager = manager;

            _sourceId = sourceId;

            _dataDelivery = manager.ObtainDataDelivery(sourceId);

            _quote = manager.ObtainQuoteProvider(sourceId, _sessionInfo.Symbol);

            _tickProvider = manager.ObtainDataTickHistoryProvider(sourceId, _sessionInfo.Symbol);

            _dataBarProvider = null;

            bool result = _dataDelivery != null && _quote != null && _tickProvider != null;

            SystemMonitor.CheckError(result, "Failed to initialize data provider.");

            return result;
        }
예제 #41
0
        /// <summary>
        /// 
        /// </summary>
        public bool SetInitialParameters(ISourceManager manager,
            ISourceOrderExecution provider, 
            ISourceDataDelivery dataDelivery, Symbol symbol)
        {
            _manager = manager;
            _provider = provider;
            _dataDelivery = dataDelivery;

            _info.Symbol = symbol;

            return true;
        }
예제 #42
0
        /// <summary>
        /// Initialize execution account with its owner provider.
        /// </summary>
        /// <param name="session"></param>
        public bool SetInitialParameters(ISourceManager manager, ISourceOrderExecution orderExecutionProvider, ISourceDataDelivery dataDelivery)
        {
            SystemMonitor.CheckError(_provider == null, "Order account already initialized.");

            _manager = manager;
            //why is the provider not ready
            _provider = orderExecutionProvider;
            _dataDelivery = dataDelivery;

            SystemMonitor.CheckWarning(_manager != null && _provider != null && _dataDelivery != null, "Account not properly initialized.");

            return true;
        }
        /// <summary>
        /// One time init by passing references essential for operation.
        /// </summary>
        public bool SetInitialParameters(ISourceManager manager, ISourceDataDelivery dataDelivery)
        {
            _manager = manager;
            _dataDelivery = dataDelivery;

            _account.SetInitialParameters(_manager, this, _dataDelivery);
            _tradeEntities.SetInitialParameters(_manager, this, _dataDelivery);

            _timeControl = new TimeControl();
            _timeControl.CanStepBack = false;
            _timeControl.CanStepForward = true;
            _timeControl.CanRestart = false;
            _timeControl.TotalStepsCount = int.MaxValue;

            ChangeOperationalState(OperationalStateEnum.Initializing);

            return true;
        }
예제 #44
0
 public override void Dispose()
 {
     _dataSourceId = ComponentId.Empty;
     _orderExectionSourceId = ComponentId.Empty;
     _manager = null;
     base.Dispose();
 }
예제 #45
0
 /// <summary>
 /// Constructor.
 /// </summary>
 public Order(ISourceManager manager, ISourceOrderExecution executionProvider, ComponentId dataSourceId)
 {
     _manager = manager;
     _executionProvider = executionProvider;
     _dataSourceId = dataSourceId;
 }
        /// <summary>
        /// 
        /// </summary>
        public bool SetInitialParameters(ISourceManager manager, ISourceOrderExecution provider,
            ISourceDataDelivery delivery)
        {
            //SystemMonitor.CheckError(_provider == null, "OrderExecutionProvider already assigned.");

            _manager = manager;
            _provider = provider;
            _delivery = delivery;

            if (_provider == null)
            {
                SystemMonitor.Warning("Failed to properly initialize entity keeper.");
            }

            return true;
        }
 public void Dispose()
 {
     _manager = null;
     _provider = null;
     _delivery = null;
 }
 public void Dispose()
 {
     _manager = null;
     _dataDelivery = null;
 }
예제 #49
0
 public CategoryController(ICategoryManager categoryManager, ISourceManager sourceManager)
 {
     CategoryManager = categoryManager;
     SourceManager = sourceManager;
 }
예제 #50
0
        public virtual void Dispose()
        {
            //if (_tradeEntities != null)
            //{
            //    _tradeEntities.UnInitialize();
            //    _tradeEntities = null;
            //}

            if (_statistics != null)
            {
                _statistics.Dispose();
                _statistics = null;
            }

            _dataDelivery = null;
            _manager = null;

            if (_provider != null)
            {
                _provider.AccountInfoUpdateEvent -= new AccountInfoUpdateDelegate(_provider_AccountInfoUpdateEvent);
                _provider.OperationalStateChangedEvent -= new OperationalStateChangedDelegate(_provider_OperationalStatusChangedEvent);

                _provider = null;
            }
        }
        void SessionManager_SessionsUpdateEvent(ISourceManager parameter1)
        {
            TracerHelper.Trace(_tracer, "");

            if (_currentSessionIndex == -1 && Manager.SessionCount > 0)
            {
                _currentSessionIndex = 0;

                if (CurrentSession.OperationalState == OperationalStateEnum.Operational)
                {
                    if (CurrentSession.DataProvider.DataBars != null)
                    {
                        Start();
                    }
                    else
                    {
                        CurrentSession.DataProvider.DataBarProviderCreatedEvent += new DataProviderBarProviderUpdateDelegate(DataProvider_DataBarProviderCreatedEvent);
                    }
                }
            }
        }
        public bool SetInitialParameters(ISourceManager manager, ComponentId sourceSourceId, ExpertSession session)
        {
            _manager = manager;

            _sessionInfo = session.Info;

            _sourceDataDelivery = manager.ObtainDataDelivery(sourceSourceId);
            //_sourceDataDelivery.OperationalStateChangedEvent += new OperationalStateChangedDelegate(_sourceDataDelivery_OperationalStateChangedEvent);

            StatusSynchronizationSource = _sourceDataDelivery;

            return true;
        }
 void sessionManager_SessionCreatedEvent(ISourceManager parameter1, ExpertSession parameter2)
 {
     _name = base.Manager.SessionsArray[0].Info.Name;
 }
예제 #54
0
 public SectionerTests()
 {
     _sourceManager = new SourceManager.SourceManager();
 }
예제 #55
0
 /// <summary>
 /// 
 /// </summary>
 public virtual void Dispose()
 {
     _manager = null;
     _executionProvider = null;
     _quoteProvider = null;
     _dataSourceId = ComponentId.Empty;
 }