}// InsertPropSheetPageControls

        //-------------------------------------------------
        // PutValuesinPage
        //
        // This function put data onto the property page
        //-------------------------------------------------
        private void PutValuesinPage()
        {
            // Get info that we'll need from the node
            CNode node = CNodeManager.GetNode(m_iCookie);
            // This should be ok now, but if we need this functionality
            // off of different nodes.....
            CVersionPolicy vp = (CVersionPolicy)node;



            m_txtAssemName.Text      = m_bri.Name;
            m_txtPublicKeyToken.Text = m_bri.PublicKeyToken;

            // Figure out the current Publisher Policy Setting

            String sGetSettingString = "PublisherPolicyFor" + m_bri.Name + "," + m_bri.PublicKeyToken;

            // If we are getting this from an App config file, let's add that info
            m_sConfigFile = vp.ConfigFile;

            if (m_sConfigFile != null)
            {
                sGetSettingString += "," + m_sConfigFile;
                bool fUsePubPolicy = (bool)CConfigStore.GetSetting(sGetSettingString);
                m_chkPubPolicy.Checked = fUsePubPolicy;
            }
            // If this isn't an app config file, we don't want to show the
            // 'Apply Publisher Policy' Checkbox or description
            else
            {
                m_chkPubPolicy.Visible           = false;
                m_lblPublisherPolicyHelp.Visible = false;
            }
        }// PutValuesinPage
Esempio n. 2
0
        }// onDeleteEntireRow

        private void PutValuesinPage()
        {
            // Get info that we'll need from the node
            CNode node = CNodeManager.GetNode(m_iCookie);
            // This should be ok now, but if we need this functionality
            // off of different nodes.....
            CVersionPolicy vp = (CVersionPolicy)node;


            String sGetSettingString = "BindingPolicyFor" + m_bri.Name + "," + m_bri.PublicKeyToken;

            // If we are getting this from an App config file, let's add that info
            m_sConfigFile = vp.ConfigFile;

            if (m_sConfigFile != null)
            {
                sGetSettingString += "," + m_sConfigFile;
            }

            BindingPolicy bp = (BindingPolicy)CConfigStore.GetSetting(sGetSettingString);

            int iLen = bp.scBaseVersion.Count;

            for (int i = 0; i < iLen; i++)
            {
                DataRow newRow;
                newRow = m_dt.NewRow();
                newRow["Requested Version"] = bp.scBaseVersion[i];
                newRow["New Version"]       = bp.scRedirectVersion[i];
                m_dt.Rows.Add(newRow);
            }

            // We want to have at least 1 row
            while (m_dt.Rows.Count < 1)
            {
                DataRow newRow;
                newRow = m_dt.NewRow();
                newRow["Requested Version"] = "";
                newRow["New Version"]       = "";
                m_dt.Rows.Add(newRow);
            }
            m_dg.CurrentCell = new DataGridCell(iLen, 0);
        }// PutValuesinPage
Esempio n. 3
0
        }// CreatePropertyPages

        //-------------------------------------------------
        // CreateChildren
        //
        // This function creates the node's children, registers
        // the nodes with the node manager, and places the node's
        // cookies in it's child array
        //-------------------------------------------------
        internal override void CreateChildren()
        {
            CNode node    = null;
            int   iCookie = 0;

            bool fNonMMC = CNodeManager.Console is INonMMCHost;


            // Some of these nodes we shouldn't add if we're not MMC


            // This node is only valid on the local machine
            if (Data == 1 && !fNonMMC)
            {
                node    = new CSharedAssemblies();
                iCookie = CNodeManager.AddNode(ref node);
                AddChild(iCookie);
            }

            if (!fNonMMC)
            {
                // Now add a Version Policy node
                node    = new CVersionPolicy();
                iCookie = CNodeManager.AddNode(ref node);
                AddChild(iCookie);

                // Now add a Subscribed services node
                node    = new CRemoting();
                iCookie = CNodeManager.AddNode(ref node);
                AddChild(iCookie);
            }
            // Add a Security policy node
            node    = new CGenSecurity();
            iCookie = CNodeManager.AddNode(ref node);
            AddChild(iCookie);

            // And add an Applications Node
            node    = new CGenApplications();
            iCookie = CNodeManager.AddNode(ref node);
            AddChild(iCookie);
        } // CreateChildren
Esempio n. 4
0
        }// AppDependsNode

        //-------------------------------------------------
        // CreateChildren
        //
        // An application node has a binding policy node and a
        // subscribed services node
        //-------------------------------------------------
        internal override void CreateChildren()
        {
            CNode node    = null;
            int   iCookie = -1;

            // We'll only give an application depends node if we have an app file
            if (m_appInfo.sAppFile.Length > 0)
            {
                // add a application depencies node
                node    = new CApplicationDepends(m_appInfo.sAppFile);
                iCookie = CNodeManager.AddNode(ref node);
                AddChild(iCookie);
            }

            // Now add a Version Policy node
            node    = new CVersionPolicy(m_appInfo.sAppConfigFile);
            iCookie = CNodeManager.AddNode(ref node);
            AddChild(iCookie);

            // Now add a Remoting node
            node    = new CRemoting(m_appInfo.sAppConfigFile);
            iCookie = CNodeManager.AddNode(ref node);
            AddChild(iCookie);
        }// CreateChildren
Esempio n. 5
0
        }// isRepeatBindingRedirInfo

        internal override int Paste(IDataObject ido)
        {
            CDO cdo = (CDO)ido;
            BindingRedirInfo bri = new BindingRedirInfo();

            // See if this is coming from the Shared Assemblies node
            if (cdo.Node is CSharedAssemblies)
            {
                CSharedAssemblies shared = (CSharedAssemblies)(cdo.Node);
                if (cdo.Data is AssemInfo)
                {
                    AddAssemInfo((AssemInfo)cdo.Data);
                }
                // This is an array list... with bunches of stuff in it
                else
                {
                    ArrayList al = (ArrayList)cdo.Data;
                    for (int i = 0; i < al.Count; i++)
                    {
                        AddAssemInfo(shared.GetAssemInfo((int)al[i] - 1));
                    }
                }
            }
            else if (cdo.Node is CApplicationDepends)
            {
                CApplicationDepends appDepends = (CApplicationDepends)(cdo.Node);
                if (cdo.Data is int)
                {
                    AddAssemInfo(appDepends.GetAssemInfo((int)cdo.Data - 1));
                }
                // This is an array list... with bunches of stuff in it
                else
                {
                    ArrayList al = (ArrayList)cdo.Data;
                    for (int i = 0; i < al.Count; i++)
                    {
                        AddAssemInfo(appDepends.GetAssemInfo((int)al[i] - 1));
                    }
                }
            }
            // This is coming from another Version Policy Node
            // We'll copy over all the binding policy this node has
            else
            {
                ArrayList      alStuff = new ArrayList();
                CVersionPolicy verpol  = (CVersionPolicy)(cdo.Node);


                if (cdo.Data is BindingRedirInfo)
                {
                    alStuff.Add(cdo.Data);
                }
                else
                {
                    // Run through and change all the indexes to BindingRedirInfos
                    ArrayList alIndexes = (ArrayList)cdo.Data;
                    for (int i = 0; i < alIndexes.Count; i++)
                    {
                        alStuff.Add(verpol.GetBindRedirInfo((int)alIndexes[i] - 1));
                    }
                }

                bool fSkipWarningDialog = false;
                for (int i = 0; i < alStuff.Count; i++)
                {
                    bri = (BindingRedirInfo)alStuff[i];

                    // Let's see if we have this item
                    bool fHaveItem = isRepeatBindingRedirInfo(bri);

                    bool fAddItem = !fHaveItem;
                    if (fHaveItem && !fSkipWarningDialog)
                    {
                        String sMessageText = "";
                        if (alStuff.Count == 1)
                        {
                            sMessageText = String.Format(CResourceStore.GetString("CVersionPolicy:ConfigInfoExistsForOneAssem"), bri.Name);
                        }
                        else
                        {
                            sMessageText = CResourceStore.GetString("CVersionPolicy:ConfigInfoExists");
                        }

                        int hr = MessageBox(sMessageText,
                                            CResourceStore.GetString("CVersionPolicy:ConfigInfoExistsTitle"),
                                            MB.ICONQUESTION | MB.YESNO);
                        if (hr == MB.IDYES)
                        {
                            fAddItem = true;
                        }
                        fSkipWarningDialog = fAddItem;
                    }

                    if (fAddItem)
                    {
                        // Set up some strings we need
                        String sFirstPartOfBinding  = "BindingPolicyFor" + bri.Name + "," + bri.PublicKeyToken;
                        String sFirstPartOfCodebase = "CodeBasesFor" + bri.Name + "," + bri.PublicKeyToken;
                        String sFirstPartOfPubPol   = "PublisherPolicyFor" + bri.Name + "," + bri.PublicKeyToken;

                        // If we are getting and writing this to an App config file,
                        // let's add that info
                        String sSecondPartOnIncoming = "";
                        if (verpol.m_sConfigFile != null)
                        {
                            sSecondPartOnIncoming = "," + verpol.m_sConfigFile;
                        }

                        String sSecondPartOnDest = "";
                        if (m_sConfigFile != null)
                        {
                            sSecondPartOnDest += "," + m_sConfigFile;
                        }

                        AddConfiguredAssembly(bri);

                        //--------------------------------------------
                        // First, read the stuff from the config store
                        //--------------------------------------------
                        // First get the binding policy
                        String        sGetSettingString = sFirstPartOfBinding + sSecondPartOnIncoming;
                        BindingPolicy bp = (BindingPolicy)CConfigStore.GetSetting(sGetSettingString);

                        // Now get the codebase info
                        sGetSettingString = sFirstPartOfCodebase + sSecondPartOnIncoming;
                        CodebaseLocations cbl = (CodebaseLocations)CConfigStore.GetSetting(sGetSettingString);

                        sGetSettingString = sFirstPartOfPubPol + sSecondPartOnIncoming;
                        bool fPubPolicy = (bool)CConfigStore.GetSetting(sGetSettingString);


                        //---------------------------------------------
                        // Now let's write this stuff to our config file
                        //---------------------------------------------

                        // First write the binding policy
                        String sSetSettingString = sFirstPartOfBinding + sSecondPartOnDest;
                        if (!CConfigStore.SetSetting(sSetSettingString, bp))
                        {
                            return(HRESULT.S_FALSE);
                        }

                        // Now Set the codebase info
                        sSetSettingString = sFirstPartOfCodebase + sSecondPartOnDest;
                        if (!CConfigStore.SetSetting(sSetSettingString, cbl))
                        {
                            return(HRESULT.S_FALSE);
                        }

                        sSetSettingString = sFirstPartOfPubPol + sSecondPartOnDest;
                        if (!CConfigStore.SetSetting(sSetSettingString, fPubPolicy))
                        {
                            return(HRESULT.S_FALSE);
                        }
                    }
                } // for loop
            }     // coming from another version policy node


            return(HRESULT.S_OK);
        }// Paste