Пример #1
0
        private static void ThreadedBuild(Project proj)
        {
            Luminate luminate = Luminate.Singleton;

            DateTime date = DateTime.Now;

            string catenatedBuilds = "";

            foreach (string s in proj.Dependencies)
            {
                bool foundProject = false;

                for (var i = 0; i < luminate.mProjects.Count; i++)
                {
                    if (luminate.mProjects[i].Name == s)
                    {
                        foundProject = true;
                        Logger.Singleton.Log("Building " + luminate.mProjects[i].Name + " on " + date.ToShortDateString() + " @" + date.ToLongTimeString(), Logger.MessageType.MESSAGE);
                        Builder.Build(luminate.mProjects[i], null);
                        Logger.Singleton.Log("Build " + luminate.mProjects[i].Name + " Complete: " + proj.OutputFile + " on " + date.ToShortDateString() + " @" + date.ToLongTimeString(), Logger.MessageType.MESSAGE);

                        catenatedBuilds += luminate.mProjects[i].CompiledJS;
                        break;
                    }
                }

                if (!foundProject)
                {
                    Logger.Singleton.Log("Project Dependency " + s + " was not found for " + proj.Name + ".", Logger.MessageType.ERROR);
                }
            }

            Logger.Singleton.Log("Building " + proj.Name + " on " + date.ToShortDateString() + " @" + date.ToLongTimeString(), Logger.MessageType.MESSAGE);
            Builder.Build(proj, catenatedBuilds);
            Logger.Singleton.Log("Build " + proj.Name + " Complete: " +
                                 proj.OutputFile + " on " + date.ToShortDateString() + " @" + date.ToLongTimeString(), Logger.MessageType.MESSAGE);

            if (proj.UseFTP)
            {
                Logger.Singleton.Log("Uploading to " + proj.FTPLocation + " with user " +
                                     proj.FTPUser + "...", Logger.MessageType.MESSAGE);
            }

            luminate.mLexer.parse(proj.CompiledJS);

            // Save to the override file
            try
            {
                if (proj.OverridePath.Trim() != "")
                {
                    StreamWriter file = new StreamWriter(proj.OverridePath);
                    file.Write(proj.CompiledJS);
                    file.Close();
                }
            }
            catch (Exception ex)
            {
                Logger.Singleton.Log(ex.Message, Logger.MessageType.ERROR);
            }

            luminate.EnableBuild(true);
        }
Пример #2
0
        /// <summary>
        /// Simple constructor
        /// </summary>
        public Luminate(string[] data)
        {
            InitializeComponent();
            mSingleton = this;

            mListenForChanges = true;
            mProjects         = new List <Project>();
            mDocs             = new List <Document>();
            mAbout            = new About();
            mFTPOptions       = new FTP_Options();
            mBuildOptions     = new BuildOptions();
            mPrefForm         = new Preferences();
            mPrevForm         = new Preview();
            mLexer            = new DocumentLexer();

            SolutionExplorer explorer = SolutionExplorer.Singleton;
            Logger           logger   = Logger.Singleton;

            //Only show the files if we dont have a layout
            if (!File.Exists(Application.StartupPath + "\\layout.lumf"))
            {
                explorer.Show(mDockPanel);
                logger.Show(mDockPanel);
                mPrevForm.Show(mDockPanel);

                explorer.DockTo(mDockPanel, DockStyle.Right);
                logger.DockTo(mDockPanel, DockStyle.Bottom);
                mPrevForm.DockTo(mDockPanel, DockStyle.Fill);
            }

            if (File.Exists(Application.StartupPath + "\\preferences.lumf"))
            {
                mPrefs = SolutionPreferences.Load(Application.StartupPath + "\\preferences.lumf");
            }
            else
            {
                mPrefs = new SolutionPreferences();
            }


            Builder.ignoreList = mPrefs.ignoreList;

            //Set the browser
            textBrowser.Tag = mPrefs.browser;
            string[] split = mPrefs.browser.Split('\\');
            textBrowser.Text = split[split.Length - 1];

            mNewProj = new NewProject();

            buttonBuild.Image       = imageList.Images[0];
            buttonRun.Image         = imageList.Images[1];
            buttonMinify.Image      = imageList.Images[3];
            buttonBrowserDiag.Image = imageList.Images[4];

            //Event handlers
            explorer.ProjectSelected += new SolutionExplorer.projectSelected(OnProjectSelected);

            OnProjectSelected(null);

            // Open the general project settings - see if there are any projects already loaded
            try
            {
                // Example #2
                // Read each line of the file into a string array. Each element
                // of the array is one line of the file.
                string[] lines = File.ReadAllLines(Application.StartupPath + "\\startup.options");

                foreach (string projectLocation in lines)
                {
                    if (projectLocation[0] == '*')
                    {
                        AddCloseNode(projectLocation.Remove(0, 1));
                    }
                    else
                    {
                        OpenProject(projectLocation);
                    }
                }
            }
            catch
            {
            }

            //If arguments are passed to the app then try and open the file if its a lum file
            if (data != null && data.Length > 0)
            {
                if (data[0].Split('.')[1].ToString().ToLower() == "lum")
                {
                    OpenProject(data[0]);
                }
            }
        }