Example #1
0
 public static AnalyseTask getInstance()
 {
     if (instance == null)
     {
         instance = new AnalyseTask();
     }
     return(instance);
 }
Example #2
0
        public static void Execute()
        {
            AnalyseTask Task           = AnalyseTask.getInstance();
            int         iANALYSE_ALLOW = INIConfig.ReadInt("ANALYSE", "DFS_ALLOW");

            while (!ApplicationEvent.isUploadAbort)
            {
                Boolean Find_File_Flag = false;
                log4net.WriteLogFile("UploadTask.Execute..", LogType.DEBUG);
                String cFileName = null;

                if (iANALYSE_ALLOW > 0)
                {
                    cFileName = Task.getAnalyseFile();
                    if (String.IsNullOrWhiteSpace(cFileName))
                    {
                        log4net.WriteLogFile("UploadTask.Execute..未发现图片", LogType.DEBUG);
                    }
                    else
                    {
                        Task.UpdateAnalyseFile(cFileName);
                        if (!Find_File_Flag)
                        {
                            Find_File_Flag = true;
                        }
                    }
                }

                if (Find_File_Flag)
                {
                    try
                    {
                        Thread.Sleep(500);
                    }
                    catch (Exception ex)
                    {
                        log4net.WriteLogFile("UploadTask.Sleep." + ex.Message);
                    }
                }
                else
                {
                    try
                    {
                        Thread.Sleep(1000 * 3);
                    }
                    catch (Exception ex)
                    {
                        log4net.WriteLogFile("UploadTask.Sleep." + ex.Message);
                    }
                }
            }
        }