}// 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
}// 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