public void TestContainsKey_PropertyStatic_ReturnsFalse()
        {
            StaticType         t          = new StaticType();
            PropertyDictionary dictionary = new PropertyDictionary(t);
            bool result = dictionary.ContainsKey("Static");

            Assert.IsFalse(result, "The property name was found.");
        }
Example #2
0
 public override int GetHashCode()
 {
     unchecked
     {
         int hashCode = (Expression != null ? Expression.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (MemberName != null ? MemberName.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (StaticType != null ? StaticType.GetHashCode() : 0);
         return(hashCode);
     }
 }
        // ------------------------------------------------------
        //
        // Constructors
        //
        // ------------------------------------------------------

        #region Constructors

        WindowsStatic (IntPtr hwnd, ProxyFragment parent, StaticType type, int style)
            : base( hwnd, parent, 0)
        {
            _type = type;
            _style = style;
            if (type == StaticType.Text)
            {
                _cControlType = ControlType.Text;
                _fIsContent = false;
                _fControlHasLabel = false;
            }
            else
            {
                _cControlType = ControlType.Image;
            }

            // support for events
            _createOnEvent = new WinEventTracker.ProxyRaiseEvents (RaiseEvents);
        }
Example #4
0
        public void StaticTest1()
        {
            //Arrange - adaugam toate resursele de care avem nevoie

            var staticType = new StaticType();

            staticType.name       = "Octavian";
            StaticType.staticName = "Cosmin";


            //Act - apelam metoda pe care vrem sa o testam
            var staticType2 = new StaticType();


            //Assert - verificam daca rezultatul este cel asteptat
            //Assert.IsTrue(result == DateTime.Now);
            //Assert.AreEqual(DateTime.Now, result);
            Assert.That(staticType2.name, Is.EqualTo("Test"));
        }
Example #5
0
        // ------------------------------------------------------
        //
        // Constructors
        //
        // ------------------------------------------------------

        #region Constructors

        WindowsStatic(IntPtr hwnd, ProxyFragment parent, StaticType type, int style)
            : base(hwnd, parent, 0)
        {
            _type  = type;
            _style = style;
            if (type == StaticType.Text)
            {
                _cControlType     = ControlType.Text;
                _fIsContent       = false;
                _fControlHasLabel = false;
            }
            else
            {
                _cControlType = ControlType.Image;
            }

            // support for events
            _createOnEvent = new WinEventTracker.ProxyRaiseEvents(RaiseEvents);
        }
Example #6
0
        private static StaticType GetStaticTypeFromStyle(int style)
        {
            StaticType staticType = StaticType.Unsupported;

            switch (style)
            {
            case NativeMethods.SS_ICON:
                staticType = StaticType.Icon;
                break;

            case NativeMethods.SS_BITMAP:
                staticType = StaticType.Bitmap;
                break;

            case NativeMethods.SS_LEFT:
            case NativeMethods.SS_CENTER:
            case NativeMethods.SS_RIGHT:
            case NativeMethods.SS_BLACKRECT:
            case NativeMethods.SS_GRAYRECT:
            case NativeMethods.SS_WHITERECT:
            case NativeMethods.SS_BLACKFRAME:
            case NativeMethods.SS_GRAYFRAME:
            case NativeMethods.SS_WHITEFRAME:
            case NativeMethods.SS_SIMPLE:
            case NativeMethods.SS_LEFTNOWORDWRAP:
            case NativeMethods.SS_ETCHEDHORZ:
            case NativeMethods.SS_ETCHEDVERT:
            case NativeMethods.SS_ETCHEDFRAME:
            case NativeMethods.SS_OWNERDRAW:
                staticType = StaticType.Text;
                break;

            case NativeMethods.SS_ENHMETAFILE:
            case NativeMethods.SS_USERITEM:
            default:
                // current patterns do not account for images
                break;
            }
            return(staticType);
        }
Example #7
0
 public void AddStaticObj(float pointx, float pointy, Image img, string divname, int width, int height, string filepath, string name, string key, StaticType type, Font staticfont, Color staticcolor)
 {
     if (ImageAnimator.CanAnimate(img) && this.UseGif)
         ImageAnimator.Animate(img, null);
     StaticObject sobj = new StaticObject(pointx, pointy, img, divname, filepath, width, height, name, key, type, staticfont, staticcolor);
     this.StaticList.Add(sobj);
     FalshStatics();
 }
Example #8
0
 public StaticObject(float pointx, float pointy, Image img, string divname, string staticfilepath, int width, int height, string name, string key, StaticType type, Font staticfont, Color staticcolor)
 {
     this.StaticPoint = new PointF(pointx, pointy);
     //this.StaticName = name;
     this.StaticImage  = img;
     this.DivName      = divname;
     this.StaticState  = staticfilepath;
     this.StaticWidth  = width;
     this.StaticHeight = height;
     this.StaticName   = name;
     this.NameKey      = key;
     this.Type         = type;
     this.StaticFont   = staticfont;
     this.StaticColor  = staticcolor;
 }
Example #9
0
        //public StaticObject(float pointx, float pointy, string name, string key, Image filepath, string divname, int width, int height, string staticfilepath, StaticType type)
        //{
        //    this.StaticPoint = new PointF(pointx, pointy);
        //    this.StaticName = name;
        //    this.StaticImage = filepath;
        //    this.DivName = divname;
        //    this.StaticWidth = width;
        //    this.StaticHeight = height;
        //    this.StaticState = staticfilepath;
        //    this.Type = type;
        //    this.NameKey = key;
        //}


        public StaticObject(float pointx, float pointy, Image filepath, string divname, string staticfilepath, StaticType type, Font staticfont, Color staticcolor)
        {
            this.StaticPoint = new PointF(pointx, pointy);
            //this.StaticName = name;
            this.StaticImage = filepath;
            this.DivName     = divname;
            this.StaticState = staticfilepath;
            this.Type        = type;
            this.StaticFont  = staticfont;
            this.StaticColor = staticcolor;
        }
Example #10
0
 //public StaticObject(float pointx, float pointy, string name, Image filepath, string divname, string staticfilepath, StaticType type)
 //{
 //    this.StaticPoint = new PointF(pointx, pointy);
 //    this.StaticName = name;
 //    this.StaticImage = filepath;
 //    this.DivName = divname;
 //    this.StaticState = staticfilepath;
 //    this.Type = type;
 //}
 public StaticObject(float pointx, float pointy, string name, string key, string divname, StaticType type, Font staticfont, Color staticcolor)
 {
     this.StaticPoint = new PointF(pointx, pointy);
     this.StaticName  = name;
     this.DivName     = divname;
     this.Type        = type;
     this.NameKey     = key;
     this.StaticFont  = staticfont;
     this.StaticColor = staticcolor;
 }
Example #11
0
        private Expression CreateExpression(Node node)
        {
            if (node.Value is Word)
            {
                if (node.FirstChild != null)
                {
                    if (node.Value.Value == "is")
                    {
                        if (node.SecondChild == null)
                        {
                            // TODO: throw empty assigment exception
                        }

                        var assignment = new Assignment
                        {
                            VariableName = node.FirstChild.Value.Value,
                            Expression   = CreateExpression(node.SecondChild)
                        };
                        return(assignment);
                    }

                    var function = new Function {
                        Name = node.Value.Value
                    };

                    var firstChildExpression = CreateExpression(node.FirstChild);
                    if (firstChildExpression is StaticType type)
                    {
                        function.StaticType = type;
                    }
                    else
                    {
                        function.Params.Add(firstChildExpression);
                    }

                    if (node.SecondChild != null)
                    {
                        function.Params.Add(CreateExpression(node.SecondChild));
                    }

                    return(function);
                }

                if (node.Value.Value == "string")
                {
                    var type = new StaticType {
                        Type = DataType.String
                    };
                    return(type);
                }

                if (node.Value.Value == "number")
                {
                    var type = new StaticType {
                        Type = DataType.Number
                    };
                    return(type);
                }

                var variable = new Variable {
                    Name = node.Value.Value
                };
                return(variable);
            }

            if (node.Value is Number)
            {
                var literal = new Literal {
                    Value = node.Value.Value, Type = DataType.Number
                };
                return(literal);
            }

            if (node.Value is QuotedContent)
            {
                var literal = new Literal {
                    Value = node.Value.Value, Type = DataType.String
                };
                return(literal);
            }

            throw new Exception("Unexpected token: " + node.Value.GetType());
        }
Example #12
0
 public TypeStaticValue(String value)
 {
     type        = StaticType.STRING;
     stringValue = value;
 }
Example #13
0
 public TypeStaticValue(byte value)
 {
     type      = StaticType.BYTE;
     byteValue = value;
 }
Example #14
0
 public staticOverride(string value) {
     Ignore = false;
     Type = StaticType.Auto;
     OldSimplify = false;
     overrideSimplify = false;
     Simplify = 1;
     Density = -1;
     StaticsOnly = false;
     NoScript = false;
     NamesNoIgnore = false;
     string[] keys = value.ToLowerInvariant().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
     foreach (string s in keys) {
         if (s == "ignore") Ignore = true;
         else if (s == "near") Type = StaticType.Near;
         else if (s == "auto") Type = StaticType.Auto;
         else if (s == "far") Type = StaticType.Far;
         else if (s == "very_far") Type = StaticType.VeryFar;
         else if (s.StartsWith ("grass")) {
             float percent;
             Type = StaticType.Grass;
             if (s.Length > 6 && float.TryParse (s.Remove (0, 6), out percent) && percent >= 0) {
                 if (percent > 100) Density = 1.0f;
                 else Density = percent / 100.0f;
             }
         } else if (s == "tree") Type = StaticType.Tree;
         else if (s == "building") Type = StaticType.Building;
         else if (s == "no_script") NoScript = true;
         else if (s == "use_old_reduction") OldSimplify = true;
         else if (s.StartsWith ("reduction_")) {
             float percent;
             if (float.TryParse (s.Remove (0, 10), out percent) && percent >= 0 && percent <= 100) {
                 overrideSimplify = true;
                 Simplify = percent / 100.0f;
             }
         } else if (s == "static_only") StaticsOnly = true;
     }
 }
Example #15
0
 public StaticObject(float pointx, float pointy, Image img, string divname, string staticfilepath, int width, int height, string name, string key, StaticType type, Font staticfont, Color staticcolor)
 {
     this.StaticPoint = new PointF(pointx, pointy);
     //this.StaticName = name;
     this.StaticImage = img;
     this.DivName = divname;
     this.StaticState = staticfilepath;
     this.StaticWidth = width;
     this.StaticHeight = height;
     this.StaticName = name;
     this.NameKey = key;
     this.Type = type;
     this.StaticFont = staticfont;
     this.StaticColor = staticcolor;
 }
Example #16
0
        //public StaticObject(float pointx, float pointy, string name, string key, Image filepath, string divname, int width, int height, string staticfilepath, StaticType type)
        //{
        //    this.StaticPoint = new PointF(pointx, pointy);
        //    this.StaticName = name;
        //    this.StaticImage = filepath;
        //    this.DivName = divname;
        //    this.StaticWidth = width;
        //    this.StaticHeight = height;
        //    this.StaticState = staticfilepath;
        //    this.Type = type;
        //    this.NameKey = key;
        //}


        public StaticObject(float pointx, float pointy, Image filepath, string divname, string staticfilepath, StaticType type, Font staticfont, Color staticcolor)
        {
            this.StaticPoint = new PointF(pointx, pointy);
            //this.StaticName = name;
            this.StaticImage = filepath;
            this.DivName = divname;
            this.StaticState = staticfilepath;
            this.Type = type;
            this.StaticFont = staticfont;
            this.StaticColor = staticcolor;
        }
Example #17
0
 //public StaticObject(float pointx, float pointy, string name, Image filepath, string divname, string staticfilepath, StaticType type)
 //{
 //    this.StaticPoint = new PointF(pointx, pointy);
 //    this.StaticName = name;
 //    this.StaticImage = filepath;
 //    this.DivName = divname;
 //    this.StaticState = staticfilepath;
 //    this.Type = type;
 //}
 public StaticObject(float pointx, float pointy, string name, string key, string divname, StaticType type,Font staticfont,Color staticcolor)
 {
     this.StaticPoint = new PointF(pointx, pointy);
     this.StaticName = name;
     this.DivName = divname;
     this.Type = type;
     this.NameKey = key;
     this.StaticFont = staticfont;
     this.StaticColor = staticcolor;
 }
Example #18
0
 public InvalTypeExeption(StaticType type)
 {
 }
Example #19
0
 public TypeStaticValue(int value)
 {
     type     = StaticType.INT;
     intValue = value;
 }
Example #20
0
 public staticOverride(byte value) {
     OldSimplify = false;
     Simplify = 1;
     Density = -1;
     overrideSimplify = false;
     Ignore = false;
     StaticsOnly = false;
     Type = StaticType.Auto;
     NoScript = false;
     NamesNoIgnore = false;
     switch (value) {
         case 0:
             Ignore = true;
             break;
         case 1:
             Type = StaticType.Near;
             break;
         case 2:
             Type = StaticType.Far;
             break;
         case 3:
             break;
         case 4:
             overrideSimplify = true;
             Type = StaticType.Near;
             break;
         case 5:
             overrideSimplify = true;
             Type = StaticType.Far;
             break;
         case 6:
             overrideSimplify = true;
             break;
     }
 }
Example #21
0
 public TypeStaticValue(char value)
 {
     type      = StaticType.CHAR;
     charValue = value;
 }
Example #22
0
 public staticOverride(staticOverride value, bool enabledInNames) {
     OldSimplify = value.OldSimplify;
     Simplify = value.Simplify;
     Density = value.Density;
     overrideSimplify = value.overrideSimplify;
     Ignore = value.Ignore;
     StaticsOnly = value.StaticsOnly;
     Type = value.Type;
     NoScript = value.NoScript;
     NamesNoIgnore = enabledInNames;
 }
Example #23
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="content"></param>
 /// <param name="asset"></param>
 public Static(ContentManager content, String asset)
     : base(content, asset)
 {
     _sType = StaticType.NORMAL;
 }