Exemple #1
0
        /// <summary>
        /// Load Source Files
        /// </summary>
        public static void LoadCustomIndicators()
        {
            _indicatorManager = new IndicatorCompilationManager();

            if (!Directory.Exists(Data.SourceFolder))
            {
                MessageBox.Show("Custom indicators folder does not exist!", Language.T("Custom Indicators"));
                IndicatorStore.ResetCustomIndicators(null);
                IndicatorStore.CombineAllIndicators();
                return;
            }

            string[] pathInputFiles = Directory.GetFiles(Data.SourceFolder, "*.cs");
            if (pathInputFiles.Length == 0)
            {
                IndicatorStore.ResetCustomIndicators(null);
                IndicatorStore.CombineAllIndicators();
                return;
            }

            var errorReport = new StringBuilder();

            errorReport.AppendLine("<h1>" + Language.T("Custom Indicators") + "</h1>");
            bool isError = false;

            foreach (string filePath in pathInputFiles)
            {
                string errorMessages;
                _indicatorManager.LoadCompileSourceFile(filePath, out errorMessages);

                if (!string.IsNullOrEmpty(errorMessages))
                {
                    isError = true;

                    errorReport.AppendLine("<h2>File name: " + Path.GetFileName(filePath) + "</h2>");
                    string error = errorMessages.Replace(Environment.NewLine, "</br>");
                    error = error.Replace("\t", "&nbsp; &nbsp; &nbsp;");
                    errorReport.AppendLine("<p>" + error + "</p>");
                }
            }

            // Adds the custom indicators
            IndicatorStore.ResetCustomIndicators(_indicatorManager.CustomIndicatorsList);
            IndicatorStore.CombineAllIndicators();

            if (isError)
            {
                var msgBox = new FancyMessageBox(errorReport.ToString(), Language.T("Custom Indicators"))
                {
                    BoxWidth = 550, BoxHeight = 340, TopMost = true
                };
                msgBox.Show();
            }

            if (Configs.ShowCustomIndicators)
            {
                ShowLoadedCustomIndicators();
            }
        }
        /// <summary>
        /// Load Source Files
        /// </summary>
        public static void LoadCustomIndicators()
        {
            _indicatorManager = new IndicatorCompilationManager();

            if (!Directory.Exists(Data.SourceFolder))
            {
                MessageBox.Show("Custom indicators folder does not exist!", Language.T("Custom Indicators"));
                IndicatorStore.ResetCustomIndicators(null);
                IndicatorStore.CombineAllIndicators();
                return;
            }

            string[] pathInputFiles = Directory.GetFiles(Data.SourceFolder, "*.cs");
            if (pathInputFiles.Length == 0)
            {
                IndicatorStore.ResetCustomIndicators(null);
                IndicatorStore.CombineAllIndicators();
                return;
            }

            var errorReport = new StringBuilder();
            errorReport.AppendLine("<h1>" + Language.T("Custom Indicators") + "</h1>");
            bool isError = false;

            foreach (string filePath in pathInputFiles)
            {
                string errorMessages;
                _indicatorManager.LoadCompileSourceFile(filePath, out errorMessages);

                if (!string.IsNullOrEmpty(errorMessages))
                {
                    isError = true;

                    errorReport.AppendLine("<h2>File name: " + Path.GetFileName(filePath) + "</h2>");
                    string error = errorMessages.Replace(Environment.NewLine, "</br>");
                    error = error.Replace("\t", "&nbsp; &nbsp; &nbsp;");
                    errorReport.AppendLine("<p>" + error + "</p>");
                }
            }

            // Adds the custom indicators
            IndicatorStore.ResetCustomIndicators(_indicatorManager.CustomIndicatorsList);
            IndicatorStore.CombineAllIndicators();

            if (isError)
            {
                var msgBox = new FancyMessageBox(errorReport.ToString(), Language.T("Custom Indicators"))
                                 {BoxWidth = 550, BoxHeight = 340, TopMost = true};
                msgBox.Show();
            }

            if (Configs.ShowCustomIndicators)
                ShowLoadedCustomIndicators();
        }