public FloatNumber(ContentManager content, SpriteBatch batch, Backend.Coords coords, string text, Camera camera, Color color, int counter = 10, uint delay = 0)
     : this(content, batch, coords, text, camera)
 {
     _color = color;
     _counter = counter;
     _delay = (uint)delay;
 }
Exemple #2
0
		protected override Backend.Renderer CreateRenderer(Backend.Context context, Func<Geometry2D.Integer.Size> getSize, Func<TextureType> getType)
		{
			Renderer result = new Renderer(context, getSize, getType);
			result.OnUse += () =>
			{
				GL.PushAttrib(OpenTK.Graphics.OpenGL.AttribMask.AllAttribBits);
				GL.Viewport(0, 0, this.Size.Width, this.Size.Height);
				GL.Ortho(0.0, 0.0, 1.0, 1.0, 0.0, 0.0);
				GL.MatrixMode(OpenTK.Graphics.OpenGL.MatrixMode.Projection);
				GL.PushMatrix();
				new Geometry2D.Single.Transform(2.0f / this.Size.Width, 0.0f, 0.0f, 2.0f / this.Size.Height, -1.0f, -1.0f).Load();
				GL.MatrixMode(OpenTK.Graphics.OpenGL.MatrixMode.Modelview);
				GL.PushMatrix();
				GL.LoadIdentity();
				GL.Enable(OpenTK.Graphics.OpenGL.EnableCap.Blend);
				if (this.Type == TextureType.Rgba)
					GL.BlendFunc(OpenTK.Graphics.OpenGL.BlendingFactorSrc.SrcAlpha, OpenTK.Graphics.OpenGL.BlendingFactorDest.OneMinusSrcAlpha);
				else
					GL.BlendFunc(OpenTK.Graphics.OpenGL.BlendingFactorSrc.One, OpenTK.Graphics.OpenGL.BlendingFactorDest.Zero);

				this.FrameBuffer.Use();
				Exception.Framebuffer.Check();
			};
			result.OnUnuse += () =>
			{
				GL.MatrixMode(OpenTK.Graphics.OpenGL.MatrixMode.Modelview);
				GL.PopMatrix();
				GL.MatrixMode(OpenTK.Graphics.OpenGL.MatrixMode.Projection);
				GL.PopMatrix();
				GL.PopAttrib();
				GL.Ext.BindFramebuffer(OpenTK.Graphics.OpenGL.FramebufferTarget.FramebufferExt, 0);
				Exception.Framebuffer.Check();
			};
			return result;
		}
Exemple #3
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="spriteBatch"></param>
 /// <param name="content"></param>
 /// <param name="displayRect"></param>
 public Zoomable(Backend.IHandleEvent parent, SpriteBatch spriteBatch, ContentManager content, Rectangle displayRect)
     : base(parent, spriteBatch, content, displayRect)
 {
     _camera = new Camera(new Vector2(displayRect.Width / 2 + displayRect.Left, displayRect.Height / 2 + displayRect.Top));
     _camera.position = new Vector2(-displayRect.Left, -displayRect.Top);
     //_camera.zoom = 0.4f;
 }
Exemple #4
0
        public Terrain(Backend backend, TerrainData data, int chunks, int resolution, Resources.Material material, Resources.Material compositeMaterial)
        {
            if (backend == null)
                throw new ArgumentNullException("backend");
            if (data == null)
                throw new ArgumentNullException("data");

            Backend = backend;
            Data = data;

            var chunkSize = new Vector2(data.WorldSize.X, data.WorldSize.Z) / (float)chunks;

            // Setup the chunks
            for (var y = 0; y < chunks; y++)
            {
                for (var x = 0; x < chunks; x++)
                {
                    var chunkPosition = new Vector2(chunkSize.X * x, chunkSize.Y * y);
                    var chunk = new Chunk(this, chunkPosition, chunkSize, resolution, chunks);
                    // TODO: Setup correct materials per chunk so that we can have different splatmaps etc ...
                    chunk.Mesh.Material = material;
                    chunk.SplatMaterial = material;
                    chunk.CompositeMaterial = compositeMaterial;
                    Chunks.Add(chunk);
                }
            }

            Mesh = new Resources.Mesh("terrain", "");
            Mesh.SubMeshes = Chunks.Select(c => c.Mesh).ToArray();
            Mesh.State = Common.ResourceLoadingState.Loaded;
        }
Exemple #5
0
        /// <summary>
        /// Create the visible version of the game map
        /// </summary>
        /// <param name="graphics">The core graphics device manager</param>
        /// <param name="spriteBatch">A sprite batch used for drawing</param>
        /// <param name="displayArea">The area on wich the map will be placed</param>
        /// <param name="floor">The textures used for the floor</param>
        /// <param name="wall1">A set of tiles for the walls</param>
        /// <param name="wall2">A set of tiles for doors</param>
        /// <param name="map">Internal storage of map data</param>
        public Mainmap(Backend.IHandleEvent parent, SpriteBatch spriteBatch, ContentManager content, Rectangle displayArea, Backend.Map map, bool enabled = true)
            : base(parent, spriteBatch, content, displayArea)
        {
            _font = _content.Load<SpriteFont>("font");
            _map = map;
            _background = _content.Load<Texture2D>("Minimap");
            _circle = _content.Load<Texture2D>("Light2");
            _highlightedTile = new Backend.Coords(-1, -1);
            _tooltip = new TileTooltip(this, _spriteBatch, _content, _displayRect);
            // Load textures to use in environment
            // 1. Walls and floor
            _walls = new WallTiles(_content, 128, 192, "");
            _floors = new WallTiles(_content, 128, 192, "");

            // 2. Environmental objects (floor, items, traps, teleporters, chest...)
            _environment = new List<TileSet>();
            _environment.Add(new TileSet(_content, 128, 192));
            _environment[0].Load("Content\\misc.xml");
            _environment.Add(new TileSet(_content, 64, 48));
            _environment[1].Load("Content\\Arrow.xml");
            _environment.Add(new TileSet(_content, 55, 55));
            _environment[2].Load("Content\\explosion.xml");

            // 3. Moving entities (player, NPCs, enemies)
            _actors = new List<ActorView>();
            _effects = new List<MapEffect>();

            resetActors();
            _floatnumbers = new List<FloatNumber>();
            _projectiles = new List<Projectile>();
            _enabled = enabled;
        }
Exemple #6
0
        public ITestVaultData Open( Backend type )
        {
            if ( type == Backend.SQLite )
                return new TestVault.Data.SQLite.SQLiteTestData();

            throw new NotSupportedException( String.Format("unsupported backend {0}", type) );
        }
 public Subscription(Flyout self, Backend.Data.Contact contact)
 {
     this.InitializeComponent();
     this.flyoutSelf = self;
     this.DataContext = contact;
     this.CurrentContact = contact;
 }
Exemple #8
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="spriteBatch"></param>
 /// <param name="content"></param>
 /// <param name="displayRect"></param>
 public UIElement(Backend.IHandleEvent parent, SpriteBatch spriteBatch, ContentManager content, Rectangle displayRect)
 {
     _displayRect = displayRect;
     _spriteBatch = spriteBatch;
     _content = content;
     _parent = parent;
 }
Exemple #9
0
		public override void Create(Backend.Texture texture, Backend.Depth depth)
		{
			GL.Ext.FramebufferTexture2D(OpenTK.Graphics.OpenGL.FramebufferTarget.FramebufferExt, OpenTK.Graphics.OpenGL.FramebufferAttachment.ColorAttachment0Ext, OpenTK.Graphics.OpenGL.TextureTarget.Texture2D, texture.Identifier, 0);
			GL.Ext.FramebufferTexture2D(OpenTK.Graphics.OpenGL.FramebufferTarget.FramebufferExt, OpenTK.Graphics.OpenGL.FramebufferAttachment.DepthAttachmentExt, OpenTK.Graphics.OpenGL.TextureTarget.Texture2D, depth.Identifier, 0);
			Exception.Framebuffer.Check();
			GL.Ext.BindFramebuffer(OpenTK.Graphics.OpenGL.FramebufferTarget.FramebufferExt, 0);
		}
Exemple #10
0
        public void DrawMap(Backend.Map map, Graphics target)
        {
            target.FillRectangle(new SolidBrush(Color.DarkGray), new Rectangle(10, 50, 4 + (_opener.Zoom + 4) * _opener.map.Width, (_opener.Zoom + 4) * _opener.map.Height + 4));
            for (int y = 0; y < map.Height; y++)
            {
                for (int x = 0; x < map.Width; x++)
                {
                    map.GetTile(x, y).Draw(target, 12 + x * (_opener.Zoom), 52 + y * (_opener.Zoom), _opener.Zoom + 4);
                     foreach (Backend.Placeable placeable in map.GetTile(x, y).placeables)
                     {
                         placeable.Draw(target, 12 + x * (_opener.Zoom), 52 + y * (_opener.Zoom), _opener.Zoom + 4);
                     }
                     foreach (Backend.Actor actor in map.GetTile(x, y).actors)
                     {
                         actor.Draw(target, 12 + x * (_opener.Zoom), 52 + y * (_opener.Zoom), _opener.Zoom + 4);
                     }
                }

            }
            if (_activeTile.X > -1)
            {

                target.DrawRectangle(new Pen(Color.Red, 2), new Rectangle(12 + _activeTile.X * (_opener.Zoom), 52 + _activeTile.Y * (_opener.Zoom), _opener.Zoom + 4, _opener.Zoom + 4));
                if (_opener.attachedImage != null)
                {
                    target.DrawImage(_opener.attachedImage,
                        new Rectangle(12 + _activeTile.X * (_opener.Zoom), 52 + _activeTile.Y * (_opener.Zoom), _opener.Zoom + 4, _opener.Zoom + 4),

                        new Rectangle(0, 0, 32, 32), GraphicsUnit.Pixel);

                }
            }
        }
        private static void _AddActivity(ContentManager _content, ActorView actor, string character, string action, Backend.Activity activity)
        {
            if (System.IO.File.Exists(".\\content\\" + character + "-" + action + ".xnb"))
            {
                try
                {
                    Texture2D texture = _content.Load<Texture2D>(character + "-" + action);
                    int size = texture.Height / 8;
                    int cols = texture.Width / size;
                    actor.width = size;
                    actor.height = size;
                    int diff = 0;
                    if (size < 128)
                    {
                        diff = 128 - size;
                    }

                    // add offset / crop
                    actor.Add(activity, Backend.Direction.DownRight, character + "-" + action, new Backend.Coords(size * 0, size * 0), cols, 1, new Backend.Coords(diff / 2, diff / 2), new Backend.Coords(diff - diff / 2, diff - diff / 2));
                    actor.Add(activity, Backend.Direction.UpRight, character + "-" + action, new Backend.Coords(size * 0, size * 1), cols, 1, new Backend.Coords(diff / 2, diff / 2), new Backend.Coords(diff - diff / 2, diff - diff / 2)); // Ok
                    actor.Add(activity, Backend.Direction.Right, character + "-" + action, new Backend.Coords(size * 0, size * 2), cols, 1, new Backend.Coords(diff / 2, diff / 2), new Backend.Coords(diff - diff / 2, diff - diff / 2)); // OK
                    actor.Add(activity, Backend.Direction.Up, character + "-" + action, new Backend.Coords(size * 0, size * 3), cols, 1, new Backend.Coords(diff / 2, diff / 2), new Backend.Coords(diff - diff / 2, diff - diff / 2)); // Ok
                    actor.Add(activity, Backend.Direction.DownLeft, character + "-" + action, new Backend.Coords(size * 0, size * 4), cols, 1, new Backend.Coords(diff / 2, diff / 2), new Backend.Coords(diff - diff / 2, diff - diff / 2)); // Ok
                    actor.Add(activity, Backend.Direction.Down, character + "-" + action, new Backend.Coords(size * 0, size * 5), cols, 1, new Backend.Coords(diff / 2, diff / 2), new Backend.Coords(diff - diff / 2, diff - diff / 2));
                    actor.Add(activity, Backend.Direction.Left, character + "-" + action, new Backend.Coords(size * 0, size * 6), cols, 1, new Backend.Coords(diff / 2, diff / 2), new Backend.Coords(diff - diff / 2, diff - diff / 2)); // OK
                    actor.Add(activity, Backend.Direction.UpLeft, character + "-" + action, new Backend.Coords(size * 0, size * 7), cols, 1, new Backend.Coords(diff / 2, diff / 2), new Backend.Coords(diff - diff / 2, diff - diff / 2));
                }
                catch
                {

                }
                _content.Unload();
            }
        }
Exemple #12
0
        public ReportArea(Backend defaultBackend)
        {
            // Insert initialization code here.
            this.BackgroundColor = Xwt.Drawing.Colors.White;
            _defaultBackend = defaultBackend;

        }
Exemple #13
0
 /// <summary>
 /// Constructor for Exit class
 /// </summary>
 /// <param name="from">Coordinates of teleporter in entrance room</param>
 /// <param name="fromRoom">Filename of entrance room</param>
 /// <param name="to">Coordinates of teleporter in exit room</param>
 /// <param name="toRoom">Filename of exit room</param>
 public Exit(Coords from, string fromRoom, Backend.Coords to = null, string toRoom = "")
 {
     _from = from;
     _fromRoom = fromRoom;
     _toRoom = toRoom;
     _to = to;
 }
Exemple #14
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="graphics"></param>
 /// <param name="spriteBatch"></param>
 /// <param name="region"></param>
 /// <param name="mapIcons"></param>
 /// <param name="map"></param>
 public Minimap(Backend.IHandleEvent parent, SpriteBatch spriteBatch, ContentManager content, Rectangle region, Backend.Map map)
     : base(parent, spriteBatch, content, region)
 {
     _map = map;
     _mapIcon = _content.Load<Texture2D>("Minimap");
     _camera.rotate = -45.0f;
     Zoom = 0.9f;
 }
Exemple #15
0
 /// <summary>
 /// Create a new event loop hooked to a Windows.Forms object and (optionally) a map
 /// </summary>
 /// <param name="opener">The Form to which Redraw events are passed</param>
 /// <param name="currentMap">(optional) map to use</param>
 public EventLoop(Dispatcher opener = null, Backend.Map currentMap = null)
 {
     _opener = opener;
     _currentMap = currentMap;
     _timer = new System.Timers.Timer(10);
     _timer.Elapsed += _timer_Elapsed;
     _timer.Start();
 }
Exemple #16
0
 public YesNoDialog(Backend.IHandleEvent parent, SpriteBatch spriteBatch, ContentManager content, Rectangle displayRect, string question = "Quit?", string yes = "Yes", string no = "No")
     : base(parent, spriteBatch, content, displayRect)
 {
     AddChild(_yes = new Button(this, _spriteBatch, _content, new Rectangle(_displayRect.Right - 85, _displayRect.Bottom - 35, 85, 30), yes, (int)Backend.Buttons.Yes));
     AddChild(_no = new Button(this, _spriteBatch, _content, new Rectangle(_displayRect.Left + 5, _displayRect.Bottom - 35, 85, 30), no, (int)Backend.Buttons.No));
     AddChild(_question = new Statusbox(this, _spriteBatch, _content, new Rectangle(_displayRect.Left + 10, _displayRect.Top + 10, _displayRect.Width - 20, _displayRect.Height - 60), false, true));
     _question.AddLine(question);
     ChangeFocus();
 }
Exemple #17
0
 public static void Init(Triton.Common.ResourceManager resourceManager, Backend backend, Triton.Common.IO.FileSystem fileSystem)
 {
     resourceManager.AddResourceLoader<Texture>(new TextureLoader(backend, fileSystem));
     resourceManager.AddResourceLoader<ShaderProgram>(new ShaderLoader(backend, fileSystem));
     resourceManager.AddResourceLoader<Mesh>(new MeshLoader(backend, resourceManager, fileSystem));
     resourceManager.AddResourceLoader<SkeletalAnimation.Skeleton>(new SkeletonLoader(fileSystem));
     resourceManager.AddResourceLoader<Material>(new MaterialLoader(resourceManager, fileSystem));
     resourceManager.AddResourceLoader<BitmapFont>(new BitmapFontLoader(resourceManager, fileSystem));
 }
Exemple #18
0
        /// <summary>
        /// コンストラクタ
        /// </summary>
        internal SoundObject(Backend.ISoundObjectBackend bsound)
        {
            if (bsound == null)
            {
                throw new ArgumentNullException("bsound");
            }

            this.bsound = bsound;
        }
 public void ReceiveFile(Backend.CompositeType data)
 {
     if (!File.Exists(data.path))
     {
         string[] res = data.path.Split(new string[] { "\\" }, StringSplitOptions.None);
         string local_path = path + "\\" + res.Last();
         File.WriteAllText(local_path, data.text);
     }
 }
Exemple #20
0
 public Menu(Backend.IHandleEvent parent, SpriteBatch spriteBatch, ContentManager content, Rectangle displayRect)
     : base(parent, spriteBatch, content, displayRect)
 {
     _font = _content.Load<SpriteFont>("Font");
     _background = _content.Load<Texture2D>("Minimap");
     _lineHeight = (int)(_font.MeasureString("WgjITt").Y) + 1;
     _numLines = (int)(displayRect.Height / _lineHeight);
     _arrows = _content.Load<Texture2D>("Arrows");
     _text = new List<string>();
 }
 public AbilityChoice(Backend.IHandleEvent parent, SpriteBatch spriteBatch, ContentManager content, Rectangle displayRect, Backend.Actor actor = null)
     : base(parent, spriteBatch, content, displayRect)
 {
     _actor = actor;
     _random = new Random(Guid.NewGuid().GetHashCode());
     _abilities = new Backend.Ability[3];
     GenerateAbility(0);
     GenerateAbility(1);
     GenerateAbility(2);
 }
Exemple #22
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="parent"></param>
 /// <param name="spriteBatch"></param>
 /// <param name="content"></param>
 /// <param name="displayRect"></param>
 public Grid(Backend.IHandleEvent parent, SpriteBatch spriteBatch, ContentManager content, Rectangle displayRect)
     : base(parent, spriteBatch, content, displayRect)
 {
     _background = _content.Load<Texture2D>("Minimap");
     _arrows = _content.Load<Texture2D>("Arrows");
     _cols = (int)((_displayRect.Width - 35) / (_width + 3));
     _rows = (int)((_displayRect.Height) / (_height + 3));
     _icons = new List<GridElement>();
     _font = _content.Load<SpriteFont>("SmallFont");
 }
Exemple #23
0
 public Projectile(uint id, Backend.IHandleEvent parent, Backend.Coords current, Backend.Direction dir, ProjectileTile tile)
 {
     _dir = dir;
     _id = id;
     _tile = tile;
     _current = Mainmap._map2screen(current);
     _target = Mainmap._map2screen(current);
     //     System.Diagnostics.Debug.WriteLine("Start at" + _current);
     _parent = parent;
 }
 /// <summary>
 /// The constructor for the TeleportTile.
 /// Setting default values.
 /// </summary>
 /// <param name="parent"></param>
 /// <param name="nextXml"></param>
 /// <param name="pos"></param>
 /// <param name="isTeleport"></param>
 /// <param name="isHidden"></param>
 /// <param name="isEnabled"></param>
 /// <param name="isUp"></param>
 public TeleportTile(object parent, string nextXml, Backend.Coords pos, bool isTeleport = false, bool isHidden = false, bool isEnabled = true, bool isUp = false)
     : base(parent)
 {
     _nextRoom = nextXml;
     _nextPlayerPos = pos;
     _teleport = isTeleport;
     _hidden = isHidden;
     _enabled = isEnabled;
     _down = !isUp;
 }
Exemple #25
0
 public FloatNumber(ContentManager content, SpriteBatch batch, Backend.Coords coords, string text, Camera camera)
 {
     _text = text;
     _pos = new Vector2(Mainmap._map2screen(coords).x + 52, Mainmap._map2screen(coords).y - 16);
     _spritebatch = batch;
     _font = content.Load<SpriteFont>("font");
     _height = _font.MeasureString(_text).Y;
     _width = _font.MeasureString(_text).X;
     _camera = camera;
 }
Exemple #26
0
 /// <summary>
 /// Create a button using a bitmap
 /// </summary>
 /// <param name="spriteBatch"></param>
 /// <param name="content"></param>
 /// <param name="displayRect"></param>
 /// <param name="button"></param>
 /// <param name="bpressed"></param>
 /// <param name="bmouseon"></param>
 public Button(Backend.IHandleEvent parent, SpriteBatch spriteBatch, ContentManager content, Rectangle displayRect, string normal, string active, string pressed, int id)
     : base(parent, spriteBatch, content, displayRect)
 {
     _buttonStates = new List<Texture2D>();
     _buttonStates.Add(_content.Load<Texture2D>(normal));
     _buttonStates.Add(_content.Load<Texture2D>(active));
     _buttonStates.Add(_content.Load<Texture2D>(pressed));
     _id = id;
     _bstat = ButtonStatus.normal;
 }
Exemple #27
0
 public Bubble(ContentManager content, Rectangle maxRect, string text = "", Backend.Direction dir = Backend.Direction.None)
 {
     _content = content;
     _maxRect = maxRect;
     _text = text;
     _direction = dir;
     _SplitString();
     _bubble = _content.Load<Texture2D>("Bubble");
     _font = _content.Load<SpriteFont>("Smallfont");
 }
Exemple #28
0
 public Orb(Backend.IHandleEvent parent, SpriteBatch spriteBatch, ContentManager content, Rectangle displayRect, int max, int value, Color color)
     : base(parent, spriteBatch, content, displayRect)
 {
     _font = _content.Load<SpriteFont>("SmallFont");
     _orb = _content.Load<Texture2D>("Orbs");
     _color = color;
     _max = max;
     _actor = null;
     _value = value;
     _center = new Vector2(_displayRect.Left + (_displayRect.Width - _font.MeasureString("100/100").X * 1.5f) / 2, _displayRect.Top + (_displayRect.Height - _font.MeasureString("100/100").Y * 1.5f) / 2);
 }
Exemple #29
0
 /// <summary>
 /// Create a button using a text label
 /// </summary>
 /// <param name="spriteBatch"></param>
 /// <param name="content"></param>
 /// <param name="displayRect"></param>
 /// <param name="button"></param>
 /// <param name="bpressed"></param>
 /// <param name="bmouseon"></param>
 public Button(Backend.IHandleEvent parent, SpriteBatch spriteBatch, ContentManager content, Rectangle displayRect, string label, int id, bool staydown = false)
     : base(parent, spriteBatch, content, displayRect)
 {
     _background = _content.Load<Texture2D>("Minimap");
     _displayRect.Height = 32;
     _font = _content.Load<SpriteFont>("smallfont");
     _label = label;
     _id = id;
     _bstat = ButtonStatus.normal;
     this.stayDown = staydown;
 }
Exemple #30
0
 /// <summary>
 /// Clears the selection
 /// </summary>
 public void UnselectAll()
 {
     Backend.UnselectAll();
 }
Exemple #31
0
 /// <summary>
 /// Unselects a row.
 /// </summary>
 /// <param name='row'>
 /// A row
 /// </param>
 public void UnselectRow(int row)
 {
     Backend.UnselectRow(row);
 }
Exemple #32
0
 public void LoadHtml(string content, string base_uri)
 {
     Backend.LoadHtml(content, base_uri);
 }
Exemple #33
0
 public void Reload()
 {
     Backend.Reload();
 }
Exemple #34
0
 public void GoBack()
 {
     Backend.GoBack();
 }
        public void FrontDoorCRUDTest()
        {
            var handler1 = new RecordedDelegatingHandler {
                StatusCodeToReturn = HttpStatusCode.OK
            };
            var handler2 = new RecordedDelegatingHandler {
                StatusCodeToReturn = HttpStatusCode.OK
            };

            string subid = ConnectionStringKeys.SubscriptionIdKey;

            using (MockContext context = MockContext.Start(this.GetType().FullName))
            {
                // Create clients
                var frontDoorMgmtClient = FrontDoorTestUtilities.GetFrontDoorManagementClient(context, handler1);
                var resourcesClient     = FrontDoorTestUtilities.GetResourceManagementClient(context, handler2);

                // Create resource group
                var resourceGroupName = FrontDoorTestUtilities.CreateResourceGroup(resourcesClient);

                // Create two different frontDoor
                string frontDoorName = TestUtilities.GenerateName("frontDoor");

                RoutingRule routingrule1 = new RoutingRule(
                    name: "routingrule1",
                    frontendEndpoints: new List <refID> {
                    new refID("/subscriptions/" + subid + "/resourceGroups/" + resourceGroupName + "/providers/Microsoft.Network/frontDoors/" + frontDoorName + "/frontendEndpoints/frontendEndpoint1")
                },
                    acceptedProtocols: new List <string> {
                    "Https"
                },
                    patternsToMatch: new List <string> {
                    "/*"
                },
                    forwardingProtocol: "MatchRequest",
                    backendPool: new refID("/subscriptions/" + subid + "/resourceGroups/" + resourceGroupName + "/providers/Microsoft.Network/frontDoors/" + frontDoorName + "/backendPools/backendPool1"),
                    enabledState: "Enabled"
                    );
                HealthProbeSettingsModel healthProbeSettings1 = new HealthProbeSettingsModel(
                    name: "healthProbeSettings1",
                    path: "/",
                    protocol: "Http",
                    intervalInSeconds: 120
                    );

                LoadBalancingSettingsModel loadBalancingSettings1 = new LoadBalancingSettingsModel(
                    name: "loadBalancingSettings1",
                    additionalLatencyMilliseconds: 0,
                    sampleSize: 4,
                    successfulSamplesRequired: 2
                    );

                Backend backend1 = new Backend(
                    address: "contoso1.azurewebsites.net",
                    httpPort: 80,
                    httpsPort: 443,
                    enabledState: "Enabled",
                    weight: 1,
                    priority: 2
                    );

                BackendPool backendPool1 = new BackendPool(
                    name: "backendPool1",
                    backends: new List <Backend> {
                    backend1
                },
                    loadBalancingSettings: new refID("/subscriptions/" + subid + "/resourceGroups/" + resourceGroupName + "/providers/Microsoft.Network/frontDoors/" + frontDoorName + "/loadBalancingSettings/loadBalancingSettings1"),
                    healthProbeSettings: new refID("/subscriptions/" + subid + "/resourceGroups/" + resourceGroupName + "/providers/Microsoft.Network/frontDoors/" + frontDoorName + "/healthProbeSettings/healthProbeSettings1")
                    );

                FrontendEndpoint frontendEndpoint1 = new FrontendEndpoint(
                    name: "frontendEndpoint1",
                    hostName: frontDoorName + ".azurefd.net",
                    sessionAffinityEnabledState: "Disabled",
                    sessionAffinityTtlSeconds: 0
                    );

                FrontDoorModel createParameters = new FrontDoorModel
                {
                    Location     = "global",
                    FriendlyName = frontDoorName,
                    Tags         = new Dictionary <string, string>
                    {
                        { "key1", "value1" },
                        { "key2", "value2" }
                    },
                    RoutingRules = new List <RoutingRule> {
                        routingrule1
                    },
                    LoadBalancingSettings = new List <LoadBalancingSettingsModel> {
                        loadBalancingSettings1
                    },
                    HealthProbeSettings = new List <HealthProbeSettingsModel> {
                        healthProbeSettings1
                    },
                    FrontendEndpoints = new List <FrontendEndpoint> {
                        frontendEndpoint1
                    },
                    BackendPools = new List <BackendPool> {
                        backendPool1
                    }
                };


                var createdFrontDoor = frontDoorMgmtClient.FrontDoors.CreateOrUpdate(resourceGroupName, frontDoorName, createParameters);

                // validate that correct frontdoor is created
                VerifyFrontDoor(createdFrontDoor, createParameters);

                // Retrieve frontdoor
                var retrievedFrontDoor = frontDoorMgmtClient.FrontDoors.Get(resourceGroupName, frontDoorName);

                // validate that correct frontdoor is retrieved
                VerifyFrontDoor(retrievedFrontDoor, createParameters);

                // update FrontDoor
                retrievedFrontDoor.Tags = new Dictionary <string, string>
                {
                    { "key3", "value3" },
                    { "key4", "value4" }
                };


                var updatedFrontDoor = frontDoorMgmtClient.FrontDoors.CreateOrUpdate(resourceGroupName, frontDoorName, retrievedFrontDoor);

                // validate that frontDoor is correctly updated
                VerifyFrontDoor(updatedFrontDoor, retrievedFrontDoor);

                // Delete frontDoor
                frontDoorMgmtClient.FrontDoors.Delete(resourceGroupName, frontDoorName);

                // Verify that frontDoor is deleted
                Assert.ThrowsAny <ErrorResponseException>(() =>
                {
                    frontDoorMgmtClient.FrontDoors.Get(resourceGroupName, frontDoorName);
                });

                FrontDoorTestUtilities.DeleteResourceGroup(resourcesClient, resourceGroupName);
            }
        }
Exemple #36
0
Fichier : Menu.cs Projet : wwwK/xwt
 /// <summary>
 /// Shows the menu at the current position of the cursor
 /// </summary>
 public void Popup()
 {
     Backend.Popup();
 }
Exemple #37
0
Fichier : Menu.cs Projet : wwwK/xwt
 internal void RemoveItem(MenuItem item)
 {
     Backend.RemoveItem((IMenuItemBackend)BackendHost.ToolkitEngine.GetSafeBackend(item));
 }
Exemple #38
0
Fichier : Menu.cs Projet : wwwK/xwt
 internal void InsertItem(int n, MenuItem item)
 {
     Backend.InsertItem(n, (IMenuItemBackend)BackendHost.ToolkitEngine.GetSafeBackend(item));
 }
Exemple #39
0
 void OnRemove(Widget child)
 {
     UnregisterChild(child);
     Backend.Remove((IWidgetBackend)GetBackend(child));
     OnPreferredSizeChanged();
 }
Exemple #40
0
        protected override void OnReallocate()
        {
            var size = Backend.Size;

            var visibleChildren = children.Where(c => c.Child.Visible).ToArray();

            IWidgetBackend[] widgets = new IWidgetBackend [visibleChildren.Length];
            Rectangle[]      rects   = new Rectangle [visibleChildren.Length];

            if (size.Width <= 0 || size.Height <= 0)
            {
                var ws = visibleChildren.Select(bp => bp.Child.GetBackend()).ToArray();
                Backend.SetAllocation(ws, new Rectangle[visibleChildren.Length]);
                return;
            }

            if (direction == Orientation.Horizontal)
            {
                CalcDefaultSizes(size.Width, size.Height, true);
                double xs = 0;
                double xe = size.Width + spacing;
                for (int n = 0; n < visibleChildren.Length; n++)
                {
                    var    bp             = visibleChildren [n];
                    double availableWidth = bp.NextSize >= 0 ? bp.NextSize : 0;
                    if (bp.PackOrigin == PackOrigin.End)
                    {
                        xe -= availableWidth + spacing;
                    }

                    var slot = new Rectangle(bp.PackOrigin == PackOrigin.Start ? xs : xe, 0, availableWidth, size.Height);
                    widgets[n] = (IWidgetBackend)GetBackend(bp.Child);
                    rects[n]   = bp.Child.Surface.GetPlacementInRect(slot).Round().WithPositiveSize();

                    if (bp.PackOrigin == PackOrigin.Start)
                    {
                        xs += availableWidth + spacing;
                    }
                }
            }
            else
            {
                CalcDefaultSizes(size.Width, size.Height, true);
                double ys = 0;
                double ye = size.Height + spacing;
                for (int n = 0; n < visibleChildren.Length; n++)
                {
                    var    bp = visibleChildren [n];
                    double availableHeight = bp.NextSize >= 0 ? bp.NextSize : 0;
                    if (bp.PackOrigin == PackOrigin.End)
                    {
                        ye -= availableHeight + spacing;
                    }

                    var slot = new Rectangle(0, bp.PackOrigin == PackOrigin.Start ? ys : ye, size.Width, availableHeight);
                    widgets[n] = (IWidgetBackend)GetBackend(bp.Child);
                    rects[n]   = bp.Child.Surface.GetPlacementInRect(slot).Round().WithPositiveSize();

                    if (bp.PackOrigin == PackOrigin.Start)
                    {
                        ys += availableHeight + spacing;
                    }
                }
            }
            Backend.SetAllocation(widgets, rects);
        }
Exemple #41
0
 void UpdateBorderWidth()
 {
     Backend.SetBorderSize(borderWidth.Left, borderWidth.Right, borderWidth.Top, borderWidth.Bottom);
     OnPreferredSizeChanged();
 }
Exemple #42
0
 void Awake()
 {
     Backend.Initialize(HandleBackendCallback);
 }
Exemple #43
0
        internal override void AdjustSize()
        {
            if (child == null)
            {
                return;
            }

            IWidgetSurface s = child.Surface;

            var size = shown ? Size : initialBounds.Size;

            var wc = (shown || widthSet) ? SizeConstraint.WithSize(size.Width - padding.HorizontalSpacing) : SizeConstraint.Unconstrained;
            var hc = (shown || heightSet) ? SizeConstraint.WithSize(size.Height - padding.VerticalSpacing) : SizeConstraint.Unconstrained;

            var ws = s.GetPreferredSize(wc, hc, true);

            if (!shown)
            {
                if (!widthSet)
                {
                    size.Width = ws.Width + padding.HorizontalSpacing;
                }
                if (!heightSet)
                {
                    size.Height = ws.Height + padding.VerticalSpacing;
                }
            }

            if (ws.Width + padding.HorizontalSpacing > size.Width)
            {
                size.Width = ws.Width + padding.HorizontalSpacing;
            }
            if (ws.Height + padding.VerticalSpacing > size.Height)
            {
                size.Height = ws.Height + padding.VerticalSpacing;
            }

            size += Backend.ImplicitMinSize;

            if (!shown)
            {
                shown = true;

                if (size != Size)
                {
                    if (locationSet)
                    {
                        Backend.Bounds = new Rectangle(initialBounds.X, initialBounds.Y, size.Width, size.Height);
                    }
                    else
                    {
                        Backend.SetSize(size.Width, size.Height);
                    }
                }
                else if (locationSet && !shown)
                {
                    Backend.Move(initialBounds.X, initialBounds.Y);
                }

                Backend.SetMinSize(Backend.ImplicitMinSize + new Size(ws.Width + padding.HorizontalSpacing, ws.Height + padding.VerticalSpacing));
            }
            else
            {
                if (size != Size)
                {
                    Backend.SetSize(size.Width, size.Height);
                }
            }
        }
Exemple #44
0
 void OnAdd(Widget child, BoxPlacement placement)
 {
     RegisterChild(child);
     Backend.Add((IWidgetBackend)GetBackend(child));
     OnPreferredSizeChanged();
 }
Exemple #45
0
 public void GoForward()
 {
     Backend.GoForward();
 }
Exemple #46
0
        static void Main(string[] args)
        {
            bool    showHelp = false;
            Backend backend  = Backend.Interpreter;

            var p = new OptionSet()
            {
                { "h|?|help", "show help", v => { showHelp = v != null; } },
                { "b|backend=", "the {BACKEND} to use, [i|interp|interpreter]|[r|recomp|recompiler]", v => { backend = ParseBackend(v).Value; } },
            };

            List <string> extra;

            try
            {
                extra = p.Parse(args);
            }
            catch (OptionException e)
            {
                Console.Write("ProllE2: ");
                Console.WriteLine(e.Message);
                Console.WriteLine("Try ProllE2 --help' for more information.");
                return;
            }
            catch (InvalidOperationException)
            {
                Console.Write("ProllE2: ");
                Console.WriteLine("Invalid backend");
                Console.WriteLine("Try ProllE2 --help' for more information.");
                return;
            }

            if (showHelp)
            {
                ShowHelp(p);
                return;
            }

            Cpu cpu;

            if (backend == Backend.Recompiler)
            {
                cpu = new Recompiler();
            }
            else
            {
                cpu = new Interpreter();
            }

            string path = AppDomain.CurrentDomain.BaseDirectory + "\\" + string.Join("", extra.ToArray());

            try
            {
                cpu.LoadProgram(path);
            }
            catch (Exception e)
            {
                Console.WriteLine("ProllE2:");
                Console.WriteLine(e.Message);
                return;
            }

            Stopwatch sw = new Stopwatch();

            sw.Start();

            bool res = cpu.Run();

            sw.Stop();

            if (res)
            {
                Console.WriteLine("Program executed successfully in " + sw.ElapsedTicks + " ticks");
            }
            else
            {
                Console.WriteLine("shit broke");
            }
        }
Exemple #47
0
 public void StopLoading()
 {
     Backend.StopLoading();
 }
Exemple #48
0
        public override bool CanCloseDocument()
        {
            Logger.LogDebug("WQE.net", 1, "Processing CanCloseDocument()\n");

            return(Backend.can_close());
        }
Exemple #49
0
 /// <summary>
 /// Selects a row.
 /// </summary>
 /// <param name='row'>
 /// a row.
 /// </param>
 /// <remarks>
 /// In single selection mode, the row will be selected and the previously selected row will be deselected.
 /// In multiple selection mode, the row will be added to the set of selected rows.
 /// </remarks>
 public void SelectRow(int row)
 {
     Backend.SelectRow(row);
 }
        public override SElement CreateWindow()
        {
            Instance = this;
            var etgmod = Backend.SearchForBackend("ETGMod");

            Console.Instance.AddDefaultCommands();

            return(new SGroup {
                Background = new Color(0, 0f, 0f, 0.8f),

                OnUpdateStyle = elem => {
                    elem.Fill(0);
                },

                Children =
                {
                    new SGroup { // OutputBox
                        Background                                    = new Color(0,                             0,    0,    0),
                        AutoLayout                                    = (self) => self.AutoLayoutVertical,
                        ScrollDirection                               = SGroup.EDirection.Vertical,
                        OnUpdateStyle                                 = (elem) => {
                            elem.Fill(0);
                            elem.Size                                 -= new Vector2(0,                    elem.Backend.LineHeight);
                        },
                        Children                                      =
                        {
                            new SLabel($"ETGMod v{etgmod.BestMatch?.Instance.StringVersion ?? "?"}")
                            {
                                Foreground                            = UnityUtil.NewColorRGB(0,               161, 231),
                                Modifiers                             =
                                {
                                    new STest()
                                }
                            }
                        }
                    },
                    new SGroup { // AutocompleteBox
                        Background                                    = new Color(0.2f,                       0.2f, 0.2f, 0.9f),
                        AutoLayout                                    = (self) => self.AutoLayoutVertical,
                        ScrollDirection                               = SGroup.EDirection.Vertical,
                        OnUpdateStyle                                 = (elem) => {
                            elem.Size.x                               = elem.Parent.InnerSize.x;
                            elem.Size.y                               = elem.Parent.InnerSize.y / 10; // 10%
                            elem.Position.y                           = elem.Parent.InnerSize.y - elem.Parent[(int)WindowChild.InputBox].Size.y - elem.Size.y;
                        },
                        Children                                      = {},
                        Visible                                       = false
                    },
                    new STextField { // InputBox
                        OverrideTab                                   = true,

                        OnUpdateStyle                                 = (elem) => {
                            elem.Size.x                               = elem.Parent.InnerSize.x;
                            elem.Position.x                           =                           0;
                            elem.Position.y                           = elem.Parent.InnerSize.y - elem.Size.y;
                        },

                        OnKey                                         = (self,                             is_down, key) => {
                            if (!is_down || key == KeyCode.Return || key == KeyCode.KeypadEnter)
                            {
                                return;
                            }

                            switch (key)
                            {
                            case KeyCode.Home:
                                self.MoveCursor(0);
                                break;

                            case KeyCode.Escape:
                            case KeyCode.F2:
                                Hide();
                                break;

                            case KeyCode.Tab:
                                Console.Instance.DoAutoComplete();
                                break;

                            case KeyCode.UpArrow:
                                Console.Instance.History.MoveUp();
                                self.MoveCursor(Console.Instance.History.Entry.Length);
                                break;

                            case KeyCode.DownArrow:
                                Console.Instance.History.MoveDown();
                                self.MoveCursor(Console.Instance.History.Entry.Length);
                                break;

                            default:
                                Console.Instance.History.LastEntry    = self.Text;
                                Console.Instance.History.CurrentIndex = Console.Instance.History.LastIndex;
                                break;
                            }

                            self.Text                                 = Console.Instance.History.Entry;
                        },

                        OnSubmit                                      = (elem,                             text) => {
                            if (text.Trim().Length == 0)
                            {
                                return;
                            }
                            Console.Instance.History.Push();
                            if (Console.Instance.LuaMode)
                            {
                                Console.Instance.ExecuteLuaAndPrintResult(text);
                            }
                            else
                            {
                                Console.Instance.ExecuteCommandAndPrintResult(text);
                            }
                        }
                    }
                }
            });
        }
Exemple #51
0
 /// <summary>
 /// Selects all rows
 /// </summary>
 public void SelectAll()
 {
     Backend.SelectAll();
 }
Exemple #52
0
        /// <summary>
        /// Verify that if the function satisfies the precondition,
        /// then it also satisfies the postcondition.
        /// </summary>
        /// <param name="invariant">The invariant.</param>
        /// <param name="backend">The backend.</param>
        /// <returns>An input if one exists satisfying the constraints.</returns>
        public bool Assert(Func <Zen <T>, Zen <bool> > invariant, Backend backend = Backend.Z3)
        {
            var result = invariant(this.function());

            return(CommonUtilities.RunWithLargeStack(() => SymbolicEvaluator.Find(result, backend)));
        }
Exemple #53
0
 void OnCellChanged()
 {
     Backend.SetViews(views);
 }
Exemple #54
0
 protected virtual void SetBackendAction(Action <object> value)
 {
     Backend.SetAction(value);
 }
Exemple #55
0
        //public static bool cacheTiling = false;

        public static async Task DoUpscale(string inpath, string outpath, ModelData mdl, bool cacheSplitDepth, bool alpha, PreviewMode mode, Backend backend, bool showTileProgress = true)
        {
            Program.cancelled = false;      // Reset cancel flag
            try
            {
                if (backend == Backend.NCNN)
                {
                    Program.lastModelName = mdl.model1Name;
                    await RunNcnn(inpath, outpath, mdl.model1Path);
                }
                else
                {
                    Program.mainForm.SetProgress(2f, "Starting ESRGAN...");
                    File.Delete(Paths.progressLogfile);
                    string modelArg = GetModelArg(mdl);
                    await RunJoey(inpath, outpath, modelArg, cacheSplitDepth, alpha, showTileProgress);
                }

                if (mode == PreviewMode.Cutout)
                {
                    await ScalePreviewOutput();

                    Program.mainForm.SetProgress(100f, "Merging into preview...");
                    await Program.PutTaskDelay();

                    PreviewMerger.Merge();
                    Program.mainForm.SetHasPreview(true);
                }
                if (mode == PreviewMode.FullImage)
                {
                    await ScalePreviewOutput();

                    Program.mainForm.SetProgress(100f, "Merging into preview...");
                    await Program.PutTaskDelay();

                    Image outImg   = ImgUtils.GetImage(Directory.GetFiles(Paths.previewOutPath, "preview.*", SearchOption.AllDirectories)[0]);
                    Image inputImg = ImgUtils.GetImage(Paths.tempImgPath);
                    PreviewUI.previewImg.Image = outImg;
                    PreviewUI.currentOriginal  = inputImg;
                    PreviewUI.currentOutput    = outImg;
                    PreviewUI.currentScale     = ImgUtils.GetScaleFloat(inputImg, outImg);
                    PreviewUI.previewImg.ZoomToFit();
                    Program.mainForm.SetHasPreview(true);
                    //Program.mainForm.SetProgress(0f, "Done.");
                }
            }
            catch (Exception e)
            {
                Program.mainForm.SetProgress(0f, "Cancelled.");
                if (Program.cancelled)
                {
                    return;
                }
                if (e.Message.Contains("No such file"))
                {
                    Program.ShowMessage("An error occured during upscaling.\nThe upscale process seems to have exited before completion!", "Error");
                }
                else
                {
                    Program.ShowMessage("An error occured during upscaling.", "Error");
                }
                Logger.Log("[ESRGAN] Upscaling Error: " + e.Message + "\n" + e.StackTrace);
            }
        }
Exemple #56
0
 void UpdatePadding()
 {
     Backend.SetPadding(padding.Left, padding.Top, padding.Right, padding.Bottom);
 }
Exemple #57
0
 /// <summary>
 /// Resolves an address-space-cast suffix.
 /// </summary>
 /// <param name="backend">The current backend.</param>
 /// <returns>The resolved address-space-cast suffix.</returns>
 public static string GetAddressSpaceCastSuffix(Backend backend) =>
 AddressSpaceCastOperationSuffix[
     backend.PointerBasicValueType == BasicValueType.Int32 ? 0 : 1];
Exemple #58
0
 void UpdatePadding()
 {
     Backend.SetPadding(padding.Left, padding.Right, padding.Top, padding.Bottom);
     OnPreferredSizeChanged();
 }
Exemple #59
0
Fichier : Menu.cs Projet : wwwK/xwt
 /// <summary>
 /// Shows the menu at the specified location
 /// </summary>
 /// <param name="parentWidget">Widget upon which to show the menu</param>
 /// <param name="x">The x coordinate, relative to the widget origin</param>
 /// <param name="y">The y coordinate, relative to the widget origin</param>
 public void Popup(Widget parentWidget, double x, double y)
 {
     Backend.Popup(parentWidget.GetBackend(), x, y);
 }
Exemple #60
-1
        public RenderTargetManager(Backend backend)
        {
            if (backend == null)
                throw new ArgumentNullException("backend");

            Backend = backend;
        }