Example #1
0
        /// <summary>
        /// Instantiate MCS, EVOApiErrorMsg, EVOApi objects here
        /// </summary>
        private void InitializeCOMComponents()
        {
            this.m_mcsReceiver     = "Evoware";
            this.m_clientName      = "NET_Client";
            this.m_curMsgID        = 0;
            this.m_evoSys          = new EVOAPILib.SystemClass();
            this.m_evoScript       = new EVOAPILib.ScriptClass();
            this.m_mcsErrorWrapper = new EVOApiErrorMsg.CMcsSvr(m_clientName);

            //Delegate all COM events handler implementation here
            this.m_evoSys.StatusChanged += new _ISystemEvents_StatusChangedEventHandler(this.StatusChanged);
            this.m_evoSys.ErrorEvent    += new _ISystemEvents_ErrorEventEventHandler(this.ErrorEvent);
            //this.m_evoSys.LogonTimeoutEvent += new _ISystemEvents_LogonTimeoutEventEventHandler(this.LogonTimeoutEvent);
            this.m_evoSys.UserPromptEvent += new _ISystemEvents_UserPromptEventEventHandler(this.UserPromptEvent);
        }
Example #2
0
        //private string GenerateRecoverScriptFile(string sScriptName)
        //{
        //    string newScriptName = null;
        //    string destRecFilePath = null;
        //    string destFilePath = null;
        //    try
        //    {
        //        int last_error_line = 0;
        //        bool canRecover = CheckCanRecover(sScriptName, out last_error_line);
        //        if (canRecover && last_error_line > 0)
        //        {
        //            System.IO.FileInfo fileInfo = new System.IO.FileInfo(WanTai.Common.Configuration.GetEvoScriptFileLocation() + sScriptName);
        //            string recFilePath = fileInfo.DirectoryName + "\\" + System.IO.Path.GetFileNameWithoutExtension(fileInfo.Name) + ".rec";
        //            bool hasRPG = false;
        //            int currentLine = 0;
        //            m_evoScript.ReadScript(sScriptName);
        //            string destFileName = System.IO.Path.GetFileNameWithoutExtension(fileInfo.Name) + DateTime.Now.Ticks + fileInfo.Extension;
        //            m_evoScript.SaveScript(destFileName);
        //            destFilePath = fileInfo.DirectoryName + "\\" + destFileName;
        //            using (System.IO.StreamReader source = new System.IO.StreamReader(new System.IO.FileStream(fileInfo.FullName, System.IO.FileMode.Open)))
        //            {
        //                while (!source.EndOfStream)
        //                {
        //                    string lineStr = source.ReadLine();

        //                    if (lineStr.StartsWith("--{ RPG }--"))
        //                    {
        //                        hasRPG = true;
        //                    }

        //                    if (hasRPG)
        //                    {
        //                        if (currentLine >= last_error_line)
        //                        {
        //                            m_evoScript.AddScriptLine(lineStr);
        //                        }
        //                        else
        //                        {
        //                            if (lineStr.StartsWith("Variable("))
        //                            {
        //                                m_evoScript.AddScriptLine(lineStr);
        //                            }
        //                        }

        //                        currentLine++;
        //                    }
        //                }

        //                destRecFilePath = fileInfo.DirectoryName + "\\" + System.IO.Path.GetFileNameWithoutExtension(destFileName) + ".rec";
        //                new System.IO.FileInfo(recFilePath).CopyTo(destRecFilePath);
        //                newScriptName = destFileName;
        //                m_evoScript.SaveScript(destFileName);
        //            }
        //        }
        //    }
        //    catch (Exception e)
        //    {
        //        if (!string.IsNullOrEmpty(destRecFilePath) && System.IO.File.Exists(destRecFilePath))
        //        {
        //            System.IO.File.Delete(destRecFilePath);
        //        }

        //        if (!string.IsNullOrEmpty(destFilePath) && System.IO.File.Exists(destFilePath))
        //        {
        //            System.IO.File.Delete(destFilePath);
        //        }

        //        throw;
        //    }

        //    return newScriptName;
        //}

        //private void DeleteTempRecoverScriptFile(string newScriptName)
        //{
        //    System.IO.FileInfo fileInfo = new System.IO.FileInfo(WanTai.Common.Configuration.GetEvoScriptFileLocation() + newScriptName);
        //    string destRecFilePath = WanTai.Common.Configuration.GetEvoScriptFileLocation() + fileInfo.Name.Substring(0, fileInfo.Name.Length - fileInfo.Extension.Length) + ".rec";
        //    if (System.IO.File.Exists(destRecFilePath))
        //    {
        //        System.IO.File.Delete(destRecFilePath);
        //    }
        //    System.IO.File.Delete(WanTai.Common.Configuration.GetEvoScriptFileLocation() + newScriptName);
        //}

        public override void Close()
        {
            LogOff();
            ShutDown();
            if (cedHandler != null)
            {
                cedHandler.Dispose();
                cedHandler = null;
            }
            if (m_evoSys != null)
            {
                m_evoSys = null;
            }
            if (instance != null)
            {
                instance = null;
            }
        }