/// <summary>
        /// Load Source Files
        /// </summary>
        public static void LoadCustomIndicators()
        {
            indicatorManager = new Indicator_Compilation_Manager();

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

            string[] pathInputFiles = Directory.GetFiles(Data.SourceFolder, "*.cs");
            if (pathInputFiles.Length == 0)
            {
                System.Windows.Forms.MessageBox.Show(Language.T("No custom indicator files found out!"), Language.T("Custom Indicators"));
                Indicator_Store.ResetCustomIndicators(null);
                Indicator_Store.CombineAllIndicators();
                return;
            }

            StringBuilder 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("\r\n", "</br>");
                    error = error.Replace("\t", "&nbsp; &nbsp; &nbsp;");
                    errorReport.AppendLine("<p>" + error + "</p>");
                }
            }

            // Adds the custom indicators
            Indicator_Store.ResetCustomIndicators(indicatorManager.CustomIndicatorsList);
            Indicator_Store.CombineAllIndicators();

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

            if (Configs.ShowCustomIndicators)
                ShowLoadedCustomIndicators();

            return;
        }
Exemplo n.º 2
0
        /// <summary>
        /// Load Source Files
        /// </summary>
        public static void LoadCustomIndicators()
        {
            indicatorManager = new Indicator_Compilation_Manager();

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

            string[] pathInputFiles = Directory.GetFiles(Data.SourceFolder, "*.cs");
            if (pathInputFiles.Length == 0)
            {
                System.Windows.Forms.MessageBox.Show(Language.T("No custom indicator files found out!"), Language.T("Custom Indicators"));
                Indicator_Store.ResetCustomIndicators(null);
                Indicator_Store.CombineAllIndicators();
                return;
            }

            StringBuilder 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("\r\n", "</br>");
                    error = error.Replace("\t", "&nbsp; &nbsp; &nbsp;");
                    errorReport.AppendLine("<p>" + error + "</p>");
                }
            }

            // Adds the custom indicators
            Indicator_Store.ResetCustomIndicators(indicatorManager.CustomIndicatorsList);
            Indicator_Store.CombineAllIndicators();

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

            if (Configs.ShowCustomIndicators)
            {
                ShowLoadedCustomIndicators();
            }

            return;
        }