Ejemplo n.º 1
0
        public void SetStatus(ProcessingStatus status, string message, params object[] prms)
        {
            Status        = status;
            StatusMessage = prms.Length > 0 ? string.Format(message, prms) : message;

            SaveLog(new Log(Name, null, null, StatusMessage));
        }
Ejemplo n.º 2
0
 public Host(ILogProvider logProvider, IContextProvider contextProvider)
 {
     ContextProvider   = contextProvider;
     LogProvider       = logProvider;
     Status            = ProcessingStatus.Ready;
     RunningContextIds = new HashSet <Guid>();
 }
Ejemplo n.º 3
0
        public static async Task <HttpResponseMessage> Run(
            [HttpTrigger(AuthorizationLevel.Function, "post")] Customer customer,
            [Table("processingStatus", Connection = "registrationstorage_STORAGE")] CloudTable processingStatusTable,
            [Queue("requestreceived", Connection = "registrationstorage_STORAGE")] CloudQueue requestReceivedQueue,
            TraceWriter log)
        {
            log.Info($"Data received: {customer.Name} - {customer.Surname}");

            var processingStatus = new ProcessingStatus
            {
                ProcessingState = ProcessingState.Received.ToString()
            };

            customer.RowKey = processingStatus.RowKey;

            TableOperation insertOperation = TableOperation.Insert(processingStatus);
            await processingStatusTable.ExecuteAsync(insertOperation);

            string serializeCustomer = JsonConvert.SerializeObject(customer);
            await requestReceivedQueue.AddMessageAsync(new CloudQueueMessage(serializeCustomer));

            return(new HttpResponseMessage(HttpStatusCode.Accepted)
            {
                Headers =
                {
                    Location = new Uri(ConfigurationManager.AppSettings["RequestStatusCheckUrl"] + processingStatus.RowKey)
                }
            });
        }
Ejemplo n.º 4
0
        public void Execute()
        {
            SetStatus(ProcessingStatus.Running, "Running.");

            if (Status == ProcessingStatus.Running)
            {
                if (++ScopeRunCounter == 1)
                {
                    DoLog($"Scope {ScopeId} started.");
                }

                var nextStep = CurrentStep.Execute(this);

                if (nextStep == null)
                {
                    if (CurrentStep is FinishStep)
                    {
                        Status = ProcessingStatus.Finished;
                    }
                    else
                    {
                        Status = ProcessingStatus.Halted;
                    }
                }

                CurrentStep = nextStep;
            }

            if (Status == ProcessingStatus.Halted ||
                Status == ProcessingStatus.Finished ||
                Status == ProcessingStatus.Error)
            {
                DoLog($"Scope {ScopeId} ended, after {ScopeRunCounter} runs.");
            }
        }
Ejemplo n.º 5
0
        public async Task <bool> TryLogProcessAttemptAsync(
            EmailQueueToken token,
            int retryCount,
            ProcessingStatus status,
            DateTime startUtc,
            DateTime endUtc,
            string errorMessage,
            CancellationToken cancellationToken)
        {
            var success = false;

            try
            {
                if (!_initialized)
                {
                    await InitializeAsync(cancellationToken);
                }

                var entry  = new TableProcessorLogEntry(token, retryCount, status, startUtc, endUtc, errorMessage);
                var op     = TableOperation.Insert(entry);
                var result = await _processLogTable.Value.ExecuteAsync(op);

                success = result.HttpStatusCode < 300 && result.HttpStatusCode >= 200;
            }
            catch (Exception ex)
            {
                _logger.LogError("Error writing processor log entry for token {0}:\n{1}", token, ex);
            }

            return(success);
        }
Ejemplo n.º 6
0
        public static async Task Run(
            [QueueTrigger("requestreceived", Connection = "registration2storage_STORAGE")] Customer customer,
            [Queue("requestaccepted", Connection = "registration2storage_STORAGE")] CloudQueue requestAcceptedQueue,
            [Table("processingStatus", Connection = "registration2storage_STORAGE")] CloudTable proccessingStatusTable,
            TraceWriter log)
        {
            log.Info($"RequestValidation function processed: {customer.RowKey} ({customer.Name} - {customer.Surname})");

            var validator            = new CustomerValidator();
            ValidationResult results = validator.Validate(customer);

            var processingStatus = new ProcessingStatus(customer.RowKey)
            {
                ETag = "*"
            };

            if (results.IsValid)
            {
                await requestAcceptedQueue.AddMessageAsync(new CloudQueueMessage(JsonConvert.SerializeObject(customer)));

                processingStatus.ProcessingState = ProcessingState.Accepted.ToString();
            }
            else
            {
                processingStatus.ProcessingState = ProcessingState.Error.ToString();
                processingStatus.Message         = "Validation failed: " +
                                                   results.Errors.Select(error => error.ErrorMessage)
                                                   .Aggregate((a, b) => a + "; " + b);
            }

            TableOperation updateOperation = TableOperation.Replace(processingStatus);
            await proccessingStatusTable.ExecuteAsync(updateOperation);
        }
Ejemplo n.º 7
0
    private void Start()
    {
        Debug.Log(gameObject.GetComponent <SpeechToText>().settings);
        LogSystem.InstallDefaultReactors();
        Runnable.Run(CreateService());
        status = ProcessingStatus.Idle;

        // You can't use hyphens in enums, so the name of the model is completely defined here.
        languageModel = "en-" + model;


        outputInputField = gameObject.GetComponent <InputField>();
        if (outputInputField == null)
        {
            outputInputField = gameObject.AddComponent <InputField>();
            outputInputField.textComponent = gameObject.AddComponent <Text>();
        }


        if (outputInputField != null)
        {
        }

        //var temp = GameObject.Find("WatsonSettings").GetComponent<WatsonSettings>();
    }
Ejemplo n.º 8
0
    private void OnRecognize(SpeechRecognitionEvent result)
    {
        status = ProcessingStatus.Processing;

        if (result != null && result.results.Length > 0)
        {
            foreach (var res in result.results)
            {
                foreach (var alt in res.alternatives)
                {
                    //string text = string.Format("{0} ({1}, {2:0.00})\n", alt.transcript, res.final ? "Final" : "Interim", alt.confidence);
                    string text = string.Format("{0}", alt.transcript);
                    Log.Debug("SpeechInput.OnRecognize()", text);

                    //Once the phrase of speech is final, set the results field to the final text.
                    //Set the processing status to show that it has been processed.
                    if (res.final)
                    {
                        if (spokenText != null)
                        {
                            spokenText.text = text;
                        }
                        if (targetInputField != null)
                        {
                            targetInputField.text = text;
                        }
                        if (targetGameObject != null)
                        {
                            InputField target = targetGameObject.GetComponent <InputField>();
                            if (target != null)
                            {
                                target.text = text;
                            }
                        }
                        status = ProcessingStatus.Processed;
                    }
                }

                if (res.keywords_result != null && res.keywords_result.keyword != null)
                {
                    foreach (var keyword in res.keywords_result.keyword)
                    {
                        Log.Debug("SpeechInput.OnRecognize()", "keyword: {0}, confidence: {1}, start time: {2}, end time: {3}", keyword.normalized_text, keyword.confidence, keyword.start_time, keyword.end_time);
                    }
                }

                if (res.word_alternatives != null)
                {
                    foreach (var wordAlternative in res.word_alternatives)
                    {
                        Log.Debug("SpeechInput.OnRecognize()", "Word alternatives found. Start time: {0} | EndTime: {1}", wordAlternative.start_time, wordAlternative.end_time);
                        foreach (var alternative in wordAlternative.alternatives)
                        {
                            Log.Debug("ExampleStreaming.OnRecognize()", "\t word: {0} | confidence: {1}", alternative.word, alternative.confidence);
                        }
                    }
                }
            }
        }
    }
Ejemplo n.º 9
0
        public void Execute()
        {
            Telemetry.Current.TrackEvent("MigrationContextExecute",
                                         new Dictionary <string, string>
            {
                { "Name", Name },
                { "Target Project", me.Target.Name },
                { "Target Collection", me.Target.Collection.Name },
                { "Source Project", me.Source.Name },
                { "Source Collection", me.Source.Collection.Name }
            });
            Trace.TraceInformation(" Migration Context Start {0} ", Name);
            var executeTimer = new Stopwatch();

            executeTimer.Start();
            //////////////////////////////////////////////////
            try
            {
                Status = ProcessingStatus.Running;
                InternalExecute();
                Status = ProcessingStatus.Complete;
                executeTimer.Stop();
                Telemetry.Current.TrackEvent("MigrationContextComplete",
                                             new Dictionary <string, string>
                {
                    { "Name", Name },
                    { "Target Project", me.Target.Name },
                    { "Target Collection", me.Target.Collection.Name },
                    { "Source Project", me.Source.Name },
                    { "Source Collection", me.Source.Collection.Name },
                    { "Status", Status.ToString() }
                },
                                             new Dictionary <string, double>
                {
                    { "MigrationContextTime", executeTimer.ElapsedMilliseconds }
                });
                Trace.TraceInformation(" Migration Context Complete {0} ", Name);
            }
            catch (Exception ex)
            {
                Status = ProcessingStatus.Failed;
                executeTimer.Stop();
                Telemetry.Current.TrackException(ex,
                                                 new Dictionary <string, string>
                {
                    { "Name", Name },
                    { "Target Project", me.Target.Name },
                    { "Target Collection", me.Target.Collection.Name },
                    { "Source Project", me.Source.Name },
                    { "Source Collection", me.Source.Collection.Name },
                    { "Status", Status.ToString() }
                },
                                                 new Dictionary <string, double>
                {
                    { "MigrationContextTime", executeTimer.ElapsedMilliseconds }
                });
                Trace.TraceWarning("  [EXCEPTION] {0}", ex.Message);
                throw ex;
            }
        }
Ejemplo n.º 10
0
 public bool Stop(HostControl hostControl)
 {
     _status = ProcessingStatus.Stopped;
     _remoteControl.StopProcessingServicesettingsMonitor();
     _cancelationSource.Cancel();
     return(true);
 }
Ejemplo n.º 11
0
 public void SetStatus(ProcessingStatus status, string message, params object[] prms)
 {
     Status        = status;
     StatusMessage = prms.Any() ? string.Format(message, prms) : message;
     DoUpdate();
     DoLog(null, StatusMessage);
 }
Ejemplo n.º 12
0
    private void Start()
    {
        // Enable TLS 1.2
        //ServicePointManager.SecurityProtocol |= SecurityProtocolType.Tls12;

        // Disable old protocols
        //ServicePointManager.SecurityProtocol &= ~(SecurityProtocolType.Ssl3 | SecurityProtocolType.Tls | SecurityProtocolType.Tls11);

        LogSystem.InstallDefaultReactors();
        Runnable.Run(CreateService());
        chatStatus = ProcessingStatus.Idle;

        // Since coroutines can't return values I use the onValueChanged listener
        // to trigger an action after waiting for an input to arrive.
        // I originally used enums or flags to keep track if a process such
        // as obtaining a chat response from IBM Assistant was still being processed
        // or was finished processing but this was cumbersome.

        if (externalInputField != null)
        {
            if (externalTriggerType == InputFieldTrigger.onEndEdit)
            {
                externalInputField.onEndEdit.AddListener(delegate { Runnable.Run(ProcessChat(externalInputField.text)); });
            }
            else
            {
                externalInputField.onValueChanged.AddListener(delegate { Runnable.Run(ProcessChat(externalInputField.text)); });
            }
        }

        inputField = gameObject.AddComponent <InputField>();
        inputField.textComponent = gameObject.AddComponent <Text>();
        inputField.onValueChanged.AddListener(delegate { Runnable.Run(ProcessChat(inputField.text)); });
    }
Ejemplo n.º 13
0
        private bool Initialize()
        {
            try
            {
                _status          = ProcessingStatus.Initialization;
                _fileQueueName   = ConfigurationManager.AppSettings["FileQueueName"];
                _sequanceTime    = int.Parse(ConfigurationManager.AppSettings["SequanceTime"]);
                _outputDirectory = ConfigurationManager.AppSettings["OutputDirectory"];
                _trashDirectory  = ConfigurationManager.AppSettings["TrashDirectory"];
                _queuesQueueName = ConfigurationManager.AppSettings["QueuesQueueName"];
                if (!Directory.Exists(_outputDirectory))
                {
                    Directory.CreateDirectory(_outputDirectory);
                }

                RestorePreviousSession();
                _status = ProcessingStatus.Idle;
                Task.Run(() => ProcessFiles(_cancelationSource.Token));
            }
            catch (Exception e)
            {
                HostLogger.Get <ProcessingService>().Error(e.Message);
                return(false);
            }

            return(true);
        }
Ejemplo n.º 14
0
        private void GeneratePdfFile(Guid agentId, List <string> imageNames, CancellationToken cancelToken)
        {
            _status = ProcessingStatus.PdfFileGeneration;
            using (var pdfFile = new PdfDocument())
            {
                foreach (var imageName in imageNames)
                {
                    HostLogger.Get <ProcessingService>().Info($"Adding of file: {imageName}");
                    var page = pdfFile.AddPage();
                    var gfx  = XGraphics.FromPdfPage(page);
                    using (var image = XImage.FromFile(imageName))
                    {
                        var imageWidth  = (double)(image.PixelWidth < page.Width ? image.PixelWidth : page.Width);
                        var imageHeight = (imageWidth / image.PixelWidth) * image.PixelHeight;
                        gfx.DrawImage(image, 0, 0, imageWidth, imageHeight);
                    }

                    cancelToken.ThrowIfCancellationRequested();
                }

                HostLogger.Get <ProcessingService>().Info("Pdf generation finished...");
                var agentName     = agentId.ToString().Substring(32, 4);
                var resultPdfFile = Path.Combine(_outputDirectory,
                                                 $"{DateTime.Now:yyyy-MMMM-dd(HH-mm-ss)} - agent {agentName}.pdf");
                HostLogger.Get <ProcessingService>().Info($"Pdf file saving: \n {resultPdfFile}");
                pdfFile.Save(resultPdfFile);
                _pdfCount++;
            }

            _status = ProcessingStatus.Idle;
        }
Ejemplo n.º 15
0
        private void SequanceProcess(Guid agentId, CancellationToken cancelToken)
        {
            try
            {
                var agentQueueName = GetAgentQueueName(agentId);
                HostLogger.Get <ProcessingService>().Info("Pdf generation started...");
                using (var agentQueue = new System.Messaging.MessageQueue(agentQueueName, QueueAccessMode.Receive))
                {
                    agentQueue.Formatter = new XmlMessageFormatter(new[] { typeof(string) });
                    var imageNamesMessages = agentQueue.GetAllMessages();
                    if (!imageNamesMessages.Any())
                    {
                        return;
                    }

                    var imageNames = imageNamesMessages.Select(x => x.Body as string).ToList();
                    GeneratePdfFile(agentId, imageNames, cancelToken);
                    RemoveProcessedItems(imageNames, agentQueue);
                }
            }
            catch (Exception e)
            {
                HostLogger.Get <ProcessingService>().Error(e.Message);
            }

            _status = ProcessingStatus.Idle;
        }
Ejemplo n.º 16
0
    private void Start()
    {
        Debug.Log(gameObject.GetComponent <SpeechToText>().settings);
        LogSystem.InstallDefaultReactors();
        //Runnable.Run(CreateService());
        status = ProcessingStatus.Idle;

        languageModel = (string)languageModels[model];

        outputInputField = gameObject.GetComponent <InputField>();
        if (outputInputField == null)
        {
            outputInputField = gameObject.AddComponent <InputField>();
            outputInputField.textComponent = gameObject.AddComponent <Text>();
        }


        if (outputInputField != null)
        {
        }

        // Active = false;

        //var temp = GameObject.Find("WatsonSettings").GetComponent<WatsonSettings>();
    }
    private void Start()
    {
        audioStatus = ProcessingStatus.Idle;
        LogSystem.InstallDefaultReactors();
        //Runnable.Run(CreateService());

        // Get or make the AudioSource for playing the speech
        if (outputAudioSource == null)
        {
            gameObject.AddComponent <AudioSource>();
            outputAudioSource = gameObject.GetComponent <AudioSource>();
        }

        // Since coroutines can't return values I use the onValueChanged listener
        // to trigger an action after waiting for an input to arrive.
        // I originally used enums or flags to keep track if a process such
        // as obtaining a chat response from IBM Assistant was still being processed
        // or was finished processing but this was cumbersome.

        if (externalInputField != null)
        {
            if (externalTriggerType == InputFieldTrigger.onEndEdit)
            {
                externalInputField.onEndEdit.AddListener(delegate { AddTextToQueue(externalInputField.text); });
            }
            else
            {
                externalInputField.onValueChanged.AddListener(delegate { AddTextToQueue(externalInputField.text); });
            }
        }

        inputField = gameObject.AddComponent <InputField>();
        inputField.textComponent = gameObject.AddComponent <Text>();
        inputField.onValueChanged.AddListener(delegate { AddTextToQueue(inputField.text); });
    }
        public ProcessingStatus Run()
        {
            Telemetry.TrackEvent("EngineStart",
                                 new Dictionary <string, string> {
                { "Engine", "Migration" }
            },
                                 new Dictionary <string, double> {
                { "Processors", Processors.Count },
                { "Mappings", FieldMaps.Count }
            });
            Stopwatch engineTimer = Stopwatch.StartNew();

            LoggingLevelSwitch logLevel = _services.GetRequiredService <LoggingLevelSwitch>();

            logLevel.MinimumLevel = Config.LogLevel;
            Log.Information("Logging has been configured and is set to: {LogLevel}. ", Config.LogLevel.ToString());
            Log.Information("                              Max Logfile: {FileLogLevel}. ", "Verbose");
            Log.Information("                              Max Console: {ConsoleLogLevel}. ", "Debug");
            Log.Information("                 Max Application Insights: {AILogLevel}. ", "Error");
            Log.Information("The Max log levels above show where to go look for extra info. e.g. Even if you set the log level to Verbose you will only see that info in the Log File, however everything up to Debug will be in the Console.");

            ProcessingStatus ps = ProcessingStatus.Running;

            Processors.EnsureConfigured();
            TypeDefinitionMaps.EnsureConfigured();
            GitRepoMaps.EnsureConfigured();
            ChangeSetMapps.EnsureConfigured();
            FieldMaps.EnsureConfigured();

            Log.Information("Beginning run of {ProcessorCount} processors", Processors.Count.ToString());
            foreach (_EngineV1.Containers.IProcessor process in Processors.Items)
            {
                Log.Information("Processor: {ProcessorName}", process.Name);
                Stopwatch processorTimer = Stopwatch.StartNew();
                process.Execute();
                processorTimer.Stop();
                Telemetry.TrackEvent("ProcessorComplete", new Dictionary <string, string> {
                    { "Processor", process.Name }, { "Status", process.Status.ToString() }
                }, new Dictionary <string, double> {
                    { "ProcessingTime", processorTimer.ElapsedMilliseconds }
                });

                if (process.Status == ProcessingStatus.Failed)
                {
                    ps = ProcessingStatus.Failed;
                    Log.Error("{Context} The Processor {ProcessorName} entered the failed state...stopping run", process.Name, "MigrationEngine");
                    break;
                }
            }
            engineTimer.Stop();
            Telemetry.TrackEvent("EngineComplete",
                                 new Dictionary <string, string> {
                { "Engine", "Migration" }
            },
                                 new Dictionary <string, double> {
                { "EngineTime", engineTimer.ElapsedMilliseconds }
            });
            return(ps);
        }
 protected void InvokeProcessingStatus(String statusMessage)
 {
     if (ProcessingStatus == null)
     {
         return;
     }
     ProcessingStatus.Invoke(this, statusMessage);
 }
Ejemplo n.º 20
0
    public void ErrorProcessing_ShouldThrow_WhenNotProcessing(ProcessingStatus status)
    {
        var sut = Fixture.CreateBook(config => config
                                     .With(x => x.IsArchived, false)
                                     .With(x => x.ProcessingStatus, status));

        Assert.Throws <InvalidOperationException>(() => sut.ErrorProcessing());
    }
Ejemplo n.º 21
0
 public LogFileRange(long startOffset, long endOffset, ProcessingStatus processingStatus) : this(startOffset)
 {
     if (endOffset < startOffset)
     {
         throw new ArgumentException(string.Format("The end offset must be at least as large as the start offset. startOffset={0}, endOffset={1}", startOffset, endOffset));
     }
     this.endOffset        = endOffset;
     this.processingStatus = processingStatus;
 }
Ejemplo n.º 22
0
    public void StartProcessing_ShouldSetToProcessing(ProcessingStatus status)
    {
        var sut = Fixture.CreateBook(config => config
                                     .With(x => x.IsArchived, false)
                                     .With(x => x.ProcessingStatus, status));

        sut.StartProcessing();

        Assert.Equal(ProcessingStatus.Processing, sut.GetState().ProcessingStatus);
    }
    private IEnumerator ProcessText()
    {
        Debug.Log("ProcessText");

        string nextText = String.Empty;

        audioStatus = ProcessingStatus.Processing;

        if (outputAudioSource.isPlaying)
        {
            yield return(null);
        }

        if (textQueue.Count < 1)
        {
            yield return(null);
        }
        else
        {
            nextText = textQueue.Dequeue();
            Debug.Log(nextText);

            if (String.IsNullOrEmpty(nextText))
            {
                yield return(null);
            }
        }

        byte[]    synthesizeResponse = null;
        AudioClip clip = null;

        tts_service.Synthesize(
            callback: (DetailedResponse <byte[]> response, IBMError error) =>
        {
            synthesizeResponse = response.Result;
            clip = WaveFile.ParseWAV("myClip", synthesizeResponse);

            //Place the new clip into the audio queue.
            audioQueue.Enqueue(clip);
        },
            text: nextText,
            ////////////////////////////////////////
            //voice: "en-" + voice,
            voice: "ko-" + voice,
            accept: "audio/wav"
            );

        while (synthesizeResponse == null)
        {
            yield return(null);
        }

        // Set status to indicate text to speech processing task completed
        audioStatus = ProcessingStatus.Idle;
    }
Ejemplo n.º 24
0
        private void InsertOrder(string reference, ProcessingStatus processingStatus = ProcessingStatus.Deliverable)
        {
            var outlet = new Outlet(Guid.NewGuid()) {Name = "The Outlet"};

            Database.InsertWithChildren(new Order(Guid.NewGuid(), outlet)
            {
                OrderReference = reference,
                ProcessingStatus = processingStatus,
                OutletMasterId = outlet.Id
            });
        }
Ejemplo n.º 25
0
        public async Task <ActionResult> GetStatus(string tabletId)
        {
            if (ModelState.IsValid)
            {
                ProcessingStatus status = await _pollingService.GetTabletStatus(tabletId);

                return(new JsonResult(status));
            }

            return(StatusCode(500));
        }
Ejemplo n.º 26
0
 public void ProcessExited(int exitCode)
 {
     if (exitCode == 0)
     {
         _status = ProcessingStatus.FINISHED;
     }
     else
     {
         _status = ProcessingStatus.CANCELED;
     }
 }
Ejemplo n.º 27
0
        /// <summary>
        /// //Game Waited Word Area
        /// </summary>

        void Start()
        {
            audioStatus = ProcessingStatus.Idle;
            LogSystem.InstallDefaultReactors();
            Runnable.Run(CreateService());

            if (outputAudioSource == null)
            {
                gameObject.AddComponent <AudioSource>();
                outputAudioSource = gameObject.GetComponent <AudioSource>();
            }
        }
Ejemplo n.º 28
0
        public static ProcessingStatus IdToProcessingStatus(int id)
        {
            ProcessingStatus output = id switch
            {
                1 => ProcessingStatus.Done,
                2 => ProcessingStatus.NotDone,
                3 => ProcessingStatus.InProgress,
                _ => throw new System.Exception("ProcessingStatus ist unbekannt"),
            };

            return(output);
        }
Ejemplo n.º 29
0
        /// <summary>
        /// Update an entity to a new status.
        /// </summary>
        /// <param name="entityId">Id of entity to update.</param>
        /// <param name="processingStatus">New status of entity.</param>
        public void UpdateEntity(Guid entityId, ProcessingStatus processingStatus)
        {
            var parms = new DynamicParameters();

            parms.Add("@id", entityId);
            parms.Add("@processingStatus", processingStatus.ToString());

            using (var conn = new SqlConnection(_connectionString))
            {
                conn.Execute("dbo.UpdateEntity", parms, commandType: CommandType.StoredProcedure);
            }
        }
Ejemplo n.º 30
0
        public static int ProcessingStatusToId(ProcessingStatus status)
        {
            int output = status switch
            {
                ProcessingStatus.Done => 1,
                ProcessingStatus.NotDone => 2,
                ProcessingStatus.InProgress => 3,
                _ => throw new System.Exception("ProcessingStatus ist unbekannt"),
            };

            return(output);
        }
        protected override void SetStatus(ProcessingStatus newStatus, string uniqueName)
        {
            if (uniqueName == null)
            {
                base.Status = newStatus;
                return;
            }
            Hashtable hashtable = Hashtable.Synchronized(m_reportStatus);

            Global.Tracer.Assert(hashtable.ContainsKey(uniqueName), "(reportStatus.ContainsKey(uniqueName))");
            hashtable[uniqueName] = newStatus;
        }
 private String GetHtmlStyle(ProcessingStatus status)
 {
     switch (status)
     {
         case ProcessingStatus.Successful:
             return "color:green";
         case ProcessingStatus.Warning:
             return "color:#E36C0A";
         case ProcessingStatus.Fail:
             return "color:red";
     }
     return String.Empty;
 }
        /// <summary>
        /// Update an entity to a new status.
        /// </summary>
        /// <param name="entityId">Id of entity to update.</param>
        /// <param name="processingStatus">New status of entity.</param>
        public void UpdateEntity(Guid entityId, ProcessingStatus processingStatus)
        {
            DataEntity entity;
            if (!_entities.TryGetValue(entityId, out entity))
            {
                throw new ArgumentException("Entity does not exist.", "entityId");
            }

            if (!_entities.TryUpdate(entityId, new DataEntity {Id = entityId, ProcessingStatus = processingStatus}, entity))
            {
                throw new EntityUpdateException("Error updating entity.");
            }
        }
 public static void SetProcessingStatus(this State<Pipeline> state, ProcessingStatus processingStatus)
 {
     state.Replace(StateKeys.ProcessingStatus, processingStatus);
 }
        /// <summary>
        /// Update an entity to a new status.
        /// </summary>
        /// <param name="entityId">Id of entity to update.</param>
        /// <param name="processingStatus">New status of entity.</param>
        public void UpdateEntity(Guid entityId, ProcessingStatus processingStatus)
        {
            var parms = new DynamicParameters();
            parms.Add("@id", entityId);
            parms.Add("@processingStatus", processingStatus.ToString());

            using (var conn = new SqlConnection(_connectionString))
            {
                conn.Execute("dbo.UpdateEntity", parms, commandType: CommandType.StoredProcedure);
            }
        }
Ejemplo n.º 36
0
 private static Brush StatusToBrush(ProcessingStatus status)
 {
     if (status == ProcessingStatus.Processed)
         return new SolidColorBrush(Colors.Green);
     else if (status == ProcessingStatus.Outdated)
         return new SolidColorBrush(Colors.Orange);
     else if (status == ProcessingStatus.Unprocessed)
         return new SolidColorBrush(Colors.Red);
     else
         return new SolidColorBrush(Colors.DarkGray);
 }
Ejemplo n.º 37
0
        public void UpdateMediaAsset(int assetId, string format, string tempLocation, string newLocationUrl, string thumbnailUrl, string posterUrl, ProcessingStatus status,DateTime? expirationDate)
        {
            ClientContext clientContext = new ClientContext(webFullUrl);
            List list = clientContext.Web.Lists.GetByTitle(mediaAssetsList);
            ListItem item = list.GetItemById(assetId);
            if (!String.IsNullOrEmpty(format))
            {
                item["MediaFormat"] = format;
            }
            item["MediaTempLocation"] = tempLocation;
            item["MediaLocation"] = newLocationUrl;
            item["MediaThumbnail"] = thumbnailUrl;
            item["MediaPoster"] = posterUrl;
            item["MediaProcStatus"] = Enum.GetName(typeof(ProcessingStatus), status);
            if (expirationDate.HasValue)
            {
                item["MediaExpirationDate"] = expirationDate.Value;
            }
            item.Update();

            clientContext.ExecuteQuery();
        }
Ejemplo n.º 38
0
        public virtual void LoadMeta()
        {
            if (!File.Exists(XMLPath))
                return;

            using (Stream SettingsStream = File.OpenRead(XMLPath))
            {
                XPathDocument Doc = new XPathDocument(SettingsStream);
                XPathNavigator Reader = Doc.CreateNavigator();
                Reader.MoveToRoot();
                Reader.MoveToFirstChild();

                {
                    string StatusString = Reader.GetAttribute("Status", "");
                    if (StatusString != null && StatusString.Length > 0)
                    {
                        switch (StatusString)
                        {
                            case "Processed":
                                _Status = ProcessingStatus.Processed;
                                break;
                            case "Outdated":
                                _Status = ProcessingStatus.Outdated;
                                break;
                            case "Unprocessed":
                                _Status = ProcessingStatus.Unprocessed;
                                break;
                            case "Skip":
                                _Status = ProcessingStatus.Skip;
                                break;
                        }
                    }
                }

                XPathNavigator NavPS1D = Reader.SelectSingleNode("//PS1D");
                if (NavPS1D != null)
                    PS1D = NavPS1D.InnerXml.Split(';').Select(v =>
                    {
                        string[] Pair = v.Split('|');
                        return new float2(float.Parse(Pair[0], CultureInfo.InvariantCulture), float.Parse(Pair[1], CultureInfo.InvariantCulture));
                    }).ToArray();

                XPathNavigator NavSimBackground = Reader.SelectSingleNode("//SimulatedBackground");
                if (NavSimBackground != null)
                    _SimulatedBackground = new Cubic1D(NavSimBackground.InnerXml.Split(';').Select(v =>
                    {
                        string[] Pair = v.Split('|');
                        return new float2(float.Parse(Pair[0], CultureInfo.InvariantCulture), float.Parse(Pair[1], CultureInfo.InvariantCulture));
                    }).ToArray());

                XPathNavigator NavSimScale = Reader.SelectSingleNode("//SimulatedScale");
                if (NavSimScale != null)
                    _SimulatedScale = new Cubic1D(NavSimScale.InnerXml.Split(';').Select(v =>
                    {
                        string[] Pair = v.Split('|');
                        return new float2(float.Parse(Pair[0], CultureInfo.InvariantCulture), float.Parse(Pair[1], CultureInfo.InvariantCulture));
                    }).ToArray());

                XPathNavigator NavCTF = Reader.SelectSingleNode("//CTF");
                if (NavCTF != null)
                    CTF.Load(NavCTF);

                XPathNavigator NavGridCTF = Reader.SelectSingleNode("//GridCTF");
                if (NavGridCTF != null)
                    GridCTF = CubicGrid.Load(NavGridCTF);

                XPathNavigator NavGridCTFPhase = Reader.SelectSingleNode("//GridCTFPhase");
                if (NavGridCTFPhase != null)
                    GridCTFPhase = CubicGrid.Load(NavGridCTFPhase);

                XPathNavigator NavMoveX = Reader.SelectSingleNode("//GridMovementX");
                if (NavMoveX != null)
                    GridMovementX = CubicGrid.Load(NavMoveX);

                XPathNavigator NavMoveY = Reader.SelectSingleNode("//GridMovementY");
                if (NavMoveY != null)
                    GridMovementY = CubicGrid.Load(NavMoveY);

                XPathNavigator NavLocalX = Reader.SelectSingleNode("//GridLocalMovementX");
                if (NavLocalX != null)
                    GridLocalX = CubicGrid.Load(NavLocalX);

                XPathNavigator NavLocalY = Reader.SelectSingleNode("//GridLocalMovementY");
                if (NavLocalY != null)
                    GridLocalY = CubicGrid.Load(NavLocalY);

                PyramidShiftX.Clear();
                foreach (XPathNavigator NavShiftX in Reader.Select("//PyramidShiftX"))
                    PyramidShiftX.Add(CubicGrid.Load(NavShiftX));

                PyramidShiftY.Clear();
                foreach (XPathNavigator NavShiftY in Reader.Select("//PyramidShiftY"))
                    PyramidShiftY.Add(CubicGrid.Load(NavShiftY));
            }
        }