示例#1
0
        }// GetTimeUnitFromTimeString

        private void PutValuesinPage()
        {
            String sSettingCommand = "ExposedTypes";

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

            m_et = (ExposedTypes)CConfigStore.GetSetting(sSettingCommand);

            DataRow newRow;

            // Now build the Well Known objects table
            for (int i = 0; i < m_et.scWellKnownMode.Count; i++)
            {
                newRow = m_dtObjectURIs.NewRow();
                // Find a good name

                String sName = m_et.scWellKnownObjectName[i];
                if (sName == null || sName.Length == 0)
                {
                    // We'll show the type instead
                    sName = m_et.scWellKnownType[i];
                }

                newRow["Object Name"] = sName;
                newRow["URI"]         = m_et.scWellKnownUri[i];

                m_dtObjectURIs.Rows.Add(newRow);
            }
        }// PutValuesinPage
        }// 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
示例#3
0
        }// CompareBindingRedirInfo

        internal override void RefreshResultView()
        {
            if (m_sConfigFile == null)
            {
                m_ol = (ArrayList)CConfigStore.GetSetting("ConfiguredAssemblies");
            }
            else
            {
                m_ol = (ArrayList)CConfigStore.GetSetting("ConfiguredAssemblies," + m_sConfigFile);
            }

            base.RefreshResultView();
        }// RefreshResultView
示例#4
0
        }// onVisibleChange

        private void PutValuesinPage()
        {
            m_nPrevSelection = -1;

            String sSettingCommand = "RemotingChannels";

            if (m_sConfigFile != null)
            {
                sSettingCommand += "," + m_sConfigFile;
            }
            try
            {
                m_alRemotingChannels = (ArrayList)CConfigStore.GetSetting(sSettingCommand);

                m_cbChannel.Items.Clear();
                for (int i = 0; i < m_alRemotingChannels.Count; i++)
                {
                    // Go searching for the "displayname" attribute
                    int j;
                    for (j = 0; j < ((RemotingChannel)m_alRemotingChannels[i]).scAttributeName.Count; j++)
                    {
                        if (((RemotingChannel)m_alRemotingChannels[i]).scAttributeName[j].ToLower(CultureInfo.InvariantCulture).Equals("displayname"))
                        {
                            m_cbChannel.Items.Add(((RemotingChannel)m_alRemotingChannels[i]).scAttributeValue[j]);
                            break;
                        }
                    }
                    // This is funny... this channel didn't have a name....
                    if (j == ((RemotingChannel)m_alRemotingChannels[i]).scAttributeName.Count)
                    {
                        m_cbChannel.Items.Add(CResourceStore.GetString("<no name>"));
                    }
                }

                if (m_alRemotingChannels.Count > 0)
                {
                    m_cbChannel.SelectedIndex = 0;
                    onChannelChange(null, null);
                }
                else
                {
                    m_cbChannel.Text = CResourceStore.GetString("<none>");
                }
            }
            catch (Exception)
            {
                // An exception will get thrown if there was an error reading
                // the remoting config info. Don't allow the property page to open.
                CloseSheet();
            }
        }// PutValuesinPage
示例#5
0
        }// InsertPropSheetPageControls

        private void PutValuesinPage()
        {
            m_chkUseSecurity.Checked = (bool)CConfigStore.GetSetting("SecurityEnabled");

            String setting = (String)CConfigStore.GetSetting("GarbageCollector");

            if (setting != null && setting.ToLower(CultureInfo.InvariantCulture).Equals("true"))
            {
                m_radConcurrent.Checked = true;
            }
            else
            {
                m_radNormal.Checked = true;
            }
        }// PutValuesinPage
示例#6
0
        }// getNumColumns

        public override int getNumRows()
        {
            if (m_ol == null)
            {
                if (m_sConfigFile == null)
                {
                    m_ol = (ArrayList)CConfigStore.GetSetting("ConfiguredAssemblies");
                }
                else
                {
                    m_ol = (ArrayList)CConfigStore.GetSetting("ConfiguredAssemblies," + m_sConfigFile);
                }
            }
            return(m_ol.Count);
        }// GetNumRows
示例#7
0
        }// ValidateData

        private void PutValuesinPage()
        {
            m_nPrevSelection = -1;

            String sSettingCommand = "RemotingApplications";

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

            try
            {
                m_alRemotingAppInfo = (ArrayList)CConfigStore.GetSetting(sSettingCommand);

                m_cbRemoteApps.Items.Clear();
                for (int i = 0; i < m_alRemotingAppInfo.Count; i++)
                {
                    String sName = ((RemotingApplicationInfo)m_alRemotingAppInfo[i]).sName;
                    if (sName == null || sName.Length == 0)
                    {
                        sName = CResourceStore.GetString("CRemotingProp1:NoDisplayName");
                    }

                    m_cbRemoteApps.Items.Add(sName);
                }
                if (m_alRemotingAppInfo.Count > 0)
                {
                    m_cbRemoteApps.DropDownStyle = ComboBoxStyle.DropDownList;
                    m_cbRemoteApps.SelectedIndex = 0;
                    onRemotingAppChange(null, null);
                }
                else
                {
                    m_cbRemoteApps.Text      = CResourceStore.GetString("CRemotingProp1:NoRemoteApps");
                    m_cbRemoteApps.Enabled   = false;
                    m_txtAppLocation.Enabled = false;
                }
            }
            catch (Exception)
            {
                // An exception will get thrown if there was an error reading
                // the remoting config info. Don't allow the property page to open.
                CloseSheet();
            }
        }// PutValuesinPage
示例#8
0
        }// onDelete

        internal override void Showing()
        {
            if (!m_fReadShowHTML)
            {
                m_fShowHTMLPage = ((String)CConfigStore.GetSetting("ShowHTMLForConfigAssem")).Equals("yes");

                if (m_fShowHTMLPage)
                {
                    m_oResults = m_taskPad;
                }
                else
                {
                    m_oResults = this;
                }

                m_fReadShowHTML = true;
            }
        }// Showing
示例#9
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
        }// MenuCommand

        internal override void Showing()
        {
            // Figure out what to display
            if (!m_fReadShowHTML)
            {
                m_taskPad = new CGenericTaskPad(this, "FULLTRUSTASSEM_HTML");

                m_fShowHTMLPage = ((String)CConfigStore.GetSetting("ShowHTMLForFullTrustAssem")).Equals("yes");

                if (m_fShowHTMLPage)
                {
                    m_oResults = m_taskPad;
                }
                else
                {
                    m_oResults = this;
                }
                m_fReadShowHTML = true;
            }
        }// Showing
        }// onRename

        internal override void Showing()
        {
            // See if we've read from the XML file yet whether we're supposed to
            // show the HTML file
            if (!m_fReadShowHTML)
            {
                // Now tell my taskpad that I'm ready....
                m_fShowHTMLPage = ((String)CConfigStore.GetSetting("ShowHTMLForPermissionSet")).Equals("yes");

                if (m_fShowHTMLPage)
                {
                    m_oResults = m_taskpad;
                }
                else
                {
                    m_oResults = this;
                }

                m_fReadShowHTML = true;
            }
        }// Showing
示例#12
0
        static CCommandHistory()
        {
            // Read our stuff from the configuration
            try
            {
                m_olCommands = (ArrayList)CConfigStore.GetSetting("CommandHistory");
            }
            catch (Exception)
            {
                m_olCommands = null;
            }
            AgeCommands();
            // Make sure we can execute the commands this time around

            // This is bad. VerifyCommands needs the entire tree view
            // to be completely filled in so it can run verifications on all
            // the 'most recently used commands' to make sure that all the nodes
            // are there that need to be.

            // However, this method is fired before the entire tree view is completely
            // built. So one would think we could wait until the tree view is done
            // before verifying commands and such, right?
            //
            // Unfortunately, we need to generate a web page that has the recently
            // used commands BEFORE the tree finishes. Such problems we have, don't
            // we?

            //VerifiyCommands();

            // Read the list of consumer commands.... will be useful for our lite container

            // Only try and do this if we're on a non-MMC host. If this fails, then
            // we should let the exception propgate up
            if (CNodeManager.Console is INonMMCHost)
            {
                m_alConsumerCommands = (ArrayList)CConfigStore.GetSetting("ConsumerCommands");
            }
        }// CCommandHistory
示例#13
0
        }// MenuCommand

        internal override void Showing()
        {
            if (m_oResults != m_taskPadWaiting)
            {
                // See if we've read from the XML file yet whether we're supposed to
                // show the HTML file
                if (!m_fReadShowHTML)
                {
                    // Now tell my taskpad that I'm ready....
                    m_fShowHTMLPage = ((String)CConfigStore.GetSetting("ShowHTMLForDependAssem")).Equals("yes");

                    if (m_fShowHTMLPage || m_olAssems == null)
                    {
                        m_oResults = m_taskPad;
                    }
                    else
                    {
                        m_oResults = this;
                    }

                    m_fReadShowHTML = true;
                }
            }
        }// Showing
示例#14
0
        }// InsertPropSheetPageControls

        //-------------------------------------------------
        // PutValuesinPage
        //
        // This function put data onto the property page
        //-------------------------------------------------
        private void PutValuesinPage()
        {
            // We're guaranteed that we have a config file, but if we have the Application file,
            // let's use that for our location.

            // Get info that we'll need from the node
            CNode node = CNodeManager.GetNode(m_iCookie);

            m_lblAppName.Text = node.DisplayName;

            m_txtLocation.Text = (m_appFiles.sAppFile.Length == 0)?m_appFiles.sAppConfigFile:m_appFiles.sAppFile;


/*      The following code will be used when we look at different runtime versions
 *
 *      // Let's grab the different versions of the runtime we know about
 *      // on this machine
 *      String[] versions = Directory.GetDirectories((String)CConfigStore.GetSetting("InstallRoot"));
 *
 *      int iLen = versions.Length;
 *      for (int i=0; i<iLen; i++)
 *      {
 *          // Strip off everything but the last directory name
 *          String[] dirs = versions[i].Split(new char[] {'\\'});
 *          String sVersion = dirs[dirs.Length-1];
 *          m_cbRuntimeVersion.Items.Add(sVersion);
 *      }
 *      // Add a 'none' for good measure
 *      m_cbRuntimeVersion.Items.Add(CResourceStore.GetString("None"));
 */
            // Put in the 'last modified' data of the file
            try
            {
                DateTime dt = File.GetLastWriteTime(m_txtLocation.Text);
                m_txtLastModified.Text = dt.ToString();
            }
            // In the event the file doesn't exist (or we can't do this for some reason)
            catch (Exception)
            {
                // If the file doesn't exist, what should we do?
            }

            // Get the version of this assembly
            m_txtVersion.Text = CResourceStore.GetString("<unknown>");

            if (m_appFiles.sAppFile.Length > 0)
            {
                AssemblyName an = AssemblyName.GetAssemblyName(m_appFiles.sAppFile);
                if (an != null)
                {
                    m_txtVersion.Text = an.Version.ToString();
                }
            }

            // Get the garbage collection settings
            try
            {
                String setting = (String)CConfigStore.GetSetting("GarbageCollector," + m_appFiles.sAppConfigFile);
                if (setting.Equals("true"))
                {
                    m_radConcurrent.Checked = true;
                }
                else
                {
                    m_radNormal.Checked = true;
                }

                // Get the binding settings
                setting = (String)CConfigStore.GetSetting("BindingMode," + m_appFiles.sAppConfigFile);
                m_chkSafeBinding.Checked = setting.Equals("yes");

                // Get the search path
                m_txtSearchPath.Text = (String)CConfigStore.GetSetting("SearchPath," + m_appFiles.sAppConfigFile);
            }
            catch (Exception)
            {
                // Most likely, an exception was thrown because we came across some
                // bad XML. We've already show a error dialog to the user. Let's
                // just put in some good dummy info
                m_radConcurrent.Checked = true;
            }

/*
 *      // Get the required Version of the runtime.
 *      m_cbRuntimeVersion.Text = (String)CConfigStore.GetSetting("RequiredRuntimeVersion," + m_appFiles.sAppConfigFile);
 */
        }// PutValuesinPage
示例#15
0
        }// 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
示例#16
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