Exemplo n.º 1
0
        /// <summary>
        /// Watch Loom projects to update the configuration
        /// </summary>
        /// <param name="project"></param>
        static public void Monitor(IProject project)
        {
            if (updater == null && project != null)
            {
                updater                     = new System.Timers.Timer();
                updater.Interval            = 200;
                updater.SynchronizingObject = PluginCore.PluginBase.MainForm as System.Windows.Forms.Form;
                updater.Elapsed            += updater_Elapsed;
                updater.AutoReset           = false;
            }

            proj = null;
            StopWatcher();
            if (project is LoomProject)
            {
                proj = project as LoomProject;
                proj.ProjectUpdating += new ProjectUpdatingHandler(proj_ProjectUpdating);
                proj_ProjectUpdating(proj);
                if (lastProject != proj.ProjectPath)
                {
                    lastProject = proj.ProjectPath;
                    AutoInit(proj);
                }
            }
            else
            {
                lastProject = null;
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Scaffold Loom project
        /// </summary>
        /// <param name="project"></param>
        private static void AutoInit(LoomProject project)
        {
            string[] files = Directory.GetFiles(project.Directory);
            if (!(files.Length == 1 && Path.GetExtension(files[0]) == ".lsproj"
                && Directory.GetDirectories(project.Directory).Length == 0)) return;

            if (!project.Storage.ContainsKey("package"))
                return;

            string pkg = project.Storage["package"] as String;
            project.Storage.Remove("package");
            project.Save();
            
            string loomPath = ResolveLoom();
            string loom = Path.Combine(loomPath, "loom.bat");
            if (!File.Exists(loom))
            {
                ShowMissingLoomBatError();
                return;
            }

            string oldWD = PluginBase.MainForm.WorkingDirectory;
            string cmd = loom + ";new --force";
            if (!string.IsNullOrEmpty(pkg)) cmd += " --app-id " + pkg;
            cmd += " \"" + Path.GetFileName(project.Directory) + "\"";

            PluginBase.MainForm.WorkingDirectory = Path.GetDirectoryName(project.Directory);
            PluginBase.MainForm.CallCommand("RunProcessCaptured", cmd);
            PluginBase.MainForm.WorkingDirectory = oldWD;

            // force re-exploring the project
            updater.Enabled = true;
        }
Exemplo n.º 3
0
        public static void Build(LoomProject project)
        {
            string loomPath = ResolveLoom();
            string loom     = Path.Combine(loomPath, "loom.bat");
            string oldWD    = PluginBase.MainForm.WorkingDirectory;

            PluginBase.MainForm.WorkingDirectory = project.Directory;
            PluginBase.MainForm.CallCommand("RunProcessCaptured", loom + ";compile");
            PluginBase.MainForm.WorkingDirectory = oldWD;
        }
Exemplo n.º 4
0
 public static void Build(LoomProject project)
 {
     string loomPath = ResolveLoom();
     string loom = Path.Combine(loomPath, "loom.bat");
     if (!File.Exists(loom))
     {
         ShowMissingLoomBatError();
         return;
     }
     string oldWD = PluginBase.MainForm.WorkingDirectory;
     PluginBase.MainForm.WorkingDirectory = project.Directory;
     PluginBase.MainForm.CallCommand("RunProcessCaptured", loom + ";compile");
     PluginBase.MainForm.WorkingDirectory = oldWD;
 }
Exemplo n.º 5
0
        public static void Run(LoomProject project)
        {
            if (Process.GetProcessesByName("LoomDemo").Length > 0)
            {
                TraceManager.AddAsync("LoomDemo is already running.");
                return;
            }

            string           loomPath = ResolveLoom();
            ProcessStartInfo info     = new ProcessStartInfo(Path.Combine(loomPath, "loom.bat"), "run");
            Process          process  = new Process();

            process.StartInfo = info;
            process.Start();
        }
Exemplo n.º 6
0
        public static void Run(LoomProject project)
        {
            if (Process.GetProcessesByName("LoomDemo").Length > 0)
            {
                TraceManager.AddAsync("LoomDemo is already running.");
                return;
            }

            string loom = Path.Combine(ResolveLoom(), "loom.bat");
            if (!File.Exists(loom))
            {
                ShowMissingLoomBatError();
                return;
            }
            ProcessStartInfo info = new ProcessStartInfo(loom, "run");
            Process process = new Process();
            process.StartInfo = info;
            process.Start();
        }