1

Microsoft.Vsaプロジェクト(VS 2005)に、名前空間を使用するコードがあります。コンパイルすると、非推奨になっていることがわかります。さらに調べてみると、バージョンVS2005ではサポートされていないことがわかりました。VS 2005で動作するように、そのコードを変更する方法を教えてもらえますか?

 public class Mobile8ScriptEngine : Microsoft.Vsa.IVsaSite
{
    private const string MODULENAME = "Mobile8ScriptEngine";
    private IVsaEngine Engine;
    private string MyMoniker = "myapp://uk.co.mdo/Mobile8ScriptEngine";
    private byte[] Code = new byte[1024];
    private IVsaItems Items;
    //this method creates the script engine
    public void CreateEngine()
    {
        try
        {
            Engine = new Microsoft.VisualBasic.Vsa.VsaEngine();
            Engine.RootMoniker = MyMoniker;
            Engine.Name = "aisland";
            Engine.RootNamespace = "Mobile8";
            Engine.Site = this;
            Items = Engine.Items;
            //adding the reference items
            IVsaReferenceItem ReferenceItem = (IVsaReferenceItem)Items.CreateItem("Mobile8", Microsoft.Vsa.VsaItemType.Reference, Microsoft.Vsa.VsaItemFlag.None);
            ReferenceItem.AssemblyName = "System.dll";
            ReferenceItem.AssemblyName = "System.Xml.dll";
        }

        catch (Exception ex)
        {
            throw ex;
        }


    }

public string ExecuteVSAScript(string asMsgId, string asRefType, string asRefNo, string asHostMsg, string asMsgTypeScript, string asOutFormat)
    {
        const string PROCNAME = "ExecuteVSAScript";

        LogExceptionMessage lObjExcepLog = new LogExceptionMessage();

        SOURCE = MODULENAME + "." + PROCNAME;
        string lsScriptCode = "", lsOutMsg = null, lsCombinedScript = "", lsScriptFilePath = "";
        int liErrCode = 0;
        StreamReader lobjStreamReader;
        XmlDocument XMLDoc;
        try
        {
            asHostMsg = asHostMsg.ToUpper();
            //loading the host message in the XMLDocument
            XMLDoc = new XmlDocument();

            //              XMLDoc.Load("Mobile8Config.xml");
            //              XmlNode lobjXmlNode= XMLDoc.SelectSingleNode("Configuration/CommonSettings/VSAScriptPath");
            lsScriptFilePath = BUConstants.GetVSAScriptPath();
            //              lsScriptFilePath=lobjXmlNode.InnerText;
            XMLDoc.LoadXml(asHostMsg);

            //VSA script executon


            lobjStreamReader = File.OpenText(lsScriptFilePath + " \\" + asMsgTypeScript);

            lsScriptCode = lobjStreamReader.ReadToEnd();
            lobjStreamReader.Close();
            lsCombinedScript = scScriptStartCode + lsScriptCode + scScriptEndCode;
            Mobile8ScriptEngine lobjVSAEngine = new Mobile8ScriptEngine();
            lobjVSAEngine.CreateEngine();
            lobjVSAEngine.RevokeCache();
            bool lbCompilationStatus = lobjVSAEngine.AddScript(lsCombinedScript);


            if (lbCompilationStatus)
            {
                object[] lobjScriptArgs ={ asRefType, asRefNo, XMLDoc, asOutFormat };

                lobjVSAEngine.StartEngine();

                lsOutMsg = lobjVSAEngine.ShowResult(lobjScriptArgs);

                lobjVSAEngine.Close();
                GC.Collect();
            }
            else//Error: Failed to compile the VSA script
            {
                liErrCode = 1079;
                lObjExcepLog.LogMessage(1, null, liErrCode, scStatusSMSFormatFailed, asMsgId, 5, false, SOURCE);
            }

        }
        catch (System.Data.DataException objDBException)
        {

            throw objDBException;
        }
        catch (System.Runtime.InteropServices.ExternalException objExtException)
        {

            throw objExtException;
        }
        catch (Exception objException)
        {

            throw objException;
        }

        return lsOutMsg;
    }

}
4

0 に答える 0