public ContentHub(Work<IContentManager> workContentManager,
     Work<IAuthenticationService> workAuthenticationService,
     IClock clock) {
     _workContentManager = workContentManager;
     _workAuthenticationService = workAuthenticationService;
     _clock = clock;
 }
Exemplo n.º 2
0
        /// <summary>
        /// Implements the search function in managed code.
        /// </summary>
        /// <param name="work"></param>
        /// <param name="round1State"></param>
        /// <param name="round1Block2"></param>
        /// <param name="round2State"></param>
        /// <param name="round2Block1"></param>
        /// <returns></returns>
        public unsafe override uint? Search(Work work, uint* round1State, byte* round1Block2, uint* round2State, byte* round2Block1)
        {
            // starting nonce
            uint nonce = 0;

            // output for final hash
            uint* round2State2 = stackalloc uint[Sha256.SHA256_STATE_SIZE];

            while (true)
            {
                // update the nonce value
                ((uint*)round1Block2)[3] = nonce;

                // transform variable second half of block using saved state from first block, into pre-padded round 2 block (end of first hash)
                Sha256.Transform(round1State, round1Block2, (uint*)round2Block1);

                // transform round 2 block into round 2 state (second hash)
                Sha256.Transform(round2State, round2Block1, round2State2);

                // test for potentially valid hash
                if (round2State2[7] == 0U)
                    // actual nonce is flipped
                    return Memory.ReverseEndian(nonce);

                // only report and check for exit conditions every so often
                if ((++nonce % 65536) == 0)
                    if (!Progress(work, 65536) || nonce == 0)
                        break;
            }

            return null;
        }
Exemplo n.º 3
0
    static void Main()
    {
        // Create the thread object. This does not start the thread.
        Worker workerObject = new Work();
        Thread workerThread = new Thread(workerObject.DoWork);

        // Start the worker thread.
        workerThread.Start();
        Console.WriteLine("main thread: Starting worker thread...");

        // Loop until worker thread activates. 
        while (!workerThread.IsAlive) ;

        // Put the main thread to sleep for 1 millisecond to 
        // allow the worker thread to do some work:
        Thread.Sleep(1);

        // Request that the worker thread stop itself:
        workerObject.RequestStop();

        // Use the Join method to block the current thread  
        // until the object's thread terminates.
        workerThread.Join();
        Console.WriteLine("main thread: Worker thread has terminated.");
    }
Exemplo n.º 4
0
    static void Main() 
    {
        // To start a thread using a static thread procedure, use the 
        // class name and method name when you create the ThreadStart 
        // delegate. Beginning in version 2.0 of the .NET Framework, 
        // it is not necessary to create a delegate explicitly.  
        // Specify the name of the method in the Thread constructor,  
        // and the compiler selects the correct delegate. For example: 
        // 
         Thread newThread = new Thread(Work.DoWork); 
        //
        // ThreadStart threadDelegate = new ThreadStart(Work.DoWork);
        // Thread newThread = new Thread(threadDelegate);
        newThread.Start();

        // To start a thread using an instance method for the thread  
        // procedure, use the instance variable and method name when  
        // you create the ThreadStart delegate. Beginning in version 
        // 2.0 of the .NET Framework, the explicit delegate is not 
        // required. 
        //
        Work w = new Work();
        w.Data = 42;
        newThread = new Thread(w.DoMoreWork); //directly attach newThread to a new method
        // threadDelegate = new ThreadStart(w.DoMoreWork);
        // newThread = new Thread(threadDelegate);
        newThread.Start();
    }
 public FacebookConnectWidgetPartHandler(Work<ISiteService> siteServiceWork)
 {
     OnActivated<FacebookConnectWidgetPart>((context, part) =>
         {
             part.PermissionsField.Loader(() => siteServiceWork.Value.GetSiteSettings().As<FacebookConnectSettingsPart>().Permissions);
         });
 }
        public static void Main()
        {
            try
            {
                TTransport transport = new TSocket("localhost", 9090);
                TProtocol protocol = new TBinaryProtocol(transport);
                Calculator.Client client = new Calculator.Client(protocol);

                transport.Open();
                try
                {
                    client.ping();
                    Console.WriteLine("ping()");

                    int sum = client.add(1, 1);
                    Console.WriteLine("1+1={0}", sum);

                    Work work = new Work();

                    work.Op = Operation.DIVIDE;
                    work.Num1 = 1;
                    work.Num2 = 0;
                    try
                    {
                        int quotient = client.calculate(1, work);
                        Console.WriteLine("Whoa we can divide by 0");
                    }
                    catch (InvalidOperation io)
                    {
                        Console.WriteLine("Invalid operation: " + io.Why);
                    }

                    work.Op = Operation.SUBTRACT;
                    work.Num1 = 15;
                    work.Num2 = 10;
                    try
                    {
                        int diff = client.calculate(1, work);
                        Console.WriteLine("15-10={0}", diff);
                    }
                    catch (InvalidOperation io)
                    {
                        Console.WriteLine("Invalid operation: " + io.Why);
                    }

                    SharedStruct log = client.getStruct(1);
                    Console.WriteLine("Check log: {0}", log.Value);

                }
                finally
                {
                    transport.Close();
                }
            }
            catch (TApplicationException x)
            {
                Console.WriteLine(x.StackTrace);
            }

        }
Exemplo n.º 7
0
		public void TypicalEmbedInMyXmlDocument()
		{
			var system = new OlacSystem();
			var work = new Work();
			work.Licenses.Add(License.CreativeCommons_Attribution_ShareAlike);
			work.Contributions.Add(new Contribution("Charlie Brown", system.GetRoleByCodeOrThrow("author")));
			work.Contributions.Add(new Contribution("Linus", system.GetRoleByCodeOrThrow("editor")));

			string metaData = system.GetXmlForWork(work);

			//Embed that data in our own file
			using (var f = new TempFile(@"<doc>
				<metadata>" + metaData + @"</metadata>
				<ourDocumentContents>blah blah<ourDocumentContents/></doc>"))
			{
				//Then when it comes time to read the file, we can extract out the work again
				var dom = new XmlDocument();
				dom.Load(f.Path);

				var node = dom.SelectSingleNode("//metadata");
				var work2 = new Work();
				system.LoadWorkFromXml(work2, node.InnerXml);

				Assert.AreEqual(2,work2.Contributions.Count());
			}
		}
Exemplo n.º 8
0
    static void Main(string[] args)
    {
        int N = int.Parse(Console.ReadLine());
        var works = new Work[N];
        for (int i = 0; i < N; i++)
        {
            string[] inputs = Console.ReadLine().Split(' ');
            int J = int.Parse(inputs[0]);
            int D = int.Parse(inputs[1]);
            works[i] = new Work { Starts = J, Ends = J + D - 1 };
        }

        var sortedWorks = works.OrderBy(x => x.Ends).ThenBy(x => x.Starts).ToArray();

        var lastEnd = 0;
        var count = 0;
        for (int i = 0; i < sortedWorks.Length; i++)
        {
            if (sortedWorks[i].Starts > lastEnd)
            {
                count++;
                lastEnd = sortedWorks[i].Ends;
            }
        }

        Console.WriteLine(count);
    }
 private ExecutionBlock ScriptDifferences(Differences differences)
 {
     var work = new Work();
     work.BuildFromDifferences(differences, Options.Default, true);
     ExecutionBlock block = work.ExecutionBlock;
     return block;
 }
Exemplo n.º 10
0
        public ShoutboxHub(Work<IOrchardServices> orchardServices, IHelpers helpers, IShoutboxService shoutboxService, IPostService postService)
        {
            if (orchardServices == null)
            {
                throw new ArgumentNullException("orchardServices");
            }

            if (helpers == null)
            {
                throw new ArgumentNullException("helpers");
            }

            if (postService == null)
            {
                throw new ArgumentNullException("postService");
            }

            if (shoutboxService == null)
            {
                throw new ArgumentNullException("shoutboxService");
            }

            _OrchardServices = orchardServices;
            _Helpers = helpers;
            _ShoutboxService = shoutboxService;
            _PostService = postService;
        }
 public DefaultExceptionPolicy(INotifier notifier, Work<IAuthorizer> authorizer)
 {
     _notifier = notifier;
     _authorizer = authorizer;
     Logger = NullLogger.Instance;
     T = NullLocalizer.Instance;
 }
 public void PerformWork(Work work, ISessionImplementor session)
 {
     if (session.TransactionInProgress)
     {
         ITransaction transaction = ((ISession)session).Transaction;
         PostTransactionWorkQueueSynchronization txSync = (PostTransactionWorkQueueSynchronization)
                                                          synchronizationPerTransaction[transaction];
         if (txSync == null || txSync.IsConsumed)
         {
             txSync =
                 new PostTransactionWorkQueueSynchronization(queueingProcessor, synchronizationPerTransaction);
             transaction.RegisterSynchronization(txSync);
             lock (synchronizationPerTransaction.SyncRoot)
                 synchronizationPerTransaction[transaction] = txSync;
         }
         txSync.Add(work);
     }
     else
     {
         WorkQueue queue = new WorkQueue(2); //one work can be split
         queueingProcessor.Add(work, queue);
         queueingProcessor.PrepareWorks(queue);
         queueingProcessor.PerformWorks(queue);
     }
 }
        public FileRecordSequenceCompletedAsyncResult(
            SequenceNumber result,
            AsyncCallback callback,
            object userState,
            Work work)
        {
            this.result = result;
            this.callback = callback;
            this.userState = userState;
            this.work = work;

            this.syncRoot = new object();

            if (this.callback != null)
            {
                try
                {
                    this.callback(this);
                }
#pragma warning suppress 56500 // This is a callback exception
                catch (Exception e)
                {
                    if (Fx.IsFatal(e))
                        throw;

                    throw DiagnosticUtility.ExceptionUtility.ThrowHelperCallback(e);
                }
            }
        }
Exemplo n.º 14
0
		/// ------------------------------------------------------------------------------------
		public string GetXmlForWork(Work work)
		{
			var bldr =  new StringBuilder();

			if (work != null)
			{
				bldr.Append(GetOlacRecordElement());

				foreach (var contributor in work.Contributions)
					bldr.Append(GetContributorElement(contributor.Role.Code, contributor.ContributorName));

				bldr.Append("</olac:olac>");
			}

			return bldr.ToString();

			/*            <dc:language xsi:type="olac:language" olac:code="adz"
				  view="Adzera"/>

			  <dc:subject xsi:type="olac:language" olac:code="adz"
				  view="Adzera"/>



	  <dc:title>Language</dc:title>
	  <dc:publisher>New York: Holt</dc:publisher>
			 */

		}
Exemplo n.º 15
0
 public Shapes(
     Work<WorkContext> workContext,
     Work<INavigationManager> navigationManager)
 {
     _workContext = workContext;
     _navigationManager = navigationManager;
 }
 public NavigationProviderFactory(Work<IAdvancedMenuService> menuService, ICacheManager cache, ISignals signals,
     IEnumerable<INavigationProvider> providers)
 {
     _menuService = menuService;
     _cache = cache;
     _signals = signals;
     _providers = providers;
 }
 public MediaFormatHeaderFilter(
     IOrchardServices _orchardServices,
     Work<IMediaGardenService> gardenService)
 {
     Services = _orchardServices;
     _gardenService = gardenService;
     T= NullLocalizer.Instance;
 }
Exemplo n.º 18
0
 public SocketsContentPartDriver(IOrchardServices services, 
     Work<IMechanicsDisplay> display)
 {
     Services = services;
     _mechanicsDisplay = display;
     Logger = NullLogger.Instance;
     T = NullLocalizer.Instance;
 }
Exemplo n.º 19
0
 public ContentPickerShapes(
     Work<INavigationManager> navigationManager,
     Work<WorkContext> workContext,
     Work<IShapeFactory> shapeFactory) {
     _navigationManager = navigationManager;
     _workContext = workContext;
     _shapeFactory = shapeFactory;
 }
Exemplo n.º 20
0
        public void Add(uint id, Work work)
        {
            if (worksById.ContainsKey(id))
                return;

            worksById.Add(id, work);
            works.Add(work);
        }
 public AssociativyGraphLinksPartHandler(Work<IGraphManager> graphManagerWork, Work<IEngineManager> engineManagerWork)
 {
     OnActivated<AssociativyGraphLinksPart>((context, part) =>
     {
         part.GraphsField.Loader(() => graphManagerWork.Value.FindGraphs(new GraphContext { ContentTypes = new [] { context.ContentType } }));
         part.FrontendEnginesField.Loader(() => engineManagerWork.Value.GetEngines());
     });
 }
 public BlogPostPickerShapes(
     Work<INavigationManager> navigationManager,
     IWorkContextAccessor workContextAccessor,
     Work<IShapeFactory> shapeFactory)
 {
     _navigationManager = navigationManager;
     _workContextAccessor = workContextAccessor;
     _shapeFactory = shapeFactory;
 }
Exemplo n.º 23
0
        public ElementShapes(
            ITagBuilderFactory tagBuilderFactory, 
            Work<IShapeFactory> shapeFactory, 
            Work<ITokenizer> tokenizer) {

            _tagBuilderFactory = tagBuilderFactory;
            _shapeFactory = shapeFactory;
            _tokenizer = tokenizer;
        }
 public CompoundElementHarverster(Work<ICompoundElementService> CompoundElementService, Work<IElementManager> elementManager, Work<ILayoutManager> layoutManager,
     Work<IElementFactory> elementFactory, Work<ILayoutSerializer> layoutSerializer)
 {
     _CompoundElementService = CompoundElementService;
     _elementManager = elementManager;
     _layoutManager = layoutManager;
     _elementFactory = elementFactory;
     _layoutSerializer = layoutSerializer;
 }
Exemplo n.º 25
0
        public ShoutboxService(Work<IOrchardServices> orchardServices)
        {
            if (orchardServices == null)
            {
                throw new ArgumentNullException("orchardServices");
            }

            _OrchardServices = orchardServices;
        }
 public RecipeExecutor(
     ShellSettings shellSettings,
     IOrchardHost orchardHost,
     Work<IImportExportService> importExportServiceWork)
 {
     _shellSettings = shellSettings;
     _orchardHost = orchardHost;
     _importExportServiceWork = importExportServiceWork;
 }
        public OwinMiddleware(
            IWorkContextAccessor wca,
            Work<ISiteService> siteServiceWork)
        {
            _wca = wca;
            _siteServiceWork = siteServiceWork;

            Logger = NullLogger.Instance;
        }
 // Injecting IResourceManager is necessary because on shell start in the end IShapeDisplayEvents are instantiated, thus this class
 // as well. ResourceManager also implementing IUnitOfWorkDependency causes an Autofac DependencyResolutionException with the message
 // "No scope with a Tag matching 'work' is visible from the scope in which the instance was requested.".
 // See: https://github.com/OrchardCMS/Orchard/issues/4852
 public OverridesInjector(
     IHttpContextAccessor hca,
     Work<IResourceManager> resourceManagerWork,
     IThemeOverrideService themeOverrideService)
 {
     _hca = hca;
     _resourceManagerWork = resourceManagerWork;
     _themeOverrideService = themeOverrideService;
 }
Exemplo n.º 29
0
        public ContentPartElementHarvester(
            Work<IContentDefinitionManager> contentDefinitionManager,
            Work<IElementFactory> elementFactory,
            Work<IElementManager> elementManager) {

            _contentDefinitionManager = contentDefinitionManager;
            _elementFactory = elementFactory;
            _elementManager = elementManager;
        }
Exemplo n.º 30
0
    public void CancelPendingWork()
    {
        if (pendingWork != null)
        {

            pendingWork.Erase();
            pendingWork = null;
        }
    }
Exemplo n.º 31
0
 public void IsSymbolAllowed_SymbolIsAllowed_True(char ch)
 {
     Assert.IsTrue(Work.IsSymbolAllowed(ch));
 }
Exemplo n.º 32
0
 public override void WriteProgram(Work work)
 {
     Console.WriteLine($"當前時間:{work.Hour}點 下班回家");
 }
Exemplo n.º 33
0
 public async Task Add(Work work)
 {
     await _workService.Add(work);
 }
Exemplo n.º 34
0
 public MemoryCacheManager(Work <ICacheScopeAccessor> scopeAccessor)
 {
     _scopeAccessor = scopeAccessor;
     _cache         = CreateCache();
 }
 public void Enqueue(Work work)
 {
     _workQueue.Enqueue(work);
     _semaphore.Release();
 }
 public WidgetElementHarvester(Work <IContentManager> contentManager, IAuthorizer authorizer)
 {
     _contentManager = contentManager;
     _authorizer     = authorizer;
 }
 public PhpRuntime(Work <IWorkContextAccessor> wcaWork, IPhpRuntimeEventHandler eventHandler)
 {
     _wcaWork      = wcaWork;
     _eventHandler = eventHandler;
 }
Exemplo n.º 38
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Node nd = new Node(this.FK_Node);
            Work wk = nd.HisWork;

            wk.OID = this.WorkID;
            wk.Retrieve();
            if (nd.HisNodeWorkType == NodeWorkType.WorkHL || nd.HisNodeWorkType == NodeWorkType.WorkFHL)
            {
                GenerWorkerLists wls = new GenerWorkerLists();
                QueryObject      qo  = new QueryObject(wls);
                qo.AddWhere(GenerWorkerListAttr.FID, wk.OID);
                qo.addAnd();
                qo.AddWhere(GenerWorkerListAttr.IsEnable, 1);
                qo.addAnd();
                qo.AddWhere(GenerWorkerListAttr.FK_Node,
                            nd.FromNodes[0].GetValByKey(NodeAttr.NodeID));

                int i = qo.DoQuery();
                if (i == 1)
                {
                    qo.clear();
                    qo.AddWhere(GenerWorkerListAttr.FID, wk.OID);
                    qo.addAnd();
                    qo.AddWhere(GenerWorkerListAttr.IsEnable, 1);
                    qo.DoQuery();
                }


                this.Pub1.AddFieldSet("分流信息");
                this.Pub1.AddTable("border=0"); // ("<table border=0 >");
                this.Pub1.AddTR();
                this.Pub1.AddTDTitle("节点");
                this.Pub1.AddTDTitle("处理人");
                this.Pub1.AddTDTitle("名称");

                this.Pub1.AddTDTitle("部门");
                this.Pub1.AddTDTitle("状态");
                this.Pub1.AddTDTitle("应完成日期");
                this.Pub1.AddTDTitle("实际完成日期");
                this.Pub1.AddTDTitle("");
                this.Pub1.AddTREnd();

                bool isHaveRuing = false;
                bool is1         = false;
                foreach (GenerWorkerList wl in wls)
                {
                    is1 = this.Pub1.AddTR(is1);
                    this.Pub1.AddTD(wl.FK_NodeText);
                    this.Pub1.AddTD(wl.FK_Emp);

                    this.Pub1.AddTD(wl.FK_EmpText);
                    this.Pub1.AddTD(wl.FK_DeptT);

                    if (wl.IsPass)
                    {
                        this.Pub1.AddTD("已完成");
                        this.Pub1.AddTD(wl.SDT);
                        this.Pub1.AddTD(wl.RDT);
                    }
                    else
                    {
                        this.Pub1.AddTD("未完成");
                        this.Pub1.AddTD(wl.SDT);
                        this.Pub1.AddTD();
                    }

                    if (wl.IsPass == false)
                    {
                        isHaveRuing = true;
                        if (nd.IsForceKill)
                        {
                            this.Pub1.AddTD("<a href=\"javascript:DoDelSubFlow('" + wl.FK_Flow + "','" + wl.WorkID + "')\"><img src='/WF/Img/Btn/Delete.gif' border=0/>终止</a>");
                        }
                        else
                        {
                            this.Pub1.AddTD();
                        }
                    }
                    else
                    {
                        this.Pub1.AddTD("<a href=\"javascript:WinOpen('FHLFlow.aspx?WorkID=" + wl.WorkID + "&FID=" + wl.FID + "&FK_Flow=" + nd.FK_Flow + "&FK_Node=" + this.FK_Node + "')\">打开</a>");
                    }
                    this.Pub1.AddTREnd();
                }

                if (isHaveRuing)
                {
                    //if (nd.IsForceKill == false)
                    //   // this.Btn_Send.Enabled = false;
                }
                this.Pub1.AddTableEnd();
                this.Pub1.AddFieldSetEnd(); //.AddFieldSet("分流信息");
            }
        }
Exemplo n.º 39
0
 public void IsSymbolAllowed_SymbolIsAllowed_False(char ch)
 {
     Assert.IsFalse(Work.IsSymbolAllowed(ch));
 }
Exemplo n.º 40
0
        private void AddEventWorkDTO(EventDetail eventDetail, EventDTO eventDTO)
        {
            if (eventDetail.WorkID == null || Work.WorkShouldBeExcludedByGroupId((int)eventDetail.WorkGroupId))
            {
                return;
            }

            var work = eventDTO.works.FirstOrDefault(w => w.workID == (int)eventDetail.WorkID);

            if (work == null)
            {
                work = new WorkDTO
                {
                    WorkTitle        = eventDetail.WorkTitle,
                    ComposerFullName = eventDetail.ComposerFullName,
                    workID           = (int)eventDetail.WorkID,
                    Arranger         = eventDetail.WorkArrangement,
                    WorkArtists      = new List <ArtistDTO>(),
                    WorkDocuments    = new List <WorkDocumentDTO>()
                };

                eventDTO.works.Add(work);
            }

            var artistID = eventDetail.ArtistID;

            if (artistID != null)
            {
                var workArtist = work.WorkArtists.FirstOrDefault(wa => wa.ArtistID == (int)eventDetail.ArtistID);

                var    instrumentID = eventDetail.InstrumentID ?? 0;
                string instrument;
                if (instrumentID == 0)
                {
                    instrument = "";
                }
                else
                {
                    instrument = Instrument.GetInstrumentByID((int)eventDetail.InstrumentID).Instrument1;
                }

                if (workArtist == null)
                {
                    var artist = Artist.GetArtistByID((int)artistID);

                    workArtist = new ArtistDTO
                    {
                        ArtistFullName   = artist.ArtistFullName,
                        ArtistInstrument = instrument,
                        ArtistID         = (int)eventDetail.ArtistID
                    };

                    work.WorkArtists.Add(workArtist);
                }
            }
            var documentID = eventDetail.WorkDocumentID;

            if (documentID != null)
            {
                var workDocument = work.WorkDocuments.FirstOrDefault(wd => wd.WorkDocumentID == (int)eventDetail.WorkDocumentID);
                if (workDocument == null)
                {
                    var document = WorkDocument.GetDocumentByID((int)documentID);
                    workDocument = new WorkDocumentDTO
                    {
                        WorkDocumentID           = (int)eventDetail.WorkDocumentID,
                        WorkDocumentName         = document.WorkDocumentName,
                        WorkDocumentFileLocation = document.WorkDocumentFileLocation,
                    };
                    work.WorkDocuments.Add(workDocument);
                }
            }
        }
Exemplo n.º 41
0
 public AclService(ICacheManager cacheManager, Work <IWorkContext> workContext, IRepository <AclRecord> aclRecordRepository)
 {
     _cacheManager        = cacheManager;
     _workContext         = workContext;
     _aclRecordRepository = aclRecordRepository;
 }
Exemplo n.º 42
0
        public async Task <JsonResult> AddWork(long wfss, string Name, string Title, string Defination, DateTime expectedDate, List <long> personels, string options)
        {
            bool priority = false;
            var  state    = options;

            if (state == "Normal")
            {
                state = "Yeni";
            }
            else
            {
                priority = true;
            }
            var pm    = new business.Management.UserManagement.UserFunctions();
            var pList = new List <Personal>();

            ImageProcess Ip = new ImageProcess();

            foreach (var item in personels)
            {
                pList.Add(pm.findPersonal(item));
            }
            try
            {
                using (business.Management.WorkManagement.WorkFunctions wm = new business.Management.WorkManagement.WorkFunctions())
                {
                    if (wm.checkWorkName(wfss, Name))
                    {
                        return(await Task.Run(() => Json(new { result = false, message = "Kayıtlı bir iş adı girdiniz, lütfen farklı bir iş adı giriniz." }, JsonRequestBehavior.AllowGet)));
                    }
                    Work newWork = new Work
                    {
                        Name          = Name,
                        Title         = Title,
                        Definition    = Defination,
                        Expected_Date = expectedDate,
                        Register_Date = DateTime.Now,
                        State         = state,
                        Priority      = priority,
                        Status        = true,
                        ProgressBar   = 0.0f
                    };
                    newWork.UploadFiles = new List <Files>();

                    var postedfiles = System.Web.HttpContext.Current.Request.Files;

                    string furl, fname;
                    for (int i = 0; i < postedfiles.Count; i++)
                    {
                        var unique = Guid.NewGuid().ToString();
                        fname = postedfiles[i].FileName;

                        if (postedfiles[i] != null && (postedfiles[i].ContentType == "image/jpeg" || postedfiles[i].ContentType == "image/jpg" || postedfiles[i].ContentType == "image/png"))
                        {
                            var mainFolder = Server.MapPath($"~/Images/WorkPics/" + Name);
                            if (!Directory.Exists(mainFolder))
                            {
                                Directory.CreateDirectory(mainFolder);
                            }

                            furl = Ip.Resolution(postedfiles[i], new int[] { 256, 1024 }, fname, "WorkPics/" + Name);

                            Files newImage = new Files
                            {
                                fileName = fname,
                                fileUrl  = furl
                            };

                            newWork.UploadFiles.Add(newImage);
                        }
                    }

                    if (wm.addWork(newWork, wfss, personels))
                    {
                        return(await Task.Run(() => Json(new { result = true, message = "İş oluşturuldu." }, JsonRequestBehavior.AllowGet)));
                    }
                    else
                    {
                        return(await Task.Run(() => Json(new { result = false, message = "İş oluşturulamadı." }, JsonRequestBehavior.AllowGet)));
                    }
                }
            }
            catch (Exception)
            {
                return(await Task.Run(() => Json(new { result = false, message = "Hata oluştu." }, JsonRequestBehavior.AllowGet)));
            }
        }
Exemplo n.º 43
0
        public CachedShapes(Work <IResourceManager> resourceManager)
        {
            _resourceManager = resourceManager;

            Logger = NullLogger.Instance;
        }
Exemplo n.º 44
0
 public void Enqueue(Work work)
 {
     workQueue.Enqueue(work);
     messageArrived.TrySetResult(true);
 }
Exemplo n.º 45
0
        /// <summary>
        /// 查询指定条件
        /// </summary>
        /// <param name="query"></param>
        /// <param name="time1"></param>
        /// <param name="time2"></param>
        private void Query(Work query)
        {
            var cmds = new List <string>();

            cmds.Add("0x1000");
            cmds.Add("0x600B");
            using (var bll = new DataBLL())
            {
                Expression <Func <TB_HISTORIES, bool> > expression = PredicateExtensions.True <TB_HISTORIES>();
                if (!string.IsNullOrEmpty(query.MacId))
                {
                    expression = expression.And(a => a.mac_id.Contains(query.MacId));
                }
                expression = expression.And(a => cmds.Contains(a.command_id));
                expression = expression.And(a => a.receive_time >= query.Time1 && a.receive_time <= query.Time2);

                var list = bll.FindList <TB_HISTORIES>(expression, "receive_time").ToList <TB_HISTORIES>();

                var html = "";
                int TotalAddedMinutes = 0, TotalWorkedMinutes = 0, TotalUsedHour = 0;
                if (null == list || list.Count() < 1)
                {
                    html = "<tr><td colspan=\"13\" class=\"in-tab-title-b\">No records, you can change condition and try again.</td></tr>";
                }
                else
                {
                    uint   lastworktime = 0;
                    string macid        = "";
                    byte   maccount     = 0;
                    for (int i = 0, len = list.Count(); i < len; i++)
                    {
                        var obj = list[i];
                        if (!macid.Equals(obj.mac_id))
                        {
                            macid = obj.mac_id;
                            maccount++;
                        }
                        var data     = CustomConvert.GetBytes(obj.message_content);
                        var worktime = BitConverter.ToUInt32(data, obj.command_id.Equals("0x1000") ? 13 : 0);
                        int interval = (int)(i == 0 ? 0 : (worktime - lastworktime));
                        // 两条数据之间接收时间之差
                        long minInterval = (long)((i == 0) ? 0 : (obj.receive_time.Value - list[i - 1].receive_time.Value).TotalSeconds);
                        if (interval > minInterval)
                        {
                            // 如果这条数据与上一条数据的工作时间之差大于了这两条数据的接收时间之差则将其算做0
                            interval = 0;
                        }

                        TotalWorkedMinutes += obj.command_id.Equals("0x600B") ? 0 : (interval > 0 ? interval : 0);
                        var    bin = obj.command_id.Equals("0x600B") ? "00000000" : CustomConvert.IntToDigit(data[4], CustomConvert.BIN, 8);
                        string eng, engflag;
                        if (obj.command_id.Equals("0x600B"))
                        {
                            eng     = EquipmentBLL.eng_off;
                            engflag = "0";
                        }
                        else if (data[1] == 0x40 || data[1] == 0x0F || data[1] == 0xFF)
                        {
                            eng     = EquipmentBLL.eng_lock;
                            engflag = "0";
                        }
                        else
                        {
                            eng     = (bin[6] == '1' ? EquipmentBLL.eng_on : EquipmentBLL.eng_off);
                            engflag = (bin[6] == '1' ? "1" : "0");
                        }
                        int added = (interval > 0 ? (obj.command_id.Equals("0x600B") ? 0 : (interval > 60 ? interval / 60 : 1)) : 0) + (engflag.Equals("1") ? 1 : 0);
                        TotalAddedMinutes += added;
                        TotalUsedHour     += interval > 0 ? (obj.command_id.Equals("0x600B") ? 0 : (interval > 60 ? interval / 60 : 1)) : 0;

                        html += "<tr>" +
                                "<td class=\"in-tab-title-b\">" + (i + 1) + "</td>" +
                                "<td class=\"in-tab-title-rb textoverflow\" style=\"text-align: left; \">" + obj.receive_time.Value.ToString("yyyy/MM/dd HH:mm:ss") + "</td>" +
                                "<td class=\"in-tab-title-b\" style=\"text-align: right;\">" + EquipmentBLL.GetRuntime((int?)worktime) + "</td>" +
                                "<td class=\"in-tab-title-b\" style=\"text-align: right;\">" + string.Format("{0:0,00}", worktime) + "</td>" +
                                "<td class=\"in-tab-title-b\" style=\"text-align: right;\">" + (interval > 60 ? ("<font color=\"#FF0000\">" + interval + "</font>") : interval.ToString()) + "</td>" +
                                "<td class=\"in-tab-title-rb\" style=\"text-align: right;\">" + added + "</td>" +
                                "<td class=\"in-tab-title-b\" style=\"text-align: left;\">" + obj.command_id + "</td>" +
                                "<td class=\"in-tab-title-b\" style=\"text-align: left;\">" + obj.terminal_id + "</td>" +
                                "<td class=\"in-tab-title-rb textoverflow\" style=\"text-align: left;\">" + obj.mac_id + "</td>" +
                                "<td class=\"in-tab-title-b\" style=\"text-align: center; width: 30px;\">" + eng + "</td>" +
                                "<td class=\"in-tab-title-b\" style=\"text-align: center; width: 30px;\">" + engflag + "</td>" +
                                "<td class=\"in-tab-title-b\" style=\"text-align: left;\">" + obj.message_content + "</td>" +
                                "<td class=\"in-tab-title-b\"></td>" +
                                "</tr>";
                        lastworktime = worktime;

                        if (i == len - 1)
                        {
                            var    compensate = (TotalWorkedMinutes / 60.0) / TotalUsedHour;
                            var    finalAdded = TotalAddedMinutes / 60.0 * compensate;
                            var    finalWork  = worktime / 60.0 + finalAdded;
                            string summary    = "<tr>" +
                                                "<td class=\"in-tab-title-rb textoverflow\">" + obj.mac_id + "</td>" +
                                                "<td class=\"in-tab-title-rb\" style=\"text-align: right;\">" + EquipmentBLL.GetRuntime((int?)worktime) + "</td>" +
                                                "<td class=\"in-tab-title-b\" style=\"text-align: right;\">" + EquipmentBLL.GetRuntime(TotalWorkedMinutes) + "</td>" +
                                                "<td class=\"in-tab-title-b\" style=\"text-align: right;\">" + TotalUsedHour + "</td>" +
                                                "<td class=\"in-tab-title-rb\" style=\"text-align: right;\">" + compensate + "</td>" +
                                                "<td class=\"in-tab-title-b\" style=\"text-align: right;\">" + TotalAddedMinutes + "/" + EquipmentBLL.GetRuntime((int?)TotalAddedMinutes) + "</td>" +
                                                "<td class=\"in-tab-title-b\" style=\"text-align: right;\">" + finalAdded + "</td>" +
                                                "<td class=\"in-tab-title-rb\" style=\"text-align: right;\">" + finalWork + "</td>" +
                                                "<td class=\"in-tab-title-b\"></td>" +
                                                "</tr>";
                            tbodySummary.InnerHtml += summary;
                            if (query.Id > 0)
                            {
                                // 只查询到一个设备时才更新统计数据,否则不需要更新
                                if (maccount <= 1)
                                {
                                    new EquipmentBLL().Update(f => f.id == query.Id, act =>
                                    {
                                        // 实际工作小时数
                                        act.WorkHours = TotalWorkedMinutes / 60.0;
                                        // 粗略计算工作小时数
                                        act.UsedHours = TotalUsedHour;
                                        // 工作效率
                                        act.HourWorkEfficiency = compensate;
                                        // 补偿的小时数
                                        act.AddedHours = TotalAddedMinutes / 60.0;
                                        // 实际补偿的小时数
                                        act.CompensatedHours = finalAdded;
                                    });
                                }
                            }
                        }
                    }
                }
                if (checkAnalyseDailyWork.Checked)
                {
                    tbodyBody.InnerHtml = html;
                }
            }
        }
Exemplo n.º 46
0
        public ActionResult Add(Work model, string submit)
        {
            if (submit == "Thêm")
            {
                isThemMoi = true;
                if (model != null)
                {
                    model.Name_Work        = model.Name_Work.ToString();
                    model.Description_Work = model.Description_Work.ToString();
                    model.Details_Work     = model.Details_Work.ToString();
                    model.DateWorkStart    = model.DateWorkStart;
                    model.DateWorkEnd      = model.DateWorkEnd;
                    if (model.Note != null)
                    {
                        model.Note = model.Note.ToString();
                    }

                    model.Status      = model.Status;
                    model.CreatedDate = model.CreatedDate.GetValueOrDefault(System.DateTime.Now);
                    _dbContext.Work.Add(model);
                    _dbContext.SaveChanges();
                    model = null;
                }
                SetAlert("Thêm thông tin thành công!", "success");
                return(RedirectToAction("Index"));
            }
            else if (submit == "Cập Nhật")
            {
                isThemMoi = false;
                if (model != null)
                {
                    var list = _dbContext.Work.SingleOrDefault(x => x.ID == model.ID);
                    list.Name_Work        = model.Name_Work ?? "";
                    list.Description_Work = model.Description_Work.ToString() ?? "";
                    list.Details_Work     = model.Details_Work.ToString() ?? "";
                    list.DateWorkStart    = model.DateWorkStart;
                    list.DateWorkEnd      = model.DateWorkEnd;
                    if (model.Note != null)
                    {
                        list.Note = model.Note.ToString();
                    }


                    list.Status       = model.Status;
                    list.ModifiedDate = model.CreatedDate.GetValueOrDefault(System.DateTime.Now);
                    _dbContext.SaveChanges();
                    model = null;
                }
                SetAlert("Cập nhật thông tin thành công!", "success");
                return(RedirectToAction("Index"));
            }
            else if (submit == "Tìm")
            {
                if (!string.IsNullOrEmpty(model.Name_Work))
                {
                    List <Work> list = GetData().Where(s => s.Name_Work.Contains(model.Name_Work)).ToList();
                    return(View("Index", list));
                }
                else
                {
                    List <Work> list = GetData();
                    return(View("Index", list));
                }
            }
            else
            {
                List <Work> list = GetData().OrderBy(s => s.Name_Work).ToList();
                return(View("Index", list));
            }
        }
Exemplo n.º 47
0
 public abstract void WriteProgram(Work w);
Exemplo n.º 48
0
 public SetTimeWindow(Work inputWork)
 {
     InitializeComponent();
     curWork      = inputWork;
     this.Loaded += SetTime_Loaded;
 }
Exemplo n.º 49
0
 internal override void DoJob(ref Worker wr, Cont <Unit> uK)
 {
     Worker.PushNew(ref wr, Do());
     Work.Do(uK, ref wr);
 }
Exemplo n.º 50
0
 public async Task Update(Work work)
 {
     await _workService.Update(work);
 }
Exemplo n.º 51
0
 internal override void DoJob(ref Worker wr, Cont <X> xK)
 {
     Work.Do(Do(xK), ref wr);
 }
Exemplo n.º 52
0
 public AdminMenu(Work <RequestContext> requestContextAccessor)
 {
     _requestContextAccessor = requestContextAccessor;
     T = NullLocalizer.Instance;
 }
Exemplo n.º 53
0
        public override bool OnMessage(GUIMessage message)
        {
            switch (message.Message)
            {
            case GUIMessage.MessageType.GUI_MSG_WINDOW_INIT:
            {
                base.OnMessage(message);
                LoadSettings();

                if (m_bAutoShuffle)
                {
                    GUIControl.SelectControl(GetID, (int)Controls.CONTROL_AUTOSHUFFLE);
                }
                return(true);
            }

            case GUIMessage.MessageType.GUI_MSG_WINDOW_DEINIT:
            {
                SaveSettings();
            }
            break;

            case GUIMessage.MessageType.GUI_MSG_CLICKED:
            {
                int iControl = message.SenderControlId;

                if (iControl == (int)Controls.CONTROL_AUTOSHUFFLE)
                {
                    m_bAutoShuffle = !m_bAutoShuffle;
                }

                if (iControl == (int)Controls.CONTROL_BTNDELALBUMINFO)
                {
                    MusicDatabaseReorg dbreorg = new MusicDatabaseReorg();
                    dbreorg.DeleteAlbumInfo();
                }
                if (iControl == (int)Controls.CONTROL_BTNDELALBUM)
                {
                    MusicDatabaseReorg dbreorg = new MusicDatabaseReorg();
                    dbreorg.DeleteSingleAlbum();
                }

                if (iControl == (int)Controls.CONTROL_BTNREORGDB)
                {
                    GUIDialogYesNo dlgYesNo = (GUIDialogYesNo)GUIWindowManager.GetWindow((int)Window.WINDOW_DIALOG_YES_NO);
                    if (null != dlgYesNo)
                    {
                        dlgYesNo.SetHeading(333);
                        dlgYesNo.SetLine(1, "");
                        dlgYesNo.SetLine(2, "");
                        dlgYesNo.SetLine(3, "");
                        dlgYesNo.DoModal(GetID);

                        if (dlgYesNo.IsConfirmed)
                        {
                            MusicDatabaseReorg reorg = new MusicDatabaseReorg(GetID);
                            Work work = new Work(new DoWorkHandler(reorg.ReorgAsync));
                            work.ThreadPriority = ThreadPriority.Lowest;
                            GlobalServiceProvider.Get <IThreadPool>().Add(work, QueuePriority.Low);
                        }
                    }
                }
            }
            break;
            }
            return(base.OnMessage(message));
        }
Exemplo n.º 54
0
        public void LogAddWorkToDB(Work work)
        {
            string message = $"A work with the id {work.Id} has been added.";

            _logger.LogInformation(MylogEventId.MyEventIdChangeDB, message);
        }
Exemplo n.º 55
0
 public TimeoutEventArgs(Work WorkItem)
 {
     this.WorkItem = WorkItem;
 }
Exemplo n.º 56
0
 public void IsSymbolAllowed_StringSymbolsIsAllowed_True(string str)
 {
     Assert.IsTrue(Work.IsSymbolAllowed(str));
 }
Exemplo n.º 57
0
        public static async Task DisplayPlayer(Player player, ICommandContext Context, bool inspect = false)
        {
            Quest  quest = Quest.getQuest(Program.handler, player.Character.Stats.Quests.questID);
            string name  = "";

            int player_damage = player.Character.Gear.Sword.Damage + player.Character.Level + player.Character.Gear.Sword.EnchantedLevel;

            string xpString    = string.Format("{0:n0}", player.Character.XP);
            string xpCapString = string.Format("{0:n0}", player.Character.XP_CAP);

            string playerName = player.Character.Name;

            playerName = playerName.First().ToString().ToUpper() + playerName.Substring(1);

            string rankString = "";

            rankString = $"[ #{Program.handler.Players.Count - Program.handler.Players.IndexOf(player)} / {Program.handler.Players.Count} ]";
            if (player.Character.ActiveTitle == null)
            {
                name += $"{playerName}  {rankString}\n";
            }
            else
            {
                name += $">>>> ~{player.Character.ActiveTitle.name}~ <<<<\n{playerName}  {rankString}\n";
            }

            string toReturn = $"{name}|+| HP:[ {player.Character.HP}/{player.Character.MAX_HP} ]  Prot:<{{ {player.Character.Protection} }}>  Dmg:<{{ {player_damage} }}>";

            if (player.Character.Level == Player.LevelCap)
            {
                toReturn += $"\n|+| Level: {player.Character.Level} ( {xpString} )";
            }
            else
            {
                toReturn += $"\n|+| Level: {player.Character.Level} ( {xpString} / {xpCapString} )";
            }

            toReturn += $"\n|+| Gold: {player.Character.Gold}\n|+| Quests Unlocked: {player.Character.Stats.Quests.questsUnlocked}\n";

            if (player.Character.Stats.Work.isWorking)
            {
                string workLeft = Work.WorkString(player, false);
                toReturn += $"\nCurrently Working. {workLeft}";
            }
            else if (player.Character.Stats.Quests.isInQuest)
            {
                if (quest.Duration - player.Character.Stats.Quests.minutesInQuest > 1)
                {
                    toReturn += $"\nCurrently On The Quest: {quest.Name} - {quest.Duration - player.Character.Stats.Quests.minutesInQuest} Minutes Left";
                }
                else
                {
                    toReturn += $"\nCurrently On The Quest: {quest.Name} - 1 Minute left";
                }
            }

            if (player.Character.Stats.HP.dead && inspect)
            {
                toReturn += $"\nThis Character Is Dead: {60 - player.Character.Stats.HP.deathCooldown} More Minutes To Recover";
            }
            else if (player.Character.Stats.HP.dead && !inspect)
            {
                toReturn += $"\nYour Character Is Dead: {60 - player.Character.Stats.HP.deathCooldown} More Minutes To Recover";
            }

            else if (!player.Character.Stats.Quests.isInQuest && player.Character.Stats.Quests.questCooldown < 5)
            {
                if (5 - player.Character.Stats.Quests.questCooldown > 1)
                {
                    toReturn += $"\nQuest Cooldown: {5 - player.Character.Stats.Quests.questCooldown} Minutes Left";
                }
                else
                {
                    toReturn += $"\nQuest Cooldown: 1 Minute Left";
                }
            }

            if (player.Character.Stats.PvP.reasonlessKillTimer > 0)
            {
                toReturn += $"\nOn Bounty. {Library.GetTimeString(player.Character.Stats.PvP.reasonlessKillTimer % 60, player.Character.Stats.PvP.reasonlessKillTimer / 60)}";
            }

            toReturn += "```";

            if (player.Character.Stats.HP.dead)
            {
                toReturn += ":skull:";
            }

            await Context.Channel.SendMessageAsync($"```swift\n{toReturn}");

            return;
        }
 public TypedElementHarvester(Work <IElementManager> elementManager, Work <IElementFactory> factory)
 {
     _elementManager = elementManager;
     _factory        = factory;
 }
Exemplo n.º 59
0
 public NumericFilterForm(IShapeFactory shapeFactory, Work <IResourceManager> resourceManager)
 {
     _resourceManager = resourceManager;
     Shape            = shapeFactory;
     T = NullLocalizer.Instance;
 }
Exemplo n.º 60
0
        /// <summary>
        /// Основной поток обработки
        /// </summary>
        /// <param name="obj">Форма процесса обработки, главная форма, список файлов для обработки</param>
        protected void delegate_action(object obj)
        {
            object [] data = (object[])obj;

            StatusWindow  window       = (StatusWindow)data[0];
            MainWindow    wmain        = (MainWindow)data[1];
            List <string> files        = (List <string>)data[2];
            List <string> missingFiles = new List <string>();

            window.setState(true, "Подготовка файлов", 0, files.Count);

            wmain.Log(DataLog.LogImage.NONE, DateTime.Now.ToString("Начало конвертации dd.MM.yyyy в HH:mm:ss"));
            wmain.Log(DataLog.LogImage.NONE, "Директория: " + LastLaunch.Default.inputDirectory);
            wmain.Log(DataLog.LogImage.NONE, "Задано файлов для обработки: " + files.Count);

            if (config.only_rules)
            {
                CheckRules(files, window, wmain);
                return;
            }

            int   errcount    = 0;
            bool  reopenExcel = true;
            Excel excel       = null;
            DBF   dbf         = null;

            Stopwatch totalwatch = Stopwatch.StartNew();

            for (int idoc = 0; idoc < files.Count; idoc++)
            {
                string pathFull  = files[idoc];
                string filename  = Path.GetFileName(pathFull);
                bool   deleteDbf = false;

                if (reopenExcel)
                {
                    excel       = new Excel();
                    reopenExcel = false;
                }

                try
                {
                    Logger.info("");
                    Logger.debug("");
                    Logger.debug("==============================================================");
                    Logger.info($"======= Загружаем Excel документ: {filename} ======");
                    Logger.debug("==============================================================");
                    window.updateState(true, $"Документ: {filename}", idoc);

                    string targetFileName = getOutputFilename(excel.worksheet, pathFull, config.outfile.simple, config.outfile.script);
                    string pathOutput     = Path.Combine(LastLaunch.Default.outputDirectory, targetFileName);
                    string pathTemp       = config.use_output_directory_as_temp ?  $"{pathOutput}.tmp" : Path.GetTempFileName();

                    if (File.Exists(pathOutput))
                    {
                        Logger.info($"Файл '{targetFileName}' уже существует!");
                        if (config.skip_existing_files)
                        {
                            var message = $"Файл '{filename}' пропущен, так как уже был сконвертирован ранее!";
                            wmain.Log(DataLog.LogImage.INFO, message);
                            continue;
                        }
                    }

                    excel.OpenWorksheet(pathFull);

                    var form = XmlTools.findCorrectForm(excel.worksheet, config.Forms);
                    if (form == null)
                    {
                        string warning = $"Для документа '{filename}' не найдено подходящих форм обработки!";
                        Logger.warn(warning);
                        var icon = config.no_form_is_error ? DataLog.LogImage.ERROR : DataLog.LogImage.WARNING;
                        wmain.Log(icon, warning);
                        throw new ArgumentNullException(warning);
                    }


                    dbf = new DBF(pathTemp, form.DBF, config.dbf_output_encoding);

                    Work work = new Work(excel.worksheet, form, config.buffer_size);
                    work.guiLogger = wmain.Log;

                    var total = excel.worksheet.UsedRange.Rows.Count - work.StartY;
                    window.setState(false, $"Обработано записей: {0}/{total}", 0, total);

                    TimeSpan elapsed = work.IterateRecords(dbf.appendRecord,
                                                           id => window.updateState(false, $"Обработано записей: {id}/{total}", id)
                                                           );

                    dbf.close();


                    // Перемещение файла
                    if (File.Exists(pathOutput))
                    {
                        File.Delete(pathOutput);
                    }
                    File.Move(pathTemp, pathOutput);
                    Logger.debug($"Перемещение файла с {pathTemp} в {pathOutput}");

                    wmain.Log(
                        DataLog.LogImage.SUCCESS,
                        $"Документ '{filename}' в {dbf.Writed} строк успешно обработан за {elapsed:hh\\:mm\\:ss\\.ff}."
                        );
                    outlog.Add($"{filename} в {dbf.Writed} строк за {elapsed:hh\\:mm\\:ss\\.ff}");

                    Logger.info("Времени потрачено на обработку данных: " + elapsed);
                    Logger.info("Обработано записей: " + dbf.Writed);
                    Logger.debug($"Начиная с {work.StartY} по {work.StartY + dbf.Writed}");
                    Logger.info($"=============== Документ {Path.GetFileName(pathFull)} успешно обработан! ===============");
                }
                catch (Exception ex) when(!DEBUG)
                {
                    bool addToFormLog = true;

                    if (ex is COMException)
                    {
                        Logger.error("Excel вероятнее всего крашанулся, он будет перезапущен для следующего документа в очереди!");
                        reopenExcel = true;
                    }

                    if (ex is ThreadAbortException || ex.InnerException is ThreadAbortException)
                    {
                        Logger.warn($"Пользователь вышел во время процесса конвертации документа '{filename}'!");
                        goto skip_error_msgbox;
                    }

                    if (ex is ArgumentNullException)
                    {
                        if (!config.no_form_is_error)
                        {
                            continue;
                        }
                        addToFormLog = false;
                    }

                    if (addToFormLog)
                    {
                        wmain.Log(DataLog.LogImage.ERROR, $"Документ '{filename}' был пропущен из-за ошибки!\n{ex.Message}");
                    }
                    Logger.error($"Документ {filename} был пропущен из-за ошибки:\n{ex.Message}\n\n{ex.StackTrace}");

skip_error_msgbox:
                    errcount++;
                    missingFiles.Add(filename);
                    deleteDbf = true;
                }
                finally
                {
                    Logger.debug("Закрытие COM Excel и DBF");
                    dbf?.close();
                    if (deleteDbf)
                    {
                        dbf?.delete();
                    }
                }
            }
            totalwatch.Stop();

            // Не забываем завершить Excel
            excel.close();

            string msgTotal = $"\nВремени затрачено суммарно: {totalwatch.Elapsed:hh\\:mm\\:ss\\.ff}";

            wmain.Log(DataLog.LogImage.INFO, msgTotal);
            Logger.info(msgTotal);

            if (errcount > 0)
            {
                wmain.Log(DataLog.LogImage.ERROR, config.warning ?? "{0}");
            }

            wmain.toggleConvertButton(true);
            updateDirectory();
            wmain.BeginInvoke((MethodInvoker)wmain.fillElementsData);
            window.mayClose();


            if (config.show_messagebox_after)
            {
                var icon    = MessageBoxIcon.Information;
                var title   = "Конвертация успешно завершена";
                var message = title + msgTotal;
                if (errcount > 0)
                {
                    icon     = MessageBoxIcon.Error;
                    title    = "Ошибка конвертации";
                    message  = "Ошибка! Не все файлы были сконвертированы!" + msgTotal;
                    message += "\n\nНе удалось конвертировать следующие файлы:\n" + string.Join("\n", missingFiles);
                }
                wmain.BeginInvoke((System.Action) delegate
                {
                    MessageBox.Show(wmain, message, title, MessageBoxButtons.OK, icon);
                });
            }
        }