예제 #1
0
 public void SaveTo(CommonProjectNode proj)
 {
     proj.SetProjectProperty("OutputType", OutputTypeToString(OutputType));
     proj.SetProjectProperty("CrateName", CrateName.ToString());
     proj.SetProjectProperty("BuildDylib", BuildDylib.ToString());
     proj.SetProjectProperty("BuildRlib", BuildRlib.ToString());
     proj.SetProjectProperty("BuildStaticlib", BuildStaticlib.ToString());
 }
        public override int OnAfterRenameFiles(int cProjects, int cFiles, IVsProject[] projects, int[] firstIndices, string[] oldFileNames, string[] newFileNames, VSRENAMEFILEFLAGS[] flags)
        {
            if (!_project.IsRefreshing)
            {
                //Get the current value of the StartupFile Property
                string currentStartupFile = _project.GetProjectProperty(CommonConstants.StartupFile, true);
                if (string.IsNullOrEmpty(currentStartupFile))
                {
                    return(VSConstants.S_OK);
                }
                string fullPathToStartupFile = CommonUtils.GetAbsoluteFilePath(_project.ProjectHome, currentStartupFile);

                //Investigate all of the oldFileNames if they are equal to the current StartupFile
                int index = 0;
                foreach (string oldfile in oldFileNames)
                {
                    FileNode node = null;
                    if ((flags[index] & VSRENAMEFILEFLAGS.VSRENAMEFILEFLAGS_Directory) != 0)
                    {
                        if (CommonUtils.IsSubpathOf(oldfile, fullPathToStartupFile))
                        {
                            // Get the newfilename and update the StartupFile property
                            string newfilename = Path.Combine(
                                newFileNames[index],
                                CommonUtils.GetRelativeFilePath(oldfile, fullPathToStartupFile)
                                );

                            node = _project.FindNodeByFullPath(newfilename) as FileNode;
                            Debug.Assert(node != null);
                        }
                    }
                    else if (CommonUtils.IsSamePath(oldfile, fullPathToStartupFile))
                    {
                        //Get the newfilename and update the StartupFile property
                        string newfilename = newFileNames[index];
                        node = _project.FindNodeByFullPath(newfilename) as FileNode;
                        Debug.Assert(node != null);
                    }

                    if (node != null)
                    {
                        // Startup file has been renamed
                        _project.SetProjectProperty(
                            CommonConstants.StartupFile,
                            CommonUtils.GetRelativeFilePath(_project.ProjectHome, node.Url));
                        break;
                    }
                    index++;
                }
            }
            return(VSConstants.S_OK);
        }
 public override void Apply()
 {
     Project.SetProjectProperty(NodeProjectProperty.NodeExePath, _control.NodeExePath);
     Project.SetProjectProperty(NodeProjectProperty.NodeExeArguments, _control.NodeExeArguments);
     Project.SetProjectProperty(CommonConstants.StartupFile, _control.ScriptFile);
     Project.SetProjectProperty(NodeProjectProperty.ScriptArguments, _control.ScriptArguments);
     Project.SetProjectProperty(NodeProjectProperty.NodejsPort, _control.NodejsPort);
     Project.SetProjectProperty(NodeProjectProperty.StartWebBrowser, _control.StartWebBrowser.ToString());
     Project.SetProjectProperty(CommonConstants.WorkingDirectory, _control.WorkingDirectory);
     Project.SetProjectProperty(NodeProjectProperty.LaunchUrl, _control.LaunchUrl);
     Project.SetProjectProperty(NodeProjectProperty.DebuggerPort, _control.DebuggerPort);
     Project.SetProjectProperty(NodeProjectProperty.Environment, _control.Environment);
     IsDirty = false;
 }