/// <summary>
 /// Creates a InvalidFilterDefinitionException
 /// </summary>
 /// <param name="cause">Cause for the exception</param>
 /// <param name="filterName">Name of the filter</param>
 /// <param name="argument">Argument that caused the exception</param>
 public InvalidFilterDefinitionException(ErrorCause cause, String filterName = null, String argument = null)
     : base(createMessage(cause))
 {
     Cause = cause;
     FilterName = filterName;
     Argument = argument;
 }
Exemplo n.º 2
0
        /// <summary>
        /// Adds an error cause.
        /// </summary>
        /// <param name="errorCause">The error cause</param>
        public void AddErrorCause(ErrorCause errorCause)
        {
            if (this.ErrorCauses == null)
            {
                this.ErrorCauses = new List <ErrorCause>();
            }

            this.ErrorCauses.Add(errorCause);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Adds an error cause to the chunk.
        /// </summary>
        /// <param name="cause"></param>
        public void AddCause(ErrorCause cause)
        {
            if (this.Causes == null)
            {
                this.Causes = new List <ErrorCause>();
            }

            this.Causes.Add(cause);
        }
Exemplo n.º 4
0
 private static void ShouldDeserialize(ErrorCause error, bool nullReason = false)
 {
     error.Should().NotBeNull();
     error.Type.Should().NotBeNullOrEmpty();
     if (nullReason)
     {
         error.Reason.Should().BeNull();
     }
     else
     {
         error.Reason.Should().NotBeNullOrEmpty();
     }
 }
Exemplo n.º 5
0
        protected override object GetEditObject()
        {
//            this.ValidateInput();
            if (_facade == null)
            {
                _facade = new TSModelFacadeFactory(base.DataProvider).CreateTSModelFacade();
            }
            ErrorCause errorCause = this._facade.CreateNewErrorCause();

            errorCause.ErrorCauseCode        = FormatHelper.CleanString(FormatHelper.PKCapitalFormat(this.txtErrorCauseCodeEdit.Text), 40);
            errorCause.ErrorCauseDescription = FormatHelper.CleanString(this.txtErrorCauseDescriptionEdit.Text, 100);
            errorCause.MaintainUser          = this.GetUserCode();

            return(errorCause);
        }
Exemplo n.º 6
0
 private void AssertMetadata(string origin, ErrorCause errorMetadata)
 {
     errorMetadata.Should().NotBeNull(origin);
     errorMetadata.Grouped.Should().BeTrue(origin);
     errorMetadata.Phase.Should().Be("query", origin);
     errorMetadata.LicensedExpiredFeature.Should().Be("ml", origin);
     errorMetadata.Index.Should().Be("index", origin);
     errorMetadata.IndexUUID.Should().NotBeNullOrWhiteSpace(origin);
     errorMetadata.ResourceType.Should().NotBeNullOrWhiteSpace(origin);
     errorMetadata.ResourceId.Should().HaveCount(1, origin);
     errorMetadata.Shard.Should().Be(1, origin);
     errorMetadata.Line.Should().Be(12, origin);
     errorMetadata.Column.Should().Be(199, origin);
     errorMetadata.BytesWanted.Should().BeGreaterThan(1, origin);
     errorMetadata.BytesLimit.Should().BeGreaterThan(1, origin);
     errorMetadata.ScriptStack.Should().HaveCount(1, origin);
     errorMetadata.Script.Should().NotBeNullOrWhiteSpace(origin);
     errorMetadata.Language.Should().NotBeNullOrWhiteSpace(origin);
     AssertFailedShards(origin, errorMetadata.FailedShards);
 }
Exemplo n.º 7
0
 private static void AssertCausedBy(string origin, ErrorCause causedBy)
 {
     causedBy.Should().NotBeNull(origin);
     causedBy.Type.Should().NotBeNullOrWhiteSpace(origin);
     causedBy.Reason.Should().NotBeNullOrWhiteSpace(origin);
 }
Exemplo n.º 8
0
 public ErrorEntry(int errorId, string message, string description, string helpUrl, ErrorCause cause)
     : this(errorId, message, description, helpUrl, new ErrorCause[] { cause })
 {
 }
 /// <summary>
 /// Creates an exception message depending on the cause
 /// </summary>
 /// <param name="cause">Cause of the exception</param>
 /// <returns>An exception message</returns>
 private static string createMessage(ErrorCause cause)
 {
     switch (cause)
     {
         case ErrorCause.InvalidNumberOfDefinitionElements:
             return
                 "Filter definition must either be only a function name, or a " +
                 "function name and a list of arguments separated by a pipe (|) character.";
         case ErrorCause.FunctionNameOrArgumentMissing:
             return "Function or arguments are missing.";
         case ErrorCause.FunctionNameContainsWhitespace:
             return "Function name contains whitespace";
         case ErrorCause.ArgumentContainsWhitespace:
             return "An argument contains whitespace.";
         case ErrorCause.NamedArgumentInvalid:
             return "The argument is not a valid argument.";
         case ErrorCause.ArgumentNameNotFound:
             return "Requested argument is not defined in the template.";
         default:
             return "Filter definition is not in a valid format.";
     }
 }
Exemplo n.º 10
0
 public ErrorEntry( int errorId, string message, string description, string helpUrl, ErrorCause[] causes )
     : this(errorId, message, description, helpUrl)
 {
     this.Causes = causes;
 }
Exemplo n.º 11
0
 public ErrorEntry( int errorId, string message, string description, string helpUrl, ErrorCause cause )
     : this(errorId, message, description, helpUrl, new ErrorCause[] { cause })
 {
 }
Exemplo n.º 12
0
        private void ProceedKernelMessage(IntPtr wParam, IntPtr lParam)
        {
            CoreMsgEnum kParam = (CoreMsgEnum)wParam.ToInt64();

            switch (kParam)
            {
            case CoreMsgEnum.UpdaterPercentage:
            {
                int percentage = (int)lParam.ToInt64();
                //OnPrintingProgressChanged(percentage);
                string info            = "";
                string mPrintingFormat = ResString.GetUpdatingProgress();
                info += "\n" + string.Format(mPrintingFormat, percentage);
                this.m_StatusBarPanelPercent.Text = info;
                break;
            }

            case CoreMsgEnum.Percentage:
            {
                int percentage = (int)lParam.ToInt64();
                OnPrintingProgressChanged(percentage);

                break;
            }

            case CoreMsgEnum.Job_Begin:
            {
                int startType = (int)lParam.ToInt64();

                if (startType == 0)
                {
                }
                else if (startType == 1)
                {
                    //OnPrintingStart();
                }

                break;
            }

            case CoreMsgEnum.Job_End:
            {
                int endType = (int)lParam.ToInt64();

                if (endType == 0)
                {
                }
                else if (endType == 1)
                {
                    //OnPrintingEnd();
                }

                break;
            }

            case CoreMsgEnum.Power_On:
            {
                int bPowerOn = (int)lParam.ToInt64();
                if (bPowerOn != 0)
                {
                    int bPropertyChanged, bSettingChanged;
                    SPrinterProperty sPrinterProperty;
                    SPrinterSetting  sPrinterSetting;

                    m_allParam.PowerOnEvent(out bPropertyChanged, out bSettingChanged, out sPrinterProperty, out sPrinterSetting);
                    if (bPropertyChanged != 0)
                    {
                        OnPrinterPropertyChange(sPrinterProperty);
                    }
                    if (bSettingChanged != 0)
                    {
                        OnPrinterSettingChange(sPrinterSetting);
                    }
                }
                else
                {
                    m_allParam.PowerOffEvent();
                }
                break;
            }

            case CoreMsgEnum.Status_Change:
            {
                int status = (int)lParam.ToInt64();
                OnPrinterStatusChanged((JetStatusEnum)status);
                break;
            }

            case CoreMsgEnum.ErrorCode:
            {
                OnErrorCodeChanged((int)lParam.ToInt64());
                //For Updateing
                int        errorcode  = (int)lParam.ToInt64();
                SErrorCode serrorcode = new SErrorCode(errorcode);
                ErrorCause cause      = (ErrorCause)serrorcode.nErrorCause;
                if (cause == ErrorCause.CoreBoard && (ErrorAction)serrorcode.nErrorAction == ErrorAction.Updating)
                {
                    if (0 != serrorcode.n16ErrorCode)
                    {
                        if (serrorcode.n16ErrorCode == 1)
                        {
                            string info = ResString.GetEnumDisplayName(typeof(UISuccess), UISuccess.UpdateSuccess);
                            MessageBox.Show(info, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
                        }
                        else
                        {
                            string info = ResString.GetEnumDisplayName(typeof(UIError), UIError.UpdateFail);
                            MessageBox.Show(info, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
                        }
#if !LIYUUSB
                        CoreInterface.SendJetCommand((int)JetCmdEnum.ClearUpdatingStatus, 0);
#endif
                    }
                }

                break;
            }

            case CoreMsgEnum.Parameter_Change:
            {
                //m_LockUpdate = true;
                SPrinterSetting sPrinterSetting = m_allParam.PrinterSetting;
                if (CoreInterface.GetPrinterSetting(ref sPrinterSetting) == 0)
                {
                    Debug.Assert(false);
                }
                else
                {
                    OnPrinterSettingChange(sPrinterSetting);
                }
                //m_LockUpdate = false;
                break;
            }

            case CoreMsgEnum.Ep6Pipe:
            {
                int    ep6Cmd = (int)lParam.ToInt64() & 0x0000ffff;
                int    index  = (((int)lParam.ToInt64()) >> 16);
                byte[] bufep6 = null;
                int    buflen = 0;
                int    ret    = (CoreInterface.GetEp6PipeData(ep6Cmd, index, bufep6, ref buflen));
                if (ret != 0 && buflen > 0)
                {
                    bufep6 = new byte[buflen];
                    if (CoreInterface.GetEp6PipeData(ep6Cmd, index, bufep6, ref buflen) != 0)
                    {
                        switch (bufep6[0])
                        {
                        case 0xD4:
                            if (QRCodeForm != null)
                            {
                                QRCodeForm.SetQrCode(bufep6);
                            }
                            break;

                        case 0xD3:
                            if (QRCodeForm != null)
                            {
                                QRCodeForm.FeedBack(bufep6);
                            }
                            break;

                        case 0xE6:
                            if (QRCodeForm != null)
                            {
                                QRCodeForm.SetQrCodeFromHead(bufep6);
                            }
                            break;
                        }
                    }
                    else
                    {
                        MessageBox.Show(ResString.GetResString("GetEp6PipeDatafail"));
                    }
                }
                //else
                //{
                //    MessageBox.Show("GetEp6PipeData  buflen fail!");
                //}
            }
            break;
            }
        }
Exemplo n.º 13
0
        protected override void WndProc(ref System.Windows.Forms.Message msg)
        {
            const string LineEnd = "\r\n";

            // Dispose user message.
            if (msg.Msg == m_MessageUpdater)
            {
                int         nMsg    = (int)msg.WParam;
                CoreMsgEnum coremsg = (CoreMsgEnum)nMsg;
                switch (coremsg)
                {
                case CoreMsgEnum.Status_Change:
                {
                    int status = msg.LParam.ToInt32();

//						int portid = (int)msg.LParam;
//						BoardEnum board = (BoardEnum)portid;
//						m_TextBoxStatus.Text +=  ResString.GetEnumDisplayName(typeof(UpdateDisplay),UpdateDisplay.Status)+
//							ResString.GetEnumDisplayName(typeof(UpdateDisplay),UpdateDisplay.Begin) +
//							board.ToString();

                    m_TextBoxStatus.Text += status.ToString();
                    m_TextBoxStatus.Text += LineEnd;
                }
                break;

                case CoreMsgEnum.Percentage:
                {
                    int percent = (int)msg.LParam;
                    if (percent > 100)
                    {
                        percent = 100;
                    }
                    if (percent < 0)
                    {
                        percent = 0;
                    }
                    m_ProgressBarPercent.Value = (int)percent;
#if false
                    m_TextBoxStatus.Text += ResString.GetEnumDisplayName(typeof(UpdateDisplay), UpdateDisplay.Status) + percent.ToString() +
                                            ResString.GetEnumDisplayName(typeof(UpdateDisplay), UpdateDisplay.Percentage);
                    m_TextBoxStatus.Text += LineEnd;
#endif
                }
                break;

                case CoreMsgEnum.ErrorCode:
                {
                    int errorcode = (int)msg.LParam;
//						m_TextBoxStatus.Text += ResString.GetEnumDisplayName(typeof(UpdateDisplay),UpdateDisplay.Status) +
//							ResString.GetEnumDisplayName(typeof(UpdateDisplay),UpdateDisplay.Failed);
                    m_TextBoxStatus.Text += SErrorCode.GetInfoFromErrCode(errorcode);
                    m_TextBoxStatus.Text += "[" + errorcode.ToString("X") + "]";
                    m_TextBoxStatus.Text += LineEnd;

                    SErrorCode serrorcode = new SErrorCode(errorcode);
                    ErrorCause cause      = (ErrorCause)serrorcode.nErrorCause;
                    if (cause == ErrorCause.CoreBoard && (ErrorAction)serrorcode.nErrorAction == ErrorAction.Updating)
                    {
                        if (0 != serrorcode.n16ErrorCode)
                        {
                            CoreInterface.SendJetCommand((int)JetCmdEnum.ClearUpdatingStatus, 0);
                        }
                        if (serrorcode.n16ErrorCode == 1)
                        {
                            string info = ResString.GetEnumDisplayName(typeof(UISuccess), UISuccess.UpdateSuccess);
                            MessageBox.Show(info, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
                        }
                        else
                        {
                            string info = ResString.GetEnumDisplayName(typeof(UIError), UIError.UpdateFail);
                            MessageBox.Show(info, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
                        }
                    }
                }
                break;

                case CoreMsgEnum.Job_Begin:
                    m_TextBoxStatus.Text += ResString.GetEnumDisplayName(typeof(UpdateDisplay), UpdateDisplay.Status) +
                                            ResString.GetEnumDisplayName(typeof(UpdateDisplay), UpdateDisplay.Begin);
                    m_TextBoxStatus.Text += LineEnd;
                    break;

                case CoreMsgEnum.Job_End:
                    m_TextBoxStatus.Text += ResString.GetEnumDisplayName(typeof(UpdateDisplay), UpdateDisplay.Status) +
                                            ResString.GetEnumDisplayName(typeof(UpdateDisplay), UpdateDisplay.Success);
                    m_TextBoxStatus.Text += LineEnd;
                    break;
                }
                return;
            }

            base.WndProc(ref msg);
        }