//-------------------------------------------------
 // CConfigAssemWiz1 - Constructor
 //
 // Initializes some variables.
 // sf is a delegate that, when called, will turn on
 // the "Finish" button on the wizard
 //-------------------------------------------------
 internal CConfigAssemWiz1(CApplicationDepends appDepends)
 {
     m_sHeaderTitle    = CResourceStore.GetString("CConfigAssemWiz1:HeaderTitle");
     m_sHeaderSubTitle = CResourceStore.GetString("CConfigAssemWiz1:HeaderSubTitle");
     m_sTitle          = CResourceStore.GetString("CConfigAssemWiz1:Title");
     m_appDepends      = appDepends;
 }// CConfigAssemWiz1
예제 #2
0
 internal CDependAssembliesDialog(CApplicationDepends appDepends)
 {
     m_appDepends = appDepends;
     m_ol         = GenerateAssemblyList();
     PutInAssemblies();
     this.Text = CResourceStore.GetString("InheritedAssemblyDialogs:ChooseFromDepend");
 }// CFusionDialog
        internal CConfigAssemWizard(CApplicationDepends appDepends)
        {
            m_sName        = "Configure Assembly Wizard";
            m_sDisplayName = "Assembly Wizard";

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

        static private void FindDependenciesForThisNode(CApplicationDepends cad)
        {
            // Let's dig into what assemblies this application depends upon
            cad.m_taskPadWaiting = new CGenericTaskPad(cad, "LOADINGDEPENDASSEM_HTML");
            cad.m_oResults       = cad.m_taskPadWaiting;
            cad.RefreshResultView();

            if (cad.m_sAppFile != null && cad.m_olAssems == null)
            {
                AssemblyDependencies ad = null;
                try
                {
                    // Grab the path off this sucker
                    String[] sArgs = cad.m_sAppFile.Split(new char[] { '\\' });
                    // Now join the directory together
                    String sDir = String.Join("\\", sArgs, 0, sArgs.Length > 1?sArgs.Length - 1:1);

                    // We want to give the assembly loader the path that this application
                    // lives in. That way it will be able to find any private assemblies
                    // that the app may depend on.
                    ad             = new AssemblyDependencies(cad.m_sAppFile, new LoadAssemblyInfo().AppPath(sDir));
                    cad.m_olAssems = new ArrayList();
                    ArrayList al = ad.Assems;
                    for (int i = 0; i < al.Count; i++)
                    {
                        AssemInfo    ai = new AssemInfo();
                        AssemblyName an = (AssemblyName)al[i];
                        ai.Name           = an.Name;
                        ai.Version        = an.Version.ToString();
                        ai.Locale         = an.CultureInfo.ToString();
                        ai.PublicKeyToken = ByteArrayToString(an.GetPublicKeyToken());

                        AddAssemblyInfo(cad.m_olAssems, ai);
                    }
                    ad.DoneLoading();
                    cad.m_fAllowListView = true;
                }
                catch (Exception)
                {
                    cad.m_taskPad  = new CGenericTaskPad(cad, "ERRORDEPENDASSEM_HTML");
                    cad.m_olAssems = null;
                }

                if (ad != null)
                {
                    ad.DoneLoading();
                }
            }
            else if (cad.m_sAppFile == null)
            {
                cad.m_olAssems = null;
                cad.m_taskPad  = new CGenericTaskPad(cad, "ERRORDEPENDASSEM_HTML");
            }
            cad.m_oResults = cad.m_taskPad;
            cad.RefreshResultView();
        }// FindDependenciesForThisNode
예제 #5
0
        }// 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
예제 #6
0
 static private void DependencyFinder()
 {
     while (true)
     {
         if (m_alNodes.Count != 0)
         {
             m_ThreadNode = (CApplicationDepends)m_alNodes[0];
             m_alNodes.RemoveAt(0);
             if (!m_ThreadNode.m_fIKnowMyDependencies)
             {
                 FindDependenciesForThisNode(m_ThreadNode);
             }
             m_ThreadNode.m_fIKnowMyDependencies = true;
             m_thread.Priority = ThreadPriority.Lowest;
         }
         // There was nothing for us to do... let's sleep for awhile
         else
         {
             Thread.Sleep(100);
         }
     }
 }// DependencyFinder
예제 #7
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
예제 #8
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