コード例 #1
0
ファイル: EVOApiProcessor.cs プロジェクト: brooklikeme/wantai
        public static EVOApiProcessor Instance()
        {
            if (instance == null)
            {
                instance = new EVOApiProcessor();
            }

            return(instance);
        }
コード例 #2
0
 public static IProcessor GetProcessor()
 {
     HasInitedProcessor = true;
     if (isMock)
     {
         return(MockProcessor.Instance());
     }
     else
     {
         return(EVOApiProcessor.Instance());
     }
 }
コード例 #3
0
ファイル: EVOApiProcessor.cs プロジェクト: brooklikeme/wantai
        //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;
            }
        }