}// AddMenuItems internal override void MenuCommand(int nCommandID, Object oResultItem) { if (nCommandID == COMMANDS.DUPLICATE_PERMISSIONSET) { NamedPermissionSet nps = (NamedPermissionSet)m_psetWrapper.PSet.Copy(); String sBaseName = nps.Name; nps.Name = String.Format(CResourceStore.GetString("CSinglePermissionSet:PrependtoDupPSets"), nps.Name); int nCounter = 1; // make sure it's not already used while (Security.isPermissionSetNameUsed(m_pl, nps.Name)) { nCounter++; nps.Name = String.Format(CResourceStore.GetString("CSinglePermissionSet:NumPrependtoDupPSets"), nCounter.ToString(), sBaseName); } CNode node = CNodeManager.GetNodeByHScope(ParentHScopeItem); CSinglePermissionSet newNode = ((CPermissionSet)node).AddPermissionSet(nps); newNode.SecurityPolicyChanged(); // Put the selection on the new permission set we just created CNodeManager.SelectScopeItem(newNode.HScopeItem); } else if (nCommandID == COMMANDS.VIEW_PERMISSION) { int iResultItem = (int)oResultItem - 1; // Pop up the Dialog Box for this permission (new CReadOnlyPermission((IPermission)m_alPermissions[iResultItem])).ShowDialog(); } else if (nCommandID == COMMANDS.ADD_PERMISSIONS) { CAddPermissionsWizard wiz = new CAddPermissionsWizard(m_psetWrapper); wiz.LaunchWizard(Cookie); if (wiz.didFinish) { SecurityPolicyChanged(); GenerateGivenPermissionsStringList(); CNodeManager.Console.SelectScopeItem(HScopeItem); } } else if (nCommandID == COMMANDS.SHOW_LISTVIEW) { m_oResults = this; RefreshResultView(); m_fShowHTMLPage = false; } else if (nCommandID == COMMANDS.SHOW_TASKPAD) { m_oResults = m_taskpad; m_fShowHTMLPage = true; // The HTML pages comes displayed with this checkbox marked. Make // sure we update the xml setting CConfigStore.SetSetting("ShowHTMLForPermissionSet", "yes"); RefreshResultView(); } }// MenuCommand
}// PSet internal override void TaskPadTaskNotify(Object arg, Object param, IConsole2 con, CData com) { if ((int)arg == 0) { m_oResults = this; RefreshResultView(); } else if ((int)arg == 1) { MenuCommand(COMMANDS.ADD_PERMISSIONS); } else if ((int)arg == 2) { OpenMyPropertyPage(); } else if ((int)arg == 3) { CConfigStore.SetSetting("ShowHTMLForPermissionSet", (bool)param?"yes":"no"); m_fShowHTMLPage = (bool)param; // We'll change the result object but we won't refresh our result view // because the user doesn't necesarily want that to happen. However, // the next time the user visits this node, they will see the new result // view m_oResults = m_fShowHTMLPage?(Object)m_taskpad:(Object)this; } }// TaskPadTaskNotify
}// PutValuesinPage //------------------------------------------------- // ApplyData // // This function gets called when the user clicks the // OK or Apply button. We should take all our information // from the wizard and "Make it so". //------------------------------------------------- internal override bool ApplyData() { // Set the garbage collector setting String sGCSetting; sGCSetting = (m_radNormal.Checked == true)?"false":"true"; if (!CConfigStore.SetSetting("GarbageCollector," + m_appFiles.sAppConfigFile, sGCSetting)) { return(false); } // Set the binding mode String sBindingSetting; sBindingSetting = (m_chkSafeBinding.Checked == true)?"yes":"no"; if (!CConfigStore.SetSetting("BindingMode," + m_appFiles.sAppConfigFile, sBindingSetting)) { return(false); } // Set the Search Path if (!CConfigStore.SetSetting("SearchPath," + m_appFiles.sAppConfigFile, m_txtSearchPath.Text)) { return(false); } /* * // Set the required version of the runtime * CConfigStore.SetSetting("RequiredRuntimeVersion," + m_appFiles.sAppConfigFile, m_cbRuntimeVersion.Text); */ return(true); }// ApplyData
}// 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
}// AddMenuItems internal override void MenuCommand(int nCommandID, Object oResultItem) { if (nCommandID == COMMANDS.ADD_ASSEMBLY) { CFusionNoVersionDialog fd = new CFusionNoVersionDialog(); System.Windows.Forms.DialogResult dr = fd.ShowDialog(); if (dr == System.Windows.Forms.DialogResult.OK) { AddAssembly(fd.Assem); } } else if (nCommandID == COMMANDS.SHOW_LISTVIEW) { m_oResults = this; RefreshResultView(); m_fShowHTMLPage = false; } else if (nCommandID == COMMANDS.SHOW_TASKPAD) { m_oResults = m_taskPad; m_fShowHTMLPage = true; // The HTML pages comes displayed with this checkbox marked. Make // sure we update the xml setting CConfigStore.SetSetting("ShowHTMLForFullTrustAssem", "yes"); RefreshResultView(); } }// MenuCommand
}// onRestoreView internal override void TaskPadTaskNotify(Object arg, Object param, IConsole2 con, CData com) { if ((int)arg == 1) { CConfigStore.SetSetting("ShowHTMLForSharedAssem", (bool)param?"yes":"no"); m_fShowHTMLPage = (bool)param; // We'll change the result object but we won't refresh our result view // because the user doesn't necesarily want that to happen. However, // the next time the user visits this node, they will see the new result // view m_oResults = m_fShowHTMLPage?(Object)m_taskPad:(Object)this; } else if ((int)arg == 0) { m_oResults = this; RefreshResultView(); } else if ((int)arg == 2) { MenuCommand(COMMANDS.ADD_GACASSEMBLY, null); // Inform our Command History that we did this CCommandHistory.CommandExecuted(new CDO(this), COMMANDS.ADD_GACASSEMBLY); } }// TaskPadTaskNotify
}// onDoubleClick internal override int onDelete(Object o) { String sMessage; if (o is ArrayList) { sMessage = CResourceStore.GetString("CVersionPolicy:ConfirmDeleteConfig"); } else { sMessage = String.Format(CResourceStore.GetString("CVersionPolicy:ConfirmDeleteSingleConfig"), ((BindingRedirInfo)o).Name); } int nRes = MessageBox(sMessage, CResourceStore.GetString("CVersionPolicy:ConfirmDeleteConfigTitle"), MB.ICONQUESTION | MB.YESNO); if (nRes == MB.IDYES) { // Let's trace through our parents looking for an Application node CNode node = CNodeManager.GetNode(m_iCookie); // If this node's parent is an Application node, then we know we're // configuring assemblies on a per app basis int iParentHScope = node.ParentHScopeItem; if (iParentHScope != -1) { node = CNodeManager.GetNodeByHScope(iParentHScope); } 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 (o is ArrayList) { ArrayList al = (ArrayList)o; int nLen = al.Count; for (int i = 0; i < nLen; i++) { int iResultNum = ((int)al[i]) - 1; CConfigStore.SetSetting("ConfiguredAssembliesDelete" + sPostFix, ((BindingRedirInfo)m_ol[iResultNum])); } } else { CConfigStore.SetSetting("ConfiguredAssembliesDelete" + sPostFix, (BindingRedirInfo)o); } // Now we'll Refresh ourselves RefreshResultView(); } return(HRESULT.S_OK); }// onDelete
}// onChange internal override bool ApplyData() { if (m_sConfigFile != null) { String sSetSettingString = "PublisherPolicyFor" + m_bri.Name + "," + m_bri.PublicKeyToken; sSetSettingString += "," + m_sConfigFile; return(CConfigStore.SetSetting(sSetSettingString, m_chkPubPolicy.Checked)); } return(true); } // ApplyData
}// AddMenuItems internal override void MenuCommand(int iCommandID, Object oResultNum) { if (iCommandID == COMMANDS.ADD_ASSEMBLY) { CApplicationDepends appDepends = null; // Let's trace through our parents looking for an Application node CNode node = CNodeManager.GetNode(m_iCookie); // If this node's parent is an Application node, then we know we're // configuring assemblies on a per app basis int iParentHScope = node.ParentHScopeItem; if (iParentHScope != -1) { node = CNodeManager.GetNodeByHScope(iParentHScope); } // If this is an application node, make sure we tell the config store // about it if (node is CApplication) { // Cool, we have a dependent assemblies node appDepends = ((CApplication)node).AppDependsNode; } CConfigAssemWizard wiz = new CConfigAssemWizard(appDepends); wiz.LaunchWizard(Cookie); if (wiz.NewAssembly != null) { if (AddConfiguredAssembly(wiz.NewAssembly)) { onDoubleClick(wiz.NewAssembly); } } } else if (iCommandID == COMMANDS.SHOW_LISTVIEW) { m_oResults = this; RefreshResultView(); m_fShowHTMLPage = false; } else if (iCommandID == COMMANDS.SHOW_TASKPAD) { m_oResults = m_taskPad; m_fShowHTMLPage = true; // The HTML pages comes displayed with this checkbox marked. Make // sure we update the xml setting CConfigStore.SetSetting("ShowHTMLForConfigAssem", "yes"); RefreshResultView(); } }// MenuCommand
}// ValidateData internal override bool ApplyData() { // Make sure we've displayed this page first if (m_dg != null) { // Let's build a CodebaseLocations structure and put all our data in it. CodebaseLocations cbl = new CodebaseLocations(); cbl.scVersion = new StringCollection(); cbl.scCodeBase = new StringCollection(); // Let's jump to a new cell, to make sure the current cell we // were editing has it's changes 'saved' m_dg.CurrentCell = new DataGridCell(0, 1); m_dg.CurrentCell = new DataGridCell(0, 0); // We need to do a try/catch block here since we getting the count of // rows from the data table isn't completely accurate, so we'll just loop // until the data grid throws us an exception about accessing an invalid row. int nRow = 0; while (nRow <= m_dt.Rows.Count) { if (isValidRow(nRow)) { cbl.scVersion.Add((String)m_dg[nRow, 0]); cbl.scCodeBase.Add((String)m_dg[nRow, 1]); } nRow++; } String sSetSettingString = "CodeBasesFor" + m_bri.Name + "," + m_bri.PublicKeyToken; if (m_sConfigFile != null) { sSetSettingString += "," + m_sConfigFile; } if (!CConfigStore.SetSetting(sSetSettingString, cbl)) { return(false); } CNodeManager.GetNode(m_iCookie).RefreshResultView(); return(true); } return(false); }// ApplyData
}// onChannelChange internal override bool ApplyData() { m_dg.CurrentCell = new DataGridCell(0, 0); // This call will copy all the current table stuff into our ArrayList onChannelChange(null, null); String sSettingCommand = "RemotingChannels"; if (m_sConfigFile != null) { sSettingCommand += "," + m_sConfigFile; } return(CConfigStore.SetSetting(sSettingCommand, m_alRemotingChannels)); } // ApplyData
}// PutValuesinPage internal override bool ApplyData() { if (!CConfigStore.SetSetting("SecurityEnabled", m_chkUseSecurity.Checked)) { return(false); } if (!CConfigStore.SetSetting("GarbageCollector", m_radConcurrent.Checked?"true":"false")) { return(false); } PutValuesinPage(); return(true); }// ApplyData
}// Showing internal override int onDelete(Object o) { int nRes = MessageBox(CResourceStore.GetString("CApplication:VerifyRemoveApp"), CResourceStore.GetString("CApplication:VerifyRemoveAppTitle"), MB.ICONQUESTION | MB.YESNO); if (nRes == MB.IDYES) { // Grab our parent node and tell him to remove us CNodeManager.GetNodeByHScope(ParentHScopeItem).RemoveSpecificChild(Cookie); // Change the XML... if (CConfigStore.SetSetting("RemoveAppConfigFile", m_appInfo)) { return(HRESULT.S_OK); } } return(HRESULT.S_FALSE); }// onDelete
}// AddMenuItems internal override void MenuCommand(int iCommandID, Object oResultItem) { if (iCommandID == COMMANDS.FIND_DEPENDENTASSEMBLIES) { // Ok, let's see if we're currently being worked on.... m_thread.Suspend(); m_taskPadWaiting = new CGenericTaskPad(this, "LOADINGDEPENDASSEM_HTML"); m_oResults = m_taskPadWaiting; RefreshResultView(); // If the thread is currently working on this node, m_ThreadNode will be this node. // The second case is a little more tricky. If this node is next in line, there's // the possibility that our thread that handles this will be a few instructions // away from getting him. We won't bother working with it then. if (!m_fIKnowMyDependencies && m_ThreadNode != this && m_alNodes[0] != this) { FindDependenciesForThisNode(this); m_fIKnowMyDependencies = true; } // Our thread is working on it... let's give it high priority... else { m_thread.Priority = ThreadPriority.Highest; } m_thread.Resume(); } else if (iCommandID == COMMANDS.SHOW_LISTVIEW && m_fAllowListView) { m_oResults = this; RefreshResultView(); m_fShowHTMLPage = false; } else if (iCommandID == COMMANDS.SHOW_TASKPAD) { m_oResults = m_taskPad; m_fShowHTMLPage = true; // The HTML pages comes displayed with this checkbox marked. Make // sure we update the xml setting CConfigStore.SetSetting("ShowHTMLForDependAssem", "yes"); RefreshResultView(); } }// MenuCommand
}// onRemotingAppChange internal override bool ApplyData() { // Get our currently displayed data into our array list if (m_alRemotingAppInfo.Count > 0) { m_dg.CurrentCell = new DataGridCell(0, 0); m_dg.CurrentCell = new DataGridCell(0, 1); } onRemotingAppChange(null, null); String sSettingCommand = "RemotingApplications"; if (m_sConfigFile != null) { sSettingCommand += "," + m_sConfigFile; } return(CConfigStore.SetSetting(sSettingCommand, m_alRemotingAppInfo)); } // ApplyData
}// onDelete internal override void TaskPadTaskNotify(Object arg, Object param, IConsole2 con, CData com) { if ((int)arg == 1) { CConfigStore.SetSetting("ShowHTMLForFullTrustAssem", (bool)param?"yes":"no"); m_fShowHTMLPage = (bool)param; // We'll change the result object but we won't refresh our result view // because the user doesn't necesarily want that to happen. However, // the next time the user visits this node, they will see the new result // view m_oResults = m_fShowHTMLPage?(Object)m_taskPad:(Object)this; } else if ((int)arg == 0) { m_oResults = this; RefreshResultView(); } }// TaskPadTaskNotify
}// ValidateData internal override bool ApplyData() { if (m_et.scWellKnownMode.Count > 0) { m_dgObjectURIs.CurrentCell = new DataGridCell(0, 0); } for (int i = 0; i < m_et.scWellKnownMode.Count; i++) { m_et.scWellKnownUri[i] = (String)m_dtObjectURIs.Rows[i]["URI"]; } String sSettingCommand = "ExposedTypes"; if (m_sConfigFile != null) { sSettingCommand += "," + m_sConfigFile; } return(CConfigStore.SetSetting(sSettingCommand, m_et)); } // ApplyData
}// CCommandHistory static internal void Shutdown() { // Write our stuff to the configuration file WeedOutOldCommands(); CConfigStore.SetSetting("CommandHistory", m_olCommands); }// Shutdown
}// CheckForDuplicateApp //------------------------------------------------- // 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() { // Don't bother doing any of this if we're not using MMC if (!(CNodeManager.Console is INonMMCHost)) { // Grab all the applications we know about and display the names to the // user ArrayList alApps = (ArrayList)CConfigStore.GetSetting("AppConfigFiles"); int iLen = alApps.Count; for (int i = 0; i < iLen; i++) { // Check to see if this App still exists AppFiles af = (AppFiles)alApps[i]; // We need either an exe or a config file to do this bool fHaveSomething = false; // Verify the exe still exists.... if (af.sAppFile != null && af.sAppFile.Length > 0) { if (File.Exists(af.sAppFile)) { fHaveSomething = true; } else { // The exe doesn't exist anymore. Let's update the record CConfigStore.SetSetting("RemoveAppConfigFile", af); af.sAppFile = ""; CConfigStore.SetSetting("AppConfigFiles", af); } } // Verify the config file exists if (af.sAppConfigFile != null && af.sAppConfigFile.Length > 0) { // If we don't have an exe, let's see if we can find it if ((af.sAppFile == null || af.sAppFile.Length == 0) && af.sAppConfigFile.Length > 6) { String sExtension = af.sAppConfigFile.Substring(af.sAppConfigFile.Length - 6).ToUpper(CultureInfo.InvariantCulture); if (sExtension.ToUpper(CultureInfo.InvariantCulture).Equals("CONFIG")) { // This is an appropriately named config file. Let's see if there is an assembly around there as well. String sAssemName = af.sAppConfigFile.Substring(0, af.sAppConfigFile.Length - 7); if (File.Exists(sAssemName)) { // Cool. When the user first added the application, they only had a config // file. Now they have an exe too. We'll take note of that CConfigStore.SetSetting("RemoveAppConfigFile", af); af.sAppFile = sAssemName; CConfigStore.SetSetting("AppConfigFiles", af); fHaveSomething = true; } } } // Check to see if the config file is still valid if (File.Exists(af.sAppConfigFile)) { fHaveSomething = true; } // If it doesn't exist... not a big deal. Config files could get // deleted. No worries. } // See if we snagged something to go off of if (fHaveSomething) { CNode node = new CApplication(af); int iCookie = CNodeManager.AddNode(ref node); AddChild(iCookie); } // This entry is now bogus. Get rid of it else { CConfigStore.SetSetting("RemoveAppConfigFile", af); } } } }// CreateChildren
}// AddMenuItems internal override void MenuCommand(int iCommandID) { if (iCommandID == COMMANDS.ADD_APPLICATION) { // Pop up a dialog so the user can find an assembly CChooseAppDialog cad = new CChooseAppDialog(); System.Windows.Forms.DialogResult dr = cad.ShowDialog(); if (dr == System.Windows.Forms.DialogResult.OK) { String sConfigFile = cad.Filename; String sAppFilename = ""; // If this is an executable or Dll, or if it is managed int iLen = sConfigFile.Length; if (iLen > 3) { String sExtension = sConfigFile.Substring(sConfigFile.Length - 3).ToUpper(CultureInfo.InvariantCulture); if (sExtension.ToUpper(CultureInfo.InvariantCulture).Equals("EXE") || sExtension.ToUpper(CultureInfo.InvariantCulture).Equals("DLL") || Fusion.isManaged(sConfigFile)) { sAppFilename = sConfigFile; // Let's add a config extension sConfigFile = sConfigFile + ".config"; } else if (iLen > 6) { // Check to see if they selected a config file sExtension = sConfigFile.Substring(sConfigFile.Length - 6).ToUpper(CultureInfo.InvariantCulture); if (sExtension.ToUpper(CultureInfo.InvariantCulture).Equals("CONFIG")) { // They've selected a config file. Let's see if there is an assembly around there as well. String sAssemName = sConfigFile.Substring(0, sConfigFile.Length - 7); if (File.Exists(sAssemName)) { sAppFilename = sAssemName; } } } } AppFiles appFile = new AppFiles(); appFile.sAppFile = sAppFilename; appFile.sAppConfigFile = sConfigFile; // Check to see if we already have this app file shown CNode node = CheckForDuplicateApp(appFile); if (node == null) { CConfigStore.SetSetting("AppConfigFiles", appFile); node = new CApplication(appFile); int iCookie = CNodeManager.AddNode(ref node); AddChild(iCookie); InsertSpecificChild(iCookie); } CNodeManager.Console.SelectScopeItem(node.HScopeItem); } } else if (iCommandID == COMMANDS.FIX_APPLICATION) { PolicyManager(CNodeManager.MMChWnd, null, null, null); } }// MenuCommand
}// 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
}// AddMenuItems internal override void MenuCommand(int iCommandID, Object oResultItem) { if (iCommandID == COMMANDS.ADD_GACASSEMBLY) { // Pop up a file dialog so the user can find an assembly OpenFileDialog fd = new OpenFileDialog(); fd.Title = CResourceStore.GetString("CSharedAssemblies:AddAssemFDTitle"); fd.Filter = CResourceStore.GetString("AssemFDMask"); fd.Multiselect = true; System.Windows.Forms.DialogResult dr = fd.ShowDialog(); if (dr == System.Windows.Forms.DialogResult.OK) { for (int i = 0; i < fd.FileNames.Length; i++) { if (!AddAssemToFusion(fd.FileNames[i])) { // If we can't add assemblies due to an access denied, then // just stop trying with our list of assemblies break; } } } // Find the assembly we just added in order to select it int nCount = getNumRows(); for (int i = 0; i < nCount; i++) { if (TurnCodebaseToFilename(GetAssemInfo(i).Codebase).ToLower(CultureInfo.InvariantCulture).Equals(fd.FileNames[0].ToLower(CultureInfo.InvariantCulture))) { IResultData ResultData = (IResultData)CNodeManager.CConsole; RESULTDATAITEM rdi = new RESULTDATAITEM(); rdi.mask = RDI.STATE; rdi.nCol = 0; rdi.nIndex = i; rdi.nState = LVIS.SELECTED; ResultData.SetItem(ref rdi); break; } } } else if (iCommandID == COMMANDS.SHOW_LISTVIEW) { m_oResults = this; RefreshResultView(); m_fShowHTMLPage = false; } else if (iCommandID == COMMANDS.SHOW_TASKPAD) { m_oResults = m_taskPad; m_fShowHTMLPage = true; // The HTML pages comes displayed with this checkbox marked. Make // sure we update the xml setting CConfigStore.SetSetting("ShowHTMLForSharedAssem", "yes"); RefreshResultView(); } else if (iCommandID == COMMANDS.REFRESH_DISPLAY) { RefreshResultView(); } }// MenuCommand