Beispiel #1
0
        private static void ImportRGBAsRRGGBB(Queue <byte> rawBytes, Image img, byte fill)
        {
            if (rawBytes == null)
            {
                throw new ArgumentNullException(nameof(rawBytes));
            }
            if (img == null)
            {
                throw new ArgumentNullException(nameof(img));
            }

            ProcessingHelper.ProcessMono(img.Planes[0], (b) =>
            {
                return(rawBytes.Any() ? rawBytes.Dequeue() : fill);
            });

            ProcessingHelper.ProcessMono(img.Planes[1], (b) =>
            {
                return(rawBytes.Any() ? rawBytes.Dequeue() : fill);
            });

            ProcessingHelper.ProcessMono(img.Planes[2], (b) =>
            {
                return(rawBytes.Any() ? rawBytes.Dequeue() : fill);
            });
        }
Beispiel #2
0
        /// <summary>
        /// 站间审批数据传送
        /// </summary>
        /// <param name="action"></param>
        /// <param name="article"></param>
        /// <returns></returns>
        bool TransferSitesFlow(ProcessAction action, Article article)
        {
            bool          success    = true;
            Processing    p          = ProcessingHelper.GetArticleProcess(article);
            string        oldFlowXml = article.FlowXml;
            MoreEventArgs evenArgs   = new MoreEventArgs();

            evenArgs.FlowXml = oldFlowXml;
            switch (action)
            {
            case ProcessAction.Restart:
            case ProcessAction.Next:
            case ProcessAction.Previous:
                if (p.FromOtherSite)
                {
                    ShareEventFactory.Instance.OnFeedBackShareData(ObjectID, evenArgs);
                }
                break;

            case ProcessAction.SubmitSite:
                ShareEventFactory.Instance.OnSubmitSiteShareData(ObjectID, evenArgs);
                success = true;
                break;

            default:
                break;
            }
            return(success);
        }
Beispiel #3
0
    public void ProcessBuildAction_Wall(ActionContainer action)
    {
        myAction = action;

        int amountOfActionsSpend = ProcessingHelper.CalculateAmountOfActions(action.CharacterTokensSpend);

        HandlePotentialDiceRoll(amountOfActionsSpend);
    }
Beispiel #4
0
    public void ProcessExploreAction(ActionContainer action)
    {
        myAction = action;
        island   = action.ReferingObject as ExploreIsland;

        int amountOfActionsSpend = ProcessingHelper.CalculateAmountOfActions(action.CharacterTokensSpend);

        HandlePotentialDiceRoll(amountOfActionsSpend);
    }
Beispiel #5
0
        private void ProcessPlane(ImagePlane plane, int[] weights, ProcessingBounds bounds, int weightSum)
        {
            var outputPlane = ProcessingHelper.ProcessMonoKernel(plane, (kl) =>
            {
                return(ApplyWeights(kl, weights, weightSum));
            }, KernelSize, bounds, PixelFilter);

            outputPlane.CopyTo(plane.Parent.Planes[plane.Plane]);
        }
Beispiel #6
0
        private void ProcessPlane(ImagePlane plane, ProcessingBounds bounds)
        {
            var outputPlane = ProcessingHelper.ProcessMonoKernel(plane, (kl) =>
            {
                return(kl.Where(b => b.HasValue).Min(b => b.Value));
            }, KernelSize, bounds, PixelFilter);

            outputPlane.CopyTo(plane.Parent.Planes[plane.Plane]);
        }
    public void ProcessBuildAction(ActionContainer action)
    {
        myAction = action;
        item     = action.ReferingObject as ItemCard;

        int amountOfActionsSpend = ProcessingHelper.CalculateAmountOfActions(action.CharacterTokensSpend);

        HandlePotentialDiceRoll(amountOfActionsSpend);
    }
Beispiel #8
0
        private void ProcessPlane(ImagePlane plane, ProcessingBounds bounds)
        {
            var outputPlane = ProcessingHelper.ProcessMonoKernel(plane, (kl) =>
            {
                var stripped = kl.Where(b => b.HasValue);
                return((byte)(stripped.Sum(b => b.Value) / stripped.Count()));
            }, KernelSize, bounds, PixelFilter);

            outputPlane.CopyTo(plane.Parent.Planes[plane.Plane]);
        }
Beispiel #9
0
        /// <summary>
        /// 保存文章审核信息
        /// </summary>
        /// <param name="action"></param>
        /// <param name="article"></param>
        ProcessAction UpdateArticleProcessState(ProcessAction action, Article article)
        {
            ProcessAction myAction = action;
            string        remark   = DescriptionTextBox.Text;
            Processing    p        = ProcessingHelper.GetArticleProcess(article);

            p.Remark           = remark;
            p.ApproveName      = AccountHelper.GetAccount(AccountID, new string[] { "LastName" }).LastName;
            p.ApproveTitle     = ApproveTitle.Text;
            p.ProcessAccountID = AccountID;

            p.ProcessState = ProcessHelper.GetNextProcessState(myAction, (Article)article);
            if (p.ProcessState == ProcessStates.EndAudit)
            {
                if (p.ProcessEndAction == ProcessEnding.SubmitSite)
                {
                    p.ProcessState = ProcessStates.FirstAudit;
                    myAction       = ProcessAction.SubmitSite;
                    p.TargetSites  = TargetSites;
                    p.TargetSiteID = TargetSiteID;
                }
                else if (p.ProcessEndAction == ProcessEnding.Start)
                {
                    article.State = (int)ArticleStates.Started;
                }
                else
                {
                    article.State = (int)ArticleStates.Stopped;
                }
            }

            if (p.FromOtherSite)
            {
                if (p.ProcessState == ProcessStates.Unaudit)
                {
                    if (myAction == ProcessAction.Restart) //退回编辑
                    {
                        p.TargetSiteID = p.SourceSiteID;
                        p.TargetSites  = p.SourceSiteName;
                    }
                    else  //退回到上一站点的审核状态
                    {
                        ProcessHistory ph = ProcessHistoryHelper.GetLastArticleProcess(article);
                        p.CurLayerNO   = ph.FromProcessState;
                        p.TargetSiteID = ph.SiteID;
                        p.TargetSites  = ph.SiteName;
                    }
                }
            }

            p.ProcessDirection = ((int)myAction).ToString();
            ProcessingHelper.SaveFlowInfoToDB(article, p);

            return(myAction);
        }
Beispiel #10
0
        private void ProcessPlane(ImagePlane plane, ProcessingBounds bounds)
        {
            var outputPlane = ProcessingHelper.ProcessMonoKernel(plane, (kl) =>
            {
                var stripped = kl.Where(b => b.HasValue).ToArray();
                Array.Sort(stripped);
                return(UseHigherMedian ? stripped[stripped.Length / 2].Value : stripped[(stripped.Length / 2) - 1].Value);
            }, KernelSize, bounds, PixelFilter);

            outputPlane.CopyTo(plane.Parent.Planes[plane.Plane]);
        }
      public static void Main()
        {
            var helper = new ProcessingHelper();

            helper.DownloadFeed(TelerikAcademyRssYoutubeLink, VideosXmlPath);

            var xmlDocument = helper.GetXml(VideosXmlPath);
            var json = helper.ConvertXmlToJson(xmlDocument);
            var videoTitles = helper.GetVideosTitles(json);
            helper.PrintVideosTitles(videoTitles);

            var videos = helper.GetVideos(json);
            helper.CreateHtmlFromVideoCollection(videos);
        }
        protected override void ProcessRecordCode()
        {
            //Validate Input arguments
            ValidateInputArguments();

            IConnectionHelper connectionHelper = new ConnectionHelper(
                relativityInstanceName: RelativityInstanceName,
                relativityAdminUserName: RelativityAdminUserName,
                relativityAdminPassword: RelativityAdminPassword,
                sqlAdminUserName: SqlAdminUserName,
                sqlAdminPassword: SqlAdminPassword);
            IProcessingHelper processingHelper = new ProcessingHelper(connectionHelper);

            processingHelper.FullSetupAndUpdateDefaultResourcePoolAsync().Wait();
        }
Beispiel #13
0
        /// <summary>
        /// Imports the given <paramref name="rawBytes"/> as mono image.
        /// </summary>
        /// <param name="rawBytes">The raw bytes to use for the image.</param>
        /// <param name="imageSize">Size of the resulting image.</param>
        /// <param name="fill">Pixel value used as a fill when no raw bytes are left.</param>
        /// <returns>Imported mono image.</returns>
        public static Image ImportAsMono(IEnumerable <byte> rawBytes, Size2D imageSize, byte fill)
        {
            if (rawBytes == null)
            {
                throw new ArgumentNullException(nameof(rawBytes));
            }

            var queue = new Queue <byte>(rawBytes);
            var img   = new Image(imageSize);

            ProcessingHelper.ProcessMono(img.Planes[0], (b) =>
            {
                return(queue.Any() ? queue.Dequeue() : fill);
            });

            return(img);
        }
Beispiel #14
0
        void InitControls()
        {
            SignPanelDiv.Visible = false;
            string curLayerNOText = "";

            if (!IsAdivice)
            {
                curLayerNOText = ProcessHelper.GetCurLayerNOText(ObjectID);
            }
            else
            {
                curLayerNOText = ProcessHelper.GetCurLayerNOAdviceText(ObjectID);
            }

            if (curLayerNOText != "") //文章当前审批进程:类似 Channel.FirstAudit
            {
                string channelID = "";
                if (!IsAdivice)
                {
                    channelID = ArticleHelper.GetArticle(ObjectID).OwnerID;
                }
                else
                {
                    channelID = AdviceHelper.GetAdvice(ObjectID).TypeID;
                }

                List <string> contents = AccountHelper.GetPermissionContents(AccountID, channelID);
                if (contents.Contains(curLayerNOText))
                {
                    ApproveDate.Text = DateTime.Now.ToString("yyyy年MM月dd日");
                    ApproveName.Text = AccountHelper.GetAccount(AccountID, new string[] { "LastName" }).LastName;
                    if (!IsAdivice)
                    {
                        Article article = ArticleHelper.GetArticle(ObjectID);
                        SummaryLabel.Text = "审核路径:" + ProcessingHelper.CreateArticleFlowPathHtml(article, TargetSites);
                    }
                    else
                    {
                        Advice advice = AdviceHelper.GetAdvice(ObjectID);
                        SummaryLabel.Text = "审核路径:" + ProcessingHelper.CreateAdviceFlowPathHtml(advice, TargetSites);
                    }
                    SignPanelDiv.Visible = true;
                }
            }
        }
Beispiel #15
0
        private static void ImportRGBAsRGBRGB(Queue <byte> rawBytes, Image img, byte fill)
        {
            if (rawBytes == null)
            {
                throw new ArgumentNullException(nameof(rawBytes));
            }
            if (img == null)
            {
                throw new ArgumentNullException(nameof(img));
            }

            ProcessingHelper.ProcessRGB(img, (i) =>
            {
                byte r = rawBytes.Any() ? rawBytes.Dequeue() : fill;
                byte g = rawBytes.Any() ? rawBytes.Dequeue() : fill;
                byte b = rawBytes.Any() ? rawBytes.Dequeue() : fill;
                return(new RGBPixel(r, g, b));
            });
        }
Beispiel #16
0
        /// <summary>
        /// 保存反馈审批信息
        /// </summary>
        /// <param name="action"></param>
        /// <param name="advice"></param>
        /// <returns></returns>
        ProcessAction UpdateAdviceProcessState(ProcessAction action, Advice advice)
        {
            ProcessAction myAction = action;
            string        remark   = DescriptionTextBox.Text;
            Processing    p        = ProcessingHelper.GetAdviceProcess(advice);

            p.Remark           = remark;
            p.ApproveName      = AccountHelper.GetAccount(AccountID, new string[] { "LastName" }).LastName;
            p.ApproveTitle     = ApproveTitle.Text;
            p.ProcessAccountID = AccountID;

            p.ProcessState = ProcessHelper.GetAdviceNextProcess(myAction, advice);
            if (p.ProcessState == ProcessStates.EndAudit)
            {
                advice.State = (int)AdviceState.Finished;
            }

            p.ProcessDirection = ((int)myAction).ToString();
            ProcessingHelper.SaveAdviceFlowInfoToDB(advice, p);

            return(myAction);
        }