예제 #1
0
        }// TaskPadTaskNotify

        internal bool AddConfiguredAssembly(BindingRedirInfo bri)
        {
            // Let's trace through our parents looking for an Application node
            // If this node's parent is an Application node, then we know we're
            // configuring assemblies on a per app basis
            CNode node = null;

            if (ParentHScopeItem != -1)
            {
                node = CNodeManager.GetNodeByHScope(ParentHScopeItem);
            }

            String sPostFix = "";

            // If this is an application node, make sure we tell the config store
            // about it
            if (node is CApplication)
            {
                sPostFix = "," + ((CApplication)node).AppConfigFile;
            }

            if (!CConfigStore.SetSetting("ConfiguredAssemblies" + sPostFix, bri))
            {
                return(false);
            }

            // Now we'll tell out node to Refresh itself,
            // but only if we're showing the list view
            if (m_oResults == this)
            {
                RefreshResultView();
            }

            return(true);
        }// AddConfiguredAssembly
        internal CConfigAssemWizard(CApplicationDepends appDepends)
        {
            m_sName        = "Configure Assembly Wizard";
            m_sDisplayName = "Assembly Wizard";

            m_aPropSheetPage = new CPropPage[] { new CConfigAssemWiz1(appDepends) };
            m_bri            = null;
        }// CConfigAssemWizard
예제 #3
0
        }// doAcceptPaste

        private void AddAssemInfo(AssemInfo asinfo)
        {
            BindingRedirInfo bri = new BindingRedirInfo();

            bri.Name           = asinfo.Name;
            bri.PublicKeyToken = asinfo.PublicKeyToken;
            AddConfiguredAssembly(bri);
        }// AddAssmInfo
예제 #4
0
        }// Paste

        internal override int onDoubleClick(Object o)
        {
            if (o != null)
            {
                BindingRedirInfo bri = (BindingRedirInfo)o;
                CDO cdo = new CDO(this);
                cdo.Data = o;
                OpenMyResultPropertyPage(bri.Name, cdo);

                return(HRESULT.S_OK);
            }
            return(HRESULT.S_FALSE);
        }// onDoubleClick
예제 #5
0
        }// AddAssmInfo

        private bool isRepeatBindingRedirInfo(BindingRedirInfo bri)
        {
            int iLen = m_ol.Count;

            for (int i = 0; i < iLen; i++)
            {
                BindingRedirInfo tmp = (BindingRedirInfo)m_ol[i];
                if (tmp.Name.Equals(bri.Name) && tmp.PublicKeyToken.Equals(bri.PublicKeyToken))
                {
                    return(true);
                }
            }
            return(false);
        }// isRepeatBindingRedirInfo
예제 #6
0
        }// ApplyPropPages

        private CPropPage[] GetPropertyPages(BindingRedirInfo bri)
        {
            // Let's see if we already have an entry for this assemby item
            int nLen = m_alResultPropPages.Count;

            for (int i = 0; i < nLen; i++)
            {
                if (CompareBindingRedirInfo(((PropPagePairs)m_alResultPropPages[i]).bri, bri))
                {
                    return(((PropPagePairs)m_alResultPropPages[i]).ppages);
                }
            }

            // If we're here, then we have a new property page to add
            PropPagePairs ppp = new PropPagePairs();

            ppp.ppages = new CPropPage[] { new CConfigAssemGeneralProp(bri), new CAssemBindPolicyProp(bri), new CAssemVerCodebases(bri) };
            ppp.bri    = bri;
            m_alResultPropPages.Add(ppp);
            return(ppp.ppages);
        } // GetPropertyPages
예제 #7
0
        }// GetBindRedirInfo

        private bool CompareBindingRedirInfo(BindingRedirInfo b1, BindingRedirInfo b2)
        {
            // We won't compare the two bools in this class, since the class is identified
            // by its name and internal key token members

            if (!b1.Name.Equals(b2.Name))
            {
                return(false);
            }

            if (b1.PublicKeyToken == null && b2.PublicKeyToken == null)
            {
                return(true);
            }

            if (b1.PublicKeyToken != null && b1.PublicKeyToken.Equals(b2.PublicKeyToken))
            {
                return(true);
            }

            return(false);
        }// CompareBindingRedirInfo
예제 #8
0
 internal CAssemVerCodebases(BindingRedirInfo bri)
 {
     m_bri         = bri;
     m_sConfigFile = null;
     m_sTitle      = CResourceStore.GetString("CAssemVerCodebases:PageTitle");
 }// CAssemVerCodebases
 //-------------------------------------------------
 // CConfigAssemGeneralProp - Constructor
 //
 // Sets up some member variables
 //-------------------------------------------------
 internal CConfigAssemGeneralProp(BindingRedirInfo bri)
 {
     m_bri    = bri;
     m_sTitle = CResourceStore.GetString("CConfigAssemGeneralProp:PageTitle");
 }// CConfigAssemGeneralProp
        }// WizSetActive

        protected override int WizFinish()
        {
            m_bri = ((CConfigAssemWiz1)m_aPropSheetPage[0]).Assembly;
            return(0);
        }// WizFinish
예제 #11
0
 //-------------------------------------------------
 // CAssemBindPolicyProp - Constructor
 //
 // Sets up some member variables
 //-------------------------------------------------
 internal CAssemBindPolicyProp(BindingRedirInfo bri)
 {
     m_bri         = bri;
     m_sConfigFile = null;
     m_sTitle      = CResourceStore.GetString("CAssemBindPolicyProp:PageTitle");
 }// CAssemBindPolicyProp
예제 #12
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