Beispiel #1
0
        public override void Execute()
        {
            try
            {
                //var contextHandler = RealmPacketMgr.Instance.CheckConstraints(Parameter1, Parameter2);
                //if (contextHandler != null && contextHandler.IsInContext)

                // Character-messages are always executed in the right context
                base.Execute();
            }
            catch (System.IO.EndOfStreamException e) { LogUtil.ErrorException(e, "End of stream on {0}. Length {1}. Position {2}", Parameter2, Parameter2.Length, Parameter2.Position);
                                                       Parameter2.Position = 0;
                                                       var packetStr = Utility.GetStringRepresentation(Parameter2.ReadBytes(Parameter2.Length));
                                                       LogUtil.ErrorException(e, "Data {0}", packetStr); }
            catch (System.Net.Sockets.SocketException)
            {
                Parameter1.Disconnect();
            }
            catch (Exception e)
            {
                LogUtil.ErrorException(e, "Client {0} triggered an Exception.", Parameter1);

/*
 *                              if (Parameter1.ActiveCharacter != null)
 *                              {
 *                                      Parameter1.ActiveCharacter.SaveLater();
 *                              }
 *
 *                              Parameter1.Disconnect();*/
            }
            finally
            {
                ((IDisposable)Parameter2).Dispose();
            }
        }
Beispiel #2
0
 public override void Execute()
 {
     try
     {
         base.Execute();
     }
     catch (EndOfStreamException ex)
     {
         LogUtil.ErrorException(ex, "End of stream on {0}. Length {1}. Position {2}",
                                (object)Parameter2, (object)Parameter2.Length, (object)Parameter2.Position);
         Parameter2.Position = 0;
         string stringRepresentation =
             Utility.GetStringRepresentation(Parameter2.ReadBytes(Parameter2.Length));
         LogUtil.ErrorException(ex, "Data {0}", (object)stringRepresentation);
     }
     catch (SocketException ex)
     {
         Parameter1.Disconnect(false);
     }
     catch (Exception ex)
     {
         LogUtil.ErrorException(ex, "Client {0} triggered an Exception.", (object)Parameter1);
     }
     finally
     {
         Parameter2.Dispose();
     }
 }
Beispiel #3
0
        public override void Execute()
        {
            try
            {
                //var contextHandler = RealmPacketMgr.Instance.CheckConstraints(Parameter1, Parameter2);
                //if (contextHandler != null && contextHandler.IsInContext)

                // Character-messages are always executed in the right context
                base.Execute();
            }
            catch (Exception e)
            {
                LogUtil.ErrorException(e, "Client {0} triggered an Exception.", Parameter1);

                if (Parameter1.ActiveCharacter != null)
                {
                    Parameter1.ActiveCharacter.SaveLater();
                }

                Parameter1.Disconnect();
            }
            finally
            {
                ((IDisposable)Parameter2).Dispose();
            }
        }
 public MainWindow()
 {
     InitializeComponent();
     Graph1.Init(App.Controller1, 3, 2000);
     Graph2.Init(App.Controller2, 3, 2000);
     Parameter1.Init(App.Controller1);
     Parameter2.Init(App.Controller2);
 }
 public ScopedBlah(
     Parameter1 parameter1,
     Parameter2 parameter2,
     Parameter3 parameter3)
 {
     Parameter1 = parameter1;
     Parameter2 = parameter2;
     Parameter3 = parameter3;
 }
Beispiel #6
0
 ///--------------------------------------------------------------------------------
 /// <summary>Interpret this node to produce code, output, or model data..</summary>
 ///
 /// <param name="interpreterType">The type of interpretation to perform.</param>
 /// <param name="solutionContext">The associated solution.</param>
 /// <param name="templateContext">The associated template.</param>
 /// <param name="modelContext">The associated model context.</param>
 ///--------------------------------------------------------------------------------
 public void InterpretNode(InterpreterTypeCode interpreterType, Solution solutionContext, ITemplate templateContext, IDomainEnterpriseObject modelContext)
 {
     try
     {
         solutionContext.PutStringLoggedValue(Parameter1.GetStringValue(solutionContext, templateContext, modelContext, interpreterType), Parameter2.GetStringValue(solutionContext, templateContext, modelContext, interpreterType), Parameter3.GetStringValue(solutionContext, templateContext, modelContext, interpreterType));
     }
     catch (ApplicationAbortException)
     {
         throw;
     }
     catch (System.Exception ex)
     {
         LogException(solutionContext, templateContext, modelContext, ex, interpreterType);
     }
 }
Beispiel #7
0
        private void button1_Click(object sender, RoutedEventArgs e)
        {
            string VIN = Parameter1.GetLineText(0);

            ResponseBlock1.Visibility = Visibility.Visible;

            StatsCalc SC = new StatsCalc(cn);

            try
            {
                ResponseBlock1.ItemsSource = SC.VehicleParts(VIN).DefaultView;
            }
            catch (OleDbException ex)
            {
                ErrorWindow Error = new ErrorWindow(ex.Message);
                Error.ShowDialog();
            }
        }
Beispiel #8
0
        public virtual bool LosOp(Klimatogram klimatogram)
        {
            if (Parameter1 == null)
            {
                throw new ArgumentException("Parameter1 is null.");
            }
            if (Parameter2 == null)
            {
                throw new ArgumentException("Parameter2 is null.");
            }
            if (Vergelijking == null)
            {
                throw new ArgumentException("Vergelijk is null.");
            }
            if (klimatogram == null)
            {
                throw new ArgumentException("Klimatogram is null.");
            }
            double param1 = Parameter1.GeefParameterWaarde(klimatogram);
            double param2 = Parameter2.GeefParameterWaarde(klimatogram);

            return(Vergelijking.Vergelijk(param1, param2));
        }
Beispiel #9
0
 public ScopedBlah(Parameter1 parameter1, Parameter2 parameter2)
 {
     Parameter1 = parameter1;
     Parameter2 = parameter2;
 }
Beispiel #10
0
 public override int GetHashCode()
 {
     return((Parameter1 != null ? Parameter1.GetHashCode() : 0) + 29 * (Parameter2 != null ? Parameter2.GetHashCode() : 0));
 }
Beispiel #11
0
        ///--------------------------------------------------------------------------------
        /// <summary>Get the string value for this parameter.</summary>
        ///
        /// <param name="solutionContext">The associated solution.</param>
        /// <param name="templateContext">The associated template.</param>
        /// <param name="modelContext">The associated model context.</param>
        /// <param name="interpreterType">The type of interpretation to perform.</param>
        ///--------------------------------------------------------------------------------
        public object GetObjectValue(Solution solutionContext, ITemplate templateContext, IDomainEnterpriseObject modelContext, InterpreterTypeCode interpreterType)
        {
            if (ModelProperty != null)
            {
                return(ModelProperty.GetPropertyObjectValue(solutionContext, templateContext, modelContext, modelContext, interpreterType));
            }
            else if (Literal != null)
            {
                return(Literal.GetObjectValue(solutionContext, templateContext, modelContext));
            }
            else if (Parameter1 != null && Parameter2 != null)
            {
                string parameter1Value = Parameter1.GetStringValue(solutionContext, templateContext, modelContext, interpreterType);
                string parameter2Value = Parameter2.GetStringValue(solutionContext, templateContext, modelContext, interpreterType);
                long   parameter1Long;
                long   parameter2Long;
                double parameter1Double;
                double parameter2Double;
                switch (MathOperator.Operator)
                {
                case "+":
                    if (long.TryParse(parameter1Value, out parameter1Long) == true && long.TryParse(parameter2Value, out parameter2Long) == true)
                    {
                        return(parameter1Long + parameter2Long);
                    }
                    else if (double.TryParse(parameter1Value, out parameter1Double) == true && double.TryParse(parameter2Value, out parameter2Double) == true)
                    {
                        return(parameter1Double + parameter2Double);
                    }
                    else
                    {
                        return(parameter1Value + parameter2Value);
                    }

                case "-":
                    if (long.TryParse(parameter1Value, out parameter1Long) == true && long.TryParse(parameter2Value, out parameter2Long) == true)
                    {
                        return(parameter1Long - parameter2Long);
                    }
                    else if (double.TryParse(parameter1Value, out parameter1Double) == true && double.TryParse(parameter2Value, out parameter2Double) == true)
                    {
                        return(parameter1Double - parameter2Double);
                    }
                    else
                    {
                        return(parameter1Value.Replace(parameter2Value, ""));
                    }

                case "*":
                    if (long.TryParse(parameter1Value, out parameter1Long) == true && long.TryParse(parameter2Value, out parameter2Long) == true)
                    {
                        return(parameter1Long * parameter2Long);
                    }
                    else if (double.TryParse(parameter1Value, out parameter1Double) == true && double.TryParse(parameter2Value, out parameter2Double) == true)
                    {
                        return(parameter1Double * parameter2Double);
                    }
                    break;

                case "/":
                    if (long.TryParse(parameter1Value, out parameter1Long) == true && long.TryParse(parameter2Value, out parameter2Long) == true && parameter2Long != 0)
                    {
                        return(parameter1Long / parameter2Long);
                    }
                    else if (double.TryParse(parameter1Value, out parameter1Double) == true && double.TryParse(parameter2Value, out parameter2Double) == true && parameter2Double != 0.00)
                    {
                        return(parameter1Double / parameter2Double);
                    }
                    break;

                default:
                    break;
                }
            }
            return(null);
        }
 ///--------------------------------------------------------------------------------
 /// <summary>Interpret this node to produce code, output, or model data..</summary>
 ///
 /// <param name="interpreterType">The type of interpretation to perform.</param>
 /// <param name="solutionContext">The associated solution.</param>
 /// <param name="templateContext">The associated template.</param>
 /// <param name="modelContext">The associated model context.</param>
 ///--------------------------------------------------------------------------------
 public void InterpretNode(InterpreterTypeCode interpreterType, Solution solutionContext, ITemplate templateContext, IDomainEnterpriseObject modelContext)
 {
     try
     {
         string path = Parameter1.GetStringValue(solutionContext, templateContext, modelContext, interpreterType);
         if (!String.IsNullOrEmpty(path))
         {
             if (solutionContext.IsSampleMode == true)
             {
                 // don't perform removal of output file data, just indicate it would be output
                 templateContext.MessageBuilder.Append("\r\n- ");
                 templateContext.MessageBuilder.Append(path);
                 templateContext.MessageBuilder.Append(": \"");
                 templateContext.MessageBuilder.Append(Parameter2.GetStringValue(solutionContext, templateContext, modelContext, interpreterType));
                 if (Parameter4 != null)
                 {
                     templateContext.MessageBuilder.Append("\", \"");
                     templateContext.MessageBuilder.Append(Parameter3.GetStringValue(solutionContext, templateContext, modelContext, interpreterType));
                     templateContext.MessageBuilder.Append("\", \"");
                     templateContext.MessageBuilder.Append(Parameter4.GetStringValue(solutionContext, templateContext, modelContext, interpreterType));
                 }
                 templateContext.MessageBuilder.Append("\"");
             }
             else if (solutionContext.LoggedErrors.Count == 0)
             {
                 if (File.Exists(path) == true)
                 {
                     string text = FileHelper.GetText(path);
                     if (Parameter4 != null)
                     {
                         // remove text bounded by begin and end tags
                         string beginTag     = Parameter2.GetStringValue(solutionContext, templateContext, modelContext, interpreterType);
                         string endTag       = Parameter3.GetStringValue(solutionContext, templateContext, modelContext, interpreterType);
                         string matchingText = Parameter4.GetStringValue(solutionContext, templateContext, modelContext, interpreterType);
                         int    beginIndex   = text.IndexOf(beginTag);
                         while (beginIndex >= 0)
                         {
                             int endIndex = text.IndexOf(endTag, beginIndex);
                             if (endIndex < 0)
                             {
                                 break;
                             }
                             int matchingIndex = text.IndexOf(matchingText, beginIndex);
                             if (matchingIndex >= 0 && matchingIndex < endIndex && matchingIndex + matchingText.Length <= endIndex)
                             {
                                 if (endIndex + endTag.Length >= text.Length)
                                 {
                                     text = text.Substring(0, beginIndex);
                                 }
                                 else
                                 {
                                     text = text.Substring(0, beginIndex) + text.Substring(endIndex + endTag.Length);
                                 }
                                 FileHelper.ReplaceFile(path, text);
                                 break;
                             }
                             beginIndex += beginTag.Length;
                             beginIndex  = text.IndexOf(beginTag, beginIndex);
                         }
                     }
                     else
                     {
                         // remove text matching input match text
                         string matchingText = Parameter2.GetStringValue(solutionContext, templateContext, modelContext, interpreterType);
                         int    index        = text.IndexOf(matchingText);
                         if (index >= 0)
                         {
                             if (index + matchingText.Length >= text.Length)
                             {
                                 text = text.Substring(0, index);
                             }
                             else
                             {
                                 text = text.Substring(0, index) + text.Substring(index + matchingText.Length);
                             }
                             FileHelper.ReplaceFile(path, text);
                         }
                     }
                 }
             }
         }
     }
     catch (ApplicationAbortException)
     {
         throw;
     }
     catch (System.Exception ex)
     {
         LogException(solutionContext, templateContext, modelContext, ex, interpreterType);
     }
 }
 public ScopedBlah(Parameter1 parameter1, Parameter2 parameter2)
 {
 }
    void getvalue()
    {
        Parameter1 pb = new Parameter1();

        pb.test();
    }
Beispiel #15
0
 public InstancePerDependency(Parameter1 parameter1, Parameter2 parameter2)
 {
 }
Beispiel #16
0
        private void button1_Click(object sender, RoutedEventArgs e)
        {
            string Para1 = Parameter1.GetLineText(0);
            string Para2 = Parameter2.GetLineText(0);
            string Para3 = Parameter3.GetLineText(0);

            if (type.CompareTo("Person") == 0)
            {
                if (PersonID)
                {
                    ResponseBlock.Visibility = Visibility.Visible;

                    SearchFunction SF = new SearchFunction(cn);

                    try
                    {
                        ResponseBlock.ItemsSource = SF.SearchPersonID(Para3).DefaultView;
                    }
                    catch (OleDbException ex)
                    {
                        ErrorWindow Error = new ErrorWindow(ex.Message);
                        Error.ShowDialog();
                    }
                }
                if (PersonName)
                {
                    ResponseBlock.Visibility = Visibility.Visible;

                    SearchFunction SF = new SearchFunction(cn);

                    try
                    {
                        ResponseBlock.ItemsSource = SF.SearchPersonName(Para3).DefaultView;
                    }
                    catch (OleDbException ex)
                    {
                        ErrorWindow Error = new ErrorWindow(ex.Message);
                        Error.ShowDialog();
                    }
                }
            }
            else if (type.CompareTo("Vehicle") == 0)
            {
                ResponseBlock.Visibility  = Visibility.Visible;
                ResponseBlock2.Visibility = Visibility.Visible;

                SearchFunction SF = new SearchFunction(cn);

                try
                {
                    ResponseBlock.ItemsSource  = SF.SearchVehicle(Para3).DefaultView;
                    ResponseBlock2.ItemsSource = SF.SearchVHR(Para3).DefaultView;
                }
                catch (OleDbException ex)
                {
                    ErrorWindow Error = new ErrorWindow(ex.Message);
                    Error.ShowDialog();
                }
            }
            else if (type.CompareTo("Part") == 0)
            {
                ResponseBlock.Visibility = Visibility.Visible;

                SearchFunction SF = new SearchFunction(cn);

                try
                {
                    ResponseBlock.ItemsSource = SF.SearchPart(Para3).DefaultView;
                }
                catch (OleDbException ex)
                {
                    ErrorWindow Error = new ErrorWindow(ex.Message);
                    Error.ShowDialog();
                }
            }
            else
            {
                ResponseBlock.Visibility = Visibility.Visible;

                SearchFunction SF = new SearchFunction(cn);

                try
                {
                    ResponseBlock.ItemsSource = SF.SearchSale(Para1, Para2, Para3).DefaultView;
                }
                catch (OleDbException ex)
                {
                    ErrorWindow Error = new ErrorWindow(ex.Message);
                    Error.ShowDialog();
                }
            }
        }