Example #1
0
 /// <summary>
 /// This adds a LinkedList of objects
 /// </summary>
 /// <param name="actorList">The list of objects</param>
 public void Add(Util.LinkedList actorList)
 {
     foreach(DXMAN.Base.xRenderable obj in xObjects)
     {
         Add(obj);
     }
 }
		/// <summary>
		/// This method determines whether the outcome is valid for the preceding sequence.  
		/// This can be used to implement constraints on what sequences are valid.  
		/// </summary>
		/// <param name="outcome">
		/// The outcome.
		/// </param>
		/// <param name="sequence">
		/// The preceding sequence of outcome assignments. 
		/// </param>
		/// <returns>
		/// true if the outcome is valid for the sequence, false otherwise.
		/// </returns>
		protected internal override bool ValidOutcome(string outcome, Util.Sequence sequence)
		{
			if (outcome.StartsWith("I-"))
			{
				string[] tags = sequence.Outcomes.ToArray();
				int lastTagIndex = tags.Length - 1;
				if (lastTagIndex == - 1)
				{
					return (false);
				}
				else
				{
					string lastTag = tags[lastTagIndex];
					if (lastTag == "O")
					{
						return false;
					}
					if (lastTag.Substring(2) != outcome.Substring(2))
					{
						return false;
					}
				}
			}
			return true;
		}
 public FileSystemRepository(ILogger logger, ISettings settings, IEncryption encryption, Util.Util util)
 {
     _logger = logger;
     _settings = settings;
     _encryption = encryption;
     _util = util;
 }
Example #4
0
			public DHSha(HashAlgorithm algorithm, Util.Func<Protocol, string> getName) {
				if (algorithm == null) throw new ArgumentNullException("algorithm");
				if (getName == null) throw new ArgumentNullException("getName");

				GetName = getName;
				Algorithm = algorithm;
			}
Example #5
0
        public System.Windows.Controls.Image getGraph(Util.TimeType duration)
        {
            if (currentSearch == null)
                return null;
            try
            {
                string query = currentSearch + CHART_TIME;
                query += timeFilter[duration];

                Uri url = new Uri(CHART_BASE + query);
                //Debugging
                //Console.Write(CHART_BASE + query);
                HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);

                //See the response that yahoo creates
                WebResponse response = request.GetResponse();

                Stream sr = response.GetResponseStream();
                System.Drawing.Image chart = System.Drawing.Image.FromStream(sr);

                //Debugging
                //chart.Save("h:\\chartTest" + query + ".bmp");

                sr.Close();
                return convertDrawingImgToWindowImg(chart);

            }
            catch (Exception)
            {
                MessageBox.Show("Error downloading the graph.");
                return null;
            }
        }
        public List<INVITATION> Search(INVITATION Entity, int PageSize, int PageIndex, out int TotalRecords, string OrderExp, Util.SortDirection SortDirection)
        {
            var result = Context.INVITATION.AsQueryable();
            if (Entity != null)
            {
                if (Entity.ID != 0)
                {
                    result = result.Where(b => b.ID == Entity.ID);
                }

                if (Entity.CustomerID.HasValue)
                {
                    result = result.Where(i => i.CustomerID == Entity.CustomerID);
                }

                if (!String.IsNullOrEmpty(Entity.InvitedMail))
                {
                    result = result.Where(i => i.InvitedMail.Contains(Entity.InvitedMail));
                }

                if (Entity.RegistrationDate != null)
                {
                    result = result.Where(i => i.RegistrationDate == (Entity.RegistrationDate));
                }
            }
            TotalRecords = result.Count();

            GenericSorterCaller<INVITATION> sorter = new GenericSorterCaller<INVITATION>();
            result = sorter.Sort(result, string.IsNullOrEmpty(OrderExp) ? DEFAULT_ORDER_EXP : OrderExp, SortDirection);

            // pagination
            return result.Skip(PageIndex * PageSize).Take(PageSize).ToList();
        }
Example #7
0
        public int SyncServerMessage(Util.DBHelper db)
        {
            var shutdownDoc = db.GetDocument("Server", "Shutdown");
            if (shutdownDoc == null)
            {
                shutdownDoc = db.CreateDocument("Server", "Shutdown",
                    new BsonDocument()
                    {
                        { "Flag", false },
                        { "Message", "" }
                    });
            }
            else
            {
                var flag = shutdownDoc["Flag"].AsBoolean;
                var msg = shutdownDoc["Message"].AsString;

                this.ShutdownFlag = flag;
                this.ShutdownMessage = msg;


                // 메세지가 있고 이전 메세지와 다르면 이벤트 발생
                if (msg.Length > 0 && m_prevShutMsg != msg && this.WhenShutdownMessageChanged != null)
                    this.WhenShutdownMessageChanged(msg, flag);


                m_prevShutMsg = msg;
            }


            return 0;
        }
Example #8
0
 public World(Dictionary<String, Block> bl, String n)
 {
     this.name = n;
        this.blocks = bl;
        this.util = new Util();
        this.xLength = (int)(Game1.graphics.GraphicsDevice.Viewport.Bounds.Width / 32);
        this.yLength = (int)(Game1.graphics.GraphicsDevice.Viewport.Bounds.Height / 32);
 }
Example #9
0
        public MapDataHeight(Util.Map.Location map)
        {
            this.map = map;
            this.file = WorldConfig.FILE_HEIGHT;

            byte[] bytes = Load();
            if (bytes!=null) Parse(bytes);
        }
Example #10
0
 public Button(string text, Util.Rect rect, Font font, VisualRectangle vsSelected, VisualRectangle vsUnselected)
 {
     this.font = font;
     this.vsSelected = vsSelected;
     this.vsUnselected = vsUnselected;
     this.rect = rect;
     this.text = text;
 }
Example #11
0
 public Button(string text, Util.Rect rect)
 {
     this.font = GUIManager.mainFont;
     this.vsSelected = GUIManager.buttonRectSelected;
     this.vsUnselected = GUIManager.buttonRectUnselected;
     this.rect = rect;
     this.text = text;
 }
 private void UserControl_Loaded(object sender, RoutedEventArgs e)
 {
     util = new Util();
     DatabaseConnection dbc = new DatabaseConnection();
     c = dbc.getConnection();
     cmd = c.CreateCommand();
     updatePane();
 }
Example #13
0
 public Mention(Util.Span span, Util.Span headSpan, int entityId, IParse parse, string extentType)
 {
     mSpan = span;
     mHeadSpan = headSpan;
     mId = entityId;
     mType = extentType;
     mParse = parse;
 }
Example #14
0
 public MapTypeInfo(Type type, Util.AttributeExtCollection attributes, bool isFwdDeclPossible) {
     if ((type == null) || (attributes == null)) {
         throw new ArgumentException("type and attributes must be != null");
     }
     m_type = type;
     m_attributes = attributes;            
     m_isFwdDeclPossible = isFwdDeclPossible;
 }
Example #15
0
 public override void Process(Util.Commands.CmdTrigger<ToolCmdArgs> trigger)
 {
     using (var wowFile = new WoWFile(trigger.Text.NextWord()))
     {
         GameObjectTypeExtractor.Extract(wowFile);
     }
     //base.Process(trigger);
 }
Example #16
0
 protected override Effect GetEffect(Util.FastBitmap source)
 {
     return new ColorTintEffect
     {
         Amount = Amount/100.0,
         RequiredColor = Color
     };
 }
Example #17
0
        public MapDataObjects(Util.Map.Location map)
        {
            this.map = map;
            this.file = WorldConfig.FILE_OBJECT;

            byte[] bytes = Load();
            if (bytes!=null) Parse(bytes);
        }
Example #18
0
 public static string incomeLevel2Str(Util.Resource resource, IncomeLevel level)
 {
     switch (level)
     {
         case IncomeLevel.GOOD: return resource.getMsg("good");
         case IncomeLevel.BAD: return resource.getMsg("bad");
         default: return resource.getMsg("good");
     }
 }
        /// <summary>
        ///	Create Gtk.Table visualising 2D table data.
        /// </summary>
        public TableWidget2D(Util.Coloring coloring, float[] axisX, float[] valuesY, float axisXmin, float axisXmax, float valuesYmin, float valuesYmax)
            : base(coloring, axisX, valuesY, axisXmin, axisXmax, valuesYmin, valuesYmax)
        {
            if (axisX.Length != valuesY.Length)
                throw new ArgumentException ("axisX.Length != valuesY.Length");

            this.cols = DataColLeft + 2 + 1;
            this.rows = this.countX + DataRowTop;
        }
Example #20
0
        public int SyncAllRect(Util.DBHelper db, Point startIdx, Point endIdx)
        {
            SyncMapSize(db);
            SyncTileRect(db, startIdx, endIdx);
            SyncServerMessage(db);


            return 0;
        }
Example #21
0
 /**
  * Board GUI Rechtecke beziehen nach Figurpunkten
  */
 public List<Rectangle> getBoardRectangles(Util.Point[] points)
 {
     List<Rectangle> rectangles = new List<Rectangle>();
     foreach (Util.Point point in points)
     {
         rectangles.Add(getRectangleAt(point.X, point.Y));
     }
     return rectangles;
 }
Example #22
0
        //##################################################################################

        public int SyncAll(Util.DBHelper db)
        {
            SyncMapSize(db);
            SyncTile(db);
            SyncServerMessage(db);


            return 0;
        }
Example #23
0
 public List<Objects.Meta> Get(Util.GridOptions options, string like)
 {
     List<Objects.Meta> lst = new List<Objects.Meta>();
     foreach (var m in context.Metas.Where(x => x.MetaNameEn.Contains(like) || x.MetaNameEs.Contains(like))
         .OrderBy(options.OrderBy, options.OrderDescending)
         .Skip(options.Skip)
         .Take(options.RowsPerPage))
         lst.Add(new Objects.Meta(m));
     return lst;
 }
Example #24
0
 public static string familyLevel2Str(Util.Resource resource, FamilyLevel level)
 {
     switch (level)
     {
         case FamilyLevel.LOW: return resource.getMsg("family_level_low");
         case FamilyLevel.MEDIUM: return resource.getMsg("family_level_medium");
         case FamilyLevel.HIGH: return resource.getMsg("family_level_high");
         default: return resource.getMsg("family_level_medium");
     }
 }
Example #25
0
 // constructors -----------------------
 public Parse(string parseText, Util.Span span, string type, double probability)
 {
     Text = parseText;
     Span = span;
     Type = type;
     Probability = probability;
     Head = this;
     _parts = new List<Parse>();
     Label = null;
     Parent = null;
 }
Example #26
0
        public static string customerLevel2Str(Util.Resource resource, CustomerLevel level)
        {
            switch (level)
            {
                case CustomerLevel.LOW: return resource.getMsg("customer_level_low");
                case CustomerLevel.MEDIUM: return resource.getMsg("customer_level_medium");
                case CustomerLevel.HIGH: return resource.getMsg("customer_level_high");
                default: return resource.getMsg("customer_level_medium");

            }
        }
Example #27
0
        public static string customerType2Str(Util.Resource resource, CustomerType type)
        {
            switch (type)
            {
                case CustomerType.AGENT: return resource.getMsg("customer_type_agent");
                case CustomerType.PERSONAL: return resource.getMsg("customer_type_personal");
                case CustomerType.OTHER: return resource.getMsg("customer_type_other");
                default: return resource.getMsg("customer_type_personal");

            }
        }
 // could also use LINQ to calc min/max since performance does not matter here
 public TableWidgetBase(Util.Coloring coloring, float[] axisX, float[] values, float axisXmin, float axisXmax, float valuesMin, float valuesMax)
 {
     this.coloring = coloring;
     this.axisX = axisX;
     this.axisXmin = axisXmin;
     this.axisXmax = axisXmax;
     this.values = values;
     this.valuesMin = valuesMin;
     this.valuesMax = valuesMax;
     this.countX = this.axisX.Length;
 }
Example #29
0
        static void Main(string[] args)
        {

            for (int i = 0; i < 100; i++)
            {
                Util util = new Util();
                util.StartThread();
                Thread.Sleep(3);
                util.Close();
            }
        }
Example #30
0
        public List<BONUS> Search(BONUS Bonus, int PageSize, int PageIndex, out int TotalRecords, string OrderExp, Util.SortDirection SortDirection)
        {
            var result = Context.BONUS.AsQueryable();
            if (Bonus != null)
            {
                if (Bonus.ID != 0)
                {
                    result = result.Where(b => b.ID == Bonus.ID);
                }

                if (!String.IsNullOrEmpty(Bonus.Description))
                {
                    result = result.Where(b => b.Description.Contains(Bonus.Description));
                }

                if (Bonus.CustomerID.HasValue)
                {
                    result = result.Where(b => b.CustomerID == Bonus.CustomerID.Value);
                }

                if (!String.IsNullOrWhiteSpace(Bonus.CustomerFullName))
                {
                    result = result.Where(s => (s.CUSTOMER.Name + " " + s.CUSTOMER.Surname).Contains(Bonus.CustomerFullName));
                }

                // useful for filtering expired bonuses
                if (Bonus.Validity.HasValue)
                {
                    result = result.Where(b => b.Validity >= Bonus.Validity);
                }

                if (Bonus.CustomerID.HasValue)
                {
                    result = result.Where(b => b.CustomerID == Bonus.CustomerID);
                }
            }
            TotalRecords = result.Count();
            if (!String.IsNullOrEmpty(OrderExp) && OrderExp.Equals("CustomerFullName"))
            {
                if (SortDirection == SortDirection.Ascending)
                    result = result.OrderBy(c => c.CUSTOMER.Name).ThenBy(c => c.CUSTOMER.Surname);
                else
                    result = result.OrderByDescending(c => c.CUSTOMER.Name).ThenBy(c => c.CUSTOMER.Surname);
            }
            else
            {
                GenericSorterCaller<BONUS> sorter = new GenericSorterCaller<BONUS>();
                result = sorter.Sort(result, string.IsNullOrEmpty(OrderExp) ? DEFAULT_ORDER_EXP : OrderExp, SortDirection);
            }

            // pagination
            return result.Skip(PageIndex * PageSize).Take(PageSize).ToList();
        }