Example #1
0
        public static void Initialize(string projectPath = null, bool showErrorMsg = true)
        {
            //if (check)
            //    CheckFilesAndFolders();

            string headerFilesPath  = "\\headerFiles";
            string moduleFilesPath  = "\\moduleFiles";
            string moduleSystemPath = "\\moduleSystem";

            if (projectPath == null)
            {
                //projectPath = CodeReader.FILES_PATH + @"tmp";
                //if (!Directory.Exists(projectPath))
                //    Directory.CreateDirectory(projectPath);
                //ShowErrorMsg("Pfad des Projekts wurde in " + Path.GetFullPath(projectPath) + " geƤndert!");
                ShowErrorMsg("No project found!");
                return;
            }

            currentProjectPath = projectPath;

            if (!IsInLastOpenedProjectPaths(projectPath))
            {
                AddProjectPathToLastOpened(projectPath);
            }

            headerFilesPath  = projectPath + headerFilesPath;
            moduleFilesPath  = projectPath + moduleFilesPath;
            moduleSystemPath = projectPath + moduleSystemPath;

            //if (!Directory.Exists(headerFilesPath))
            Directory.CreateDirectory(headerFilesPath);
            //if (!Directory.Exists(moduleFilesPath))
            Directory.CreateDirectory(moduleFilesPath);
            //if (!Directory.Exists(moduleSystemPath))
            Directory.CreateDirectory(moduleSystemPath);

            CodeReader.ProjectPath       = projectPath;
            moduleFilesPath             += '\\';
            SourceWriter.ModuleFilesPath = moduleFilesPath;

            if (SetModPath(showErrorMsg))
            {
                CodeReader.LoadAll();
                ImportsManager importsManager = new ImportsManager(CodeReader.FILES_PATH);
                //SourceWriter.MakeBackup = !SourceWriter.MakeBackup; /// --> DEFAULT IS NOW FALSE ///
                SourceWriter.SetImportsForModuleFiles(importsManager.ReadDataBankInfos());
                ConstantsFinder.InitializeConstants(CodeReader.FILES_PATH + "module_constants.py");

                CopyDefaultFiles();
            }
        }