Ejemplo n.º 1
0
        /// <summary>
        /// Sets the node property.
        /// </summary>
        /// <param name="propid">Property id.</param>
        /// <param name="value">Property value.</param>
        /// <returns>Returns success or failure code.</returns>
        public override int SetProperty(int propid, object value)
        {
            int         result;
            __VSHPROPID id = (__VSHPROPID)propid;

            switch (id)
            {
            case __VSHPROPID.VSHPROPID_IsNonMemberItem:
                if (value == null)
                {
                    throw new ArgumentNullException("value");
                }

                bool boolValue = false;
                CciTracing.TraceCall(this.Id + "," + id.ToString());
                if (bool.TryParse(value.ToString(), out boolValue))
                {
                    this.IsNonmemberItem = boolValue;
                }
                else
                {
                    Trace.WriteLine("Could not parse the IsNonMemberItem property value.");
                }

                result = VSConstants.S_OK;
                break;

            default:
                result = base.SetProperty(propid, value);
                break;
            }

            return(result);
        }
Ejemplo n.º 2
0
        public virtual int AdviseBuildStatusCallback(IVsBuildStatusCallback callback, out uint cookie)
        {
            CciTracing.TraceCall();

            cookie = callbacks.Add(callback);
            return(VSConstants.S_OK);
        }
Ejemplo n.º 3
0
        public virtual int get_ProjectCfg(out IVsProjectCfg p)
        {
            CciTracing.TraceCall();

            p = config;
            return(VSConstants.S_OK);
        }
Ejemplo n.º 4
0
        public virtual void CreateDirectory(string newName)
        {
            if (String.IsNullOrEmpty(newName))
            {
                throw new ArgumentException(SR.GetString(SR.ParameterCannotBeNullOrEmpty, CultureInfo.CurrentUICulture), "newName");
            }

            try
            {
                // on a new dir && enter, we get called with the same name (so do nothing if name is the same
                char[] dummy = new char[1];
                dummy[0] = Path.DirectorySeparatorChar;
                string oldDir = this.Url;
                oldDir = oldDir.TrimEnd(dummy);
                string strNewDir = Path.Combine(Path.GetDirectoryName(oldDir), newName);

                if (!String.Equals(strNewDir, oldDir, StringComparison.OrdinalIgnoreCase))
                {
                    if (Directory.Exists(strNewDir))
                    {
                        throw new InvalidOperationException(SR.GetString(SR.DirectoryExistError, CultureInfo.CurrentUICulture));
                    }
                    Directory.CreateDirectory(strNewDir);
                }
            }
            //TODO - this should not digest all exceptions.
            catch (System.Exception e)
            {
                CciTracing.Trace(e);
                throw;
            }
        }
Ejemplo n.º 5
0
        public virtual int QueryStatus(out int done)
        {
            CciTracing.TraceCall();

            done = (this.config.ProjectManager.BuildInProgress) ? 0 : 1;
            return(VSConstants.S_OK);
        }
Ejemplo n.º 6
0
        public virtual int UnadviseBuildStatusCallback(uint cookie)
        {
            CciTracing.TraceCall();


            callbacks.RemoveAt(cookie);
            return(VSConstants.S_OK);
        }
Ejemplo n.º 7
0
 public virtual int StartClean(IVsOutputWindowPane pane, uint options)
 {
     CciTracing.TraceCall();
     config.PrepareBuild(true);
     // Current version of MSBuild wish to be called in an STA
     this.Build(options, pane, MSBuildTarget.Clean);
     return(VSConstants.S_OK);
 }
Ejemplo n.º 8
0
        public static void Trace(System.Exception exception)
        {
            if (exception == null)
            {
                throw new ArgumentNullException("exception");
            }

            CciTracing.InternalTraceCall(2);
            System.Diagnostics.Trace.WriteLine("ExceptionInfo: \t" + exception.ToString());
        }
Ejemplo n.º 9
0
 public virtual int get_IsReleaseOnly(out int fRelease)
 {
     CciTracing.TraceCall();
     fRelease = 0;
     if (this.ConfigName == "Release")
     {
         fRelease = 1;
     }
     return(VSConstants.S_OK);
 }
Ejemplo n.º 10
0
        public virtual int get_BuildableProjectCfg(out IVsBuildableProjectCfg pb)
        {
            CciTracing.TraceCall();
            if (buildableCfg == null)
            {
                buildableCfg = new BuildableProjectConfig(this);
            }

            pb = buildableCfg;
            return(VSConstants.S_OK);
        }
Ejemplo n.º 11
0
        public virtual int get_UpdateSequenceNumber(ULARGE_INTEGER[] li)
        {
            if (li == null)
            {
                throw new ArgumentNullException("li");
            }

            CciTracing.TraceCall();
            li[0]          = new ULARGE_INTEGER();
            li[0].QuadPart = 0;
            return(VSConstants.S_OK);
        }
Ejemplo n.º 12
0
 public virtual int QueryStartBuild(uint options, int[] supported, int[] ready)
 {
     CciTracing.TraceCall();
     if (supported != null && supported.Length > 0)
     {
         supported[0] = 1;
     }
     if (ready != null && ready.Length > 0)
     {
         ready[0] = (this.config.ProjectManager.BuildInProgress) ? 0 : 1;
     }
     return(VSConstants.S_OK);
 }
Ejemplo n.º 13
0
        /// <summary>
        /// Determines whether the debugger can be launched, given the state of the launch flags.
        /// </summary>
        /// <param name="flags">Flags that determine the conditions under which to launch the debugger.
        /// For valid grfLaunch values, see __VSDBGLAUNCHFLAGS or __VSDBGLAUNCHFLAGS2.</param>
        /// <param name="fCanLaunch">true if the debugger can be launched, otherwise false</param>
        /// <returns>S_OK if the method succeeds, otherwise an error code</returns>
        public virtual int QueryDebugLaunch(uint flags, out int fCanLaunch)
        {
            CciTracing.TraceCall();
            string assembly = this._project.GetAssemblyName(this.ConfigName, this.Platform);

            fCanLaunch = (assembly != null && assembly.ToUpperInvariant().EndsWith(".exe", StringComparison.OrdinalIgnoreCase)) ? 1 : 0;
            if (fCanLaunch == 0)
            {
                string property = GetConfigurationProperty("StartProgram", _PersistStorageType.PST_USER_FILE, true);
                fCanLaunch = (property != null && property.Length > 0) ? 1 : 0;
            }
            return(VSConstants.S_OK);
        }
Ejemplo n.º 14
0
        public virtual int StartBuild(IVsOutputWindowPane pane, uint options)
        {
            CciTracing.TraceCall();
            config.PrepareBuild(false);

            // Current version of MSBuild wish to be called in an STA
            uint flags = VSConstants.VS_BUILDABLEPROJECTCFGOPTS_REBUILD;

            // If we are not asked for a rebuild, then we build the default target (by passing null)
            this.Build(options, pane, ((options & flags) != 0) ? MSBuildTarget.Rebuild : null);

            return(VSConstants.S_OK);
        }
Ejemplo n.º 15
0
        public virtual int get_ProjectCfgProvider(out IVsProjectCfgProvider p)
        {
            CciTracing.TraceCall();
            p = null;
            IVsCfgProvider cfgProvider = null;

            this._project.GetCfgProvider(out cfgProvider);
            if (cfgProvider != null)
            {
                p = cfgProvider as IVsProjectCfgProvider;
            }

            return((null == p) ? VSConstants.E_NOTIMPL : VSConstants.S_OK);
        }
Ejemplo n.º 16
0
 public virtual void CreateDirectory()
 {
     try
     {
         if (Directory.Exists(this.Url) == false)
         {
             Directory.CreateDirectory(this.Url);
         }
     }
     //TODO - this should not digest all exceptions.
     catch (System.Exception e)
     {
         CciTracing.Trace(e);
         throw;
     }
 }
Ejemplo n.º 17
0
        /// <summary>
        /// Sets the value of a configuration dependent property.
        /// If the attribute does not exist it is created.
        /// If value is null it will be set to an empty string.
        /// </summary>
        /// <param name="name">property name.</param>
        /// <param name="value">value of property</param>
        public virtual void SetConfigProperty(string name, _PersistStorageType storageType, string value)
        {
            CciTracing.TraceCall();
            if (value == null)
            {
                value = String.Empty;
            }

            if (this.ProjectManager != null)
            {
                for (int i = 0, n = this.projectConfigs.Length; i < n; i++)
                {
                    ProjectConfig config = projectConfigs[i];

                    config.SetConfigurationProperty(name, storageType, value);
                }

                this.ProjectManager.SetProjectFileDirty(true);
            }
        }
Ejemplo n.º 18
0
 public virtual int OpenOutput(string name, out IVsOutput output)
 {
     CciTracing.TraceCall();
     output = null;
     return(VSConstants.E_NOTIMPL);
 }
Ejemplo n.º 19
0
        public virtual int StartUpToDateCheck(IVsOutputWindowPane pane, uint options)
        {
            CciTracing.TraceCall();

            return(VSConstants.E_NOTIMPL);
        }
Ejemplo n.º 20
0
 public virtual int get_TargetCodePage(out uint target)
 {
     CciTracing.TraceCall();
     target = (uint)System.Text.Encoding.Default.CodePage;
     return(VSConstants.S_OK);
 }
Ejemplo n.º 21
0
 public virtual int get_RootURL(out string root)
 {
     CciTracing.TraceCall();
     root = null;
     return(VSConstants.S_OK);
 }
Ejemplo n.º 22
0
 public virtual int get_Platform(out Guid platform)
 {
     CciTracing.TraceCall();
     platform = Guid.Empty;
     return(VSConstants.E_NOTIMPL);
 }
Ejemplo n.º 23
0
 public static void TraceCall()
 {
     // skip this one as well
     CciTracing.InternalTraceCall(2);
 }
Ejemplo n.º 24
0
 public virtual int get_IsPackaged(out int pkgd)
 {
     CciTracing.TraceCall();
     pkgd = 0;
     return(VSConstants.S_OK);
 }
Ejemplo n.º 25
0
        public virtual int Stop(int fsync)
        {
            CciTracing.TraceCall();

            return(VSConstants.S_OK);
        }
Ejemplo n.º 26
0
 public virtual int EnumOutputs(out IVsEnumOutputs eo)
 {
     CciTracing.TraceCall();
     eo = null;
     return(VSConstants.E_NOTIMPL);
 }
Ejemplo n.º 27
0
        public virtual int Wait(uint ms, int fTickWhenMessageQNotEmpty)
        {
            CciTracing.TraceCall();

            return(VSConstants.E_NOTIMPL);
        }
Ejemplo n.º 28
0
        /// <summary>
        /// Called by the vs shell to start debugging (managed or unmanaged).
        /// Override this method to support other debug engines.
        /// </summary>
        /// <param name="grfLaunch">A flag that determines the conditions under which to start the debugger. For valid grfLaunch values, see __VSDBGLAUNCHFLAGS</param>
        /// <returns>If the method succeeds, it returns S_OK. If it fails, it returns an error code</returns>
        public virtual int DebugLaunch(uint grfLaunch)
        {
            CciTracing.TraceCall();

            try
            {
                VsDebugTargetInfo info = new VsDebugTargetInfo();
                info.cbSize = (uint)Marshal.SizeOf(info);
                info.dlo    = Microsoft.VisualStudio.Shell.Interop.DEBUG_LAUNCH_OPERATION.DLO_CreateProcess;

                // On first call, reset the cache, following calls will use the cached values
                string property = GetConfigurationProperty("StartProgram", _PersistStorageType.PST_USER_FILE, true);
                if (string.IsNullOrEmpty(property))
                {
                    info.bstrExe = this._project.GetOutputAssembly(this.ConfigName, this.Platform);
                }
                else
                {
                    info.bstrExe = property;
                }

                property = GetConfigurationProperty("WorkingDirectory", _PersistStorageType.PST_USER_FILE, false);
                if (string.IsNullOrEmpty(property))
                {
                    info.bstrCurDir = Path.GetDirectoryName(info.bstrExe);
                }
                else
                {
                    info.bstrCurDir = property;
                }

                property = GetConfigurationProperty("CmdArgs", _PersistStorageType.PST_USER_FILE, false);
                if (!string.IsNullOrEmpty(property))
                {
                    info.bstrArg = property;
                }

                property = GetConfigurationProperty("RemoteDebugMachine", _PersistStorageType.PST_USER_FILE, false);
                if (property != null && property.Length > 0)
                {
                    info.bstrRemoteMachine = property;
                }

                info.fSendStdoutToOutputWindow = 0;

                property = GetConfigurationProperty("EnableUnmanagedDebugging", _PersistStorageType.PST_USER_FILE, false);
                if (property != null && string.Equals(property, "true", StringComparison.OrdinalIgnoreCase))
                {
                    //Set the unmanged debugger
                    info.clsidCustom = VSConstants.DebugEnginesGuids.NativeOnly_guid;
                }
                else
                {
                    //Set the managed debugger
                    info.clsidCustom = VSConstants.DebugEnginesGuids.ManagedOnly_guid;
                }

                info.grfLaunch = grfLaunch;
                VsShellUtilities.LaunchDebugger(this._project.Site, info);
            }
            catch (Exception e)
            {
                Trace.WriteLine("Exception : " + e.Message);

                return(Marshal.GetHRForException(e));
            }

            return(VSConstants.S_OK);
        }
Ejemplo n.º 29
0
 public static void TraceCall(string parameters)
 {
     CciTracing.InternalTraceCall(2);
     System.Diagnostics.Trace.WriteLine("\tParameters: \t" + parameters);
 }
Ejemplo n.º 30
0
 public virtual int get_IsSpecifyingOutputSupported(out int f)
 {
     CciTracing.TraceCall();
     f = 1;
     return(VSConstants.S_OK);
 }