Index Server Catalogue Class

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • newsreader

    #1

    Index Server Catalogue Class

    I am curious if anybody has tried to create a Catalogue Class in C#.
    Here is the code:
    CIODMLib.AdminI ndexServerClass oAdmin = new
    CIODMLib.AdminI ndexServerClass ();
    CIODMLib.CatAdm Class oCatAdmin;
    oAdmin.MachineN ame = "MYSERVER";
    if(oAdmin.IsRun ning())
    {
    oCatAdmin = (CIODMLib.CatAd mClass)oAdmin.G etCatalogByName ("MYDF");
    //Error here
    }
    else
    {
    oAdmin.Start();
    }

    For some reason the runtime error message tells me that the cast is not
    valid.

    The modified code does not work either, the same exception "cast is not
    valid":

    CIODMLib.AdminI ndexServerClass oAdmin = new
    CIODMLib.AdminI ndexServerClass ();
    object oCatAdmin;
    oAdmin.MachineN ame = "MYSERVER";
    if(oAdmin.IsRun ning())
    {
    oCatAdmin = oAdmin.GetCatal ogByName("MYDF" );

    MessageBox.Show (((CIODMLib.Cat AdmClass)oCatAd min).GetCatalog ByName("MYCATAL O
    GUE"); //Error here
    }
    else
    {
    oAdmin.Start();
    }

    Anybody has any ideas how to deal with this?


  • newsreader

    #2
    Re: Index Server Catalogue Class SOLVED

    I have found the solution to this.
    One has to use Marshal.CreateW rapperOfType:
    CIODMLib.AdminI ndexServerClass oAdmin = new
    CIODMLib.AdminI ndexServerClass ();

    CIODMLib.CatAdm Class oCatAdmin;

    oAdmin.MachineN ame = "DFSERVER";

    if(oAdmin.IsRun ning())

    {

    Type oType = typeof(CIODMLib .CatAdmClass);

    object oObject = oAdmin.GetCatal ogByName("MYDF" );

    object oWrapper = Marshal.CreateW rapperOfType(oO bject, oType);

    oCatAdmin = (CIODMLib.CatAd mClass)oWrapper ;

    MessageBox.Show (oCatAdmin.Cata logName);

    }

    else

    {

    oAdmin.Start();

    }

    "newsreader " <someone@somewh ere.com> wrote in message
    news:xS1Va.778$ Cx4.213102@news 20.bellglobal.c om...[color=blue]
    > I am curious if anybody has tried to create a Catalogue Class in C#.
    > Here is the code:
    > CIODMLib.AdminI ndexServerClass oAdmin = new
    > CIODMLib.AdminI ndexServerClass ();
    > CIODMLib.CatAdm Class oCatAdmin;
    > oAdmin.MachineN ame = "MYSERVER";
    > if(oAdmin.IsRun ning())
    > {
    > oCatAdmin = (CIODMLib.CatAd mClass)oAdmin.G etCatalogByName ("MYDF");
    > //Error here
    > }
    > else
    > {
    > oAdmin.Start();
    > }
    >
    > For some reason the runtime error message tells me that the cast is not
    > valid.
    >
    > The modified code does not work either, the same exception "cast is not
    > valid":
    >
    > CIODMLib.AdminI ndexServerClass oAdmin = new
    > CIODMLib.AdminI ndexServerClass ();
    > object oCatAdmin;
    > oAdmin.MachineN ame = "MYSERVER";
    > if(oAdmin.IsRun ning())
    > {
    > oCatAdmin = oAdmin.GetCatal ogByName("MYDF" );
    >
    >[/color]
    MessageBox.Show (((CIODMLib.Cat AdmClass)oCatAd min).GetCatalog ByName("MYCATAL O[color=blue]
    > GUE"); //Error here
    > }
    > else
    > {
    > oAdmin.Start();
    > }
    >
    > Anybody has any ideas how to deal with this?
    >
    >[/color]


    Comment

    Working...