content
stringlengths
5
1.04M
avg_line_length
float64
1.75
12.9k
max_line_length
int64
2
244k
alphanum_fraction
float64
0
0.98
licenses
list
repository_name
stringlengths
7
92
path
stringlengths
3
249
size
int64
5
1.04M
lang
stringclasses
2 values
// This file is auto-generated, don't edit it. Thanks. using System; using System.Collections.Generic; using System.IO; using Tea; namespace AntChain.SDK.BLOCKCHAIN.Models { public class StartDidIotAgentcreatewithsidekeyRequest : TeaModel { // OAuth模式下的授权token [NameInMap("auth_token")] [Validation(Required=false)] public string AuthToken { get; set; } [NameInMap("product_instance_id")] [Validation(Required=false)] public string ProductInstanceId { get; set; } // { "自定义服务相关字段": 自定义字符串, "type": "IOT设备类型", "name": "演示用户名", "licenceNo": "设备唯一号", "address": "1111" } [NameInMap("extension_info")] [Validation(Required=false)] public string ExtensionInfo { get; set; } // 所有需要关联的外键,外键必须已did auth key controller的did作为前缀+“sidekey:”+外键 [NameInMap("indexs")] [Validation(Required=true)] public List<string> Indexs { get; set; } // iot设备名 [NameInMap("owner_name")] [Validation(Required=false)] public string OwnerName { get; set; } // 自定义企业唯一id,企业在自有模式下的唯一号bid的has... [NameInMap("owner_uid")] [Validation(Required=true)] public string OwnerUid { get; set; } // 场景码,找dis工作人员进行分配 [NameInMap("biz_code")] [Validation(Required=false)] public string BizCode { get; set; } } }
28.591837
111
0.619557
[ "MIT" ]
alipay/antchain-openapi-prod-sdk
blockchain/csharp/core/Models/StartDidIotAgentcreatewithsidekeyRequest.cs
1,593
C#
using DF.Enums; using DFHack; using MapGen; using RemoteFortressReader; using System.Collections.Generic; using System.Globalization; using System.IO; using System.Text; using System.Threading; using UnitFlags; using UnityEngine; using UnityEngine.UI; using UnityEngine.EventSystems; using System.Collections; using Building; // The class responsible for talking to DF and meshing the data it gets. // Relevant vocabulary: A "map tile" is an individual square on the map. // A "map block" is a 16x16x1 area of map tiles stored by DF; think minecraft "chunks". public class GameMap : MonoBehaviour { public CanvasGroup helpOverlay; public Material waterMaterial; public Material magmaMaterial; public Light magmaGlowPrefab; public Text cursorProperties; public bool overheadShadows = true; public bool firstPerson = false; public int cursX = -30000; public int cursY = -30000; public int cursZ = -30000; public WorldMapMaker worldMap; public RectTransform optionsPanel; // Parameters managing the currently visible area of the map. // Tracking: public int PosXBlock { get { return posXTile / blockSize; } } public int PosYBlock { get { return posYTile / blockSize; } } [SerializeField] int posXTile = 0; [SerializeField] int posYTile = 0; [SerializeField] int posZ = 0; public int PosZ { // Public accessor; used from MapSelection get { return posZ; } } public int PosXTile { get { return posXTile; } } public int PosYTile { get { return posYTile; } } // Stored view information ViewInfo view; BlockMesher mesher; public BlockMeshSet[,,] mapMeshes; // Dirty flags for those meshes bool[,,] blockDirtyBits; bool[,,] blockContentBits; UpdateSchedule[,,] blockUpdateSchedules; bool[,,] liquidBlockDirtyBits; // Lights from magma. Light[,,] magmaGlow; DFCoord mapSize; //This is to keep track of changing size of the map. DFCoord mapPosition; // Stuff to let the material list & various meshes & whatnot be loaded from xml specs at runtime. public static Dictionary<MatPairStruct, MaterialDefinition> materials; public static Dictionary<MatPairStruct, MaterialDefinition> items; public static Dictionary<BuildingStruct, BuildingDefinition> buildings; public static Dictionary<MatPairStruct, MaterialDefinition> creatures; // Coordinate system stuff. public const float tileHeight = 3.0f; public const float floorHeight = 0.5f; public const float tileWidth = 2.0f; public const int blockSize = 16; static object mapZOffsetLock = new object(); static int _mapZoffset = 0; public static int MapZOffset { get { lock (mapZOffsetLock) { return _mapZoffset; } } set { lock (mapZOffsetLock) { _mapZoffset = value; } } } public static Vector3 DFtoUnityCoord(int x, int y, int z) { Vector3 outCoord = new Vector3(x * tileWidth, (z + MapZOffset) * tileHeight, y * (-tileWidth)); return outCoord; } public static Vector3 DFtoUnityCoord(float x, float y, float z) { Vector3 outCoord = new Vector3(x * tileWidth, (z + MapZOffset) * tileHeight, y * (-tileWidth)); return outCoord; } public static Vector3 DFtoUnityDirection(float x, float y, float z) { return new Vector3(x* tileWidth, z *tileHeight, y * (-tileWidth)); } public static Vector3 DFtoUnityCoord(DFCoord input) { Vector3 outCoord = new Vector3(input.x * tileWidth, (input.z + MapZOffset) * tileHeight, input.y * (-tileWidth)); return outCoord; } public static Vector3 DFtoUnityTileCenter(DFCoord input) { Vector3 result = DFtoUnityCoord(input); result.y += tileHeight / 2; return result; } public static Vector3 DFtoUnityBottomCorner(DFCoord input) { Vector3 result = DFtoUnityCoord(input); result.x -= tileWidth / 2; result.z -= tileWidth / 2; return result; } public static DFCoord UnityToDFCoord(Vector3 input) { int x = Mathf.RoundToInt(input.x / tileWidth); int y = Mathf.RoundToInt(input.z / -tileWidth); int z = Mathf.FloorToInt(input.y / tileHeight); return new DFCoord(x, y, z - MapZOffset); } public static Vector3 UnityToFloatingDFCoord(Vector3 input) { float x = input.x / tileWidth; float y = input.z / -tileWidth; float z = input.y / tileHeight; return new Vector3(x + 0.5f, y + 0.5f, z - MapZOffset); } public static bool IsBlockCorner(DFCoord input) { return input.x % blockSize == 0 && input.y % blockSize == 0; } // Does about what you'd think it does. void Start() { enabled = false; Debug.Log("Started Armok Vision version " + BuildSettings.Instance.content_version); Debug.Log("scmCommitId: " + BuildManifest.Instance.scmCommitId); Debug.Log("scmBranch: " + BuildManifest.Instance.scmBranch); Debug.Log("buildNumber: " + BuildManifest.Instance.buildNumber); Debug.Log("buildStartTime: " + BuildManifest.Instance.buildStartTime); Debug.Log("projectId: " + BuildManifest.Instance.projectId); Debug.Log("bundleId: " + BuildManifest.Instance.bundleId); Debug.Log("unityVersion: " + BuildManifest.Instance.unityVersion); Debug.Log("xcodeVersion: " + BuildManifest.Instance.xcodeVersion); Debug.Log("cloudBuildTargetName: " + BuildManifest.Instance.cloudBuildTargetName); DFConnection.RegisterConnectionCallback(OnConnectToDF); #if DEVELOPMENT_BUILD Debug.Log("Dev build"); #endif dfScreen.SetActive(GameSettings.Instance.game.showDFScreen); } public static GameMap Instance { get; private set; } static Thread mainThread; // Awake is called when the script instance is being loaded public void Awake() { Instance = this; cameraMovement = FindObjectOfType<CameraMovement>(); mainThread = Thread.CurrentThread; } public static bool IsMainThread { get { return Thread.CurrentThread == mainThread; } } [System.Diagnostics.Conditional("DEVELOPMENT_BUILD"), System.Diagnostics.Conditional("UNITY_EDITOR")] public static void BeginSample(string name) { if (IsMainThread) UnityEngine.Profiling.Profiler.BeginSample(name); } [System.Diagnostics.Conditional("DEVELOPMENT_BUILD"), System.Diagnostics.Conditional("UNITY_EDITOR")] public static void BeginSample(string name, Object targetObject) { if (IsMainThread) UnityEngine.Profiling.Profiler.BeginSample(name, targetObject); } [System.Diagnostics.Conditional("DEVELOPMENT_BUILD"), System.Diagnostics.Conditional("UNITY_EDITOR")] public static void EndSample() { if (IsMainThread) UnityEngine.Profiling.Profiler.EndSample(); } void OnConnectToDF() { Debug.Log("Connected"); enabled = true; mesher = BlockMesher.GetMesher(GameSettings.Instance.meshing.meshingThreads); // Initialize materials, if available if (DFConnection.Instance.NetMaterialList != null) { if (materials == null) materials = new Dictionary<MatPairStruct, RemoteFortressReader.MaterialDefinition>(); materials.Clear(); foreach (RemoteFortressReader.MaterialDefinition material in DFConnection.Instance.NetMaterialList.material_list) { materials[material.mat_pair] = material; } if (GameSettings.Instance.debug.saveMaterialList) SaveMaterialList(materials, Path.Combine(Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.MyDocuments), Application.productName), "MaterialList.csv")); } // Initialize items, if available if (DFConnection.Instance.NetItemList != null) { if (items == null) items = new Dictionary<MatPairStruct, RemoteFortressReader.MaterialDefinition>(); items.Clear(); foreach (MaterialDefinition material in DFConnection.Instance.NetItemList.material_list) { items[material.mat_pair] = material; } if (GameSettings.Instance.debug.saveItemList) SaveMaterialList(items, Path.Combine(Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.MyDocuments), Application.productName), "ItemList.csv")); } if (DFConnection.Instance.NetBuildingList != null) { if (buildings == null) buildings = new Dictionary<BuildingStruct, BuildingDefinition>(); buildings.Clear(); foreach (BuildingDefinition building in DFConnection.Instance.NetBuildingList.building_list) { buildings[building.building_type] = building; } if (GameSettings.Instance.debug.saveBuildingList) SaveBuildingList(); } if (DFConnection.Instance.CreatureRaws != null) { if (creatures == null) creatures = new Dictionary<MatPairStruct, MaterialDefinition>(); foreach (CreatureRaw creatureRaw in DFConnection.Instance.CreatureRaws) { foreach (var caste in creatureRaw.caste) { MatPairStruct creatureCaste = new MatPairStruct(creatureRaw.index, caste.index); MaterialDefinition creatureDef = new MaterialDefinition(); creatureDef.mat_pair = creatureCaste; creatureDef.id = creatureRaw.creature_id + ":" + caste.caste_id; creatureDef.name = caste.caste_name[0]; creatureDef.state_color = creatureRaw.color; creatures[creatureCaste] = creatureDef; } } GeneratedCreatureTranslator.AddFakeCreaturesToList(creatures); if (GameSettings.Instance.debug.saveCreatureList) SaveMaterialList(creatures, Path.Combine(Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.MyDocuments), Application.productName), "CreatureList.csv")); } if (GameSettings.Instance.debug.saveTiletypeList) SaveTileTypeList(); if (GameSettings.Instance.debug.savePlantList) SavePlantList(); UpdateView(); InitializeBlocks(); } public GameObject dfScreen; GameObject selected; CameraMovement cameraMovement; // Run once per frame. void Update() { if (Input.GetButtonDown("ToggleDF") && EventSystem.current.currentSelectedGameObject == null) { GameSettings.Instance.game.showDFScreen = !GameSettings.Instance.game.showDFScreen; dfScreen.SetActive(GameSettings.Instance.game.showDFScreen); } if ((cameraMovement != null && cameraMovement.following) || GameSettings.Instance.game.showDFScreen) UpdateView(); if (!GameSettings.Instance.game.showDFScreen && EventSystem.current.currentSelectedGameObject == null && DFConnection.Instance.WorldMode != dfproto.GetWorldInfoOut.Mode.MODE_ADVENTURE) { if (Input.GetKeyDown(KeyCode.F1)) { ToggleHelp(); } if (Input.GetButtonDown("ScaleUnits")) { GameSettings.Instance.units.scaleUnits = !GameSettings.Instance.units.scaleUnits; } if (Input.GetButtonDown("OverheadShadows")) { overheadShadows = !overheadShadows; } if (Input.GetButtonDown("FollowDF")) { cameraMovement.following = true; } if (Input.GetKeyDown(KeyCode.C)) { cameraMovement.following = false; } // take screenshot on up->down transition of F9 key if (Input.GetButtonDown("TakeScreenshot")) { string path = Path.Combine(Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.MyDocuments), Application.productName), "Screenshots"); if (!Directory.Exists(path)) Directory.CreateDirectory(path); string screenshotFilename; do { screenshotCount++; screenshotFilename = Path.Combine(path, "screenshot" + screenshotCount + ".png"); } while (File.Exists(screenshotFilename)); Debug.Log ("Saving screenshot to: " + screenshotFilename); if (Input.GetButton("Mod")) { RenderTexture.active = Minimap.Instance.texture; Texture2D virtualPhoto = new Texture2D(Minimap.Instance.texture.width, Minimap.Instance.texture.height, TextureFormat.RGB24, false); // false, meaning no need for mipmaps virtualPhoto.ReadPixels(new Rect(0, 0, Minimap.Instance.texture.width, Minimap.Instance.texture.height), 0, 0); RenderTexture.active = null; //can help avoid errors File.WriteAllBytes(screenshotFilename, virtualPhoto.EncodeToPNG()); } else UnityEngine.ScreenCapture.CaptureScreenshot(screenshotFilename); } if (Input.GetButtonDown("Refresh")) { Refresh(); } if (Input.GetButtonDown("Cancel")) { optionsPanel.gameObject.SetActive(!optionsPanel.gameObject.activeSelf); } if(Input.GetButtonDown("ToggleMap")) { mapWindow.SetActive(!mapWindow.activeSelf); mapCamera.SetActive(!mapCamera.activeSelf); } if(Input.GetButtonDown("ToggleUI")) { mainUI.gameObject.SetActive(!mainUI.gameObject.activeSelf); } } if (ContentLoader.Instance == null) return; ShowCursorInfo(); UpdateRequestRegion(); UpdateBlocks(); //DrawBlocks(); UpdateBlockVisibility(); } private void UpdateBlockVisibility() { Shader.SetGlobalVector("_ViewMin", DFtoUnityBottomCorner(new DFCoord( (PosXBlock - GameSettings.Instance.rendering.drawRangeSide + 1) * blockSize, (PosYBlock + GameSettings.Instance.rendering.drawRangeSide) * blockSize, PosZ - GameSettings.Instance.rendering.drawRangeDown )) + new Vector3(0, 0, GameMap.tileWidth)); Shader.SetGlobalVector("_ViewMax", DFtoUnityBottomCorner(new DFCoord( (PosXBlock + GameSettings.Instance.rendering.drawRangeSide) * blockSize, (PosYBlock - GameSettings.Instance.rendering.drawRangeSide + 1) * blockSize, PosZ + (firstPerson ? GameSettings.Instance.rendering.drawRangeUp : 0) )) + new Vector3(0, 0, GameMap.tileWidth)); for (int z = 0; z < mapMeshes.GetLength(2); z++) { UpdateBlockVisibility(z); } } void UpdateBlockVisibility(int z) { if (z < 0 || z >= mapMeshes.GetLength(2)) return; for (int x = 0; x < mapMeshes.GetLength(0); x++) for (int y = 0; y < mapMeshes.GetLength(1); y++) { if (mapMeshes[x, y, z] == null) continue; if( x <= PosXBlock - GameSettings.Instance.rendering.drawRangeSide || x >= PosXBlock + GameSettings.Instance.rendering.drawRangeSide || y <= PosYBlock - GameSettings.Instance.rendering.drawRangeSide || y >= PosYBlock + GameSettings.Instance.rendering.drawRangeSide ) mapMeshes[x, y, z].UpdateVisibility(BlockMeshSet.Visibility.None); else mapMeshes[x, y, z].UpdateVisibility(GetVisibility(z)); } } public static bool IsInVisibleArea(DFCoord coord) { return (coord.z < (Instance.firstPerson ? Instance.PosZ + GameSettings.Instance.rendering.drawRangeUp : Instance.PosZ)) && (coord.z >= (Instance.PosZ - GameSettings.Instance.rendering.drawRangeDown)) && (coord.x / blockSize > (Instance.PosXBlock - GameSettings.Instance.rendering.drawRangeSide)) && (coord.x / blockSize < (Instance.PosXBlock + GameSettings.Instance.rendering.drawRangeSide)) && (coord.y / blockSize > (Instance.PosYBlock - GameSettings.Instance.rendering.drawRangeSide)) && (coord.y / blockSize < (Instance.PosYBlock + GameSettings.Instance.rendering.drawRangeSide)); } BlockMeshSet.Visibility GetVisibility(int z) { if (z > PosZ + GameSettings.Instance.rendering.drawRangeUp) return BlockMeshSet.Visibility.None; else if (z >= PosZ) { if (firstPerson) return BlockMeshSet.Visibility.Walls; else if (overheadShadows) return BlockMeshSet.Visibility.Shadows; else return BlockMeshSet.Visibility.None; } else if (z == PosZ - 1) return BlockMeshSet.Visibility.All; else if (z >= PosZ - GameSettings.Instance.rendering.drawRangeDown) { return BlockMeshSet.Visibility.Walls; } else return BlockMeshSet.Visibility.None; } public float helpFadeLength = 0.5f; Coroutine helpFade; bool helpEnabled = false; private void ToggleHelp() { StopCoroutine(helpFade); if (helpEnabled) { HideHelp(); } else { ShowHelp(); } } public void HideHelp() { helpFade = StartCoroutine(DisableHelp()); } public void ShowHelp() { helpFade = StartCoroutine(EnableHelp()); } IEnumerator DisableHelp() { helpEnabled = false; for (float f = helpOverlay.alpha; f >= 0; f -= (Time.deltaTime / helpFadeLength)) { helpOverlay.alpha = f; yield return null; } helpOverlay.gameObject.SetActive(false); yield return null; } IEnumerator EnableHelp() { helpEnabled = true; helpOverlay.gameObject.SetActive(true); for (float f = helpOverlay.alpha; f <= 1; f += (Time.deltaTime / helpFadeLength)) { helpOverlay.alpha = f; yield return null; } yield return null; } public void Refresh() { for (int z = 0; z < blockDirtyBits.GetLength(2); z++) for (int x = 0; x < blockDirtyBits.GetLength(0); x++) for (int y = 0; y < blockDirtyBits.GetLength(1); y++) { if (blockContentBits[x, y, z]) { SplatManager.Instance.DirtyLayer(x, y, z); SplatManager.Instance.DirtyGrass(x, y, z); SplatManager.Instance.DirtySpatter(x, y, z); } blockDirtyBits[x, y, z] = blockContentBits[x, y, z]; liquidBlockDirtyBits[x, y, z] = blockContentBits[x, y, z]; } } public Mesh testMesh; private void SaveMeshes() { //COLLADA exportScene = new COLLADA(); //List<geometry> geometryList = new List<geometry>(); ////if(testMesh!= null) ////{ //// geometry geo = COLLADA.MeshToGeometry(testMesh); //// if (geo != null) //// geometryList.Add(geo); ////} //Debug.Log("Starting mesh export"); //foreach (Mesh mesh in blocks) //{ // if (mesh != null) // { // geometry geo = (COLLADA.MeshToGeometry(mesh)); // if (geo != null) // geometryList.Add(geo); // } //} //Debug.Log("Added opaque blocks"); //foreach (Mesh mesh in stencilBlocks) //{ // if (mesh != null) // { // geometry geo = (COLLADA.MeshToGeometry(mesh)); // if (geo != null) // geometryList.Add(geo); // } //} //Debug.Log("Added stencil blocks"); //foreach (Mesh mesh in transparentBlocks) //{ // if (mesh != null) // { // geometry geo = (COLLADA.MeshToGeometry(mesh)); // if (geo != null) // geometryList.Add(geo); // } //} //Debug.Log("Added transparent blocks"); //foreach (Mesh mesh in liquidBlocks) //{ // if (mesh != null) // { // geometry geo = (COLLADA.MeshToGeometry(mesh)); // if (geo != null) // geometryList.Add(geo); // } //} //Debug.Log("Added liquid blocks"); //library_geometries geometryLib = new library_geometries(); //geometryLib.geometry = geometryList.ToArray(); //Debug.Log("Added geometry to library"); //library_visual_scenes visualSceneLib = new library_visual_scenes(); //visual_scene visualScene = new visual_scene(); //visualSceneLib.visual_scene = new visual_scene[1]; //visualSceneLib.visual_scene[0] = visualScene; //visualScene.id = "Map"; //visualScene.name = "Map"; //visualScene.node = new node[geometryList.Count]; //for (int i = 0; i < geometryList.Count; i++) //{ // node thisNode = new node(); // visualScene.node[i] = thisNode; // geometry thisGeometry = geometryList[i]; // thisNode.id = thisGeometry.id.Remove(thisGeometry.id.Length - 4); // thisNode.name = thisGeometry.name.Remove(thisGeometry.name.Length - 6); // thisNode.sid = thisNode.id; // thisNode.Items = new object[1]; // thisNode.Items[0] = COLLADA.ConvertMatrix(Matrix4x4.identity); // thisNode.ItemsElementName = new ItemsChoiceType2[1]; // thisNode.ItemsElementName[0] = ItemsChoiceType2.matrix; // thisNode.instance_geometry = new instance_geometry[1]; // thisNode.instance_geometry[0] = new instance_geometry(); // thisNode.instance_geometry[0].url = "#" + thisGeometry.id; //} //Debug.Log("Added geometry to scene"); //COLLADAScene sceneInstance = new COLLADAScene(); //sceneInstance.instance_visual_scene = new InstanceWithExtra(); //sceneInstance.instance_visual_scene.url = "#" + visualScene.id; //exportScene.scene = sceneInstance; //exportScene.Items = new object[2]; //exportScene.Items[0] = geometryLib; //exportScene.Items[1] = visualSceneLib; //asset assetHeader = new asset(); //assetHeader.unit = new assetUnit(); //assetHeader.unit.meter = 1; //assetHeader.unit.name = "meter"; //assetHeader.up_axis = UpAxisType.Y_UP; //exportScene.asset = assetHeader; //Debug.Log("Setup Scene"); //if (File.Exists("Map.dae")) // File.Delete("Map.dae"); //exportScene.Save("Map.dae"); //Debug.Log("Saved Scene"); //Texture2D mainTex = (Texture2D)BasicTerrainMaterial.GetTexture("_MainTex"); //Color[] mainTexPixels = mainTex.GetPixels(); //Color[] diffusePixels = new Color[mainTexPixels.Length]; //Color[] roughnessPixels = new Color[mainTexPixels.Length]; //for (int i = 0; i < mainTexPixels.Length; i++) //{ // diffusePixels[i] = new Color(mainTexPixels[i].r, mainTexPixels[i].g, mainTexPixels[i].b, 1.0f); // roughnessPixels[i] = new Color(mainTexPixels[i].a, mainTexPixels[i].a, mainTexPixels[i].a, 1.0f); //} //Texture2D diffuseTex = new Texture2D(mainTex.width, mainTex.height); //Texture2D roughnessTex = new Texture2D(mainTex.width, mainTex.height); //diffuseTex.SetPixels(diffusePixels); //roughnessTex.SetPixels(roughnessPixels); //diffuseTex.Apply(); //roughnessTex.Apply(); //byte[] diffuseBytes = diffuseTex.EncodeToPNG(); //byte[] roughnessBytes = roughnessTex.EncodeToPNG(); //File.WriteAllBytes("pattern.png", diffuseBytes); //File.WriteAllBytes("specular.png", roughnessBytes); //Debug.Log("Saved Maintex"); //Texture2D bumpMap = (Texture2D)BasicTerrainMaterial.GetTexture("_BumpMap"); //Color[] bumpMapPixels = bumpMap.GetPixels(); //Color[] normalMapPixels = new Color[bumpMapPixels.Length]; //Color[] ambientMapPixels = new Color[bumpMapPixels.Length]; //Color[] alphaMapPixels = new Color[bumpMapPixels.Length]; //for (int i = 0; i < bumpMapPixels.Length; i++) //{ // normalMapPixels[i] = new Color(bumpMapPixels[i].a, bumpMapPixels[i].g, Mathf.Sqrt(1 - ((bumpMapPixels[i].a * 2 - 1) * (bumpMapPixels[i].a * 2 - 1)) + ((bumpMapPixels[i].g * 2 - 1) * (bumpMapPixels[i].g * 2 - 1)))); // ambientMapPixels[i] = new Color(bumpMapPixels[i].r, bumpMapPixels[i].r, bumpMapPixels[i].r, 1.0f); // alphaMapPixels[i] = new Color(bumpMapPixels[i].b, bumpMapPixels[i].b, bumpMapPixels[i].b, 1.0f); //} //Texture2D normalTex = new Texture2D(bumpMap.width, bumpMap.height); //Texture2D ambientTex = new Texture2D(bumpMap.width, bumpMap.height); //Texture2D alphaTex = new Texture2D(bumpMap.width, bumpMap.height); //normalTex.SetPixels(normalMapPixels); //ambientTex.SetPixels(ambientMapPixels); //alphaTex.SetPixels(alphaMapPixels); //normalTex.Apply(); //ambientTex.Apply(); //alphaTex.Apply(); //byte[] normalBytes = normalTex.EncodeToPNG(); //byte[] ambientBytes = ambientTex.EncodeToPNG(); //byte[] alphaBytes = alphaTex.EncodeToPNG(); //File.WriteAllBytes("normal.png", normalBytes); //File.WriteAllBytes("occlusion.png", ambientBytes); //File.WriteAllBytes("alpha.png", alphaBytes); //Debug.Log("Saved DetailTex"); //Debug.Log("Saved map!"); } void OnDestroy() { if (mesher != null) { mesher.Terminate(); mesher = null; } } public void OpenURL(string url) { Application.OpenURL(url); } void UpdateView() { RemoteFortressReader.ViewInfo newView = DFConnection.Instance.PopViewInfoUpdate(); if (newView == null) return; if(!cameraMovement.following) return; UnityEngine.Profiling.Profiler.BeginSample("UpdateView", this); //Debug.Log("Got view"); view = newView; if (view.follow_unit_id != -1 && CreatureManager.Instance.Units != null) { int unitIndex = CreatureManager.Instance.Units.creature_list.FindIndex(x => x.id == view.follow_unit_id); if (unitIndex >= 0) { var unit = CreatureManager.Instance.Units.creature_list[unitIndex]; posXTile = unit.pos_x; posYTile = unit.pos_y; posZ = unit.pos_z + 1; return; } } posXTile = (view.view_pos_x + (view.view_size_x / 2)); posYTile = (view.view_pos_y + (view.view_size_y / 2)); posZ = view.view_pos_z + 1; UnityEngine.Profiling.Profiler.EndSample(); } // Update the region we're requesting void UpdateRequestRegion() { UnityEngine.Profiling.Profiler.BeginSample("UpdateRequestRegion", this); DFConnection.Instance.SetRequestRegion( new BlockCoord( PosXBlock - GameSettings.Instance.rendering.drawRangeSide, PosYBlock - GameSettings.Instance.rendering.drawRangeSide, posZ - GameSettings.Instance.rendering.drawRangeDown ), new BlockCoord( PosXBlock + GameSettings.Instance.rendering.drawRangeSide, PosYBlock + GameSettings.Instance.rendering.drawRangeSide, posZ + GameSettings.Instance.rendering.drawRangeUp )); UnityEngine.Profiling.Profiler.EndSample(); } void UpdateBlocks() { if (DFConnection.Instance.EmbarkMapSize != mapSize) { ClearMap(); InitializeBlocks(); mapSize = DFConnection.Instance.EmbarkMapSize; DFConnection.Instance.RequestMapReset(); } if (DFConnection.Instance.EmbarkMapPosition != mapPosition) { ClearMap(); mapPosition = DFConnection.Instance.EmbarkMapPosition; MapZOffset = DFConnection.Instance.EmbarkMapPosition.z; DFConnection.Instance.RequestMapReset(); } if (MapDataStore.MapSize.x < 48) return; BuildingManager.Instance.BeginExistenceCheck(); ItemManager.Instance.BeginExistenceCheck(); UnityEngine.Profiling.Profiler.BeginSample("UpdateBlocks", this); MapBlock block; if(DFConnection.Instance.UpdatedAnyBlocks) { FlowManager.Instance.Clear(); DFConnection.Instance.UpdatedAnyBlocks = false; } while((block = DFConnection.Instance.PopMapBlockUpdate()) != null) { bool setTiles; bool setLiquids; bool setSpatters; UnityEngine.Profiling.Profiler.BeginSample("StoreTiles", this); MapDataStore.StoreTiles(block, out setTiles, out setLiquids, out setSpatters); UnityEngine.Profiling.Profiler.EndSample(); if (setTiles) { addSeasonalUpdates(block, block.map_x, block.map_y, block.map_z); SetDirtyBlock(block.map_x, block.map_y, block.map_z); SetBlockContent(block.map_x, block.map_y, block.map_z); } if (setLiquids) { SetDirtyLiquidBlock(block.map_x, block.map_y, block.map_z); SetBlockContent(block.map_x, block.map_y, block.map_z); } if (setSpatters) { SetDirtySpatterBlock(block.map_x, block.map_y, block.map_z); } //foreach (var item in block.items) //{ // ///Send it to item manager later. //} UnityEngine.Profiling.Profiler.BeginSample("BuildingManager.LoadBlock", this); BuildingManager.Instance.LoadBlock(block); UnityEngine.Profiling.Profiler.EndSample(); UnityEngine.Profiling.Profiler.BeginSample("ItemManager.LoadBlock", this); ItemManager.Instance.LoadBlock(block); UnityEngine.Profiling.Profiler.EndSample(); FlowManager.Instance[new DFCoord(block.map_x, block.map_y, block.map_z)] = block.flows; //Add tile fires to flows directly. List<FlowInfo> tileFlows = null; if(block.tiles != null && block.tiles.Count == 256) { for(int x = 0; x < 16; x++) for(int y = 0; y < 16; y++) { int index = y * 16 + x; var tile = DFConnection.Instance.NetTiletypeList.tiletype_list[block.tiles[index]]; if(tile.material == TiletypeMaterial.CAMPFIRE || tile.material == TiletypeMaterial.FIRE) { FlowInfo flow = new FlowInfo(); flow.type = FlowType.Fire; if (tile.material == TiletypeMaterial.CAMPFIRE) flow.type = FlowType.CampFire; else flow.type = FlowType.Fire; flow.density = 100; flow.pos = new DFCoord(block.map_x + x, block.map_y + y, block.map_z); if (tileFlows == null) tileFlows = new List<FlowInfo>(); tileFlows.Add(flow); } } FlowManager.Instance.SetTileFlows(new DFCoord(block.map_x, block.map_y, block.map_z), tileFlows); } } BuildingManager.Instance.EndExistenceCheck(); ItemManager.Instance.EndExitenceCheck(); DirtySeasonalBlocks(); UnityEngine.Profiling.Profiler.BeginSample("EnqueueMeshUpdates", this); EnqueueMeshUpdates(); UnityEngine.Profiling.Profiler.EndSample(); mesher.Poll(); FetchNewMeshes(); UnityEngine.Profiling.Profiler.EndSample(); } void SetMaterialBounds(Vector4 bounds) { MaterialManager.Instance.SetVector("_WorldBounds", bounds); } void InitializeBlocks() { int blockSizeX = DFConnection.Instance.EmbarkMapSize.x; int blockSizeY = DFConnection.Instance.EmbarkMapSize.y; int blockSizeZ = DFConnection.Instance.EmbarkMapSize.z; MapZOffset = DFConnection.Instance.EmbarkMapPosition.z; mapMeshes = new BlockMeshSet[blockSizeX * 16 / blockSize, blockSizeY * 16 / blockSize, blockSizeZ]; blockDirtyBits = new bool[blockSizeX * 16 / blockSize, blockSizeY * 16 / blockSize, blockSizeZ]; blockContentBits = new bool[blockSizeX * 16 / blockSize, blockSizeY * 16 / blockSize, blockSizeZ]; blockUpdateSchedules = new UpdateSchedule[blockSizeX * 16 / blockSize, blockSizeY * 16 / blockSize, blockSizeZ]; liquidBlockDirtyBits = new bool[blockSizeX * 16 / blockSize, blockSizeY * 16 / blockSize, blockSizeZ]; magmaGlow = new Light[blockSizeX * 16, blockSizeY * 16, blockSizeZ]; SplatManager.Instance.Init(blockSizeX * 16 / blockSize, blockSizeY * 16 / blockSize, blockSizeZ); Vector3 min = DFtoUnityCoord(0, 0, 0) - new Vector3(tileWidth / 2, 0, -tileWidth / 2); Vector3 max = DFtoUnityCoord((blockSizeX * 16) - 1, (blockSizeY * 16) - 1, 0) + new Vector3(tileWidth / 2, 0, -tileWidth / 2); SetMaterialBounds(new Vector4(min.x, min.z, max.x, max.z)); } void addSeasonalUpdates(MapBlock block, int mapBlockX, int mapBlockY, int mapBlockZ) { if (DFConnection.Instance.NetPlantRawList == null) return; mapBlockX /= blockSize; mapBlockY /= blockSize; if (blockUpdateSchedules[mapBlockX, mapBlockY, mapBlockZ] != null) blockUpdateSchedules[mapBlockX, mapBlockY, mapBlockZ].Clear(); foreach (var material in block.materials) { if (material.mat_type != 419 || material.mat_index < 0 || DFConnection.Instance.NetPlantRawList.plant_raws.Count <= material.mat_index || DFConnection.Instance.NetPlantRawList.plant_raws[material.mat_index].growths.Count == 0) continue; PlantRaw plantRaw = DFConnection.Instance.NetPlantRawList.plant_raws[material.mat_index]; if (blockUpdateSchedules[mapBlockX, mapBlockY, mapBlockZ] == null) blockUpdateSchedules[mapBlockX, mapBlockY, mapBlockZ] = new UpdateSchedule(); var schedule = blockUpdateSchedules[mapBlockX, mapBlockY, mapBlockZ]; foreach (TreeGrowth growth in plantRaw.growths) { schedule.Add(growth.timing_start); schedule.Add(growth.timing_end); foreach (GrowthPrint print in growth.prints) { schedule.Add(print.timing_start); schedule.Add(print.timing_end); } } } } void SetDirtyBlock(int mapBlockX, int mapBlockY, int mapBlockZ) { mapBlockX /= blockSize; mapBlockY /= blockSize; blockDirtyBits[mapBlockX, mapBlockY, mapBlockZ] = true; SplatManager.Instance.DirtyGrass(mapBlockX, mapBlockY, mapBlockZ); SplatManager.Instance.DirtyLayer(mapBlockX, mapBlockY, mapBlockZ); if (mapBlockZ < SplatManager.Instance.SizeZ - 1) { SplatManager.Instance.DirtyGrass(mapBlockX, mapBlockY, mapBlockZ + 1); SplatManager.Instance.DirtyLayer(mapBlockX, mapBlockY, mapBlockZ + 1); } } void SetBlockContent(int mapBlockX, int mapBlockY, int mapBlockZ) { mapBlockX /= blockSize; mapBlockY /= blockSize; blockContentBits[mapBlockX, mapBlockY, mapBlockZ] = true; } void SetDirtyLiquidBlock(int mapBlockX, int mapBlockY, int mapBlockZ) { mapBlockX /= blockSize; mapBlockY /= blockSize; liquidBlockDirtyBits[mapBlockX, mapBlockY, mapBlockZ] = true; } private void SetDirtySpatterBlock(int map_x, int map_y, int map_z) { map_x /= blockSize; map_y /= blockSize; SplatManager.Instance.DirtySpatter(map_x, map_y, map_z); } #region Debug Data Saving void PrintFullMaterialList() { int totalCount = DFConnection.Instance.NetMaterialList.material_list.Count; int limit = totalCount; if (limit >= 100) limit = 100; //Don't ever do this. for (int i = totalCount - limit; i < totalCount; i++) { //no really, don't. RemoteFortressReader.MaterialDefinition material = DFConnection.Instance.NetMaterialList.material_list[i]; Debug.Log("{" + material.mat_pair.mat_index + "," + material.mat_pair.mat_type + "}, " + material.id + ", " + material.name); } } void SaveTileTypeList() { if (DFConnection.Instance.NetTiletypeList == null) return; string fileName = Path.Combine(Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.MyDocuments), Application.productName), "TiletypeList.csv"); try { File.Delete(fileName); } catch (IOException) { return; } using (StreamWriter writer = new StreamWriter(fileName)) { foreach (Tiletype item in DFConnection.Instance.NetTiletypeList.tiletype_list) { writer.WriteLine( item.id + "," + "\"" + item.name + "\"," + item.shape + ":" + item.special + ":" + item.material + ":" + item.variant + ":" + item.direction ); } } } void SaveBuildingList() { if (DFConnection.Instance.NetBuildingList == null) return; string fileName = Path.Combine(Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.MyDocuments), Application.productName), "BuildingList.csv"); try { File.Delete(fileName); } catch (IOException) { return; } using (StreamWriter writer = new StreamWriter(fileName)) { foreach (var item in DFConnection.Instance.NetBuildingList.building_list) { writer.WriteLine("\"" + item.name + "\",\"" + item.id + "\"," + item.building_type.building_type + ":" + item.building_type.building_subtype + ":" + item.building_type.building_custom ); } } } class ListContainer { public List<MaterialDefinition> list = new List<MaterialDefinition>(); } void SaveMaterialList(IEnumerable<KeyValuePair<MatPairStruct, MaterialDefinition>> list, string filename) { string jsonFile = Path.ChangeExtension(filename, "json"); try { File.Delete(filename); File.Delete(jsonFile); } catch (IOException) { return; } ListContainer container = new ListContainer(); using (StreamWriter writer = new StreamWriter(filename)) { foreach (var item in list) { writer.WriteLine("\"" + item.Value.name + "\",\"" + item.Value.id + "\"," + item.Value.mat_pair.mat_type + "," + item.Value.mat_pair.mat_index ); container.list.Add(item.Value); } } File.WriteAllText(jsonFile, Newtonsoft.Json.JsonConvert.SerializeObject(container, Newtonsoft.Json.Formatting.Indented)); } void SavePlantList() { if (DFConnection.Instance.NetPlantRawList == null) return; string fileName = Path.Combine(Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.MyDocuments), Application.productName), "PlantList.csv"); try { File.Delete(fileName); } catch (IOException) { return; } using (StreamWriter writer = new StreamWriter(fileName)) { foreach (var plant in TokenLists.PlantTokenList.GrowthIDs) { foreach (var growth in plant.Value) { foreach (var print in growth.Value) { writer.Write("\""); writer.Write(plant.Key); writer.Write("\",\""); writer.Write(growth.Key); writer.Write("\",\""); writer.Write(print.Key); writer.Write("\",\""); writer.Write(print.Value); writer.Write("\""); //var index = print.Value; //if (index.building_type >= 0) //{ // PlantRaw plantRaw = DFConnection.Instance.NetPlantRawList.plant_raws[index.building_type]; // if (index.building_type >= 0 && index.building_subtype >= 0 && index.building_custom >= 0) // { // var printRaw = plantRaw.growths[index.building_subtype].prints[index.building_custom]; // writer.Write(CharacterConverter.Convert((byte)printRaw.tile)); // } // else // { // writer.Write(CharacterConverter.Convert((byte)plantRaw.tile)); // } //} writer.WriteLine(); } } } } } #endregion void DirtySeasonalBlocks() { int xmin = Mathf.Clamp(PosXBlock - GameSettings.Instance.rendering.drawRangeSide, 0, mapMeshes.GetLength(0)); int xmax = Mathf.Clamp(PosXBlock + GameSettings.Instance.rendering.drawRangeSide, 0, mapMeshes.GetLength(0)); int ymin = Mathf.Clamp(PosYBlock - GameSettings.Instance.rendering.drawRangeSide, 0, mapMeshes.GetLength(1)); int ymax = Mathf.Clamp(PosYBlock + GameSettings.Instance.rendering.drawRangeSide, 0, mapMeshes.GetLength(1)); int zmin = Mathf.Clamp(posZ - GameSettings.Instance.rendering.drawRangeDown, 0, mapMeshes.GetLength(2)); int zmax = Mathf.Clamp(posZ + GameSettings.Instance.rendering.drawRangeUp, 0, mapMeshes.GetLength(2)); for (int zz = zmin; zz < zmax; zz++) for (int yy = ymin; yy < ymax; yy++) for (int xx = xmin; xx < xmax; xx++) { if (blockUpdateSchedules[xx, yy, zz] != null && blockUpdateSchedules[xx, yy, zz].CheckUpdate(TimeHolder.DisplayedTime.CurrentYearTicks)) blockDirtyBits[xx, yy, zz] = true; } } // Have the mesher mesh all dirty tiles in the region void EnqueueMeshUpdates() { int queueCount = 0; int xmin = Mathf.Clamp(PosXBlock - GameSettings.Instance.rendering.drawRangeSide + 1, 0, mapMeshes.GetLength(0)); int xmax = Mathf.Clamp(PosXBlock + GameSettings.Instance.rendering.drawRangeSide, 0, mapMeshes.GetLength(0)); int ymin = Mathf.Clamp(PosYBlock - GameSettings.Instance.rendering.drawRangeSide + 1, 0, mapMeshes.GetLength(1)); int ymax = Mathf.Clamp(PosYBlock + GameSettings.Instance.rendering.drawRangeSide, 0, mapMeshes.GetLength(1)); int zmin = Mathf.Clamp(posZ - GameSettings.Instance.rendering.drawRangeDown, 0, mapMeshes.GetLength(2)); int zmax = Mathf.Clamp(posZ + GameSettings.Instance.rendering.drawRangeUp, 0, mapMeshes.GetLength(2)); if (PosXBlock >= 0 && PosXBlock < mapMeshes.GetLength(0) && PosYBlock >= 0 && PosYBlock < mapMeshes.GetLength(1)) for (int zz = posZ - 1; zz >= zmin; zz--) { if (zz >= mapMeshes.GetLength(2)) continue; if (!blockDirtyBits[PosXBlock, PosYBlock, zz] && !liquidBlockDirtyBits[PosXBlock, PosYBlock, zz]) { continue; } if (!(zz == posZ - 1) && MapDataStore.IsFullyHidden(PosXBlock, PosYBlock, zz)) continue; //If we were not able to add it to the queue, don't try any more till next fame. if (!mesher.Enqueue(new DFCoord(PosXBlock * 16, PosYBlock * 16, zz), blockDirtyBits[PosXBlock, PosYBlock, zz], liquidBlockDirtyBits[PosXBlock, PosYBlock, zz])) return; blockDirtyBits[PosXBlock, PosYBlock, zz] = false; liquidBlockDirtyBits[PosXBlock, PosYBlock, zz] = false; queueCount++; if (queueCount > GameSettings.Instance.meshing.queueLimit) return; } for (int zz = posZ - 1; zz >= zmin; zz--) { if (zz >= mapMeshes.GetLength(2)) continue; for (int yy = ymin; yy < ymax; yy++) for (int xx = xmin; xx < xmax; xx++) { if (!blockDirtyBits[xx, yy, zz] && !liquidBlockDirtyBits[xx, yy, zz]) { continue; } if (!(zz == posZ - 1) && MapDataStore.IsFullyHidden(PosXBlock, PosYBlock, zz)) continue; //If we were not able to add it to the queue, don't try any more till next fame. if (!mesher.Enqueue(new DFCoord(xx * 16, yy * 16, zz), blockDirtyBits[xx, yy, zz], liquidBlockDirtyBits[xx, yy, zz])) return; blockDirtyBits[xx, yy, zz] = false; liquidBlockDirtyBits[xx, yy, zz] = false; queueCount++; if (queueCount > GameSettings.Instance.meshing.queueLimit) return; } } for (int zz = posZ; zz < zmax; zz++) { if (zz < 0) continue; for (int yy = ymin; yy < ymax; yy++) for (int xx = xmin; xx < xmax; xx++) { if (!blockDirtyBits[xx, yy, zz] && !liquidBlockDirtyBits[xx, yy, zz]) { continue; } if (MapDataStore.IsFullyHidden(PosXBlock, PosYBlock, zz)) continue; //If we were not able to add it to the queue, don't try any more till next fame. if (!mesher.Enqueue(new DFCoord(xx * 16, yy * 16, zz), blockDirtyBits[xx, yy, zz], liquidBlockDirtyBits[xx, yy, zz])) return; blockDirtyBits[xx, yy, zz] = false; liquidBlockDirtyBits[xx, yy, zz] = false; queueCount++; if (queueCount > GameSettings.Instance.meshing.queueLimit) return; } } } private BlockMeshSet blockPrefab; // Get new meshes from the mesher void FetchNewMeshes() { UnityEngine.Profiling.Profiler.BeginSample("FetchNewMeshes", this); while (mesher.HasNewMeshes) { if (blockPrefab == null) blockPrefab = Resources.Load<BlockMeshSet>("MapBlock"); var newMeshes = mesher.Dequeue().Value; int block_x = newMeshes.location.x / blockSize; int block_y = newMeshes.location.y / blockSize; int block_z = newMeshes.location.z; if (mapMeshes[block_x, block_y, block_z] == null) { mapMeshes[block_x, block_y, block_z] = Instantiate(blockPrefab, DFtoUnityCoord(newMeshes.location), Quaternion.identity, transform); mapMeshes[block_x, block_y, block_z].name = string.Format("Block_{0}_{1}_{2}", block_x, block_y, block_z); mapMeshes[block_x, block_y, block_z].Init(); SplatManager.Instance.ApplyTerrain(mapMeshes[block_x, block_y, block_z], block_z); SplatManager.Instance.ApplyGrass(mapMeshes[block_x, block_y, block_z], block_z); SplatManager.Instance.ApplySpatter(mapMeshes[block_x, block_y, block_z], block_z); } var meshSet = mapMeshes[block_x, block_y, block_z]; meshSet.LoadMeshes(newMeshes, string.Format("{0}_{1}_{2}", block_x, block_y, block_z)); meshSet.UpdateVisibility(GetVisibility(block_z)); if (newMeshes.collisionMesh != null) { Mesh collisionMesh = new Mesh(); collisionMesh.name = string.Format("block_collision_{0}_{1}_{2}", block_x, block_y, block_z); newMeshes.collisionMesh.CopyToMesh(collisionMesh); meshSet.collisionBlocks.sharedMesh = null; meshSet.collisionBlocks.sharedMesh = collisionMesh; } } UnityEngine.Profiling.Profiler.EndSample(); } void ClearMap() { foreach (var item in mapMeshes) { if (item != null) item.Clear(); } foreach (var item in magmaGlow) { Destroy(item); } CreatureManager.Instance.Clear(); if (MapDataStore.Main != null) MapDataStore.Main.Reset(); } void ShowCursorInfo() { if (MapDataStore.Main == null) return; //No UnityEngine.Profiling.Profiler.BeginSample("ShowCursorInfo", this); StringBuilder statusText = new StringBuilder(); if (cursX >= 0 && cursY >= 0 && cursZ >= 0 && GameSettings.Instance.debug.drawDebugInfo) { statusText.Append("Cursor: "); statusText.Append(cursX).Append(","); statusText.Append(cursY).Append(","); statusText.Append(cursZ).AppendLine(); var tile = MapDataStore.Main[cursX, cursY, cursZ]; if (tile != null) { statusText.Append("Tiletype:\n"); var tiletype = DFConnection.Instance.NetTiletypeList.tiletype_list [tile.tileType]; statusText.Append(tiletype.name).AppendLine(); statusText.Append( tiletype.shape).Append(":").Append( tiletype.special).Append(":").Append( tiletype.material).Append(":").Append( tiletype.variant).Append(":").Append( tiletype.direction).AppendLine(); statusText.Append("Tree: ").Append(tile.positionOnTree).Append(" (").Append(tile.trunkPercent).Append("%)").AppendLine(); statusText.Append("Desingation: ").Append(tile.digDesignation).AppendLine(); if (tile.Hidden) statusText.Append("Hidden").AppendLine(); statusText.Append(tile.WallBuildingSides).AppendLine(); var mat = tile.material; statusText.Append("Material: "); statusText.Append(mat); if (materials.ContainsKey(mat)) { statusText.Append(", "); statusText.Append(materials[mat].id).AppendLine(); } else statusText.AppendLine(); var basemat = tile.base_material; statusText.Append("Base Material: "); statusText.Append(basemat); if (materials.ContainsKey(basemat)) { statusText.Append(", "); statusText.Append(materials[basemat].id).AppendLine(); } else statusText.Append("Unknown Base Material\n"); var layermat = tile.layer_material; statusText.Append("Layer Material: "); statusText.Append(layermat); if (materials.ContainsKey(layermat)) { statusText.Append(", "); statusText.Append(materials[layermat].id).AppendLine(); } else statusText.Append("Unknown Layer Material\n"); var veinmat = tile.vein_material; statusText.Append("Vein Material: "); statusText.Append(veinmat); if (materials.ContainsKey(veinmat)) { statusText.Append(", "); statusText.Append(materials[veinmat].id).AppendLine(); } else statusText.Append("Unknown Vein Material\n"); var cons = tile.construction_item; statusText.Append("Construction Item: "); statusText.Append(cons); if (items.ContainsKey(cons)) { statusText.Append(", "); statusText.Append(items[cons].id).AppendLine(); } else statusText.Append("Unknown Construction Item\n"); statusText.AppendLine(); statusText.Append(Building.BuildingManager.Instance.GetBuildingInfoText(new DFCoord(cursX, cursY, cursZ))); if (tile.spatters != null) foreach (var spatter in tile.spatters) { string matString = ((MatPairStruct)spatter.material).ToString(); if (materials.ContainsKey(spatter.material)) matString = materials[spatter.material].id; if (spatter.item != null) { string item = ((MatPairStruct)spatter.item).ToString(); if (spatter.item.mat_type == 55)//Plant Growth { item = DFConnection.Instance.NetPlantRawList.plant_raws[spatter.material.mat_index].growths[spatter.item.mat_index].id; } else if (items.ContainsKey(spatter.item)) item = items[spatter.item].id; else if (items.ContainsKey(new MatPairStruct(spatter.item.mat_type, -1))) item = items[new MatPairStruct(spatter.item.mat_type, -1)].id; statusText.AppendFormat("{0} {1}: {2}", matString, item, spatter.amount).AppendLine(); } else statusText.AppendFormat("{0} {1}: {2}", matString, spatter.state, spatter.amount).AppendLine(); } } if (CreatureManager.Instance.Units != null) { UnitDefinition foundUnit = null; foreach (UnitDefinition unit in CreatureManager.Instance.Units.creature_list) { UnitFlags1 flags1 = (UnitFlags1)unit.flags1; if (((flags1 & UnitFlags1.dead) == UnitFlags1.dead) || ((flags1 & UnitFlags1.left) == UnitFlags1.left) || ((flags1 & UnitFlags1.caged) == UnitFlags1.caged) || ((flags1 & UnitFlags1.forest) == UnitFlags1.forest) ) continue; if (unit.pos_x == cursX && unit.pos_y == cursY && unit.pos_z == cursZ) { foundUnit = unit; if ((flags1 & UnitFlags1.on_ground) == UnitFlags1.on_ground) continue; // Keep looking until we find a standing unit. else break; } } if (foundUnit != null) { UnitFlags1 flags1 = (UnitFlags1)foundUnit.flags1; UnitFlags2 flags2 = (UnitFlags2)foundUnit.flags2; CreatureRaw creatureRaw = null; if (DFConnection.Instance.CreatureRaws != null) creatureRaw = DFConnection.Instance.CreatureRaws[foundUnit.race.mat_type]; if (creatureRaw != null) { statusText.Append("Unit: \n"); statusText.Append("Race: "); statusText.Append(creatureRaw.creature_id + ":"); statusText.Append(creatureRaw.caste[foundUnit.race.mat_index].caste_id); statusText.AppendLine(); statusText.Append(flags1).AppendLine(); statusText.Append(flags2).AppendLine(); //statusText.Append(flags3).AppendLine(); statusText.Append("Length: ").Append(foundUnit.size_info.length_cur).Append("/").Append(Mathf.FloorToInt(Mathf.Pow(creatureRaw.adultsize * 10000, 1.0f / 3.0f))).AppendLine(); statusText.Append("Profession: ").Append((profession)foundUnit.profession_id).AppendLine(); foreach (var noble in foundUnit.noble_positions) { statusText.Append(noble).Append(", "); } statusText.AppendLine(); } } } //if (itemPositions.ContainsKey(new DFCoord(cursX, cursY, cursZ))) //{ // for (int itemIndex = 0; itemIndex < itemPositions[new DFCoord(cursX, cursY, cursZ)].Count && itemIndex < 5; itemIndex++) // { // var item = itemPositions[new DFCoord(cursX, cursY, cursZ)][itemIndex]; // statusText.Append("Item ").Append(item.id).Append(": "); // if (materials.ContainsKey(item.material)) // statusText.Append(materials[item.material].id); // else // statusText.Append(((MatPairStruct)item.material).ToString()); // statusText.Append(" "); // if (items.ContainsKey(item.type)) // statusText.Append(items[item.type].id); // statusText.Append("(").Append(((MatPairStruct)item.type)).Append(")"); // statusText.AppendLine(); // } // if (itemPositions[new DFCoord(cursX, cursY, cursZ)].Count > 4) // statusText.Append(itemPositions[new DFCoord(cursX, cursY, cursZ)].Count - 4).Append(" items more."); //} } cursorProperties.text = statusText.ToString(); UnityEngine.Profiling.Profiler.EndSample(); } private int screenshotCount; public void UpdateCenter(Vector3 pos) { if(cameraMovement.following) return; DFCoord dfPos = UnityToDFCoord(pos); posXTile = dfPos.x; posYTile = dfPos.y; posZ = dfPos.z + 1; } public ParticleSystem itemParticleSystem; public GameObject mapWindow; public GameObject mapCamera; public Canvas mainUI; //ParticleSystem.Particle[] itemParticles; //Dictionary<int, ParticleSystem> customItemParticleSystems = new Dictionary<int, ParticleSystem>(); //Dictionary<int, ParticleSystem.Particle[]> customItemParticles = new Dictionary<int, ParticleSystem.Particle[]>(); //Dictionary<int, int> customItemParticleCount = new Dictionary<int, int>(); //Dictionary<int, bool> noCustomParticleColor = new Dictionary<int, bool>(); //OpenSimplexNoise noise = new OpenSimplexNoise(); //void DrawItems() //{ // return; // if (ContentLoader.Instance == null) // return; // UnityEngine.Profiling.Profiler.BeginSample("DrawItems", this); // if (itemParticles == null) // { // itemParticles = new ParticleSystem.Particle[itemParticleSystem.main.maxParticles]; // } // MapDataStore.Tile tempTile = new MapDataStore.Tile(null, new DFCoord(0, 0, 0)); // int i = 0; // foreach (var count in customItemParticleSystems) // { // customItemParticleCount[count.Key] = 0; // } // foreach (var item in itemPositions) // { // var pos = item.Key; // if (!(pos.z < PosZ && pos.z >= (PosZ - GameSettings.Instance.rendering.drawRangeDown))) // continue; // for (int index = 0; index < item.Value.Count && index < 100; index++) // { // var currentItem = item.Value[index]; // tempTile.material = currentItem.material; // tempTile.construction_item = currentItem.type; // ColorContent colorContent; // MeshContent meshContent; // var part = new ParticleSystem.Particle(); // part.startSize = 1; // part.position = DFtoUnityCoord(currentItem.pos) + new Vector3(0, floorHeight + 0.1f, 0) + Stacker.SpiralHemisphere(index); // if (ContentLoader.Instance.ColorConfiguration.GetValue(tempTile, MeshLayer.StaticMaterial, out colorContent)) // part.startColor = colorContent.color; // else if (materials.ContainsKey(currentItem.material) && materials[currentItem.material].state_color != null) // { // var stateColor = materials[currentItem.material].state_color; // part.startColor = new Color32((byte)stateColor.red, (byte)stateColor.green, (byte)stateColor.blue, 255); // } // else // part.startColor = Color.gray; // if (currentItem.dye != null) // { // part.startColor *= (Color)(new Color32((byte)currentItem.dye.red, (byte)currentItem.dye.green, (byte)currentItem.dye.blue, 255)); // } // if (ContentLoader.Instance.ItemMeshConfiguration != null && ContentLoader.Instance.ItemMeshConfiguration.GetValue(tempTile, MeshLayer.StaticMaterial, out meshContent)) // { // ParticleSystem partSys; // if (!customItemParticleSystems.ContainsKey(meshContent.UniqueIndex)) // { // partSys = Instantiate(itemParticleSystem); // partSys.transform.parent = transform; // var renderer = partSys.GetComponent<ParticleSystemRenderer>(); // Mesh mesh = new Mesh(); // if (meshContent.MeshData.ContainsKey(MeshLayer.StaticCutout)) // { // meshContent.MeshData[MeshLayer.StaticCutout].CopyToMesh(mesh); // noCustomParticleColor[meshContent.UniqueIndex] = false; // } // else if (meshContent.MeshData.ContainsKey(MeshLayer.NoMaterialCutout)) // { // meshContent.MeshData[MeshLayer.NoMaterialCutout].CopyToMesh(mesh); // noCustomParticleColor[meshContent.UniqueIndex] = true; // } // else // { // bool copied = false; // foreach (var backup in meshContent.MeshData) // { // backup.Value.CopyToMesh(mesh); // noCustomParticleColor[meshContent.UniqueIndex] = false; // copied = true; // break; // } // if (!copied) // continue; // } // renderer.mesh = mesh; // if (meshContent.MaterialTexture != null) // renderer.material.SetTexture("_MainTex", meshContent.MaterialTexture.Texture); // else // { // TextureContent texCon; // if (ContentLoader.Instance.MaterialTextureConfiguration.GetValue(tempTile, MeshLayer.StaticMaterial, out texCon)) // renderer.material.SetTexture("_MainTex", texCon.Texture); // } // if (meshContent.ShapeTexture != null) // renderer.material.SetTexture("_BumpMap", meshContent.ShapeTexture.Texture); // else // { // NormalContent normalCon; // if (ContentLoader.Instance.ShapeTextureConfiguration.GetValue(tempTile, MeshLayer.StaticMaterial, out normalCon)) // renderer.material.SetTexture("_BumpMap", normalCon.Texture); // } // if (meshContent.SpecialTexture != null) // renderer.material.SetTexture("_SpecialTex", meshContent.SpecialTexture.Texture); // customItemParticleSystems[meshContent.UniqueIndex] = partSys; // customItemParticles[meshContent.UniqueIndex] = new ParticleSystem.Particle[partSys.main.maxParticles]; // customItemParticleCount[meshContent.UniqueIndex] = 0; // } // if (meshContent.Rotation == RotationType.Random) // part.rotation = (float)noise.eval(pos.x, pos.y, pos.z) * 360; // part.rotation += index * 254.558f; // if (noCustomParticleColor[meshContent.UniqueIndex]) // part.startColor = Color.gray; // customItemParticles[meshContent.UniqueIndex][customItemParticleCount[meshContent.UniqueIndex]] = part; // customItemParticleCount[meshContent.UniqueIndex]++; // } // else // { // itemParticles[i] = part; // i++; // } // } // } // itemParticleSystem.SetParticles(itemParticles, i); // foreach (var sys in customItemParticleSystems) // { // sys.Value.SetParticles(customItemParticles[sys.Key], customItemParticleCount[sys.Key]); // } // UnityEngine.Profiling.Profiler.EndSample(); //} }
40.774021
228
0.556622
[ "MIT" ]
alexchandel/armok-vision
Assets/Scripts/MapGen/GameMap.cs
68,745
C#
//----------------------------------------------------------------------- // <copyright company="CoApp Project"> // Copyright (c) 2010-2013 Garrett Serack and CoApp Contributors. // Contributors can be discovered using the 'git log' command. // All rights reserved. // </copyright> // <license> // The software is licensed under the Apache 2.0 License (the "License") // You may not use the software except in compliance with the License. // </license> //----------------------------------------------------------------------- namespace ClrPlus.Core.Linq.Serialization.Xml { using System.Linq.Expressions; using System.Xml.Linq; public abstract class CustomExpressionXmlConverter { public abstract bool TryDeserialize(XElement expressionXml, out Expression e); public abstract bool TrySerialize(Expression expression, out XElement x); } }
43.52381
87
0.586433
[ "Apache-2.0" ]
Jaykul/clrplus
Core/Linq/Serialization/Xml/CustomExpressionXmlConverter.cs
914
C#
/* * Copyright 2018 JDCLOUD.COM * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http:#www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * * * * * Contact: * * NOTE: This class is auto generated by the jdcloud code generator program. */ using System; using System.Collections.Generic; using System.Text; namespace JDCloudSDK.Jdfusion.Model { /// <summary> /// vpcEipCreateTask /// </summary> public class VpcEipCreateTask { ///<summary> /// Task ///</summary> public ResourceTFInfo Task{ get; set; } } }
22.478261
76
0.675048
[ "Apache-2.0" ]
jdcloud-api/jdcloud-sdk-net
sdk/src/Service/Jdfusion/Model/VpcEipCreateTask.cs
1,034
C#
using System; using System.Xml.Serialization; namespace BroadWorksConnector.Ocip.Models { /// <summary> /// Calling Line ID Policy Selections. /// NOTE: The "Use Group CLID" value indicates the department CLID will be used if available otherwise the group CLID is used. /// </summary> [Serializable] [XmlRoot(Namespace = "")] public enum GroupCLIDPolicy { [XmlEnum(Name = "Use DN")] UseDN, [XmlEnum(Name = "Use Configurable CLID")] UseConfigurableCLID, [XmlEnum(Name = "Use Group CLID")] UseGroupCLID, } }
26.909091
131
0.633446
[ "MIT" ]
JTOne123/broadworks-connector-net
BroadworksConnector/Ocip/Models/GroupCLIDPolicy.cs
592
C#
// Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; using System.Collections.Generic; using System.ComponentModel; using System.Linq; using System.Web.Http.Dependencies; using Microsoft.AspNet.WebHooks.Config; using Microsoft.AspNet.WebHooks.Diagnostics; using Microsoft.AspNet.WebHooks.Services; namespace Microsoft.AspNet.WebHooks { /// <summary> /// Extension methods for <see cref="System.Web.Http.Dependencies.IDependencyScope"/> facilitating getting the services used. /// </summary> [EditorBrowsable(EditorBrowsableState.Never)] public static class DependencyScopeExtensions { /// <summary> /// Gets an <see cref="ILogger"/> implementation registered with the Dependency Injection engine /// or a default <see cref="System.Diagnostics.Trace"/> implementation if none are registered. /// </summary> /// <param name="services">The <see cref="IDependencyScope"/> implementation.</param> /// <returns>The registered <see cref="ILogger"/> instance or a default implementation if none are registered.</returns> public static ILogger GetLogger(this IDependencyScope services) { ILogger logger = services.GetService<ILogger>(); return logger ?? CommonServices.GetLogger(); } /// <summary> /// Gets a <see cref="SettingsDictionary"/> instance registered with the Dependency Injection engine /// or a default implementation based on application settings if none are registered. /// </summary> /// <param name="services">The <see cref="IDependencyScope"/> implementation.</param> /// <returns>The registered <see cref="SettingsDictionary"/> instance or a default implementation if none are registered.</returns> public static SettingsDictionary GetSettings(this IDependencyScope services) { SettingsDictionary settings = services.GetService<SettingsDictionary>(); return settings != null && settings.Count > 0 ? settings : CommonServices.GetSettings(); } /// <summary> /// Gets the <typeparamref name="TService"/> instance registered with the Dependency Injection engine or /// null if none are registered. /// </summary> /// <typeparam name="TService">The type of services to lookup.</typeparam> /// <param name="services">The <see cref="IDependencyScope"/> implementation.</param> /// <returns>The registered instance or null if none are registered.</returns> public static TService GetService<TService>(this IDependencyScope services) { if (services == null) { throw new ArgumentNullException(nameof(services)); } return (TService)services.GetService(typeof(TService)); } /// <summary> /// Gets the set of <typeparamref name="TService"/> instances registered with the Dependency Injection engine /// or an empty collection if none are registered. /// </summary> /// <typeparam name="TService">The type of services to lookup.</typeparam> /// <param name="services">The <see cref="IDependencyScope"/> implementation.</param> /// <returns>An <see cref="IEnumerable{T}"/> containing the registered instances.</returns> public static IEnumerable<TService> GetServices<TService>(this IDependencyScope services) { if (services == null) { throw new ArgumentNullException(nameof(services)); } return services.GetServices(typeof(TService)).Cast<TService>(); } } }
48.063291
139
0.663682
[ "Apache-2.0" ]
Mythz123/AspNetWebHooks
src/Microsoft.AspNet.WebHooks.Common/Extensions/DependencyScopeExtensions.cs
3,799
C#
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ShikiApiLib { /// <include file='Docs/ExternalSummary.xml' path='docs/ShikiApiStatic/class[@name="ShikiApiStatic"]/*' /> public static class ShikiApiStatic { private static string domen = "https://shikimori.one/"; private static string domenApi = "https://shikimori.one/api/"; /// <include file='Docs/ExternalSummary.xml' path='docs/ShikiApiStatic/property[@name="Domen"]/*' /> public static string Domen { get { return domen; } set { domen = value; } } /// <include file='Docs/ExternalSummary.xml' path='docs/ShikiApiStatic/property[@name="DomenApi"]/*' /> public static string DomenApi { get { return domenApi; } set { domenApi = value; } } /// <include file='Docs/ExternalSummary.xml' path='docs/ShikiApiStatic/property[@name="ClientName"]/*' /> public static string ClientName { get; set; } = "Shiki Desktop App"; private const int rate_list_limit = 999999; /// <include file='Docs/ExternalSummary.xml' path='docs/ShikiApiStatic/method[@name="GetUserInfo"]/*' /> public static UserInfo GetUserInfo(int user_id) { string url = DomenApi + "users/" + user_id; return new UserInfo(Query.GET<_UserFullInfo>(url)); } /// <include file='Docs/ExternalSummary.xml' path='docs/ShikiApiStatic/method[@name="GetAnimeRates"]/*' /> public static List<AnimeRate> GetAnimeRates(int user_id, int limit = rate_list_limit) { string url = DomenApi + "users/" + user_id + "/anime_rates?limit=" + limit; return Query.GET<List<_UserRate>>(url).Select(x => new AnimeRate(x)).ToList(); } /// <include file='Docs/ExternalSummary.xml' path='docs/ShikiApiStatic/method[@name="GetMangaRates"]/*' /> public static List<MangaRate> GetMangaRates(int user_id, int limit = rate_list_limit) { string url = DomenApi + "users/" + user_id + "/manga_rates?limit=" + limit; return Query.GET<List<_UserRate>>(url).Select(x => new MangaRate(x)).ToList(); } /// <include file='Docs/ExternalSummary.xml' path='docs/ShikiApiStatic/method[@name="GetTitleType1"]/*' /> public static TitleType GetTitleType(_UserRate rate) { if (rate.anime != null) { return TitleType.anime; } if (rate.manga != null) { return TitleType.manga; } return (TitleType)(-1); } /// <include file='Docs/ExternalSummary.xml' path='docs/ShikiApiStatic/method[@name="GetTitleType2"]/*' /> public static TitleType GetTitleType(_UserRate_v2 rate) { if (rate.target_type == "Anime") { return TitleType.anime; } if (rate.target_type == "Manga") { return TitleType.manga; } return (TitleType)(-1); } /// <include file='Docs/ExternalSummary.xml' path='docs/ShikiApiStatic/method[@name="GetAnimeFullInfo"]/*' /> public static AnimeFullInfo GetAnimeFullInfo(int title_id) { string url = DomenApi + "animes/" + title_id; return Query.GET<AnimeFullInfo>(url); } /// <include file='Docs/ExternalSummary.xml' path='docs/ShikiApiStatic/method[@name="GetMangaFullInfo"]/*' /> public static MangaFullInfo GetMangaFullInfo(int title_id) { string url = DomenApi + "mangas/" + title_id; return Query.GET<MangaFullInfo>(url); } /// <include file='Docs/ExternalSummary.xml' path='docs/ShikiApiStatic/method[@name="GetStudios"]/*' /> public static List<Studio> GetStudios() { string url = DomenApi + "studios"; return Query.GET<List<Studio>>(url); } /// <include file='Docs/ExternalSummary.xml' path='docs/ShikiApiStatic/method[@name="GetStudio"]/*' /> public static Studio GetStudio(int id) { return GetStudios().FirstOrDefault(x => x.id == id); } /// <include file='Docs/ExternalSummary.xml' path='docs/ShikiApiStatic/method[@name="GetPublishers"]/*' /> public static List<Publisher> GetPublishers() { string url = DomenApi + "publishers"; return Query.GET<List<Publisher>>(url); } /// <include file='Docs/ExternalSummary.xml' path='docs/ShikiApiStatic/method[@name="GetPublisher"]/*' /> public static Publisher GetPublisher(int id) { return GetPublishers().FirstOrDefault(x => x.id == id); } /// <include file='Docs/ExternalSummary.xml' path='docs/ShikiApiStatic/method[@name="GetGenres"]/*' /> public static List<Genre> GetGenres() { string url = DomenApi + "genres"; return Query.GET<List<Genre>>(url); } /// <include file='Docs/ExternalSummary.xml' path='docs/ShikiApiStatic/method[@name="GetGenre"]/*' /> public static Genre GetGenre(int id) { return GetGenres().FirstOrDefault(x => x.id == id); } /// <include file='Docs/ExternalSummary.xml' path='docs/ShikiApiStatic/method[@name="GetVideos"]/*' /> public static List<Video> GetVideos(int title_id) //Video of animes (OP or ED) { string url = DomenApi + "animes/" + title_id + "/videos"; return Query.GET<List<Video>>(url); } } }
45.454545
117
0.612182
[ "Apache-2.0" ]
Advanced-Alliance/su4na-API-NET
Api/ShikiApiLib/ShikiApiStatic.cs
5,502
C#
using Stump.Core.IO; using Stump.DofusProtocol.Enums; using Stump.Server.BaseServer.Commands; using Stump.Server.WorldServer.Game.Actors.RolePlay.Characters; namespace Stump.Server.WorldServer.Commands.Trigger { public abstract class GameTrigger : TriggerBase { protected GameTrigger(StringStream args, Character character) : base(args, character.UserGroup.Role) { Character = character; } protected GameTrigger(string args, Character character) : base(args, character.UserGroup.Role) { Character = character; } public override RoleEnum UserRole => Character.UserGroup.Role; public override bool CanFormat => true; public Character Character { get; protected set; } public override bool CanAccessCommand(CommandBase command) => Character.UserGroup.IsCommandAvailable(command); public override void Log() { if (BoundCommand.RequiredRole <= RoleEnum.Player) return; //TODO: Add commands logging } } }
26.767442
118
0.629018
[ "Apache-2.0" ]
Daymortel/Stump
src/Stump.Server.WorldServer/Commands/Trigger/GameTrigger.cs
1,151
C#
using DM.Views; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Xamarin.Forms; using Xamarin.Forms.Xaml; namespace DM.MasterPage { [XamlCompilation(XamlCompilationOptions.Compile)] public partial class MasterDetailPage_main : MasterDetailPage { public MasterDetailPage_main() { InitializeComponent(); MasterPage.ListView.ItemSelected += ListView_ItemSelected; } private void ListView_ItemSelected(object sender, SelectedItemChangedEventArgs e) { MasterDetailPage_mainMasterMenuItem item = e.SelectedItem as MasterDetailPage_mainMasterMenuItem; if (item == null) return; if(item.TargetType.Equals(typeof(LoginPage))) App.Current.MainPage = new LoginPage(); var page = (Page)Activator.CreateInstance(item.TargetType); page.Title = item.Title; Detail = new NavigationPage(page); IsPresented = false; MasterPage.ListView.SelectedItem = null; } } }
29.230769
109
0.657895
[ "Apache-2.0" ]
Alothar/DM
DM/DM/MasterPage/MasterDetailPage_main.xaml.cs
1,142
C#
using System; using Autofac; using IrcUserAdmin.ConfigSettings; using IrcUserAdmin.SlavePersistance; using IrcUserAdmin.WCFServiceReference; namespace IrcUserAdmin.CompositionRoot.Components { public class WcfSlaveModule : Module { private readonly IBotConfig _config; public WcfSlaveModule(IBotConfig config) { if (config == null) throw new ArgumentNullException("config"); _config = config; } protected override void Load(ContainerBuilder builder) { int initialCount = 0; if (_config.Settings.NHSlaves != null && _config.Settings.NHSlaves.NHSlave != null) { //continue with the count from nhibernate slaves: initialCount = _config.Settings.NHSlaves.NHSlave.Count; } if (_config.Settings.SoapSlaves != null) { for (int i = initialCount; i < _config.Settings.SoapSlaves.Count; i++) { var wcfSlave = _config.Settings.SoapSlaves[i]; builder.RegisterType<WcfServiceWrapper>().Keyed<ISlavePersistence>(i).InstancePerLifetimeScope() .WithParameter("adress", wcfSlave.Address); } } } } }
34.578947
116
0.592085
[ "MIT" ]
kjholzapfel/IrcUserAdmin
IrcUserAdmin.Main/CompositionRoot/Components/WcfSlaveModule.cs
1,316
C#
/* * Copyright 2010-2014 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). * You may not use this file except in compliance with the License. * A copy of the License is located at * * http://aws.amazon.com/apache2.0 * * or in the "license" file accompanying this file. This file is distributed * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either * express or implied. See the License for the specific language governing * permissions and limitations under the License. */ /* * Do not modify this file. This file is generated from the pinpoint-2016-12-01.normal.json service model. */ using System; using Amazon.Runtime; using Amazon.Util.Internal; namespace Amazon.Pinpoint { /// <summary> /// Configuration for accessing Amazon Pinpoint service /// </summary> public partial class AmazonPinpointConfig : ClientConfig { private static readonly string UserAgentString = InternalSDKUtils.BuildUserAgentString("3.3.100.13"); private string _userAgent = UserAgentString; /// <summary> /// Default constructor /// </summary> public AmazonPinpointConfig() { this.AuthenticationServiceName = "mobiletargeting"; } /// <summary> /// The constant used to lookup in the region hash the endpoint. /// </summary> public override string RegionEndpointServiceName { get { return "pinpoint"; } } /// <summary> /// Gets the ServiceVersion property. /// </summary> public override string ServiceVersion { get { return "2016-12-01"; } } /// <summary> /// Gets the value of UserAgent property. /// </summary> public override string UserAgent { get { return _userAgent; } } } }
26.2125
106
0.58846
[ "Apache-2.0" ]
hyandell/aws-sdk-net
sdk/src/Services/Pinpoint/Generated/AmazonPinpointConfig.cs
2,097
C#
namespace Identity.Ids { using MedEasy.Ids; using MedEasy.Ids.Converters; using Microsoft.EntityFrameworkCore.Storage.ValueConversion; using System; using System.Text.Json.Serialization; /// <summary> /// <see cref="RoleClaim"/>'s identifier /// </summary> [JsonConverter(typeof(StronglyTypedIdJsonConverter<RoleClaimId, Guid>))] public record RoleClaimId(Guid Value) : StronglyTypedId<Guid>(Value) { /// <summary> /// Creates a new <see cref="RoleClaimId"/> /// </summary> /// <returns>The newly created <see cref="AccountClaimId"/></returns> public static RoleClaimId New() => new(Guid.NewGuid()); public static RoleClaimId Empty => new(Guid.Empty); #pragma warning disable S1185 // Overriding members should do more than simply call the same member in the base class public override string ToString() => base.ToString(); #pragma warning restore S1185 // Overriding members should do more than simply call the same member in the base class public class EfValueConverter : ValueConverter<RoleClaimId, Guid> { public EfValueConverter(ConverterMappingHints mappingHints = null) : base(id => id.Value, value => new RoleClaimId(value), mappingHints) { } } } }
36.921053
132
0.630078
[ "Apache-2.0" ]
candoumbe/MedEasy
src/services/identity/Identity.Ids/RoleClaimId.cs
1,405
C#
namespace Dealership.Models { using System; public static class ExtendetValidator { public static void ValidateStringLength(string text, int min, int max, string message) { if (text.Length < min || max < text.Length) { throw new IndexOutOfRangeException(message); } } public static void ValidateAddVehicle(string text, int min, int max, string message) { if (text.Length < min || max < text.Length) { throw new IndexOutOfRangeException(message); } } } }
26.041667
94
0.5504
[ "MIT" ]
b-slavov/Telerik-Software-Academy
03.C# OOP/Exam-Dealership/Solution/Dealership/Models/ExtendetValidator.cs
627
C#
namespace FitDontQuit.Web.Areas.Administration.Controllers { using System; using System.Threading.Tasks; using FitDontQuit.Data.Models.Enums; using FitDontQuit.Services.Data; using FitDontQuit.Services.Mapping; using FitDontQuit.Services.Models.Memberships; using FitDontQuit.Web.ViewModels.Administration.Memberships; using Microsoft.AspNetCore.Mvc; public class MembershipsController : AdministrationController { private readonly IMembershipsService membershipsService; public MembershipsController(IMembershipsService membershipsService) { this.membershipsService = membershipsService; } public IActionResult Index() { var memberships = this.membershipsService.GetAll<MembershipViewModel>(); return this.View(memberships); } public IActionResult Create() { var durations = (Duration[])Enum.GetValues(typeof(Duration)); var peopleLimits = (AmountOfPeopleLimit[])Enum.GetValues(typeof(AmountOfPeopleLimit)); var visitsLimits = (VisitLimit[])Enum.GetValues(typeof(VisitLimit)); var viewModel = new CreateMembershipModel { Durations = durations, AmountOfPeopleLimits = peopleLimits, VisitsLimits = visitsLimits, }; return this.View(viewModel); } [HttpPost] public async Task<IActionResult> Create(CreateMembershipModel inputModel) { if (!this.ModelState.IsValid) { return this.View(inputModel); } var membershipServiceModel = AutoMapperConfig.MapperInstance.Map<CreateMembershipInputModel>(inputModel); await this.membershipsService.CreateAsync(membershipServiceModel); return this.RedirectToAction("Index"); } public IActionResult Edit(int id) { var membership = this.membershipsService.GetById<EditMembershipModel>(id); if (membership == null) { return this.NotFound(); } var durations = (Duration[])Enum.GetValues(typeof(Duration)); var peopleLimits = (AmountOfPeopleLimit[])Enum.GetValues(typeof(AmountOfPeopleLimit)); var visitsLimits = (VisitLimit[])Enum.GetValues(typeof(VisitLimit)); membership.Durations = durations; membership.AmountOfPeopleLimits = peopleLimits; membership.VisitsLimits = visitsLimits; return this.View(membership); } [HttpPost] public async Task<IActionResult> Edit(int id, EditMembershipModel membershipModel) { if (!this.ModelState.IsValid) { return this.View(membershipModel); } var membershipServiceModel = AutoMapperConfig.MapperInstance.Map<EditMembershipInputModel>(membershipModel); await this.membershipsService.EditAsync(id, membershipServiceModel); return this.RedirectToAction("Index"); } public IActionResult Delete(int id) { var membershipModel = this.membershipsService.GetById<DeleteMembershipModel>(id); if (membershipModel == null) { return this.NotFound(); } return this.View(membershipModel); } [HttpPost] public async Task<IActionResult> Delete(DeleteMembershipModel membershipModel) { await this.membershipsService.DeleteAsync(membershipModel.Id); return this.RedirectToAction("Index"); } } }
32.701754
120
0.626609
[ "MIT" ]
YolitoMarinova/Fit-Dont-Quit.WebApp
Web/FitDontQuit.Web/Areas/Administration/Controllers/MembershipsController.cs
3,730
C#
using Newtonsoft.Json; namespace ESI.NET.Models.Corporation { public class MemberTitles { [JsonProperty("character_id")] public int CharacterId { get; set; } [JsonProperty("titles")] public int[] Titles { get; set; } } }
17.933333
44
0.605948
[ "MIT" ]
BitBaboonSteve/ESI.NET
ESI.NET/Models/Corporation/MemberTitles.cs
271
C#
using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.Text; namespace VaporStore.Data.Models { public class Genre { public Genre() { this.Games = new HashSet<Game>(); } [Key] public int Id { get; set; } [Required] public string Name { get; set; } public virtual ICollection<Game> Games { get; set; } } }
19.434783
60
0.588367
[ "MIT" ]
dzhanetGerdzhikova/EF-Core
Exams/Exam Exercise 2/VaporStore/Data/Models/Genre.cs
449
C#
/* * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). * You may not use this file except in compliance with the License. * A copy of the License is located at * * http://aws.amazon.com/apache2.0 * * or in the "license" file accompanying this file. This file is distributed * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either * express or implied. See the License for the specific language governing * permissions and limitations under the License. */ /* * Do not modify this file. This file is generated from the opsworks-2013-02-18.normal.json service model. */ using System; using System.Collections.Generic; using System.Xml.Serialization; using System.Text; using System.IO; using System.Net; using Amazon.Runtime; using Amazon.Runtime.Internal; namespace Amazon.OpsWorks.Model { /// <summary> /// Represents an app's environment variable. /// </summary> public partial class EnvironmentVariable { private string _key; private bool? _secure; private string _value; /// <summary> /// Gets and sets the property Key. /// <para> /// (Required) The environment variable's name, which can consist of up to 64 characters /// and must be specified. The name can contain upper- and lowercase letters, numbers, /// and underscores (_), but it must start with a letter or underscore. /// </para> /// </summary> [AWSProperty(Required=true)] public string Key { get { return this._key; } set { this._key = value; } } // Check to see if Key property is set internal bool IsSetKey() { return this._key != null; } /// <summary> /// Gets and sets the property Secure. /// <para> /// (Optional) Whether the variable's value will be returned by the <a>DescribeApps</a> /// action. To conceal an environment variable's value, set <code>Secure</code> to <code>true</code>. /// <code>DescribeApps</code> then returns <code>*****FILTERED*****</code> instead of /// the actual value. The default value for <code>Secure</code> is <code>false</code>. /// /// </para> /// </summary> public bool Secure { get { return this._secure.GetValueOrDefault(); } set { this._secure = value; } } // Check to see if Secure property is set internal bool IsSetSecure() { return this._secure.HasValue; } /// <summary> /// Gets and sets the property Value. /// <para> /// (Optional) The environment variable's value, which can be left empty. If you specify /// a value, it can contain up to 256 characters, which must all be printable. /// </para> /// </summary> [AWSProperty(Required=true)] public string Value { get { return this._value; } set { this._value = value; } } // Check to see if Value property is set internal bool IsSetValue() { return this._value != null; } } }
32.932692
110
0.57635
[ "Apache-2.0" ]
philasmar/aws-sdk-net
sdk/src/Services/OpsWorks/Generated/Model/EnvironmentVariable.cs
3,425
C#
using UnityEngine; using System.Collections; public class ProgressiveQuadtree : Quadtree { public ProgressiveQuadtree(float _size, Vector2 _corner, int _maxLevel) : base(_size, _corner, _maxLevel) { root = new ProgressiveQuadtreeNode(0, new int[] { 0, 0 }, null, this); } } public class ProgressiveQuadtreeNode : QuadtreeNode { public ProgressiveQuadtreeNode(int _level, int[] _index, ProgressiveQuadtreeNode _parent, ProgressiveQuadtree _tree) : base(_level, _index, _parent, _tree) {} public override void CreateChildren() { if (children == null) { children = new ProgressiveQuadtreeNode[2, 2]; for (int xi = 0; xi < 2; xi++) for (int yi = 0; yi < 2; yi++) { int[] newIndex = { index[0] * 2 + xi, index[1] * 2 + yi }; children[xi, yi] = new ProgressiveQuadtreeNode(level + 1, newIndex, this, (ProgressiveQuadtree) tree); } if (level != 0) { for (int i = 0; i < 4; i++) { QuadtreeNode found = tree.Find(new int[] {index[0] + Quadtree.dir[i, 0], index[1] + Quadtree.dir[i, 1] }, level); if (found != null && found.level < level) { found.CreateChildren(); } } } } } }
39.735294
162
0.547742
[ "MIT" ]
Michigari/PLATEAU_DroneNavigation
UnusedScripts/ProgressiveQuadtree.cs
1,353
C#
//------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Runtime Version:4.0.30319.42000 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ namespace ImageFetcherPlugin.Properties { using System; /// <summary> /// A strongly-typed resource class, for looking up localized strings, etc. /// </summary> // This class was auto-generated by the StronglyTypedResourceBuilder // class via a tool like ResGen or Visual Studio. // To add or remove a member, edit your .ResX file then rerun ResGen // with the /str option, or rebuild your VS project. [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] internal class Resources { private static global::System.Resources.ResourceManager resourceMan; private static global::System.Globalization.CultureInfo resourceCulture; [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] internal Resources() { } /// <summary> /// Returns the cached ResourceManager instance used by this class. /// </summary> [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] internal static global::System.Resources.ResourceManager ResourceManager { get { if (object.ReferenceEquals(resourceMan, null)) { global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("ImageFetcherPlugin.Properties.Resources", typeof(Resources).Assembly); resourceMan = temp; } return resourceMan; } } /// <summary> /// Overrides the current thread's CurrentUICulture property for all /// resource lookups using this strongly typed resource class. /// </summary> [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] internal static global::System.Globalization.CultureInfo Culture { get { return resourceCulture; } set { resourceCulture = value; } } } }
43.75
184
0.615357
[ "MIT" ]
Bullgator351/LCG_Extractor
ImageFetcherPlugin/Properties/Resources.Designer.cs
2,802
C#
namespace NPBehave { public class Repeater : Decorator { private int loopCount = -1; private int currentLoop; /// <param name="loopCount">number of times to execute the decoratee. Set to -1 to repeat forever, be careful with endless loops!</param> /// <param name="decoratee">Decorated Node</param> public Repeater(int loopCount, Node decoratee) : base("Repeater", decoratee) { this.loopCount = loopCount; } /// <param name="decoratee">Decorated Node, repeated forever</param> public Repeater(Node decoratee) : base("Repeater", decoratee) { } protected override void DoStart() { if (loopCount != 0) { currentLoop = 0; Decoratee.Start(); } else { this.Stopped(true); } } override protected void DoCancel() { this.Clock.RemoveTimer(restartDecoratee); if (Decoratee.IsActive) { Decoratee.CancelWithoutReturnResult(); } else { Stopped(false); } } protected override void DoChildStopped(Node child, bool result) { if (result) { if (IsStopRequested || (loopCount > 0 && ++currentLoop >= loopCount)) { Stopped(true); } else { this.Clock.AddTimer(0, 0, restartDecoratee); } } else { Stopped(false); } } protected void restartDecoratee() { Decoratee.Start(); } } }
26.126761
145
0.454447
[ "MIT" ]
DBestBean/ETandGF
Server/Model/NKGMOBA/Battle/NPBehave/Core/NPBehave/Decorator/Repeater.cs
1,857
C#
using FluentAssertions; using Symbolica.Computation.Values.TestData; using Xunit; namespace Symbolica.Computation.Values; public class FloatGreaterOrEqualTests { [Theory] [ClassData(typeof(SingleBinaryTestData))] [ClassData(typeof(DoubleBinaryTestData))] private void ShouldCreateEquivalentBitVectors( IValue left0, IValue right0, IValue left1, IValue right1) { using var solver = PooledSolver.Create(); using var bv0 = FloatGreaterOrEqual.Create(left0, right0).AsBitVector(solver); using var result0 = bv0.Simplify(); using var bv1 = FloatGreaterOrEqual.Create(left1, right1).AsBitVector(solver); using var result1 = bv1.Simplify(); result0.Should().BeEquivalentTo(result1); } [Theory] [ClassData(typeof(SingleBinaryTestData))] [ClassData(typeof(DoubleBinaryTestData))] private void ShouldCreateEquivalentBooleans( IValue left0, IValue right0, IValue left1, IValue right1) { using var solver = PooledSolver.Create(); using var b0 = FloatGreaterOrEqual.Create(left0, right0).AsBool(solver); using var result0 = b0.Simplify(); using var b1 = FloatGreaterOrEqual.Create(left1, right1).AsBool(solver); using var result1 = b1.Simplify(); result0.Should().BeEquivalentTo(result1); } }
30.355556
86
0.692533
[ "MIT" ]
Symbolica/Symbolica
tests/Computation.Tests/Values/FloatGreaterOrEqualTests.cs
1,368
C#
//*********************************************************** // 作者:Nicholas Leo // E-Mail:nicholasleo1030@163.com // GitHub:https://github.com/nicholasleo // 时间:2019-08-15 12:24:05 // 说明: // 版权所有:个人 //*********************************************************** using Newtonsoft.Json; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace NL.Framework.Model.System { public class UserImageModel : SystemBaseModel { public byte[] UserIcon { get; set; } /// <summary> /// 用户头像地址 /// </summary> public string ImageUrl { get; set; } [JsonIgnore] public virtual UserModel UserModel { get; set; } } }
25.2
62
0.52381
[ "MIT" ]
Nicholasleo/NL.Framework
NL.Framework.Model/System/UserImageModel.cs
802
C#
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using RimWorld; using HarmonyLib; using Verse; namespace ProjectRimFactory.Common.HarmonyPatches { [HarmonyPatch(typeof(RoomRequirement_ThingCount), "Count")] class Patch_DroneColumn_Royalty { static void Postfix(Room r, ref int __result , RoomRequirement_ThingCount __instance ) { if (__result < __instance.count && __instance.thingDef == PRFDefOf.Column) { __result += r.ThingCount(PRFDefOf.PRF_MiniDroneColumn); } } } }
24.423077
94
0.68189
[ "MIT" ]
AmCh-Q/Project-RimFactory-Revived
Source/ProjectRimFactory/Common/HarmonyPatches/Patch_DroneColumn_Royalty.cs
637
C#
using System.Collections.Generic; using System; using Microsoft.AspNetCore.Mvc; using EventPlanner.Models; namespace EventPlanner.Controllers { public class EventsController : Controller { [HttpGet("/events")] public ActionResult Index() { List<Event> allEvents = Event.GetAll(); return View(allEvents); } [HttpGet("/events/new")] public ActionResult New() { List<Menu> allMenus = Menu.GetAll(); return View(allMenus); } [HttpPost("/events/new")] public ActionResult Create(string name, DateTime eventDate, string eventLocation, int menuId) { Event newEvent = new Event(name, eventDate, eventLocation, menuId); newEvent.Save(); return RedirectToAction("Index"); } [HttpGet("/events/{eventId}")] public ActionResult Show(int eventId) { Event selectedEvent = Event.Find(eventId); Menu eventMenu = Menu.Find(selectedEvent.GetMenusId()); List<Task> tasks = selectedEvent.GetTasks(); List<Invitee> invitees = selectedEvent.GetInvitees(); List<Task> allTasks = Task.GetAll(); List<Invitee> allInvitees = Invitee.GetAll(); Dictionary<string, object> model = new Dictionary<string, object>(); model.Add("selectedEvent", selectedEvent); model.Add("tasks", tasks); model.Add("invitees", invitees); model.Add("eventMenu", eventMenu); model.Add("allInvitees", allInvitees); model.Add("allTasks", allTasks); return View(model); } [HttpPost("/events/{eventId}/tasks/new")] public ActionResult AddTask(int eventId, int taskId) { Event selectedEvent = Event.Find(eventId); selectedEvent.AddTask(Task.Find(taskId)); return RedirectToAction("Show"); } [HttpGet("/events/{eventId}/tasks/{tasksId}/delete")] public ActionResult DeleteTask(int eventId, int tasksId) { Event selectedEvent = Event.Find(eventId); selectedEvent.DeleteTask(Task.Find(tasksId)); return RedirectToAction("Show"); } [HttpPost("/events/{eventId}/invitees/new")] public ActionResult AddInvitee(int eventId, int inviteeId) { Event selectedEvent = Event.Find(eventId); selectedEvent.AddInvitee(Invitee.Find(inviteeId)); return RedirectToAction("Show"); } [HttpGet("/events/{eventId}/invitees/{inviteesId}/delete")] public ActionResult DeleteInvitee(int eventId, int inviteesId) { Event selectedEvent = Event.Find(eventId); selectedEvent.DeleteInvitee(Invitee.Find(inviteesId)); return RedirectToAction("Show"); } [HttpGet("/events/{eventId}/delete")] public ActionResult Delete(int eventId) { Event selectedEvent = Event.Find(eventId); selectedEvent.Delete(); return RedirectToAction("Index"); } [HttpGet("/events/delete")] public ActionResult DeleteAll() { Event.DeleteAll(); return RedirectToAction("Index"); } [HttpGet("/events/{eventId}/edit")] public ActionResult Edit(int eventId) { Event selectedEvent = Event.Find(eventId); Menu eventMenu = Menu.Find(selectedEvent.GetMenusId()); List<Menu> allMenus = Menu.GetAll(); Dictionary<string, object> model = new Dictionary<string, object>(); model.Add("selectedEvent", selectedEvent); model.Add("eventMenu", eventMenu); model.Add("allMenus", allMenus); return View(model); } [HttpPost("/events/{eventId}/edit")] public ActionResult Update(int eventId, string name, DateTime eventDate, string eventLocation, int menuId) { Event selectedEvent = Event.Find(eventId); selectedEvent.Edit(name, eventDate, eventLocation, menuId); return RedirectToAction("Index"); } } }
32.932203
111
0.644879
[ "MIT" ]
MarkStrickland562/EventPlanner.Solution
EventPlanner/Controllers/EventsController.cs
3,886
C#
/* * Ory Kratos API * * Documentation for all public and administrative Ory Kratos APIs. Public and administrative APIs are exposed on different ports. Public APIs can face the public internet without any protection while administrative APIs should never be exposed without prior authorization. To protect the administative API port you should use something like Nginx, Ory Oathkeeper, or any other technology capable of authorizing incoming requests. * * The version of the OpenAPI document: v0.10.1 * Contact: hi@ory.sh * Generated by: https://github.com/openapitools/openapi-generator.git */ using System; using System.Collections; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Linq; using System.IO; using System.Runtime.Serialization; using System.Text; using System.Text.RegularExpressions; using Newtonsoft.Json; using Newtonsoft.Json.Converters; using Newtonsoft.Json.Linq; using System.ComponentModel.DataAnnotations; using OpenAPIDateConverter = Ory.Kratos.Client.Client.OpenAPIDateConverter; namespace Ory.Kratos.Client.Model { /// <summary> /// KratosSubmitSelfServiceRecoveryFlowWithLinkMethodBody /// </summary> [DataContract(Name = "submitSelfServiceRecoveryFlowWithLinkMethodBody")] public partial class KratosSubmitSelfServiceRecoveryFlowWithLinkMethodBody : IEquatable<KratosSubmitSelfServiceRecoveryFlowWithLinkMethodBody>, IValidatableObject { /// <summary> /// Initializes a new instance of the <see cref="KratosSubmitSelfServiceRecoveryFlowWithLinkMethodBody" /> class. /// </summary> [JsonConstructorAttribute] protected KratosSubmitSelfServiceRecoveryFlowWithLinkMethodBody() { this.AdditionalProperties = new Dictionary<string, object>(); } /// <summary> /// Initializes a new instance of the <see cref="KratosSubmitSelfServiceRecoveryFlowWithLinkMethodBody" /> class. /// </summary> /// <param name="csrfToken">Sending the anti-csrf token is only required for browser login flows..</param> /// <param name="email">Email to Recover Needs to be set when initiating the flow. If the email is a registered recovery email, a recovery link will be sent. If the email is not known, a email with details on what happened will be sent instead. format: email (required).</param> /// <param name="method">Method supports &#x60;link&#x60; only right now. (required).</param> public KratosSubmitSelfServiceRecoveryFlowWithLinkMethodBody(string csrfToken = default(string), string email = default(string), string method = default(string)) { // to ensure "email" is required (not null) if (email == null) { throw new ArgumentNullException("email is a required property for KratosSubmitSelfServiceRecoveryFlowWithLinkMethodBody and cannot be null"); } this.Email = email; // to ensure "method" is required (not null) if (method == null) { throw new ArgumentNullException("method is a required property for KratosSubmitSelfServiceRecoveryFlowWithLinkMethodBody and cannot be null"); } this.Method = method; this.CsrfToken = csrfToken; this.AdditionalProperties = new Dictionary<string, object>(); } /// <summary> /// Sending the anti-csrf token is only required for browser login flows. /// </summary> /// <value>Sending the anti-csrf token is only required for browser login flows.</value> [DataMember(Name = "csrf_token", EmitDefaultValue = false)] public string CsrfToken { get; set; } /// <summary> /// Email to Recover Needs to be set when initiating the flow. If the email is a registered recovery email, a recovery link will be sent. If the email is not known, a email with details on what happened will be sent instead. format: email /// </summary> /// <value>Email to Recover Needs to be set when initiating the flow. If the email is a registered recovery email, a recovery link will be sent. If the email is not known, a email with details on what happened will be sent instead. format: email</value> [DataMember(Name = "email", IsRequired = true, EmitDefaultValue = false)] public string Email { get; set; } /// <summary> /// Method supports &#x60;link&#x60; only right now. /// </summary> /// <value>Method supports &#x60;link&#x60; only right now.</value> [DataMember(Name = "method", IsRequired = true, EmitDefaultValue = false)] public string Method { get; set; } /// <summary> /// Gets or Sets additional properties /// </summary> [JsonExtensionData] public IDictionary<string, object> AdditionalProperties { get; set; } /// <summary> /// Returns the string presentation of the object /// </summary> /// <returns>String presentation of the object</returns> public override string ToString() { StringBuilder sb = new StringBuilder(); sb.Append("class KratosSubmitSelfServiceRecoveryFlowWithLinkMethodBody {\n"); sb.Append(" CsrfToken: ").Append(CsrfToken).Append("\n"); sb.Append(" Email: ").Append(Email).Append("\n"); sb.Append(" Method: ").Append(Method).Append("\n"); sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); sb.Append("}\n"); return sb.ToString(); } /// <summary> /// Returns the JSON string presentation of the object /// </summary> /// <returns>JSON string presentation of the object</returns> public virtual string ToJson() { return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); } /// <summary> /// Returns true if objects are equal /// </summary> /// <param name="input">Object to be compared</param> /// <returns>Boolean</returns> public override bool Equals(object input) { return this.Equals(input as KratosSubmitSelfServiceRecoveryFlowWithLinkMethodBody); } /// <summary> /// Returns true if KratosSubmitSelfServiceRecoveryFlowWithLinkMethodBody instances are equal /// </summary> /// <param name="input">Instance of KratosSubmitSelfServiceRecoveryFlowWithLinkMethodBody to be compared</param> /// <returns>Boolean</returns> public bool Equals(KratosSubmitSelfServiceRecoveryFlowWithLinkMethodBody input) { if (input == null) { return false; } return ( this.CsrfToken == input.CsrfToken || (this.CsrfToken != null && this.CsrfToken.Equals(input.CsrfToken)) ) && ( this.Email == input.Email || (this.Email != null && this.Email.Equals(input.Email)) ) && ( this.Method == input.Method || (this.Method != null && this.Method.Equals(input.Method)) ) && (this.AdditionalProperties.Count == input.AdditionalProperties.Count && !this.AdditionalProperties.Except(input.AdditionalProperties).Any()); } /// <summary> /// Gets the hash code /// </summary> /// <returns>Hash code</returns> public override int GetHashCode() { unchecked // Overflow is fine, just wrap { int hashCode = 41; if (this.CsrfToken != null) { hashCode = (hashCode * 59) + this.CsrfToken.GetHashCode(); } if (this.Email != null) { hashCode = (hashCode * 59) + this.Email.GetHashCode(); } if (this.Method != null) { hashCode = (hashCode * 59) + this.Method.GetHashCode(); } if (this.AdditionalProperties != null) { hashCode = (hashCode * 59) + this.AdditionalProperties.GetHashCode(); } return hashCode; } } /// <summary> /// To validate all properties of the instance /// </summary> /// <param name="validationContext">Validation context</param> /// <returns>Validation Result</returns> public IEnumerable<System.ComponentModel.DataAnnotations.ValidationResult> Validate(ValidationContext validationContext) { yield break; } } }
45.333333
431
0.614082
[ "Apache-2.0" ]
ory/sdk-generator
clients/kratos/dotnet/src/Ory.Kratos.Client/Model/KratosSubmitSelfServiceRecoveryFlowWithLinkMethodBody.cs
8,976
C#
using System; using Aop.Api.Domain; using System.Collections.Generic; using Aop.Api.Response; namespace Aop.Api.Request { /// <summary> /// AOP API: alipay.commerce.transport.nfccard.send /// </summary> public class AlipayCommerceTransportNfccardSendRequest : IAopRequest<AlipayCommerceTransportNfccardSendResponse> { /// <summary> /// NFC用户卡信息同步 /// </summary> public string BizContent { get; set; } #region IAopRequest Members private bool needEncrypt=false; private string apiVersion = "1.0"; private string terminalType; private string terminalInfo; private string prodCode; private string notifyUrl; private string returnUrl; private AopObject bizModel; private Dictionary<string, string> udfParams; //add user-defined text parameters public void SetNeedEncrypt(bool needEncrypt){ this.needEncrypt=needEncrypt; } public bool GetNeedEncrypt(){ return this.needEncrypt; } public void SetNotifyUrl(string notifyUrl){ this.notifyUrl = notifyUrl; } public string GetNotifyUrl(){ return this.notifyUrl; } public void SetReturnUrl(string returnUrl){ this.returnUrl = returnUrl; } public string GetReturnUrl(){ return this.returnUrl; } public void SetTerminalType(String terminalType){ this.terminalType=terminalType; } public string GetTerminalType(){ return this.terminalType; } public void SetTerminalInfo(String terminalInfo){ this.terminalInfo=terminalInfo; } public string GetTerminalInfo(){ return this.terminalInfo; } public void SetProdCode(String prodCode){ this.prodCode=prodCode; } public string GetProdCode(){ return this.prodCode; } public string GetApiName() { return "alipay.commerce.transport.nfccard.send"; } public void SetApiVersion(string apiVersion){ this.apiVersion=apiVersion; } public string GetApiVersion(){ return this.apiVersion; } public void PutOtherTextParam(string key, string value) { if(this.udfParams == null) { this.udfParams = new Dictionary<string, string>(); } this.udfParams.Add(key, value); } public IDictionary<string, string> GetParameters() { AopDictionary parameters = new AopDictionary(); parameters.Add("biz_content", this.BizContent); if(udfParams != null) { parameters.AddAll(this.udfParams); } return parameters; } public AopObject GetBizModel() { return this.bizModel; } public void SetBizModel(AopObject bizModel) { this.bizModel = bizModel; } #endregion } }
25.983871
117
0.567349
[ "Apache-2.0" ]
554393109/alipay-sdk-net-all
AlipaySDKNet.Standard/Request/AlipayCommerceTransportNfccardSendRequest.cs
3,236
C#
using NUnit.Framework; namespace MtgLibrary.Tests { public class Tests { [SetUp] public void Setup() { } [Test] public void Test1() { Assert.Pass(); } } }
13.555556
27
0.442623
[ "MIT" ]
vinceynhz/mtg-library
MtgLibrary.Tests/UnitTest1.cs
244
C#
// *** WARNING: this file was generated by the Pulumi SDK Generator. *** // *** Do not edit by hand unless you're certain you know what you are doing! *** using System; using System.Collections.Generic; using System.Collections.Immutable; using System.Threading.Tasks; using Pulumi.Serialization; namespace Pulumi.AzureNative.TestBase.Outputs { /// <summary> /// The command used in the test /// </summary> [OutputType] public sealed class CommandResponse { /// <summary> /// The action of the command. /// </summary> public readonly string Action; /// <summary> /// Specifies whether to run the command even if a previous command is failed. /// </summary> public readonly bool? AlwaysRun; /// <summary> /// Specifies whether to apply update before the command. /// </summary> public readonly bool? ApplyUpdateBefore; /// <summary> /// The content of the command. The content depends on source type. /// </summary> public readonly string Content; /// <summary> /// The type of command content. /// </summary> public readonly string ContentType; /// <summary> /// Specifies the max run time of the command. /// </summary> public readonly int? MaxRunTime; /// <summary> /// The name of the command. /// </summary> public readonly string Name; /// <summary> /// Specifies whether to restart the VM after the command executed. /// </summary> public readonly bool? RestartAfter; /// <summary> /// Specifies whether to run the command in interactive mode. /// </summary> public readonly bool? RunAsInteractive; /// <summary> /// Specifies whether to run the command as administrator. /// </summary> public readonly bool? RunElevated; [OutputConstructor] private CommandResponse( string action, bool? alwaysRun, bool? applyUpdateBefore, string content, string contentType, int? maxRunTime, string name, bool? restartAfter, bool? runAsInteractive, bool? runElevated) { Action = action; AlwaysRun = alwaysRun; ApplyUpdateBefore = applyUpdateBefore; Content = content; ContentType = contentType; MaxRunTime = maxRunTime; Name = name; RestartAfter = restartAfter; RunAsInteractive = runAsInteractive; RunElevated = runElevated; } } }
29.010526
86
0.570029
[ "Apache-2.0" ]
polivbr/pulumi-azure-native
sdk/dotnet/TestBase/Outputs/CommandResponse.cs
2,756
C#
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ namespace Apache.Ignite.Tests { using System; /// <summary> /// Wraps an action to be executed on Dispose call. /// </summary> public sealed class DisposeAction : IDisposable { /** */ private readonly Action _action; /// <summary> /// Initializes a new instance of the <see cref="DisposeAction"/> class. /// </summary> /// <param name="action">Action.</param> public DisposeAction(Action action) { _action = action; } /** <inheritdoc /> */ public void Dispose() { _action(); } } }
31.347826
80
0.649098
[ "CC0-1.0" ]
IgGusev/ignite-3
modules/platforms/dotnet/Apache.Ignite.Tests/DisposeAction.cs
1,442
C#
//----------------------------------------------------------------------- // <copyright file="DateFormatValidator.cs" company="NJsonSchema"> // Copyright (c) Rico Suter. All rights reserved. // </copyright> // <license>https://github.com/rsuter/NJsonSchema/blob/master/LICENSE.md</license> // <author>Rico Suter, mail@rsuter.com</author> //----------------------------------------------------------------------- using Newtonsoft.Json.Linq; using System; using System.Globalization; namespace NJsonSchema.Validation.FormatValidators { /// <summary>Validator for "Date" format.</summary> public class DateFormatValidator : IFormatValidator { /// <summary>Validates format of given value.</summary> /// <param name="value">String value.</param> /// <param name="tokenType">Type of token holding the value.</param> /// <returns>True if value is correct for given format, False - if not.</returns> public bool IsValid(string value, JTokenType tokenType) { return tokenType == JTokenType.Date || DateTime.TryParseExact(value, "yyyy-MM-dd", null, DateTimeStyles.None, out DateTime dateTimeResult) && dateTimeResult.Date == dateTimeResult; } /// <summary>Gets the format attribute's value.</summary> public string Format { get; } = JsonFormatStrings.Date; /// <summary>Returns validation error kind.</summary> public ValidationErrorKind ValidationErrorKind { get; } = ValidationErrorKind.DateExpected; } }
43.361111
119
0.608584
[ "MIT" ]
DarkWanderer/NJsonSchema
src/NJsonSchema/Validation/FormatValidators/DateFormatValidator.cs
1,563
C#
/* * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). * You may not use this file except in compliance with the License. * A copy of the License is located at * * http://aws.amazon.com/apache2.0 * * or in the "license" file accompanying this file. This file is distributed * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either * express or implied. See the License for the specific language governing * permissions and limitations under the License. */ /* * Do not modify this file. This file is generated from the devops-guru-2020-12-01.normal.json service model. */ using System; using System.Threading; using System.Threading.Tasks; using System.Collections.Generic; using Amazon.Runtime; using Amazon.DevOpsGuru.Model; namespace Amazon.DevOpsGuru { /// <summary> /// Interface for accessing DevOpsGuru /// /// Amazon DevOps Guru is a fully managed service that helps you identify anomalous behavior /// in business critical operational applications. You specify the AWS resources that /// you want DevOps Guru to cover, then the Amazon CloudWatch metrics and AWS CloudTrail /// events related to those resources are analyzed. When anomalous behavior is detected, /// DevOps Guru creates an <i>insight</i> that includes recommendations, related events, /// and related metrics that can help you improve your operational applications. For more /// information, see <a href="https://docs.aws.amazon.com/devops-guru/latest/userguide/welcome.html">What /// is Amazon DevOps Guru</a>. /// /// /// <para> /// You can specify 1 or 2 Amazon Simple Notification Service topics so you are notified /// every time a new insight is created. You can also enable DevOps Guru to generate an /// OpsItem in AWS Systems Manager for each insight to help you manage and track your /// work addressing insights. /// </para> /// /// <para> /// To learn about the DevOps Guru workflow, see <a href="https://docs.aws.amazon.com/devops-guru/latest/userguide/welcome.html#how-it-works">How /// DevOps Guru works</a>. To learn about DevOps Guru concepts, see <a href="https://docs.aws.amazon.com/devops-guru/latest/userguide/concepts.html">Concepts /// in DevOps Guru</a>. /// </para> /// </summary> public partial interface IAmazonDevOpsGuru : IAmazonService, IDisposable { /// <summary> /// Paginators for the service /// </summary> IDevOpsGuruPaginatorFactory Paginators { get; } #region AddNotificationChannel /// <summary> /// Adds a notification channel to DevOps Guru. A notification channel is used to notify /// you about important DevOps Guru events, such as when an insight is generated. /// /// /// <para> /// If you use an Amazon SNS topic in another account, you must attach a policy to it /// that grants DevOps Guru permission to it notifications. DevOps Guru adds the required /// policy on your behalf to send notifications using Amazon SNS in your account. For /// more information, see <a href="https://docs.aws.amazon.com/devops-guru/latest/userguide/sns-required-permissions.html">Permissions /// for cross account Amazon SNS topics</a>. /// </para> /// /// <para> /// If you use an Amazon SNS topic that is encrypted by an AWS Key Management Service /// customer-managed key (CMK), then you must add permissions to the CMK. For more information, /// see <a href="https://docs.aws.amazon.com/devops-guru/latest/userguide/sns-kms-permissions.html">Permissions /// for AWS KMS–encrypted Amazon SNS topics</a>. /// </para> /// </summary> /// <param name="request">Container for the necessary parameters to execute the AddNotificationChannel service method.</param> /// /// <returns>The response from the AddNotificationChannel service method, as returned by DevOpsGuru.</returns> /// <exception cref="Amazon.DevOpsGuru.Model.AccessDeniedException"> /// You don't have permissions to perform the requested operation. The user or role that /// is making the request must have at least one IAM permissions policy attached that /// grants the required permissions. For more information, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/access.html">Access /// Management</a> in the <i>IAM User Guide</i>. /// </exception> /// <exception cref="Amazon.DevOpsGuru.Model.ConflictException"> /// An exception that is thrown when a conflict occurs. /// </exception> /// <exception cref="Amazon.DevOpsGuru.Model.InternalServerException"> /// An internal failure in an Amazon service occurred. /// </exception> /// <exception cref="Amazon.DevOpsGuru.Model.ResourceNotFoundException"> /// A requested resource could not be found /// </exception> /// <exception cref="Amazon.DevOpsGuru.Model.ServiceQuotaExceededException"> /// The request contains a value that exceeds a maximum quota. /// </exception> /// <exception cref="Amazon.DevOpsGuru.Model.ThrottlingException"> /// The request was denied due to a request throttling. /// </exception> /// <exception cref="Amazon.DevOpsGuru.Model.ValidationException"> /// Contains information about data passed in to a field during a request that is not /// valid. /// </exception> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/devops-guru-2020-12-01/AddNotificationChannel">REST API Reference for AddNotificationChannel Operation</seealso> AddNotificationChannelResponse AddNotificationChannel(AddNotificationChannelRequest request); /// <summary> /// Adds a notification channel to DevOps Guru. A notification channel is used to notify /// you about important DevOps Guru events, such as when an insight is generated. /// /// /// <para> /// If you use an Amazon SNS topic in another account, you must attach a policy to it /// that grants DevOps Guru permission to it notifications. DevOps Guru adds the required /// policy on your behalf to send notifications using Amazon SNS in your account. For /// more information, see <a href="https://docs.aws.amazon.com/devops-guru/latest/userguide/sns-required-permissions.html">Permissions /// for cross account Amazon SNS topics</a>. /// </para> /// /// <para> /// If you use an Amazon SNS topic that is encrypted by an AWS Key Management Service /// customer-managed key (CMK), then you must add permissions to the CMK. For more information, /// see <a href="https://docs.aws.amazon.com/devops-guru/latest/userguide/sns-kms-permissions.html">Permissions /// for AWS KMS–encrypted Amazon SNS topics</a>. /// </para> /// </summary> /// <param name="request">Container for the necessary parameters to execute the AddNotificationChannel service method.</param> /// <param name="cancellationToken"> /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// </param> /// /// <returns>The response from the AddNotificationChannel service method, as returned by DevOpsGuru.</returns> /// <exception cref="Amazon.DevOpsGuru.Model.AccessDeniedException"> /// You don't have permissions to perform the requested operation. The user or role that /// is making the request must have at least one IAM permissions policy attached that /// grants the required permissions. For more information, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/access.html">Access /// Management</a> in the <i>IAM User Guide</i>. /// </exception> /// <exception cref="Amazon.DevOpsGuru.Model.ConflictException"> /// An exception that is thrown when a conflict occurs. /// </exception> /// <exception cref="Amazon.DevOpsGuru.Model.InternalServerException"> /// An internal failure in an Amazon service occurred. /// </exception> /// <exception cref="Amazon.DevOpsGuru.Model.ResourceNotFoundException"> /// A requested resource could not be found /// </exception> /// <exception cref="Amazon.DevOpsGuru.Model.ServiceQuotaExceededException"> /// The request contains a value that exceeds a maximum quota. /// </exception> /// <exception cref="Amazon.DevOpsGuru.Model.ThrottlingException"> /// The request was denied due to a request throttling. /// </exception> /// <exception cref="Amazon.DevOpsGuru.Model.ValidationException"> /// Contains information about data passed in to a field during a request that is not /// valid. /// </exception> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/devops-guru-2020-12-01/AddNotificationChannel">REST API Reference for AddNotificationChannel Operation</seealso> Task<AddNotificationChannelResponse> AddNotificationChannelAsync(AddNotificationChannelRequest request, CancellationToken cancellationToken = default(CancellationToken)); #endregion #region DescribeAccountHealth /// <summary> /// Returns the number of open reactive insights, the number of open proactive insights, /// and the number of metrics analyzed in your AWS account. Use these numbers to gauge /// the health of operations in your AWS account. /// </summary> /// <param name="request">Container for the necessary parameters to execute the DescribeAccountHealth service method.</param> /// /// <returns>The response from the DescribeAccountHealth service method, as returned by DevOpsGuru.</returns> /// <exception cref="Amazon.DevOpsGuru.Model.AccessDeniedException"> /// You don't have permissions to perform the requested operation. The user or role that /// is making the request must have at least one IAM permissions policy attached that /// grants the required permissions. For more information, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/access.html">Access /// Management</a> in the <i>IAM User Guide</i>. /// </exception> /// <exception cref="Amazon.DevOpsGuru.Model.InternalServerException"> /// An internal failure in an Amazon service occurred. /// </exception> /// <exception cref="Amazon.DevOpsGuru.Model.ThrottlingException"> /// The request was denied due to a request throttling. /// </exception> /// <exception cref="Amazon.DevOpsGuru.Model.ValidationException"> /// Contains information about data passed in to a field during a request that is not /// valid. /// </exception> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/devops-guru-2020-12-01/DescribeAccountHealth">REST API Reference for DescribeAccountHealth Operation</seealso> DescribeAccountHealthResponse DescribeAccountHealth(DescribeAccountHealthRequest request); /// <summary> /// Returns the number of open reactive insights, the number of open proactive insights, /// and the number of metrics analyzed in your AWS account. Use these numbers to gauge /// the health of operations in your AWS account. /// </summary> /// <param name="request">Container for the necessary parameters to execute the DescribeAccountHealth service method.</param> /// <param name="cancellationToken"> /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// </param> /// /// <returns>The response from the DescribeAccountHealth service method, as returned by DevOpsGuru.</returns> /// <exception cref="Amazon.DevOpsGuru.Model.AccessDeniedException"> /// You don't have permissions to perform the requested operation. The user or role that /// is making the request must have at least one IAM permissions policy attached that /// grants the required permissions. For more information, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/access.html">Access /// Management</a> in the <i>IAM User Guide</i>. /// </exception> /// <exception cref="Amazon.DevOpsGuru.Model.InternalServerException"> /// An internal failure in an Amazon service occurred. /// </exception> /// <exception cref="Amazon.DevOpsGuru.Model.ThrottlingException"> /// The request was denied due to a request throttling. /// </exception> /// <exception cref="Amazon.DevOpsGuru.Model.ValidationException"> /// Contains information about data passed in to a field during a request that is not /// valid. /// </exception> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/devops-guru-2020-12-01/DescribeAccountHealth">REST API Reference for DescribeAccountHealth Operation</seealso> Task<DescribeAccountHealthResponse> DescribeAccountHealthAsync(DescribeAccountHealthRequest request, CancellationToken cancellationToken = default(CancellationToken)); #endregion #region DescribeAccountOverview /// <summary> /// For the time range passed in, returns the number of open reactive insight that were /// created, the number of open proactive insights that were created, and the Mean Time /// to Recover (MTTR) for all closed reactive insights. /// </summary> /// <param name="request">Container for the necessary parameters to execute the DescribeAccountOverview service method.</param> /// /// <returns>The response from the DescribeAccountOverview service method, as returned by DevOpsGuru.</returns> /// <exception cref="Amazon.DevOpsGuru.Model.AccessDeniedException"> /// You don't have permissions to perform the requested operation. The user or role that /// is making the request must have at least one IAM permissions policy attached that /// grants the required permissions. For more information, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/access.html">Access /// Management</a> in the <i>IAM User Guide</i>. /// </exception> /// <exception cref="Amazon.DevOpsGuru.Model.InternalServerException"> /// An internal failure in an Amazon service occurred. /// </exception> /// <exception cref="Amazon.DevOpsGuru.Model.ThrottlingException"> /// The request was denied due to a request throttling. /// </exception> /// <exception cref="Amazon.DevOpsGuru.Model.ValidationException"> /// Contains information about data passed in to a field during a request that is not /// valid. /// </exception> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/devops-guru-2020-12-01/DescribeAccountOverview">REST API Reference for DescribeAccountOverview Operation</seealso> DescribeAccountOverviewResponse DescribeAccountOverview(DescribeAccountOverviewRequest request); /// <summary> /// For the time range passed in, returns the number of open reactive insight that were /// created, the number of open proactive insights that were created, and the Mean Time /// to Recover (MTTR) for all closed reactive insights. /// </summary> /// <param name="request">Container for the necessary parameters to execute the DescribeAccountOverview service method.</param> /// <param name="cancellationToken"> /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// </param> /// /// <returns>The response from the DescribeAccountOverview service method, as returned by DevOpsGuru.</returns> /// <exception cref="Amazon.DevOpsGuru.Model.AccessDeniedException"> /// You don't have permissions to perform the requested operation. The user or role that /// is making the request must have at least one IAM permissions policy attached that /// grants the required permissions. For more information, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/access.html">Access /// Management</a> in the <i>IAM User Guide</i>. /// </exception> /// <exception cref="Amazon.DevOpsGuru.Model.InternalServerException"> /// An internal failure in an Amazon service occurred. /// </exception> /// <exception cref="Amazon.DevOpsGuru.Model.ThrottlingException"> /// The request was denied due to a request throttling. /// </exception> /// <exception cref="Amazon.DevOpsGuru.Model.ValidationException"> /// Contains information about data passed in to a field during a request that is not /// valid. /// </exception> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/devops-guru-2020-12-01/DescribeAccountOverview">REST API Reference for DescribeAccountOverview Operation</seealso> Task<DescribeAccountOverviewResponse> DescribeAccountOverviewAsync(DescribeAccountOverviewRequest request, CancellationToken cancellationToken = default(CancellationToken)); #endregion #region DescribeAnomaly /// <summary> /// Returns details about an anomaly that you specify using its ID. /// </summary> /// <param name="request">Container for the necessary parameters to execute the DescribeAnomaly service method.</param> /// /// <returns>The response from the DescribeAnomaly service method, as returned by DevOpsGuru.</returns> /// <exception cref="Amazon.DevOpsGuru.Model.AccessDeniedException"> /// You don't have permissions to perform the requested operation. The user or role that /// is making the request must have at least one IAM permissions policy attached that /// grants the required permissions. For more information, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/access.html">Access /// Management</a> in the <i>IAM User Guide</i>. /// </exception> /// <exception cref="Amazon.DevOpsGuru.Model.InternalServerException"> /// An internal failure in an Amazon service occurred. /// </exception> /// <exception cref="Amazon.DevOpsGuru.Model.ResourceNotFoundException"> /// A requested resource could not be found /// </exception> /// <exception cref="Amazon.DevOpsGuru.Model.ThrottlingException"> /// The request was denied due to a request throttling. /// </exception> /// <exception cref="Amazon.DevOpsGuru.Model.ValidationException"> /// Contains information about data passed in to a field during a request that is not /// valid. /// </exception> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/devops-guru-2020-12-01/DescribeAnomaly">REST API Reference for DescribeAnomaly Operation</seealso> DescribeAnomalyResponse DescribeAnomaly(DescribeAnomalyRequest request); /// <summary> /// Returns details about an anomaly that you specify using its ID. /// </summary> /// <param name="request">Container for the necessary parameters to execute the DescribeAnomaly service method.</param> /// <param name="cancellationToken"> /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// </param> /// /// <returns>The response from the DescribeAnomaly service method, as returned by DevOpsGuru.</returns> /// <exception cref="Amazon.DevOpsGuru.Model.AccessDeniedException"> /// You don't have permissions to perform the requested operation. The user or role that /// is making the request must have at least one IAM permissions policy attached that /// grants the required permissions. For more information, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/access.html">Access /// Management</a> in the <i>IAM User Guide</i>. /// </exception> /// <exception cref="Amazon.DevOpsGuru.Model.InternalServerException"> /// An internal failure in an Amazon service occurred. /// </exception> /// <exception cref="Amazon.DevOpsGuru.Model.ResourceNotFoundException"> /// A requested resource could not be found /// </exception> /// <exception cref="Amazon.DevOpsGuru.Model.ThrottlingException"> /// The request was denied due to a request throttling. /// </exception> /// <exception cref="Amazon.DevOpsGuru.Model.ValidationException"> /// Contains information about data passed in to a field during a request that is not /// valid. /// </exception> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/devops-guru-2020-12-01/DescribeAnomaly">REST API Reference for DescribeAnomaly Operation</seealso> Task<DescribeAnomalyResponse> DescribeAnomalyAsync(DescribeAnomalyRequest request, CancellationToken cancellationToken = default(CancellationToken)); #endregion #region DescribeFeedback /// <summary> /// Returns the most recent feedback submitted in the current AWS account and Region. /// </summary> /// <param name="request">Container for the necessary parameters to execute the DescribeFeedback service method.</param> /// /// <returns>The response from the DescribeFeedback service method, as returned by DevOpsGuru.</returns> /// <exception cref="Amazon.DevOpsGuru.Model.AccessDeniedException"> /// You don't have permissions to perform the requested operation. The user or role that /// is making the request must have at least one IAM permissions policy attached that /// grants the required permissions. For more information, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/access.html">Access /// Management</a> in the <i>IAM User Guide</i>. /// </exception> /// <exception cref="Amazon.DevOpsGuru.Model.InternalServerException"> /// An internal failure in an Amazon service occurred. /// </exception> /// <exception cref="Amazon.DevOpsGuru.Model.ResourceNotFoundException"> /// A requested resource could not be found /// </exception> /// <exception cref="Amazon.DevOpsGuru.Model.ThrottlingException"> /// The request was denied due to a request throttling. /// </exception> /// <exception cref="Amazon.DevOpsGuru.Model.ValidationException"> /// Contains information about data passed in to a field during a request that is not /// valid. /// </exception> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/devops-guru-2020-12-01/DescribeFeedback">REST API Reference for DescribeFeedback Operation</seealso> DescribeFeedbackResponse DescribeFeedback(DescribeFeedbackRequest request); /// <summary> /// Returns the most recent feedback submitted in the current AWS account and Region. /// </summary> /// <param name="request">Container for the necessary parameters to execute the DescribeFeedback service method.</param> /// <param name="cancellationToken"> /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// </param> /// /// <returns>The response from the DescribeFeedback service method, as returned by DevOpsGuru.</returns> /// <exception cref="Amazon.DevOpsGuru.Model.AccessDeniedException"> /// You don't have permissions to perform the requested operation. The user or role that /// is making the request must have at least one IAM permissions policy attached that /// grants the required permissions. For more information, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/access.html">Access /// Management</a> in the <i>IAM User Guide</i>. /// </exception> /// <exception cref="Amazon.DevOpsGuru.Model.InternalServerException"> /// An internal failure in an Amazon service occurred. /// </exception> /// <exception cref="Amazon.DevOpsGuru.Model.ResourceNotFoundException"> /// A requested resource could not be found /// </exception> /// <exception cref="Amazon.DevOpsGuru.Model.ThrottlingException"> /// The request was denied due to a request throttling. /// </exception> /// <exception cref="Amazon.DevOpsGuru.Model.ValidationException"> /// Contains information about data passed in to a field during a request that is not /// valid. /// </exception> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/devops-guru-2020-12-01/DescribeFeedback">REST API Reference for DescribeFeedback Operation</seealso> Task<DescribeFeedbackResponse> DescribeFeedbackAsync(DescribeFeedbackRequest request, CancellationToken cancellationToken = default(CancellationToken)); #endregion #region DescribeInsight /// <summary> /// Returns details about an insight that you specify using its ID. /// </summary> /// <param name="request">Container for the necessary parameters to execute the DescribeInsight service method.</param> /// /// <returns>The response from the DescribeInsight service method, as returned by DevOpsGuru.</returns> /// <exception cref="Amazon.DevOpsGuru.Model.AccessDeniedException"> /// You don't have permissions to perform the requested operation. The user or role that /// is making the request must have at least one IAM permissions policy attached that /// grants the required permissions. For more information, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/access.html">Access /// Management</a> in the <i>IAM User Guide</i>. /// </exception> /// <exception cref="Amazon.DevOpsGuru.Model.InternalServerException"> /// An internal failure in an Amazon service occurred. /// </exception> /// <exception cref="Amazon.DevOpsGuru.Model.ResourceNotFoundException"> /// A requested resource could not be found /// </exception> /// <exception cref="Amazon.DevOpsGuru.Model.ThrottlingException"> /// The request was denied due to a request throttling. /// </exception> /// <exception cref="Amazon.DevOpsGuru.Model.ValidationException"> /// Contains information about data passed in to a field during a request that is not /// valid. /// </exception> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/devops-guru-2020-12-01/DescribeInsight">REST API Reference for DescribeInsight Operation</seealso> DescribeInsightResponse DescribeInsight(DescribeInsightRequest request); /// <summary> /// Returns details about an insight that you specify using its ID. /// </summary> /// <param name="request">Container for the necessary parameters to execute the DescribeInsight service method.</param> /// <param name="cancellationToken"> /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// </param> /// /// <returns>The response from the DescribeInsight service method, as returned by DevOpsGuru.</returns> /// <exception cref="Amazon.DevOpsGuru.Model.AccessDeniedException"> /// You don't have permissions to perform the requested operation. The user or role that /// is making the request must have at least one IAM permissions policy attached that /// grants the required permissions. For more information, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/access.html">Access /// Management</a> in the <i>IAM User Guide</i>. /// </exception> /// <exception cref="Amazon.DevOpsGuru.Model.InternalServerException"> /// An internal failure in an Amazon service occurred. /// </exception> /// <exception cref="Amazon.DevOpsGuru.Model.ResourceNotFoundException"> /// A requested resource could not be found /// </exception> /// <exception cref="Amazon.DevOpsGuru.Model.ThrottlingException"> /// The request was denied due to a request throttling. /// </exception> /// <exception cref="Amazon.DevOpsGuru.Model.ValidationException"> /// Contains information about data passed in to a field during a request that is not /// valid. /// </exception> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/devops-guru-2020-12-01/DescribeInsight">REST API Reference for DescribeInsight Operation</seealso> Task<DescribeInsightResponse> DescribeInsightAsync(DescribeInsightRequest request, CancellationToken cancellationToken = default(CancellationToken)); #endregion #region DescribeResourceCollectionHealth /// <summary> /// Returns the number of open proactive insights, open reactive insights, and the Mean /// Time to Recover (MTTR) for all closed insights in resource collections in your account. /// You specify the type of AWS resources collection. The one type of AWS resource collection /// supported is AWS CloudFormation stacks. DevOps Guru can be configured to analyze only /// the AWS resources that are defined in the stacks. /// </summary> /// <param name="request">Container for the necessary parameters to execute the DescribeResourceCollectionHealth service method.</param> /// /// <returns>The response from the DescribeResourceCollectionHealth service method, as returned by DevOpsGuru.</returns> /// <exception cref="Amazon.DevOpsGuru.Model.AccessDeniedException"> /// You don't have permissions to perform the requested operation. The user or role that /// is making the request must have at least one IAM permissions policy attached that /// grants the required permissions. For more information, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/access.html">Access /// Management</a> in the <i>IAM User Guide</i>. /// </exception> /// <exception cref="Amazon.DevOpsGuru.Model.InternalServerException"> /// An internal failure in an Amazon service occurred. /// </exception> /// <exception cref="Amazon.DevOpsGuru.Model.ThrottlingException"> /// The request was denied due to a request throttling. /// </exception> /// <exception cref="Amazon.DevOpsGuru.Model.ValidationException"> /// Contains information about data passed in to a field during a request that is not /// valid. /// </exception> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/devops-guru-2020-12-01/DescribeResourceCollectionHealth">REST API Reference for DescribeResourceCollectionHealth Operation</seealso> DescribeResourceCollectionHealthResponse DescribeResourceCollectionHealth(DescribeResourceCollectionHealthRequest request); /// <summary> /// Returns the number of open proactive insights, open reactive insights, and the Mean /// Time to Recover (MTTR) for all closed insights in resource collections in your account. /// You specify the type of AWS resources collection. The one type of AWS resource collection /// supported is AWS CloudFormation stacks. DevOps Guru can be configured to analyze only /// the AWS resources that are defined in the stacks. /// </summary> /// <param name="request">Container for the necessary parameters to execute the DescribeResourceCollectionHealth service method.</param> /// <param name="cancellationToken"> /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// </param> /// /// <returns>The response from the DescribeResourceCollectionHealth service method, as returned by DevOpsGuru.</returns> /// <exception cref="Amazon.DevOpsGuru.Model.AccessDeniedException"> /// You don't have permissions to perform the requested operation. The user or role that /// is making the request must have at least one IAM permissions policy attached that /// grants the required permissions. For more information, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/access.html">Access /// Management</a> in the <i>IAM User Guide</i>. /// </exception> /// <exception cref="Amazon.DevOpsGuru.Model.InternalServerException"> /// An internal failure in an Amazon service occurred. /// </exception> /// <exception cref="Amazon.DevOpsGuru.Model.ThrottlingException"> /// The request was denied due to a request throttling. /// </exception> /// <exception cref="Amazon.DevOpsGuru.Model.ValidationException"> /// Contains information about data passed in to a field during a request that is not /// valid. /// </exception> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/devops-guru-2020-12-01/DescribeResourceCollectionHealth">REST API Reference for DescribeResourceCollectionHealth Operation</seealso> Task<DescribeResourceCollectionHealthResponse> DescribeResourceCollectionHealthAsync(DescribeResourceCollectionHealthRequest request, CancellationToken cancellationToken = default(CancellationToken)); #endregion #region DescribeServiceIntegration /// <summary> /// Returns the integration status of services that are integrated with DevOps Guru. /// The one service that can be integrated with DevOps Guru is AWS Systems Manager, which /// can be used to create an OpsItem for each generated insight. /// </summary> /// <param name="request">Container for the necessary parameters to execute the DescribeServiceIntegration service method.</param> /// /// <returns>The response from the DescribeServiceIntegration service method, as returned by DevOpsGuru.</returns> /// <exception cref="Amazon.DevOpsGuru.Model.AccessDeniedException"> /// You don't have permissions to perform the requested operation. The user or role that /// is making the request must have at least one IAM permissions policy attached that /// grants the required permissions. For more information, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/access.html">Access /// Management</a> in the <i>IAM User Guide</i>. /// </exception> /// <exception cref="Amazon.DevOpsGuru.Model.InternalServerException"> /// An internal failure in an Amazon service occurred. /// </exception> /// <exception cref="Amazon.DevOpsGuru.Model.ThrottlingException"> /// The request was denied due to a request throttling. /// </exception> /// <exception cref="Amazon.DevOpsGuru.Model.ValidationException"> /// Contains information about data passed in to a field during a request that is not /// valid. /// </exception> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/devops-guru-2020-12-01/DescribeServiceIntegration">REST API Reference for DescribeServiceIntegration Operation</seealso> DescribeServiceIntegrationResponse DescribeServiceIntegration(DescribeServiceIntegrationRequest request); /// <summary> /// Returns the integration status of services that are integrated with DevOps Guru. /// The one service that can be integrated with DevOps Guru is AWS Systems Manager, which /// can be used to create an OpsItem for each generated insight. /// </summary> /// <param name="request">Container for the necessary parameters to execute the DescribeServiceIntegration service method.</param> /// <param name="cancellationToken"> /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// </param> /// /// <returns>The response from the DescribeServiceIntegration service method, as returned by DevOpsGuru.</returns> /// <exception cref="Amazon.DevOpsGuru.Model.AccessDeniedException"> /// You don't have permissions to perform the requested operation. The user or role that /// is making the request must have at least one IAM permissions policy attached that /// grants the required permissions. For more information, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/access.html">Access /// Management</a> in the <i>IAM User Guide</i>. /// </exception> /// <exception cref="Amazon.DevOpsGuru.Model.InternalServerException"> /// An internal failure in an Amazon service occurred. /// </exception> /// <exception cref="Amazon.DevOpsGuru.Model.ThrottlingException"> /// The request was denied due to a request throttling. /// </exception> /// <exception cref="Amazon.DevOpsGuru.Model.ValidationException"> /// Contains information about data passed in to a field during a request that is not /// valid. /// </exception> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/devops-guru-2020-12-01/DescribeServiceIntegration">REST API Reference for DescribeServiceIntegration Operation</seealso> Task<DescribeServiceIntegrationResponse> DescribeServiceIntegrationAsync(DescribeServiceIntegrationRequest request, CancellationToken cancellationToken = default(CancellationToken)); #endregion #region GetResourceCollection /// <summary> /// Returns lists AWS resources that are of the specified resource collection type. The /// one type of AWS resource collection supported is AWS CloudFormation stacks. DevOps /// Guru can be configured to analyze only the AWS resources that are defined in the stacks. /// </summary> /// <param name="request">Container for the necessary parameters to execute the GetResourceCollection service method.</param> /// /// <returns>The response from the GetResourceCollection service method, as returned by DevOpsGuru.</returns> /// <exception cref="Amazon.DevOpsGuru.Model.AccessDeniedException"> /// You don't have permissions to perform the requested operation. The user or role that /// is making the request must have at least one IAM permissions policy attached that /// grants the required permissions. For more information, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/access.html">Access /// Management</a> in the <i>IAM User Guide</i>. /// </exception> /// <exception cref="Amazon.DevOpsGuru.Model.InternalServerException"> /// An internal failure in an Amazon service occurred. /// </exception> /// <exception cref="Amazon.DevOpsGuru.Model.ResourceNotFoundException"> /// A requested resource could not be found /// </exception> /// <exception cref="Amazon.DevOpsGuru.Model.ThrottlingException"> /// The request was denied due to a request throttling. /// </exception> /// <exception cref="Amazon.DevOpsGuru.Model.ValidationException"> /// Contains information about data passed in to a field during a request that is not /// valid. /// </exception> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/devops-guru-2020-12-01/GetResourceCollection">REST API Reference for GetResourceCollection Operation</seealso> GetResourceCollectionResponse GetResourceCollection(GetResourceCollectionRequest request); /// <summary> /// Returns lists AWS resources that are of the specified resource collection type. The /// one type of AWS resource collection supported is AWS CloudFormation stacks. DevOps /// Guru can be configured to analyze only the AWS resources that are defined in the stacks. /// </summary> /// <param name="request">Container for the necessary parameters to execute the GetResourceCollection service method.</param> /// <param name="cancellationToken"> /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// </param> /// /// <returns>The response from the GetResourceCollection service method, as returned by DevOpsGuru.</returns> /// <exception cref="Amazon.DevOpsGuru.Model.AccessDeniedException"> /// You don't have permissions to perform the requested operation. The user or role that /// is making the request must have at least one IAM permissions policy attached that /// grants the required permissions. For more information, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/access.html">Access /// Management</a> in the <i>IAM User Guide</i>. /// </exception> /// <exception cref="Amazon.DevOpsGuru.Model.InternalServerException"> /// An internal failure in an Amazon service occurred. /// </exception> /// <exception cref="Amazon.DevOpsGuru.Model.ResourceNotFoundException"> /// A requested resource could not be found /// </exception> /// <exception cref="Amazon.DevOpsGuru.Model.ThrottlingException"> /// The request was denied due to a request throttling. /// </exception> /// <exception cref="Amazon.DevOpsGuru.Model.ValidationException"> /// Contains information about data passed in to a field during a request that is not /// valid. /// </exception> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/devops-guru-2020-12-01/GetResourceCollection">REST API Reference for GetResourceCollection Operation</seealso> Task<GetResourceCollectionResponse> GetResourceCollectionAsync(GetResourceCollectionRequest request, CancellationToken cancellationToken = default(CancellationToken)); #endregion #region ListAnomaliesForInsight /// <summary> /// Returns a list of the anomalies that belong to an insight that you specify using /// its ID. /// </summary> /// <param name="request">Container for the necessary parameters to execute the ListAnomaliesForInsight service method.</param> /// /// <returns>The response from the ListAnomaliesForInsight service method, as returned by DevOpsGuru.</returns> /// <exception cref="Amazon.DevOpsGuru.Model.AccessDeniedException"> /// You don't have permissions to perform the requested operation. The user or role that /// is making the request must have at least one IAM permissions policy attached that /// grants the required permissions. For more information, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/access.html">Access /// Management</a> in the <i>IAM User Guide</i>. /// </exception> /// <exception cref="Amazon.DevOpsGuru.Model.InternalServerException"> /// An internal failure in an Amazon service occurred. /// </exception> /// <exception cref="Amazon.DevOpsGuru.Model.ResourceNotFoundException"> /// A requested resource could not be found /// </exception> /// <exception cref="Amazon.DevOpsGuru.Model.ThrottlingException"> /// The request was denied due to a request throttling. /// </exception> /// <exception cref="Amazon.DevOpsGuru.Model.ValidationException"> /// Contains information about data passed in to a field during a request that is not /// valid. /// </exception> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/devops-guru-2020-12-01/ListAnomaliesForInsight">REST API Reference for ListAnomaliesForInsight Operation</seealso> ListAnomaliesForInsightResponse ListAnomaliesForInsight(ListAnomaliesForInsightRequest request); /// <summary> /// Returns a list of the anomalies that belong to an insight that you specify using /// its ID. /// </summary> /// <param name="request">Container for the necessary parameters to execute the ListAnomaliesForInsight service method.</param> /// <param name="cancellationToken"> /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// </param> /// /// <returns>The response from the ListAnomaliesForInsight service method, as returned by DevOpsGuru.</returns> /// <exception cref="Amazon.DevOpsGuru.Model.AccessDeniedException"> /// You don't have permissions to perform the requested operation. The user or role that /// is making the request must have at least one IAM permissions policy attached that /// grants the required permissions. For more information, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/access.html">Access /// Management</a> in the <i>IAM User Guide</i>. /// </exception> /// <exception cref="Amazon.DevOpsGuru.Model.InternalServerException"> /// An internal failure in an Amazon service occurred. /// </exception> /// <exception cref="Amazon.DevOpsGuru.Model.ResourceNotFoundException"> /// A requested resource could not be found /// </exception> /// <exception cref="Amazon.DevOpsGuru.Model.ThrottlingException"> /// The request was denied due to a request throttling. /// </exception> /// <exception cref="Amazon.DevOpsGuru.Model.ValidationException"> /// Contains information about data passed in to a field during a request that is not /// valid. /// </exception> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/devops-guru-2020-12-01/ListAnomaliesForInsight">REST API Reference for ListAnomaliesForInsight Operation</seealso> Task<ListAnomaliesForInsightResponse> ListAnomaliesForInsightAsync(ListAnomaliesForInsightRequest request, CancellationToken cancellationToken = default(CancellationToken)); #endregion #region ListEvents /// <summary> /// Returns a list of the events emitted by the resources that are evaluated by DevOps /// Guru. You can use filters to specify which events are returned. /// </summary> /// <param name="request">Container for the necessary parameters to execute the ListEvents service method.</param> /// /// <returns>The response from the ListEvents service method, as returned by DevOpsGuru.</returns> /// <exception cref="Amazon.DevOpsGuru.Model.AccessDeniedException"> /// You don't have permissions to perform the requested operation. The user or role that /// is making the request must have at least one IAM permissions policy attached that /// grants the required permissions. For more information, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/access.html">Access /// Management</a> in the <i>IAM User Guide</i>. /// </exception> /// <exception cref="Amazon.DevOpsGuru.Model.InternalServerException"> /// An internal failure in an Amazon service occurred. /// </exception> /// <exception cref="Amazon.DevOpsGuru.Model.ResourceNotFoundException"> /// A requested resource could not be found /// </exception> /// <exception cref="Amazon.DevOpsGuru.Model.ThrottlingException"> /// The request was denied due to a request throttling. /// </exception> /// <exception cref="Amazon.DevOpsGuru.Model.ValidationException"> /// Contains information about data passed in to a field during a request that is not /// valid. /// </exception> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/devops-guru-2020-12-01/ListEvents">REST API Reference for ListEvents Operation</seealso> ListEventsResponse ListEvents(ListEventsRequest request); /// <summary> /// Returns a list of the events emitted by the resources that are evaluated by DevOps /// Guru. You can use filters to specify which events are returned. /// </summary> /// <param name="request">Container for the necessary parameters to execute the ListEvents service method.</param> /// <param name="cancellationToken"> /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// </param> /// /// <returns>The response from the ListEvents service method, as returned by DevOpsGuru.</returns> /// <exception cref="Amazon.DevOpsGuru.Model.AccessDeniedException"> /// You don't have permissions to perform the requested operation. The user or role that /// is making the request must have at least one IAM permissions policy attached that /// grants the required permissions. For more information, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/access.html">Access /// Management</a> in the <i>IAM User Guide</i>. /// </exception> /// <exception cref="Amazon.DevOpsGuru.Model.InternalServerException"> /// An internal failure in an Amazon service occurred. /// </exception> /// <exception cref="Amazon.DevOpsGuru.Model.ResourceNotFoundException"> /// A requested resource could not be found /// </exception> /// <exception cref="Amazon.DevOpsGuru.Model.ThrottlingException"> /// The request was denied due to a request throttling. /// </exception> /// <exception cref="Amazon.DevOpsGuru.Model.ValidationException"> /// Contains information about data passed in to a field during a request that is not /// valid. /// </exception> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/devops-guru-2020-12-01/ListEvents">REST API Reference for ListEvents Operation</seealso> Task<ListEventsResponse> ListEventsAsync(ListEventsRequest request, CancellationToken cancellationToken = default(CancellationToken)); #endregion #region ListInsights /// <summary> /// Returns a list of insights in your AWS account. You can specify which insights are /// returned by their start time and status (<code>ONGOING</code>, <code>CLOSED</code>, /// or <code>ANY</code>). /// </summary> /// <param name="request">Container for the necessary parameters to execute the ListInsights service method.</param> /// /// <returns>The response from the ListInsights service method, as returned by DevOpsGuru.</returns> /// <exception cref="Amazon.DevOpsGuru.Model.AccessDeniedException"> /// You don't have permissions to perform the requested operation. The user or role that /// is making the request must have at least one IAM permissions policy attached that /// grants the required permissions. For more information, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/access.html">Access /// Management</a> in the <i>IAM User Guide</i>. /// </exception> /// <exception cref="Amazon.DevOpsGuru.Model.InternalServerException"> /// An internal failure in an Amazon service occurred. /// </exception> /// <exception cref="Amazon.DevOpsGuru.Model.ThrottlingException"> /// The request was denied due to a request throttling. /// </exception> /// <exception cref="Amazon.DevOpsGuru.Model.ValidationException"> /// Contains information about data passed in to a field during a request that is not /// valid. /// </exception> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/devops-guru-2020-12-01/ListInsights">REST API Reference for ListInsights Operation</seealso> ListInsightsResponse ListInsights(ListInsightsRequest request); /// <summary> /// Returns a list of insights in your AWS account. You can specify which insights are /// returned by their start time and status (<code>ONGOING</code>, <code>CLOSED</code>, /// or <code>ANY</code>). /// </summary> /// <param name="request">Container for the necessary parameters to execute the ListInsights service method.</param> /// <param name="cancellationToken"> /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// </param> /// /// <returns>The response from the ListInsights service method, as returned by DevOpsGuru.</returns> /// <exception cref="Amazon.DevOpsGuru.Model.AccessDeniedException"> /// You don't have permissions to perform the requested operation. The user or role that /// is making the request must have at least one IAM permissions policy attached that /// grants the required permissions. For more information, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/access.html">Access /// Management</a> in the <i>IAM User Guide</i>. /// </exception> /// <exception cref="Amazon.DevOpsGuru.Model.InternalServerException"> /// An internal failure in an Amazon service occurred. /// </exception> /// <exception cref="Amazon.DevOpsGuru.Model.ThrottlingException"> /// The request was denied due to a request throttling. /// </exception> /// <exception cref="Amazon.DevOpsGuru.Model.ValidationException"> /// Contains information about data passed in to a field during a request that is not /// valid. /// </exception> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/devops-guru-2020-12-01/ListInsights">REST API Reference for ListInsights Operation</seealso> Task<ListInsightsResponse> ListInsightsAsync(ListInsightsRequest request, CancellationToken cancellationToken = default(CancellationToken)); #endregion #region ListNotificationChannels /// <summary> /// Returns a list of notification channels configured for DevOps Guru. Each notification /// channel is used to notify you when DevOps Guru generates an insight that contains /// information about how to improve your operations. The one supported notification channel /// is Amazon Simple Notification Service (Amazon SNS). /// </summary> /// <param name="request">Container for the necessary parameters to execute the ListNotificationChannels service method.</param> /// /// <returns>The response from the ListNotificationChannels service method, as returned by DevOpsGuru.</returns> /// <exception cref="Amazon.DevOpsGuru.Model.AccessDeniedException"> /// You don't have permissions to perform the requested operation. The user or role that /// is making the request must have at least one IAM permissions policy attached that /// grants the required permissions. For more information, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/access.html">Access /// Management</a> in the <i>IAM User Guide</i>. /// </exception> /// <exception cref="Amazon.DevOpsGuru.Model.InternalServerException"> /// An internal failure in an Amazon service occurred. /// </exception> /// <exception cref="Amazon.DevOpsGuru.Model.ThrottlingException"> /// The request was denied due to a request throttling. /// </exception> /// <exception cref="Amazon.DevOpsGuru.Model.ValidationException"> /// Contains information about data passed in to a field during a request that is not /// valid. /// </exception> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/devops-guru-2020-12-01/ListNotificationChannels">REST API Reference for ListNotificationChannels Operation</seealso> ListNotificationChannelsResponse ListNotificationChannels(ListNotificationChannelsRequest request); /// <summary> /// Returns a list of notification channels configured for DevOps Guru. Each notification /// channel is used to notify you when DevOps Guru generates an insight that contains /// information about how to improve your operations. The one supported notification channel /// is Amazon Simple Notification Service (Amazon SNS). /// </summary> /// <param name="request">Container for the necessary parameters to execute the ListNotificationChannels service method.</param> /// <param name="cancellationToken"> /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// </param> /// /// <returns>The response from the ListNotificationChannels service method, as returned by DevOpsGuru.</returns> /// <exception cref="Amazon.DevOpsGuru.Model.AccessDeniedException"> /// You don't have permissions to perform the requested operation. The user or role that /// is making the request must have at least one IAM permissions policy attached that /// grants the required permissions. For more information, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/access.html">Access /// Management</a> in the <i>IAM User Guide</i>. /// </exception> /// <exception cref="Amazon.DevOpsGuru.Model.InternalServerException"> /// An internal failure in an Amazon service occurred. /// </exception> /// <exception cref="Amazon.DevOpsGuru.Model.ThrottlingException"> /// The request was denied due to a request throttling. /// </exception> /// <exception cref="Amazon.DevOpsGuru.Model.ValidationException"> /// Contains information about data passed in to a field during a request that is not /// valid. /// </exception> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/devops-guru-2020-12-01/ListNotificationChannels">REST API Reference for ListNotificationChannels Operation</seealso> Task<ListNotificationChannelsResponse> ListNotificationChannelsAsync(ListNotificationChannelsRequest request, CancellationToken cancellationToken = default(CancellationToken)); #endregion #region ListRecommendations /// <summary> /// Returns a list of a specified insight's recommendations. Each recommendation includes /// a list of related metrics and a list of related events. /// </summary> /// <param name="request">Container for the necessary parameters to execute the ListRecommendations service method.</param> /// /// <returns>The response from the ListRecommendations service method, as returned by DevOpsGuru.</returns> /// <exception cref="Amazon.DevOpsGuru.Model.AccessDeniedException"> /// You don't have permissions to perform the requested operation. The user or role that /// is making the request must have at least one IAM permissions policy attached that /// grants the required permissions. For more information, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/access.html">Access /// Management</a> in the <i>IAM User Guide</i>. /// </exception> /// <exception cref="Amazon.DevOpsGuru.Model.InternalServerException"> /// An internal failure in an Amazon service occurred. /// </exception> /// <exception cref="Amazon.DevOpsGuru.Model.ResourceNotFoundException"> /// A requested resource could not be found /// </exception> /// <exception cref="Amazon.DevOpsGuru.Model.ThrottlingException"> /// The request was denied due to a request throttling. /// </exception> /// <exception cref="Amazon.DevOpsGuru.Model.ValidationException"> /// Contains information about data passed in to a field during a request that is not /// valid. /// </exception> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/devops-guru-2020-12-01/ListRecommendations">REST API Reference for ListRecommendations Operation</seealso> ListRecommendationsResponse ListRecommendations(ListRecommendationsRequest request); /// <summary> /// Returns a list of a specified insight's recommendations. Each recommendation includes /// a list of related metrics and a list of related events. /// </summary> /// <param name="request">Container for the necessary parameters to execute the ListRecommendations service method.</param> /// <param name="cancellationToken"> /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// </param> /// /// <returns>The response from the ListRecommendations service method, as returned by DevOpsGuru.</returns> /// <exception cref="Amazon.DevOpsGuru.Model.AccessDeniedException"> /// You don't have permissions to perform the requested operation. The user or role that /// is making the request must have at least one IAM permissions policy attached that /// grants the required permissions. For more information, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/access.html">Access /// Management</a> in the <i>IAM User Guide</i>. /// </exception> /// <exception cref="Amazon.DevOpsGuru.Model.InternalServerException"> /// An internal failure in an Amazon service occurred. /// </exception> /// <exception cref="Amazon.DevOpsGuru.Model.ResourceNotFoundException"> /// A requested resource could not be found /// </exception> /// <exception cref="Amazon.DevOpsGuru.Model.ThrottlingException"> /// The request was denied due to a request throttling. /// </exception> /// <exception cref="Amazon.DevOpsGuru.Model.ValidationException"> /// Contains information about data passed in to a field during a request that is not /// valid. /// </exception> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/devops-guru-2020-12-01/ListRecommendations">REST API Reference for ListRecommendations Operation</seealso> Task<ListRecommendationsResponse> ListRecommendationsAsync(ListRecommendationsRequest request, CancellationToken cancellationToken = default(CancellationToken)); #endregion #region PutFeedback /// <summary> /// Collects customer feedback about the specified insight. /// </summary> /// <param name="request">Container for the necessary parameters to execute the PutFeedback service method.</param> /// /// <returns>The response from the PutFeedback service method, as returned by DevOpsGuru.</returns> /// <exception cref="Amazon.DevOpsGuru.Model.AccessDeniedException"> /// You don't have permissions to perform the requested operation. The user or role that /// is making the request must have at least one IAM permissions policy attached that /// grants the required permissions. For more information, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/access.html">Access /// Management</a> in the <i>IAM User Guide</i>. /// </exception> /// <exception cref="Amazon.DevOpsGuru.Model.ConflictException"> /// An exception that is thrown when a conflict occurs. /// </exception> /// <exception cref="Amazon.DevOpsGuru.Model.InternalServerException"> /// An internal failure in an Amazon service occurred. /// </exception> /// <exception cref="Amazon.DevOpsGuru.Model.ResourceNotFoundException"> /// A requested resource could not be found /// </exception> /// <exception cref="Amazon.DevOpsGuru.Model.ThrottlingException"> /// The request was denied due to a request throttling. /// </exception> /// <exception cref="Amazon.DevOpsGuru.Model.ValidationException"> /// Contains information about data passed in to a field during a request that is not /// valid. /// </exception> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/devops-guru-2020-12-01/PutFeedback">REST API Reference for PutFeedback Operation</seealso> PutFeedbackResponse PutFeedback(PutFeedbackRequest request); /// <summary> /// Collects customer feedback about the specified insight. /// </summary> /// <param name="request">Container for the necessary parameters to execute the PutFeedback service method.</param> /// <param name="cancellationToken"> /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// </param> /// /// <returns>The response from the PutFeedback service method, as returned by DevOpsGuru.</returns> /// <exception cref="Amazon.DevOpsGuru.Model.AccessDeniedException"> /// You don't have permissions to perform the requested operation. The user or role that /// is making the request must have at least one IAM permissions policy attached that /// grants the required permissions. For more information, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/access.html">Access /// Management</a> in the <i>IAM User Guide</i>. /// </exception> /// <exception cref="Amazon.DevOpsGuru.Model.ConflictException"> /// An exception that is thrown when a conflict occurs. /// </exception> /// <exception cref="Amazon.DevOpsGuru.Model.InternalServerException"> /// An internal failure in an Amazon service occurred. /// </exception> /// <exception cref="Amazon.DevOpsGuru.Model.ResourceNotFoundException"> /// A requested resource could not be found /// </exception> /// <exception cref="Amazon.DevOpsGuru.Model.ThrottlingException"> /// The request was denied due to a request throttling. /// </exception> /// <exception cref="Amazon.DevOpsGuru.Model.ValidationException"> /// Contains information about data passed in to a field during a request that is not /// valid. /// </exception> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/devops-guru-2020-12-01/PutFeedback">REST API Reference for PutFeedback Operation</seealso> Task<PutFeedbackResponse> PutFeedbackAsync(PutFeedbackRequest request, CancellationToken cancellationToken = default(CancellationToken)); #endregion #region RemoveNotificationChannel /// <summary> /// Removes a notification channel from DevOps Guru. A notification channel is used to /// notify you when DevOps Guru generates an insight that contains information about how /// to improve your operations. /// </summary> /// <param name="request">Container for the necessary parameters to execute the RemoveNotificationChannel service method.</param> /// /// <returns>The response from the RemoveNotificationChannel service method, as returned by DevOpsGuru.</returns> /// <exception cref="Amazon.DevOpsGuru.Model.AccessDeniedException"> /// You don't have permissions to perform the requested operation. The user or role that /// is making the request must have at least one IAM permissions policy attached that /// grants the required permissions. For more information, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/access.html">Access /// Management</a> in the <i>IAM User Guide</i>. /// </exception> /// <exception cref="Amazon.DevOpsGuru.Model.ConflictException"> /// An exception that is thrown when a conflict occurs. /// </exception> /// <exception cref="Amazon.DevOpsGuru.Model.InternalServerException"> /// An internal failure in an Amazon service occurred. /// </exception> /// <exception cref="Amazon.DevOpsGuru.Model.ResourceNotFoundException"> /// A requested resource could not be found /// </exception> /// <exception cref="Amazon.DevOpsGuru.Model.ThrottlingException"> /// The request was denied due to a request throttling. /// </exception> /// <exception cref="Amazon.DevOpsGuru.Model.ValidationException"> /// Contains information about data passed in to a field during a request that is not /// valid. /// </exception> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/devops-guru-2020-12-01/RemoveNotificationChannel">REST API Reference for RemoveNotificationChannel Operation</seealso> RemoveNotificationChannelResponse RemoveNotificationChannel(RemoveNotificationChannelRequest request); /// <summary> /// Removes a notification channel from DevOps Guru. A notification channel is used to /// notify you when DevOps Guru generates an insight that contains information about how /// to improve your operations. /// </summary> /// <param name="request">Container for the necessary parameters to execute the RemoveNotificationChannel service method.</param> /// <param name="cancellationToken"> /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// </param> /// /// <returns>The response from the RemoveNotificationChannel service method, as returned by DevOpsGuru.</returns> /// <exception cref="Amazon.DevOpsGuru.Model.AccessDeniedException"> /// You don't have permissions to perform the requested operation. The user or role that /// is making the request must have at least one IAM permissions policy attached that /// grants the required permissions. For more information, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/access.html">Access /// Management</a> in the <i>IAM User Guide</i>. /// </exception> /// <exception cref="Amazon.DevOpsGuru.Model.ConflictException"> /// An exception that is thrown when a conflict occurs. /// </exception> /// <exception cref="Amazon.DevOpsGuru.Model.InternalServerException"> /// An internal failure in an Amazon service occurred. /// </exception> /// <exception cref="Amazon.DevOpsGuru.Model.ResourceNotFoundException"> /// A requested resource could not be found /// </exception> /// <exception cref="Amazon.DevOpsGuru.Model.ThrottlingException"> /// The request was denied due to a request throttling. /// </exception> /// <exception cref="Amazon.DevOpsGuru.Model.ValidationException"> /// Contains information about data passed in to a field during a request that is not /// valid. /// </exception> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/devops-guru-2020-12-01/RemoveNotificationChannel">REST API Reference for RemoveNotificationChannel Operation</seealso> Task<RemoveNotificationChannelResponse> RemoveNotificationChannelAsync(RemoveNotificationChannelRequest request, CancellationToken cancellationToken = default(CancellationToken)); #endregion #region SearchInsights /// <summary> /// Returns a list of insights in your AWS account. You can specify which insights are /// returned by their start time, one or more statuses (<code>ONGOING</code>, <code>CLOSED</code>, /// and <code>CLOSED</code>), one or more severities (<code>LOW</code>, <code>MEDIUM</code>, /// and <code>HIGH</code>), and type (<code>REACTIVE</code> or <code>PROACTIVE</code>). /// /// /// /// <para> /// Use the <code>Filters</code> parameter to specify status and severity search parameters. /// Use the <code>Type</code> parameter to specify <code>REACTIVE</code> or <code>PROACTIVE</code> /// in your search. /// </para> /// </summary> /// <param name="request">Container for the necessary parameters to execute the SearchInsights service method.</param> /// /// <returns>The response from the SearchInsights service method, as returned by DevOpsGuru.</returns> /// <exception cref="Amazon.DevOpsGuru.Model.AccessDeniedException"> /// You don't have permissions to perform the requested operation. The user or role that /// is making the request must have at least one IAM permissions policy attached that /// grants the required permissions. For more information, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/access.html">Access /// Management</a> in the <i>IAM User Guide</i>. /// </exception> /// <exception cref="Amazon.DevOpsGuru.Model.InternalServerException"> /// An internal failure in an Amazon service occurred. /// </exception> /// <exception cref="Amazon.DevOpsGuru.Model.ThrottlingException"> /// The request was denied due to a request throttling. /// </exception> /// <exception cref="Amazon.DevOpsGuru.Model.ValidationException"> /// Contains information about data passed in to a field during a request that is not /// valid. /// </exception> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/devops-guru-2020-12-01/SearchInsights">REST API Reference for SearchInsights Operation</seealso> SearchInsightsResponse SearchInsights(SearchInsightsRequest request); /// <summary> /// Returns a list of insights in your AWS account. You can specify which insights are /// returned by their start time, one or more statuses (<code>ONGOING</code>, <code>CLOSED</code>, /// and <code>CLOSED</code>), one or more severities (<code>LOW</code>, <code>MEDIUM</code>, /// and <code>HIGH</code>), and type (<code>REACTIVE</code> or <code>PROACTIVE</code>). /// /// /// /// <para> /// Use the <code>Filters</code> parameter to specify status and severity search parameters. /// Use the <code>Type</code> parameter to specify <code>REACTIVE</code> or <code>PROACTIVE</code> /// in your search. /// </para> /// </summary> /// <param name="request">Container for the necessary parameters to execute the SearchInsights service method.</param> /// <param name="cancellationToken"> /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// </param> /// /// <returns>The response from the SearchInsights service method, as returned by DevOpsGuru.</returns> /// <exception cref="Amazon.DevOpsGuru.Model.AccessDeniedException"> /// You don't have permissions to perform the requested operation. The user or role that /// is making the request must have at least one IAM permissions policy attached that /// grants the required permissions. For more information, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/access.html">Access /// Management</a> in the <i>IAM User Guide</i>. /// </exception> /// <exception cref="Amazon.DevOpsGuru.Model.InternalServerException"> /// An internal failure in an Amazon service occurred. /// </exception> /// <exception cref="Amazon.DevOpsGuru.Model.ThrottlingException"> /// The request was denied due to a request throttling. /// </exception> /// <exception cref="Amazon.DevOpsGuru.Model.ValidationException"> /// Contains information about data passed in to a field during a request that is not /// valid. /// </exception> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/devops-guru-2020-12-01/SearchInsights">REST API Reference for SearchInsights Operation</seealso> Task<SearchInsightsResponse> SearchInsightsAsync(SearchInsightsRequest request, CancellationToken cancellationToken = default(CancellationToken)); #endregion #region UpdateResourceCollection /// <summary> /// Updates the collection of resources that DevOps Guru analyzes. The one type of AWS /// resource collection supported is AWS CloudFormation stacks. DevOps Guru can be configured /// to analyze only the AWS resources that are defined in the stacks. This method also /// creates the IAM role required for you to use DevOps Guru. /// </summary> /// <param name="request">Container for the necessary parameters to execute the UpdateResourceCollection service method.</param> /// /// <returns>The response from the UpdateResourceCollection service method, as returned by DevOpsGuru.</returns> /// <exception cref="Amazon.DevOpsGuru.Model.AccessDeniedException"> /// You don't have permissions to perform the requested operation. The user or role that /// is making the request must have at least one IAM permissions policy attached that /// grants the required permissions. For more information, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/access.html">Access /// Management</a> in the <i>IAM User Guide</i>. /// </exception> /// <exception cref="Amazon.DevOpsGuru.Model.ConflictException"> /// An exception that is thrown when a conflict occurs. /// </exception> /// <exception cref="Amazon.DevOpsGuru.Model.InternalServerException"> /// An internal failure in an Amazon service occurred. /// </exception> /// <exception cref="Amazon.DevOpsGuru.Model.ThrottlingException"> /// The request was denied due to a request throttling. /// </exception> /// <exception cref="Amazon.DevOpsGuru.Model.ValidationException"> /// Contains information about data passed in to a field during a request that is not /// valid. /// </exception> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/devops-guru-2020-12-01/UpdateResourceCollection">REST API Reference for UpdateResourceCollection Operation</seealso> UpdateResourceCollectionResponse UpdateResourceCollection(UpdateResourceCollectionRequest request); /// <summary> /// Updates the collection of resources that DevOps Guru analyzes. The one type of AWS /// resource collection supported is AWS CloudFormation stacks. DevOps Guru can be configured /// to analyze only the AWS resources that are defined in the stacks. This method also /// creates the IAM role required for you to use DevOps Guru. /// </summary> /// <param name="request">Container for the necessary parameters to execute the UpdateResourceCollection service method.</param> /// <param name="cancellationToken"> /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// </param> /// /// <returns>The response from the UpdateResourceCollection service method, as returned by DevOpsGuru.</returns> /// <exception cref="Amazon.DevOpsGuru.Model.AccessDeniedException"> /// You don't have permissions to perform the requested operation. The user or role that /// is making the request must have at least one IAM permissions policy attached that /// grants the required permissions. For more information, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/access.html">Access /// Management</a> in the <i>IAM User Guide</i>. /// </exception> /// <exception cref="Amazon.DevOpsGuru.Model.ConflictException"> /// An exception that is thrown when a conflict occurs. /// </exception> /// <exception cref="Amazon.DevOpsGuru.Model.InternalServerException"> /// An internal failure in an Amazon service occurred. /// </exception> /// <exception cref="Amazon.DevOpsGuru.Model.ThrottlingException"> /// The request was denied due to a request throttling. /// </exception> /// <exception cref="Amazon.DevOpsGuru.Model.ValidationException"> /// Contains information about data passed in to a field during a request that is not /// valid. /// </exception> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/devops-guru-2020-12-01/UpdateResourceCollection">REST API Reference for UpdateResourceCollection Operation</seealso> Task<UpdateResourceCollectionResponse> UpdateResourceCollectionAsync(UpdateResourceCollectionRequest request, CancellationToken cancellationToken = default(CancellationToken)); #endregion #region UpdateServiceIntegration /// <summary> /// Enables or disables integration with a service that can be integrated with DevOps /// Guru. The one service that can be integrated with DevOps Guru is AWS Systems Manager, /// which can be used to create an OpsItem for each generated insight. /// </summary> /// <param name="request">Container for the necessary parameters to execute the UpdateServiceIntegration service method.</param> /// /// <returns>The response from the UpdateServiceIntegration service method, as returned by DevOpsGuru.</returns> /// <exception cref="Amazon.DevOpsGuru.Model.AccessDeniedException"> /// You don't have permissions to perform the requested operation. The user or role that /// is making the request must have at least one IAM permissions policy attached that /// grants the required permissions. For more information, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/access.html">Access /// Management</a> in the <i>IAM User Guide</i>. /// </exception> /// <exception cref="Amazon.DevOpsGuru.Model.ConflictException"> /// An exception that is thrown when a conflict occurs. /// </exception> /// <exception cref="Amazon.DevOpsGuru.Model.InternalServerException"> /// An internal failure in an Amazon service occurred. /// </exception> /// <exception cref="Amazon.DevOpsGuru.Model.ThrottlingException"> /// The request was denied due to a request throttling. /// </exception> /// <exception cref="Amazon.DevOpsGuru.Model.ValidationException"> /// Contains information about data passed in to a field during a request that is not /// valid. /// </exception> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/devops-guru-2020-12-01/UpdateServiceIntegration">REST API Reference for UpdateServiceIntegration Operation</seealso> UpdateServiceIntegrationResponse UpdateServiceIntegration(UpdateServiceIntegrationRequest request); /// <summary> /// Enables or disables integration with a service that can be integrated with DevOps /// Guru. The one service that can be integrated with DevOps Guru is AWS Systems Manager, /// which can be used to create an OpsItem for each generated insight. /// </summary> /// <param name="request">Container for the necessary parameters to execute the UpdateServiceIntegration service method.</param> /// <param name="cancellationToken"> /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// </param> /// /// <returns>The response from the UpdateServiceIntegration service method, as returned by DevOpsGuru.</returns> /// <exception cref="Amazon.DevOpsGuru.Model.AccessDeniedException"> /// You don't have permissions to perform the requested operation. The user or role that /// is making the request must have at least one IAM permissions policy attached that /// grants the required permissions. For more information, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/access.html">Access /// Management</a> in the <i>IAM User Guide</i>. /// </exception> /// <exception cref="Amazon.DevOpsGuru.Model.ConflictException"> /// An exception that is thrown when a conflict occurs. /// </exception> /// <exception cref="Amazon.DevOpsGuru.Model.InternalServerException"> /// An internal failure in an Amazon service occurred. /// </exception> /// <exception cref="Amazon.DevOpsGuru.Model.ThrottlingException"> /// The request was denied due to a request throttling. /// </exception> /// <exception cref="Amazon.DevOpsGuru.Model.ValidationException"> /// Contains information about data passed in to a field during a request that is not /// valid. /// </exception> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/devops-guru-2020-12-01/UpdateServiceIntegration">REST API Reference for UpdateServiceIntegration Operation</seealso> Task<UpdateServiceIntegrationResponse> UpdateServiceIntegrationAsync(UpdateServiceIntegrationRequest request, CancellationToken cancellationToken = default(CancellationToken)); #endregion } }
61.519462
208
0.675003
[ "Apache-2.0" ]
diegodias/aws-sdk-net
sdk/src/Services/DevOpsGuru/Generated/_bcl45/IAmazonDevOpsGuru.cs
86,931
C#
namespace DotNet.Testcontainers.Containers.WaitStrategies.Common { using System; using System.IO; using System.Text; using System.Text.RegularExpressions; using System.Threading.Tasks; internal class UntilMessageIsLogged : IWaitUntil { private readonly string message; private readonly Stream stream; public UntilMessageIsLogged(Stream stream, string message) { this.stream = stream; this.message = message; } public async Task<bool> Until(Uri endpoint, string id) { this.stream.Seek(0, SeekOrigin.Begin); using (var streamReader = new StreamReader(this.stream, Encoding.UTF8, false, 4096, true)) { var output= await streamReader.ReadToEndAsync() .ConfigureAwait(false); return Regex.IsMatch(output, this.message); } } } }
24.647059
96
0.687351
[ "MIT" ]
ErenArslan/dotnet-testcontainers
src/DotNet.Testcontainers/Containers/WaitStrategies/Common/UntilMessageIsLogged.cs
838
C#
// Licensed to Elasticsearch B.V under one or more agreements. // Elasticsearch B.V licenses this file to you under the Apache 2.0 License. // See the LICENSE file in the project root for more information using System; using System.Collections.Generic; using System.Runtime.Serialization; using Elasticsearch.Net.Utf8Json; namespace Nest { [InterfaceDataContract] public interface IEmailAction : IAction { [DataMember(Name = "account")] string Account { get; set; } [DataMember(Name = "attachments")] IEmailAttachments Attachments { get; set; } [DataMember(Name = "bcc")] IEnumerable<string> Bcc { get; set; } [DataMember(Name = "body")] IEmailBody Body { get; set; } [DataMember(Name = "cc")] IEnumerable<string> Cc { get; set; } [DataMember(Name = "from")] string From { get; set; } [DataMember(Name = "priority")] EmailPriority? Priority { get; set; } [DataMember(Name = "reply_to")] IEnumerable<string> ReplyTo { get; set; } [DataMember(Name = "subject")] string Subject { get; set; } [DataMember(Name = "to")] IEnumerable<string> To { get; set; } } public class EmailAction : ActionBase, IEmailAction { public EmailAction(string name) : base(name) { } public string Account { get; set; } public override ActionType ActionType => ActionType.Email; public IEmailAttachments Attachments { get; set; } public IEnumerable<string> Bcc { get; set; } public IEmailBody Body { get; set; } public IEnumerable<string> Cc { get; set; } public string From { get; set; } public EmailPriority? Priority { get; set; } public IEnumerable<string> ReplyTo { get; set; } public string Subject { get; set; } public IEnumerable<string> To { get; set; } } public class EmailActionDescriptor : ActionsDescriptorBase<EmailActionDescriptor, IEmailAction>, IEmailAction { public EmailActionDescriptor(string name) : base(name) { } protected override ActionType ActionType => ActionType.Email; string IEmailAction.Account { get; set; } IEmailAttachments IEmailAction.Attachments { get; set; } IEnumerable<string> IEmailAction.Bcc { get; set; } IEmailBody IEmailAction.Body { get; set; } IEnumerable<string> IEmailAction.Cc { get; set; } string IEmailAction.From { get; set; } EmailPriority? IEmailAction.Priority { get; set; } IEnumerable<string> IEmailAction.ReplyTo { get; set; } string IEmailAction.Subject { get; set; } IEnumerable<string> IEmailAction.To { get; set; } public EmailActionDescriptor Account(string account) => Assign(account, (a, v) => a.Account = v); public EmailActionDescriptor From(string from) => Assign(from, (a, v) => a.From = v); public EmailActionDescriptor To(IEnumerable<string> to) => Assign(to, (a, v) => a.To = v); public EmailActionDescriptor To(params string[] to) => Assign(to, (a, v) => a.To = v); public EmailActionDescriptor Cc(IEnumerable<string> cc) => Assign(cc, (a, v) => a.Cc = v); public EmailActionDescriptor Cc(params string[] cc) => Assign(cc, (a, v) => a.Cc = v); public EmailActionDescriptor Bcc(IEnumerable<string> bcc) => Assign(bcc, (a, v) => a.Bcc = v); public EmailActionDescriptor Bcc(params string[] bcc) => Assign(bcc, (a, v) => a.Bcc = v); public EmailActionDescriptor ReplyTo(IEnumerable<string> replyTo) => Assign(replyTo, (a, v) => a.ReplyTo = v); public EmailActionDescriptor ReplyTo(params string[] replyTo) => Assign(replyTo, (a, v) => a.ReplyTo = v); public EmailActionDescriptor Subject(string subject) => Assign(subject, (a, v) => a.Subject = v); public EmailActionDescriptor Body(Func<EmailBodyDescriptor, IEmailBody> selector) => Assign(selector.InvokeOrDefault(new EmailBodyDescriptor()), (a, v) => a.Body = v); public EmailActionDescriptor Priority(EmailPriority? priority) => Assign(priority, (a, v) => a.Priority = v); public EmailActionDescriptor Attachments(Func<EmailAttachmentsDescriptor, IPromise<IEmailAttachments>> selector) => Assign(selector, (a, v) => a.Attachments = v?.Invoke(new EmailAttachmentsDescriptor())?.Value); } }
33.825
117
0.703868
[ "Apache-2.0" ]
Brightspace/elasticsearch-net
src/Nest/XPack/Watcher/Action/Email/EmailAction.cs
4,061
C#
public class Points : Window { public Points(string[] args) { Text = "Points"; var canvas = new Canvas(); canvas.Left = 0; canvas.Top = 0; FillWindow(canvas); canvas.MouseDown += (sender, e) => { if (e.Button == MouseButtons.Left) { canvas.Points.Add(new Point(e.X, e.Y)); } else if (e.Button == MouseButtons.Right) { if (canvas.Points.Count > 0) { canvas.Points.RemoveAt(canvas.Points.Count - 1); } } else if (e.Button == MouseButtons.Middle) { canvas.Points.Clear(); } canvas.Invalidate(); }; Controls.Add(canvas); ShowDialog(); } }
23.378378
68
0.419653
[ "MIT" ]
marcosbozzani/joytokey-viewer
sources/points.cs
865
C#
//--------------------------------------------------------------------------------------------------------------------------------------------------- // Copyright Microsoft Corporation, Inc. // All Rights Reserved // // Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. // You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 // // THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED, // INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABLITY OR NON-INFRINGEMENT. // See the Apache 2 License for the specific language governing permissions and limitations under the License. //--------------------------------------------------------------------------------------------------------------------------------------------------- using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace WindowsPhoneDriver { public class WebResponse { public enum StatusCodeType { Informational, Success, Redirection, ClientError, ServerError, Unknown } public static Dictionary<uint, string> ReasonPhrase = new Dictionary<uint, string>() { {100, "Continue"}, {101, "Switching Protocols"}, {200, "OK"}, {201, "Created"}, {202, "Acceped"}, {203, "Non Authoritative Information"}, {204, "No Content"}, {205, "Reset Content"}, {206, "Partial Content"}, {300, "Multiple Choices"}, {301, "Moved Permanently"}, {302, "Found"}, {303, "See Other"}, {304, "Not Modified"}, {305, "Use Proxy"}, {307, "Temporary Redirect"}, {400, "Bad Request"}, {401, "Unauthorized"}, {402, "Payment Required"}, {403, "Forbidden"}, {404, "Not Found"}, {405, "Method Not Allowed"}, {406, "Not Acceptable"}, {407, "Proxy Authentication Required"}, {408, "Request Time out"}, {409, "Conflict"}, {410, "Gone"}, {411, "Length Required"}, {412, "Precondition Failed"}, {413, "Request Entity Too Large"}, {414, "Request URI Too Large"}, {415, "Unsupported Media Type"}, {416, "Requested range not satisfiable"}, {417, "Expectation Failed"}, {500, "Internal Server Error"}, {501, "Not Implemented"}, {502, "Bad Gateway"}, {503, "Service Unavailable"}, {504, "Gateway Time out"}, {505, "HTTP Version not supported"} }; public string Content; public int ContentLength { get { return this.Content.Length; } } public string ContentType; public string Location; public uint StatusCode; private static string HTTPVersionString = "HTTP/1.1"; public static WebResponse InternalServerError() { WebResponse response = new WebResponse(); response.ContentType = "text/plan;charset=utf-8"; response.StatusCode = 500; response.Content = "Call could not be fullfield. JavaScript injection failed."; return response; } public static WebResponse NotImplemented() { WebResponse response = new WebResponse(); string msg = "Sorry, not implemented yet."; response.ContentType = "text/plan;charset=utf-8"; response.StatusCode = 501; response.Content = msg; return response; } public static WebResponse SucessSimple() { WebResponse response = new WebResponse(); response.StatusCode = 200; response.Content = string.Empty; return response; } override public string ToString() { switch (CodeType(this.StatusCode)) { case StatusCodeType.Informational: break; case StatusCodeType.Success: return SuccessToString(); case StatusCodeType.Redirection: return RedirectionToString(); case StatusCodeType.ClientError: return ClientErrorToString(); case StatusCodeType.ServerError: return ServerErrorToString(); default: throw new Exception("Wrong status code of response"); } return string.Empty; } private string ClientErrorToString() { StringBuilder str = new StringBuilder(); str.Append(GetStatusLine()); str.Append(GetServerLine()); str.Append("Content-Type: "); str.Append(this.ContentType); str.Append("Content-Lenght: "); str.Append(ContentLength); str.AppendLine(); str.AppendLine(); str.Append(Content); return str.ToString(); } private string RedirectionToString() { StringBuilder str = new StringBuilder(); str.Append(GetStatusLine()); str.Append(GetServerLine()); str.AppendLine("Content-Type: text/html; charset=utf-8"); str.AppendLine("Content-Lenght: 0"); str.AppendLine("Location: " + this.Location); str.AppendLine(); return str.ToString(); } private string SuccessToString() { return this.ServerErrorToString(); } private string ServerErrorToString() { StringBuilder str = new StringBuilder(); str.Append(GetStatusLine()); str.Append(GetServerLine()); str.Append("Content-Type: " + this.ContentType); str.AppendLine(); str.Append("Content-Lenght: " + this.ContentLength); str.AppendLine(); str.Append("Connection: close"); str.AppendLine(); str.Append("Vary: Accept-Charset, Accept-Encoding, Accept-Language, Accept"); str.AppendLine(); str.Append("Accept-Ranges: bytes"); str.AppendLine(); str.AppendLine(); str.Append(this.Content); return str.ToString(); } private string GetServerLine() { return "Server: Selenium Windows Phone WebDriver\r\n"; } private string GetStatusLine() { return string.Format("{0} {1} {2}{3}", WebResponse.HTTPVersionString, this.StatusCode, WebResponse.ReasonPhrase[this.StatusCode], Environment.NewLine ); } public StatusCodeType CodeType(uint code) { if (code < 200) return StatusCodeType.Informational; if (code < 300) return StatusCodeType.Success; if (code < 400) return StatusCodeType.Redirection; if (code < 500) return StatusCodeType.ClientError; if (code < 600) return StatusCodeType.ServerError; return StatusCodeType.Unknown; } } }
33.58159
151
0.49701
[ "Apache-2.0", "MIT" ]
asthanarht/WinPhoneSeleniumWebDriver
WindowsPhoneDriver/WebResponse.cs
8,028
C#
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. using System.Diagnostics; using System.Diagnostics.CodeAnalysis; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Text; using System.Threading; using System.Threading.Tasks; namespace System.IO { // This class implements a TextWriter for writing characters to a Stream. // This is designed for character output in a particular Encoding, // whereas the Stream class is designed for byte input and output. public class StreamWriter : TextWriter { // For UTF-8, the values of 1K for the default buffer size and 4K for the // file stream buffer size are reasonable & give very reasonable // performance for in terms of construction time for the StreamWriter and // write perf. Note that for UTF-8, we end up allocating a 4K byte buffer, // which means we take advantage of adaptive buffering code. // The performance using UnicodeEncoding is acceptable. private const int DefaultBufferSize = 1024; // char[] private const int DefaultFileStreamBufferSize = 4096; private const int MinBufferSize = 128; // Bit bucket - Null has no backing store. Non closable. public static new readonly StreamWriter Null = new StreamWriter(Stream.Null, UTF8NoBOM, MinBufferSize, leaveOpen: true); private readonly Stream _stream; private readonly Encoding _encoding; private readonly Encoder _encoder; private readonly byte[] _byteBuffer; private readonly char[] _charBuffer; private int _charPos; private int _charLen; private bool _autoFlush; private bool _haveWrittenPreamble; private readonly bool _closable; private bool _disposed; // We don't guarantee thread safety on StreamWriter, but we should at // least prevent users from trying to write anything while an Async // write from the same thread is in progress. private Task _asyncWriteTask = Task.CompletedTask; private void CheckAsyncTaskInProgress() { // We are not locking the access to _asyncWriteTask because this is not meant to guarantee thread safety. // We are simply trying to deter calling any Write APIs while an async Write from the same thread is in progress. if (!_asyncWriteTask.IsCompleted) { ThrowAsyncIOInProgress(); } } [DoesNotReturn] private static void ThrowAsyncIOInProgress() => throw new InvalidOperationException(SR.InvalidOperation_AsyncIOInProgress); // The high level goal is to be tolerant of encoding errors when we read and very strict // when we write. Hence, default StreamWriter encoding will throw on encoding error. // Note: when StreamWriter throws on invalid encoding chars (for ex, high surrogate character // D800-DBFF without a following low surrogate character DC00-DFFF), it will cause the // internal StreamWriter's state to be irrecoverable as it would have buffered the // illegal chars and any subsequent call to Flush() would hit the encoding error again. // Even Close() will hit the exception as it would try to flush the unwritten data. // Maybe we can add a DiscardBufferedData() method to get out of such situation (like // StreamReader though for different reason). Either way, the buffered data will be lost! private static Encoding UTF8NoBOM => EncodingCache.UTF8NoBOM; public StreamWriter(Stream stream) : this(stream, UTF8NoBOM, DefaultBufferSize, false) { } public StreamWriter(Stream stream, Encoding encoding) : this(stream, encoding, DefaultBufferSize, false) { } // Creates a new StreamWriter for the given stream. The // character encoding is set by encoding and the buffer size, // in number of 16-bit characters, is set by bufferSize. // public StreamWriter(Stream stream, Encoding encoding, int bufferSize) : this(stream, encoding, bufferSize, false) { } public StreamWriter(Stream stream, Encoding? encoding = null, int bufferSize = -1, bool leaveOpen = false) : base(null) // Ask for CurrentCulture all the time { if (stream == null) { throw new ArgumentNullException(nameof(stream)); } if (encoding == null) { encoding = UTF8NoBOM; } if (!stream.CanWrite) { throw new ArgumentException(SR.Argument_StreamNotWritable); } if (bufferSize == -1) { bufferSize = DefaultBufferSize; } else if (bufferSize <= 0) { throw new ArgumentOutOfRangeException(nameof(bufferSize), SR.ArgumentOutOfRange_NeedPosNum); } _stream = stream; _encoding = encoding; _encoder = _encoding.GetEncoder(); if (bufferSize < MinBufferSize) { bufferSize = MinBufferSize; } _charBuffer = new char[bufferSize]; _byteBuffer = new byte[_encoding.GetMaxByteCount(bufferSize)]; _charLen = bufferSize; // If we're appending to a Stream that already has data, don't write // the preamble. if (_stream.CanSeek && _stream.Position > 0) { _haveWrittenPreamble = true; } _closable = !leaveOpen; } public StreamWriter(string path) : this(path, false, UTF8NoBOM, DefaultBufferSize) { } public StreamWriter(string path, bool append) : this(path, append, UTF8NoBOM, DefaultBufferSize) { } public StreamWriter(string path, bool append, Encoding encoding) : this(path, append, encoding, DefaultBufferSize) { } public StreamWriter(string path, bool append, Encoding encoding, int bufferSize) : this(ValidateArgsAndOpenPath(path, append, encoding, bufferSize), encoding, bufferSize, leaveOpen: false) { } private static Stream ValidateArgsAndOpenPath(string path, bool append, Encoding encoding, int bufferSize) { if (path == null) throw new ArgumentNullException(nameof(path)); if (encoding == null) throw new ArgumentNullException(nameof(encoding)); if (path.Length == 0) throw new ArgumentException(SR.Argument_EmptyPath); if (bufferSize <= 0) throw new ArgumentOutOfRangeException(nameof(bufferSize), SR.ArgumentOutOfRange_NeedPosNum); return new FileStream(path, append ? FileMode.Append : FileMode.Create, FileAccess.Write, FileShare.Read, DefaultFileStreamBufferSize, FileOptions.SequentialScan); } public override void Close() { Dispose(true); GC.SuppressFinalize(this); } protected override void Dispose(bool disposing) { try { // We need to flush any buffered data if we are being closed/disposed. // Also, we never close the handles for stdout & friends. So we can safely // write any buffered data to those streams even during finalization, which // is generally the right thing to do. if (!_disposed && disposing) { // Note: flush on the underlying stream can throw (ex., low disk space) CheckAsyncTaskInProgress(); Flush(flushStream: true, flushEncoder: true); } } finally { CloseStreamFromDispose(disposing); } } private void CloseStreamFromDispose(bool disposing) { // Dispose of our resources if this StreamWriter is closable. if (_closable && !_disposed) { try { // Attempt to close the stream even if there was an IO error from Flushing. // Note that Stream.Close() can potentially throw here (may or may not be // due to the same Flush error). In this case, we still need to ensure // cleaning up internal resources, hence the finally block. if (disposing) { _stream.Close(); } } finally { _disposed = true; _charLen = 0; base.Dispose(disposing); } } } public override ValueTask DisposeAsync() => GetType() != typeof(StreamWriter) ? base.DisposeAsync() : DisposeAsyncCore(); private async ValueTask DisposeAsyncCore() { // Same logic as in Dispose(), but with async flushing. Debug.Assert(GetType() == typeof(StreamWriter)); try { if (!_disposed) { await FlushAsync().ConfigureAwait(false); } } finally { CloseStreamFromDispose(disposing: true); } GC.SuppressFinalize(this); } public override void Flush() { CheckAsyncTaskInProgress(); Flush(true, true); } private void Flush(bool flushStream, bool flushEncoder) { // flushEncoder should be true at the end of the file and if // the user explicitly calls Flush (though not if AutoFlush is true). // This is required to flush any dangling characters from our UTF-7 // and UTF-8 encoders. ThrowIfDisposed(); // Perf boost for Flush on non-dirty writers. if (_charPos == 0 && !flushStream && !flushEncoder) { return; } if (!_haveWrittenPreamble) { _haveWrittenPreamble = true; ReadOnlySpan<byte> preamble = _encoding.Preamble; if (preamble.Length > 0) { _stream.Write(preamble); } } int count = _encoder.GetBytes(_charBuffer, 0, _charPos, _byteBuffer, 0, flushEncoder); _charPos = 0; if (count > 0) { _stream.Write(_byteBuffer, 0, count); } // By definition, calling Flush should flush the stream, but this is // only necessary if we passed in true for flushStream. The Web // Services guys have some perf tests where flushing needlessly hurts. if (flushStream) { _stream.Flush(); } } public virtual bool AutoFlush { get { return _autoFlush; } set { CheckAsyncTaskInProgress(); _autoFlush = value; if (value) { Flush(true, false); } } } public virtual Stream BaseStream => _stream; public override Encoding Encoding => _encoding; public override void Write(char value) { CheckAsyncTaskInProgress(); if (_charPos == _charLen) { Flush(false, false); } _charBuffer[_charPos] = value; _charPos++; if (_autoFlush) { Flush(true, false); } } [MethodImpl(MethodImplOptions.NoInlining)] // prevent WriteSpan from bloating call sites public override void Write(char[]? buffer) { WriteSpan(buffer, appendNewLine: false); } [MethodImpl(MethodImplOptions.NoInlining)] // prevent WriteSpan from bloating call sites public override void Write(char[] buffer, int index, int count) { if (buffer == null) { throw new ArgumentNullException(nameof(buffer), SR.ArgumentNull_Buffer); } if (index < 0) { throw new ArgumentOutOfRangeException(nameof(index), SR.ArgumentOutOfRange_NeedNonNegNum); } if (count < 0) { throw new ArgumentOutOfRangeException(nameof(count), SR.ArgumentOutOfRange_NeedNonNegNum); } if (buffer.Length - index < count) { throw new ArgumentException(SR.Argument_InvalidOffLen); } WriteSpan(buffer.AsSpan(index, count), appendNewLine: false); } [MethodImpl(MethodImplOptions.NoInlining)] // prevent WriteSpan from bloating call sites public override void Write(ReadOnlySpan<char> buffer) { if (GetType() == typeof(StreamWriter)) { WriteSpan(buffer, appendNewLine: false); } else { // If a derived class may have overridden existing Write behavior, // we need to make sure we use it. base.Write(buffer); } } [MethodImpl(MethodImplOptions.AggressiveInlining)] private unsafe void WriteSpan(ReadOnlySpan<char> buffer, bool appendNewLine) { CheckAsyncTaskInProgress(); if (buffer.Length <= 4 && // Threshold of 4 chosen based on perf experimentation buffer.Length <= _charLen - _charPos) { // For very short buffers and when we don't need to worry about running out of space // in the char buffer, just copy the chars individually. for (int i = 0; i < buffer.Length; i++) { _charBuffer[_charPos++] = buffer[i]; } } else { // For larger buffers or when we may run out of room in the internal char buffer, copy in chunks. // Use unsafe code until https://github.com/dotnet/coreclr/issues/13827 is addressed, as spans are // resulting in significant overhead (even when the if branch above is taken rather than this // else) due to temporaries that need to be cleared. Given the use of unsafe code, we also // make local copies of instance state to protect against potential concurrent misuse. ThrowIfDisposed(); char[] charBuffer = _charBuffer; fixed (char* bufferPtr = &MemoryMarshal.GetReference(buffer)) fixed (char* dstPtr = &charBuffer[0]) { char* srcPtr = bufferPtr; int count = buffer.Length; int dstPos = _charPos; // use a local copy of _charPos for safety while (count > 0) { if (dstPos == charBuffer.Length) { Flush(false, false); dstPos = 0; } int n = Math.Min(charBuffer.Length - dstPos, count); int bytesToCopy = n * sizeof(char); Buffer.MemoryCopy(srcPtr, dstPtr + dstPos, bytesToCopy, bytesToCopy); _charPos += n; dstPos += n; srcPtr += n; count -= n; } } } if (appendNewLine) { char[] coreNewLine = CoreNewLine; for (int i = 0; i < coreNewLine.Length; i++) // Generally 1 (\n) or 2 (\r\n) iterations { if (_charPos == _charLen) { Flush(false, false); } _charBuffer[_charPos] = coreNewLine[i]; _charPos++; } } if (_autoFlush) { Flush(true, false); } } [MethodImpl(MethodImplOptions.NoInlining)] // prevent WriteSpan from bloating call sites public override void Write(string? value) { WriteSpan(value, appendNewLine: false); } [MethodImpl(MethodImplOptions.NoInlining)] // prevent WriteSpan from bloating call sites public override void WriteLine(string? value) { CheckAsyncTaskInProgress(); WriteSpan(value, appendNewLine: true); } [MethodImpl(MethodImplOptions.NoInlining)] // prevent WriteSpan from bloating call sites public override void WriteLine(ReadOnlySpan<char> value) { if (GetType() == typeof(StreamWriter)) { CheckAsyncTaskInProgress(); WriteSpan(value, appendNewLine: true); } else { // If a derived class may have overridden existing WriteLine behavior, // we need to make sure we use it. base.WriteLine(value); } } private void WriteFormatHelper(string format, ParamsArray args, bool appendNewLine) { StringBuilder sb = StringBuilderCache.Acquire((format?.Length ?? 0) + args.Length * 8) .AppendFormatHelper(null, format!, args); // AppendFormatHelper will appropriately throw ArgumentNullException for a null format StringBuilder.ChunkEnumerator chunks = sb.GetChunks(); bool more = chunks.MoveNext(); while (more) { ReadOnlySpan<char> current = chunks.Current.Span; more = chunks.MoveNext(); // If final chunk, include the newline if needed WriteSpan(current, appendNewLine: more ? false : appendNewLine); } StringBuilderCache.Release(sb); } public override void Write(string format, object? arg0) { if (GetType() == typeof(StreamWriter)) { WriteFormatHelper(format, new ParamsArray(arg0), appendNewLine: false); } else { base.Write(format, arg0); } } public override void Write(string format, object? arg0, object? arg1) { if (GetType() == typeof(StreamWriter)) { WriteFormatHelper(format, new ParamsArray(arg0, arg1), appendNewLine: false); } else { base.Write(format, arg0, arg1); } } public override void Write(string format, object? arg0, object? arg1, object? arg2) { if (GetType() == typeof(StreamWriter)) { WriteFormatHelper(format, new ParamsArray(arg0, arg1, arg2), appendNewLine: false); } else { base.Write(format, arg0, arg1, arg2); } } public override void Write(string format, params object?[] arg) { if (GetType() == typeof(StreamWriter)) { if (arg == null) { throw new ArgumentNullException((format == null) ? nameof(format) : nameof(arg)); // same as base logic } WriteFormatHelper(format, new ParamsArray(arg), appendNewLine: false); } else { base.Write(format, arg); } } public override void WriteLine(string format, object? arg0) { if (GetType() == typeof(StreamWriter)) { WriteFormatHelper(format, new ParamsArray(arg0), appendNewLine: true); } else { base.WriteLine(format, arg0); } } public override void WriteLine(string format, object? arg0, object? arg1) { if (GetType() == typeof(StreamWriter)) { WriteFormatHelper(format, new ParamsArray(arg0, arg1), appendNewLine: true); } else { base.WriteLine(format, arg0, arg1); } } public override void WriteLine(string format, object? arg0, object? arg1, object? arg2) { if (GetType() == typeof(StreamWriter)) { WriteFormatHelper(format, new ParamsArray(arg0, arg1, arg2), appendNewLine: true); } else { base.WriteLine(format, arg0, arg1, arg2); } } public override void WriteLine(string format, params object?[] arg) { if (GetType() == typeof(StreamWriter)) { if (arg == null) { throw new ArgumentNullException(nameof(arg)); } WriteFormatHelper(format, new ParamsArray(arg), appendNewLine: true); } else { base.WriteLine(format, arg); } } public override Task WriteAsync(char value) { // If we have been inherited into a subclass, the following implementation could be incorrect // since it does not call through to Write() which a subclass might have overridden. // To be safe we will only use this implementation in cases where we know it is safe to do so, // and delegate to our base class (which will call into Write) when we are not sure. if (GetType() != typeof(StreamWriter)) { return base.WriteAsync(value); } ThrowIfDisposed(); CheckAsyncTaskInProgress(); Task task = WriteAsyncInternal(this, value, _charBuffer, _charPos, _charLen, CoreNewLine, _autoFlush, appendNewLine: false); _asyncWriteTask = task; return task; } // We pass in private instance fields of this MarshalByRefObject-derived type as local params // to ensure performant access inside the state machine that corresponds this async method. // Fields that are written to must be assigned at the end of the method *and* before instance invocations. private static async Task WriteAsyncInternal(StreamWriter _this, char value, char[] charBuffer, int charPos, int charLen, char[] coreNewLine, bool autoFlush, bool appendNewLine) { if (charPos == charLen) { await _this.FlushAsyncInternal(false, false, charBuffer, charPos).ConfigureAwait(false); Debug.Assert(_this._charPos == 0); charPos = 0; } charBuffer[charPos] = value; charPos++; if (appendNewLine) { for (int i = 0; i < coreNewLine.Length; i++) // Expect 2 iterations, no point calling BlockCopy { if (charPos == charLen) { await _this.FlushAsyncInternal(false, false, charBuffer, charPos).ConfigureAwait(false); Debug.Assert(_this._charPos == 0); charPos = 0; } charBuffer[charPos] = coreNewLine[i]; charPos++; } } if (autoFlush) { await _this.FlushAsyncInternal(true, false, charBuffer, charPos).ConfigureAwait(false); Debug.Assert(_this._charPos == 0); charPos = 0; } _this._charPos = charPos; } public override Task WriteAsync(string? value) { // If we have been inherited into a subclass, the following implementation could be incorrect // since it does not call through to Write() which a subclass might have overridden. // To be safe we will only use this implementation in cases where we know it is safe to do so, // and delegate to our base class (which will call into Write) when we are not sure. if (GetType() != typeof(StreamWriter)) { return base.WriteAsync(value); } if (value != null) { ThrowIfDisposed(); CheckAsyncTaskInProgress(); Task task = WriteAsyncInternal(this, value, _charBuffer, _charPos, _charLen, CoreNewLine, _autoFlush, appendNewLine: false); _asyncWriteTask = task; return task; } else { return Task.CompletedTask; } } // We pass in private instance fields of this MarshalByRefObject-derived type as local params // to ensure performant access inside the state machine that corresponds this async method. // Fields that are written to must be assigned at the end of the method *and* before instance invocations. private static async Task WriteAsyncInternal(StreamWriter _this, string value, char[] charBuffer, int charPos, int charLen, char[] coreNewLine, bool autoFlush, bool appendNewLine) { Debug.Assert(value != null); int count = value.Length; int index = 0; while (count > 0) { if (charPos == charLen) { await _this.FlushAsyncInternal(false, false, charBuffer, charPos).ConfigureAwait(false); Debug.Assert(_this._charPos == 0); charPos = 0; } int n = charLen - charPos; if (n > count) { n = count; } Debug.Assert(n > 0, "StreamWriter::Write(String) isn't making progress! This is most likely a race condition in user code."); value.CopyTo(index, charBuffer, charPos, n); charPos += n; index += n; count -= n; } if (appendNewLine) { for (int i = 0; i < coreNewLine.Length; i++) // Expect 2 iterations, no point calling BlockCopy { if (charPos == charLen) { await _this.FlushAsyncInternal(false, false, charBuffer, charPos).ConfigureAwait(false); Debug.Assert(_this._charPos == 0); charPos = 0; } charBuffer[charPos] = coreNewLine[i]; charPos++; } } if (autoFlush) { await _this.FlushAsyncInternal(true, false, charBuffer, charPos).ConfigureAwait(false); Debug.Assert(_this._charPos == 0); charPos = 0; } _this._charPos = charPos; } public override Task WriteAsync(char[] buffer, int index, int count) { if (buffer == null) { throw new ArgumentNullException(nameof(buffer), SR.ArgumentNull_Buffer); } if (index < 0) { throw new ArgumentOutOfRangeException(nameof(index), SR.ArgumentOutOfRange_NeedNonNegNum); } if (count < 0) { throw new ArgumentOutOfRangeException(nameof(count), SR.ArgumentOutOfRange_NeedNonNegNum); } if (buffer.Length - index < count) { throw new ArgumentException(SR.Argument_InvalidOffLen); } // If we have been inherited into a subclass, the following implementation could be incorrect // since it does not call through to Write() which a subclass might have overridden. // To be safe we will only use this implementation in cases where we know it is safe to do so, // and delegate to our base class (which will call into Write) when we are not sure. if (GetType() != typeof(StreamWriter)) { return base.WriteAsync(buffer, index, count); } ThrowIfDisposed(); CheckAsyncTaskInProgress(); Task task = WriteAsyncInternal(this, new ReadOnlyMemory<char>(buffer, index, count), _charBuffer, _charPos, _charLen, CoreNewLine, _autoFlush, appendNewLine: false, cancellationToken: default); _asyncWriteTask = task; return task; } public override Task WriteAsync(ReadOnlyMemory<char> buffer, CancellationToken cancellationToken = default) { if (GetType() != typeof(StreamWriter)) { // If a derived type may have overridden existing WriteASync(char[], ...) behavior, make sure we use it. return base.WriteAsync(buffer, cancellationToken); } ThrowIfDisposed(); CheckAsyncTaskInProgress(); if (cancellationToken.IsCancellationRequested) { return Task.FromCanceled(cancellationToken); } Task task = WriteAsyncInternal(this, buffer, _charBuffer, _charPos, _charLen, CoreNewLine, _autoFlush, appendNewLine: false, cancellationToken: cancellationToken); _asyncWriteTask = task; return task; } // We pass in private instance fields of this MarshalByRefObject-derived type as local params // to ensure performant access inside the state machine that corresponds this async method. // Fields that are written to must be assigned at the end of the method *and* before instance invocations. private static async Task WriteAsyncInternal(StreamWriter _this, ReadOnlyMemory<char> source, char[] charBuffer, int charPos, int charLen, char[] coreNewLine, bool autoFlush, bool appendNewLine, CancellationToken cancellationToken) { int copied = 0; while (copied < source.Length) { if (charPos == charLen) { await _this.FlushAsyncInternal(false, false, charBuffer, charPos, cancellationToken).ConfigureAwait(false); Debug.Assert(_this._charPos == 0); charPos = 0; } int n = Math.Min(charLen - charPos, source.Length - copied); Debug.Assert(n > 0, "StreamWriter::Write(char[], int, int) isn't making progress! This is most likely a race condition in user code."); source.Span.Slice(copied, n).CopyTo(new Span<char>(charBuffer, charPos, n)); charPos += n; copied += n; } if (appendNewLine) { for (int i = 0; i < coreNewLine.Length; i++) // Expect 2 iterations, no point calling BlockCopy { if (charPos == charLen) { await _this.FlushAsyncInternal(false, false, charBuffer, charPos, cancellationToken).ConfigureAwait(false); Debug.Assert(_this._charPos == 0); charPos = 0; } charBuffer[charPos] = coreNewLine[i]; charPos++; } } if (autoFlush) { await _this.FlushAsyncInternal(true, false, charBuffer, charPos, cancellationToken).ConfigureAwait(false); Debug.Assert(_this._charPos == 0); charPos = 0; } _this._charPos = charPos; } public override Task WriteLineAsync() { // If we have been inherited into a subclass, the following implementation could be incorrect // since it does not call through to Write() which a subclass might have overridden. // To be safe we will only use this implementation in cases where we know it is safe to do so, // and delegate to our base class (which will call into Write) when we are not sure. if (GetType() != typeof(StreamWriter)) { return base.WriteLineAsync(); } ThrowIfDisposed(); CheckAsyncTaskInProgress(); Task task = WriteAsyncInternal(this, ReadOnlyMemory<char>.Empty, _charBuffer, _charPos, _charLen, CoreNewLine, _autoFlush, appendNewLine: true, cancellationToken: default); _asyncWriteTask = task; return task; } public override Task WriteLineAsync(char value) { // If we have been inherited into a subclass, the following implementation could be incorrect // since it does not call through to Write() which a subclass might have overridden. // To be safe we will only use this implementation in cases where we know it is safe to do so, // and delegate to our base class (which will call into Write) when we are not sure. if (GetType() != typeof(StreamWriter)) { return base.WriteLineAsync(value); } ThrowIfDisposed(); CheckAsyncTaskInProgress(); Task task = WriteAsyncInternal(this, value, _charBuffer, _charPos, _charLen, CoreNewLine, _autoFlush, appendNewLine: true); _asyncWriteTask = task; return task; } public override Task WriteLineAsync(string? value) { if (value == null) { return WriteLineAsync(); } // If we have been inherited into a subclass, the following implementation could be incorrect // since it does not call through to Write() which a subclass might have overridden. // To be safe we will only use this implementation in cases where we know it is safe to do so, // and delegate to our base class (which will call into Write) when we are not sure. if (GetType() != typeof(StreamWriter)) { return base.WriteLineAsync(value); } ThrowIfDisposed(); CheckAsyncTaskInProgress(); Task task = WriteAsyncInternal(this, value, _charBuffer, _charPos, _charLen, CoreNewLine, _autoFlush, appendNewLine: true); _asyncWriteTask = task; return task; } public override Task WriteLineAsync(char[] buffer, int index, int count) { if (buffer == null) { throw new ArgumentNullException(nameof(buffer), SR.ArgumentNull_Buffer); } if (index < 0) { throw new ArgumentOutOfRangeException(nameof(index), SR.ArgumentOutOfRange_NeedNonNegNum); } if (count < 0) { throw new ArgumentOutOfRangeException(nameof(count), SR.ArgumentOutOfRange_NeedNonNegNum); } if (buffer.Length - index < count) { throw new ArgumentException(SR.Argument_InvalidOffLen); } // If we have been inherited into a subclass, the following implementation could be incorrect // since it does not call through to Write() which a subclass might have overridden. // To be safe we will only use this implementation in cases where we know it is safe to do so, // and delegate to our base class (which will call into Write) when we are not sure. if (GetType() != typeof(StreamWriter)) { return base.WriteLineAsync(buffer, index, count); } ThrowIfDisposed(); CheckAsyncTaskInProgress(); Task task = WriteAsyncInternal(this, new ReadOnlyMemory<char>(buffer, index, count), _charBuffer, _charPos, _charLen, CoreNewLine, _autoFlush, appendNewLine: true, cancellationToken: default); _asyncWriteTask = task; return task; } public override Task WriteLineAsync(ReadOnlyMemory<char> buffer, CancellationToken cancellationToken = default) { if (GetType() != typeof(StreamWriter)) { return base.WriteLineAsync(buffer, cancellationToken); } ThrowIfDisposed(); CheckAsyncTaskInProgress(); if (cancellationToken.IsCancellationRequested) { return Task.FromCanceled(cancellationToken); } Task task = WriteAsyncInternal(this, buffer, _charBuffer, _charPos, _charLen, CoreNewLine, _autoFlush, appendNewLine: true, cancellationToken: cancellationToken); _asyncWriteTask = task; return task; } public override Task FlushAsync() { // If we have been inherited into a subclass, the following implementation could be incorrect // since it does not call through to Flush() which a subclass might have overridden. To be safe // we will only use this implementation in cases where we know it is safe to do so, // and delegate to our base class (which will call into Flush) when we are not sure. if (GetType() != typeof(StreamWriter)) { return base.FlushAsync(); } // flushEncoder should be true at the end of the file and if // the user explicitly calls Flush (though not if AutoFlush is true). // This is required to flush any dangling characters from our UTF-7 // and UTF-8 encoders. ThrowIfDisposed(); CheckAsyncTaskInProgress(); Task task = FlushAsyncInternal(true, true, _charBuffer, _charPos); _asyncWriteTask = task; return task; } private Task FlushAsyncInternal(bool flushStream, bool flushEncoder, char[] sCharBuffer, int sCharPos, CancellationToken cancellationToken = default) { if (cancellationToken.IsCancellationRequested) { return Task.FromCanceled(cancellationToken); } // Perf boost for Flush on non-dirty writers. if (sCharPos == 0 && !flushStream && !flushEncoder) { return Task.CompletedTask; } Task flushTask = FlushAsyncInternal(this, flushStream, flushEncoder, sCharBuffer, sCharPos, _haveWrittenPreamble, _encoding, _encoder, _byteBuffer, _stream, cancellationToken); _charPos = 0; return flushTask; } // We pass in private instance fields of this MarshalByRefObject-derived type as local params // to ensure performant access inside the state machine that corresponds this async method. private static async Task FlushAsyncInternal(StreamWriter _this, bool flushStream, bool flushEncoder, char[] charBuffer, int charPos, bool haveWrittenPreamble, Encoding encoding, Encoder encoder, byte[] byteBuffer, Stream stream, CancellationToken cancellationToken) { if (!haveWrittenPreamble) { _this._haveWrittenPreamble = true; byte[] preamble = encoding.GetPreamble(); if (preamble.Length > 0) { await stream.WriteAsync(new ReadOnlyMemory<byte>(preamble), cancellationToken).ConfigureAwait(false); } } int count = encoder.GetBytes(charBuffer, 0, charPos, byteBuffer, 0, flushEncoder); if (count > 0) { await stream.WriteAsync(new ReadOnlyMemory<byte>(byteBuffer, 0, count), cancellationToken).ConfigureAwait(false); } // By definition, calling Flush should flush the stream, but this is // only necessary if we passed in true for flushStream. The Web // Services guys have some perf tests where flushing needlessly hurts. if (flushStream) { await stream.FlushAsync(cancellationToken).ConfigureAwait(false); } } private void ThrowIfDisposed() { if (_disposed) { ThrowObjectDisposedException(); } void ThrowObjectDisposedException() => throw new ObjectDisposedException(GetType().Name, SR.ObjectDisposed_WriterClosed); } } // class StreamWriter } // namespace
38.979611
205
0.546589
[ "MIT" ]
Azure-2019/corefx
src/Common/src/CoreLib/System/IO/StreamWriter.cs
42,059
C#
using Microsoft.AspNetCore.Mvc.Rendering; using Microsoft.AspNetCore.Mvc.Routing; using Microsoft.AspNetCore.Routing; using DNZ.MvcComponents; using System.Collections.Generic; namespace Microsoft.AspNetCore.Mvc { public class TypeaheadAjax : IOptionBuilder { public Dictionary<string, object> Attributes { get; set; } private readonly IHtmlHelper _htmlHelper; public TypeaheadAjax(IHtmlHelper htmlHelper) { Attributes = new Dictionary<string, object>(); _htmlHelper = htmlHelper; } public TypeaheadAjax Url(string value) { Attributes["url"] = string.Format("'{0}'", value); return this; } public TypeaheadAjax UrlAction(string action) { var urlHelper = _htmlHelper.GetUrlHelper(); var url = urlHelper.Action(new UrlActionContext { Action = action }); return Url(url); } public TypeaheadAjax UrlAction(string action, object routeValues) { var urlHelper = _htmlHelper.GetUrlHelper(); var url = urlHelper.Action(new UrlActionContext { Action = action, Values = routeValues }); return Url(url); } public TypeaheadAjax UrlAction(string action, RouteValueDictionary routeValues) { var urlHelper = _htmlHelper.GetUrlHelper(); var url = urlHelper.Action(new UrlActionContext { Action = action, Values = routeValues }); return Url(url); } public TypeaheadAjax UrlAction(string action, string controller) { var urlHelper = _htmlHelper.GetUrlHelper(); var url = urlHelper.Action(new UrlActionContext { Action = action, Controller = controller }); return Url(url); } public TypeaheadAjax UrlAction(string action, string controller, object routeValues) { var urlHelper = _htmlHelper.GetUrlHelper(); var url = urlHelper.Action(new UrlActionContext { Action = action, Controller = controller, Values = routeValues }); Url(url); return this; } public TypeaheadAjax UrlAction(string action, string controller, RouteValueDictionary routeValues) { var urlHelper = _htmlHelper.GetUrlHelper(); var url = urlHelper.Action(new UrlActionContext { Action = action, Controller = controller, Values = routeValues }); return Url(url); } public TypeaheadAjax Timeout(int value) { Attributes["timeout"] = value; return this; } public TypeaheadAjax Method(FormMethod value) { Attributes["method"] = string.Format("'{0}'", value.ToString()); return this; } public TypeaheadAjax TriggerLength(int value) { Attributes["triggerLength"] = value; return this; } public TypeaheadAjax LoadingClass(string value) { Attributes["loadingClass"] = string.Format("'{0}'", value); return this; } public TypeaheadAjax DisplayField(string value) { Attributes["displayField"] = string.Format("'{0}'", value); return this; } public TypeaheadAjax ValueField(string value) { Attributes["valueField"] = string.Format("'{0}'", value); return this; } public TypeaheadAjax PreDispatch(string value) { Attributes["preDispatch"] = value; return this; } public TypeaheadAjax PreProcess(string value) { Attributes["preProcess"] = value; return this; } public TypeaheadAjax Parameter(string value) { Attributes["preDispatch"] = @"function (query) { return { " + value + @":query } }"; return this; } } }
32.335938
128
0.565354
[ "MIT" ]
hootanht/PersianComponents
src/Typeahead/Typeahead.cs
4,141
C#
using System; using System.Collections; using System.Collections.Generic; using UnityEngine; public class Agent : MonoBehaviour { public float ACCLIMATION_THRESHOLD = 0.2f; public float PLATFORM_SPEED = 0.1f; public Generator platformGenerator; private Coroutine generateSequence; public bool acclimated = false; private int coinsCollected = 0; public int totalCoinsCollected = 0; public Queue<float> scores = new Queue<float>(); public float scoreSD = 1; public int subpolicies = 0; public Subpolicy[] allPolicies; private Manager Manager; private Web Web; public Game gameToGenerate; public Round r0, r1, r2, r3, r4, r5, r6, r7, r8, r9; public Policy p0, p1, p2, p3, p4, p5; public List<Policy> policies; public Policy currentPolicy; public int roundIndex = 0; public int policyIndex = 0; public string REPORT = ""; void Start() { REPORT += "{\"game\": [{\"round\": ["; Manager = GameObject.Find("Manager").GetComponent<Manager>(); Web = GameObject.Find("Web").GetComponent<Web>(); p0 = new Policy(0); p1 = new Policy(1); p2 = new Policy(2); p3 = new Policy(3); p4 = new Policy(4); p5 = new Policy(5); r0 = new Round(new List<Policy>() {p0, p1, p2}); r1 = new Round(new List<Policy>() {p2, p3, p0}); r2 = new Round(new List<Policy>() {p1, p0, p5}); r3 = new Round(new List<Policy>() {p5, p4, p2}); r4 = new Round(new List<Policy>() {p0, p2, p4}); r5 = new Round(new List<Policy>() {p3, p1, p2}); r6 = new Round(new List<Policy>() {p0, p2, p5}); r7 = new Round(new List<Policy>() {p4, p3, p5}); r8 = new Round(new List<Policy>() {p4, p1, p0}); r9 = new Round(new List<Policy>() {p1, p3, p5}); // gameToGenerate = new Game(new List<Round>() {r0, r1, r2, r3, r4, r5, r6, r7, r8, r9}); gameToGenerate = new Game(new List<Round>() {r0, r1, r2}); List<Policy> policies = new List<Policy>() { p0, p1, p2, p3, p4, p5 }; currentPolicy = policies[policyIndex]; } void Update() { // Handle game pause. if (Manager.GetPaused()) { // StopGeneration(); } if(Input.GetKeyDown(KeyCode.Return) && Manager.GetPaused()) { // if cor running // stop if (platformGenerator.GetIsRunning()) { StopCoroutine(generateSequence); } Manager.SetPaused(false); generateSequence = StartCoroutine(platformGenerator.GenerateSequence(gameToGenerate.GetPolicy(roundIndex, policyIndex))); // Debug.Log("AGENT STARTS COUROUTINE"); } } public void StopGeneration() { StopCoroutine(generateSequence); } // SETTERS ---------------------------------------------------------------- public void IncrementCoinsCollected() { this.coinsCollected++; this.totalCoinsCollected++; } public void ResetCoinsCollected() { this.coinsCollected = 0; } // GETTERS ---------------------------------------------------------------- public bool GetIsAcclimated() { return acclimated; } public int GetTotalCoinsCollected() { return this.totalCoinsCollected; } public string GetCurrentPolicy() { return currentPolicy.GetStringRepresentation(); } public int GetCoinsPerCurrentWindow() { return this.currentPolicy.coinsPerWindow; } public int GetCoinsCollected() { return this.coinsCollected; } public string ScoresToString() { string result = ""; foreach (float value in this.scores) { result += "[" + value + "] "; } return result; } public float CalculateStandardDeviation() { // Get sum of list. float sum = 0; foreach (float value in this.scores) { sum += value; } float mean = (float)sum/this.scores.Count; // For each value, subtract mean and square result. List<float> squaredDifferences = new List<float>(); foreach (float value in this.scores) { squaredDifferences.Add((float)Math.Pow(value - mean, 2)); } // Get mean of squared differences. float sumOfSquares = 0; foreach (float value in squaredDifferences) { sumOfSquares += value; } float meanOfSquares = (float)sumOfSquares/squaredDifferences.Count; // Return square root of mean of squares. return (float)Math.Pow(meanOfSquares, 0.5); } /** * Called when player has acclimated/fallen. */ public Policy NextPolicy(Policy currentPolicy) { // Add current policy to report REPORT += currentPolicy.ToString(); // IF NO DEATH ... if (currentPolicy.acclimated) { // If no death, make new policy policyIndex++; // If reached end of round ... if (policyIndex >= gameToGenerate.PoliciesInRound(roundIndex)) { REPORT += "]}, {\"round\": ["; policyIndex = 0; roundIndex++; } else { REPORT += ", "; } // IF DEATH ... } else { REPORT += "]}, {\"round\": ["; policyIndex = 0; roundIndex++; } if (roundIndex >= gameToGenerate.RoundsInGame()) { REPORT = REPORT.Substring(0, REPORT.Length - 13); REPORT += "]}"; Manager.HandleGameOver(); Debug.Log("Game over"); Web.WriteData(REPORT); } Debug.Log(REPORT); return gameToGenerate.GetPolicy(roundIndex, policyIndex); } }
29.893939
133
0.544856
[ "MIT" ]
kirakira0/DDA
Assets/Scripts/Agent.cs
5,921
C#
/* * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). * You may not use this file except in compliance with the License. * A copy of the License is located at * * http://aws.amazon.com/apache2.0 * * or in the "license" file accompanying this file. This file is distributed * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either * express or implied. See the License for the specific language governing * permissions and limitations under the License. */ using System; using System.Collections.Generic; using System.Xml.Serialization; using System.Text; using Amazon.Runtime; namespace Amazon.SimpleEmail.Model { /// <summary> /// Returns information about the SendRawEmail response and response metadata. /// </summary> public class SendRawEmailResponse : SendRawEmailResult { /// <summary> /// Gets and sets the SendRawEmailResult property. /// Represents a unique message ID returned from a successful SendRawEmail request. /// </summary> [Obsolete(@"This property has been deprecated. All properties of the SendRawEmailResult class are now available on the SendRawEmailResponse class. You should use the properties on SendRawEmailResponse instead of accessing them through SendRawEmailResult.")] public SendRawEmailResult SendRawEmailResult { get { return this; } } } }
35.340909
265
0.69582
[ "Apache-2.0" ]
virajs/aws-sdk-net
AWSSDK_DotNet35/Amazon.SimpleEmail/Model/SendRawEmailResponse.cs
1,555
C#
using System; using NLog; using Sandbox.Game; using Sandbox.Game.World; using Torch.API.Managers; using Utils.Torch; using VRageMath; namespace AutoModerator.Quests { public sealed class QuestEntity { public interface IConfig { double QuestLagNormal { get; } bool EnableNotification { get; } string NotificationCurrentText { get; } bool EnableQuest { get; } string QuestTitle { get; } string QuestDetailMustProfileSelfText { get; } string QuestDetailMustDelagSelfText { get; } string QuestDetailMustWaitUnpinnedText { get; } string QuestDetailEndedText { get; } bool EnableQuestChatFeed { get; } } static readonly ILogger Log = LogManager.GetCurrentClassLogger(); readonly IConfig _config; readonly IChatManagerServer _chatManager; int _notificationId; int _commandNotificationId; bool _selfProfiled; bool _endCalled; public QuestEntity(long playerId, IConfig config, IChatManagerServer chatManager) { _config = config; PlayerId = playerId; _chatManager = chatManager; } public long PlayerId { get; } public string PlayerName { get; private set; } public long EntityId { get; private set; } public double LagNormal { get; private set; } public double QuestLagNormal { get; private set; } TimeSpan Pin { get; set; } public Quest Quest { get; private set; } public void Update(QuestSource source) { if (source.PlayerId != PlayerId) { throw new InvalidOperationException("player id mismatch"); } if (source.LagNormal < _config.QuestLagNormal && source.Pin == TimeSpan.Zero) { throw new InvalidOperationException("shouldn't be here"); } Log.Trace($"QuestEntity.Update({source})"); EntityId = source.EntityId; PlayerName = source.PlayerName; LagNormal = source.LagNormal; QuestLagNormal = source.LagNormal / _config.QuestLagNormal; Pin = source.Pin; UpdateQuest(); } public void OnSelfProfiled() { _selfProfiled = true; UpdateQuest(); } public void End() { _endCalled = true; UpdateQuest(); } void UpdateQuest() { var lastQuest = Quest; if (lastQuest == Quest.Ended) { // pass } else if (_endCalled) { Quest = Quest.Ended; } else if (Pin > TimeSpan.Zero) { Quest = Quest.MustWaitUnpinned; } else if (_selfProfiled) { Quest = Quest.MustDelagSelf; } else { Quest = Quest.MustProfileSelf; } if (Quest != lastQuest) { UpdateQuestLog(); SendQuestChat(); } UpdateNotification(); UpdateCommandNotification(); } public void Clear() { MyVisualScriptLogicProvider.RemoveNotification(_notificationId); MyVisualScriptLogicProvider.RemoveNotification(_commandNotificationId); MyVisualScriptLogicProvider.SetQuestlog(false, "", PlayerId); } public static void Clear(long playerId) { MyVisualScriptLogicProvider.SetQuestlog(false, "", playerId); } void UpdateNotification() { MyVisualScriptLogicProvider.RemoveNotification(_notificationId); if (!_config.EnableNotification) return; var message = $"{_config.NotificationCurrentText}: {LagNormal * 100:0}%"; if (Pin > TimeSpan.Zero) { message += $" (punishment left: {Pin.TotalSeconds:0} seconds or longer)"; } _notificationId = MyVisualScriptLogicProvider.AddNotification(message, "Red", PlayerId); } void UpdateCommandNotification() { MyVisualScriptLogicProvider.RemoveNotification(_commandNotificationId); if (Quest >= Quest.Ended) return; if (_selfProfiled) { const string Msg = "Type in chat: !lag inspect"; _commandNotificationId = MyVisualScriptLogicProvider.AddNotification(Msg, "Green", PlayerId); } else { const string Msg = "Type in chat: !lag profile"; _commandNotificationId = MyVisualScriptLogicProvider.AddNotification(Msg, "Green", PlayerId); } } void UpdateQuestLog() { if (!_config.EnableQuest) return; var playerName = MySession.Static.Players.GetPlayerNameOrElse(PlayerId, $"{PlayerId}"); Log.Debug($"updating quest log: {playerName}: {Quest}"); switch (Quest) { case Quest.MustProfileSelf: { MyVisualScriptLogicProvider.SetQuestlog(true, _config.QuestTitle, PlayerId); MyVisualScriptLogicProvider.RemoveQuestlogDetails(PlayerId); MyVisualScriptLogicProvider.AddQuestlogDetail(_config.QuestDetailMustProfileSelfText, true, true, PlayerId); return; } case Quest.MustDelagSelf: { MyVisualScriptLogicProvider.RemoveQuestlogDetails(PlayerId); MyVisualScriptLogicProvider.AddQuestlogDetail(_config.QuestDetailMustDelagSelfText, true, true, PlayerId); return; } case Quest.MustWaitUnpinned: { MyVisualScriptLogicProvider.RemoveQuestlogDetails(PlayerId); MyVisualScriptLogicProvider.AddQuestlogDetail(_config.QuestDetailMustWaitUnpinnedText, true, true, PlayerId); return; } case Quest.Ended: { MyVisualScriptLogicProvider.RemoveQuestlogDetails(PlayerId); MyVisualScriptLogicProvider.AddQuestlogDetail(_config.QuestDetailEndedText, true, true, PlayerId); return; } default: throw new ArgumentOutOfRangeException(nameof(Quest), Quest, null); } } void SendQuestChat() { if (!_config.EnableQuestChatFeed) return; var playerName = MySession.Static.Players.GetPlayerNameOrElse(PlayerId, $"{PlayerId}"); Log.Debug($"sending quest chat: {playerName}: {Quest}"); switch (Quest) { case Quest.MustProfileSelf: { SendChat(_config.QuestDetailMustProfileSelfText); return; } case Quest.MustDelagSelf: { SendChat(_config.QuestDetailMustDelagSelfText); return; } case Quest.MustWaitUnpinned: { SendChat(_config.QuestDetailMustWaitUnpinnedText); return; } case Quest.Ended: { SendChat(_config.QuestDetailEndedText); return; } default: throw new ArgumentOutOfRangeException(nameof(Quest), Quest, null); } } void SendChat(string message) { var steamId = MySession.Static.Players.TryGetSteamId(PlayerId); if (steamId == 0) return; _chatManager.SendMessageAsOther("AutoModerator", message, Color.Red, steamId); } public override string ToString() { return $"{{\"{PlayerName}\" {Quest} {LagNormal * 100:0}% ({QuestLagNormal * 100:0}%) pin({Pin.TotalSeconds:0}secs)}}"; } } }
33.431452
130
0.541792
[ "MIT" ]
HnZGaming/TorchShittyShitShitter
TorchAutoModerator/AutoModerator.Quests/QuestEntity.cs
8,293
C#
// The MIT License (MIT) // // Copyright (c) 2015 Daniel Franklin. http://blazedsp.com/ // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. namespace Blaze.DSP.Library.Models.Database { using Interfaces.Database; public class DestinationType : IDestinationType { public int Id { get; set; } public string Name { get; set; } } }
42.121212
80
0.738849
[ "MIT" ]
d-franklin/BlazeDSP
Libraries/Blaze.DSP.Library.Models/Database/DestinationType.cs
1,392
C#
using System.Threading; using ISO22900.II; using NUnit.Framework; namespace ISO22900.II.Test { public partial class IntegrationTest_SetupAndTearDown { [Test] public void TestPduGetStatusModule() { var statusData = _dPduApi.PduGetStatus(_moduleOne, PduConst.PDU_HANDLE_UNDEF, PduConst.PDU_HANDLE_UNDEF); Assert.AreEqual(PduStatus.PDU_MODST_READY, statusData.Status ); } [Test] public void TestPduGetStatusComLogicalLink() { var statusData = _dPduApi.PduGetStatus(_moduleOne, _cll, PduConst.PDU_HANDLE_UNDEF); Assert.AreEqual(PduStatus.PDU_CLLST_OFFLINE, statusData.Status); } [Test] public void TestPduGetStatusComPrimitive() { _dPduApi.PduConnect(_moduleOne, _cll); uint delay = 200; var copControlDelay = new PduCopCtrlData(delay); var hCoP = _dPduApi.PduStartComPrimitive(_moduleOne, _cll, PduCopt.PDU_COPT_DELAY, new byte[] { }, copControlDelay, 0); var statusData = _dPduApi.PduGetStatus(_moduleOne, _cll, hCoP); Assert.AreEqual(PduStatus.PDU_COPST_IDLE, statusData.Status); _dPduApi.PduDisconnect(_moduleOne, _cll); } } }
33.717949
117
0.636502
[ "MIT" ]
DiagProf/ISO22900.II
WrapISO22900.II.Test/TestIso22900NativeWrapAccessWithOutEcuCom/IntegrationTest_PduGetStatus.cs
1,315
C#
// <auto-generated> // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for // license information. // // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. // </auto-generated> namespace Microsoft.Azure.Management.ApiManagement.Models { using Newtonsoft.Json; using Newtonsoft.Json.Converters; using System.Runtime; using System.Runtime.Serialization; /// <summary> /// Defines values for KeyType. /// </summary> [JsonConverter(typeof(StringEnumConverter))] public enum KeyType { [EnumMember(Value = "primary")] Primary, [EnumMember(Value = "secondary")] Secondary } internal static class KeyTypeEnumExtension { internal static string ToSerializedValue(this KeyType? value) { return value == null ? null : ((KeyType)value).ToSerializedValue(); } internal static string ToSerializedValue(this KeyType value) { switch( value ) { case KeyType.Primary: return "primary"; case KeyType.Secondary: return "secondary"; } return null; } internal static KeyType? ParseKeyType(this string value) { switch( value ) { case "primary": return KeyType.Primary; case "secondary": return KeyType.Secondary; } return null; } } }
27.885246
79
0.576132
[ "MIT" ]
0rland0Wats0n/azure-sdk-for-net
sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/KeyType.cs
1,701
C#
/* * Copyright 2010-2014 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). * You may not use this file except in compliance with the License. * A copy of the License is located at * * http://aws.amazon.com/apache2.0 * * or in the "license" file accompanying this file. This file is distributed * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either * express or implied. See the License for the specific language governing * permissions and limitations under the License. */ /* * Do not modify this file. This file is generated from the states-2016-11-23.normal.json service model. */ using System; using System.Net; using Amazon.Runtime; namespace Amazon.StepFunctions.Model { ///<summary> /// StepFunctions exception /// </summary> #if !PCL && !NETSTANDARD [Serializable] #endif public class InvalidLoggingConfigurationException : AmazonStepFunctionsException { /// <summary> /// Constructs a new InvalidLoggingConfigurationException with the specified error /// message. /// </summary> /// <param name="message"> /// Describes the error encountered. /// </param> public InvalidLoggingConfigurationException(string message) : base(message) {} /// <summary> /// Construct instance of InvalidLoggingConfigurationException /// </summary> /// <param name="message"></param> /// <param name="innerException"></param> public InvalidLoggingConfigurationException(string message, Exception innerException) : base(message, innerException) {} /// <summary> /// Construct instance of InvalidLoggingConfigurationException /// </summary> /// <param name="innerException"></param> public InvalidLoggingConfigurationException(Exception innerException) : base(innerException) {} /// <summary> /// Construct instance of InvalidLoggingConfigurationException /// </summary> /// <param name="message"></param> /// <param name="innerException"></param> /// <param name="errorType"></param> /// <param name="errorCode"></param> /// <param name="requestId"></param> /// <param name="statusCode"></param> public InvalidLoggingConfigurationException(string message, Exception innerException, ErrorType errorType, string errorCode, string requestId, HttpStatusCode statusCode) : base(message, innerException, errorType, errorCode, requestId, statusCode) {} /// <summary> /// Construct instance of InvalidLoggingConfigurationException /// </summary> /// <param name="message"></param> /// <param name="errorType"></param> /// <param name="errorCode"></param> /// <param name="requestId"></param> /// <param name="statusCode"></param> public InvalidLoggingConfigurationException(string message, ErrorType errorType, string errorCode, string requestId, HttpStatusCode statusCode) : base(message, errorType, errorCode, requestId, statusCode) {} #if !PCL && !NETSTANDARD /// <summary> /// Constructs a new instance of the InvalidLoggingConfigurationException class with serialized data. /// </summary> /// <param name="info">The <see cref="T:System.Runtime.Serialization.SerializationInfo" /> that holds the serialized object data about the exception being thrown.</param> /// <param name="context">The <see cref="T:System.Runtime.Serialization.StreamingContext" /> that contains contextual information about the source or destination.</param> /// <exception cref="T:System.ArgumentNullException">The <paramref name="info" /> parameter is null. </exception> /// <exception cref="T:System.Runtime.Serialization.SerializationException">The class name is null or <see cref="P:System.Exception.HResult" /> is zero (0). </exception> protected InvalidLoggingConfigurationException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) : base(info, context) { } #endif } }
44.721649
178
0.662517
[ "Apache-2.0" ]
NGL321/aws-sdk-net
sdk/src/Services/StepFunctions/Generated/Model/InvalidLoggingConfigurationException.cs
4,338
C#
// // DO NOT MODIFY. THIS IS AUTOMATICALLY GENERATED FILE. // #nullable enable namespace CefNet.DevTools.Protocol.Accessibility { /// <summary>Unique accessibility node identifier.</summary> public readonly struct AXNodeId : System.IEquatable<CefNet.DevTools.Protocol.Accessibility.AXNodeId> { private readonly string? _value; public AXNodeId( string value) { _value = value; } [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] public readonly string GetUnderlyingValue( ) { return _value ?? ""; } public override int GetHashCode( ) { return (_value ?? "").GetHashCode(); } public override string ToString( ) { return GetUnderlyingValue(); } public override bool Equals( object? obj) { if (obj is AXNodeId other) return Equals(other); return false; } public bool Equals( AXNodeId other) { return GetUnderlyingValue() == other.GetUnderlyingValue(); } public static bool operator==( AXNodeId x, AXNodeId y) { return x.GetUnderlyingValue() == y.GetUnderlyingValue(); } public static bool operator!=( AXNodeId x, AXNodeId y) { return x.GetUnderlyingValue() != y.GetUnderlyingValue(); } } }
24.208955
122
0.54439
[ "MIT" ]
CefNet/CefNet.DevTools.Protocol
CefNet.DevTools.Protocol/Generated/Accessibility/AXNodeId.g.cs
1,622
C#
using Application.DTOs; using Application.Interfaces; using AutoMapper; using Common.ExtensionMethods; using Domain.Interfaces; using Domain.Models; using HtmlAgilityPack; using Microsoft.AspNetCore.Hosting; using Newtonsoft.Json; using System.Collections.Generic; using System.IO; using System.Linq; using System.Net.Http; using System.Threading.Tasks; namespace Application.Services { public class ExtractGovWebDataService : IExtractGovWebDataService { private readonly string _baseUrl = "https://catalog.data.gov/"; private readonly IExtractGovWebDataRepository _extractGovWebDataRepository; private readonly IHostingEnvironment _hostingEnvironment; private readonly IMapper _mapper; private readonly HttpClient _httpClient; public ExtractGovWebDataService(IExtractGovWebDataRepository extractGovWebDataRepository, IHostingEnvironment hostingEnvironment, IMapper mapper, HttpClient httpClient) { _extractGovWebDataRepository = extractGovWebDataRepository; _httpClient = httpClient; _hostingEnvironment = hostingEnvironment; _mapper = mapper; } public async Task<bool> ExtractGovFilesAndData(string searchTerm) { List<string> links = await SearchLinksRelated(searchTerm); List<GovInformation> informations = await ExtractInfoGov(links, searchTerm); return await _extractGovWebDataRepository.SaveExtractGovData(informations); } private async Task<List<string>> SearchLinksRelated(string searchTerm) { List<string> links = new(); string htmlResponse = await _httpClient.GetResponseHtmlAsync(_baseUrl.CombineUrl($"dataset?q={searchTerm}&sort=score+desc")); HtmlDocument doc = htmlResponse.CreateHtmlDocument(); HtmlNodeCollection nodes = doc.DocumentNode.SelectNodes(".//h3//a"); if (nodes != null) links = nodes.Select(node => _baseUrl.CombineUrl(node.Attributes["href"].Value)).ToList(); return links; } private async Task<List<GovInformation>> ExtractInfoGov(List<string> links, string searchTerm) { List<GovInformation> informations = new(); foreach (string link in links) { string htmlResponse = await _httpClient.GetResponseHtmlAsync(link); List<DownloadUrlDocument> completeDownloadPaths = await ExtractDocumentsFiles(htmlResponse); Root root = await DownloadMetadataInfo(htmlResponse); informations.Add(new GovInformation(root, searchTerm, completeDownloadPaths)); } return informations; } private async Task<List<DownloadUrlDocument>> ExtractDocumentsFiles(string htmlResponse) { List<DownloadUrlDocument> completeDownloadPaths = new(); HtmlDocument doc = htmlResponse.CreateHtmlDocument(); HtmlNodeCollection nodes = doc.DocumentNode.SelectNodes("//ul[@class='resource-list']/li/a"); if (nodes != null) { List<string> links = nodes.Select(node => _baseUrl.CombineUrl(node.Attributes["href"].Value)).ToList(); foreach (string link in links) { string pathDownload = await DownloadFiles(link); if (!string.IsNullOrEmpty(pathDownload)) { completeDownloadPaths.Add(new(pathDownload)); } } } return completeDownloadPaths; } private async Task<string> DownloadFiles(string link) { string completeDownloadPath = string.Empty; string htmlResponse = await _httpClient.GetResponseHtmlAsync(link); HtmlDocument doc = htmlResponse.CreateHtmlDocument(); HtmlNode node = doc.DocumentNode.SelectSingleNode(".//div[@class='actions']//ul//li//a"); if (node != null) { string linkDoc = node.Attributes["href"].Value; completeDownloadPath = linkDoc.DownloadFilesFromUrl(Path.Combine(_hostingEnvironment.WebRootPath, "Files"), true); } return completeDownloadPath; } private async Task<Root> DownloadMetadataInfo(string htmlResponse) { Root root = new(); HtmlDocument doc = htmlResponse.CreateHtmlDocument(); HtmlNode node = doc.DocumentNode.SelectSingleNode(".//p[@class='description']//a"); if (node != null) { string linkMetadata = node.Attributes["href"].Value; string jsonData = await _httpClient.GetResponseHtmlAsync(_baseUrl.CombineUrl(linkMetadata)); if (jsonData.IsValidJson()) root = JsonConvert.DeserializeObject<Root>(jsonData); } return root; } public async Task<List<GovInformationDTO>> GetExtractGovDataBySearchTerm(string searchTerm) { List<GovInformation> govInformations = await _extractGovWebDataRepository.GetExtractGovDataBySearchTerm(searchTerm); return _mapper.Map<List<GovInformationDTO>>(govInformations); } } }
38.780142
137
0.629298
[ "MIT" ]
Marcus-V-Freitas/WebScrapingGovData
Application/Services/ExtractGovWebDataService.cs
5,470
C#
/* MIT License Copyright (c) 2016 JetBrains http://www.jetbrains.com Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ using System; #pragma warning disable 1591 // ReSharper disable UnusedMember.Global // ReSharper disable MemberCanBePrivate.Global // ReSharper disable UnusedAutoPropertyAccessor.Global // ReSharper disable IntroduceOptionalParameters.Global // ReSharper disable MemberCanBeProtected.Global // ReSharper disable InconsistentNaming namespace UwpHelpers.Examples.Annotations { /// <summary> /// Indicates that the value of the marked element could be <c>null</c> sometimes, /// so the check for <c>null</c> is necessary before its usage. /// </summary> /// <example><code> /// [CanBeNull] object Test() => null; /// /// void UseTest() { /// var p = Test(); /// var s = p.ToString(); // Warning: Possible 'System.NullReferenceException' /// } /// </code></example> [AttributeUsage( AttributeTargets.Method | AttributeTargets.Parameter | AttributeTargets.Property | AttributeTargets.Delegate | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Class | AttributeTargets.Interface | AttributeTargets.GenericParameter)] public sealed class CanBeNullAttribute : Attribute { } /// <summary> /// Indicates that the value of the marked element could never be <c>null</c>. /// </summary> /// <example><code> /// [NotNull] object Foo() { /// return null; // Warning: Possible 'null' assignment /// } /// </code></example> [AttributeUsage( AttributeTargets.Method | AttributeTargets.Parameter | AttributeTargets.Property | AttributeTargets.Delegate | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Class | AttributeTargets.Interface | AttributeTargets.GenericParameter)] public sealed class NotNullAttribute : Attribute { } /// <summary> /// Can be appplied to symbols of types derived from IEnumerable as well as to symbols of Task /// and Lazy classes to indicate that the value of a collection item, of the Task.Result property /// or of the Lazy.Value property can never be null. /// </summary> [AttributeUsage( AttributeTargets.Method | AttributeTargets.Parameter | AttributeTargets.Property | AttributeTargets.Delegate | AttributeTargets.Field)] public sealed class ItemNotNullAttribute : Attribute { } /// <summary> /// Can be appplied to symbols of types derived from IEnumerable as well as to symbols of Task /// and Lazy classes to indicate that the value of a collection item, of the Task.Result property /// or of the Lazy.Value property can be null. /// </summary> [AttributeUsage( AttributeTargets.Method | AttributeTargets.Parameter | AttributeTargets.Property | AttributeTargets.Delegate | AttributeTargets.Field)] public sealed class ItemCanBeNullAttribute : Attribute { } /// <summary> /// Implicitly apply [NotNull]/[ItemNotNull] annotation to all the of type members and parameters /// in particular scope where this annotation is used (type declaration or whole assembly). /// </summary> [AttributeUsage( AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Interface | AttributeTargets.Assembly)] public sealed class ImplicitNotNullAttribute : Attribute { } /// <summary> /// Indicates that the marked method builds string by format pattern and (optional) arguments. /// Parameter, which contains format string, should be given in constructor. The format string /// should be in <see cref="string.Format(IFormatProvider,string,object[])"/>-like form. /// </summary> /// <example><code> /// [StringFormatMethod("message")] /// void ShowError(string message, params object[] args) { /* do something */ } /// /// void Foo() { /// ShowError("Failed: {0}"); // Warning: Non-existing argument in format string /// } /// </code></example> [AttributeUsage( AttributeTargets.Constructor | AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Delegate)] public sealed class StringFormatMethodAttribute : Attribute { /// <param name="formatParameterName"> /// Specifies which parameter of an annotated method should be treated as format-string /// </param> public StringFormatMethodAttribute([NotNull] string formatParameterName) { FormatParameterName = formatParameterName; } [NotNull] public string FormatParameterName { get; private set; } } /// <summary> /// For a parameter that is expected to be one of the limited set of values. /// Specify fields of which type should be used as values for this parameter. /// </summary> [AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Property | AttributeTargets.Field)] public sealed class ValueProviderAttribute : Attribute { public ValueProviderAttribute([NotNull] string name) { Name = name; } [NotNull] public string Name { get; private set; } } /// <summary> /// Indicates that the function argument should be string literal and match one /// of the parameters of the caller function. For example, ReSharper annotates /// the parameter of <see cref="System.ArgumentNullException"/>. /// </summary> /// <example><code> /// void Foo(string param) { /// if (param == null) /// throw new ArgumentNullException("par"); // Warning: Cannot resolve symbol /// } /// </code></example> [AttributeUsage(AttributeTargets.Parameter)] public sealed class InvokerParameterNameAttribute : Attribute { } /// <summary> /// Indicates that the method is contained in a type that implements /// <c>System.ComponentModel.INotifyPropertyChanged</c> interface and this method /// is used to notify that some property value changed. /// </summary> /// <remarks> /// The method should be non-static and conform to one of the supported signatures: /// <list> /// <item><c>NotifyChanged(string)</c></item> /// <item><c>NotifyChanged(params string[])</c></item> /// <item><c>NotifyChanged{T}(Expression{Func{T}})</c></item> /// <item><c>NotifyChanged{T,U}(Expression{Func{T,U}})</c></item> /// <item><c>SetProperty{T}(ref T, T, string)</c></item> /// </list> /// </remarks> /// <example><code> /// public class Foo : INotifyPropertyChanged { /// public event PropertyChangedEventHandler PropertyChanged; /// /// [NotifyPropertyChangedInvocator] /// protected virtual void NotifyChanged(string propertyName) { ... } /// /// string _name; /// /// public string Name { /// get { return _name; } /// set { _name = value; NotifyChanged("LastName"); /* Warning */ } /// } /// } /// </code> /// Examples of generated notifications: /// <list> /// <item><c>NotifyChanged("Property")</c></item> /// <item><c>NotifyChanged(() =&gt; Property)</c></item> /// <item><c>NotifyChanged((VM x) =&gt; x.Property)</c></item> /// <item><c>SetProperty(ref myField, value, "Property")</c></item> /// </list> /// </example> [AttributeUsage(AttributeTargets.Method)] public sealed class NotifyPropertyChangedInvocatorAttribute : Attribute { public NotifyPropertyChangedInvocatorAttribute() { } public NotifyPropertyChangedInvocatorAttribute([NotNull] string parameterName) { ParameterName = parameterName; } [CanBeNull] public string ParameterName { get; private set; } } /// <summary> /// Describes dependency between method input and output. /// </summary> /// <syntax> /// <p>Function Definition Table syntax:</p> /// <list> /// <item>FDT ::= FDTRow [;FDTRow]*</item> /// <item>FDTRow ::= Input =&gt; Output | Output &lt;= Input</item> /// <item>Input ::= ParameterName: Value [, Input]*</item> /// <item>Output ::= [ParameterName: Value]* {halt|stop|void|nothing|Value}</item> /// <item>Value ::= true | false | null | notnull | canbenull</item> /// </list> /// If method has single input parameter, it's name could be omitted.<br/> /// Using <c>halt</c> (or <c>void</c>/<c>nothing</c>, which is the same) /// for method output means that the methos doesn't return normally.<br/> /// <c>canbenull</c> annotation is only applicable for output parameters.<br/> /// You can use multiple <c>[ContractAnnotation]</c> for each FDT row, /// or use single attribute with rows separated by semicolon.<br/> /// </syntax> /// <examples><list> /// <item><code> /// [ContractAnnotation("=> halt")] /// public void TerminationMethod() /// </code></item> /// <item><code> /// [ContractAnnotation("halt &lt;= condition: false")] /// public void Assert(bool condition, string text) // regular assertion method /// </code></item> /// <item><code> /// [ContractAnnotation("s:null => true")] /// public bool IsNullOrEmpty(string s) // string.IsNullOrEmpty() /// </code></item> /// <item><code> /// // A method that returns null if the parameter is null, /// // and not null if the parameter is not null /// [ContractAnnotation("null => null; notnull => notnull")] /// public object Transform(object data) /// </code></item> /// <item><code> /// [ContractAnnotation("s:null=>false; =>true,result:notnull; =>false, result:null")] /// public bool TryParse(string s, out Person result) /// </code></item> /// </list></examples> [AttributeUsage(AttributeTargets.Method, AllowMultiple = true)] public sealed class ContractAnnotationAttribute : Attribute { public ContractAnnotationAttribute([NotNull] string contract) : this(contract, false) { } public ContractAnnotationAttribute([NotNull] string contract, bool forceFullStates) { Contract = contract; ForceFullStates = forceFullStates; } [NotNull] public string Contract { get; private set; } public bool ForceFullStates { get; private set; } } /// <summary> /// Indicates that marked element should be localized or not. /// </summary> /// <example><code> /// [LocalizationRequiredAttribute(true)] /// class Foo { /// string str = "my string"; // Warning: Localizable string /// } /// </code></example> [AttributeUsage(AttributeTargets.All)] public sealed class LocalizationRequiredAttribute : Attribute { public LocalizationRequiredAttribute() : this(true) { } public LocalizationRequiredAttribute(bool required) { Required = required; } public bool Required { get; private set; } } /// <summary> /// Indicates that the value of the marked type (or its derivatives) /// cannot be compared using '==' or '!=' operators and <c>Equals()</c> /// should be used instead. However, using '==' or '!=' for comparison /// with <c>null</c> is always permitted. /// </summary> /// <example><code> /// [CannotApplyEqualityOperator] /// class NoEquality { } /// /// class UsesNoEquality { /// void Test() { /// var ca1 = new NoEquality(); /// var ca2 = new NoEquality(); /// if (ca1 != null) { // OK /// bool condition = ca1 == ca2; // Warning /// } /// } /// } /// </code></example> [AttributeUsage(AttributeTargets.Interface | AttributeTargets.Class | AttributeTargets.Struct)] public sealed class CannotApplyEqualityOperatorAttribute : Attribute { } /// <summary> /// When applied to a target attribute, specifies a requirement for any type marked /// with the target attribute to implement or inherit specific type or types. /// </summary> /// <example><code> /// [BaseTypeRequired(typeof(IComponent)] // Specify requirement /// class ComponentAttribute : Attribute { } /// /// [Component] // ComponentAttribute requires implementing IComponent interface /// class MyComponent : IComponent { } /// </code></example> [AttributeUsage(AttributeTargets.Class, AllowMultiple = true)] [BaseTypeRequired(typeof(Attribute))] public sealed class BaseTypeRequiredAttribute : Attribute { public BaseTypeRequiredAttribute([NotNull] Type baseType) { BaseType = baseType; } [NotNull] public Type BaseType { get; private set; } } /// <summary> /// Indicates that the marked symbol is used implicitly (e.g. via reflection, in external library), /// so this symbol will not be marked as unused (as well as by other usage inspections). /// </summary> [AttributeUsage(AttributeTargets.All)] public sealed class UsedImplicitlyAttribute : Attribute { public UsedImplicitlyAttribute() : this(ImplicitUseKindFlags.Default, ImplicitUseTargetFlags.Default) { } public UsedImplicitlyAttribute(ImplicitUseKindFlags useKindFlags) : this(useKindFlags, ImplicitUseTargetFlags.Default) { } public UsedImplicitlyAttribute(ImplicitUseTargetFlags targetFlags) : this(ImplicitUseKindFlags.Default, targetFlags) { } public UsedImplicitlyAttribute(ImplicitUseKindFlags useKindFlags, ImplicitUseTargetFlags targetFlags) { UseKindFlags = useKindFlags; TargetFlags = targetFlags; } public ImplicitUseKindFlags UseKindFlags { get; private set; } public ImplicitUseTargetFlags TargetFlags { get; private set; } } /// <summary> /// Should be used on attributes and causes ReSharper to not mark symbols marked with such attributes /// as unused (as well as by other usage inspections) /// </summary> [AttributeUsage(AttributeTargets.Class | AttributeTargets.GenericParameter)] public sealed class MeansImplicitUseAttribute : Attribute { public MeansImplicitUseAttribute() : this(ImplicitUseKindFlags.Default, ImplicitUseTargetFlags.Default) { } public MeansImplicitUseAttribute(ImplicitUseKindFlags useKindFlags) : this(useKindFlags, ImplicitUseTargetFlags.Default) { } public MeansImplicitUseAttribute(ImplicitUseTargetFlags targetFlags) : this(ImplicitUseKindFlags.Default, targetFlags) { } public MeansImplicitUseAttribute(ImplicitUseKindFlags useKindFlags, ImplicitUseTargetFlags targetFlags) { UseKindFlags = useKindFlags; TargetFlags = targetFlags; } [UsedImplicitly] public ImplicitUseKindFlags UseKindFlags { get; private set; } [UsedImplicitly] public ImplicitUseTargetFlags TargetFlags { get; private set; } } [Flags] public enum ImplicitUseKindFlags { Default = Access | Assign | InstantiatedWithFixedConstructorSignature, /// <summary>Only entity marked with attribute considered used.</summary> Access = 1, /// <summary>Indicates implicit assignment to a member.</summary> Assign = 2, /// <summary> /// Indicates implicit instantiation of a type with fixed constructor signature. /// That means any unused constructor parameters won't be reported as such. /// </summary> InstantiatedWithFixedConstructorSignature = 4, /// <summary>Indicates implicit instantiation of a type.</summary> InstantiatedNoFixedConstructorSignature = 8, } /// <summary> /// Specify what is considered used implicitly when marked /// with <see cref="MeansImplicitUseAttribute"/> or <see cref="UsedImplicitlyAttribute"/>. /// </summary> [Flags] public enum ImplicitUseTargetFlags { Default = Itself, Itself = 1, /// <summary>Members of entity marked with attribute are considered used.</summary> Members = 2, /// <summary>Entity marked with attribute and all its members considered used.</summary> WithMembers = Itself | Members } /// <summary> /// This attribute is intended to mark publicly available API /// which should not be removed and so is treated as used. /// </summary> [MeansImplicitUse(ImplicitUseTargetFlags.WithMembers)] public sealed class PublicAPIAttribute : Attribute { public PublicAPIAttribute() { } public PublicAPIAttribute([NotNull] string comment) { Comment = comment; } [CanBeNull] public string Comment { get; private set; } } /// <summary> /// Tells code analysis engine if the parameter is completely handled when the invoked method is on stack. /// If the parameter is a delegate, indicates that delegate is executed while the method is executed. /// If the parameter is an enumerable, indicates that it is enumerated while the method is executed. /// </summary> [AttributeUsage(AttributeTargets.Parameter)] public sealed class InstantHandleAttribute : Attribute { } /// <summary> /// Indicates that a method does not make any observable state changes. /// The same as <c>System.Diagnostics.Contracts.PureAttribute</c>. /// </summary> /// <example><code> /// [Pure] int Multiply(int x, int y) => x * y; /// /// void M() { /// Multiply(123, 42); // Waring: Return value of pure method is not used /// } /// </code></example> [AttributeUsage(AttributeTargets.Method)] public sealed class PureAttribute : Attribute { } /// <summary> /// Indicates that the return value of method invocation must be used. /// </summary> [AttributeUsage(AttributeTargets.Method)] public sealed class MustUseReturnValueAttribute : Attribute { public MustUseReturnValueAttribute() { } public MustUseReturnValueAttribute([NotNull] string justification) { Justification = justification; } [CanBeNull] public string Justification { get; private set; } } /// <summary> /// Indicates the type member or parameter of some type, that should be used instead of all other ways /// to get the value that type. This annotation is useful when you have some "context" value evaluated /// and stored somewhere, meaning that all other ways to get this value must be consolidated with existing one. /// </summary> /// <example><code> /// class Foo { /// [ProvidesContext] IBarService _barService = ...; /// /// void ProcessNode(INode node) { /// DoSomething(node, node.GetGlobalServices().Bar); /// // ^ Warning: use value of '_barService' field /// } /// } /// </code></example> [AttributeUsage( AttributeTargets.Field | AttributeTargets.Property | AttributeTargets.Parameter | AttributeTargets.Method | AttributeTargets.Class | AttributeTargets.Interface | AttributeTargets.Struct | AttributeTargets.GenericParameter)] public sealed class ProvidesContextAttribute : Attribute { } /// <summary> /// Indicates that a parameter is a path to a file or a folder within a web project. /// Path can be relative or absolute, starting from web root (~). /// </summary> [AttributeUsage(AttributeTargets.Parameter)] public sealed class PathReferenceAttribute : Attribute { public PathReferenceAttribute() { } public PathReferenceAttribute([NotNull, PathReference] string basePath) { BasePath = basePath; } [CanBeNull] public string BasePath { get; private set; } } /// <summary> /// An extension method marked with this attribute is processed by ReSharper code completion /// as a 'Source Template'. When extension method is completed over some expression, it's source code /// is automatically expanded like a template at call site. /// </summary> /// <remarks> /// Template method body can contain valid source code and/or special comments starting with '$'. /// Text inside these comments is added as source code when the template is applied. Template parameters /// can be used either as additional method parameters or as identifiers wrapped in two '$' signs. /// Use the <see cref="MacroAttribute"/> attribute to specify macros for parameters. /// </remarks> /// <example> /// In this example, the 'forEach' method is a source template available over all values /// of enumerable types, producing ordinary C# 'foreach' statement and placing caret inside block: /// <code> /// [SourceTemplate] /// public static void forEach&lt;T&gt;(this IEnumerable&lt;T&gt; xs) { /// foreach (var x in xs) { /// //$ $END$ /// } /// } /// </code> /// </example> [AttributeUsage(AttributeTargets.Method)] public sealed class SourceTemplateAttribute : Attribute { } /// <summary> /// Allows specifying a macro for a parameter of a <see cref="SourceTemplateAttribute">source template</see>. /// </summary> /// <remarks> /// You can apply the attribute on the whole method or on any of its additional parameters. The macro expression /// is defined in the <see cref="MacroAttribute.Expression"/> property. When applied on a method, the target /// template parameter is defined in the <see cref="MacroAttribute.Target"/> property. To apply the macro silently /// for the parameter, set the <see cref="MacroAttribute.Editable"/> property value = -1. /// </remarks> /// <example> /// Applying the attribute on a source template method: /// <code> /// [SourceTemplate, Macro(Target = "item", Expression = "suggestVariableName()")] /// public static void forEach&lt;T&gt;(this IEnumerable&lt;T&gt; collection) { /// foreach (var item in collection) { /// //$ $END$ /// } /// } /// </code> /// Applying the attribute on a template method parameter: /// <code> /// [SourceTemplate] /// public static void something(this Entity x, [Macro(Expression = "guid()", Editable = -1)] string newguid) { /// /*$ var $x$Id = "$newguid$" + x.ToString(); /// x.DoSomething($x$Id); */ /// } /// </code> /// </example> [AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Method, AllowMultiple = true)] public sealed class MacroAttribute : Attribute { /// <summary> /// Allows specifying a macro that will be executed for a <see cref="SourceTemplateAttribute">source template</see> /// parameter when the template is expanded. /// </summary> public string Expression { get; set; } /// <summary> /// Allows specifying which occurrence of the target parameter becomes editable when the template is deployed. /// </summary> /// <remarks> /// If the target parameter is used several times in the template, only one occurrence becomes editable; /// other occurrences are changed synchronously. To specify the zero-based index of the editable occurrence, /// use values >= 0. To make the parameter non-editable when the template is expanded, use -1. /// </remarks>> public int Editable { get; set; } /// <summary> /// Identifies the target parameter of a <see cref="SourceTemplateAttribute">source template</see> if the /// <see cref="MacroAttribute"/> is applied on a template method. /// </summary> public string Target { get; set; } } [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] public sealed class AspMvcAreaMasterLocationFormatAttribute : Attribute { public AspMvcAreaMasterLocationFormatAttribute([NotNull] string format) { Format = format; } [NotNull] public string Format { get; private set; } } [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] public sealed class AspMvcAreaPartialViewLocationFormatAttribute : Attribute { public AspMvcAreaPartialViewLocationFormatAttribute([NotNull] string format) { Format = format; } [NotNull] public string Format { get; private set; } } [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] public sealed class AspMvcAreaViewLocationFormatAttribute : Attribute { public AspMvcAreaViewLocationFormatAttribute([NotNull] string format) { Format = format; } [NotNull] public string Format { get; private set; } } [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] public sealed class AspMvcMasterLocationFormatAttribute : Attribute { public AspMvcMasterLocationFormatAttribute(string format) { Format = format; } public string Format { get; private set; } } [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] public sealed class AspMvcPartialViewLocationFormatAttribute : Attribute { public AspMvcPartialViewLocationFormatAttribute([NotNull] string format) { Format = format; } [NotNull] public string Format { get; private set; } } [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] public sealed class AspMvcViewLocationFormatAttribute : Attribute { public AspMvcViewLocationFormatAttribute([NotNull] string format) { Format = format; } [NotNull] public string Format { get; private set; } } /// <summary> /// ASP.NET MVC attribute. If applied to a parameter, indicates that the parameter /// is an MVC action. If applied to a method, the MVC action name is calculated /// implicitly from the context. Use this attribute for custom wrappers similar to /// <c>System.Web.Mvc.Html.ChildActionExtensions.RenderAction(HtmlHelper, String)</c>. /// </summary> [AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Method)] public sealed class AspMvcActionAttribute : Attribute { public AspMvcActionAttribute() { } public AspMvcActionAttribute([NotNull] string anonymousProperty) { AnonymousProperty = anonymousProperty; } [CanBeNull] public string AnonymousProperty { get; private set; } } /// <summary> /// ASP.NET MVC attribute. Indicates that a parameter is an MVC area. /// Use this attribute for custom wrappers similar to /// <c>System.Web.Mvc.Html.ChildActionExtensions.RenderAction(HtmlHelper, String)</c>. /// </summary> [AttributeUsage(AttributeTargets.Parameter)] public sealed class AspMvcAreaAttribute : Attribute { public AspMvcAreaAttribute() { } public AspMvcAreaAttribute([NotNull] string anonymousProperty) { AnonymousProperty = anonymousProperty; } [CanBeNull] public string AnonymousProperty { get; private set; } } /// <summary> /// ASP.NET MVC attribute. If applied to a parameter, indicates that the parameter is /// an MVC controller. If applied to a method, the MVC controller name is calculated /// implicitly from the context. Use this attribute for custom wrappers similar to /// <c>System.Web.Mvc.Html.ChildActionExtensions.RenderAction(HtmlHelper, String, String)</c>. /// </summary> [AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Method)] public sealed class AspMvcControllerAttribute : Attribute { public AspMvcControllerAttribute() { } public AspMvcControllerAttribute([NotNull] string anonymousProperty) { AnonymousProperty = anonymousProperty; } [CanBeNull] public string AnonymousProperty { get; private set; } } /// <summary> /// ASP.NET MVC attribute. Indicates that a parameter is an MVC Master. Use this attribute /// for custom wrappers similar to <c>System.Web.Mvc.Controller.View(String, String)</c>. /// </summary> [AttributeUsage(AttributeTargets.Parameter)] public sealed class AspMvcMasterAttribute : Attribute { } /// <summary> /// ASP.NET MVC attribute. Indicates that a parameter is an MVC model type. Use this attribute /// for custom wrappers similar to <c>System.Web.Mvc.Controller.View(String, Object)</c>. /// </summary> [AttributeUsage(AttributeTargets.Parameter)] public sealed class AspMvcModelTypeAttribute : Attribute { } /// <summary> /// ASP.NET MVC attribute. If applied to a parameter, indicates that the parameter is an MVC /// partial view. If applied to a method, the MVC partial view name is calculated implicitly /// from the context. Use this attribute for custom wrappers similar to /// <c>System.Web.Mvc.Html.RenderPartialExtensions.RenderPartial(HtmlHelper, String)</c>. /// </summary> [AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Method)] public sealed class AspMvcPartialViewAttribute : Attribute { } /// <summary> /// ASP.NET MVC attribute. Allows disabling inspections for MVC views within a class or a method. /// </summary> [AttributeUsage(AttributeTargets.Class | AttributeTargets.Method)] public sealed class AspMvcSuppressViewErrorAttribute : Attribute { } /// <summary> /// ASP.NET MVC attribute. Indicates that a parameter is an MVC display template. /// Use this attribute for custom wrappers similar to /// <c>System.Web.Mvc.Html.DisplayExtensions.DisplayForModel(HtmlHelper, String)</c>. /// </summary> [AttributeUsage(AttributeTargets.Parameter)] public sealed class AspMvcDisplayTemplateAttribute : Attribute { } /// <summary> /// ASP.NET MVC attribute. Indicates that a parameter is an MVC editor template. /// Use this attribute for custom wrappers similar to /// <c>System.Web.Mvc.Html.EditorExtensions.EditorForModel(HtmlHelper, String)</c>. /// </summary> [AttributeUsage(AttributeTargets.Parameter)] public sealed class AspMvcEditorTemplateAttribute : Attribute { } /// <summary> /// ASP.NET MVC attribute. Indicates that a parameter is an MVC template. /// Use this attribute for custom wrappers similar to /// <c>System.ComponentModel.DataAnnotations.UIHintAttribute(System.String)</c>. /// </summary> [AttributeUsage(AttributeTargets.Parameter)] public sealed class AspMvcTemplateAttribute : Attribute { } /// <summary> /// ASP.NET MVC attribute. If applied to a parameter, indicates that the parameter /// is an MVC view component. If applied to a method, the MVC view name is calculated implicitly /// from the context. Use this attribute for custom wrappers similar to /// <c>System.Web.Mvc.Controller.View(Object)</c>. /// </summary> [AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Method)] public sealed class AspMvcViewAttribute : Attribute { } /// <summary> /// ASP.NET MVC attribute. If applied to a parameter, indicates that the parameter /// is an MVC view component name. /// </summary> [AttributeUsage(AttributeTargets.Parameter)] public sealed class AspMvcViewComponentAttribute : Attribute { } /// <summary> /// ASP.NET MVC attribute. If applied to a parameter, indicates that the parameter /// is an MVC view component view. If applied to a method, the MVC view component view name is default. /// </summary> [AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Method)] public sealed class AspMvcViewComponentViewAttribute : Attribute { } /// <summary> /// ASP.NET MVC attribute. When applied to a parameter of an attribute, /// indicates that this parameter is an MVC action name. /// </summary> /// <example><code> /// [ActionName("Foo")] /// public ActionResult Login(string returnUrl) { /// ViewBag.ReturnUrl = Url.Action("Foo"); // OK /// return RedirectToAction("Bar"); // Error: Cannot resolve action /// } /// </code></example> [AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Property)] public sealed class AspMvcActionSelectorAttribute : Attribute { } [AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Property | AttributeTargets.Field)] public sealed class HtmlElementAttributesAttribute : Attribute { public HtmlElementAttributesAttribute() { } public HtmlElementAttributesAttribute([NotNull] string name) { Name = name; } [CanBeNull] public string Name { get; private set; } } [AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Field | AttributeTargets.Property)] public sealed class HtmlAttributeValueAttribute : Attribute { public HtmlAttributeValueAttribute([NotNull] string name) { Name = name; } [NotNull] public string Name { get; private set; } } /// <summary> /// Razor attribute. Indicates that a parameter or a method is a Razor section. /// Use this attribute for custom wrappers similar to /// <c>System.Web.WebPages.WebPageBase.RenderSection(String)</c>. /// </summary> [AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Method)] public sealed class RazorSectionAttribute : Attribute { } /// <summary> /// Indicates how method, constructor invocation or property access /// over collection type affects content of the collection. /// </summary> [AttributeUsage(AttributeTargets.Method | AttributeTargets.Constructor | AttributeTargets.Property)] public sealed class CollectionAccessAttribute : Attribute { public CollectionAccessAttribute(CollectionAccessType collectionAccessType) { CollectionAccessType = collectionAccessType; } public CollectionAccessType CollectionAccessType { get; private set; } } [Flags] public enum CollectionAccessType { /// <summary>Method does not use or modify content of the collection.</summary> None = 0, /// <summary>Method only reads content of the collection but does not modify it.</summary> Read = 1, /// <summary>Method can change content of the collection but does not add new elements.</summary> ModifyExistingContent = 2, /// <summary>Method can add new elements to the collection.</summary> UpdatedContent = ModifyExistingContent | 4 } /// <summary> /// Indicates that the marked method is assertion method, i.e. it halts control flow if /// one of the conditions is satisfied. To set the condition, mark one of the parameters with /// <see cref="AssertionConditionAttribute"/> attribute. /// </summary> [AttributeUsage(AttributeTargets.Method)] public sealed class AssertionMethodAttribute : Attribute { } /// <summary> /// Indicates the condition parameter of the assertion method. The method itself should be /// marked by <see cref="AssertionMethodAttribute"/> attribute. The mandatory argument of /// the attribute is the assertion type. /// </summary> [AttributeUsage(AttributeTargets.Parameter)] public sealed class AssertionConditionAttribute : Attribute { public AssertionConditionAttribute(AssertionConditionType conditionType) { ConditionType = conditionType; } public AssertionConditionType ConditionType { get; private set; } } /// <summary> /// Specifies assertion type. If the assertion method argument satisfies the condition, /// then the execution continues. Otherwise, execution is assumed to be halted. /// </summary> public enum AssertionConditionType { /// <summary>Marked parameter should be evaluated to true.</summary> IS_TRUE = 0, /// <summary>Marked parameter should be evaluated to false.</summary> IS_FALSE = 1, /// <summary>Marked parameter should be evaluated to null value.</summary> IS_NULL = 2, /// <summary>Marked parameter should be evaluated to not null value.</summary> IS_NOT_NULL = 3, } /// <summary> /// Indicates that the marked method unconditionally terminates control flow execution. /// For example, it could unconditionally throw exception. /// </summary> [Obsolete("Use [ContractAnnotation('=> halt')] instead")] [AttributeUsage(AttributeTargets.Method)] public sealed class TerminatesProgramAttribute : Attribute { } /// <summary> /// Indicates that method is pure LINQ method, with postponed enumeration (like Enumerable.Select, /// .Where). This annotation allows inference of [InstantHandle] annotation for parameters /// of delegate type by analyzing LINQ method chains. /// </summary> [AttributeUsage(AttributeTargets.Method)] public sealed class LinqTunnelAttribute : Attribute { } /// <summary> /// Indicates that IEnumerable, passed as parameter, is not enumerated. /// </summary> [AttributeUsage(AttributeTargets.Parameter)] public sealed class NoEnumerationAttribute : Attribute { } /// <summary> /// Indicates that parameter is regular expression pattern. /// </summary> [AttributeUsage(AttributeTargets.Parameter)] public sealed class RegexPatternAttribute : Attribute { } /// <summary> /// XAML attribute. Indicates the type that has <c>ItemsSource</c> property and should be treated /// as <c>ItemsControl</c>-derived type, to enable inner items <c>DataContext</c> type resolve. /// </summary> [AttributeUsage(AttributeTargets.Class)] public sealed class XamlItemsControlAttribute : Attribute { } /// <summary> /// XAML attribute. Indicates the property of some <c>BindingBase</c>-derived type, that /// is used to bind some item of <c>ItemsControl</c>-derived type. This annotation will /// enable the <c>DataContext</c> type resolve for XAML bindings for such properties. /// </summary> /// <remarks> /// Property should have the tree ancestor of the <c>ItemsControl</c> type or /// marked with the <see cref="XamlItemsControlAttribute"/> attribute. /// </remarks> [AttributeUsage(AttributeTargets.Property)] public sealed class XamlItemBindingOfItemsControlAttribute : Attribute { } [AttributeUsage(AttributeTargets.Class, AllowMultiple = true)] public sealed class AspChildControlTypeAttribute : Attribute { public AspChildControlTypeAttribute([NotNull] string tagName, [NotNull] Type controlType) { TagName = tagName; ControlType = controlType; } [NotNull] public string TagName { get; private set; } [NotNull] public Type ControlType { get; private set; } } [AttributeUsage(AttributeTargets.Property | AttributeTargets.Method)] public sealed class AspDataFieldAttribute : Attribute { } [AttributeUsage(AttributeTargets.Property | AttributeTargets.Method)] public sealed class AspDataFieldsAttribute : Attribute { } [AttributeUsage(AttributeTargets.Property)] public sealed class AspMethodPropertyAttribute : Attribute { } [AttributeUsage(AttributeTargets.Class, AllowMultiple = true)] public sealed class AspRequiredAttributeAttribute : Attribute { public AspRequiredAttributeAttribute([NotNull] string attribute) { Attribute = attribute; } [NotNull] public string Attribute { get; private set; } } [AttributeUsage(AttributeTargets.Property)] public sealed class AspTypePropertyAttribute : Attribute { public bool CreateConstructorReferences { get; private set; } public AspTypePropertyAttribute(bool createConstructorReferences) { CreateConstructorReferences = createConstructorReferences; } } [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] public sealed class RazorImportNamespaceAttribute : Attribute { public RazorImportNamespaceAttribute([NotNull] string name) { Name = name; } [NotNull] public string Name { get; private set; } } [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] public sealed class RazorInjectionAttribute : Attribute { public RazorInjectionAttribute([NotNull] string type, [NotNull] string fieldName) { Type = type; FieldName = fieldName; } [NotNull] public string Type { get; private set; } [NotNull] public string FieldName { get; private set; } } [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] public sealed class RazorDirectiveAttribute : Attribute { public RazorDirectiveAttribute([NotNull] string directive) { Directive = directive; } [NotNull] public string Directive { get; private set; } } [AttributeUsage(AttributeTargets.Method)] public sealed class RazorHelperCommonAttribute : Attribute { } [AttributeUsage(AttributeTargets.Property)] public sealed class RazorLayoutAttribute : Attribute { } [AttributeUsage(AttributeTargets.Method)] public sealed class RazorWriteLiteralMethodAttribute : Attribute { } [AttributeUsage(AttributeTargets.Method)] public sealed class RazorWriteMethodAttribute : Attribute { } [AttributeUsage(AttributeTargets.Parameter)] public sealed class RazorWriteMethodParameterAttribute : Attribute { } /// <summary> /// Prevents the Member Reordering feature from tossing members of the marked class. /// </summary> /// <remarks> /// The attribute must be mentioned in your member reordering patterns /// </remarks> [AttributeUsage(AttributeTargets.All)] public sealed class NoReorder : Attribute { } }
39.396535
119
0.708035
[ "MIT" ]
LanceMcCarthy/UwpProjects
UwpHelpers/UwpHelpers.Examples/Properties/Annotations.cs
40,935
C#
using Microsoft.EntityFrameworkCore; using SMS.Web.Model; using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; namespace SMS.Web.Db { public class SMSContext : DbContext { public SMSContext(DbContextOptions<SMSContext> options) : base(options) { } public DbSet<Student> Users { get; set; } public DbSet<Teacher> Posts { get; set; } } }
20.363636
63
0.65625
[ "MIT" ]
mahedee/code-sample
SwaggerInMemory/SMS.Web/SMS.Web/Db/SMSContext.cs
450
C#
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt) // This code is distributed under the GNU LGPL (for details please see \doc\license.txt) using System; using System.Diagnostics; using System.Windows; using System.Windows.Controls; namespace ICSharpCode.Core.Presentation { /// <summary> /// Cancels the desired size of the child elements. Use this control around scrolling containers (e.g. ListBox) used /// inside auto-scroll contexts. /// </summary> public class RestrictDesiredSize : Decorator { Size lastArrangeSize = new Size(double.NaN, double.NaN); protected override Size MeasureOverride(Size constraint) { return new Size(0, 0); } protected override Size ArrangeOverride(Size arrangeSize) { if (lastArrangeSize != arrangeSize) { lastArrangeSize = arrangeSize; base.MeasureOverride(arrangeSize); } return base.ArrangeOverride(arrangeSize); } } }
28.176471
117
0.741127
[ "MIT" ]
Plankankul/SharpDevelop-w-Framework
src/Main/ICSharpCode.Core.Presentation/RestrictDesiredSize.cs
960
C#
// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. using System.Collections.Generic; namespace Azure.AI.FormRecognizer.Models { /// <summary> /// Represents a page recognized from the input document. Contains lines, words, tables and page metadata. /// </summary> public class FormPage { internal FormPage(PageResult_internal pageResult, IReadOnlyList<ReadResult_internal> readResults, int pageIndex) { ReadResult_internal readResult = readResults[pageIndex]; PageNumber = readResult.Page; // Workaround because the service can sometimes return angles between 180 and 360 (bug). // Currently tracked by: https://github.com/Azure/azure-sdk-for-net/issues/12319 TextAngle = readResult.Angle <= 180.0f ? readResult.Angle : readResult.Angle - 360.0f; Width = readResult.Width; Height = readResult.Height; Unit = readResult.Unit; Lines = readResult.Lines != null ? ConvertLines(readResult.Lines, readResult.Page) : new List<FormLine>(); Tables = pageResult?.Tables != null ? ConvertTables(pageResult, readResults, pageIndex) : new List<FormTable>(); } /// <summary> /// The 1-based page number in the input document. /// </summary> public int PageNumber { get; } /// <summary> /// The general orientation of the text in clockwise direction, measured in degrees between (-180, 180]. /// </summary> public float TextAngle { get; } /// <summary> /// The width of the image/PDF in pixels/inches, respectively. /// </summary> public float Width { get; } /// <summary> /// The height of the image/PDF in pixels/inches, respectively. /// </summary> public float Height { get; } /// <summary> /// The unit used by the width, height and <see cref="BoundingBox"/> properties. For images, the unit is /// &quot;pixel&quot;. For PDF, the unit is &quot;inch&quot;. /// </summary> public LengthUnit Unit { get; } /// <summary> /// When <see cref="RecognizeOptions.IncludeFieldElements"/> is set to <c>true</c>, a list of recognized lines of text. /// An empty list otherwise. For calls to recognize content, this list is always populated. The maximum number of /// lines returned is 300 per page. The lines are sorted top to bottom, left to right, although in certain cases /// proximity is treated with higher priority. As the sorting order depends on the detected text, it may change across /// images and OCR version updates. Thus, business logic should be built upon the actual line location instead of order. /// </summary> public IReadOnlyList<FormLine> Lines { get; } /// <summary> /// A list of extracted tables contained in a page. /// </summary> public IReadOnlyList<FormTable> Tables { get; } private static IReadOnlyList<FormLine> ConvertLines(IReadOnlyList<TextLine_internal> textLines, int pageNumber) { List<FormLine> rawLines = new List<FormLine>(); foreach (TextLine_internal textLine in textLines) { rawLines.Add(new FormLine(textLine, pageNumber)); } return rawLines; } private static IReadOnlyList<FormTable> ConvertTables(PageResult_internal pageResult, IReadOnlyList<ReadResult_internal> readResults, int pageIndex) { List<FormTable> tables = new List<FormTable>(); foreach (var table in pageResult.Tables) { tables.Add(new FormTable(table, readResults, pageIndex)); } return tables; } } }
39.929293
156
0.615229
[ "MIT" ]
aditink/azure-sdk-for-net
sdk/formrecognizer/Azure.AI.FormRecognizer/src/FormPage.cs
3,955
C#
using AspNetCoreHero.Boilerplate.Application.Interfaces.CacheRepositories; using AspNetCoreHero.Results; using AutoMapper; using MediatR; using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; namespace AspNetCoreHero.Boilerplate.Application.Features.Brands.Queries.GetAllCached { public class GetAllBrandsCachedQuery : IRequest<Result<List<GetAllBrandsCachedResponse>>> { public GetAllBrandsCachedQuery() { } } public class GetAllBrandsCachedQueryHandler : IRequestHandler<GetAllBrandsCachedQuery, Result<List<GetAllBrandsCachedResponse>>> { private readonly IBrandCacheRepository _brandCache; private readonly IMapper _mapper; public GetAllBrandsCachedQueryHandler(IBrandCacheRepository brandCache, IMapper mapper) { _brandCache = brandCache; _mapper = mapper; } public async Task<Result<List<GetAllBrandsCachedResponse>>> Handle(GetAllBrandsCachedQuery request, CancellationToken cancellationToken) { var brandList = await _brandCache.GetCachedListAsync(); var mappedBrands = _mapper.Map<List<GetAllBrandsCachedResponse>>(brandList); return Result<List<GetAllBrandsCachedResponse>>.Success(mappedBrands); } } }
36.75
144
0.738473
[ "MIT" ]
jackyykk/Boilerplate
AspNetCoreHero.Boilerplate.Application/Features/Brands/Queries/GetAllCached/GetAllBrandsCachedQuery.cs
1,325
C#
namespace Ap.CorrAnalysis.Common { public static class Extensions { public static void AddReferenceIfAllocatable<T>(this T obj) { var allocatable = obj as IAllocatable; if (allocatable != null) allocatable.AddReference(); } public static void ReleaseIfAllocatable<T>(this T obj) { var allocatable = obj as IAllocatable; if (allocatable != null) allocatable.Release(); } } }
28.411765
67
0.596273
[ "MIT" ]
ap3rus/CorrAnalysis
Source/Ap.CorrAnalysis.Common/Extensions.cs
485
C#
using Quartz; namespace HCore.Scheduling.Providers { public interface ISchedulingProvider { void StartJob(IJob job, ITrigger jobTrigger); } }
16.4
53
0.70122
[ "MIT" ]
rh78/HCore
HCore-Scheduling/Providers/ISchedulingProvider.cs
166
C#
using System; using IntegratedAuthoringTool.DTOs; using WellFormedNames; namespace IntegratedAuthoringTool { /// <summary> /// Represents a dialogue action /// </summary> public class DialogStateAction { public Guid Id { get; private set; } public Name CurrentState { get; private set; } public Name NextState { get; private set; } public Name Meaning { get; private set; } public Name Style { get; private set; } public string Utterance { get; set; } public string UtteranceId { get; set;} /// <summary> /// Creates a new instance of a dialogue action from the corresponding DTO /// </summary> public DialogStateAction(DialogueStateActionDTO dto) { this.Id = dto.Id == Guid.Empty?Guid.NewGuid() : dto.Id; this.CurrentState = Name.BuildName(dto.CurrentState); this.Meaning = Name.BuildName(dto.Meaning); this.Style = Name.BuildName(dto.Style); this.NextState = Name.BuildName(dto.NextState); this.Utterance = dto.Utterance; this.UtteranceId = dto.UtteranceId; } public Name BuildSpeakAction() { var speakAction = string.Format(IATConsts.DIALOG_ACTION_KEY + "({0},{1},{2},{3})", CurrentState, NextState,Meaning,Style); return (Name)speakAction; } /// <summary> /// Creates a DTO from the dialogue action /// </summary> public DialogueStateActionDTO ToDTO() { return new DialogueStateActionDTO { Id = this.Id, CurrentState = this.CurrentState.ToString(), NextState = this.NextState.ToString(), Meaning = this.Meaning.ToString(), Style = this.Style.ToString(), Utterance = this.Utterance, UtteranceId = this.UtteranceId }; } } }
32.803279
94
0.570215
[ "Apache-2.0" ]
GAIPS-INESC-ID/FAtiMA-Toolk
Assets/IntegratedAuthoringTool/DialogStateAction.cs
2,003
C#
using Xamarin.Forms; namespace WildernessLabs.Clima.Client.Views { public partial class MainPage : ContentPage { public MainPage() { InitializeComponent(); } void BtnHackKitClicked(object sender, System.EventArgs e) { Navigation.PushAsync(new HackKitPage()); } void BtnProKitClicked(object sender, System.EventArgs e) { Navigation.PushAsync(new ProKitPage()); } } }
22.227273
65
0.588957
[ "Apache-2.0" ]
WildernessLabs/Clima
Source/Clima/WildernessLabs.Clima.Client/WildernessLabs.Clima.Client/Views/MainPage.xaml.cs
491
C#
using System.Collections.Generic; using Microsoft.EntityFrameworkCore; using SharedTrip.Data; using SharedTrip.Services; using SUS.HTTP; using SUS.MvcFramework; namespace SharedTrip { public class Startup : IMvcApplication { public void Configure(List<Route> routeTable) { new ApplicationDbContext().Database.Migrate(); } public void ConfigureServices(IServiceCollection serviceCollection) { serviceCollection.Add<IUsersService, UsersService>(); serviceCollection.Add<ITripsService, TripsService>(); } } }
22.518519
75
0.684211
[ "MIT" ]
Iceto04/SoftUni
C# Web Basics/SUS/SUS/Apps/SharedTrip/Startup.cs
610
C#
using System.ComponentModel.DataAnnotations; using B2B.Core.Models.DomainModels.Companies; using B2B.Core.Models.Dtos.Person; namespace B2B.Core.Models.Dtos.Company { public class CreateCompanyDto { [Required] [MinLength(2)] public string ShortName { get; set; } [Required] [MinLength(2)] public string FullName { get; set; } [Required] public CreatePersonDto Owner { get; set; } public CreateAddresDto Address { get; set; } [Range((int)CompanyCategory.IndustrialChemistry, (int)CompanyCategory.ConstructionAndRepair)] public CompanyCategory Category { get; set; } public string Description { get; set; } } }
25.857143
101
0.656077
[ "Apache-2.0" ]
olehspidey/B2B
b2b/src/B2B.Core/Models/Dtos/Company/CreateCompanyDto.cs
726
C#
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; using MySql.Data.MySqlClient; namespace Quiz_Creator { public class Course { private string courseName; private string instructorName; private string password; private Boolean hasPassword; List<Quiz> quizList; public Course() { courseName = null; instructorName = null; password = null; hasPassword = false; quizList = new List<Quiz>(); } public Course(string in_name, string in_instructor) { courseName = in_name; instructorName = in_instructor; } public Course(string in_name, string in_instructor, string in_password, List<Quiz> in_quizzes) { courseName = in_name; instructorName = in_instructor; password = in_password; quizList = in_quizzes; hasPassword = true; } public Boolean IsProtected() { return hasPassword; } public List<Quiz> GetQuizzes() { return quizList; } public string GetName() { return courseName; } public string GetPassword() { return password; } public void SetName(string in_name) { courseName = in_name; } public void SetInstructorName(string in_instructorName) { instructorName = in_instructorName; } public string GetInstructorName() { return instructorName; } public void SetPassword(string in_pass) { password = in_pass; hasPassword = true; } } }
19.55102
102
0.542276
[ "Apache-2.0" ]
bkm98/Quiz-Creator
Quiz-Creator/Course.cs
1,918
C#
using UnityEngine; using System.Collections; using TestingMe; using UnityEngine.UI; public class GrabData : MonoBehaviour { // initializing some variables string url = "http://www.felix.gullamolar.com/latest"; private DataStruct[] curArray; WWW www; Vector3[] vertices; Color[] colors; public Text textA; public Text textB; public Text textC; public Text textD; public Text textE; public Text textF; public GameObject VesselA; public GameObject VesselB; public GameObject VesselC; public GameObject VesselD; public GameObject VesselE; public GameObject VesselF; Mesh meshA; Mesh meshB; Mesh meshC; Mesh meshD; Mesh meshE; Mesh meshF; public void setUpdateRange(bool five) { if (five) { url = "http://www.felix.gullamolar.com/latest"; } else { url = "http://www.felix.gullamolar.com/latestRow"; } } void Start() { // initial assign of the Gameobject meshes meshA = VesselA.GetComponent<MeshFilter> ().mesh; meshB = VesselB.GetComponent<MeshFilter> ().mesh; meshC = VesselC.GetComponent<MeshFilter> ().mesh; meshD = VesselD.GetComponent<MeshFilter> ().mesh; meshE = VesselE.GetComponent<MeshFilter> ().mesh; meshF = VesselF.GetComponent<MeshFilter> ().mesh; // Start a Coroutine which fetches the 5 last database rows and visualizes them StartCoroutine ("getLatestFive"); } // Fetches the 5 last database rows and visualizes them in 1s steps (infinite loop) IEnumerator getLatestFive() { while (true) { www = new WWW(url); while (!www.isDone) { } curArray = JsonHelper.getJsonArray<DataStruct> (www.text); Debug.Log (curArray.Length); for (int i = curArray.Length-1; i >= 0; i--) { // update Vessel vertices updateVesselColor (curArray [i].Unit1.Temp, curArray [i].Unit1.Level, meshA, 14.5f, 1.0f); updateVesselColor (curArray [i].Unit2.Temp, curArray [i].Unit2.Level, meshB, 7.5f, 1.0f); updateVesselColor (curArray [i].Unit3.Temp, curArray [i].Unit3.Level, meshC, 12.0f, 1.2f); updateVesselColor (curArray [i].Unit4.Temp, curArray [i].Unit4.Level, meshD, 14.5f, 1.0f); updateVesselColor (curArray [i].Unit5.Temp, curArray [i].Unit5.Level, meshE, 7.5f, 1.0f); updateVesselColor (curArray [i].Unit6.Temp, curArray [i].Unit6.Level, meshF, 12.0f, 1.2f); // update GUI text textA.text = curArray [i].Unit1.buttonString (); textB.text = curArray [i].Unit2.buttonString (); textC.text = curArray [i].Unit3.buttonString (); textD.text = curArray [i].Unit4.buttonString (); textE.text = curArray [i].Unit5.buttonString (); textF.text = curArray [i].Unit6.buttonString (); yield return new WaitForSeconds(1); } } } // changes the color of all vertices of the model curMesh with respect to temperature and fill level // the limit is for manually setting the highest Y coordinate of the mesh model void updateVesselColor(int temp, int level, Mesh curMesh, float limit, float low) { vertices = curMesh.vertices; colors = new Color[vertices.Length]; // Color Mapping from temperature (0-100) to RGB values float ratio = temp / 50.0f; float b = Mathf.Max(0, 255 * (1 - ratio)); float r = Mathf.Max(0, 255 * (ratio - 1)); float g = (255 - b - r); Color fillColor = new Color(r / 255.0f,g / 255.0f,b / 255.0f,1); // assigns the color to all vertices that are below the measured fill level int i = 0; while (i < vertices.Length) { if ((vertices [i].y >= low) && (vertices [i].y <= ((limit-low) * level * 0.01f + low))) { // colors[i] = fillColor; } else { colors[i] = Color.gray; } i++; } curMesh.colors = colors; } // Update is called once per frame void Update () { } }
31.127119
101
0.682548
[ "Apache-2.0" ]
fix92/BrewerySimUnity3D
code/GrabData.cs
3,675
C#
namespace In.ProjectEKA.HipService.Link { using HipLibrary.Patient.Model; public class OtpMessage { public OtpMessage(ResponseType responseType, string message) { ResponseType = responseType; Message = message; } // ReSharper disable once MemberCanBePrivate.Global // ReSharper disable once UnusedAutoPropertyAccessor.Global public ResponseType ResponseType { get; } public string Message { get; } public Error toError() { return ResponseType switch { ResponseType.OtpInvalid => new Error(ErrorCode.OtpInValid, Message), ResponseType.OtpExpired => new Error(ErrorCode.OtpExpired, Message), _ => new Error(ErrorCode.ServerInternalError, Message) }; } } }
29.827586
84
0.604624
[ "MIT" ]
Bahmni-Covid19/hip-service
src/In.ProjectEKA.HipService/Link/OtpMessage.cs
865
C#
using System.Collections.Generic; using System.Xml.Serialization; namespace Nez.TiledMaps { [XmlRoot(ElementName = "map")] public class TmxMap { public TmxMap() { Properties = new List<TmxProperty>(); Tilesets = new List<TmxTileset>(); Layers = new List<TmxLayer>(); ObjectGroups = new List<TmxObjectGroup>(); } [XmlAttribute(AttributeName = "version")] public string Version; [XmlAttribute(AttributeName = "orientation")] public TmxOrientation Orientation; [XmlAttribute(AttributeName = "renderorder")] public TmxRenderOrder RenderOrder; [XmlAttribute(AttributeName = "backgroundcolor")] public string BackgroundColor; [XmlAttribute(AttributeName = "firstgid")] public int FirstGid; [XmlAttribute(AttributeName = "width")] public int Width; [XmlAttribute(AttributeName = "height")] public int Height; [XmlAttribute(AttributeName = "tilewidth")] public int TileWidth; [XmlAttribute(AttributeName = "tileheight")] public int TileHeight; [XmlAttribute("nextobjectid")] public int NextObjectId; [XmlElement(ElementName = "tileset")] public List<TmxTileset> Tilesets; [XmlElement(ElementName = "objectgroup")] public List<TmxObjectGroup> ObjectGroups; [XmlElement(ElementName = "layer", Type = typeof(TmxTileLayer))] [XmlElement(ElementName = "imagelayer", Type = typeof(TmxImageLayer))] public List<TmxLayer> Layers; [XmlArray("properties")] [XmlArrayItem("property")] public List<TmxProperty> Properties; } }
25.389831
73
0.731642
[ "Apache-2.0", "MIT" ]
sherjilozair/Nez
Nez.PipelineImporter/Tiled/TmxMap.cs
1,498
C#
using System; using Microsoft.Data.SqlClient; namespace Nysa.Data.SqlClient { public class SqlConnect { public String Source { get; init; } public (String Login, String Password)? Credentials { get; init; } public String? ApplicationName { get; init; } public ApplicationIntent? Intent { get; init; } public String? InitialCatalog { get; init; } private SqlConnect(String source, (String login, String password)? credentials = null, String? applicationName = null, ApplicationIntent? intent = null, String? initialCatalog = null) { this.Source = source; this.Credentials = credentials; this.ApplicationName = applicationName; this.Intent = intent; this.InitialCatalog = initialCatalog; } public SqlConnect(String source) : this(source, null, null, null, null) { } public SqlConnect WithCredentials(String login, String password) => new SqlConnect(this.Source, (login, password), this.ApplicationName, this.Intent, this.InitialCatalog); public SqlConnect WithApplicationName(String applicationName) => new SqlConnect(this.Source, this.Credentials, applicationName, this.Intent, this.InitialCatalog); public SqlConnect WithIntent(ApplicationIntent intent) => new SqlConnect(this.Source, this.Credentials, this.ApplicationName, intent, this.InitialCatalog); public SqlConnect WithInitialCatalog(String databaseName) => new SqlConnect(this.Source, this.Credentials, this.ApplicationName, this.Intent, databaseName); } }
39.883721
191
0.654227
[ "MIT" ]
slowsigma/Nysa
Nysa.Data.SqlClient/SqlConnect.cs
1,715
C#
// *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. *** // *** Do not edit by hand unless you're certain you know what you are doing! *** using System; using System.Collections.Generic; using System.Collections.Immutable; using System.Threading.Tasks; using Pulumi.Serialization; namespace Pulumi.Azure.Storage.Inputs { public sealed class AccountNetworkRulesGetArgs : Pulumi.ResourceArgs { [Input("bypasses")] private InputList<string>? _bypasses; /// <summary> /// Specifies whether traffic is bypassed for Logging/Metrics/AzureServices. Valid options are /// any combination of `Logging`, `Metrics`, `AzureServices`, or `None`. /// </summary> public InputList<string> Bypasses { get => _bypasses ?? (_bypasses = new InputList<string>()); set => _bypasses = value; } /// <summary> /// Specifies the default action of allow or deny when no other rules match. Valid options are `Deny` or `Allow`. /// </summary> [Input("defaultAction", required: true)] public Input<string> DefaultAction { get; set; } = null!; [Input("ipRules")] private InputList<string>? _ipRules; /// <summary> /// List of public IP or IP ranges in CIDR Format. Only IPV4 addresses are allowed. Private IP address ranges (as defined in [RFC 1918](https://tools.ietf.org/html/rfc1918#section-3)) are not allowed. /// </summary> public InputList<string> IpRules { get => _ipRules ?? (_ipRules = new InputList<string>()); set => _ipRules = value; } [Input("virtualNetworkSubnetIds")] private InputList<string>? _virtualNetworkSubnetIds; /// <summary> /// A list of resource ids for subnets. /// </summary> public InputList<string> VirtualNetworkSubnetIds { get => _virtualNetworkSubnetIds ?? (_virtualNetworkSubnetIds = new InputList<string>()); set => _virtualNetworkSubnetIds = value; } public AccountNetworkRulesGetArgs() { } } }
34.777778
208
0.61707
[ "ECL-2.0", "Apache-2.0" ]
AdminTurnedDevOps/pulumi-azure
sdk/dotnet/Storage/Inputs/AccountNetworkRulesGetArgs.cs
2,191
C#
using System; using System.Collections.Generic; namespace Arma3BE.Client.Modules.CoreModule { public class StringTemplater { private readonly IDictionary<string, Func<string>> _params; public StringTemplater() { _params = new Dictionary<string, Func<string>>(); } public string Template(string someText) { var result = someText; foreach (var p in _params) { result = result.Replace($"{{{p.Key}}}", p.Value()); } return result; } public void AddParameter(string param, string value) { _params.Add(param, () => value); } public void AddParameter(string param, Func<string> value) { _params.Add(param, value); } } }
22.918919
67
0.536557
[ "Apache-2.0" ]
tym32167/arma3beclient
src/Arma3BE.Client.Modules.CoreModule/StringTemplater.cs
850
C#
#region S# License /****************************************************************************************** NOTICE!!! This program and source code is owned and licensed by StockSharp, LLC, www.stocksharp.com Viewing or use of this code requires your acceptance of the license agreement found at https://github.com/StockSharp/StockSharp/blob/master/LICENSE Removal of this comment is a violation of the license agreement. Project: StockSharp.Algo.Algo File: Connector_Raise.cs Created: 2015, 11, 11, 2:32 PM Copyright 2010 by StockSharp, LLC *******************************************************************************************/ #endregion S# License namespace StockSharp.Algo { using System; using System.Collections.Generic; using Ecng.Common; using StockSharp.Algo.Candles; using StockSharp.BusinessEntities; using StockSharp.Logging; using StockSharp.Messages; using StockSharp.Localization; partial class Connector { /// <inheritdoc /> public event Action<MyTrade> NewMyTrade; /// <inheritdoc /> public event Action<IEnumerable<MyTrade>> NewMyTrades; /// <inheritdoc /> public event Action<Trade> NewTrade; /// <inheritdoc /> public event Action<IEnumerable<Trade>> NewTrades; /// <inheritdoc /> public event Action<Order> NewOrder; /// <inheritdoc /> public event Action<IEnumerable<Order>> NewOrders; /// <inheritdoc /> public event Action<Order> OrderChanged; /// <inheritdoc /> public event Action<IEnumerable<Order>> NewStopOrders; /// <inheritdoc /> public event Action<IEnumerable<Order>> OrdersChanged; /// <inheritdoc /> public event Action<OrderFail> OrderRegisterFailed; /// <inheritdoc /> public event Action<OrderFail> OrderCancelFailed; /// <inheritdoc /> public event Action<IEnumerable<Order>> StopOrdersChanged; /// <inheritdoc /> public event Action<long, Exception, DateTimeOffset> OrderStatusFailed2; /// <inheritdoc /> public event Action<OrderFail> StopOrderRegisterFailed; /// <inheritdoc /> public event Action<OrderFail> StopOrderCancelFailed; /// <inheritdoc /> public event Action<Order> NewStopOrder; /// <inheritdoc /> public event Action<Order> StopOrderChanged; /// <inheritdoc /> public event Action<Security> NewSecurity; /// <inheritdoc /> public event Action<IEnumerable<OrderFail>> OrdersRegisterFailed; /// <inheritdoc /> public event Action<IEnumerable<OrderFail>> OrdersCancelFailed; /// <inheritdoc /> public event Action<long> MassOrderCanceled; /// <inheritdoc /> public event Action<long, DateTimeOffset> MassOrderCanceled2; /// <inheritdoc /> public event Action<long, Exception> MassOrderCancelFailed; /// <inheritdoc /> public event Action<long, Exception, DateTimeOffset> MassOrderCancelFailed2; /// <inheritdoc /> public event Action<long, Exception> OrderStatusFailed; /// <inheritdoc /> public event Action<IEnumerable<OrderFail>> StopOrdersRegisterFailed; /// <inheritdoc /> public event Action<IEnumerable<OrderFail>> StopOrdersCancelFailed; /// <inheritdoc /> public event Action<IEnumerable<Security>> NewSecurities; /// <inheritdoc /> public event Action<Security> SecurityChanged; /// <inheritdoc /> public event Action<IEnumerable<Security>> SecuritiesChanged; /// <inheritdoc /> public event Action<Portfolio> NewPortfolio; /// <inheritdoc /> public event Action<IEnumerable<Portfolio>> NewPortfolios; /// <inheritdoc /> public event Action<Portfolio> PortfolioChanged; /// <inheritdoc /> public event Action<IEnumerable<Portfolio>> PortfoliosChanged; /// <inheritdoc /> public event Action<Position> NewPosition; /// <inheritdoc /> public event Action<IEnumerable<Position>> NewPositions; /// <inheritdoc /> public event Action<Position> PositionChanged; /// <inheritdoc /> public event Action<IEnumerable<Position>> PositionsChanged; /// <inheritdoc /> public event Action<MarketDepth> NewMarketDepth; /// <inheritdoc /> public event Action<MarketDepth> MarketDepthChanged; /// <inheritdoc /> public event Action<IEnumerable<MarketDepth>> NewMarketDepths; /// <inheritdoc /> public event Action<IEnumerable<MarketDepth>> MarketDepthsChanged; /// <inheritdoc /> public event Action<OrderLogItem> NewOrderLogItem; /// <inheritdoc /> public event Action<IEnumerable<OrderLogItem>> NewOrderLogItems; /// <inheritdoc /> public event Action<TimeSpan> MarketTimeChanged; /// <inheritdoc /> public event Action<News> NewNews; /// <inheritdoc /> public event Action<News> NewsChanged; /// <inheritdoc /> public event Action<Message> NewMessage; /// <inheritdoc /> public event Action Connected; /// <inheritdoc /> public event Action Disconnected; /// <inheritdoc /> public event Action<Exception> ConnectionError; /// <inheritdoc /> public event Action<IMessageAdapter> ConnectedEx; /// <inheritdoc /> public event Action<IMessageAdapter> DisconnectedEx; /// <inheritdoc /> public event Action<IMessageAdapter, Exception> ConnectionErrorEx; /// <inheritdoc cref="IConnector" /> public event Action<Exception> Error; /// <inheritdoc /> public event Action<SecurityLookupMessage, IEnumerable<Security>, Exception> LookupSecuritiesResult; /// <inheritdoc /> public event Action<PortfolioLookupMessage, IEnumerable<Portfolio>, Exception> LookupPortfoliosResult; /// <inheritdoc /> public event Action<BoardLookupMessage, IEnumerable<ExchangeBoard>, Exception> LookupBoardsResult; /// <inheritdoc /> public event Action<SecurityLookupMessage, IEnumerable<Security>, IEnumerable<Security>, Exception> LookupSecuritiesResult2; /// <inheritdoc /> public event Action<PortfolioLookupMessage, IEnumerable<Portfolio>, IEnumerable<Portfolio>, Exception> LookupPortfoliosResult2; /// <inheritdoc /> public event Action<BoardLookupMessage, IEnumerable<ExchangeBoard>, IEnumerable<ExchangeBoard>, Exception> LookupBoardsResult2; /// <inheritdoc /> public event Action<Security, MarketDataMessage> MarketDataSubscriptionSucceeded; /// <inheritdoc /> public event Action<Security, MarketDataMessage, Exception> MarketDataSubscriptionFailed; /// <inheritdoc /> public event Action<Security, MarketDataMessage, MarketDataMessage> MarketDataSubscriptionFailed2; /// <inheritdoc /> public event Action<Security, MarketDataMessage> MarketDataUnSubscriptionSucceeded; /// <inheritdoc /> public event Action<Security, MarketDataMessage, Exception> MarketDataUnSubscriptionFailed; /// <inheritdoc /> public event Action<Security, MarketDataMessage, MarketDataMessage> MarketDataUnSubscriptionFailed2; /// <inheritdoc /> public event Action<Security, MarketDataFinishedMessage> MarketDataSubscriptionFinished; /// <inheritdoc /> public event Action<Security, MarketDataMessage, Exception> MarketDataUnexpectedCancelled; /// <inheritdoc /> public event Action<ExchangeBoard, SessionStates> SessionStateChanged; /// <inheritdoc /> public event Action<Security, IEnumerable<KeyValuePair<Level1Fields, object>>, DateTimeOffset, DateTimeOffset> ValuesChanged; /// <inheritdoc /> public event Action<Subscription, Level1ChangeMessage> Level1Received; /// <inheritdoc /> public event Action<Subscription, Trade> TickTradeReceived; /// <inheritdoc /> public event Action<Subscription, Security> SecurityReceived; /// <inheritdoc /> public event Action<Subscription, ExchangeBoard> BoardReceived; /// <inheritdoc /> public event Action<Subscription, MarketDepth> MarketDepthReceived; /// <inheritdoc /> public event Action<Subscription, OrderLogItem> OrderLogItemReceived; /// <inheritdoc /> public event Action<Subscription, News> NewsReceived; /// <inheritdoc /> public event Action<Subscription, Candle> CandleReceived; /// <inheritdoc /> public event Action<Subscription, MyTrade> OwnTradeReceived; /// <inheritdoc /> public event Action<Subscription, Order> OrderReceived; /// <inheritdoc /> public event Action<Subscription, OrderFail> OrderRegisterFailReceived; /// <inheritdoc /> public event Action<Subscription, OrderFail> OrderCancelFailReceived; /// <inheritdoc /> public event Action<Subscription, Portfolio> PortfolioReceived; /// <inheritdoc /> public event Action<Subscription, Position> PositionReceived; /// <summary> /// Connection restored. /// </summary> public event Action Restored; /// <summary> /// Connection timed-out. /// </summary> public event Action TimeOut; /// <summary> /// A new value for processing occurrence event. /// </summary> public event Action<CandleSeries, Candle> CandleSeriesProcessing; /// <summary> /// The series processing end event. /// </summary> public event Action<CandleSeries> CandleSeriesStopped; /// <summary> /// The series error event. /// </summary> public event Action<CandleSeries, MarketDataMessage> CandleSeriesError; /// <inheritdoc /> public event Action<Order> OrderInitialized; /// <inheritdoc /> public event Action<long, Exception> ChangePasswordResult; private void RaiseOrderInitialized(Order order) { OrderInitialized?.Invoke(order); } private void RaiseNewMyTrade(MyTrade trade) { this.AddInfoLog("New own trade: {0}", trade); NewMyTrade?.Invoke(trade); NewMyTrades?.Invoke(new[] { trade }); } private void RaiseNewTrade(Trade trade) { NewTrade?.Invoke(trade); NewTrades?.Invoke(new[] { trade }); } private void RaiseNewOrder(Order order) { NewOrder?.Invoke(order); NewOrders?.Invoke(new[] { order }); } private void RaiseOrderChanged(Order order) { OrderChanged?.Invoke(order); OrdersChanged?.Invoke(new[] { order }); } /// <summary> /// To call the event <see cref="NewStopOrders"/>. /// </summary> /// <param name="stopOrder">Stop order that should be passed to the event.</param> private void RaiseNewStopOrder(Order stopOrder) { NewStopOrder?.Invoke(stopOrder); NewStopOrders?.Invoke(new[] { stopOrder }); } /// <summary> /// To call the event <see cref="StopOrdersChanged"/>. /// </summary> /// <param name="stopOrder">Stop orders that should be passed to the event.</param> private void RaiseStopOrderChanged(Order stopOrder) { StopOrderChanged?.Invoke(stopOrder); StopOrdersChanged?.Invoke(new[] { stopOrder }); } private void RaiseOrderRegisterFailed(OrderFail fail) { OrderRegisterFailed?.Invoke(fail); OrdersRegisterFailed?.Invoke(new[] { fail }); } private void RaiseOrderCancelFailed(OrderFail fail) { OrderCancelFailed?.Invoke(fail); OrdersCancelFailed?.Invoke(new[] { fail }); } /// <summary> /// To call the event <see cref="StopOrdersRegisterFailed"/>. /// </summary> /// <param name="fail">Error information that should be passed to the event.</param> private void RaiseStopOrdersRegisterFailed(OrderFail fail) { StopOrderRegisterFailed?.Invoke(fail); StopOrdersRegisterFailed?.Invoke(new[] { fail }); } /// <summary> /// To call the event <see cref="StopOrdersCancelFailed"/>. /// </summary> /// <param name="fail">Error information that should be passed to the event.</param> private void RaiseStopOrdersCancelFailed(OrderFail fail) { StopOrderCancelFailed?.Invoke(fail); StopOrdersCancelFailed?.Invoke(new[] { fail }); } private void RaiseMassOrderCanceled(long transactionId, DateTimeOffset time) { MassOrderCanceled?.Invoke(transactionId); MassOrderCanceled2?.Invoke(transactionId, time); } private void RaiseMassOrderCancelFailed(long transactionId, Exception error, DateTimeOffset time) { MassOrderCancelFailed?.Invoke(transactionId, error); MassOrderCancelFailed2?.Invoke(transactionId, error, time); } private void RaiseOrderStatusFailed(long transactionId, Exception error, DateTimeOffset time) { OrderStatusFailed?.Invoke(transactionId, error); OrderStatusFailed2?.Invoke(transactionId, error, time); } private void RaiseNewSecurity(Security security) { var arr = new[] { security }; _added?.Invoke(arr); NewSecurity?.Invoke(security); NewSecurities?.Invoke(arr); } private void RaiseSecuritiesChanged(Security[] securities) { SecuritiesChanged?.Invoke(securities); var evt = SecurityChanged; if (evt == null) return; foreach (var security in securities) evt(security); } private void RaiseSecurityChanged(Security security) { SecurityChanged?.Invoke(security); SecuritiesChanged?.Invoke(new[] { security }); } private void RaiseNewPortfolio(Portfolio portfolio) { NewPortfolio?.Invoke(portfolio); NewPortfolios?.Invoke(new[] { portfolio }); } private void RaisePortfolioChanged(Portfolio portfolio) { PortfolioChanged?.Invoke(portfolio); PortfoliosChanged?.Invoke(new[] { portfolio }); } private void RaiseNewPosition(Position position) { NewPosition?.Invoke(position); NewPositions?.Invoke(new[] { position }); } private void RaisePositionChanged(Position position) { PositionChanged?.Invoke(position); PositionsChanged?.Invoke(new[] { position }); } private void RaiseNewMarketDepth(MarketDepth marketDepth) { NewMarketDepth?.Invoke(marketDepth); NewMarketDepths?.Invoke(new[] { marketDepth }); } private void RaiseMarketDepthChanged(MarketDepth marketDepth) { MarketDepthChanged?.Invoke(marketDepth); MarketDepthsChanged?.Invoke(new[] { marketDepth }); } /// <summary> /// To call the event <see cref="NewNews"/>. /// </summary> /// <param name="news">News.</param> private void RaiseNewNews(News news) { NewNews?.Invoke(news); } /// <summary> /// To call the event <see cref="NewsChanged"/>. /// </summary> /// <param name="news">News.</param> private void RaiseNewsChanged(News news) { NewsChanged?.Invoke(news); } private void RaiseNewOrderLogItem(OrderLogItem item) { NewOrderLogItem?.Invoke(item); NewOrderLogItems?.Invoke(new[] { item }); } /// <summary> /// To call the event <see cref="Connected"/>. /// </summary> private void RaiseConnected() { ConnectionState = ConnectionStates.Connected; Connected?.Invoke(); } /// <summary> /// To call the event <see cref="ConnectedEx"/>. /// </summary> /// <param name="adapter">Adapter, initiated event.</param> private void RaiseConnectedEx(IMessageAdapter adapter) { ConnectedEx?.Invoke(adapter); } /// <summary> /// To call the event <see cref="Disconnected"/>. /// </summary> private void RaiseDisconnected() { ConnectionState = ConnectionStates.Disconnected; Disconnected?.Invoke(); } /// <summary> /// To call the event <see cref="DisconnectedEx"/>. /// </summary> /// <param name="adapter">Adapter, initiated event.</param> private void RaiseDisconnectedEx(IMessageAdapter adapter) { DisconnectedEx?.Invoke(adapter); } /// <summary> /// To call the event <see cref="ConnectionError"/>. /// </summary> /// <param name="exception">Error connection.</param> private void RaiseConnectionError(Exception exception) { if (exception == null) throw new ArgumentNullException(nameof(exception)); ConnectionState = ConnectionStates.Failed; ConnectionError?.Invoke(exception); this.AddErrorLog(exception); } /// <summary> /// To call the event <see cref="ConnectionErrorEx"/>. /// </summary> /// <param name="adapter">Adapter, initiated event.</param> /// <param name="exception">Error connection.</param> private void RaiseConnectionErrorEx(IMessageAdapter adapter, Exception exception) { if (exception == null) throw new ArgumentNullException(nameof(exception)); ConnectionErrorEx?.Invoke(adapter, exception); } /// <summary> /// To call the event <see cref="Connector.Error"/>. /// </summary> /// <param name="exception">Data processing error.</param> protected void RaiseError(Exception exception) { if (exception == null) throw new ArgumentNullException(nameof(exception)); ErrorCount++; this.AddErrorLog(exception); Error?.Invoke(exception); } /// <summary> /// To call the event <see cref="MarketTimeChanged"/>. /// </summary> /// <param name="diff">The difference in the time since the last call of the event. The first time the event passes the <see cref="TimeSpan.Zero"/> value.</param> private void RaiseMarketTimeChanged(TimeSpan diff) { MarketTimeChanged?.Invoke(diff); } /// <summary> /// To call the event <see cref="LookupSecuritiesResult"/>. /// </summary> /// <param name="message">Message.</param> /// <param name="error">An error of lookup operation. The value will be <see langword="null"/> if operation complete successfully.</param> /// <param name="securities">Found instruments.</param> /// <param name="newSecurities">Newly created.</param> private void RaiseLookupSecuritiesResult(SecurityLookupMessage message, Exception error, Security[] securities, Security[] newSecurities) { LookupSecuritiesResult?.Invoke(message, securities, error); LookupSecuritiesResult2?.Invoke(message, securities, newSecurities, error); } /// <summary> /// To call the event <see cref="LookupBoardsResult"/>. /// </summary> /// <param name="message">Message.</param> /// <param name="error">An error of lookup operation. The value will be <see langword="null"/> if operation complete successfully.</param> /// <param name="boards">Found boards.</param> /// <param name="newBoards">Newly created.</param> private void RaiseLookupBoardsResult(BoardLookupMessage message, Exception error, ExchangeBoard[] boards, ExchangeBoard[] newBoards) { LookupBoardsResult?.Invoke(message, boards, error); LookupBoardsResult2?.Invoke(message, boards, newBoards, error); } /// <summary> /// To call the event <see cref="LookupPortfoliosResult"/>. /// </summary> /// <param name="message">Message.</param> /// <param name="error">An error of lookup operation. The value will be <see langword="null"/> if operation complete successfully.</param> /// <param name="portfolios">Found portfolios.</param> /// <param name="newPortfolios">Newly created.</param> private void RaiseLookupPortfoliosResult(PortfolioLookupMessage message, Exception error, Portfolio[] portfolios, Portfolio[] newPortfolios) { LookupPortfoliosResult?.Invoke(message, portfolios, error); LookupPortfoliosResult2?.Invoke(message, portfolios, newPortfolios, error); } private void RaiseMarketDataSubscriptionSucceeded(Security security, MarketDataMessage message) { var msg = LocalizedStrings.SubscribedOk.Put(security?.Id, message.DataType + (message.DataType.IsCandleDataType() ? " " + message.Arg : string.Empty)); if (message.From != null && message.To != null) msg += LocalizedStrings.Str691Params.Put(message.From.Value, message.To.Value); this.AddDebugLog(msg + "."); MarketDataSubscriptionSucceeded?.Invoke(security, message); } private void RaiseMarketDataSubscriptionFailed(Security security, MarketDataMessage origin, MarketDataMessage reply) { var error = reply.Error ?? new NotSupportedException(LocalizedStrings.SubscriptionNotSupported.Put(origin)); if (reply.IsNotSupported) this.AddWarningLog(LocalizedStrings.SubscriptionNotSupported, origin); else this.AddErrorLog(LocalizedStrings.SubscribedError, security?.Id, origin.DataType, error.Message); MarketDataSubscriptionFailed?.Invoke(security, origin, error); MarketDataSubscriptionFailed2?.Invoke(security, origin, reply); } private void RaiseMarketDataUnSubscriptionSucceeded(Security security, MarketDataMessage message) { var msg = LocalizedStrings.UnSubscribedOk.Put(security?.Id, message.DataType + (message.DataType.IsCandleDataType() ? " " + message.Arg : string.Empty)); if (message.From != null && message.To != null) msg += LocalizedStrings.Str691Params.Put(message.From.Value, message.To.Value); this.AddDebugLog(msg + "."); MarketDataUnSubscriptionSucceeded?.Invoke(security, message); } private void RaiseMarketDataUnSubscriptionFailed(Security security, MarketDataMessage origin, MarketDataMessage reply) { var error = reply.Error ?? new NotSupportedException(); this.AddErrorLog(LocalizedStrings.UnSubscribedError, security?.Id, origin.DataType, error.Message); MarketDataUnSubscriptionFailed?.Invoke(security, origin, error); MarketDataUnSubscriptionFailed2?.Invoke(security, origin, reply); } private void RaiseMarketDataSubscriptionFinished(Security security, MarketDataFinishedMessage message) { this.AddDebugLog(LocalizedStrings.SubscriptionFinished, security?.Id, message); MarketDataSubscriptionFinished?.Invoke(security, message); } private void RaiseMarketDataUnexpectedCancelled(Security security, MarketDataMessage message, Exception error) { this.AddErrorLog(LocalizedStrings.SubscriptionUnexpectedCancelled, security?.Id, message.DataType, error.Message); MarketDataUnexpectedCancelled?.Invoke(security, message, error); } /// <summary> /// To call the event <see cref="NewMessage"/>. /// </summary> /// <param name="message">A new message.</param> private void RaiseNewMessage(Message message) { NewMessage?.Invoke(message); _newOutMessage?.Invoke(message); } private void RaiseValuesChanged(Security security, IEnumerable<KeyValuePair<Level1Fields, object>> changes, DateTimeOffset serverTime, DateTimeOffset localTime) { ValuesChanged?.Invoke(security, changes, serverTime, localTime); } private void RaiseRestored() { Restored?.Invoke(); } private void RaiseTimeOut() { TimeOut?.Invoke(); } private void RaiseCandleSeriesProcessing(CandleSeries series, Candle candle) { CandleSeriesProcessing?.Invoke(series, candle); } private void RaiseCandleSeriesStopped(CandleSeries series) { CandleSeriesStopped?.Invoke(series); } private void RaiseCandleSeriesError(CandleSeries series, MarketDataMessage reply) { CandleSeriesError?.Invoke(series, reply); } private void RaiseSessionStateChanged(ExchangeBoard board, SessionStates state) { SessionStateChanged?.Invoke(board, state); } private void RaiseChangePassword(long transactionId, Exception error) { ChangePasswordResult?.Invoke(transactionId, error); } private void RaiseReceived<TEntity>(TEntity entity, ISubscriptionIdMessage message, Action<Subscription, TEntity> evt) { if (evt == null) return; foreach (var id in message.GetSubscriptionIds()) { if (!_subscriptions.TryGetValue(id, out var subscription)) continue; evt(subscription, entity); } } } }
30.116248
164
0.718791
[ "Apache-2.0" ]
gridgentoo/StockSharpMono
Algo/Connector_Raise.cs
22,798
C#
using System; using System.Collections.Generic; using NUnit.Framework; using Vts.Common; using Vts.IO; using Vts.MonteCarlo; using Vts.MonteCarlo.Sources; using Vts.MonteCarlo.Tissues; using Vts.MonteCarlo.Detectors; using Vts.MonteCarlo.Helpers; using Vts.MonteCarlo.Sources.SourceProfiles; namespace Vts.Test.MonteCarlo.Detectors { /// <summary> /// These tests execute a discrete absorption weighting (DAW) MC simulation with /// one layer tissue bounded by a cylinder and validate against prior run results /// </summary> [TestFixture] public class DAWBoundingCylinderDetectorsTests { private SimulationOutput _outputBoundedTissue; private SimulationInput _inputBoundedTissue; /// <summary> /// list of temporary files created by these unit tests /// </summary> List<string> listOfTestGeneratedFiles = new List<string>() { "file.txt", // file that captures screen output of MC simulation }; [OneTimeTearDown] public void clear_folders_and_files() { foreach (var file in listOfTestGeneratedFiles) { FileIO.FileDelete(file); } } /// <summary> /// DiscreteAbsorptionWeighting detection. /// Setup input to the MC for a homogeneous one layer tissue and a bounding /// cylinder tissue (both regions have same optical properties), execute simulations /// and verify results agree. /// </summary> [OneTimeSetUp] public void execute_Monte_Carlo() { // delete previously generated files clear_folders_and_files(); var cylinderRadius = 5.0; var tissueThickness = 2.0; // instantiate common classes var simulationOptions = new SimulationOptions( 0, // reproducible RandomNumberGeneratorType.MersenneTwister, AbsorptionWeightingType.Discrete, PhaseFunctionType.HenyeyGreenstein, new List<DatabaseType>() { }, // databases to be written false, // track statistics 0.0, // RR threshold -> 0 = no RR performed 0); var source = new CustomCircularSourceInput( cylinderRadius - 0.01, // outer radius 0.0, // inner radius new FlatSourceProfile(), new DoubleRange(0.0, 0.0), // polar angle emission range new DoubleRange(0.0, 0.0), // azimuthal angle emission range new Direction(0, 0, 1), // normal to tissue new Position(0, 0, 0), // center of beam on surface new PolarAzimuthalAngles(0, 0), // no beam rotation 0); // 0=start in air, 1=start in tissue // debug with point source //var source = new DirectionalPointSourceInput( // new Position(0.0, 0.0, 0.0), // new Direction(0.0, 0.0, 1.0), // //new Direction(1/Math.Sqrt(2), 0.0, 1/Math.Sqrt(2)),// debug with 45 degree direction and g=1.0 // 1); // start inside tissue var detectors = new List<IDetectorInput> { new RSpecularDetectorInput(), new RDiffuseDetectorInput(), new ROfRhoDetectorInput() {Rho=new DoubleRange(0.0, cylinderRadius, 11)}, new TDiffuseDetectorInput(), new TOfRhoDetectorInput() {Rho=new DoubleRange(0.0, cylinderRadius, 11)}, new AOfRhoAndZDetectorInput() {Rho=new DoubleRange(0.0, cylinderRadius, 11), Z=new DoubleRange(0, tissueThickness, 11)}, new ATotalDetectorInput(), new ATotalBoundingVolumeDetectorInput() { TallySecondMoment = true } }; _inputBoundedTissue = new SimulationInput( 100, "", simulationOptions, source, new BoundingCylinderTissueInput( new CaplessCylinderTissueRegion( new Position(0, 0, tissueThickness / 2), cylinderRadius, tissueThickness, new OpticalProperties(0.0, 1e-10, 1.0, 1.4) ), new ITissueRegion[] { new LayerTissueRegion( new DoubleRange(double.NegativeInfinity, 0.0), new OpticalProperties(0.0, 1e-10, 1.0, 1.0)), new LayerTissueRegion( // note two layer and one layer give same results Yay! new DoubleRange(0.0, 1.0), new OpticalProperties(0.01, 1.0, 0.8, 1.4)), // debug g=1.0 new LayerTissueRegion( new DoubleRange(1.0, tissueThickness), new OpticalProperties(0.01, 1.0, 0.8, 1.4)), // debug g=1.0 new LayerTissueRegion( new DoubleRange(tissueThickness, double.PositiveInfinity), new OpticalProperties(0.0, 1e-10, 1.0, 1.0)) } ), detectors); _outputBoundedTissue = new MonteCarloSimulation(_inputBoundedTissue).Run(); } // Diffuse Reflectance [Test] public void validate_DAW_boundingcylinder_RDiffuse() { Assert.Less(Math.Abs(_outputBoundedTissue.Rd - 0.238231), 0.000001); } // Reflection R(rho) [Test] public void validate_DAW_boundingcylinder_ROfRho() { Assert.Less(Math.Abs(_outputBoundedTissue.R_r[0] - 0.0), 0.12381000001); } // Diffuse Transmittance [Test] public void validate_DAW_boundingcylinder_TDiffuse() { Assert.Less(Math.Abs(_outputBoundedTissue.Td - 0.256878), 0.000001); } // Transmittance T(rho) [Test] public void validate_DAW_boundingcylinder_TOfRho() { Assert.Less(Math.Abs(_outputBoundedTissue.T_r[1] - 0.003941), 0.000001); } // Total Absorption [Test] public void validate_DAW_boundingcylinder_ATotal() { Assert.Less(Math.Abs(_outputBoundedTissue.Atot - 0.047790), 0.000001); } // Total Absorption in Bounding Volume [Test] public void validate_DAW_boundingcylinder_ATotalBoundingCylinder() { Assert.Less(Math.Abs(_outputBoundedTissue.AtotBV - 0.427099), 0.000001); Assert.Less(Math.Abs(_outputBoundedTissue.AtotBV2 - 0.405981), 0.000001); } // Absorption(x,y,z) [Test] public void validate_DAW_boundingcylinder_AOfRhoAndZ() { Assert.Less(Math.Abs(_outputBoundedTissue.A_rz[0, 0] - 0.000746), 0.000001); } // sanity checks [Test] public void validate_DAW_boundingcylinder_RDiffuse_plus_ATotal_plus_TDiffuse_equals_one() { // add specular because photons started outside tissue Assert.Less(Math.Abs(_outputBoundedTissue.Rd + _outputBoundedTissue.Atot + _outputBoundedTissue.Rspec + _outputBoundedTissue.AtotBV + _outputBoundedTissue.Td - 1), 0.000001); } } }
41.845304
123
0.558622
[ "MIT" ]
VirtualPhotonics/VTS
src/Vts.Test/MonteCarlo/Detectors/DAWBoundingCylinderDetectorsTests.cs
7,574
C#
using System.IO; using CP77.CR2W.Reflection; using FastMember; using static CP77.CR2W.Types.Enums; namespace CP77.CR2W.Types { [REDMeta] public class rendRenderTextureBlobPS4 : rendIRenderTextureBlob { public rendRenderTextureBlobPS4(CR2WFile cr2w, CVariable parent, string name) : base(cr2w, parent, name) { } } }
22.466667
111
0.744807
[ "MIT" ]
Eingin/CP77Tools
CP77.CR2W/Types/cp77/rendRenderTextureBlobPS4.cs
323
C#
// Copyright (c) CSA, NJUST. All rights reserved. // Licensed under the Mozilla license. See LICENSE file in the project root for full license information. using System.Collections; using System.Collections.Generic; using UnityEngine; public class PlayerBuffer : MonoBehaviour { public float RequireTime = 10f; //技能请求间隔 private bool RequireBuffState;//技能请求状态 private bool RequireAvaliable;//当前是否可以请求升级 private float RequireTiming;//技能请求计时器 private void Start() { RequireBuffState = false; RequireAvaliable = true; RequireTiming = 0; } private void FixedUpdate() { if (RequireAvaliable) { //GetBuff(); //如果技能可用 检测玩家请求 } else { Timing(); //如果技能不可用 计时 } } /* private bool GetBuff() { //玩家选择发动技能1:增加炸弹爆炸范围 if (Input.GetKey(KeyCode.Alpha1)) { if ((RequireBuffState = gameObject.GetComponent<PlayerScoreManager>().Upgrade())) //积分扣除成功时才开启加强 { gameObject.SendMessage("IncreaseBombArea"); RequireAvaliable = false; //开启计时器 } return RequireBuffState; //返回技能请求状态 } //玩家选择发动技能2:增加血量 if (Input.GetKey(KeyCode.Alpha2)) { if((RequireBuffState = gameObject.GetComponent<PlayerHealth>().IncreaseHP())) { RequireAvaliable = false; } return RequireBuffState; } return false; } */ //技能计时器 private void Timing() { if (!RequireAvaliable) { RequireTiming += Time.deltaTime; } if (RequireTiming >= RequireTime) { RequireAvaliable = true; RequireTiming = 0; } } }
23.675325
108
0.557872
[ "MPL-2.0" ]
NJUST-CSA-Develop-Group/The-11th-TuringCup
src/Project/Assets/Scrpit/Player/PlayerBuffer.cs
2,045
C#
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ using System; namespace org.apache.commons.compress.archivers.tar { /** * This interface contains all the definitions used in the package. * */ // CheckStyle:InterfaceIsTypeCheck OFF (bc) public class TarConstants // Basties note: while only const declared - use class { /** * The length of the name field in a header buffer. */ public const int NAMELEN = 100; /** * The length of the mode field in a header buffer. */ public const int MODELEN = 8; /** * The length of the user id field in a header buffer. */ public const int UIDLEN = 8; /** * The length of the group id field in a header buffer. */ public const int GIDLEN = 8; /** * The length of the checksum field in a header buffer. */ public const int CHKSUMLEN = 8; /** * The length of the size field in a header buffer. * Includes the trailing space or NUL. */ public const int SIZELEN = 12; /** * The maximum size of a file in a tar archive (That's 11 sevens, octal). */ public const long MAXSIZE = 077777777777L; /** Offset of start of magic field within header record */ public const int MAGIC_OFFSET = 257; /** * The length of the magic field in a header buffer. */ public const int MAGICLEN = 6; /** Offset of start of magic field within header record */ public const int VERSION_OFFSET = 263; /** * Previously this was regarded as part of "magic" field, but it is separate. */ public const int VERSIONLEN = 2; /** * The length of the modification time field in a header buffer. */ public const int MODTIMELEN = 12; /** * The length of the user name field in a header buffer. */ public const int UNAMELEN = 32; /** * The length of the group name field in a header buffer. */ public const int GNAMELEN = 32; /** * The length of each of the device fields (major and minor) in a header buffer. */ public const int DEVLEN = 8; /** * Length of the prefix field. * */ public const int PREFIXLEN = 155; /** * LF_ constants represent the "link flag" of an entry, or more commonly, * the "entry type". This is the "old way" of indicating a normal file. */ public const byte LF_OLDNORM = 0; /** * Normal file type. */ public static byte LF_NORMAL = (byte)'0'; /** * Link file type. */ public const byte LF_LINK = (byte)'1'; /** * Symbolic link file type. */ public const byte LF_SYMLINK = (byte)'2'; /** * Character device file type. */ public const byte LF_CHR = (byte)'3'; /** * Block device file type. */ public const byte LF_BLK = (byte)'4'; /** * Directory file type. */ public const byte LF_DIR = (byte)'5'; /** * FIFO (pipe) file type. */ public const byte LF_FIFO = (byte)'6'; /** * Contiguous file type. */ public const byte LF_CONTIG = (byte)'7'; /** * Identifies the *next* file on the tape as having a long name. */ public const byte LF_GNUTYPE_LONGNAME = (byte)'L'; // See "http://www.opengroup.org/onlinepubs/009695399/utilities/pax.html#tag_04_100_13_02" /** * Identifies the entry as a Pax extended header. * @since Apache Commons Compress 1.1 */ public const byte LF_PAX_EXTENDED_HEADER_LC = (byte)'x'; /** * Identifies the entry as a Pax extended header (SunOS tar -E). * * @since Apache Commons Compress 1.1 */ public const byte LF_PAX_EXTENDED_HEADER_UC = (byte)'X'; /** * Identifies the entry as a Pax global extended header. * * @since Apache Commons Compress 1.1 */ public const byte LF_PAX_GLOBAL_EXTENDED_HEADER = (byte)'g'; /** * The magic tag representing a POSIX tar archive. */ public static String MAGIC_POSIX = "ustar\0"; public static String VERSION_POSIX = "00"; /** * The magic tag representing a GNU tar archive. */ public const String MAGIC_GNU = "ustar "; // Appear to be two possible GNU versions public const String VERSION_GNU_SPACE = " \0"; public const String VERSION_GNU_ZERO = "0\0"; /** * The magic tag representing an Ant tar archive. * * @since Apache Commons Compress 1.1 */ public const String MAGIC_ANT = "ustar\0"; /** * The "version" representing an Ant tar archive. * * @since Apache Commons Compress 1.1 */ // Does not appear to have a version, however Ant does write 8 bytes, // so assume the version is 2 nulls public const String VERSION_ANT = "\0\0"; /** * The name of the GNU tar entry which contains a long name. */ public const String GNU_LONGLINK = "././@LongLink"; // TODO rename as LONGLINK_GNU ? } }
29.825688
99
0.551984
[ "ECL-2.0", "Apache-2.0" ]
bastie/NetSpider
archive/codeplex/JavApi Commons Compress (Apache Port)/org/apache/commons/compress/archivers/tar/TarConstants.cs
6,502
C#
using System; using System.Collections.Generic; using System.Diagnostics; using NtfsExtract.NTFS.Enums; using NtfsExtract.NTFS.Utilities; using RawDiskLib; namespace NtfsExtract.NTFS.Attributes { public class AttributeList : Attribute { public AttributeListItem[] Items { get; set; } public override AttributeResidentAllow AllowedResidentStates { get { return AttributeResidentAllow.Resident | AttributeResidentAllow.NonResident; } } internal override void ParseAttributeResidentBody(byte[] data, int maxLength, int offset) { base.ParseAttributeResidentBody(data, maxLength, offset); Debug.Assert(maxLength >= ResidentHeader.ContentLength); List<AttributeListItem> results = new List<AttributeListItem>(); int pointer = offset; while (pointer + 26 <= offset + maxLength) // 26 is the smallest possible MFTAttributeListItem { AttributeListItem item = AttributeListItem.ParseListItem(data, Math.Min(data.Length - pointer, maxLength), pointer); if (item.Type == AttributeType.EndOfAttributes) break; results.Add(item); pointer += item.Length; } Items = results.ToArray(); } internal override void ParseAttributeNonResidentBody(RawDisk disk) { base.ParseAttributeNonResidentBody(disk); // Get all chunks byte[] data = NtfsUtils.ReadFragments(disk, NonResidentHeader.Fragments); // Parse List<AttributeListItem> results = new List<AttributeListItem>(); int pointer = 0; int contentSize = (int) NonResidentHeader.ContentSize; while (pointer + 26 <= contentSize) // 26 is the smallest possible MFTAttributeListItem { AttributeListItem item = AttributeListItem.ParseListItem(data, data.Length - pointer, pointer); if (item.Type == AttributeType.EndOfAttributes) break; if (item.Length == 0) break; results.Add(item); pointer += item.Length; } Debug.Assert(pointer == contentSize); Items = results.ToArray(); } } }
31.064103
132
0.589765
[ "MIT" ]
LordMike/NtfsLib
NtfsExtract/NTFS/Attributes/AttributeList.cs
2,425
C#
// Copyright (c) Microsoft. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. //----------------------------------------------------------------------- // </copyright> // <summary>Class implementing INodeProvider for out-of-proc nodes.</summary> //----------------------------------------------------------------------- using System; using System.Collections.Generic; using System.Globalization; using System.Text; using System.IO; using System.IO.Pipes; using System.Diagnostics; using System.Threading; using System.Reflection; using System.Runtime.InteropServices; using System.Security; using System.Security.AccessControl; using System.Security.Principal; using System.Security.Permissions; using Microsoft.Build.Shared; using Microsoft.Build.Framework; using Microsoft.Build.Exceptions; using Microsoft.Build.Internal; using Microsoft.Build.Evaluation; using Microsoft.Build.Execution; namespace Microsoft.Build.BackEnd { /// <summary> /// The provider for out-of-proc nodes. This manages the lifetime of external MSBuild.exe processes /// which act as child nodes for the build system. /// </summary> internal class NodeProviderOutOfProcTaskHost : NodeProviderOutOfProcBase, INodeProvider, INodePacketFactory, INodePacketHandler { /// <summary> /// The maximum number of nodes that this provider supports. Should /// always be equivalent to the number of different TaskHostContexts /// that exist. /// </summary> private const int MaxNodeCount = 4; /// <summary> /// Store the path for MSBuild / MSBuildTaskHost so that we don't have to keep recalculating it. /// </summary> private static string s_baseTaskHostPath; /// <summary> /// Store the 64-bit path for MSBuild / MSBuildTaskHost so that we don't have to keep recalculating it. /// </summary> private static string s_baseTaskHostPath64; /// <summary> /// Store the path for the 32-bit MSBuildTaskHost so that we don't have to keep re-calculating it. /// </summary> private static string s_pathToX32Clr2; /// <summary> /// Store the path for the 64-bit MSBuildTaskHost so that we don't have to keep re-calculating it. /// </summary> private static string s_pathToX64Clr2; /// <summary> /// Store the path for the 32-bit MSBuild so that we don't have to keep re-calculating it. /// </summary> private static string s_pathToX32Clr4; /// <summary> /// Store the path for the 64-bit MSBuild so that we don't have to keep re-calculating it. /// </summary> private static string s_pathToX64Clr4; /// <summary> /// Name for MSBuild.exe /// </summary> private static string s_msbuildName; /// <summary> /// Name for MSBuildTaskHost.exe /// </summary> private static string s_msbuildTaskHostName; /// <summary> /// Are there any active nodes? /// </summary> private ManualResetEvent _noNodesActiveEvent; /// <summary> /// A mapping of all the nodes managed by this provider. /// </summary> private Dictionary<TaskHostContext, NodeContext> _nodeContexts; /// <summary> /// A mapping of all of the INodePacketFactories wrapped by this provider. /// </summary> private IDictionary<int, INodePacketFactory> _nodeIdToPacketFactory; /// <summary> /// A mapping of all of the INodePacketHandlers wrapped by this provider. /// </summary> private IDictionary<int, INodePacketHandler> _nodeIdToPacketHandler; /// <summary> /// Keeps track of the set of nodes for which we have not yet received shutdown notification. /// </summary> private HashSet<int> _activeNodes; /// <summary> /// Packet factory we use if there's not already one associated with a particular context. /// </summary> private NodePacketFactory _localPacketFactory; /// <summary> /// Constructor. /// </summary> private NodeProviderOutOfProcTaskHost() { } #region INodeProvider Members /// <summary> /// Returns the node provider type. /// </summary> public NodeProviderType ProviderType { [DebuggerStepThrough] get { return NodeProviderType.OutOfProc; } } /// <summary> /// Returns the number of available nodes. /// </summary> public int AvailableNodes { get { return MaxNodeCount - _nodeContexts.Count; } } /// <summary> /// Returns the name of the CLR2 Task Host executable /// </summary> internal static string TaskHostNameForClr2TaskHost { get { if (s_msbuildTaskHostName == null) { s_msbuildTaskHostName = Environment.GetEnvironmentVariable("MSBUILDTASKHOST_EXE_NAME"); if (s_msbuildTaskHostName == null) { s_msbuildTaskHostName = "MSBuildTaskHost.exe"; } } return s_msbuildTaskHostName; } } /// <summary> /// Instantiates a new MSBuild process acting as a child node. /// </summary> public bool CreateNode(int nodeId, INodePacketFactory factory, NodeConfiguration configuration) { throw new NotImplementedException("Use the other overload of CreateNode instead"); } /// <summary> /// Sends data to the specified node. /// </summary> /// <param name="nodeId">The node to which data shall be sent.</param> /// <param name="packet">The packet to send.</param> public void SendData(int nodeId, INodePacket packet) { throw new NotImplementedException("Use the other overload of SendData instead"); } /// <summary> /// Sends data to the specified node. /// </summary> /// <param name="hostContext">The node to which data shall be sent.</param> /// <param name="packet">The packet to send.</param> public void SendData(TaskHostContext hostContext, INodePacket packet) { ErrorUtilities.VerifyThrow(_nodeContexts.ContainsKey(hostContext), "Invalid host context specified: {0}.", hostContext.ToString()); SendData(_nodeContexts[hostContext], packet); } /// <summary> /// Shuts down all of the connected managed nodes. /// </summary> /// <param name="enableReuse">Flag indicating if nodes should prepare for reuse.</param> public void ShutdownConnectedNodes(bool enableReuse) { // Send the build completion message to the nodes, causing them to shutdown or reset. List<NodeContext> contextsToShutDown; lock (_nodeContexts) { contextsToShutDown = new List<NodeContext>(_nodeContexts.Values); } ShutdownConnectedNodes(contextsToShutDown, enableReuse); _noNodesActiveEvent.WaitOne(); } /// <summary> /// Shuts down all of the managed nodes permanently. /// </summary> public void ShutdownAllNodes() { ShutdownAllNodes(NodeProviderOutOfProc.HostHandshake, NodeProviderOutOfProc.ClientHandshake, NodeContextTerminated); } #endregion #region IBuildComponent Members /// <summary> /// Initializes the component. /// </summary> /// <param name="host">The component host.</param> public void InitializeComponent(IBuildComponentHost host) { this.ComponentHost = host; _nodeContexts = new Dictionary<TaskHostContext, NodeContext>(); _nodeIdToPacketFactory = new Dictionary<int, INodePacketFactory>(); _nodeIdToPacketHandler = new Dictionary<int, INodePacketHandler>(); _activeNodes = new HashSet<int>(); _noNodesActiveEvent = new ManualResetEvent(true); _localPacketFactory = new NodePacketFactory(); (this as INodePacketFactory).RegisterPacketHandler(NodePacketType.LogMessage, LogMessagePacket.FactoryForDeserialization, this); (this as INodePacketFactory).RegisterPacketHandler(NodePacketType.TaskHostTaskComplete, TaskHostTaskComplete.FactoryForDeserialization, this); (this as INodePacketFactory).RegisterPacketHandler(NodePacketType.NodeShutdown, NodeShutdown.FactoryForDeserialization, this); } /// <summary> /// Shuts down the component /// </summary> public void ShutdownComponent() { } #endregion #region INodePacketFactory Members /// <summary> /// Registers the specified handler for a particular packet type. /// </summary> /// <param name="packetType">The packet type.</param> /// <param name="factory">The factory for packets of the specified type.</param> /// <param name="handler">The handler to be called when packets of the specified type are received.</param> public void RegisterPacketHandler(NodePacketType packetType, NodePacketFactoryMethod factory, INodePacketHandler handler) { _localPacketFactory.RegisterPacketHandler(packetType, factory, handler); } /// <summary> /// Unregisters a packet handler. /// </summary> /// <param name="packetType">The packet type.</param> public void UnregisterPacketHandler(NodePacketType packetType) { _localPacketFactory.UnregisterPacketHandler(packetType); } /// <summary> /// Takes a serializer, deserializes the packet and routes it to the appropriate handler. /// </summary> /// <param name="nodeId">The node from which the packet was received.</param> /// <param name="packetType">The packet type.</param> /// <param name="translator">The translator containing the data from which the packet should be reconstructed.</param> public void DeserializeAndRoutePacket(int nodeId, NodePacketType packetType, INodePacketTranslator translator) { if (_nodeIdToPacketFactory.ContainsKey(nodeId)) { _nodeIdToPacketFactory[nodeId].DeserializeAndRoutePacket(nodeId, packetType, translator); } else { _localPacketFactory.DeserializeAndRoutePacket(nodeId, packetType, translator); } } /// <summary> /// Routes the specified packet /// </summary> /// <param name="nodeId">The node from which the packet was received.</param> /// <param name="packet">The packet to route.</param> public void RoutePacket(int nodeId, INodePacket packet) { if (_nodeIdToPacketFactory.ContainsKey(nodeId)) { _nodeIdToPacketFactory[nodeId].RoutePacket(nodeId, packet); } else { _localPacketFactory.RoutePacket(nodeId, packet); } } #endregion #region INodePacketHandler Members /// <summary> /// This method is invoked by the NodePacketRouter when a packet is received and is intended for /// this recipient. /// </summary> /// <param name="node">The node from which the packet was received.</param> /// <param name="packet">The packet.</param> public void PacketReceived(int node, INodePacket packet) { if (_nodeIdToPacketHandler.ContainsKey(node)) { _nodeIdToPacketHandler[node].PacketReceived(node, packet); } else { ErrorUtilities.VerifyThrow(packet.Type == NodePacketType.NodeShutdown, "We should only ever handle packets of type NodeShutdown -- everything else should only come in when there's an active task"); // May also be removed by unnatural termination, so don't assume it's there lock (_activeNodes) { if (_activeNodes.Contains(node)) { _activeNodes.Remove(node); } if (_activeNodes.Count == 0) { _noNodesActiveEvent.Set(); } } } } #endregion /// <summary> /// Static factory for component creation. /// </summary> static internal IBuildComponent CreateComponent(BuildComponentType componentType) { ErrorUtilities.VerifyThrow(componentType == BuildComponentType.OutOfProcTaskHostNodeProvider, "Factory cannot create components of type {0}", componentType); return new NodeProviderOutOfProcTaskHost(); } /// <summary> /// Clears out our cached values for the various task host names and paths. /// FOR UNIT TESTING ONLY /// </summary> internal static void ClearCachedTaskHostPaths() { s_msbuildName = null; s_msbuildTaskHostName = null; s_pathToX32Clr2 = null; s_pathToX32Clr4 = null; s_pathToX64Clr2 = null; s_pathToX64Clr4 = null; s_baseTaskHostPath = null; s_baseTaskHostPath64 = null; } /// <summary> /// Given a TaskHostContext, returns the name of the executable we should be searching for. /// </summary> internal static string GetTaskHostNameFromHostContext(TaskHostContext hostContext) { if (hostContext == TaskHostContext.X64CLR4 || hostContext == TaskHostContext.X32CLR4) { if (s_msbuildName == null) { s_msbuildName = Environment.GetEnvironmentVariable("MSBUILD_EXE_NAME"); if (s_msbuildName == null) { s_msbuildName = "MSBuild.exe"; } } return s_msbuildName; } else if (hostContext == TaskHostContext.X32CLR2 || hostContext == TaskHostContext.X64CLR2) { return TaskHostNameForClr2TaskHost; } else { ErrorUtilities.ThrowInternalErrorUnreachable(); return null; } } /// <summary> /// Given a TaskHostContext, return the appropriate location of the /// executable (MSBuild or MSBuildTaskHost) that we wish to use, or null /// if that location cannot be resolved. /// </summary> internal static string GetMSBuildLocationFromHostContext(TaskHostContext hostContext) { string toolName = GetTaskHostNameFromHostContext(hostContext); string toolPath = null; if (s_baseTaskHostPath == null) { Toolset currentToolset = ProjectCollection.GlobalProjectCollection.GetToolset(MSBuildConstants.CurrentToolsVersion); if (currentToolset != null) { ProjectPropertyInstance toolsPath32 = null; if (!currentToolset.Properties.TryGetValue("MSBuildToolsPath32", out toolsPath32)) { // ... This is a very weird toolset. But try falling back to the base ToolsPath since we // know for a fact that that will always exist. s_baseTaskHostPath = currentToolset.ToolsPath; } else { s_baseTaskHostPath = toolsPath32.EvaluatedValue; } } } if (s_baseTaskHostPath64 == null && s_baseTaskHostPath != null) { s_baseTaskHostPath64 = Path.Combine(s_baseTaskHostPath, "amd64"); if (!Directory.Exists(s_baseTaskHostPath64)) { // time to give up s_baseTaskHostPath64 = null; } } switch (hostContext) { case TaskHostContext.X32CLR2: if (s_pathToX32Clr2 == null) { s_pathToX32Clr2 = Environment.GetEnvironmentVariable("MSBUILDTASKHOSTLOCATION"); if (s_pathToX32Clr2 == null || !FileUtilities.FileExistsNoThrow(Path.Combine(s_pathToX32Clr2, toolName))) { s_pathToX32Clr2 = s_baseTaskHostPath; } } toolPath = s_pathToX32Clr2; break; case TaskHostContext.X64CLR2: if (s_pathToX64Clr2 == null) { s_pathToX64Clr2 = Environment.GetEnvironmentVariable("MSBUILDTASKHOSTLOCATION64"); if (s_pathToX64Clr2 == null || !FileUtilities.FileExistsNoThrow(Path.Combine(s_pathToX64Clr2, toolName))) { s_pathToX64Clr2 = s_baseTaskHostPath64; } } toolPath = s_pathToX64Clr2; break; case TaskHostContext.X32CLR4: if (s_pathToX32Clr4 == null) { s_pathToX32Clr4 = s_baseTaskHostPath; } toolPath = s_pathToX32Clr4; break; case TaskHostContext.X64CLR4: if (s_pathToX64Clr4 == null) { s_pathToX64Clr4 = s_baseTaskHostPath64; } toolPath = s_pathToX64Clr4; break; default: ErrorUtilities.ThrowInternalErrorUnreachable(); break; } if (toolName != null && toolPath != null) { return Path.Combine(toolPath, toolName); } else { return null; } } /// <summary> /// Make sure a node in the requested context exists. /// </summary> internal bool AcquireAndSetUpHost(TaskHostContext hostContext, INodePacketFactory factory, INodePacketHandler handler, TaskHostConfiguration configuration) { NodeContext context = null; bool nodeCreationSucceeded = false; if (!(_nodeContexts.TryGetValue(hostContext, out context))) { nodeCreationSucceeded = CreateNode(hostContext, factory, handler, configuration); } else { // node already exists, so "creation" automatically succeeded nodeCreationSucceeded = true; } if (nodeCreationSucceeded) { context = _nodeContexts[hostContext]; _nodeIdToPacketFactory[(int)hostContext] = factory; _nodeIdToPacketHandler[(int)hostContext] = handler; // Configure the node. context.SendData(configuration); return true; } return false; } /// <summary> /// Expected to be called when TaskHostTask is done with host of the given context. /// </summary> internal void DisconnectFromHost(TaskHostContext hostContext) { ErrorUtilities.VerifyThrow(_nodeIdToPacketFactory.ContainsKey((int)hostContext) && _nodeIdToPacketHandler.ContainsKey((int)hostContext), "Why are we trying to disconnect from a context that we already disconnected from? Did we call DisconnectFromHost twice?"); _nodeIdToPacketFactory.Remove((int)hostContext); _nodeIdToPacketHandler.Remove((int)hostContext); } /// <summary> /// Instantiates a new MSBuild or MSBuildTaskHost process acting as a child node. /// </summary> internal bool CreateNode(TaskHostContext hostContext, INodePacketFactory factory, INodePacketHandler handler, TaskHostConfiguration configuration) { ErrorUtilities.VerifyThrowArgumentNull(factory, "factory"); ErrorUtilities.VerifyThrow(!_nodeIdToPacketFactory.ContainsKey((int)hostContext), "We should not already have a factory for this context! Did we forget to call DisconnectFromHost somewhere?"); if (AvailableNodes == 0) { ErrorUtilities.ThrowInternalError("All allowable nodes already created ({0}).", _nodeContexts.Count); return false; } // Start the new process. We pass in a node mode with a node number of 2, to indicate that we // want to start up an MSBuild task host node. string commandLineArgs = " /nologo /nodemode:2 "; string msbuildLocation = GetMSBuildLocationFromHostContext(hostContext); // we couldn't even figure out the location we're trying to launch ... just go ahead and fail. if (msbuildLocation == null) { return false; } CommunicationsUtilities.Trace("For a host context of {0}, spawning executable from {1}.", hostContext.ToString(), msbuildLocation); // Make it here. NodeContext context = GetNode ( msbuildLocation, commandLineArgs, (int)hostContext, this, CommunicationsUtilities.GetTaskHostHostHandshake(hostContext), CommunicationsUtilities.GetTaskHostClientHandshake(hostContext), NodeContextTerminated ); if (null != context) { _nodeContexts[hostContext] = context; // Start the asynchronous read. context.BeginAsyncPacketRead(); _activeNodes.Add((int)hostContext); _noNodesActiveEvent.Reset(); return true; } return false; } /// <summary> /// Method called when a context terminates. /// </summary> private void NodeContextTerminated(int nodeId) { lock (_nodeContexts) { _nodeContexts.Remove((TaskHostContext)nodeId); } // May also be removed by unnatural termination, so don't assume it's there lock (_activeNodes) { if (_activeNodes.Contains(nodeId)) { _activeNodes.Remove(nodeId); } if (_activeNodes.Count == 0) { _noNodesActiveEvent.Set(); } } } } }
38.860095
274
0.550464
[ "MIT" ]
abock/msbuild
src/XMakeBuildEngine/BackEnd/Components/Communications/NodeProviderOutOfProcTaskHost.cs
23,817
C#
/** * Copyright (c) 2014, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. */ using System; using NUnit.Framework; namespace Facebook.CSSLayout.Tests { /** * Tests for {@link LayoutEngine} */ public class LayoutEngineTest { const int POSITION_LEFT = CSSLayout.POSITION_LEFT; const int POSITION_TOP = CSSLayout.POSITION_TOP; const int POSITION_RIGHT = CSSLayout.POSITION_RIGHT; const int POSITION_BOTTOM = CSSLayout.POSITION_BOTTOM; const int DIMENSION_HEIGHT = CSSLayout.DIMENSION_HEIGHT; const int DIMENSION_WIDTH = CSSLayout.DIMENSION_WIDTH; static readonly MeasureFunction sTestMeasureFunction = (node, width, widthMode, height, heightMode) => { TestCSSNode testNode = (TestCSSNode) node; if (testNode.context.Equals(TestConstants.SMALL_TEXT)) { if (widthMode == CSSMeasureMode.Undefined) { width = 10000000; } return new MeasureOutput( Math.Min(width, TestConstants.SMALL_WIDTH), TestConstants.SMALL_HEIGHT); } else if (testNode.context.Equals(TestConstants.LONG_TEXT)) { if (widthMode == CSSMeasureMode.Undefined) { width = 10000000; } return new MeasureOutput(width >= TestConstants.BIG_WIDTH ? TestConstants.BIG_WIDTH : Math.Max(TestConstants.BIG_MIN_WIDTH, width), width >= TestConstants.BIG_WIDTH ? TestConstants.SMALL_HEIGHT : TestConstants.BIG_HEIGHT); } else if (testNode.context.Equals(TestConstants.MEASURE_WITH_RATIO_2)) { if (widthMode != CSSMeasureMode.Undefined) { return new MeasureOutput(width, width * 2); } else if (heightMode != CSSMeasureMode.Undefined) { return new MeasureOutput(height * 2, height); } else { return new MeasureOutput(99999, 99999); } } else if (testNode.context.Equals(TestConstants.MEASURE_WITH_MATCH_PARENT)) { if (widthMode == CSSMeasureMode.Undefined) { width = 99999; } if (heightMode == CSSMeasureMode.Undefined) { height = 99999; } return new MeasureOutput(width, height); } else { throw new Exception("Got unknown test: " + testNode.context); } }; private class TestCSSNode : CSSNode { public String context = null; public TestCSSNode getChildAt(int i) { return (TestCSSNode) base[i]; } } private static void test(String message, CSSNode style, CSSNode expectedLayout) { style.CalculateLayout(); assertLayoutsEqual(message, style, expectedLayout); } private static void addChildren(TestCSSNode node, int numChildren) { for (int i = 0; i < numChildren; i++) { node.addChildAt(new TestCSSNode(), i); } } private static void assertLayoutsEqual(String message, CSSNode actual, CSSNode expected) { Assert.IsTrue( areLayoutsEqual(actual, expected), message + "\nActual:\n" + actual.ToString() + "\nExpected:\n" + expected.ToString() ); } private static bool areLayoutsEqual(CSSNode a, CSSNode b) { bool doNodesHaveSameLayout = areFloatsEqual(a.layout.position[POSITION_LEFT], b.layout.position[POSITION_LEFT]) && areFloatsEqual(a.layout.position[POSITION_TOP], b.layout.position[POSITION_TOP]) && areFloatsEqual(a.layout.dimensions[DIMENSION_WIDTH], b.layout.dimensions[DIMENSION_WIDTH]) && areFloatsEqual(a.layout.dimensions[DIMENSION_HEIGHT], b.layout.dimensions[DIMENSION_HEIGHT]); if (!doNodesHaveSameLayout) { return false; } for (int i = 0; i < a.getChildCount(); i++) { if (!areLayoutsEqual(a.getChildAt(i), b.getChildAt(i))) { return false; } } return true; } private static bool areFloatsEqual(float a, float b) { return Math.Abs(a - b) < .00001f; } /** START_GENERATED **/ [Test] public void TestCase0() { TestCSSNode root_node = new TestCSSNode(); { TestCSSNode node_0 = root_node; node_0.style.dimensions[DIMENSION_WIDTH] = 100; node_0.style.dimensions[DIMENSION_HEIGHT] = 200; } TestCSSNode root_layout = new TestCSSNode(); { TestCSSNode node_0 = root_layout; node_0.layout.position[POSITION_TOP] = 0; node_0.layout.position[POSITION_LEFT] = 0; node_0.layout.dimensions[DIMENSION_WIDTH] = 100; node_0.layout.dimensions[DIMENSION_HEIGHT] = 200; } test("should layout a single node with width and height", root_node, root_layout); } [Test] public void TestCase1() { TestCSSNode root_node = new TestCSSNode(); { TestCSSNode node_0 = root_node; node_0.style.dimensions[DIMENSION_WIDTH] = 1000; node_0.style.dimensions[DIMENSION_HEIGHT] = 1000; addChildren(node_0, 3); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.style.dimensions[DIMENSION_WIDTH] = 500; node_1.style.dimensions[DIMENSION_HEIGHT] = 500; node_1 = node_0.getChildAt(1); node_1.style.dimensions[DIMENSION_WIDTH] = 250; node_1.style.dimensions[DIMENSION_HEIGHT] = 250; node_1 = node_0.getChildAt(2); node_1.style.dimensions[DIMENSION_WIDTH] = 125; node_1.style.dimensions[DIMENSION_HEIGHT] = 125; } } TestCSSNode root_layout = new TestCSSNode(); { TestCSSNode node_0 = root_layout; node_0.layout.position[POSITION_TOP] = 0; node_0.layout.position[POSITION_LEFT] = 0; node_0.layout.dimensions[DIMENSION_WIDTH] = 1000; node_0.layout.dimensions[DIMENSION_HEIGHT] = 1000; addChildren(node_0, 3); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.layout.position[POSITION_TOP] = 0; node_1.layout.position[POSITION_LEFT] = 0; node_1.layout.dimensions[DIMENSION_WIDTH] = 500; node_1.layout.dimensions[DIMENSION_HEIGHT] = 500; node_1 = node_0.getChildAt(1); node_1.layout.position[POSITION_TOP] = 500; node_1.layout.position[POSITION_LEFT] = 0; node_1.layout.dimensions[DIMENSION_WIDTH] = 250; node_1.layout.dimensions[DIMENSION_HEIGHT] = 250; node_1 = node_0.getChildAt(2); node_1.layout.position[POSITION_TOP] = 750; node_1.layout.position[POSITION_LEFT] = 0; node_1.layout.dimensions[DIMENSION_WIDTH] = 125; node_1.layout.dimensions[DIMENSION_HEIGHT] = 125; } } test("should layout node with children", root_node, root_layout); } [Test] public void TestCase2() { TestCSSNode root_node = new TestCSSNode(); { TestCSSNode node_0 = root_node; node_0.style.flexDirection = CSSFlexDirection.ColumnReverse; node_0.style.dimensions[DIMENSION_WIDTH] = 1000; node_0.style.dimensions[DIMENSION_HEIGHT] = 1000; addChildren(node_0, 3); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.style.dimensions[DIMENSION_WIDTH] = 500; node_1.style.dimensions[DIMENSION_HEIGHT] = 500; node_1 = node_0.getChildAt(1); node_1.style.dimensions[DIMENSION_WIDTH] = 250; node_1.style.dimensions[DIMENSION_HEIGHT] = 250; node_1 = node_0.getChildAt(2); node_1.style.dimensions[DIMENSION_WIDTH] = 125; node_1.style.dimensions[DIMENSION_HEIGHT] = 125; } } TestCSSNode root_layout = new TestCSSNode(); { TestCSSNode node_0 = root_layout; node_0.layout.position[POSITION_TOP] = 0; node_0.layout.position[POSITION_LEFT] = 0; node_0.layout.dimensions[DIMENSION_WIDTH] = 1000; node_0.layout.dimensions[DIMENSION_HEIGHT] = 1000; addChildren(node_0, 3); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.layout.position[POSITION_TOP] = 500; node_1.layout.position[POSITION_LEFT] = 0; node_1.layout.dimensions[DIMENSION_WIDTH] = 500; node_1.layout.dimensions[DIMENSION_HEIGHT] = 500; node_1 = node_0.getChildAt(1); node_1.layout.position[POSITION_TOP] = 250; node_1.layout.position[POSITION_LEFT] = 0; node_1.layout.dimensions[DIMENSION_WIDTH] = 250; node_1.layout.dimensions[DIMENSION_HEIGHT] = 250; node_1 = node_0.getChildAt(2); node_1.layout.position[POSITION_TOP] = 125; node_1.layout.position[POSITION_LEFT] = 0; node_1.layout.dimensions[DIMENSION_WIDTH] = 125; node_1.layout.dimensions[DIMENSION_HEIGHT] = 125; } } test("should layout node with children in reverse", root_node, root_layout); } [Test] public void TestCase3() { TestCSSNode root_node = new TestCSSNode(); { TestCSSNode node_0 = root_node; node_0.style.dimensions[DIMENSION_WIDTH] = 1000; node_0.style.dimensions[DIMENSION_HEIGHT] = 1000; addChildren(node_0, 2); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.style.dimensions[DIMENSION_WIDTH] = 500; node_1.style.dimensions[DIMENSION_HEIGHT] = 500; node_1 = node_0.getChildAt(1); node_1.style.dimensions[DIMENSION_WIDTH] = 500; node_1.style.dimensions[DIMENSION_HEIGHT] = 500; addChildren(node_1, 2); { TestCSSNode node_2; node_2 = node_1.getChildAt(0); node_2.style.dimensions[DIMENSION_WIDTH] = 250; node_2.style.dimensions[DIMENSION_HEIGHT] = 250; node_2 = node_1.getChildAt(1); node_2.style.dimensions[DIMENSION_WIDTH] = 250; node_2.style.dimensions[DIMENSION_HEIGHT] = 250; } } } TestCSSNode root_layout = new TestCSSNode(); { TestCSSNode node_0 = root_layout; node_0.layout.position[POSITION_TOP] = 0; node_0.layout.position[POSITION_LEFT] = 0; node_0.layout.dimensions[DIMENSION_WIDTH] = 1000; node_0.layout.dimensions[DIMENSION_HEIGHT] = 1000; addChildren(node_0, 2); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.layout.position[POSITION_TOP] = 0; node_1.layout.position[POSITION_LEFT] = 0; node_1.layout.dimensions[DIMENSION_WIDTH] = 500; node_1.layout.dimensions[DIMENSION_HEIGHT] = 500; node_1 = node_0.getChildAt(1); node_1.layout.position[POSITION_TOP] = 500; node_1.layout.position[POSITION_LEFT] = 0; node_1.layout.dimensions[DIMENSION_WIDTH] = 500; node_1.layout.dimensions[DIMENSION_HEIGHT] = 500; addChildren(node_1, 2); { TestCSSNode node_2; node_2 = node_1.getChildAt(0); node_2.layout.position[POSITION_TOP] = 0; node_2.layout.position[POSITION_LEFT] = 0; node_2.layout.dimensions[DIMENSION_WIDTH] = 250; node_2.layout.dimensions[DIMENSION_HEIGHT] = 250; node_2 = node_1.getChildAt(1); node_2.layout.position[POSITION_TOP] = 250; node_2.layout.position[POSITION_LEFT] = 0; node_2.layout.dimensions[DIMENSION_WIDTH] = 250; node_2.layout.dimensions[DIMENSION_HEIGHT] = 250; } } } test("should layout node with nested children", root_node, root_layout); } [Test] public void TestCase4() { TestCSSNode root_node = new TestCSSNode(); { TestCSSNode node_0 = root_node; node_0.style.flexDirection = CSSFlexDirection.ColumnReverse; node_0.style.dimensions[DIMENSION_WIDTH] = 1000; node_0.style.dimensions[DIMENSION_HEIGHT] = 1000; addChildren(node_0, 2); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.style.dimensions[DIMENSION_WIDTH] = 500; node_1.style.dimensions[DIMENSION_HEIGHT] = 500; node_1 = node_0.getChildAt(1); node_1.style.flexDirection = CSSFlexDirection.ColumnReverse; node_1.style.dimensions[DIMENSION_WIDTH] = 500; node_1.style.dimensions[DIMENSION_HEIGHT] = 500; addChildren(node_1, 2); { TestCSSNode node_2; node_2 = node_1.getChildAt(0); node_2.style.dimensions[DIMENSION_WIDTH] = 250; node_2.style.dimensions[DIMENSION_HEIGHT] = 250; node_2 = node_1.getChildAt(1); node_2.style.dimensions[DIMENSION_WIDTH] = 250; node_2.style.dimensions[DIMENSION_HEIGHT] = 250; } } } TestCSSNode root_layout = new TestCSSNode(); { TestCSSNode node_0 = root_layout; node_0.layout.position[POSITION_TOP] = 0; node_0.layout.position[POSITION_LEFT] = 0; node_0.layout.dimensions[DIMENSION_WIDTH] = 1000; node_0.layout.dimensions[DIMENSION_HEIGHT] = 1000; addChildren(node_0, 2); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.layout.position[POSITION_TOP] = 500; node_1.layout.position[POSITION_LEFT] = 0; node_1.layout.dimensions[DIMENSION_WIDTH] = 500; node_1.layout.dimensions[DIMENSION_HEIGHT] = 500; node_1 = node_0.getChildAt(1); node_1.layout.position[POSITION_TOP] = 0; node_1.layout.position[POSITION_LEFT] = 0; node_1.layout.dimensions[DIMENSION_WIDTH] = 500; node_1.layout.dimensions[DIMENSION_HEIGHT] = 500; addChildren(node_1, 2); { TestCSSNode node_2; node_2 = node_1.getChildAt(0); node_2.layout.position[POSITION_TOP] = 250; node_2.layout.position[POSITION_LEFT] = 0; node_2.layout.dimensions[DIMENSION_WIDTH] = 250; node_2.layout.dimensions[DIMENSION_HEIGHT] = 250; node_2 = node_1.getChildAt(1); node_2.layout.position[POSITION_TOP] = 0; node_2.layout.position[POSITION_LEFT] = 0; node_2.layout.dimensions[DIMENSION_WIDTH] = 250; node_2.layout.dimensions[DIMENSION_HEIGHT] = 250; } } } test("should layout node with nested children in reverse", root_node, root_layout); } [Test] public void TestCase5() { TestCSSNode root_node = new TestCSSNode(); { TestCSSNode node_0 = root_node; node_0.style.dimensions[DIMENSION_WIDTH] = 100; node_0.style.dimensions[DIMENSION_HEIGHT] = 200; node_0.setMargin(Spacing.LEFT, 10); node_0.setMargin(Spacing.TOP, 10); node_0.setMargin(Spacing.RIGHT, 10); node_0.setMargin(Spacing.BOTTOM, 10); node_0.setMargin(Spacing.START, 10); node_0.setMargin(Spacing.END, 10); } TestCSSNode root_layout = new TestCSSNode(); { TestCSSNode node_0 = root_layout; node_0.layout.position[POSITION_TOP] = 10; node_0.layout.position[POSITION_LEFT] = 10; node_0.layout.dimensions[DIMENSION_WIDTH] = 100; node_0.layout.dimensions[DIMENSION_HEIGHT] = 200; } test("should layout node with margin", root_node, root_layout); } [Test] public void TestCase6() { TestCSSNode root_node = new TestCSSNode(); { TestCSSNode node_0 = root_node; node_0.style.dimensions[DIMENSION_WIDTH] = 1000; node_0.style.dimensions[DIMENSION_HEIGHT] = 1000; node_0.setMargin(Spacing.LEFT, 10); node_0.setMargin(Spacing.TOP, 10); node_0.setMargin(Spacing.RIGHT, 10); node_0.setMargin(Spacing.BOTTOM, 10); node_0.setMargin(Spacing.START, 10); node_0.setMargin(Spacing.END, 10); addChildren(node_0, 3); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.style.dimensions[DIMENSION_WIDTH] = 100; node_1.style.dimensions[DIMENSION_HEIGHT] = 100; node_1.setMargin(Spacing.LEFT, 50); node_1.setMargin(Spacing.TOP, 50); node_1.setMargin(Spacing.RIGHT, 50); node_1.setMargin(Spacing.BOTTOM, 50); node_1.setMargin(Spacing.START, 50); node_1.setMargin(Spacing.END, 50); node_1 = node_0.getChildAt(1); node_1.style.dimensions[DIMENSION_WIDTH] = 100; node_1.style.dimensions[DIMENSION_HEIGHT] = 100; node_1.setMargin(Spacing.LEFT, 25); node_1.setMargin(Spacing.TOP, 25); node_1.setMargin(Spacing.RIGHT, 25); node_1.setMargin(Spacing.BOTTOM, 25); node_1.setMargin(Spacing.START, 25); node_1.setMargin(Spacing.END, 25); node_1 = node_0.getChildAt(2); node_1.style.dimensions[DIMENSION_WIDTH] = 100; node_1.style.dimensions[DIMENSION_HEIGHT] = 100; node_1.setMargin(Spacing.LEFT, 10); node_1.setMargin(Spacing.TOP, 10); node_1.setMargin(Spacing.RIGHT, 10); node_1.setMargin(Spacing.BOTTOM, 10); node_1.setMargin(Spacing.START, 10); node_1.setMargin(Spacing.END, 10); } } TestCSSNode root_layout = new TestCSSNode(); { TestCSSNode node_0 = root_layout; node_0.layout.position[POSITION_TOP] = 10; node_0.layout.position[POSITION_LEFT] = 10; node_0.layout.dimensions[DIMENSION_WIDTH] = 1000; node_0.layout.dimensions[DIMENSION_HEIGHT] = 1000; addChildren(node_0, 3); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.layout.position[POSITION_TOP] = 50; node_1.layout.position[POSITION_LEFT] = 50; node_1.layout.dimensions[DIMENSION_WIDTH] = 100; node_1.layout.dimensions[DIMENSION_HEIGHT] = 100; node_1 = node_0.getChildAt(1); node_1.layout.position[POSITION_TOP] = 225; node_1.layout.position[POSITION_LEFT] = 25; node_1.layout.dimensions[DIMENSION_WIDTH] = 100; node_1.layout.dimensions[DIMENSION_HEIGHT] = 100; node_1 = node_0.getChildAt(2); node_1.layout.position[POSITION_TOP] = 360; node_1.layout.position[POSITION_LEFT] = 10; node_1.layout.dimensions[DIMENSION_WIDTH] = 100; node_1.layout.dimensions[DIMENSION_HEIGHT] = 100; } } test("should layout node with several children", root_node, root_layout); } [Test] public void TestCase7() { TestCSSNode root_node = new TestCSSNode(); { TestCSSNode node_0 = root_node; node_0.style.flexDirection = CSSFlexDirection.ColumnReverse; node_0.style.dimensions[DIMENSION_WIDTH] = 1000; node_0.style.dimensions[DIMENSION_HEIGHT] = 1000; node_0.setMargin(Spacing.LEFT, 10); node_0.setMargin(Spacing.TOP, 10); node_0.setMargin(Spacing.RIGHT, 10); node_0.setMargin(Spacing.BOTTOM, 10); node_0.setMargin(Spacing.START, 10); node_0.setMargin(Spacing.END, 10); addChildren(node_0, 3); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.style.dimensions[DIMENSION_WIDTH] = 100; node_1.style.dimensions[DIMENSION_HEIGHT] = 100; node_1.setMargin(Spacing.LEFT, 50); node_1.setMargin(Spacing.TOP, 50); node_1.setMargin(Spacing.RIGHT, 50); node_1.setMargin(Spacing.BOTTOM, 50); node_1.setMargin(Spacing.START, 50); node_1.setMargin(Spacing.END, 50); node_1 = node_0.getChildAt(1); node_1.style.dimensions[DIMENSION_WIDTH] = 100; node_1.style.dimensions[DIMENSION_HEIGHT] = 100; node_1.setMargin(Spacing.LEFT, 25); node_1.setMargin(Spacing.TOP, 25); node_1.setMargin(Spacing.RIGHT, 25); node_1.setMargin(Spacing.BOTTOM, 25); node_1.setMargin(Spacing.START, 25); node_1.setMargin(Spacing.END, 25); node_1 = node_0.getChildAt(2); node_1.style.dimensions[DIMENSION_WIDTH] = 100; node_1.style.dimensions[DIMENSION_HEIGHT] = 100; node_1.setMargin(Spacing.LEFT, 10); node_1.setMargin(Spacing.TOP, 10); node_1.setMargin(Spacing.RIGHT, 10); node_1.setMargin(Spacing.BOTTOM, 10); node_1.setMargin(Spacing.START, 10); node_1.setMargin(Spacing.END, 10); } } TestCSSNode root_layout = new TestCSSNode(); { TestCSSNode node_0 = root_layout; node_0.layout.position[POSITION_TOP] = 10; node_0.layout.position[POSITION_LEFT] = 10; node_0.layout.dimensions[DIMENSION_WIDTH] = 1000; node_0.layout.dimensions[DIMENSION_HEIGHT] = 1000; addChildren(node_0, 3); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.layout.position[POSITION_TOP] = 850; node_1.layout.position[POSITION_LEFT] = 50; node_1.layout.dimensions[DIMENSION_WIDTH] = 100; node_1.layout.dimensions[DIMENSION_HEIGHT] = 100; node_1 = node_0.getChildAt(1); node_1.layout.position[POSITION_TOP] = 675; node_1.layout.position[POSITION_LEFT] = 25; node_1.layout.dimensions[DIMENSION_WIDTH] = 100; node_1.layout.dimensions[DIMENSION_HEIGHT] = 100; node_1 = node_0.getChildAt(2); node_1.layout.position[POSITION_TOP] = 540; node_1.layout.position[POSITION_LEFT] = 10; node_1.layout.dimensions[DIMENSION_WIDTH] = 100; node_1.layout.dimensions[DIMENSION_HEIGHT] = 100; } } test("should layout node with several children in reverse", root_node, root_layout); } [Test] public void TestCase8() { TestCSSNode root_node = new TestCSSNode(); { TestCSSNode node_0 = root_node; node_0.style.direction = CSSDirection.RTL; node_0.style.flexDirection = CSSFlexDirection.RowReverse; node_0.style.dimensions[DIMENSION_WIDTH] = 1000; node_0.style.dimensions[DIMENSION_HEIGHT] = 1000; addChildren(node_0, 2); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.style.dimensions[DIMENSION_WIDTH] = 100; node_1.style.dimensions[DIMENSION_HEIGHT] = 200; node_1 = node_0.getChildAt(1); node_1.style.dimensions[DIMENSION_WIDTH] = 300; node_1.style.dimensions[DIMENSION_HEIGHT] = 150; } } TestCSSNode root_layout = new TestCSSNode(); { TestCSSNode node_0 = root_layout; node_0.layout.position[POSITION_TOP] = 0; node_0.layout.position[POSITION_LEFT] = 0; node_0.layout.dimensions[DIMENSION_WIDTH] = 1000; node_0.layout.dimensions[DIMENSION_HEIGHT] = 1000; addChildren(node_0, 2); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.layout.position[POSITION_TOP] = 0; node_1.layout.position[POSITION_LEFT] = 0; node_1.layout.dimensions[DIMENSION_WIDTH] = 100; node_1.layout.dimensions[DIMENSION_HEIGHT] = 200; node_1 = node_0.getChildAt(1); node_1.layout.position[POSITION_TOP] = 0; node_1.layout.position[POSITION_LEFT] = 100; node_1.layout.dimensions[DIMENSION_WIDTH] = 300; node_1.layout.dimensions[DIMENSION_HEIGHT] = 150; } } test("should layout rtl with reverse correctly", root_node, root_layout); } [Test] public void TestCase9() { TestCSSNode root_node = new TestCSSNode(); { TestCSSNode node_0 = root_node; node_0.style.flexDirection = CSSFlexDirection.Row; node_0.style.dimensions[DIMENSION_WIDTH] = 1000; node_0.style.dimensions[DIMENSION_HEIGHT] = 1000; addChildren(node_0, 2); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.style.dimensions[DIMENSION_WIDTH] = 100; node_1.style.dimensions[DIMENSION_HEIGHT] = 200; node_1 = node_0.getChildAt(1); node_1.style.dimensions[DIMENSION_WIDTH] = 300; node_1.style.dimensions[DIMENSION_HEIGHT] = 150; } } TestCSSNode root_layout = new TestCSSNode(); { TestCSSNode node_0 = root_layout; node_0.layout.position[POSITION_TOP] = 0; node_0.layout.position[POSITION_LEFT] = 0; node_0.layout.dimensions[DIMENSION_WIDTH] = 1000; node_0.layout.dimensions[DIMENSION_HEIGHT] = 1000; addChildren(node_0, 2); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.layout.position[POSITION_TOP] = 0; node_1.layout.position[POSITION_LEFT] = 0; node_1.layout.dimensions[DIMENSION_WIDTH] = 100; node_1.layout.dimensions[DIMENSION_HEIGHT] = 200; node_1 = node_0.getChildAt(1); node_1.layout.position[POSITION_TOP] = 0; node_1.layout.position[POSITION_LEFT] = 100; node_1.layout.dimensions[DIMENSION_WIDTH] = 300; node_1.layout.dimensions[DIMENSION_HEIGHT] = 150; } } test("should layout node with row flex direction", root_node, root_layout); } [Test] public void TestCase10() { TestCSSNode root_node = new TestCSSNode(); { TestCSSNode node_0 = root_node; node_0.style.direction = CSSDirection.RTL; node_0.style.flexDirection = CSSFlexDirection.Row; node_0.style.dimensions[DIMENSION_WIDTH] = 1000; node_0.style.dimensions[DIMENSION_HEIGHT] = 1000; addChildren(node_0, 2); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.style.dimensions[DIMENSION_WIDTH] = 100; node_1.style.dimensions[DIMENSION_HEIGHT] = 200; node_1 = node_0.getChildAt(1); node_1.style.dimensions[DIMENSION_WIDTH] = 300; node_1.style.dimensions[DIMENSION_HEIGHT] = 150; } } TestCSSNode root_layout = new TestCSSNode(); { TestCSSNode node_0 = root_layout; node_0.layout.position[POSITION_TOP] = 0; node_0.layout.position[POSITION_LEFT] = 0; node_0.layout.dimensions[DIMENSION_WIDTH] = 1000; node_0.layout.dimensions[DIMENSION_HEIGHT] = 1000; addChildren(node_0, 2); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.layout.position[POSITION_TOP] = 0; node_1.layout.position[POSITION_LEFT] = 900; node_1.layout.dimensions[DIMENSION_WIDTH] = 100; node_1.layout.dimensions[DIMENSION_HEIGHT] = 200; node_1 = node_0.getChildAt(1); node_1.layout.position[POSITION_TOP] = 0; node_1.layout.position[POSITION_LEFT] = 600; node_1.layout.dimensions[DIMENSION_WIDTH] = 300; node_1.layout.dimensions[DIMENSION_HEIGHT] = 150; } } test("should layout node with row flex direction in rtl", root_node, root_layout); } [Test] public void TestCase11() { TestCSSNode root_node = new TestCSSNode(); { TestCSSNode node_0 = root_node; node_0.style.dimensions[DIMENSION_WIDTH] = 300; addChildren(node_0, 2); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.style.dimensions[DIMENSION_WIDTH] = 100; node_1.style.dimensions[DIMENSION_HEIGHT] = 200; node_1 = node_0.getChildAt(1); node_1.style.dimensions[DIMENSION_WIDTH] = 300; node_1.style.dimensions[DIMENSION_HEIGHT] = 150; } } TestCSSNode root_layout = new TestCSSNode(); { TestCSSNode node_0 = root_layout; node_0.layout.position[POSITION_TOP] = 0; node_0.layout.position[POSITION_LEFT] = 0; node_0.layout.dimensions[DIMENSION_WIDTH] = 300; node_0.layout.dimensions[DIMENSION_HEIGHT] = 350; addChildren(node_0, 2); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.layout.position[POSITION_TOP] = 0; node_1.layout.position[POSITION_LEFT] = 0; node_1.layout.dimensions[DIMENSION_WIDTH] = 100; node_1.layout.dimensions[DIMENSION_HEIGHT] = 200; node_1 = node_0.getChildAt(1); node_1.layout.position[POSITION_TOP] = 200; node_1.layout.position[POSITION_LEFT] = 0; node_1.layout.dimensions[DIMENSION_WIDTH] = 300; node_1.layout.dimensions[DIMENSION_HEIGHT] = 150; } } test("should layout node based on children main dimensions", root_node, root_layout); } [Test] public void TestCase12() { TestCSSNode root_node = new TestCSSNode(); { TestCSSNode node_0 = root_node; node_0.style.flexDirection = CSSFlexDirection.ColumnReverse; node_0.style.dimensions[DIMENSION_WIDTH] = 300; addChildren(node_0, 2); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.style.dimensions[DIMENSION_WIDTH] = 100; node_1.style.dimensions[DIMENSION_HEIGHT] = 200; node_1 = node_0.getChildAt(1); node_1.style.dimensions[DIMENSION_WIDTH] = 300; node_1.style.dimensions[DIMENSION_HEIGHT] = 150; } } TestCSSNode root_layout = new TestCSSNode(); { TestCSSNode node_0 = root_layout; node_0.layout.position[POSITION_TOP] = 0; node_0.layout.position[POSITION_LEFT] = 0; node_0.layout.dimensions[DIMENSION_WIDTH] = 300; node_0.layout.dimensions[DIMENSION_HEIGHT] = 350; addChildren(node_0, 2); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.layout.position[POSITION_TOP] = 150; node_1.layout.position[POSITION_LEFT] = 0; node_1.layout.dimensions[DIMENSION_WIDTH] = 100; node_1.layout.dimensions[DIMENSION_HEIGHT] = 200; node_1 = node_0.getChildAt(1); node_1.layout.position[POSITION_TOP] = 0; node_1.layout.position[POSITION_LEFT] = 0; node_1.layout.dimensions[DIMENSION_WIDTH] = 300; node_1.layout.dimensions[DIMENSION_HEIGHT] = 150; } } test("should layout node based on children main dimensions in reverse", root_node, root_layout); } [Test] public void TestCase13() { TestCSSNode root_node = new TestCSSNode(); { TestCSSNode node_0 = root_node; node_0.style.dimensions[DIMENSION_WIDTH] = 1000; node_0.style.dimensions[DIMENSION_HEIGHT] = 1000; addChildren(node_0, 2); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.style.dimensions[DIMENSION_WIDTH] = 100; node_1.style.dimensions[DIMENSION_HEIGHT] = 200; node_1 = node_0.getChildAt(1); node_1.style.flex = 1; node_1.style.dimensions[DIMENSION_WIDTH] = 100; } } TestCSSNode root_layout = new TestCSSNode(); { TestCSSNode node_0 = root_layout; node_0.layout.position[POSITION_TOP] = 0; node_0.layout.position[POSITION_LEFT] = 0; node_0.layout.dimensions[DIMENSION_WIDTH] = 1000; node_0.layout.dimensions[DIMENSION_HEIGHT] = 1000; addChildren(node_0, 2); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.layout.position[POSITION_TOP] = 0; node_1.layout.position[POSITION_LEFT] = 0; node_1.layout.dimensions[DIMENSION_WIDTH] = 100; node_1.layout.dimensions[DIMENSION_HEIGHT] = 200; node_1 = node_0.getChildAt(1); node_1.layout.position[POSITION_TOP] = 200; node_1.layout.position[POSITION_LEFT] = 0; node_1.layout.dimensions[DIMENSION_WIDTH] = 100; node_1.layout.dimensions[DIMENSION_HEIGHT] = 800; } } test("should layout node with just flex", root_node, root_layout); } [Test] public void TestCase14() { TestCSSNode root_node = new TestCSSNode(); { TestCSSNode node_0 = root_node; node_0.style.flexDirection = CSSFlexDirection.ColumnReverse; node_0.style.dimensions[DIMENSION_WIDTH] = 1000; node_0.style.dimensions[DIMENSION_HEIGHT] = 1000; addChildren(node_0, 2); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.style.dimensions[DIMENSION_WIDTH] = 100; node_1.style.dimensions[DIMENSION_HEIGHT] = 200; node_1 = node_0.getChildAt(1); node_1.style.flex = 1; node_1.style.dimensions[DIMENSION_WIDTH] = 100; } } TestCSSNode root_layout = new TestCSSNode(); { TestCSSNode node_0 = root_layout; node_0.layout.position[POSITION_TOP] = 0; node_0.layout.position[POSITION_LEFT] = 0; node_0.layout.dimensions[DIMENSION_WIDTH] = 1000; node_0.layout.dimensions[DIMENSION_HEIGHT] = 1000; addChildren(node_0, 2); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.layout.position[POSITION_TOP] = 800; node_1.layout.position[POSITION_LEFT] = 0; node_1.layout.dimensions[DIMENSION_WIDTH] = 100; node_1.layout.dimensions[DIMENSION_HEIGHT] = 200; node_1 = node_0.getChildAt(1); node_1.layout.position[POSITION_TOP] = 0; node_1.layout.position[POSITION_LEFT] = 0; node_1.layout.dimensions[DIMENSION_WIDTH] = 100; node_1.layout.dimensions[DIMENSION_HEIGHT] = 800; } } test("should layout node with just flex in reverse", root_node, root_layout); } [Test] public void TestCase15() { TestCSSNode root_node = new TestCSSNode(); { TestCSSNode node_0 = root_node; node_0.style.dimensions[DIMENSION_WIDTH] = 1000; node_0.style.dimensions[DIMENSION_HEIGHT] = 1000; addChildren(node_0, 1); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.style.flex = 1; node_1.style.dimensions[DIMENSION_WIDTH] = 1000; addChildren(node_1, 1); { TestCSSNode node_2; node_2 = node_1.getChildAt(0); node_2.style.flex = 1; node_2.style.dimensions[DIMENSION_WIDTH] = 1000; addChildren(node_2, 1); { TestCSSNode node_3; node_3 = node_2.getChildAt(0); node_3.style.flex = 1; node_3.style.dimensions[DIMENSION_WIDTH] = 1000; } } } } TestCSSNode root_layout = new TestCSSNode(); { TestCSSNode node_0 = root_layout; node_0.layout.position[POSITION_TOP] = 0; node_0.layout.position[POSITION_LEFT] = 0; node_0.layout.dimensions[DIMENSION_WIDTH] = 1000; node_0.layout.dimensions[DIMENSION_HEIGHT] = 1000; addChildren(node_0, 1); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.layout.position[POSITION_TOP] = 0; node_1.layout.position[POSITION_LEFT] = 0; node_1.layout.dimensions[DIMENSION_WIDTH] = 1000; node_1.layout.dimensions[DIMENSION_HEIGHT] = 1000; addChildren(node_1, 1); { TestCSSNode node_2; node_2 = node_1.getChildAt(0); node_2.layout.position[POSITION_TOP] = 0; node_2.layout.position[POSITION_LEFT] = 0; node_2.layout.dimensions[DIMENSION_WIDTH] = 1000; node_2.layout.dimensions[DIMENSION_HEIGHT] = 1000; addChildren(node_2, 1); { TestCSSNode node_3; node_3 = node_2.getChildAt(0); node_3.layout.position[POSITION_TOP] = 0; node_3.layout.position[POSITION_LEFT] = 0; node_3.layout.dimensions[DIMENSION_WIDTH] = 1000; node_3.layout.dimensions[DIMENSION_HEIGHT] = 1000; } } } } test("should layout node with flex recursively", root_node, root_layout); } [Test] public void TestCase16() { TestCSSNode root_node = new TestCSSNode(); { TestCSSNode node_0 = root_node; node_0.style.flexDirection = CSSFlexDirection.ColumnReverse; node_0.style.dimensions[DIMENSION_WIDTH] = 1000; node_0.style.dimensions[DIMENSION_HEIGHT] = 1000; addChildren(node_0, 1); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.style.flexDirection = CSSFlexDirection.ColumnReverse; node_1.style.flex = 1; node_1.style.dimensions[DIMENSION_WIDTH] = 1000; addChildren(node_1, 1); { TestCSSNode node_2; node_2 = node_1.getChildAt(0); node_2.style.flexDirection = CSSFlexDirection.ColumnReverse; node_2.style.flex = 1; node_2.style.dimensions[DIMENSION_WIDTH] = 1000; addChildren(node_2, 1); { TestCSSNode node_3; node_3 = node_2.getChildAt(0); node_3.style.flexDirection = CSSFlexDirection.ColumnReverse; node_3.style.flex = 1; node_3.style.dimensions[DIMENSION_WIDTH] = 1000; } } } } TestCSSNode root_layout = new TestCSSNode(); { TestCSSNode node_0 = root_layout; node_0.layout.position[POSITION_TOP] = 0; node_0.layout.position[POSITION_LEFT] = 0; node_0.layout.dimensions[DIMENSION_WIDTH] = 1000; node_0.layout.dimensions[DIMENSION_HEIGHT] = 1000; addChildren(node_0, 1); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.layout.position[POSITION_TOP] = 0; node_1.layout.position[POSITION_LEFT] = 0; node_1.layout.dimensions[DIMENSION_WIDTH] = 1000; node_1.layout.dimensions[DIMENSION_HEIGHT] = 1000; addChildren(node_1, 1); { TestCSSNode node_2; node_2 = node_1.getChildAt(0); node_2.layout.position[POSITION_TOP] = 0; node_2.layout.position[POSITION_LEFT] = 0; node_2.layout.dimensions[DIMENSION_WIDTH] = 1000; node_2.layout.dimensions[DIMENSION_HEIGHT] = 1000; addChildren(node_2, 1); { TestCSSNode node_3; node_3 = node_2.getChildAt(0); node_3.layout.position[POSITION_TOP] = 0; node_3.layout.position[POSITION_LEFT] = 0; node_3.layout.dimensions[DIMENSION_WIDTH] = 1000; node_3.layout.dimensions[DIMENSION_HEIGHT] = 1000; } } } } test("should layout node with flex recursively in reverse", root_node, root_layout); } [Test] public void TestCase17() { TestCSSNode root_node = new TestCSSNode(); { TestCSSNode node_0 = root_node; node_0.style.dimensions[DIMENSION_WIDTH] = 1000; node_0.style.dimensions[DIMENSION_HEIGHT] = 1000; node_0.setMargin(Spacing.LEFT, 5); node_0.setMargin(Spacing.TOP, 10); addChildren(node_0, 2); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.style.dimensions[DIMENSION_WIDTH] = 100; node_1.style.dimensions[DIMENSION_HEIGHT] = 100; node_1.setMargin(Spacing.LEFT, 15); node_1.setMargin(Spacing.TOP, 50); node_1.setMargin(Spacing.BOTTOM, 20); node_1 = node_0.getChildAt(1); node_1.style.dimensions[DIMENSION_WIDTH] = 100; node_1.style.dimensions[DIMENSION_HEIGHT] = 100; node_1.setMargin(Spacing.LEFT, 30); } } TestCSSNode root_layout = new TestCSSNode(); { TestCSSNode node_0 = root_layout; node_0.layout.position[POSITION_TOP] = 10; node_0.layout.position[POSITION_LEFT] = 5; node_0.layout.dimensions[DIMENSION_WIDTH] = 1000; node_0.layout.dimensions[DIMENSION_HEIGHT] = 1000; addChildren(node_0, 2); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.layout.position[POSITION_TOP] = 50; node_1.layout.position[POSITION_LEFT] = 15; node_1.layout.dimensions[DIMENSION_WIDTH] = 100; node_1.layout.dimensions[DIMENSION_HEIGHT] = 100; node_1 = node_0.getChildAt(1); node_1.layout.position[POSITION_TOP] = 170; node_1.layout.position[POSITION_LEFT] = 30; node_1.layout.dimensions[DIMENSION_WIDTH] = 100; node_1.layout.dimensions[DIMENSION_HEIGHT] = 100; } } test("should layout node with targeted margin", root_node, root_layout); } [Test] public void TestCase18() { TestCSSNode root_node = new TestCSSNode(); { TestCSSNode node_0 = root_node; node_0.style.flexDirection = CSSFlexDirection.ColumnReverse; node_0.style.dimensions[DIMENSION_WIDTH] = 1000; node_0.style.dimensions[DIMENSION_HEIGHT] = 1000; node_0.setMargin(Spacing.LEFT, 5); node_0.setMargin(Spacing.TOP, 10); addChildren(node_0, 2); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.style.dimensions[DIMENSION_WIDTH] = 100; node_1.style.dimensions[DIMENSION_HEIGHT] = 100; node_1.setMargin(Spacing.LEFT, 15); node_1.setMargin(Spacing.TOP, 50); node_1.setMargin(Spacing.BOTTOM, 20); node_1 = node_0.getChildAt(1); node_1.style.dimensions[DIMENSION_WIDTH] = 100; node_1.style.dimensions[DIMENSION_HEIGHT] = 100; node_1.setMargin(Spacing.LEFT, 30); } } TestCSSNode root_layout = new TestCSSNode(); { TestCSSNode node_0 = root_layout; node_0.layout.position[POSITION_TOP] = 10; node_0.layout.position[POSITION_LEFT] = 5; node_0.layout.dimensions[DIMENSION_WIDTH] = 1000; node_0.layout.dimensions[DIMENSION_HEIGHT] = 1000; addChildren(node_0, 2); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.layout.position[POSITION_TOP] = 880; node_1.layout.position[POSITION_LEFT] = 15; node_1.layout.dimensions[DIMENSION_WIDTH] = 100; node_1.layout.dimensions[DIMENSION_HEIGHT] = 100; node_1 = node_0.getChildAt(1); node_1.layout.position[POSITION_TOP] = 730; node_1.layout.position[POSITION_LEFT] = 30; node_1.layout.dimensions[DIMENSION_WIDTH] = 100; node_1.layout.dimensions[DIMENSION_HEIGHT] = 100; } } test("should layout node with targeted margin in reverse", root_node, root_layout); } [Test] public void TestCase19() { TestCSSNode root_node = new TestCSSNode(); { TestCSSNode node_0 = root_node; node_0.style.justifyContent = CSSJustify.FlexStart; node_0.style.dimensions[DIMENSION_WIDTH] = 1000; node_0.style.dimensions[DIMENSION_HEIGHT] = 1000; addChildren(node_0, 2); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.style.dimensions[DIMENSION_WIDTH] = 100; node_1.style.dimensions[DIMENSION_HEIGHT] = 100; node_1 = node_0.getChildAt(1); node_1.style.dimensions[DIMENSION_WIDTH] = 100; node_1.style.dimensions[DIMENSION_HEIGHT] = 100; } } TestCSSNode root_layout = new TestCSSNode(); { TestCSSNode node_0 = root_layout; node_0.layout.position[POSITION_TOP] = 0; node_0.layout.position[POSITION_LEFT] = 0; node_0.layout.dimensions[DIMENSION_WIDTH] = 1000; node_0.layout.dimensions[DIMENSION_HEIGHT] = 1000; addChildren(node_0, 2); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.layout.position[POSITION_TOP] = 0; node_1.layout.position[POSITION_LEFT] = 0; node_1.layout.dimensions[DIMENSION_WIDTH] = 100; node_1.layout.dimensions[DIMENSION_HEIGHT] = 100; node_1 = node_0.getChildAt(1); node_1.layout.position[POSITION_TOP] = 100; node_1.layout.position[POSITION_LEFT] = 0; node_1.layout.dimensions[DIMENSION_WIDTH] = 100; node_1.layout.dimensions[DIMENSION_HEIGHT] = 100; } } test("should layout node with justifyContent: flex-start", root_node, root_layout); } [Test] public void TestCase20() { TestCSSNode root_node = new TestCSSNode(); { TestCSSNode node_0 = root_node; node_0.style.flexDirection = CSSFlexDirection.ColumnReverse; node_0.style.justifyContent = CSSJustify.FlexStart; node_0.style.dimensions[DIMENSION_WIDTH] = 1000; node_0.style.dimensions[DIMENSION_HEIGHT] = 1000; addChildren(node_0, 2); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.style.dimensions[DIMENSION_WIDTH] = 100; node_1.style.dimensions[DIMENSION_HEIGHT] = 100; node_1 = node_0.getChildAt(1); node_1.style.dimensions[DIMENSION_WIDTH] = 100; node_1.style.dimensions[DIMENSION_HEIGHT] = 100; } } TestCSSNode root_layout = new TestCSSNode(); { TestCSSNode node_0 = root_layout; node_0.layout.position[POSITION_TOP] = 0; node_0.layout.position[POSITION_LEFT] = 0; node_0.layout.dimensions[DIMENSION_WIDTH] = 1000; node_0.layout.dimensions[DIMENSION_HEIGHT] = 1000; addChildren(node_0, 2); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.layout.position[POSITION_TOP] = 900; node_1.layout.position[POSITION_LEFT] = 0; node_1.layout.dimensions[DIMENSION_WIDTH] = 100; node_1.layout.dimensions[DIMENSION_HEIGHT] = 100; node_1 = node_0.getChildAt(1); node_1.layout.position[POSITION_TOP] = 800; node_1.layout.position[POSITION_LEFT] = 0; node_1.layout.dimensions[DIMENSION_WIDTH] = 100; node_1.layout.dimensions[DIMENSION_HEIGHT] = 100; } } test("should layout node with justifyContent: flex-start in reverse", root_node, root_layout); } [Test] public void TestCase21() { TestCSSNode root_node = new TestCSSNode(); { TestCSSNode node_0 = root_node; node_0.style.justifyContent = CSSJustify.FlexEnd; node_0.style.dimensions[DIMENSION_WIDTH] = 1000; node_0.style.dimensions[DIMENSION_HEIGHT] = 1000; addChildren(node_0, 2); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.style.dimensions[DIMENSION_WIDTH] = 100; node_1.style.dimensions[DIMENSION_HEIGHT] = 100; node_1 = node_0.getChildAt(1); node_1.style.dimensions[DIMENSION_WIDTH] = 100; node_1.style.dimensions[DIMENSION_HEIGHT] = 100; } } TestCSSNode root_layout = new TestCSSNode(); { TestCSSNode node_0 = root_layout; node_0.layout.position[POSITION_TOP] = 0; node_0.layout.position[POSITION_LEFT] = 0; node_0.layout.dimensions[DIMENSION_WIDTH] = 1000; node_0.layout.dimensions[DIMENSION_HEIGHT] = 1000; addChildren(node_0, 2); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.layout.position[POSITION_TOP] = 800; node_1.layout.position[POSITION_LEFT] = 0; node_1.layout.dimensions[DIMENSION_WIDTH] = 100; node_1.layout.dimensions[DIMENSION_HEIGHT] = 100; node_1 = node_0.getChildAt(1); node_1.layout.position[POSITION_TOP] = 900; node_1.layout.position[POSITION_LEFT] = 0; node_1.layout.dimensions[DIMENSION_WIDTH] = 100; node_1.layout.dimensions[DIMENSION_HEIGHT] = 100; } } test("should layout node with justifyContent: flex-end", root_node, root_layout); } [Test] public void TestCase22() { TestCSSNode root_node = new TestCSSNode(); { TestCSSNode node_0 = root_node; node_0.style.flexDirection = CSSFlexDirection.ColumnReverse; node_0.style.justifyContent = CSSJustify.FlexEnd; node_0.style.dimensions[DIMENSION_WIDTH] = 1000; node_0.style.dimensions[DIMENSION_HEIGHT] = 1000; addChildren(node_0, 2); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.style.dimensions[DIMENSION_WIDTH] = 100; node_1.style.dimensions[DIMENSION_HEIGHT] = 100; node_1 = node_0.getChildAt(1); node_1.style.dimensions[DIMENSION_WIDTH] = 100; node_1.style.dimensions[DIMENSION_HEIGHT] = 100; } } TestCSSNode root_layout = new TestCSSNode(); { TestCSSNode node_0 = root_layout; node_0.layout.position[POSITION_TOP] = 0; node_0.layout.position[POSITION_LEFT] = 0; node_0.layout.dimensions[DIMENSION_WIDTH] = 1000; node_0.layout.dimensions[DIMENSION_HEIGHT] = 1000; addChildren(node_0, 2); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.layout.position[POSITION_TOP] = 100; node_1.layout.position[POSITION_LEFT] = 0; node_1.layout.dimensions[DIMENSION_WIDTH] = 100; node_1.layout.dimensions[DIMENSION_HEIGHT] = 100; node_1 = node_0.getChildAt(1); node_1.layout.position[POSITION_TOP] = 0; node_1.layout.position[POSITION_LEFT] = 0; node_1.layout.dimensions[DIMENSION_WIDTH] = 100; node_1.layout.dimensions[DIMENSION_HEIGHT] = 100; } } test("should layout node with justifyContent: flex-end in reverse", root_node, root_layout); } [Test] public void TestCase23() { TestCSSNode root_node = new TestCSSNode(); { TestCSSNode node_0 = root_node; node_0.style.justifyContent = CSSJustify.SpaceBetween; node_0.style.dimensions[DIMENSION_WIDTH] = 1000; node_0.style.dimensions[DIMENSION_HEIGHT] = 1000; addChildren(node_0, 2); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.style.dimensions[DIMENSION_WIDTH] = 100; node_1.style.dimensions[DIMENSION_HEIGHT] = 100; node_1 = node_0.getChildAt(1); node_1.style.dimensions[DIMENSION_WIDTH] = 100; node_1.style.dimensions[DIMENSION_HEIGHT] = 100; } } TestCSSNode root_layout = new TestCSSNode(); { TestCSSNode node_0 = root_layout; node_0.layout.position[POSITION_TOP] = 0; node_0.layout.position[POSITION_LEFT] = 0; node_0.layout.dimensions[DIMENSION_WIDTH] = 1000; node_0.layout.dimensions[DIMENSION_HEIGHT] = 1000; addChildren(node_0, 2); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.layout.position[POSITION_TOP] = 0; node_1.layout.position[POSITION_LEFT] = 0; node_1.layout.dimensions[DIMENSION_WIDTH] = 100; node_1.layout.dimensions[DIMENSION_HEIGHT] = 100; node_1 = node_0.getChildAt(1); node_1.layout.position[POSITION_TOP] = 900; node_1.layout.position[POSITION_LEFT] = 0; node_1.layout.dimensions[DIMENSION_WIDTH] = 100; node_1.layout.dimensions[DIMENSION_HEIGHT] = 100; } } test("should layout node with justifyContent: space-between", root_node, root_layout); } [Test] public void TestCase24() { TestCSSNode root_node = new TestCSSNode(); { TestCSSNode node_0 = root_node; node_0.style.flexDirection = CSSFlexDirection.ColumnReverse; node_0.style.justifyContent = CSSJustify.SpaceBetween; node_0.style.dimensions[DIMENSION_WIDTH] = 1000; node_0.style.dimensions[DIMENSION_HEIGHT] = 1000; addChildren(node_0, 2); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.style.dimensions[DIMENSION_WIDTH] = 100; node_1.style.dimensions[DIMENSION_HEIGHT] = 100; node_1 = node_0.getChildAt(1); node_1.style.dimensions[DIMENSION_WIDTH] = 100; node_1.style.dimensions[DIMENSION_HEIGHT] = 100; } } TestCSSNode root_layout = new TestCSSNode(); { TestCSSNode node_0 = root_layout; node_0.layout.position[POSITION_TOP] = 0; node_0.layout.position[POSITION_LEFT] = 0; node_0.layout.dimensions[DIMENSION_WIDTH] = 1000; node_0.layout.dimensions[DIMENSION_HEIGHT] = 1000; addChildren(node_0, 2); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.layout.position[POSITION_TOP] = 900; node_1.layout.position[POSITION_LEFT] = 0; node_1.layout.dimensions[DIMENSION_WIDTH] = 100; node_1.layout.dimensions[DIMENSION_HEIGHT] = 100; node_1 = node_0.getChildAt(1); node_1.layout.position[POSITION_TOP] = 0; node_1.layout.position[POSITION_LEFT] = 0; node_1.layout.dimensions[DIMENSION_WIDTH] = 100; node_1.layout.dimensions[DIMENSION_HEIGHT] = 100; } } test("should layout node with justifyContent: space-between in reverse", root_node, root_layout); } [Test] public void TestCase25() { TestCSSNode root_node = new TestCSSNode(); { TestCSSNode node_0 = root_node; node_0.style.justifyContent = CSSJustify.SpaceAround; node_0.style.dimensions[DIMENSION_WIDTH] = 1000; node_0.style.dimensions[DIMENSION_HEIGHT] = 1000; addChildren(node_0, 2); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.style.dimensions[DIMENSION_WIDTH] = 100; node_1.style.dimensions[DIMENSION_HEIGHT] = 100; node_1 = node_0.getChildAt(1); node_1.style.dimensions[DIMENSION_WIDTH] = 100; node_1.style.dimensions[DIMENSION_HEIGHT] = 100; } } TestCSSNode root_layout = new TestCSSNode(); { TestCSSNode node_0 = root_layout; node_0.layout.position[POSITION_TOP] = 0; node_0.layout.position[POSITION_LEFT] = 0; node_0.layout.dimensions[DIMENSION_WIDTH] = 1000; node_0.layout.dimensions[DIMENSION_HEIGHT] = 1000; addChildren(node_0, 2); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.layout.position[POSITION_TOP] = 200; node_1.layout.position[POSITION_LEFT] = 0; node_1.layout.dimensions[DIMENSION_WIDTH] = 100; node_1.layout.dimensions[DIMENSION_HEIGHT] = 100; node_1 = node_0.getChildAt(1); node_1.layout.position[POSITION_TOP] = 700; node_1.layout.position[POSITION_LEFT] = 0; node_1.layout.dimensions[DIMENSION_WIDTH] = 100; node_1.layout.dimensions[DIMENSION_HEIGHT] = 100; } } test("should layout node with justifyContent: space-around", root_node, root_layout); } [Test] public void TestCase26() { TestCSSNode root_node = new TestCSSNode(); { TestCSSNode node_0 = root_node; node_0.style.flexDirection = CSSFlexDirection.ColumnReverse; node_0.style.justifyContent = CSSJustify.SpaceAround; node_0.style.dimensions[DIMENSION_WIDTH] = 1000; node_0.style.dimensions[DIMENSION_HEIGHT] = 1000; addChildren(node_0, 2); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.style.dimensions[DIMENSION_WIDTH] = 100; node_1.style.dimensions[DIMENSION_HEIGHT] = 100; node_1 = node_0.getChildAt(1); node_1.style.dimensions[DIMENSION_WIDTH] = 100; node_1.style.dimensions[DIMENSION_HEIGHT] = 100; } } TestCSSNode root_layout = new TestCSSNode(); { TestCSSNode node_0 = root_layout; node_0.layout.position[POSITION_TOP] = 0; node_0.layout.position[POSITION_LEFT] = 0; node_0.layout.dimensions[DIMENSION_WIDTH] = 1000; node_0.layout.dimensions[DIMENSION_HEIGHT] = 1000; addChildren(node_0, 2); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.layout.position[POSITION_TOP] = 700; node_1.layout.position[POSITION_LEFT] = 0; node_1.layout.dimensions[DIMENSION_WIDTH] = 100; node_1.layout.dimensions[DIMENSION_HEIGHT] = 100; node_1 = node_0.getChildAt(1); node_1.layout.position[POSITION_TOP] = 200; node_1.layout.position[POSITION_LEFT] = 0; node_1.layout.dimensions[DIMENSION_WIDTH] = 100; node_1.layout.dimensions[DIMENSION_HEIGHT] = 100; } } test("should layout node with justifyContent: space-around in reverse", root_node, root_layout); } [Test] public void TestCase27() { TestCSSNode root_node = new TestCSSNode(); { TestCSSNode node_0 = root_node; node_0.style.justifyContent = CSSJustify.Center; node_0.style.dimensions[DIMENSION_WIDTH] = 1000; node_0.style.dimensions[DIMENSION_HEIGHT] = 1000; addChildren(node_0, 2); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.style.dimensions[DIMENSION_WIDTH] = 100; node_1.style.dimensions[DIMENSION_HEIGHT] = 100; node_1 = node_0.getChildAt(1); node_1.style.dimensions[DIMENSION_WIDTH] = 100; node_1.style.dimensions[DIMENSION_HEIGHT] = 100; } } TestCSSNode root_layout = new TestCSSNode(); { TestCSSNode node_0 = root_layout; node_0.layout.position[POSITION_TOP] = 0; node_0.layout.position[POSITION_LEFT] = 0; node_0.layout.dimensions[DIMENSION_WIDTH] = 1000; node_0.layout.dimensions[DIMENSION_HEIGHT] = 1000; addChildren(node_0, 2); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.layout.position[POSITION_TOP] = 400; node_1.layout.position[POSITION_LEFT] = 0; node_1.layout.dimensions[DIMENSION_WIDTH] = 100; node_1.layout.dimensions[DIMENSION_HEIGHT] = 100; node_1 = node_0.getChildAt(1); node_1.layout.position[POSITION_TOP] = 500; node_1.layout.position[POSITION_LEFT] = 0; node_1.layout.dimensions[DIMENSION_WIDTH] = 100; node_1.layout.dimensions[DIMENSION_HEIGHT] = 100; } } test("should layout node with justifyContent: center", root_node, root_layout); } [Test] public void TestCase28() { TestCSSNode root_node = new TestCSSNode(); { TestCSSNode node_0 = root_node; node_0.style.flexDirection = CSSFlexDirection.ColumnReverse; node_0.style.justifyContent = CSSJustify.Center; node_0.style.dimensions[DIMENSION_WIDTH] = 1000; node_0.style.dimensions[DIMENSION_HEIGHT] = 1000; addChildren(node_0, 2); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.style.dimensions[DIMENSION_WIDTH] = 100; node_1.style.dimensions[DIMENSION_HEIGHT] = 100; node_1 = node_0.getChildAt(1); node_1.style.dimensions[DIMENSION_WIDTH] = 100; node_1.style.dimensions[DIMENSION_HEIGHT] = 100; } } TestCSSNode root_layout = new TestCSSNode(); { TestCSSNode node_0 = root_layout; node_0.layout.position[POSITION_TOP] = 0; node_0.layout.position[POSITION_LEFT] = 0; node_0.layout.dimensions[DIMENSION_WIDTH] = 1000; node_0.layout.dimensions[DIMENSION_HEIGHT] = 1000; addChildren(node_0, 2); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.layout.position[POSITION_TOP] = 500; node_1.layout.position[POSITION_LEFT] = 0; node_1.layout.dimensions[DIMENSION_WIDTH] = 100; node_1.layout.dimensions[DIMENSION_HEIGHT] = 100; node_1 = node_0.getChildAt(1); node_1.layout.position[POSITION_TOP] = 400; node_1.layout.position[POSITION_LEFT] = 0; node_1.layout.dimensions[DIMENSION_WIDTH] = 100; node_1.layout.dimensions[DIMENSION_HEIGHT] = 100; } } test("should layout node with justifyContent: center in reverse", root_node, root_layout); } [Test] public void TestCase29() { TestCSSNode root_node = new TestCSSNode(); { TestCSSNode node_0 = root_node; node_0.style.dimensions[DIMENSION_WIDTH] = 1000; node_0.style.dimensions[DIMENSION_HEIGHT] = 1000; addChildren(node_0, 1); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.style.flex = 1; node_1.style.dimensions[DIMENSION_WIDTH] = 100; node_1.style.dimensions[DIMENSION_HEIGHT] = 100; } } TestCSSNode root_layout = new TestCSSNode(); { TestCSSNode node_0 = root_layout; node_0.layout.position[POSITION_TOP] = 0; node_0.layout.position[POSITION_LEFT] = 0; node_0.layout.dimensions[DIMENSION_WIDTH] = 1000; node_0.layout.dimensions[DIMENSION_HEIGHT] = 1000; addChildren(node_0, 1); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.layout.position[POSITION_TOP] = 0; node_1.layout.position[POSITION_LEFT] = 0; node_1.layout.dimensions[DIMENSION_WIDTH] = 100; node_1.layout.dimensions[DIMENSION_HEIGHT] = 1000; } } test("should layout node with flex override height", root_node, root_layout); } [Test] public void TestCase30() { TestCSSNode root_node = new TestCSSNode(); { TestCSSNode node_0 = root_node; node_0.style.alignItems = CSSAlign.FlexStart; node_0.style.dimensions[DIMENSION_WIDTH] = 1000; node_0.style.dimensions[DIMENSION_HEIGHT] = 1000; addChildren(node_0, 2); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.style.dimensions[DIMENSION_WIDTH] = 200; node_1.style.dimensions[DIMENSION_HEIGHT] = 100; node_1 = node_0.getChildAt(1); node_1.style.dimensions[DIMENSION_WIDTH] = 100; node_1.style.dimensions[DIMENSION_HEIGHT] = 100; } } TestCSSNode root_layout = new TestCSSNode(); { TestCSSNode node_0 = root_layout; node_0.layout.position[POSITION_TOP] = 0; node_0.layout.position[POSITION_LEFT] = 0; node_0.layout.dimensions[DIMENSION_WIDTH] = 1000; node_0.layout.dimensions[DIMENSION_HEIGHT] = 1000; addChildren(node_0, 2); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.layout.position[POSITION_TOP] = 0; node_1.layout.position[POSITION_LEFT] = 0; node_1.layout.dimensions[DIMENSION_WIDTH] = 200; node_1.layout.dimensions[DIMENSION_HEIGHT] = 100; node_1 = node_0.getChildAt(1); node_1.layout.position[POSITION_TOP] = 100; node_1.layout.position[POSITION_LEFT] = 0; node_1.layout.dimensions[DIMENSION_WIDTH] = 100; node_1.layout.dimensions[DIMENSION_HEIGHT] = 100; } } test("should layout node with alignItems: flex-start", root_node, root_layout); } [Test] public void TestCase31() { TestCSSNode root_node = new TestCSSNode(); { TestCSSNode node_0 = root_node; node_0.style.flexDirection = CSSFlexDirection.ColumnReverse; node_0.style.alignItems = CSSAlign.FlexStart; node_0.style.dimensions[DIMENSION_WIDTH] = 1000; node_0.style.dimensions[DIMENSION_HEIGHT] = 1000; addChildren(node_0, 2); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.style.dimensions[DIMENSION_WIDTH] = 200; node_1.style.dimensions[DIMENSION_HEIGHT] = 100; node_1 = node_0.getChildAt(1); node_1.style.dimensions[DIMENSION_WIDTH] = 100; node_1.style.dimensions[DIMENSION_HEIGHT] = 100; } } TestCSSNode root_layout = new TestCSSNode(); { TestCSSNode node_0 = root_layout; node_0.layout.position[POSITION_TOP] = 0; node_0.layout.position[POSITION_LEFT] = 0; node_0.layout.dimensions[DIMENSION_WIDTH] = 1000; node_0.layout.dimensions[DIMENSION_HEIGHT] = 1000; addChildren(node_0, 2); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.layout.position[POSITION_TOP] = 900; node_1.layout.position[POSITION_LEFT] = 0; node_1.layout.dimensions[DIMENSION_WIDTH] = 200; node_1.layout.dimensions[DIMENSION_HEIGHT] = 100; node_1 = node_0.getChildAt(1); node_1.layout.position[POSITION_TOP] = 800; node_1.layout.position[POSITION_LEFT] = 0; node_1.layout.dimensions[DIMENSION_WIDTH] = 100; node_1.layout.dimensions[DIMENSION_HEIGHT] = 100; } } test("should layout node with alignItems: flex-start in reverse", root_node, root_layout); } [Test] public void TestCase32() { TestCSSNode root_node = new TestCSSNode(); { TestCSSNode node_0 = root_node; node_0.style.alignItems = CSSAlign.Center; node_0.style.dimensions[DIMENSION_WIDTH] = 1000; node_0.style.dimensions[DIMENSION_HEIGHT] = 1000; addChildren(node_0, 2); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.style.dimensions[DIMENSION_WIDTH] = 200; node_1.style.dimensions[DIMENSION_HEIGHT] = 100; node_1 = node_0.getChildAt(1); node_1.style.dimensions[DIMENSION_WIDTH] = 100; node_1.style.dimensions[DIMENSION_HEIGHT] = 100; } } TestCSSNode root_layout = new TestCSSNode(); { TestCSSNode node_0 = root_layout; node_0.layout.position[POSITION_TOP] = 0; node_0.layout.position[POSITION_LEFT] = 0; node_0.layout.dimensions[DIMENSION_WIDTH] = 1000; node_0.layout.dimensions[DIMENSION_HEIGHT] = 1000; addChildren(node_0, 2); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.layout.position[POSITION_TOP] = 0; node_1.layout.position[POSITION_LEFT] = 400; node_1.layout.dimensions[DIMENSION_WIDTH] = 200; node_1.layout.dimensions[DIMENSION_HEIGHT] = 100; node_1 = node_0.getChildAt(1); node_1.layout.position[POSITION_TOP] = 100; node_1.layout.position[POSITION_LEFT] = 450; node_1.layout.dimensions[DIMENSION_WIDTH] = 100; node_1.layout.dimensions[DIMENSION_HEIGHT] = 100; } } test("should layout node with alignItems: center", root_node, root_layout); } [Test] public void TestCase33() { TestCSSNode root_node = new TestCSSNode(); { TestCSSNode node_0 = root_node; node_0.style.flexDirection = CSSFlexDirection.ColumnReverse; node_0.style.alignItems = CSSAlign.Center; node_0.style.dimensions[DIMENSION_WIDTH] = 1000; node_0.style.dimensions[DIMENSION_HEIGHT] = 1000; addChildren(node_0, 2); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.style.dimensions[DIMENSION_WIDTH] = 200; node_1.style.dimensions[DIMENSION_HEIGHT] = 100; node_1 = node_0.getChildAt(1); node_1.style.dimensions[DIMENSION_WIDTH] = 100; node_1.style.dimensions[DIMENSION_HEIGHT] = 100; } } TestCSSNode root_layout = new TestCSSNode(); { TestCSSNode node_0 = root_layout; node_0.layout.position[POSITION_TOP] = 0; node_0.layout.position[POSITION_LEFT] = 0; node_0.layout.dimensions[DIMENSION_WIDTH] = 1000; node_0.layout.dimensions[DIMENSION_HEIGHT] = 1000; addChildren(node_0, 2); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.layout.position[POSITION_TOP] = 900; node_1.layout.position[POSITION_LEFT] = 400; node_1.layout.dimensions[DIMENSION_WIDTH] = 200; node_1.layout.dimensions[DIMENSION_HEIGHT] = 100; node_1 = node_0.getChildAt(1); node_1.layout.position[POSITION_TOP] = 800; node_1.layout.position[POSITION_LEFT] = 450; node_1.layout.dimensions[DIMENSION_WIDTH] = 100; node_1.layout.dimensions[DIMENSION_HEIGHT] = 100; } } test("should layout node with alignItems: center in reverse", root_node, root_layout); } [Test] public void TestCase34() { TestCSSNode root_node = new TestCSSNode(); { TestCSSNode node_0 = root_node; node_0.style.alignItems = CSSAlign.FlexEnd; node_0.style.dimensions[DIMENSION_WIDTH] = 1000; node_0.style.dimensions[DIMENSION_HEIGHT] = 1000; addChildren(node_0, 2); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.style.dimensions[DIMENSION_WIDTH] = 200; node_1.style.dimensions[DIMENSION_HEIGHT] = 100; node_1 = node_0.getChildAt(1); node_1.style.dimensions[DIMENSION_WIDTH] = 100; node_1.style.dimensions[DIMENSION_HEIGHT] = 100; } } TestCSSNode root_layout = new TestCSSNode(); { TestCSSNode node_0 = root_layout; node_0.layout.position[POSITION_TOP] = 0; node_0.layout.position[POSITION_LEFT] = 0; node_0.layout.dimensions[DIMENSION_WIDTH] = 1000; node_0.layout.dimensions[DIMENSION_HEIGHT] = 1000; addChildren(node_0, 2); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.layout.position[POSITION_TOP] = 0; node_1.layout.position[POSITION_LEFT] = 800; node_1.layout.dimensions[DIMENSION_WIDTH] = 200; node_1.layout.dimensions[DIMENSION_HEIGHT] = 100; node_1 = node_0.getChildAt(1); node_1.layout.position[POSITION_TOP] = 100; node_1.layout.position[POSITION_LEFT] = 900; node_1.layout.dimensions[DIMENSION_WIDTH] = 100; node_1.layout.dimensions[DIMENSION_HEIGHT] = 100; } } test("should layout node with alignItems: flex-end", root_node, root_layout); } [Test] public void TestCase35() { TestCSSNode root_node = new TestCSSNode(); { TestCSSNode node_0 = root_node; node_0.style.flexDirection = CSSFlexDirection.ColumnReverse; node_0.style.alignItems = CSSAlign.FlexEnd; node_0.style.dimensions[DIMENSION_WIDTH] = 1000; node_0.style.dimensions[DIMENSION_HEIGHT] = 1000; addChildren(node_0, 2); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.style.dimensions[DIMENSION_WIDTH] = 200; node_1.style.dimensions[DIMENSION_HEIGHT] = 100; node_1 = node_0.getChildAt(1); node_1.style.dimensions[DIMENSION_WIDTH] = 100; node_1.style.dimensions[DIMENSION_HEIGHT] = 100; } } TestCSSNode root_layout = new TestCSSNode(); { TestCSSNode node_0 = root_layout; node_0.layout.position[POSITION_TOP] = 0; node_0.layout.position[POSITION_LEFT] = 0; node_0.layout.dimensions[DIMENSION_WIDTH] = 1000; node_0.layout.dimensions[DIMENSION_HEIGHT] = 1000; addChildren(node_0, 2); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.layout.position[POSITION_TOP] = 900; node_1.layout.position[POSITION_LEFT] = 800; node_1.layout.dimensions[DIMENSION_WIDTH] = 200; node_1.layout.dimensions[DIMENSION_HEIGHT] = 100; node_1 = node_0.getChildAt(1); node_1.layout.position[POSITION_TOP] = 800; node_1.layout.position[POSITION_LEFT] = 900; node_1.layout.dimensions[DIMENSION_WIDTH] = 100; node_1.layout.dimensions[DIMENSION_HEIGHT] = 100; } } test("should layout node with alignItems: flex-end in reverse", root_node, root_layout); } [Test] public void TestCase36() { TestCSSNode root_node = new TestCSSNode(); { TestCSSNode node_0 = root_node; node_0.style.alignItems = CSSAlign.FlexEnd; node_0.style.dimensions[DIMENSION_WIDTH] = 1000; node_0.style.dimensions[DIMENSION_HEIGHT] = 1000; addChildren(node_0, 2); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.style.dimensions[DIMENSION_WIDTH] = 200; node_1.style.dimensions[DIMENSION_HEIGHT] = 100; node_1 = node_0.getChildAt(1); node_1.style.alignSelf = CSSAlign.Center; node_1.style.dimensions[DIMENSION_WIDTH] = 100; node_1.style.dimensions[DIMENSION_HEIGHT] = 100; } } TestCSSNode root_layout = new TestCSSNode(); { TestCSSNode node_0 = root_layout; node_0.layout.position[POSITION_TOP] = 0; node_0.layout.position[POSITION_LEFT] = 0; node_0.layout.dimensions[DIMENSION_WIDTH] = 1000; node_0.layout.dimensions[DIMENSION_HEIGHT] = 1000; addChildren(node_0, 2); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.layout.position[POSITION_TOP] = 0; node_1.layout.position[POSITION_LEFT] = 800; node_1.layout.dimensions[DIMENSION_WIDTH] = 200; node_1.layout.dimensions[DIMENSION_HEIGHT] = 100; node_1 = node_0.getChildAt(1); node_1.layout.position[POSITION_TOP] = 100; node_1.layout.position[POSITION_LEFT] = 450; node_1.layout.dimensions[DIMENSION_WIDTH] = 100; node_1.layout.dimensions[DIMENSION_HEIGHT] = 100; } } test("should layout node with alignSelf overrides alignItems", root_node, root_layout); } [Test] public void TestCase37() { TestCSSNode root_node = new TestCSSNode(); { TestCSSNode node_0 = root_node; node_0.style.flexDirection = CSSFlexDirection.ColumnReverse; node_0.style.alignItems = CSSAlign.FlexEnd; node_0.style.dimensions[DIMENSION_WIDTH] = 1000; node_0.style.dimensions[DIMENSION_HEIGHT] = 1000; addChildren(node_0, 2); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.style.dimensions[DIMENSION_WIDTH] = 200; node_1.style.dimensions[DIMENSION_HEIGHT] = 100; node_1 = node_0.getChildAt(1); node_1.style.alignSelf = CSSAlign.Center; node_1.style.dimensions[DIMENSION_WIDTH] = 100; node_1.style.dimensions[DIMENSION_HEIGHT] = 100; } } TestCSSNode root_layout = new TestCSSNode(); { TestCSSNode node_0 = root_layout; node_0.layout.position[POSITION_TOP] = 0; node_0.layout.position[POSITION_LEFT] = 0; node_0.layout.dimensions[DIMENSION_WIDTH] = 1000; node_0.layout.dimensions[DIMENSION_HEIGHT] = 1000; addChildren(node_0, 2); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.layout.position[POSITION_TOP] = 900; node_1.layout.position[POSITION_LEFT] = 800; node_1.layout.dimensions[DIMENSION_WIDTH] = 200; node_1.layout.dimensions[DIMENSION_HEIGHT] = 100; node_1 = node_0.getChildAt(1); node_1.layout.position[POSITION_TOP] = 800; node_1.layout.position[POSITION_LEFT] = 450; node_1.layout.dimensions[DIMENSION_WIDTH] = 100; node_1.layout.dimensions[DIMENSION_HEIGHT] = 100; } } test("should layout node with alignSelf overrides alignItems in reverse", root_node, root_layout); } [Test] public void TestCase38() { TestCSSNode root_node = new TestCSSNode(); { TestCSSNode node_0 = root_node; node_0.style.alignItems = CSSAlign.Stretch; node_0.style.dimensions[DIMENSION_WIDTH] = 1000; node_0.style.dimensions[DIMENSION_HEIGHT] = 1000; addChildren(node_0, 1); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.style.dimensions[DIMENSION_HEIGHT] = 100; } } TestCSSNode root_layout = new TestCSSNode(); { TestCSSNode node_0 = root_layout; node_0.layout.position[POSITION_TOP] = 0; node_0.layout.position[POSITION_LEFT] = 0; node_0.layout.dimensions[DIMENSION_WIDTH] = 1000; node_0.layout.dimensions[DIMENSION_HEIGHT] = 1000; addChildren(node_0, 1); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.layout.position[POSITION_TOP] = 0; node_1.layout.position[POSITION_LEFT] = 0; node_1.layout.dimensions[DIMENSION_WIDTH] = 1000; node_1.layout.dimensions[DIMENSION_HEIGHT] = 100; } } test("should layout node with alignItem: stretch", root_node, root_layout); } [Test] public void TestCase39() { TestCSSNode root_node = new TestCSSNode(); { TestCSSNode node_0 = root_node; node_0.style.flexDirection = CSSFlexDirection.ColumnReverse; node_0.style.alignItems = CSSAlign.Stretch; node_0.style.dimensions[DIMENSION_WIDTH] = 1000; node_0.style.dimensions[DIMENSION_HEIGHT] = 1000; addChildren(node_0, 1); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.style.dimensions[DIMENSION_HEIGHT] = 100; } } TestCSSNode root_layout = new TestCSSNode(); { TestCSSNode node_0 = root_layout; node_0.layout.position[POSITION_TOP] = 0; node_0.layout.position[POSITION_LEFT] = 0; node_0.layout.dimensions[DIMENSION_WIDTH] = 1000; node_0.layout.dimensions[DIMENSION_HEIGHT] = 1000; addChildren(node_0, 1); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.layout.position[POSITION_TOP] = 900; node_1.layout.position[POSITION_LEFT] = 0; node_1.layout.dimensions[DIMENSION_WIDTH] = 1000; node_1.layout.dimensions[DIMENSION_HEIGHT] = 100; } } test("should layout node with alignItem: stretch in reverse", root_node, root_layout); } [Test] public void TestCase40() { TestCSSNode root_node = new TestCSSNode(); { TestCSSNode node_0 = root_node; addChildren(node_0, 1); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); } } TestCSSNode root_layout = new TestCSSNode(); { TestCSSNode node_0 = root_layout; node_0.layout.position[POSITION_TOP] = 0; node_0.layout.position[POSITION_LEFT] = 0; node_0.layout.dimensions[DIMENSION_WIDTH] = 0; node_0.layout.dimensions[DIMENSION_HEIGHT] = 0; addChildren(node_0, 1); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.layout.position[POSITION_TOP] = 0; node_1.layout.position[POSITION_LEFT] = 0; node_1.layout.dimensions[DIMENSION_WIDTH] = 0; node_1.layout.dimensions[DIMENSION_HEIGHT] = 0; } } test("should layout empty node", root_node, root_layout); } [Test] public void TestCase41() { TestCSSNode root_node = new TestCSSNode(); { TestCSSNode node_0 = root_node; node_0.style.flexDirection = CSSFlexDirection.ColumnReverse; addChildren(node_0, 1); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); } } TestCSSNode root_layout = new TestCSSNode(); { TestCSSNode node_0 = root_layout; node_0.layout.position[POSITION_TOP] = 0; node_0.layout.position[POSITION_LEFT] = 0; node_0.layout.dimensions[DIMENSION_WIDTH] = 0; node_0.layout.dimensions[DIMENSION_HEIGHT] = 0; addChildren(node_0, 1); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.layout.position[POSITION_TOP] = 0; node_1.layout.position[POSITION_LEFT] = 0; node_1.layout.dimensions[DIMENSION_WIDTH] = 0; node_1.layout.dimensions[DIMENSION_HEIGHT] = 0; } } test("should layout empty node in reverse", root_node, root_layout); } [Test] public void TestCase42() { TestCSSNode root_node = new TestCSSNode(); { TestCSSNode node_0 = root_node; addChildren(node_0, 1); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.setMargin(Spacing.LEFT, 5); node_1.setMargin(Spacing.TOP, 5); node_1.setMargin(Spacing.RIGHT, 5); node_1.setMargin(Spacing.BOTTOM, 5); node_1.setMargin(Spacing.START, 5); node_1.setMargin(Spacing.END, 5); } } TestCSSNode root_layout = new TestCSSNode(); { TestCSSNode node_0 = root_layout; node_0.layout.position[POSITION_TOP] = 0; node_0.layout.position[POSITION_LEFT] = 0; node_0.layout.dimensions[DIMENSION_WIDTH] = 10; node_0.layout.dimensions[DIMENSION_HEIGHT] = 10; addChildren(node_0, 1); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.layout.position[POSITION_TOP] = 5; node_1.layout.position[POSITION_LEFT] = 5; node_1.layout.dimensions[DIMENSION_WIDTH] = 0; node_1.layout.dimensions[DIMENSION_HEIGHT] = 0; } } test("should layout child with margin", root_node, root_layout); } [Test] public void TestCase43() { TestCSSNode root_node = new TestCSSNode(); { TestCSSNode node_0 = root_node; node_0.style.flexDirection = CSSFlexDirection.ColumnReverse; addChildren(node_0, 1); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.setMargin(Spacing.LEFT, 5); node_1.setMargin(Spacing.TOP, 5); node_1.setMargin(Spacing.RIGHT, 5); node_1.setMargin(Spacing.BOTTOM, 5); node_1.setMargin(Spacing.START, 5); node_1.setMargin(Spacing.END, 5); } } TestCSSNode root_layout = new TestCSSNode(); { TestCSSNode node_0 = root_layout; node_0.layout.position[POSITION_TOP] = 0; node_0.layout.position[POSITION_LEFT] = 0; node_0.layout.dimensions[DIMENSION_WIDTH] = 10; node_0.layout.dimensions[DIMENSION_HEIGHT] = 10; addChildren(node_0, 1); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.layout.position[POSITION_TOP] = 5; node_1.layout.position[POSITION_LEFT] = 5; node_1.layout.dimensions[DIMENSION_WIDTH] = 0; node_1.layout.dimensions[DIMENSION_HEIGHT] = 0; } } test("should layout child with margin in reverse", root_node, root_layout); } [Test] public void TestCase44() { TestCSSNode root_node = new TestCSSNode(); { TestCSSNode node_0 = root_node; node_0.style.dimensions[DIMENSION_HEIGHT] = 100; addChildren(node_0, 2); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.style.dimensions[DIMENSION_HEIGHT] = 100; node_1 = node_0.getChildAt(1); node_1.style.dimensions[DIMENSION_HEIGHT] = 200; } } TestCSSNode root_layout = new TestCSSNode(); { TestCSSNode node_0 = root_layout; node_0.layout.position[POSITION_TOP] = 0; node_0.layout.position[POSITION_LEFT] = 0; node_0.layout.dimensions[DIMENSION_WIDTH] = 0; node_0.layout.dimensions[DIMENSION_HEIGHT] = 100; addChildren(node_0, 2); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.layout.position[POSITION_TOP] = 0; node_1.layout.position[POSITION_LEFT] = 0; node_1.layout.dimensions[DIMENSION_WIDTH] = 0; node_1.layout.dimensions[DIMENSION_HEIGHT] = 100; node_1 = node_0.getChildAt(1); node_1.layout.position[POSITION_TOP] = 100; node_1.layout.position[POSITION_LEFT] = 0; node_1.layout.dimensions[DIMENSION_WIDTH] = 0; node_1.layout.dimensions[DIMENSION_HEIGHT] = 200; } } test("should not shrink children if not enough space", root_node, root_layout); } [Test] public void TestCase45() { TestCSSNode root_node = new TestCSSNode(); { TestCSSNode node_0 = root_node; node_0.style.flexDirection = CSSFlexDirection.ColumnReverse; node_0.style.dimensions[DIMENSION_HEIGHT] = 100; addChildren(node_0, 2); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.style.dimensions[DIMENSION_HEIGHT] = 100; node_1 = node_0.getChildAt(1); node_1.style.dimensions[DIMENSION_HEIGHT] = 200; } } TestCSSNode root_layout = new TestCSSNode(); { TestCSSNode node_0 = root_layout; node_0.layout.position[POSITION_TOP] = 0; node_0.layout.position[POSITION_LEFT] = 0; node_0.layout.dimensions[DIMENSION_WIDTH] = 0; node_0.layout.dimensions[DIMENSION_HEIGHT] = 100; addChildren(node_0, 2); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.layout.position[POSITION_TOP] = 0; node_1.layout.position[POSITION_LEFT] = 0; node_1.layout.dimensions[DIMENSION_WIDTH] = 0; node_1.layout.dimensions[DIMENSION_HEIGHT] = 100; node_1 = node_0.getChildAt(1); node_1.layout.position[POSITION_TOP] = -200; node_1.layout.position[POSITION_LEFT] = 0; node_1.layout.dimensions[DIMENSION_WIDTH] = 0; node_1.layout.dimensions[DIMENSION_HEIGHT] = 200; } } test("should not shrink children if not enough space in reverse", root_node, root_layout); } [Test] public void TestCase46() { TestCSSNode root_node = new TestCSSNode(); { TestCSSNode node_0 = root_node; node_0.style.justifyContent = CSSJustify.Center; } TestCSSNode root_layout = new TestCSSNode(); { TestCSSNode node_0 = root_layout; node_0.layout.position[POSITION_TOP] = 0; node_0.layout.position[POSITION_LEFT] = 0; node_0.layout.dimensions[DIMENSION_WIDTH] = 0; node_0.layout.dimensions[DIMENSION_HEIGHT] = 0; } test("should layout for center", root_node, root_layout); } [Test] public void TestCase47() { TestCSSNode root_node = new TestCSSNode(); { TestCSSNode node_0 = root_node; node_0.style.justifyContent = CSSJustify.FlexEnd; node_0.style.dimensions[DIMENSION_HEIGHT] = 100; addChildren(node_0, 1); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.setMargin(Spacing.TOP, 10); } } TestCSSNode root_layout = new TestCSSNode(); { TestCSSNode node_0 = root_layout; node_0.layout.position[POSITION_TOP] = 0; node_0.layout.position[POSITION_LEFT] = 0; node_0.layout.dimensions[DIMENSION_WIDTH] = 0; node_0.layout.dimensions[DIMENSION_HEIGHT] = 100; addChildren(node_0, 1); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.layout.position[POSITION_TOP] = 100; node_1.layout.position[POSITION_LEFT] = 0; node_1.layout.dimensions[DIMENSION_WIDTH] = 0; node_1.layout.dimensions[DIMENSION_HEIGHT] = 0; } } test("should layout flex-end taking into account margin", root_node, root_layout); } [Test] public void TestCase48() { TestCSSNode root_node = new TestCSSNode(); { TestCSSNode node_0 = root_node; node_0.style.flexDirection = CSSFlexDirection.ColumnReverse; node_0.style.justifyContent = CSSJustify.FlexEnd; node_0.style.dimensions[DIMENSION_HEIGHT] = 100; addChildren(node_0, 1); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.setMargin(Spacing.TOP, 10); } } TestCSSNode root_layout = new TestCSSNode(); { TestCSSNode node_0 = root_layout; node_0.layout.position[POSITION_TOP] = 0; node_0.layout.position[POSITION_LEFT] = 0; node_0.layout.dimensions[DIMENSION_WIDTH] = 0; node_0.layout.dimensions[DIMENSION_HEIGHT] = 100; addChildren(node_0, 1); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.layout.position[POSITION_TOP] = 10; node_1.layout.position[POSITION_LEFT] = 0; node_1.layout.dimensions[DIMENSION_WIDTH] = 0; node_1.layout.dimensions[DIMENSION_HEIGHT] = 0; } } test("should layout flex-end taking into account margin in reverse", root_node, root_layout); } [Test] public void TestCase49() { TestCSSNode root_node = new TestCSSNode(); { TestCSSNode node_0 = root_node; addChildren(node_0, 1); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.style.alignItems = CSSAlign.FlexEnd; addChildren(node_1, 2); { TestCSSNode node_2; node_2 = node_1.getChildAt(0); node_2.setMargin(Spacing.LEFT, 10); node_2.setMargin(Spacing.TOP, 10); node_2.setMargin(Spacing.RIGHT, 10); node_2.setMargin(Spacing.BOTTOM, 10); node_2.setMargin(Spacing.START, 10); node_2.setMargin(Spacing.END, 10); node_2 = node_1.getChildAt(1); node_2.style.dimensions[DIMENSION_HEIGHT] = 100; } } } TestCSSNode root_layout = new TestCSSNode(); { TestCSSNode node_0 = root_layout; node_0.layout.position[POSITION_TOP] = 0; node_0.layout.position[POSITION_LEFT] = 0; node_0.layout.dimensions[DIMENSION_WIDTH] = 20; node_0.layout.dimensions[DIMENSION_HEIGHT] = 120; addChildren(node_0, 1); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.layout.position[POSITION_TOP] = 0; node_1.layout.position[POSITION_LEFT] = 0; node_1.layout.dimensions[DIMENSION_WIDTH] = 20; node_1.layout.dimensions[DIMENSION_HEIGHT] = 120; addChildren(node_1, 2); { TestCSSNode node_2; node_2 = node_1.getChildAt(0); node_2.layout.position[POSITION_TOP] = 10; node_2.layout.position[POSITION_LEFT] = 10; node_2.layout.dimensions[DIMENSION_WIDTH] = 0; node_2.layout.dimensions[DIMENSION_HEIGHT] = 0; node_2 = node_1.getChildAt(1); node_2.layout.position[POSITION_TOP] = 20; node_2.layout.position[POSITION_LEFT] = 20; node_2.layout.dimensions[DIMENSION_WIDTH] = 0; node_2.layout.dimensions[DIMENSION_HEIGHT] = 100; } } } test("should layout alignItems with margin", root_node, root_layout); } [Test] public void TestCase50() { TestCSSNode root_node = new TestCSSNode(); { TestCSSNode node_0 = root_node; addChildren(node_0, 1); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.style.flexDirection = CSSFlexDirection.ColumnReverse; node_1.style.alignItems = CSSAlign.FlexEnd; addChildren(node_1, 2); { TestCSSNode node_2; node_2 = node_1.getChildAt(0); node_2.setMargin(Spacing.LEFT, 10); node_2.setMargin(Spacing.TOP, 10); node_2.setMargin(Spacing.RIGHT, 10); node_2.setMargin(Spacing.BOTTOM, 10); node_2.setMargin(Spacing.START, 10); node_2.setMargin(Spacing.END, 10); node_2 = node_1.getChildAt(1); node_2.style.dimensions[DIMENSION_HEIGHT] = 100; } } } TestCSSNode root_layout = new TestCSSNode(); { TestCSSNode node_0 = root_layout; node_0.layout.position[POSITION_TOP] = 0; node_0.layout.position[POSITION_LEFT] = 0; node_0.layout.dimensions[DIMENSION_WIDTH] = 20; node_0.layout.dimensions[DIMENSION_HEIGHT] = 120; addChildren(node_0, 1); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.layout.position[POSITION_TOP] = 0; node_1.layout.position[POSITION_LEFT] = 0; node_1.layout.dimensions[DIMENSION_WIDTH] = 20; node_1.layout.dimensions[DIMENSION_HEIGHT] = 120; addChildren(node_1, 2); { TestCSSNode node_2; node_2 = node_1.getChildAt(0); node_2.layout.position[POSITION_TOP] = 110; node_2.layout.position[POSITION_LEFT] = 10; node_2.layout.dimensions[DIMENSION_WIDTH] = 0; node_2.layout.dimensions[DIMENSION_HEIGHT] = 0; node_2 = node_1.getChildAt(1); node_2.layout.position[POSITION_TOP] = 0; node_2.layout.position[POSITION_LEFT] = 20; node_2.layout.dimensions[DIMENSION_WIDTH] = 0; node_2.layout.dimensions[DIMENSION_HEIGHT] = 100; } } } test("should layout alignItems with margin in reverse", root_node, root_layout); } [Test] public void TestCase51() { TestCSSNode root_node = new TestCSSNode(); { TestCSSNode node_0 = root_node; addChildren(node_0, 1); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.style.flex = 1; } } TestCSSNode root_layout = new TestCSSNode(); { TestCSSNode node_0 = root_layout; node_0.layout.position[POSITION_TOP] = 0; node_0.layout.position[POSITION_LEFT] = 0; node_0.layout.dimensions[DIMENSION_WIDTH] = 0; node_0.layout.dimensions[DIMENSION_HEIGHT] = 0; addChildren(node_0, 1); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.layout.position[POSITION_TOP] = 0; node_1.layout.position[POSITION_LEFT] = 0; node_1.layout.dimensions[DIMENSION_WIDTH] = 0; node_1.layout.dimensions[DIMENSION_HEIGHT] = 0; } } test("should layout flex inside of an empty element", root_node, root_layout); } [Test] public void TestCase52() { TestCSSNode root_node = new TestCSSNode(); { TestCSSNode node_0 = root_node; node_0.style.alignItems = CSSAlign.Stretch; addChildren(node_0, 1); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.setMargin(Spacing.LEFT, 10); } } TestCSSNode root_layout = new TestCSSNode(); { TestCSSNode node_0 = root_layout; node_0.layout.position[POSITION_TOP] = 0; node_0.layout.position[POSITION_LEFT] = 0; node_0.layout.dimensions[DIMENSION_WIDTH] = 10; node_0.layout.dimensions[DIMENSION_HEIGHT] = 0; addChildren(node_0, 1); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.layout.position[POSITION_TOP] = 0; node_1.layout.position[POSITION_LEFT] = 10; node_1.layout.dimensions[DIMENSION_WIDTH] = 0; node_1.layout.dimensions[DIMENSION_HEIGHT] = 0; } } test("should layout alignItems stretch and margin", root_node, root_layout); } [Test] public void TestCase53() { TestCSSNode root_node = new TestCSSNode(); { TestCSSNode node_0 = root_node; node_0.style.flexDirection = CSSFlexDirection.ColumnReverse; node_0.style.alignItems = CSSAlign.Stretch; addChildren(node_0, 1); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.setMargin(Spacing.LEFT, 10); } } TestCSSNode root_layout = new TestCSSNode(); { TestCSSNode node_0 = root_layout; node_0.layout.position[POSITION_TOP] = 0; node_0.layout.position[POSITION_LEFT] = 0; node_0.layout.dimensions[DIMENSION_WIDTH] = 10; node_0.layout.dimensions[DIMENSION_HEIGHT] = 0; addChildren(node_0, 1); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.layout.position[POSITION_TOP] = 0; node_1.layout.position[POSITION_LEFT] = 10; node_1.layout.dimensions[DIMENSION_WIDTH] = 0; node_1.layout.dimensions[DIMENSION_HEIGHT] = 0; } } test("should layout alignItems stretch and margin in reverse", root_node, root_layout); } [Test] public void TestCase54() { TestCSSNode root_node = new TestCSSNode(); { TestCSSNode node_0 = root_node; node_0.setPadding(Spacing.LEFT, 5); node_0.setPadding(Spacing.TOP, 5); node_0.setPadding(Spacing.RIGHT, 5); node_0.setPadding(Spacing.BOTTOM, 5); node_0.setPadding(Spacing.START, 5); node_0.setPadding(Spacing.END, 5); } TestCSSNode root_layout = new TestCSSNode(); { TestCSSNode node_0 = root_layout; node_0.layout.position[POSITION_TOP] = 0; node_0.layout.position[POSITION_LEFT] = 0; node_0.layout.dimensions[DIMENSION_WIDTH] = 10; node_0.layout.dimensions[DIMENSION_HEIGHT] = 10; } test("should layout node with padding", root_node, root_layout); } [Test] public void TestCase55() { TestCSSNode root_node = new TestCSSNode(); { TestCSSNode node_0 = root_node; node_0.setPadding(Spacing.LEFT, 5); node_0.setPadding(Spacing.TOP, 5); node_0.setPadding(Spacing.RIGHT, 5); node_0.setPadding(Spacing.BOTTOM, 5); node_0.setPadding(Spacing.START, 5); node_0.setPadding(Spacing.END, 5); addChildren(node_0, 1); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); } } TestCSSNode root_layout = new TestCSSNode(); { TestCSSNode node_0 = root_layout; node_0.layout.position[POSITION_TOP] = 0; node_0.layout.position[POSITION_LEFT] = 0; node_0.layout.dimensions[DIMENSION_WIDTH] = 10; node_0.layout.dimensions[DIMENSION_HEIGHT] = 10; addChildren(node_0, 1); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.layout.position[POSITION_TOP] = 5; node_1.layout.position[POSITION_LEFT] = 5; node_1.layout.dimensions[DIMENSION_WIDTH] = 0; node_1.layout.dimensions[DIMENSION_HEIGHT] = 0; } } test("should layout node with padding and a child", root_node, root_layout); } [Test] public void TestCase56() { TestCSSNode root_node = new TestCSSNode(); { TestCSSNode node_0 = root_node; node_0.setPadding(Spacing.LEFT, 5); node_0.setPadding(Spacing.TOP, 5); node_0.setPadding(Spacing.RIGHT, 5); node_0.setPadding(Spacing.BOTTOM, 5); node_0.setPadding(Spacing.START, 5); node_0.setPadding(Spacing.END, 5); addChildren(node_0, 1); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.setMargin(Spacing.LEFT, 5); node_1.setMargin(Spacing.TOP, 5); node_1.setMargin(Spacing.RIGHT, 5); node_1.setMargin(Spacing.BOTTOM, 5); node_1.setMargin(Spacing.START, 5); node_1.setMargin(Spacing.END, 5); } } TestCSSNode root_layout = new TestCSSNode(); { TestCSSNode node_0 = root_layout; node_0.layout.position[POSITION_TOP] = 0; node_0.layout.position[POSITION_LEFT] = 0; node_0.layout.dimensions[DIMENSION_WIDTH] = 20; node_0.layout.dimensions[DIMENSION_HEIGHT] = 20; addChildren(node_0, 1); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.layout.position[POSITION_TOP] = 10; node_1.layout.position[POSITION_LEFT] = 10; node_1.layout.dimensions[DIMENSION_WIDTH] = 0; node_1.layout.dimensions[DIMENSION_HEIGHT] = 0; } } test("should layout node with padding and a child with margin", root_node, root_layout); } [Test] public void TestCase57() { TestCSSNode root_node = new TestCSSNode(); { TestCSSNode node_0 = root_node; addChildren(node_0, 1); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.style.alignSelf = CSSAlign.Stretch; node_1.setPadding(Spacing.LEFT, 10); node_1.setPadding(Spacing.TOP, 10); node_1.setPadding(Spacing.RIGHT, 10); node_1.setPadding(Spacing.BOTTOM, 10); node_1.setPadding(Spacing.START, 10); node_1.setPadding(Spacing.END, 10); } } TestCSSNode root_layout = new TestCSSNode(); { TestCSSNode node_0 = root_layout; node_0.layout.position[POSITION_TOP] = 0; node_0.layout.position[POSITION_LEFT] = 0; node_0.layout.dimensions[DIMENSION_WIDTH] = 20; node_0.layout.dimensions[DIMENSION_HEIGHT] = 20; addChildren(node_0, 1); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.layout.position[POSITION_TOP] = 0; node_1.layout.position[POSITION_LEFT] = 0; node_1.layout.dimensions[DIMENSION_WIDTH] = 20; node_1.layout.dimensions[DIMENSION_HEIGHT] = 20; } } test("should layout node with padding and stretch", root_node, root_layout); } [Test] public void TestCase58() { TestCSSNode root_node = new TestCSSNode(); { TestCSSNode node_0 = root_node; node_0.setPadding(Spacing.LEFT, 50); node_0.setPadding(Spacing.TOP, 50); node_0.setPadding(Spacing.RIGHT, 50); node_0.setPadding(Spacing.BOTTOM, 50); node_0.setPadding(Spacing.START, 50); node_0.setPadding(Spacing.END, 50); addChildren(node_0, 1); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.style.alignSelf = CSSAlign.Stretch; node_1.setPadding(Spacing.LEFT, 10); node_1.setPadding(Spacing.TOP, 10); node_1.setPadding(Spacing.RIGHT, 10); node_1.setPadding(Spacing.BOTTOM, 10); node_1.setPadding(Spacing.START, 10); node_1.setPadding(Spacing.END, 10); } } TestCSSNode root_layout = new TestCSSNode(); { TestCSSNode node_0 = root_layout; node_0.layout.position[POSITION_TOP] = 0; node_0.layout.position[POSITION_LEFT] = 0; node_0.layout.dimensions[DIMENSION_WIDTH] = 120; node_0.layout.dimensions[DIMENSION_HEIGHT] = 120; addChildren(node_0, 1); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.layout.position[POSITION_TOP] = 50; node_1.layout.position[POSITION_LEFT] = 50; node_1.layout.dimensions[DIMENSION_WIDTH] = 20; node_1.layout.dimensions[DIMENSION_HEIGHT] = 20; } } test("should layout node with inner & outer padding and stretch", root_node, root_layout); } [Test] public void TestCase59() { TestCSSNode root_node = new TestCSSNode(); { TestCSSNode node_0 = root_node; addChildren(node_0, 1); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.style.alignSelf = CSSAlign.Stretch; addChildren(node_1, 1); { TestCSSNode node_2; node_2 = node_1.getChildAt(0); node_2.setMargin(Spacing.LEFT, 16); node_2.setMargin(Spacing.TOP, 16); node_2.setMargin(Spacing.RIGHT, 16); node_2.setMargin(Spacing.BOTTOM, 16); node_2.setMargin(Spacing.START, 16); node_2.setMargin(Spacing.END, 16); } } } TestCSSNode root_layout = new TestCSSNode(); { TestCSSNode node_0 = root_layout; node_0.layout.position[POSITION_TOP] = 0; node_0.layout.position[POSITION_LEFT] = 0; node_0.layout.dimensions[DIMENSION_WIDTH] = 32; node_0.layout.dimensions[DIMENSION_HEIGHT] = 32; addChildren(node_0, 1); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.layout.position[POSITION_TOP] = 0; node_1.layout.position[POSITION_LEFT] = 0; node_1.layout.dimensions[DIMENSION_WIDTH] = 32; node_1.layout.dimensions[DIMENSION_HEIGHT] = 32; addChildren(node_1, 1); { TestCSSNode node_2; node_2 = node_1.getChildAt(0); node_2.layout.position[POSITION_TOP] = 16; node_2.layout.position[POSITION_LEFT] = 16; node_2.layout.dimensions[DIMENSION_WIDTH] = 0; node_2.layout.dimensions[DIMENSION_HEIGHT] = 0; } } } test("should layout node with stretch and child with margin", root_node, root_layout); } [Test] public void TestCase60() { TestCSSNode root_node = new TestCSSNode(); { TestCSSNode node_0 = root_node; node_0.style.position[POSITION_LEFT] = 5; node_0.style.position[POSITION_TOP] = 5; } TestCSSNode root_layout = new TestCSSNode(); { TestCSSNode node_0 = root_layout; node_0.layout.position[POSITION_TOP] = 5; node_0.layout.position[POSITION_LEFT] = 5; node_0.layout.dimensions[DIMENSION_WIDTH] = 0; node_0.layout.dimensions[DIMENSION_HEIGHT] = 0; } test("should layout node with top and left", root_node, root_layout); } [Test] public void TestCase61() { TestCSSNode root_node = new TestCSSNode(); { TestCSSNode node_0 = root_node; node_0.style.justifyContent = CSSJustify.SpaceAround; node_0.style.dimensions[DIMENSION_HEIGHT] = 10; node_0.setPadding(Spacing.TOP, 5); addChildren(node_0, 1); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); } } TestCSSNode root_layout = new TestCSSNode(); { TestCSSNode node_0 = root_layout; node_0.layout.position[POSITION_TOP] = 0; node_0.layout.position[POSITION_LEFT] = 0; node_0.layout.dimensions[DIMENSION_WIDTH] = 0; node_0.layout.dimensions[DIMENSION_HEIGHT] = 10; addChildren(node_0, 1); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.layout.position[POSITION_TOP] = 7.5f; node_1.layout.position[POSITION_LEFT] = 0; node_1.layout.dimensions[DIMENSION_WIDTH] = 0; node_1.layout.dimensions[DIMENSION_HEIGHT] = 0; } } test("should layout node with height, padding and space-around", root_node, root_layout); } [Test] public void TestCase62() { TestCSSNode root_node = new TestCSSNode(); { TestCSSNode node_0 = root_node; node_0.style.position[POSITION_BOTTOM] = 5; } TestCSSNode root_layout = new TestCSSNode(); { TestCSSNode node_0 = root_layout; node_0.layout.position[POSITION_TOP] = -5; node_0.layout.position[POSITION_LEFT] = 0; node_0.layout.dimensions[DIMENSION_WIDTH] = 0; node_0.layout.dimensions[DIMENSION_HEIGHT] = 0; } test("should layout node with bottom", root_node, root_layout); } [Test] public void TestCase63() { TestCSSNode root_node = new TestCSSNode(); { TestCSSNode node_0 = root_node; node_0.style.position[POSITION_TOP] = 10; node_0.style.position[POSITION_BOTTOM] = 5; } TestCSSNode root_layout = new TestCSSNode(); { TestCSSNode node_0 = root_layout; node_0.layout.position[POSITION_TOP] = 10; node_0.layout.position[POSITION_LEFT] = 0; node_0.layout.dimensions[DIMENSION_WIDTH] = 0; node_0.layout.dimensions[DIMENSION_HEIGHT] = 0; } test("should layout node with both top and bottom", root_node, root_layout); } [Test] public void TestCase64() { TestCSSNode root_node = new TestCSSNode(); { TestCSSNode node_0 = root_node; node_0.style.flexDirection = CSSFlexDirection.Row; node_0.style.dimensions[DIMENSION_WIDTH] = 500; addChildren(node_0, 3); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.style.flex = 1; node_1 = node_0.getChildAt(1); node_1.style.positionType = CSSPositionType.Absolute; node_1.style.dimensions[DIMENSION_WIDTH] = 50; node_1 = node_0.getChildAt(2); node_1.style.flex = 1; } } TestCSSNode root_layout = new TestCSSNode(); { TestCSSNode node_0 = root_layout; node_0.layout.position[POSITION_TOP] = 0; node_0.layout.position[POSITION_LEFT] = 0; node_0.layout.dimensions[DIMENSION_WIDTH] = 500; node_0.layout.dimensions[DIMENSION_HEIGHT] = 0; addChildren(node_0, 3); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.layout.position[POSITION_TOP] = 0; node_1.layout.position[POSITION_LEFT] = 0; node_1.layout.dimensions[DIMENSION_WIDTH] = 250; node_1.layout.dimensions[DIMENSION_HEIGHT] = 0; node_1 = node_0.getChildAt(1); node_1.layout.position[POSITION_TOP] = 0; node_1.layout.position[POSITION_LEFT] = 250; node_1.layout.dimensions[DIMENSION_WIDTH] = 50; node_1.layout.dimensions[DIMENSION_HEIGHT] = 0; node_1 = node_0.getChildAt(2); node_1.layout.position[POSITION_TOP] = 0; node_1.layout.position[POSITION_LEFT] = 250; node_1.layout.dimensions[DIMENSION_WIDTH] = 250; node_1.layout.dimensions[DIMENSION_HEIGHT] = 0; } } test("should layout node with position: absolute", root_node, root_layout); } [Test] public void TestCase65() { TestCSSNode root_node = new TestCSSNode(); { TestCSSNode node_0 = root_node; addChildren(node_0, 1); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.style.positionType = CSSPositionType.Absolute; node_1.setMargin(Spacing.RIGHT, 15); } } TestCSSNode root_layout = new TestCSSNode(); { TestCSSNode node_0 = root_layout; node_0.layout.position[POSITION_TOP] = 0; node_0.layout.position[POSITION_LEFT] = 0; node_0.layout.dimensions[DIMENSION_WIDTH] = 0; node_0.layout.dimensions[DIMENSION_HEIGHT] = 0; addChildren(node_0, 1); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.layout.position[POSITION_TOP] = 0; node_1.layout.position[POSITION_LEFT] = 0; node_1.layout.dimensions[DIMENSION_WIDTH] = 0; node_1.layout.dimensions[DIMENSION_HEIGHT] = 0; } } test("should layout node with child with position: absolute and margin", root_node, root_layout); } [Test] public void TestCase66() { TestCSSNode root_node = new TestCSSNode(); { TestCSSNode node_0 = root_node; addChildren(node_0, 1); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.style.alignSelf = CSSAlign.Center; node_1.style.positionType = CSSPositionType.Absolute; node_1.setPadding(Spacing.RIGHT, 12); } } TestCSSNode root_layout = new TestCSSNode(); { TestCSSNode node_0 = root_layout; node_0.layout.position[POSITION_TOP] = 0; node_0.layout.position[POSITION_LEFT] = 0; node_0.layout.dimensions[DIMENSION_WIDTH] = 0; node_0.layout.dimensions[DIMENSION_HEIGHT] = 0; addChildren(node_0, 1); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.layout.position[POSITION_TOP] = 0; node_1.layout.position[POSITION_LEFT] = 0; node_1.layout.dimensions[DIMENSION_WIDTH] = 12; node_1.layout.dimensions[DIMENSION_HEIGHT] = 0; } } test("should layout node with position: absolute, padding and alignSelf: center", root_node, root_layout); } [Test] public void TestCase67() { TestCSSNode root_node = new TestCSSNode(); { TestCSSNode node_0 = root_node; node_0.style.dimensions[DIMENSION_HEIGHT] = 5; node_0.setPadding(Spacing.BOTTOM, 20); } TestCSSNode root_layout = new TestCSSNode(); { TestCSSNode node_0 = root_layout; node_0.layout.position[POSITION_TOP] = 0; node_0.layout.position[POSITION_LEFT] = 0; node_0.layout.dimensions[DIMENSION_WIDTH] = 0; node_0.layout.dimensions[DIMENSION_HEIGHT] = 20; } test("should work with height smaller than paddingBottom", root_node, root_layout); } [Test] public void TestCase68() { TestCSSNode root_node = new TestCSSNode(); { TestCSSNode node_0 = root_node; node_0.style.dimensions[DIMENSION_WIDTH] = 5; node_0.setPadding(Spacing.LEFT, 20); } TestCSSNode root_layout = new TestCSSNode(); { TestCSSNode node_0 = root_layout; node_0.layout.position[POSITION_TOP] = 0; node_0.layout.position[POSITION_LEFT] = 0; node_0.layout.dimensions[DIMENSION_WIDTH] = 20; node_0.layout.dimensions[DIMENSION_HEIGHT] = 0; } test("should work with width smaller than paddingLeft", root_node, root_layout); } [Test] public void TestCase69() { TestCSSNode root_node = new TestCSSNode(); { TestCSSNode node_0 = root_node; addChildren(node_0, 2); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); addChildren(node_1, 1); { TestCSSNode node_2; node_2 = node_1.getChildAt(0); node_2.style.dimensions[DIMENSION_WIDTH] = 400; } node_1 = node_0.getChildAt(1); node_1.style.alignSelf = CSSAlign.Stretch; node_1.style.dimensions[DIMENSION_WIDTH] = 200; } } TestCSSNode root_layout = new TestCSSNode(); { TestCSSNode node_0 = root_layout; node_0.layout.position[POSITION_TOP] = 0; node_0.layout.position[POSITION_LEFT] = 0; node_0.layout.dimensions[DIMENSION_WIDTH] = 400; node_0.layout.dimensions[DIMENSION_HEIGHT] = 0; addChildren(node_0, 2); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.layout.position[POSITION_TOP] = 0; node_1.layout.position[POSITION_LEFT] = 0; node_1.layout.dimensions[DIMENSION_WIDTH] = 400; node_1.layout.dimensions[DIMENSION_HEIGHT] = 0; addChildren(node_1, 1); { TestCSSNode node_2; node_2 = node_1.getChildAt(0); node_2.layout.position[POSITION_TOP] = 0; node_2.layout.position[POSITION_LEFT] = 0; node_2.layout.dimensions[DIMENSION_WIDTH] = 400; node_2.layout.dimensions[DIMENSION_HEIGHT] = 0; } node_1 = node_0.getChildAt(1); node_1.layout.position[POSITION_TOP] = 0; node_1.layout.position[POSITION_LEFT] = 0; node_1.layout.dimensions[DIMENSION_WIDTH] = 200; node_1.layout.dimensions[DIMENSION_HEIGHT] = 0; } } test("should layout node with specified width and stretch", root_node, root_layout); } [Test] public void TestCase70() { TestCSSNode root_node = new TestCSSNode(); { TestCSSNode node_0 = root_node; node_0.setPadding(Spacing.LEFT, 5); node_0.setPadding(Spacing.TOP, 5); node_0.setPadding(Spacing.RIGHT, 5); node_0.setPadding(Spacing.BOTTOM, 5); node_0.setPadding(Spacing.START, 5); node_0.setPadding(Spacing.END, 5); addChildren(node_0, 1); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.style.positionType = CSSPositionType.Absolute; } } TestCSSNode root_layout = new TestCSSNode(); { TestCSSNode node_0 = root_layout; node_0.layout.position[POSITION_TOP] = 0; node_0.layout.position[POSITION_LEFT] = 0; node_0.layout.dimensions[DIMENSION_WIDTH] = 10; node_0.layout.dimensions[DIMENSION_HEIGHT] = 10; addChildren(node_0, 1); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.layout.position[POSITION_TOP] = 5; node_1.layout.position[POSITION_LEFT] = 5; node_1.layout.dimensions[DIMENSION_WIDTH] = 0; node_1.layout.dimensions[DIMENSION_HEIGHT] = 0; } } test("should layout node with padding and child with position absolute", root_node, root_layout); } [Test] public void TestCase71() { TestCSSNode root_node = new TestCSSNode(); { TestCSSNode node_0 = root_node; addChildren(node_0, 2); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.style.dimensions[DIMENSION_HEIGHT] = 100; node_1 = node_0.getChildAt(1); node_1.style.positionType = CSSPositionType.Absolute; node_1.style.position[POSITION_LEFT] = 10; node_1.style.position[POSITION_TOP] = 10; } } TestCSSNode root_layout = new TestCSSNode(); { TestCSSNode node_0 = root_layout; node_0.layout.position[POSITION_TOP] = 0; node_0.layout.position[POSITION_LEFT] = 0; node_0.layout.dimensions[DIMENSION_WIDTH] = 0; node_0.layout.dimensions[DIMENSION_HEIGHT] = 100; addChildren(node_0, 2); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.layout.position[POSITION_TOP] = 0; node_1.layout.position[POSITION_LEFT] = 0; node_1.layout.dimensions[DIMENSION_WIDTH] = 0; node_1.layout.dimensions[DIMENSION_HEIGHT] = 100; node_1 = node_0.getChildAt(1); node_1.layout.position[POSITION_TOP] = 10; node_1.layout.position[POSITION_LEFT] = 10; node_1.layout.dimensions[DIMENSION_WIDTH] = 0; node_1.layout.dimensions[DIMENSION_HEIGHT] = 0; } } test("should layout node with position absolute, top and left", root_node, root_layout); } [Test] public void TestCase72() { TestCSSNode root_node = new TestCSSNode(); { TestCSSNode node_0 = root_node; node_0.setPadding(Spacing.LEFT, 20); node_0.setPadding(Spacing.TOP, 20); node_0.setPadding(Spacing.RIGHT, 20); node_0.setPadding(Spacing.BOTTOM, 20); node_0.setPadding(Spacing.START, 20); node_0.setPadding(Spacing.END, 20); addChildren(node_0, 1); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.style.positionType = CSSPositionType.Absolute; node_1.style.position[POSITION_LEFT] = 5; } } TestCSSNode root_layout = new TestCSSNode(); { TestCSSNode node_0 = root_layout; node_0.layout.position[POSITION_TOP] = 0; node_0.layout.position[POSITION_LEFT] = 0; node_0.layout.dimensions[DIMENSION_WIDTH] = 40; node_0.layout.dimensions[DIMENSION_HEIGHT] = 40; addChildren(node_0, 1); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.layout.position[POSITION_TOP] = 20; node_1.layout.position[POSITION_LEFT] = 5; node_1.layout.dimensions[DIMENSION_WIDTH] = 0; node_1.layout.dimensions[DIMENSION_HEIGHT] = 0; } } test("should layout node with padding and child position absolute, left", root_node, root_layout); } [Test] public void TestCase73() { TestCSSNode root_node = new TestCSSNode(); { TestCSSNode node_0 = root_node; addChildren(node_0, 1); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.style.positionType = CSSPositionType.Absolute; node_1.setMargin(Spacing.TOP, 5); node_1.style.position[POSITION_TOP] = 5; } } TestCSSNode root_layout = new TestCSSNode(); { TestCSSNode node_0 = root_layout; node_0.layout.position[POSITION_TOP] = 0; node_0.layout.position[POSITION_LEFT] = 0; node_0.layout.dimensions[DIMENSION_WIDTH] = 0; node_0.layout.dimensions[DIMENSION_HEIGHT] = 0; addChildren(node_0, 1); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.layout.position[POSITION_TOP] = 10; node_1.layout.position[POSITION_LEFT] = 0; node_1.layout.dimensions[DIMENSION_WIDTH] = 0; node_1.layout.dimensions[DIMENSION_HEIGHT] = 0; } } test("should layout node with position: absolute, top and marginTop", root_node, root_layout); } [Test] public void TestCase74() { TestCSSNode root_node = new TestCSSNode(); { TestCSSNode node_0 = root_node; addChildren(node_0, 1); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.style.positionType = CSSPositionType.Absolute; node_1.setMargin(Spacing.LEFT, 5); node_1.style.position[POSITION_LEFT] = 5; } } TestCSSNode root_layout = new TestCSSNode(); { TestCSSNode node_0 = root_layout; node_0.layout.position[POSITION_TOP] = 0; node_0.layout.position[POSITION_LEFT] = 0; node_0.layout.dimensions[DIMENSION_WIDTH] = 0; node_0.layout.dimensions[DIMENSION_HEIGHT] = 0; addChildren(node_0, 1); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.layout.position[POSITION_TOP] = 0; node_1.layout.position[POSITION_LEFT] = 10; node_1.layout.dimensions[DIMENSION_WIDTH] = 0; node_1.layout.dimensions[DIMENSION_HEIGHT] = 0; } } test("should layout node with position: absolute, left and marginLeft", root_node, root_layout); } [Test] public void TestCase75() { TestCSSNode root_node = new TestCSSNode(); { TestCSSNode node_0 = root_node; node_0.style.justifyContent = CSSJustify.SpaceAround; node_0.style.dimensions[DIMENSION_HEIGHT] = 200; addChildren(node_0, 2); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.style.positionType = CSSPositionType.Absolute; node_1 = node_0.getChildAt(1); } } TestCSSNode root_layout = new TestCSSNode(); { TestCSSNode node_0 = root_layout; node_0.layout.position[POSITION_TOP] = 0; node_0.layout.position[POSITION_LEFT] = 0; node_0.layout.dimensions[DIMENSION_WIDTH] = 0; node_0.layout.dimensions[DIMENSION_HEIGHT] = 200; addChildren(node_0, 2); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.layout.position[POSITION_TOP] = 100; node_1.layout.position[POSITION_LEFT] = 0; node_1.layout.dimensions[DIMENSION_WIDTH] = 0; node_1.layout.dimensions[DIMENSION_HEIGHT] = 0; node_1 = node_0.getChildAt(1); node_1.layout.position[POSITION_TOP] = 100; node_1.layout.position[POSITION_LEFT] = 0; node_1.layout.dimensions[DIMENSION_WIDTH] = 0; node_1.layout.dimensions[DIMENSION_HEIGHT] = 0; } } test("should layout node with space-around and child position absolute", root_node, root_layout); } [Test] public void TestCase76() { TestCSSNode root_node = new TestCSSNode(); { TestCSSNode node_0 = root_node; node_0.style.flexDirection = CSSFlexDirection.ColumnReverse; node_0.style.justifyContent = CSSJustify.SpaceAround; node_0.style.dimensions[DIMENSION_HEIGHT] = 200; addChildren(node_0, 2); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.style.positionType = CSSPositionType.Absolute; node_1 = node_0.getChildAt(1); } } TestCSSNode root_layout = new TestCSSNode(); { TestCSSNode node_0 = root_layout; node_0.layout.position[POSITION_TOP] = 0; node_0.layout.position[POSITION_LEFT] = 0; node_0.layout.dimensions[DIMENSION_WIDTH] = 0; node_0.layout.dimensions[DIMENSION_HEIGHT] = 200; addChildren(node_0, 2); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.layout.position[POSITION_TOP] = 100; node_1.layout.position[POSITION_LEFT] = 0; node_1.layout.dimensions[DIMENSION_WIDTH] = 0; node_1.layout.dimensions[DIMENSION_HEIGHT] = 0; node_1 = node_0.getChildAt(1); node_1.layout.position[POSITION_TOP] = 100; node_1.layout.position[POSITION_LEFT] = 0; node_1.layout.dimensions[DIMENSION_WIDTH] = 0; node_1.layout.dimensions[DIMENSION_HEIGHT] = 0; } } test("should layout node with space-around and child position absolute in reverse", root_node, root_layout); } [Test] public void TestCase77() { TestCSSNode root_node = new TestCSSNode(); { TestCSSNode node_0 = root_node; node_0.style.flexDirection = CSSFlexDirection.Row; node_0.style.dimensions[DIMENSION_WIDTH] = 700; addChildren(node_0, 1); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.style.flex = 1; node_1.setMargin(Spacing.LEFT, 5); } } TestCSSNode root_layout = new TestCSSNode(); { TestCSSNode node_0 = root_layout; node_0.layout.position[POSITION_TOP] = 0; node_0.layout.position[POSITION_LEFT] = 0; node_0.layout.dimensions[DIMENSION_WIDTH] = 700; node_0.layout.dimensions[DIMENSION_HEIGHT] = 0; addChildren(node_0, 1); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.layout.position[POSITION_TOP] = 0; node_1.layout.position[POSITION_LEFT] = 5; node_1.layout.dimensions[DIMENSION_WIDTH] = 695; node_1.layout.dimensions[DIMENSION_HEIGHT] = 0; } } test("should layout node with flex and main margin", root_node, root_layout); } [Test] public void TestCase78() { TestCSSNode root_node = new TestCSSNode(); { TestCSSNode node_0 = root_node; node_0.style.direction = CSSDirection.RTL; node_0.style.flexDirection = CSSFlexDirection.Row; node_0.style.dimensions[DIMENSION_WIDTH] = 700; addChildren(node_0, 1); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.style.flex = 1; node_1.setMargin(Spacing.RIGHT, 5); } } TestCSSNode root_layout = new TestCSSNode(); { TestCSSNode node_0 = root_layout; node_0.layout.position[POSITION_TOP] = 0; node_0.layout.position[POSITION_LEFT] = 0; node_0.layout.dimensions[DIMENSION_WIDTH] = 700; node_0.layout.dimensions[DIMENSION_HEIGHT] = 0; addChildren(node_0, 1); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.layout.position[POSITION_TOP] = 0; node_1.layout.position[POSITION_LEFT] = 0; node_1.layout.dimensions[DIMENSION_WIDTH] = 695; node_1.layout.dimensions[DIMENSION_HEIGHT] = 0; } } test("should layout node with flex and main margin in rtl", root_node, root_layout); } [Test] public void TestCase79() { TestCSSNode root_node = new TestCSSNode(); { TestCSSNode node_0 = root_node; node_0.style.flexDirection = CSSFlexDirection.Row; node_0.style.dimensions[DIMENSION_WIDTH] = 700; addChildren(node_0, 2); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.style.flex = 1; node_1 = node_0.getChildAt(1); node_1.style.flex = 1; node_1.setPadding(Spacing.RIGHT, 5); } } TestCSSNode root_layout = new TestCSSNode(); { TestCSSNode node_0 = root_layout; node_0.layout.position[POSITION_TOP] = 0; node_0.layout.position[POSITION_LEFT] = 0; node_0.layout.dimensions[DIMENSION_WIDTH] = 700; node_0.layout.dimensions[DIMENSION_HEIGHT] = 0; addChildren(node_0, 2); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.layout.position[POSITION_TOP] = 0; node_1.layout.position[POSITION_LEFT] = 0; node_1.layout.dimensions[DIMENSION_WIDTH] = 347.5f; node_1.layout.dimensions[DIMENSION_HEIGHT] = 0; node_1 = node_0.getChildAt(1); node_1.layout.position[POSITION_TOP] = 0; node_1.layout.position[POSITION_LEFT] = 347.5f; node_1.layout.dimensions[DIMENSION_WIDTH] = 352.5f; node_1.layout.dimensions[DIMENSION_HEIGHT] = 0; } } test("should layout node with multiple flex and padding", root_node, root_layout); } [Test] public void TestCase80() { TestCSSNode root_node = new TestCSSNode(); { TestCSSNode node_0 = root_node; node_0.style.direction = CSSDirection.RTL; node_0.style.flexDirection = CSSFlexDirection.Row; node_0.style.dimensions[DIMENSION_WIDTH] = 700; addChildren(node_0, 2); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.style.flex = 1; node_1 = node_0.getChildAt(1); node_1.style.flex = 1; node_1.setPadding(Spacing.LEFT, 5); } } TestCSSNode root_layout = new TestCSSNode(); { TestCSSNode node_0 = root_layout; node_0.layout.position[POSITION_TOP] = 0; node_0.layout.position[POSITION_LEFT] = 0; node_0.layout.dimensions[DIMENSION_WIDTH] = 700; node_0.layout.dimensions[DIMENSION_HEIGHT] = 0; addChildren(node_0, 2); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.layout.position[POSITION_TOP] = 0; node_1.layout.position[POSITION_LEFT] = 352.5f; node_1.layout.dimensions[DIMENSION_WIDTH] = 347.5f; node_1.layout.dimensions[DIMENSION_HEIGHT] = 0; node_1 = node_0.getChildAt(1); node_1.layout.position[POSITION_TOP] = 0; node_1.layout.position[POSITION_LEFT] = 0; node_1.layout.dimensions[DIMENSION_WIDTH] = 352.5f; node_1.layout.dimensions[DIMENSION_HEIGHT] = 0; } } test("should layout node with multiple flex and padding in rtl", root_node, root_layout); } [Test] public void TestCase81() { TestCSSNode root_node = new TestCSSNode(); { TestCSSNode node_0 = root_node; node_0.style.flexDirection = CSSFlexDirection.Row; node_0.style.dimensions[DIMENSION_WIDTH] = 700; addChildren(node_0, 2); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.style.flex = 1; node_1 = node_0.getChildAt(1); node_1.style.flex = 1; node_1.setMargin(Spacing.LEFT, 5); } } TestCSSNode root_layout = new TestCSSNode(); { TestCSSNode node_0 = root_layout; node_0.layout.position[POSITION_TOP] = 0; node_0.layout.position[POSITION_LEFT] = 0; node_0.layout.dimensions[DIMENSION_WIDTH] = 700; node_0.layout.dimensions[DIMENSION_HEIGHT] = 0; addChildren(node_0, 2); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.layout.position[POSITION_TOP] = 0; node_1.layout.position[POSITION_LEFT] = 0; node_1.layout.dimensions[DIMENSION_WIDTH] = 347.5f; node_1.layout.dimensions[DIMENSION_HEIGHT] = 0; node_1 = node_0.getChildAt(1); node_1.layout.position[POSITION_TOP] = 0; node_1.layout.position[POSITION_LEFT] = 352.5f; node_1.layout.dimensions[DIMENSION_WIDTH] = 347.5f; node_1.layout.dimensions[DIMENSION_HEIGHT] = 0; } } test("should layout node with multiple flex and margin", root_node, root_layout); } [Test] public void TestCase82() { TestCSSNode root_node = new TestCSSNode(); { TestCSSNode node_0 = root_node; node_0.style.direction = CSSDirection.RTL; node_0.style.flexDirection = CSSFlexDirection.Row; node_0.style.dimensions[DIMENSION_WIDTH] = 700; addChildren(node_0, 2); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.style.flex = 1; node_1 = node_0.getChildAt(1); node_1.style.flex = 1; node_1.setMargin(Spacing.RIGHT, 5); } } TestCSSNode root_layout = new TestCSSNode(); { TestCSSNode node_0 = root_layout; node_0.layout.position[POSITION_TOP] = 0; node_0.layout.position[POSITION_LEFT] = 0; node_0.layout.dimensions[DIMENSION_WIDTH] = 700; node_0.layout.dimensions[DIMENSION_HEIGHT] = 0; addChildren(node_0, 2); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.layout.position[POSITION_TOP] = 0; node_1.layout.position[POSITION_LEFT] = 352.5f; node_1.layout.dimensions[DIMENSION_WIDTH] = 347.5f; node_1.layout.dimensions[DIMENSION_HEIGHT] = 0; node_1 = node_0.getChildAt(1); node_1.layout.position[POSITION_TOP] = 0; node_1.layout.position[POSITION_LEFT] = 0; node_1.layout.dimensions[DIMENSION_WIDTH] = 347.5f; node_1.layout.dimensions[DIMENSION_HEIGHT] = 0; } } test("should layout node with multiple flex and margin in rtl", root_node, root_layout); } [Test] public void TestCase83() { TestCSSNode root_node = new TestCSSNode(); { TestCSSNode node_0 = root_node; node_0.style.dimensions[DIMENSION_HEIGHT] = 300; addChildren(node_0, 2); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.style.dimensions[DIMENSION_HEIGHT] = 600; node_1 = node_0.getChildAt(1); node_1.style.flex = 1; } } TestCSSNode root_layout = new TestCSSNode(); { TestCSSNode node_0 = root_layout; node_0.layout.position[POSITION_TOP] = 0; node_0.layout.position[POSITION_LEFT] = 0; node_0.layout.dimensions[DIMENSION_WIDTH] = 0; node_0.layout.dimensions[DIMENSION_HEIGHT] = 300; addChildren(node_0, 2); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.layout.position[POSITION_TOP] = 0; node_1.layout.position[POSITION_LEFT] = 0; node_1.layout.dimensions[DIMENSION_WIDTH] = 0; node_1.layout.dimensions[DIMENSION_HEIGHT] = 600; node_1 = node_0.getChildAt(1); node_1.layout.position[POSITION_TOP] = 600; node_1.layout.position[POSITION_LEFT] = 0; node_1.layout.dimensions[DIMENSION_WIDTH] = 0; node_1.layout.dimensions[DIMENSION_HEIGHT] = 0; } } test("should layout node with flex and overflow", root_node, root_layout); } [Test] public void TestCase84() { TestCSSNode root_node = new TestCSSNode(); { TestCSSNode node_0 = root_node; node_0.style.flexDirection = CSSFlexDirection.Row; node_0.style.dimensions[DIMENSION_WIDTH] = 600; addChildren(node_0, 1); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.style.positionType = CSSPositionType.Absolute; node_1.style.flex = 1; } } TestCSSNode root_layout = new TestCSSNode(); { TestCSSNode node_0 = root_layout; node_0.layout.position[POSITION_TOP] = 0; node_0.layout.position[POSITION_LEFT] = 0; node_0.layout.dimensions[DIMENSION_WIDTH] = 600; node_0.layout.dimensions[DIMENSION_HEIGHT] = 0; addChildren(node_0, 1); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.layout.position[POSITION_TOP] = 0; node_1.layout.position[POSITION_LEFT] = 0; node_1.layout.dimensions[DIMENSION_WIDTH] = 0; node_1.layout.dimensions[DIMENSION_HEIGHT] = 0; } } test("should layout node with flex and position absolute", root_node, root_layout); } [Test] public void TestCase85() { TestCSSNode root_node = new TestCSSNode(); { TestCSSNode node_0 = root_node; node_0.style.direction = CSSDirection.RTL; node_0.style.flexDirection = CSSFlexDirection.Row; node_0.style.dimensions[DIMENSION_WIDTH] = 600; addChildren(node_0, 1); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.style.positionType = CSSPositionType.Absolute; node_1.style.flex = 1; } } TestCSSNode root_layout = new TestCSSNode(); { TestCSSNode node_0 = root_layout; node_0.layout.position[POSITION_TOP] = 0; node_0.layout.position[POSITION_LEFT] = 0; node_0.layout.dimensions[DIMENSION_WIDTH] = 600; node_0.layout.dimensions[DIMENSION_HEIGHT] = 0; addChildren(node_0, 1); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.layout.position[POSITION_TOP] = 0; node_1.layout.position[POSITION_LEFT] = 600; node_1.layout.dimensions[DIMENSION_WIDTH] = 0; node_1.layout.dimensions[DIMENSION_HEIGHT] = 0; } } test("should layout node with flex and position absolute in rtl", root_node, root_layout); } [Test] public void TestCase86() { TestCSSNode root_node = new TestCSSNode(); { TestCSSNode node_0 = root_node; node_0.style.dimensions[DIMENSION_HEIGHT] = 500; addChildren(node_0, 2); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.style.flex = 1; node_1 = node_0.getChildAt(1); node_1.style.positionType = CSSPositionType.Absolute; node_1.style.flex = 1; } } TestCSSNode root_layout = new TestCSSNode(); { TestCSSNode node_0 = root_layout; node_0.layout.position[POSITION_TOP] = 0; node_0.layout.position[POSITION_LEFT] = 0; node_0.layout.dimensions[DIMENSION_WIDTH] = 0; node_0.layout.dimensions[DIMENSION_HEIGHT] = 500; addChildren(node_0, 2); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.layout.position[POSITION_TOP] = 0; node_1.layout.position[POSITION_LEFT] = 0; node_1.layout.dimensions[DIMENSION_WIDTH] = 0; node_1.layout.dimensions[DIMENSION_HEIGHT] = 500; node_1 = node_0.getChildAt(1); node_1.layout.position[POSITION_TOP] = 500; node_1.layout.position[POSITION_LEFT] = 0; node_1.layout.dimensions[DIMENSION_WIDTH] = 0; node_1.layout.dimensions[DIMENSION_HEIGHT] = 0; } } test("should layout node with double flex and position absolute", root_node, root_layout); } [Test] public void TestCase87() { TestCSSNode root_node = new TestCSSNode(); { TestCSSNode node_0 = root_node; node_0.setBorder(Spacing.LEFT, 5); node_0.setBorder(Spacing.TOP, 5); node_0.setBorder(Spacing.RIGHT, 5); node_0.setBorder(Spacing.BOTTOM, 5); node_0.setBorder(Spacing.START, 5); node_0.setBorder(Spacing.END, 5); } TestCSSNode root_layout = new TestCSSNode(); { TestCSSNode node_0 = root_layout; node_0.layout.position[POSITION_TOP] = 0; node_0.layout.position[POSITION_LEFT] = 0; node_0.layout.dimensions[DIMENSION_WIDTH] = 10; node_0.layout.dimensions[DIMENSION_HEIGHT] = 10; } test("should layout node with borderWidth", root_node, root_layout); } [Test] public void TestCase88() { TestCSSNode root_node = new TestCSSNode(); { TestCSSNode node_0 = root_node; node_0.setBorder(Spacing.TOP, 1); addChildren(node_0, 1); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.style.positionType = CSSPositionType.Absolute; node_1.style.position[POSITION_TOP] = -1; } } TestCSSNode root_layout = new TestCSSNode(); { TestCSSNode node_0 = root_layout; node_0.layout.position[POSITION_TOP] = 0; node_0.layout.position[POSITION_LEFT] = 0; node_0.layout.dimensions[DIMENSION_WIDTH] = 0; node_0.layout.dimensions[DIMENSION_HEIGHT] = 1; addChildren(node_0, 1); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.layout.position[POSITION_TOP] = 0; node_1.layout.position[POSITION_LEFT] = 0; node_1.layout.dimensions[DIMENSION_WIDTH] = 0; node_1.layout.dimensions[DIMENSION_HEIGHT] = 0; } } test("should layout node with borderWidth and position: absolute, top", root_node, root_layout); } [Test] public void TestCase89() { TestCSSNode root_node = new TestCSSNode(); { TestCSSNode node_0 = root_node; node_0.setBorder(Spacing.LEFT, 1); node_0.setBorder(Spacing.TOP, 1); node_0.setBorder(Spacing.RIGHT, 1); node_0.setBorder(Spacing.BOTTOM, 1); node_0.setBorder(Spacing.START, 1); node_0.setBorder(Spacing.END, 1); addChildren(node_0, 1); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.style.positionType = CSSPositionType.Absolute; node_1.style.position[POSITION_LEFT] = 5; } } TestCSSNode root_layout = new TestCSSNode(); { TestCSSNode node_0 = root_layout; node_0.layout.position[POSITION_TOP] = 0; node_0.layout.position[POSITION_LEFT] = 0; node_0.layout.dimensions[DIMENSION_WIDTH] = 2; node_0.layout.dimensions[DIMENSION_HEIGHT] = 2; addChildren(node_0, 1); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.layout.position[POSITION_TOP] = 1; node_1.layout.position[POSITION_LEFT] = 6; node_1.layout.dimensions[DIMENSION_WIDTH] = 0; node_1.layout.dimensions[DIMENSION_HEIGHT] = 0; } } test("should layout node with borderWidth and position: absolute, top. cross axis", root_node, root_layout); } [Test] public void TestCase90() { TestCSSNode root_node = new TestCSSNode(); { TestCSSNode node_0 = root_node; node_0.style.dimensions[DIMENSION_WIDTH] = 50; addChildren(node_0, 1); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.style.alignSelf = CSSAlign.Stretch; node_1.setMargin(Spacing.LEFT, 20); node_1.setPadding(Spacing.LEFT, 20); node_1.setPadding(Spacing.TOP, 20); node_1.setPadding(Spacing.RIGHT, 20); node_1.setPadding(Spacing.BOTTOM, 20); node_1.setPadding(Spacing.START, 20); node_1.setPadding(Spacing.END, 20); } } TestCSSNode root_layout = new TestCSSNode(); { TestCSSNode node_0 = root_layout; node_0.layout.position[POSITION_TOP] = 0; node_0.layout.position[POSITION_LEFT] = 0; node_0.layout.dimensions[DIMENSION_WIDTH] = 50; node_0.layout.dimensions[DIMENSION_HEIGHT] = 40; addChildren(node_0, 1); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.layout.position[POSITION_TOP] = 0; node_1.layout.position[POSITION_LEFT] = 20; node_1.layout.dimensions[DIMENSION_WIDTH] = 40; node_1.layout.dimensions[DIMENSION_HEIGHT] = 40; } } test("should correctly take into account min padding for stretch", root_node, root_layout); } [Test] public void TestCase91() { TestCSSNode root_node = new TestCSSNode(); { TestCSSNode node_0 = root_node; node_0.style.dimensions[DIMENSION_WIDTH] = -31; addChildren(node_0, 1); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.setBorder(Spacing.RIGHT, 5); } } TestCSSNode root_layout = new TestCSSNode(); { TestCSSNode node_0 = root_layout; node_0.layout.position[POSITION_TOP] = 0; node_0.layout.position[POSITION_LEFT] = 0; node_0.layout.dimensions[DIMENSION_WIDTH] = 5; node_0.layout.dimensions[DIMENSION_HEIGHT] = 0; addChildren(node_0, 1); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.layout.position[POSITION_TOP] = 0; node_1.layout.position[POSITION_LEFT] = 0; node_1.layout.dimensions[DIMENSION_WIDTH] = 5; node_1.layout.dimensions[DIMENSION_HEIGHT] = 0; } } test("should layout node with negative width", root_node, root_layout); } [Test] public void TestCase92() { TestCSSNode root_node = new TestCSSNode(); { TestCSSNode node_0 = root_node; node_0.style.flexDirection = CSSFlexDirection.Row; node_0.setBorder(Spacing.RIGHT, 1); addChildren(node_0, 1); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.setMargin(Spacing.RIGHT, -8); } } TestCSSNode root_layout = new TestCSSNode(); { TestCSSNode node_0 = root_layout; node_0.layout.position[POSITION_TOP] = 0; node_0.layout.position[POSITION_LEFT] = 0; node_0.layout.dimensions[DIMENSION_WIDTH] = 1; node_0.layout.dimensions[DIMENSION_HEIGHT] = 0; addChildren(node_0, 1); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.layout.position[POSITION_TOP] = 0; node_1.layout.position[POSITION_LEFT] = 0; node_1.layout.dimensions[DIMENSION_WIDTH] = 0; node_1.layout.dimensions[DIMENSION_HEIGHT] = 0; } } test("should handle negative margin and min padding correctly", root_node, root_layout); } [Test] public void TestCase93() { TestCSSNode root_node = new TestCSSNode(); { TestCSSNode node_0 = root_node; node_0.style.direction = CSSDirection.RTL; node_0.style.flexDirection = CSSFlexDirection.Row; node_0.setBorder(Spacing.LEFT, 1); addChildren(node_0, 1); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.setMargin(Spacing.LEFT, -8); } } TestCSSNode root_layout = new TestCSSNode(); { TestCSSNode node_0 = root_layout; node_0.layout.position[POSITION_TOP] = 0; node_0.layout.position[POSITION_LEFT] = 0; node_0.layout.dimensions[DIMENSION_WIDTH] = 1; node_0.layout.dimensions[DIMENSION_HEIGHT] = 0; addChildren(node_0, 1); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.layout.position[POSITION_TOP] = 0; node_1.layout.position[POSITION_LEFT] = 1; node_1.layout.dimensions[DIMENSION_WIDTH] = 0; node_1.layout.dimensions[DIMENSION_HEIGHT] = 0; } } test("should handle negative margin and min padding correctly in rtl", root_node, root_layout); } [Test] public void TestCase94() { TestCSSNode root_node = new TestCSSNode(); { TestCSSNode node_0 = root_node; node_0.setMeasureFunction(sTestMeasureFunction); node_0.context = "small"; } TestCSSNode root_layout = new TestCSSNode(); { TestCSSNode node_0 = root_layout; node_0.layout.position[POSITION_TOP] = 0; node_0.layout.position[POSITION_LEFT] = 0; node_0.layout.dimensions[DIMENSION_WIDTH] = 35; node_0.layout.dimensions[DIMENSION_HEIGHT] = 18; } test("should layout node with just text", root_node, root_layout); } [Test] public void TestCase95() { TestCSSNode root_node = new TestCSSNode(); { TestCSSNode node_0 = root_node; node_0.style.dimensions[DIMENSION_WIDTH] = 100; node_0.setMeasureFunction(sTestMeasureFunction); node_0.context = "measureWithRatio2"; } TestCSSNode root_layout = new TestCSSNode(); { TestCSSNode node_0 = root_layout; node_0.layout.position[POSITION_TOP] = 0; node_0.layout.position[POSITION_LEFT] = 0; node_0.layout.dimensions[DIMENSION_WIDTH] = 100; node_0.layout.dimensions[DIMENSION_HEIGHT] = 200; } test("should layout node with fixed width and custom measure function", root_node, root_layout); } [Test] public void TestCase96() { TestCSSNode root_node = new TestCSSNode(); { TestCSSNode node_0 = root_node; node_0.style.dimensions[DIMENSION_HEIGHT] = 100; node_0.setMeasureFunction(sTestMeasureFunction); node_0.context = "measureWithRatio2"; } TestCSSNode root_layout = new TestCSSNode(); { TestCSSNode node_0 = root_layout; node_0.layout.position[POSITION_TOP] = 0; node_0.layout.position[POSITION_LEFT] = 0; node_0.layout.dimensions[DIMENSION_WIDTH] = 200; node_0.layout.dimensions[DIMENSION_HEIGHT] = 100; } test("should layout node with fixed height and custom measure function", root_node, root_layout); } [Test] public void TestCase97() { TestCSSNode root_node = new TestCSSNode(); { TestCSSNode node_0 = root_node; node_0.style.dimensions[DIMENSION_WIDTH] = 100; node_0.style.dimensions[DIMENSION_HEIGHT] = 100; node_0.setMeasureFunction(sTestMeasureFunction); node_0.context = "measureWithRatio2"; } TestCSSNode root_layout = new TestCSSNode(); { TestCSSNode node_0 = root_layout; node_0.layout.position[POSITION_TOP] = 0; node_0.layout.position[POSITION_LEFT] = 0; node_0.layout.dimensions[DIMENSION_WIDTH] = 100; node_0.layout.dimensions[DIMENSION_HEIGHT] = 100; } test("should layout node with fixed height and fixed width, ignoring custom measure function", root_node, root_layout); } [Test] public void TestCase98() { TestCSSNode root_node = new TestCSSNode(); { TestCSSNode node_0 = root_node; node_0.setMeasureFunction(sTestMeasureFunction); node_0.context = "measureWithRatio2"; } TestCSSNode root_layout = new TestCSSNode(); { TestCSSNode node_0 = root_layout; node_0.layout.position[POSITION_TOP] = 0; node_0.layout.position[POSITION_LEFT] = 0; node_0.layout.dimensions[DIMENSION_WIDTH] = 99999; node_0.layout.dimensions[DIMENSION_HEIGHT] = 99999; } test("should layout node with no fixed dimension and custom measure function", root_node, root_layout); } [Test] public void TestCase99() { TestCSSNode root_node = new TestCSSNode(); { TestCSSNode node_0 = root_node; node_0.style.flexDirection = CSSFlexDirection.Column; node_0.style.dimensions[DIMENSION_WIDTH] = 320; addChildren(node_0, 2); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.setMeasureFunction(sTestMeasureFunction); node_1.context = "measureWithRatio2"; node_1 = node_0.getChildAt(1); node_1.style.flexDirection = CSSFlexDirection.Row; node_1.style.overflow = CSSOverflow.Hidden; node_1.style.dimensions[DIMENSION_HEIGHT] = 100; addChildren(node_1, 2); { TestCSSNode node_2; node_2 = node_1.getChildAt(0); node_2.setMeasureFunction(sTestMeasureFunction); node_2.context = "measureWithRatio2"; node_2 = node_1.getChildAt(1); node_2.setMeasureFunction(sTestMeasureFunction); node_2.context = "measureWithRatio2"; } } } TestCSSNode root_layout = new TestCSSNode(); { TestCSSNode node_0 = root_layout; node_0.layout.position[POSITION_TOP] = 0; node_0.layout.position[POSITION_LEFT] = 0; node_0.layout.dimensions[DIMENSION_WIDTH] = 320; node_0.layout.dimensions[DIMENSION_HEIGHT] = 740; addChildren(node_0, 2); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.layout.position[POSITION_TOP] = 0; node_1.layout.position[POSITION_LEFT] = 0; node_1.layout.dimensions[DIMENSION_WIDTH] = 320; node_1.layout.dimensions[DIMENSION_HEIGHT] = 640; node_1 = node_0.getChildAt(1); node_1.layout.position[POSITION_TOP] = 640; node_1.layout.position[POSITION_LEFT] = 0; node_1.layout.dimensions[DIMENSION_WIDTH] = 320; node_1.layout.dimensions[DIMENSION_HEIGHT] = 100; addChildren(node_1, 2); { TestCSSNode node_2; node_2 = node_1.getChildAt(0); node_2.layout.position[POSITION_TOP] = 0; node_2.layout.position[POSITION_LEFT] = 0; node_2.layout.dimensions[DIMENSION_WIDTH] = 200; node_2.layout.dimensions[DIMENSION_HEIGHT] = 100; node_2 = node_1.getChildAt(1); node_2.layout.position[POSITION_TOP] = 0; node_2.layout.position[POSITION_LEFT] = 200; node_2.layout.dimensions[DIMENSION_WIDTH] = 200; node_2.layout.dimensions[DIMENSION_HEIGHT] = 100; } } } test("should layout node with nested stacks and custom measure function", root_node, root_layout); } [Test] public void TestCase100() { TestCSSNode root_node = new TestCSSNode(); { TestCSSNode node_0 = root_node; node_0.style.dimensions[DIMENSION_WIDTH] = 10; node_0.setMeasureFunction(sTestMeasureFunction); node_0.context = "small"; } TestCSSNode root_layout = new TestCSSNode(); { TestCSSNode node_0 = root_layout; node_0.layout.position[POSITION_TOP] = 0; node_0.layout.position[POSITION_LEFT] = 0; node_0.layout.dimensions[DIMENSION_WIDTH] = 10; node_0.layout.dimensions[DIMENSION_HEIGHT] = 18; } test("should layout node with text and width", root_node, root_layout); } [Test] public void TestCase101() { TestCSSNode root_node = new TestCSSNode(); { TestCSSNode node_0 = root_node; node_0.setMeasureFunction(sTestMeasureFunction); node_0.context = "loooooooooong with space"; } TestCSSNode root_layout = new TestCSSNode(); { TestCSSNode node_0 = root_layout; node_0.layout.position[POSITION_TOP] = 0; node_0.layout.position[POSITION_LEFT] = 0; node_0.layout.dimensions[DIMENSION_WIDTH] = 172; node_0.layout.dimensions[DIMENSION_HEIGHT] = 18; } test("should layout node with text, padding and margin", root_node, root_layout); } [Test] public void TestCase102() { TestCSSNode root_node = new TestCSSNode(); { TestCSSNode node_0 = root_node; node_0.style.dimensions[DIMENSION_WIDTH] = 300; addChildren(node_0, 1); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.style.alignSelf = CSSAlign.Stretch; addChildren(node_1, 1); { TestCSSNode node_2; node_2 = node_1.getChildAt(0); node_2.style.alignSelf = CSSAlign.Stretch; } } } TestCSSNode root_layout = new TestCSSNode(); { TestCSSNode node_0 = root_layout; node_0.layout.position[POSITION_TOP] = 0; node_0.layout.position[POSITION_LEFT] = 0; node_0.layout.dimensions[DIMENSION_WIDTH] = 300; node_0.layout.dimensions[DIMENSION_HEIGHT] = 0; addChildren(node_0, 1); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.layout.position[POSITION_TOP] = 0; node_1.layout.position[POSITION_LEFT] = 0; node_1.layout.dimensions[DIMENSION_WIDTH] = 300; node_1.layout.dimensions[DIMENSION_HEIGHT] = 0; addChildren(node_1, 1); { TestCSSNode node_2; node_2 = node_1.getChildAt(0); node_2.layout.position[POSITION_TOP] = 0; node_2.layout.position[POSITION_LEFT] = 0; node_2.layout.dimensions[DIMENSION_WIDTH] = 300; node_2.layout.dimensions[DIMENSION_HEIGHT] = 0; } } } test("should layout node with nested alignSelf: stretch", root_node, root_layout); } [Test] public void TestCase103() { TestCSSNode root_node = new TestCSSNode(); { TestCSSNode node_0 = root_node; addChildren(node_0, 1); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.style.flexDirection = CSSFlexDirection.Row; node_1.style.dimensions[DIMENSION_WIDTH] = 500; addChildren(node_1, 1); { TestCSSNode node_2; node_2 = node_1.getChildAt(0); node_2.style.flex = 1; node_2.setMeasureFunction(sTestMeasureFunction); node_2.context = "loooooooooong with space"; } } } TestCSSNode root_layout = new TestCSSNode(); { TestCSSNode node_0 = root_layout; node_0.layout.position[POSITION_TOP] = 0; node_0.layout.position[POSITION_LEFT] = 0; node_0.layout.dimensions[DIMENSION_WIDTH] = 500; node_0.layout.dimensions[DIMENSION_HEIGHT] = 18; addChildren(node_0, 1); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.layout.position[POSITION_TOP] = 0; node_1.layout.position[POSITION_LEFT] = 0; node_1.layout.dimensions[DIMENSION_WIDTH] = 500; node_1.layout.dimensions[DIMENSION_HEIGHT] = 18; addChildren(node_1, 1); { TestCSSNode node_2; node_2 = node_1.getChildAt(0); node_2.layout.position[POSITION_TOP] = 0; node_2.layout.position[POSITION_LEFT] = 0; node_2.layout.dimensions[DIMENSION_WIDTH] = 500; node_2.layout.dimensions[DIMENSION_HEIGHT] = 18; } } } test("should layout node with text and flex", root_node, root_layout); } [Test] public void TestCase104() { TestCSSNode root_node = new TestCSSNode(); { TestCSSNode node_0 = root_node; addChildren(node_0, 1); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.style.direction = CSSDirection.RTL; node_1.style.flexDirection = CSSFlexDirection.Row; node_1.style.dimensions[DIMENSION_WIDTH] = 500; addChildren(node_1, 1); { TestCSSNode node_2; node_2 = node_1.getChildAt(0); node_2.style.flex = 1; node_2.setMeasureFunction(sTestMeasureFunction); node_2.context = "loooooooooong with space"; } } } TestCSSNode root_layout = new TestCSSNode(); { TestCSSNode node_0 = root_layout; node_0.layout.position[POSITION_TOP] = 0; node_0.layout.position[POSITION_LEFT] = 0; node_0.layout.dimensions[DIMENSION_WIDTH] = 500; node_0.layout.dimensions[DIMENSION_HEIGHT] = 18; addChildren(node_0, 1); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.layout.position[POSITION_TOP] = 0; node_1.layout.position[POSITION_LEFT] = 0; node_1.layout.dimensions[DIMENSION_WIDTH] = 500; node_1.layout.dimensions[DIMENSION_HEIGHT] = 18; addChildren(node_1, 1); { TestCSSNode node_2; node_2 = node_1.getChildAt(0); node_2.layout.position[POSITION_TOP] = 0; node_2.layout.position[POSITION_LEFT] = 0; node_2.layout.dimensions[DIMENSION_WIDTH] = 500; node_2.layout.dimensions[DIMENSION_HEIGHT] = 18; } } } test("should layout node with text and flex in rtl", root_node, root_layout); } [Test] public void TestCase105() { TestCSSNode root_node = new TestCSSNode(); { TestCSSNode node_0 = root_node; node_0.style.dimensions[DIMENSION_WIDTH] = 130; addChildren(node_0, 1); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.style.alignItems = CSSAlign.Stretch; node_1.style.alignSelf = CSSAlign.Stretch; addChildren(node_1, 1); { TestCSSNode node_2; node_2 = node_1.getChildAt(0); node_2.setMeasureFunction(sTestMeasureFunction); node_2.context = "loooooooooong with space"; } } } TestCSSNode root_layout = new TestCSSNode(); { TestCSSNode node_0 = root_layout; node_0.layout.position[POSITION_TOP] = 0; node_0.layout.position[POSITION_LEFT] = 0; node_0.layout.dimensions[DIMENSION_WIDTH] = 130; node_0.layout.dimensions[DIMENSION_HEIGHT] = 36; addChildren(node_0, 1); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.layout.position[POSITION_TOP] = 0; node_1.layout.position[POSITION_LEFT] = 0; node_1.layout.dimensions[DIMENSION_WIDTH] = 130; node_1.layout.dimensions[DIMENSION_HEIGHT] = 36; addChildren(node_1, 1); { TestCSSNode node_2; node_2 = node_1.getChildAt(0); node_2.layout.position[POSITION_TOP] = 0; node_2.layout.position[POSITION_LEFT] = 0; node_2.layout.dimensions[DIMENSION_WIDTH] = 130; node_2.layout.dimensions[DIMENSION_HEIGHT] = 36; } } } test("should layout node with text and stretch", root_node, root_layout); } [Test] public void TestCase106() { TestCSSNode root_node = new TestCSSNode(); { TestCSSNode node_0 = root_node; node_0.style.dimensions[DIMENSION_WIDTH] = 200; addChildren(node_0, 1); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.style.alignItems = CSSAlign.Stretch; node_1.style.alignSelf = CSSAlign.Stretch; addChildren(node_1, 1); { TestCSSNode node_2; node_2 = node_1.getChildAt(0); node_2.style.dimensions[DIMENSION_WIDTH] = 130; node_2.setMeasureFunction(sTestMeasureFunction); node_2.context = "loooooooooong with space"; } } } TestCSSNode root_layout = new TestCSSNode(); { TestCSSNode node_0 = root_layout; node_0.layout.position[POSITION_TOP] = 0; node_0.layout.position[POSITION_LEFT] = 0; node_0.layout.dimensions[DIMENSION_WIDTH] = 200; node_0.layout.dimensions[DIMENSION_HEIGHT] = 36; addChildren(node_0, 1); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.layout.position[POSITION_TOP] = 0; node_1.layout.position[POSITION_LEFT] = 0; node_1.layout.dimensions[DIMENSION_WIDTH] = 200; node_1.layout.dimensions[DIMENSION_HEIGHT] = 36; addChildren(node_1, 1); { TestCSSNode node_2; node_2 = node_1.getChildAt(0); node_2.layout.position[POSITION_TOP] = 0; node_2.layout.position[POSITION_LEFT] = 0; node_2.layout.dimensions[DIMENSION_WIDTH] = 130; node_2.layout.dimensions[DIMENSION_HEIGHT] = 36; } } } test("should layout node with text stretch and width", root_node, root_layout); } [Test] public void TestCase107() { TestCSSNode root_node = new TestCSSNode(); { TestCSSNode node_0 = root_node; node_0.style.alignSelf = CSSAlign.FlexStart; node_0.style.dimensions[DIMENSION_WIDTH] = 100; addChildren(node_0, 1); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.style.alignSelf = CSSAlign.FlexStart; node_1.setMeasureFunction(sTestMeasureFunction); node_1.context = "loooooooooong with space"; } } TestCSSNode root_layout = new TestCSSNode(); { TestCSSNode node_0 = root_layout; node_0.layout.position[POSITION_TOP] = 0; node_0.layout.position[POSITION_LEFT] = 0; node_0.layout.dimensions[DIMENSION_WIDTH] = 100; node_0.layout.dimensions[DIMENSION_HEIGHT] = 36; addChildren(node_0, 1); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.layout.position[POSITION_TOP] = 0; node_1.layout.position[POSITION_LEFT] = 0; node_1.layout.dimensions[DIMENSION_WIDTH] = 100; node_1.layout.dimensions[DIMENSION_HEIGHT] = 36; } } test("should layout node with text bounded by parent", root_node, root_layout); } [Test] public void TestCase108() { TestCSSNode root_node = new TestCSSNode(); { TestCSSNode node_0 = root_node; node_0.style.alignSelf = CSSAlign.FlexStart; node_0.style.dimensions[DIMENSION_WIDTH] = 100; node_0.setPadding(Spacing.LEFT, 10); node_0.setPadding(Spacing.TOP, 10); node_0.setPadding(Spacing.RIGHT, 10); node_0.setPadding(Spacing.BOTTOM, 10); node_0.setPadding(Spacing.START, 10); node_0.setPadding(Spacing.END, 10); addChildren(node_0, 1); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.style.alignSelf = CSSAlign.FlexStart; node_1.setMargin(Spacing.LEFT, 10); node_1.setMargin(Spacing.TOP, 10); node_1.setMargin(Spacing.RIGHT, 10); node_1.setMargin(Spacing.BOTTOM, 10); node_1.setMargin(Spacing.START, 10); node_1.setMargin(Spacing.END, 10); addChildren(node_1, 1); { TestCSSNode node_2; node_2 = node_1.getChildAt(0); node_2.setMeasureFunction(sTestMeasureFunction); node_2.context = "loooooooooong with space"; } } } TestCSSNode root_layout = new TestCSSNode(); { TestCSSNode node_0 = root_layout; node_0.layout.position[POSITION_TOP] = 0; node_0.layout.position[POSITION_LEFT] = 0; node_0.layout.dimensions[DIMENSION_WIDTH] = 100; node_0.layout.dimensions[DIMENSION_HEIGHT] = 76; addChildren(node_0, 1); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.layout.position[POSITION_TOP] = 20; node_1.layout.position[POSITION_LEFT] = 20; node_1.layout.dimensions[DIMENSION_WIDTH] = 60; node_1.layout.dimensions[DIMENSION_HEIGHT] = 36; addChildren(node_1, 1); { TestCSSNode node_2; node_2 = node_1.getChildAt(0); node_2.layout.position[POSITION_TOP] = 0; node_2.layout.position[POSITION_LEFT] = 0; node_2.layout.dimensions[DIMENSION_WIDTH] = 100; node_2.layout.dimensions[DIMENSION_HEIGHT] = 36; } } } test("should layout node with text bounded by grand-parent", root_node, root_layout); } [Test] public void TestCase109() { TestCSSNode root_node = new TestCSSNode(); { TestCSSNode node_0 = root_node; node_0.style.justifyContent = CSSJustify.SpaceBetween; node_0.style.dimensions[DIMENSION_HEIGHT] = 100; addChildren(node_0, 2); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.style.dimensions[DIMENSION_HEIGHT] = 900; node_1 = node_0.getChildAt(1); } } TestCSSNode root_layout = new TestCSSNode(); { TestCSSNode node_0 = root_layout; node_0.layout.position[POSITION_TOP] = 0; node_0.layout.position[POSITION_LEFT] = 0; node_0.layout.dimensions[DIMENSION_WIDTH] = 0; node_0.layout.dimensions[DIMENSION_HEIGHT] = 100; addChildren(node_0, 2); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.layout.position[POSITION_TOP] = 0; node_1.layout.position[POSITION_LEFT] = 0; node_1.layout.dimensions[DIMENSION_WIDTH] = 0; node_1.layout.dimensions[DIMENSION_HEIGHT] = 900; node_1 = node_0.getChildAt(1); node_1.layout.position[POSITION_TOP] = 900; node_1.layout.position[POSITION_LEFT] = 0; node_1.layout.dimensions[DIMENSION_WIDTH] = 0; node_1.layout.dimensions[DIMENSION_HEIGHT] = 0; } } test("should layout space-between when remaining space is negative", root_node, root_layout); } [Test] public void TestCase110() { TestCSSNode root_node = new TestCSSNode(); { TestCSSNode node_0 = root_node; node_0.style.flexDirection = CSSFlexDirection.ColumnReverse; node_0.style.justifyContent = CSSJustify.SpaceBetween; node_0.style.dimensions[DIMENSION_HEIGHT] = 100; addChildren(node_0, 2); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.style.dimensions[DIMENSION_HEIGHT] = 900; node_1 = node_0.getChildAt(1); } } TestCSSNode root_layout = new TestCSSNode(); { TestCSSNode node_0 = root_layout; node_0.layout.position[POSITION_TOP] = 0; node_0.layout.position[POSITION_LEFT] = 0; node_0.layout.dimensions[DIMENSION_WIDTH] = 0; node_0.layout.dimensions[DIMENSION_HEIGHT] = 100; addChildren(node_0, 2); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.layout.position[POSITION_TOP] = -800; node_1.layout.position[POSITION_LEFT] = 0; node_1.layout.dimensions[DIMENSION_WIDTH] = 0; node_1.layout.dimensions[DIMENSION_HEIGHT] = 900; node_1 = node_0.getChildAt(1); node_1.layout.position[POSITION_TOP] = -800; node_1.layout.position[POSITION_LEFT] = 0; node_1.layout.dimensions[DIMENSION_WIDTH] = 0; node_1.layout.dimensions[DIMENSION_HEIGHT] = 0; } } test("should layout space-between when remaining space is negative in reverse", root_node, root_layout); } [Test] public void TestCase111() { TestCSSNode root_node = new TestCSSNode(); { TestCSSNode node_0 = root_node; node_0.style.flexDirection = CSSFlexDirection.Row; node_0.style.justifyContent = CSSJustify.FlexEnd; node_0.style.dimensions[DIMENSION_WIDTH] = 200; addChildren(node_0, 1); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.style.dimensions[DIMENSION_WIDTH] = 900; } } TestCSSNode root_layout = new TestCSSNode(); { TestCSSNode node_0 = root_layout; node_0.layout.position[POSITION_TOP] = 0; node_0.layout.position[POSITION_LEFT] = 0; node_0.layout.dimensions[DIMENSION_WIDTH] = 200; node_0.layout.dimensions[DIMENSION_HEIGHT] = 0; addChildren(node_0, 1); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.layout.position[POSITION_TOP] = 0; node_1.layout.position[POSITION_LEFT] = -700; node_1.layout.dimensions[DIMENSION_WIDTH] = 900; node_1.layout.dimensions[DIMENSION_HEIGHT] = 0; } } test("should layout flex-end when remaining space is negative", root_node, root_layout); } [Test] public void TestCase112() { TestCSSNode root_node = new TestCSSNode(); { TestCSSNode node_0 = root_node; node_0.style.direction = CSSDirection.RTL; node_0.style.flexDirection = CSSFlexDirection.Row; node_0.style.justifyContent = CSSJustify.FlexEnd; node_0.style.dimensions[DIMENSION_WIDTH] = 200; addChildren(node_0, 1); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.style.dimensions[DIMENSION_WIDTH] = 900; } } TestCSSNode root_layout = new TestCSSNode(); { TestCSSNode node_0 = root_layout; node_0.layout.position[POSITION_TOP] = 0; node_0.layout.position[POSITION_LEFT] = 0; node_0.layout.dimensions[DIMENSION_WIDTH] = 200; node_0.layout.dimensions[DIMENSION_HEIGHT] = 0; addChildren(node_0, 1); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.layout.position[POSITION_TOP] = 0; node_1.layout.position[POSITION_LEFT] = 0; node_1.layout.dimensions[DIMENSION_WIDTH] = 900; node_1.layout.dimensions[DIMENSION_HEIGHT] = 0; } } test("should layout flex-end when remaining space is negative in rtl", root_node, root_layout); } [Test] public void TestCase113() { TestCSSNode root_node = new TestCSSNode(); { TestCSSNode node_0 = root_node; addChildren(node_0, 1); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.style.flexDirection = CSSFlexDirection.Row; node_1.style.dimensions[DIMENSION_WIDTH] = 200; addChildren(node_1, 1); { TestCSSNode node_2; node_2 = node_1.getChildAt(0); node_2.setMargin(Spacing.LEFT, 20); node_2.setMargin(Spacing.TOP, 20); node_2.setMargin(Spacing.RIGHT, 20); node_2.setMargin(Spacing.BOTTOM, 20); node_2.setMargin(Spacing.START, 20); node_2.setMargin(Spacing.END, 20); node_2.setMeasureFunction(sTestMeasureFunction); node_2.context = "loooooooooong with space"; } } } TestCSSNode root_layout = new TestCSSNode(); { TestCSSNode node_0 = root_layout; node_0.layout.position[POSITION_TOP] = 0; node_0.layout.position[POSITION_LEFT] = 0; node_0.layout.dimensions[DIMENSION_WIDTH] = 200; node_0.layout.dimensions[DIMENSION_HEIGHT] = 58; addChildren(node_0, 1); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.layout.position[POSITION_TOP] = 0; node_1.layout.position[POSITION_LEFT] = 0; node_1.layout.dimensions[DIMENSION_WIDTH] = 200; node_1.layout.dimensions[DIMENSION_HEIGHT] = 58; addChildren(node_1, 1); { TestCSSNode node_2; node_2 = node_1.getChildAt(0); node_2.layout.position[POSITION_TOP] = 20; node_2.layout.position[POSITION_LEFT] = 20; node_2.layout.dimensions[DIMENSION_WIDTH] = 172; node_2.layout.dimensions[DIMENSION_HEIGHT] = 18; } } } test("should layout text with flexDirection row", root_node, root_layout); } [Test] public void TestCase114() { TestCSSNode root_node = new TestCSSNode(); { TestCSSNode node_0 = root_node; node_0.style.direction = CSSDirection.RTL; addChildren(node_0, 1); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.style.flexDirection = CSSFlexDirection.Row; node_1.style.dimensions[DIMENSION_WIDTH] = 200; addChildren(node_1, 1); { TestCSSNode node_2; node_2 = node_1.getChildAt(0); node_2.setMargin(Spacing.LEFT, 20); node_2.setMargin(Spacing.TOP, 20); node_2.setMargin(Spacing.RIGHT, 20); node_2.setMargin(Spacing.BOTTOM, 20); node_2.setMargin(Spacing.START, 20); node_2.setMargin(Spacing.END, 20); node_2.setMeasureFunction(sTestMeasureFunction); node_2.context = "loooooooooong with space"; } } } TestCSSNode root_layout = new TestCSSNode(); { TestCSSNode node_0 = root_layout; node_0.layout.position[POSITION_TOP] = 0; node_0.layout.position[POSITION_LEFT] = 0; node_0.layout.dimensions[DIMENSION_WIDTH] = 200; node_0.layout.dimensions[DIMENSION_HEIGHT] = 58; addChildren(node_0, 1); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.layout.position[POSITION_TOP] = 0; node_1.layout.position[POSITION_LEFT] = 0; node_1.layout.dimensions[DIMENSION_WIDTH] = 200; node_1.layout.dimensions[DIMENSION_HEIGHT] = 58; addChildren(node_1, 1); { TestCSSNode node_2; node_2 = node_1.getChildAt(0); node_2.layout.position[POSITION_TOP] = 20; node_2.layout.position[POSITION_LEFT] = 8; node_2.layout.dimensions[DIMENSION_WIDTH] = 172; node_2.layout.dimensions[DIMENSION_HEIGHT] = 18; } } } test("should layout text with flexDirection row in rtl", root_node, root_layout); } [Test] public void TestCase115() { TestCSSNode root_node = new TestCSSNode(); { TestCSSNode node_0 = root_node; addChildren(node_0, 1); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.style.dimensions[DIMENSION_WIDTH] = 200; addChildren(node_1, 1); { TestCSSNode node_2; node_2 = node_1.getChildAt(0); node_2.setMargin(Spacing.LEFT, 20); node_2.setMargin(Spacing.TOP, 20); node_2.setMargin(Spacing.RIGHT, 20); node_2.setMargin(Spacing.BOTTOM, 20); node_2.setMargin(Spacing.START, 20); node_2.setMargin(Spacing.END, 20); node_2.setMeasureFunction(sTestMeasureFunction); node_2.context = "loooooooooong with space"; } } } TestCSSNode root_layout = new TestCSSNode(); { TestCSSNode node_0 = root_layout; node_0.layout.position[POSITION_TOP] = 0; node_0.layout.position[POSITION_LEFT] = 0; node_0.layout.dimensions[DIMENSION_WIDTH] = 200; node_0.layout.dimensions[DIMENSION_HEIGHT] = 76; addChildren(node_0, 1); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.layout.position[POSITION_TOP] = 0; node_1.layout.position[POSITION_LEFT] = 0; node_1.layout.dimensions[DIMENSION_WIDTH] = 200; node_1.layout.dimensions[DIMENSION_HEIGHT] = 76; addChildren(node_1, 1); { TestCSSNode node_2; node_2 = node_1.getChildAt(0); node_2.layout.position[POSITION_TOP] = 20; node_2.layout.position[POSITION_LEFT] = 20; node_2.layout.dimensions[DIMENSION_WIDTH] = 160; node_2.layout.dimensions[DIMENSION_HEIGHT] = 36; } } } test("should layout with text and margin", root_node, root_layout); } [Test] public void TestCase116() { TestCSSNode root_node = new TestCSSNode(); { TestCSSNode node_0 = root_node; node_0.style.dimensions[DIMENSION_WIDTH] = 100; node_0.style.dimensions[DIMENSION_HEIGHT] = 100; addChildren(node_0, 1); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.style.positionType = CSSPositionType.Absolute; node_1.style.position[POSITION_LEFT] = 0; node_1.style.position[POSITION_TOP] = 0; node_1.style.position[POSITION_RIGHT] = 0; node_1.style.position[POSITION_BOTTOM] = 0; } } TestCSSNode root_layout = new TestCSSNode(); { TestCSSNode node_0 = root_layout; node_0.layout.position[POSITION_TOP] = 0; node_0.layout.position[POSITION_LEFT] = 0; node_0.layout.dimensions[DIMENSION_WIDTH] = 100; node_0.layout.dimensions[DIMENSION_HEIGHT] = 100; addChildren(node_0, 1); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.layout.position[POSITION_TOP] = 0; node_1.layout.position[POSITION_LEFT] = 0; node_1.layout.dimensions[DIMENSION_WIDTH] = 100; node_1.layout.dimensions[DIMENSION_HEIGHT] = 100; } } test("should layout with position absolute, top, left, bottom, right", root_node, root_layout); } [Test] public void TestCase117() { TestCSSNode root_node = new TestCSSNode(); { TestCSSNode node_0 = root_node; node_0.style.alignSelf = CSSAlign.FlexStart; node_0.style.dimensions[DIMENSION_WIDTH] = 100; node_0.style.dimensions[DIMENSION_HEIGHT] = 100; addChildren(node_0, 2); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.style.alignSelf = CSSAlign.FlexStart; node_1.style.flex = 2.5f; node_1 = node_0.getChildAt(1); node_1.style.alignSelf = CSSAlign.FlexStart; node_1.style.flex = 7.5f; } } TestCSSNode root_layout = new TestCSSNode(); { TestCSSNode node_0 = root_layout; node_0.layout.position[POSITION_TOP] = 0; node_0.layout.position[POSITION_LEFT] = 0; node_0.layout.dimensions[DIMENSION_WIDTH] = 100; node_0.layout.dimensions[DIMENSION_HEIGHT] = 100; addChildren(node_0, 2); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.layout.position[POSITION_TOP] = 0; node_1.layout.position[POSITION_LEFT] = 0; node_1.layout.dimensions[DIMENSION_WIDTH] = 0; node_1.layout.dimensions[DIMENSION_HEIGHT] = 25; node_1 = node_0.getChildAt(1); node_1.layout.position[POSITION_TOP] = 25; node_1.layout.position[POSITION_LEFT] = 0; node_1.layout.dimensions[DIMENSION_WIDTH] = 0; node_1.layout.dimensions[DIMENSION_HEIGHT] = 75; } } test("should layout with arbitrary flex", root_node, root_layout); } [Test] public void TestCase118() { TestCSSNode root_node = new TestCSSNode(); { TestCSSNode node_0 = root_node; node_0.style.flexDirection = CSSFlexDirection.ColumnReverse; node_0.style.alignSelf = CSSAlign.FlexStart; node_0.style.dimensions[DIMENSION_WIDTH] = 100; node_0.style.dimensions[DIMENSION_HEIGHT] = 100; addChildren(node_0, 2); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.style.alignSelf = CSSAlign.FlexStart; node_1.style.flex = 2.5f; node_1 = node_0.getChildAt(1); node_1.style.alignSelf = CSSAlign.FlexStart; node_1.style.flex = 7.5f; } } TestCSSNode root_layout = new TestCSSNode(); { TestCSSNode node_0 = root_layout; node_0.layout.position[POSITION_TOP] = 0; node_0.layout.position[POSITION_LEFT] = 0; node_0.layout.dimensions[DIMENSION_WIDTH] = 100; node_0.layout.dimensions[DIMENSION_HEIGHT] = 100; addChildren(node_0, 2); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.layout.position[POSITION_TOP] = 75; node_1.layout.position[POSITION_LEFT] = 0; node_1.layout.dimensions[DIMENSION_WIDTH] = 0; node_1.layout.dimensions[DIMENSION_HEIGHT] = 25; node_1 = node_0.getChildAt(1); node_1.layout.position[POSITION_TOP] = 0; node_1.layout.position[POSITION_LEFT] = 0; node_1.layout.dimensions[DIMENSION_WIDTH] = 0; node_1.layout.dimensions[DIMENSION_HEIGHT] = 75; } } test("should layout with arbitrary flex in reverse", root_node, root_layout); } [Test] public void TestCase119() { TestCSSNode root_node = new TestCSSNode(); { TestCSSNode node_0 = root_node; node_0.style.flexDirection = CSSFlexDirection.ColumnReverse; node_0.style.alignSelf = CSSAlign.FlexStart; node_0.style.dimensions[DIMENSION_WIDTH] = 100; node_0.style.dimensions[DIMENSION_HEIGHT] = 100; addChildren(node_0, 2); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.style.alignSelf = CSSAlign.FlexStart; node_1.style.flex = -2.5f; node_1 = node_0.getChildAt(1); node_1.style.alignSelf = CSSAlign.FlexStart; node_1.style.flex = 0; } } TestCSSNode root_layout = new TestCSSNode(); { TestCSSNode node_0 = root_layout; node_0.layout.position[POSITION_TOP] = 0; node_0.layout.position[POSITION_LEFT] = 0; node_0.layout.dimensions[DIMENSION_WIDTH] = 100; node_0.layout.dimensions[DIMENSION_HEIGHT] = 100; addChildren(node_0, 2); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.layout.position[POSITION_TOP] = 100; node_1.layout.position[POSITION_LEFT] = 0; node_1.layout.dimensions[DIMENSION_WIDTH] = 0; node_1.layout.dimensions[DIMENSION_HEIGHT] = 0; node_1 = node_0.getChildAt(1); node_1.layout.position[POSITION_TOP] = 100; node_1.layout.position[POSITION_LEFT] = 0; node_1.layout.dimensions[DIMENSION_WIDTH] = 0; node_1.layout.dimensions[DIMENSION_HEIGHT] = 0; } } test("should layout with negative flex in reverse", root_node, root_layout); } [Test] public void TestCase120() { TestCSSNode root_node = new TestCSSNode(); { TestCSSNode node_0 = root_node; addChildren(node_0, 2); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.style.dimensions[DIMENSION_WIDTH] = 50; node_1.style.dimensions[DIMENSION_HEIGHT] = 100; node_1 = node_0.getChildAt(1); node_1.style.positionType = CSSPositionType.Absolute; node_1.style.position[POSITION_LEFT] = 0; node_1.style.position[POSITION_RIGHT] = 0; } } TestCSSNode root_layout = new TestCSSNode(); { TestCSSNode node_0 = root_layout; node_0.layout.position[POSITION_TOP] = 0; node_0.layout.position[POSITION_LEFT] = 0; node_0.layout.dimensions[DIMENSION_WIDTH] = 50; node_0.layout.dimensions[DIMENSION_HEIGHT] = 100; addChildren(node_0, 2); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.layout.position[POSITION_TOP] = 0; node_1.layout.position[POSITION_LEFT] = 0; node_1.layout.dimensions[DIMENSION_WIDTH] = 50; node_1.layout.dimensions[DIMENSION_HEIGHT] = 100; node_1 = node_0.getChildAt(1); node_1.layout.position[POSITION_TOP] = 100; node_1.layout.position[POSITION_LEFT] = 0; node_1.layout.dimensions[DIMENSION_WIDTH] = 50; node_1.layout.dimensions[DIMENSION_HEIGHT] = 0; } } test("should layout with position: absolute and another sibling", root_node, root_layout); } [Test] public void TestCase121() { TestCSSNode root_node = new TestCSSNode(); { TestCSSNode node_0 = root_node; node_0.style.dimensions[DIMENSION_HEIGHT] = 100; addChildren(node_0, 1); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.style.positionType = CSSPositionType.Absolute; node_1.style.position[POSITION_TOP] = 0; node_1.style.position[POSITION_BOTTOM] = 20; } } TestCSSNode root_layout = new TestCSSNode(); { TestCSSNode node_0 = root_layout; node_0.layout.position[POSITION_TOP] = 0; node_0.layout.position[POSITION_LEFT] = 0; node_0.layout.dimensions[DIMENSION_WIDTH] = 0; node_0.layout.dimensions[DIMENSION_HEIGHT] = 100; addChildren(node_0, 1); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.layout.position[POSITION_TOP] = 0; node_1.layout.position[POSITION_LEFT] = 0; node_1.layout.dimensions[DIMENSION_WIDTH] = 0; node_1.layout.dimensions[DIMENSION_HEIGHT] = 80; } } test("should calculate height properly with position: absolute top and bottom", root_node, root_layout); } [Test] public void TestCase122() { TestCSSNode root_node = new TestCSSNode(); { TestCSSNode node_0 = root_node; node_0.style.dimensions[DIMENSION_WIDTH] = 200; node_0.style.dimensions[DIMENSION_HEIGHT] = 200; addChildren(node_0, 1); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.style.justifyContent = CSSJustify.Center; node_1.style.positionType = CSSPositionType.Absolute; node_1.style.position[POSITION_LEFT] = 0; node_1.style.position[POSITION_TOP] = 0; node_1.style.position[POSITION_RIGHT] = 0; node_1.style.position[POSITION_BOTTOM] = 0; addChildren(node_1, 1); { TestCSSNode node_2; node_2 = node_1.getChildAt(0); node_2.style.dimensions[DIMENSION_WIDTH] = 100; node_2.style.dimensions[DIMENSION_HEIGHT] = 100; } } } TestCSSNode root_layout = new TestCSSNode(); { TestCSSNode node_0 = root_layout; node_0.layout.position[POSITION_TOP] = 0; node_0.layout.position[POSITION_LEFT] = 0; node_0.layout.dimensions[DIMENSION_WIDTH] = 200; node_0.layout.dimensions[DIMENSION_HEIGHT] = 200; addChildren(node_0, 1); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.layout.position[POSITION_TOP] = 0; node_1.layout.position[POSITION_LEFT] = 0; node_1.layout.dimensions[DIMENSION_WIDTH] = 200; node_1.layout.dimensions[DIMENSION_HEIGHT] = 200; addChildren(node_1, 1); { TestCSSNode node_2; node_2 = node_1.getChildAt(0); node_2.layout.position[POSITION_TOP] = 50; node_2.layout.position[POSITION_LEFT] = 0; node_2.layout.dimensions[DIMENSION_WIDTH] = 100; node_2.layout.dimensions[DIMENSION_HEIGHT] = 100; } } } test("should layout with complicated position: absolute and justifyContent: center combo", root_node, root_layout); } [Test] public void TestCase123() { TestCSSNode root_node = new TestCSSNode(); { TestCSSNode node_0 = root_node; node_0.style.dimensions[DIMENSION_HEIGHT] = 100; addChildren(node_0, 1); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.style.positionType = CSSPositionType.Absolute; node_1.style.position[POSITION_BOTTOM] = 0; } } TestCSSNode root_layout = new TestCSSNode(); { TestCSSNode node_0 = root_layout; node_0.layout.position[POSITION_TOP] = 0; node_0.layout.position[POSITION_LEFT] = 0; node_0.layout.dimensions[DIMENSION_WIDTH] = 0; node_0.layout.dimensions[DIMENSION_HEIGHT] = 100; addChildren(node_0, 1); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.layout.position[POSITION_TOP] = 100; node_1.layout.position[POSITION_LEFT] = 0; node_1.layout.dimensions[DIMENSION_WIDTH] = 0; node_1.layout.dimensions[DIMENSION_HEIGHT] = 0; } } test("should calculate top properly with position: absolute bottom", root_node, root_layout); } [Test] public void TestCase124() { TestCSSNode root_node = new TestCSSNode(); { TestCSSNode node_0 = root_node; node_0.style.dimensions[DIMENSION_WIDTH] = 100; addChildren(node_0, 1); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.style.positionType = CSSPositionType.Absolute; node_1.style.position[POSITION_RIGHT] = 0; } } TestCSSNode root_layout = new TestCSSNode(); { TestCSSNode node_0 = root_layout; node_0.layout.position[POSITION_TOP] = 0; node_0.layout.position[POSITION_LEFT] = 0; node_0.layout.dimensions[DIMENSION_WIDTH] = 100; node_0.layout.dimensions[DIMENSION_HEIGHT] = 0; addChildren(node_0, 1); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.layout.position[POSITION_TOP] = 0; node_1.layout.position[POSITION_LEFT] = 100; node_1.layout.dimensions[DIMENSION_WIDTH] = 0; node_1.layout.dimensions[DIMENSION_HEIGHT] = 0; } } test("should calculate left properly with position: absolute right", root_node, root_layout); } [Test] public void TestCase125() { TestCSSNode root_node = new TestCSSNode(); { TestCSSNode node_0 = root_node; node_0.style.dimensions[DIMENSION_HEIGHT] = 100; addChildren(node_0, 1); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.style.positionType = CSSPositionType.Absolute; node_1.style.dimensions[DIMENSION_HEIGHT] = 10; node_1.style.position[POSITION_BOTTOM] = 0; } } TestCSSNode root_layout = new TestCSSNode(); { TestCSSNode node_0 = root_layout; node_0.layout.position[POSITION_TOP] = 0; node_0.layout.position[POSITION_LEFT] = 0; node_0.layout.dimensions[DIMENSION_WIDTH] = 0; node_0.layout.dimensions[DIMENSION_HEIGHT] = 100; addChildren(node_0, 1); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.layout.position[POSITION_TOP] = 90; node_1.layout.position[POSITION_LEFT] = 0; node_1.layout.dimensions[DIMENSION_WIDTH] = 0; node_1.layout.dimensions[DIMENSION_HEIGHT] = 10; } } test("should calculate top properly with position: absolute bottom and height", root_node, root_layout); } [Test] public void TestCase126() { TestCSSNode root_node = new TestCSSNode(); { TestCSSNode node_0 = root_node; node_0.style.dimensions[DIMENSION_WIDTH] = 100; addChildren(node_0, 1); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.style.positionType = CSSPositionType.Absolute; node_1.style.dimensions[DIMENSION_WIDTH] = 10; node_1.style.position[POSITION_RIGHT] = 0; } } TestCSSNode root_layout = new TestCSSNode(); { TestCSSNode node_0 = root_layout; node_0.layout.position[POSITION_TOP] = 0; node_0.layout.position[POSITION_LEFT] = 0; node_0.layout.dimensions[DIMENSION_WIDTH] = 100; node_0.layout.dimensions[DIMENSION_HEIGHT] = 0; addChildren(node_0, 1); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.layout.position[POSITION_TOP] = 0; node_1.layout.position[POSITION_LEFT] = 90; node_1.layout.dimensions[DIMENSION_WIDTH] = 10; node_1.layout.dimensions[DIMENSION_HEIGHT] = 0; } } test("should calculate left properly with position: absolute right and width", root_node, root_layout); } [Test] public void TestCase127() { TestCSSNode root_node = new TestCSSNode(); { TestCSSNode node_0 = root_node; addChildren(node_0, 1); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.style.positionType = CSSPositionType.Absolute; node_1.style.dimensions[DIMENSION_HEIGHT] = 10; node_1.style.position[POSITION_BOTTOM] = 0; } } TestCSSNode root_layout = new TestCSSNode(); { TestCSSNode node_0 = root_layout; node_0.layout.position[POSITION_TOP] = 0; node_0.layout.position[POSITION_LEFT] = 0; node_0.layout.dimensions[DIMENSION_WIDTH] = 0; node_0.layout.dimensions[DIMENSION_HEIGHT] = 0; addChildren(node_0, 1); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.layout.position[POSITION_TOP] = -10; node_1.layout.position[POSITION_LEFT] = 0; node_1.layout.dimensions[DIMENSION_WIDTH] = 0; node_1.layout.dimensions[DIMENSION_HEIGHT] = 10; } } test("should calculate top properly with position: absolute right, width, and no parent dimensions", root_node, root_layout); } [Test] public void TestCase128() { TestCSSNode root_node = new TestCSSNode(); { TestCSSNode node_0 = root_node; addChildren(node_0, 1); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.style.positionType = CSSPositionType.Absolute; node_1.style.dimensions[DIMENSION_WIDTH] = 10; node_1.style.position[POSITION_RIGHT] = 0; } } TestCSSNode root_layout = new TestCSSNode(); { TestCSSNode node_0 = root_layout; node_0.layout.position[POSITION_TOP] = 0; node_0.layout.position[POSITION_LEFT] = 0; node_0.layout.dimensions[DIMENSION_WIDTH] = 0; node_0.layout.dimensions[DIMENSION_HEIGHT] = 0; addChildren(node_0, 1); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.layout.position[POSITION_TOP] = 0; node_1.layout.position[POSITION_LEFT] = -10; node_1.layout.dimensions[DIMENSION_WIDTH] = 10; node_1.layout.dimensions[DIMENSION_HEIGHT] = 0; } } test("should calculate left properly with position: absolute right, width, and no parent dimensions", root_node, root_layout); } [Test] public void TestCase129() { TestCSSNode root_node = new TestCSSNode(); { TestCSSNode node_0 = root_node; node_0.style.justifyContent = CSSJustify.SpaceBetween; addChildren(node_0, 1); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.setBorder(Spacing.BOTTOM, 1); } } TestCSSNode root_layout = new TestCSSNode(); { TestCSSNode node_0 = root_layout; node_0.layout.position[POSITION_TOP] = 0; node_0.layout.position[POSITION_LEFT] = 0; node_0.layout.dimensions[DIMENSION_WIDTH] = 0; node_0.layout.dimensions[DIMENSION_HEIGHT] = 1; addChildren(node_0, 1); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.layout.position[POSITION_TOP] = 0; node_1.layout.position[POSITION_LEFT] = 0; node_1.layout.dimensions[DIMENSION_WIDTH] = 0; node_1.layout.dimensions[DIMENSION_HEIGHT] = 1; } } test("should layout border bottom inside of justify content space between container", root_node, root_layout); } [Test] public void TestCase130() { TestCSSNode root_node = new TestCSSNode(); { TestCSSNode node_0 = root_node; node_0.style.justifyContent = CSSJustify.Center; addChildren(node_0, 1); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.setMargin(Spacing.TOP, -6); } } TestCSSNode root_layout = new TestCSSNode(); { TestCSSNode node_0 = root_layout; node_0.layout.position[POSITION_TOP] = 0; node_0.layout.position[POSITION_LEFT] = 0; node_0.layout.dimensions[DIMENSION_WIDTH] = 0; node_0.layout.dimensions[DIMENSION_HEIGHT] = 0; addChildren(node_0, 1); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.layout.position[POSITION_TOP] = -3; node_1.layout.position[POSITION_LEFT] = 0; node_1.layout.dimensions[DIMENSION_WIDTH] = 0; node_1.layout.dimensions[DIMENSION_HEIGHT] = 0; } } test("should layout negative margin top inside of justify content center container", root_node, root_layout); } [Test] public void TestCase131() { TestCSSNode root_node = new TestCSSNode(); { TestCSSNode node_0 = root_node; node_0.style.justifyContent = CSSJustify.Center; addChildren(node_0, 1); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.setMargin(Spacing.TOP, 20); } } TestCSSNode root_layout = new TestCSSNode(); { TestCSSNode node_0 = root_layout; node_0.layout.position[POSITION_TOP] = 0; node_0.layout.position[POSITION_LEFT] = 0; node_0.layout.dimensions[DIMENSION_WIDTH] = 0; node_0.layout.dimensions[DIMENSION_HEIGHT] = 20; addChildren(node_0, 1); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.layout.position[POSITION_TOP] = 20; node_1.layout.position[POSITION_LEFT] = 0; node_1.layout.dimensions[DIMENSION_WIDTH] = 0; node_1.layout.dimensions[DIMENSION_HEIGHT] = 0; } } test("should layout positive margin top inside of justify content center container", root_node, root_layout); } [Test] public void TestCase132() { TestCSSNode root_node = new TestCSSNode(); { TestCSSNode node_0 = root_node; node_0.style.justifyContent = CSSJustify.FlexEnd; node_0.setBorder(Spacing.BOTTOM, 5); addChildren(node_0, 1); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); } } TestCSSNode root_layout = new TestCSSNode(); { TestCSSNode node_0 = root_layout; node_0.layout.position[POSITION_TOP] = 0; node_0.layout.position[POSITION_LEFT] = 0; node_0.layout.dimensions[DIMENSION_WIDTH] = 0; node_0.layout.dimensions[DIMENSION_HEIGHT] = 5; addChildren(node_0, 1); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.layout.position[POSITION_TOP] = 0; node_1.layout.position[POSITION_LEFT] = 0; node_1.layout.dimensions[DIMENSION_WIDTH] = 0; node_1.layout.dimensions[DIMENSION_HEIGHT] = 0; } } test("should layout border bottom and flex end with an empty child", root_node, root_layout); } [Test] public void TestCase133() { TestCSSNode root_node = new TestCSSNode(); { TestCSSNode node_0 = root_node; node_0.style.dimensions[DIMENSION_WIDTH] = 800; addChildren(node_0, 1); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.style.position[POSITION_LEFT] = 5; addChildren(node_1, 1); { TestCSSNode node_2; node_2 = node_1.getChildAt(0); } } } TestCSSNode root_layout = new TestCSSNode(); { TestCSSNode node_0 = root_layout; node_0.layout.position[POSITION_TOP] = 0; node_0.layout.position[POSITION_LEFT] = 0; node_0.layout.dimensions[DIMENSION_WIDTH] = 800; node_0.layout.dimensions[DIMENSION_HEIGHT] = 0; addChildren(node_0, 1); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.layout.position[POSITION_TOP] = 0; node_1.layout.position[POSITION_LEFT] = 5; node_1.layout.dimensions[DIMENSION_WIDTH] = 800; node_1.layout.dimensions[DIMENSION_HEIGHT] = 0; addChildren(node_1, 1); { TestCSSNode node_2; node_2 = node_1.getChildAt(0); node_2.layout.position[POSITION_TOP] = 0; node_2.layout.position[POSITION_LEFT] = 0; node_2.layout.dimensions[DIMENSION_WIDTH] = 800; node_2.layout.dimensions[DIMENSION_HEIGHT] = 0; } } } test("should layout with children of a contain with left", root_node, root_layout); } [Test] public void TestCase134() { TestCSSNode root_node = new TestCSSNode(); { TestCSSNode node_0 = root_node; node_0.style.flexDirection = CSSFlexDirection.Row; node_0.style.flexWrap = CSSWrap.Wrap; node_0.style.dimensions[DIMENSION_WIDTH] = 100; addChildren(node_0, 3); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.style.dimensions[DIMENSION_WIDTH] = 40; node_1.style.dimensions[DIMENSION_HEIGHT] = 10; node_1 = node_0.getChildAt(1); node_1.style.dimensions[DIMENSION_WIDTH] = 40; node_1.style.dimensions[DIMENSION_HEIGHT] = 10; node_1 = node_0.getChildAt(2); node_1.style.dimensions[DIMENSION_WIDTH] = 40; node_1.style.dimensions[DIMENSION_HEIGHT] = 10; } } TestCSSNode root_layout = new TestCSSNode(); { TestCSSNode node_0 = root_layout; node_0.layout.position[POSITION_TOP] = 0; node_0.layout.position[POSITION_LEFT] = 0; node_0.layout.dimensions[DIMENSION_WIDTH] = 100; node_0.layout.dimensions[DIMENSION_HEIGHT] = 20; addChildren(node_0, 3); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.layout.position[POSITION_TOP] = 0; node_1.layout.position[POSITION_LEFT] = 0; node_1.layout.dimensions[DIMENSION_WIDTH] = 40; node_1.layout.dimensions[DIMENSION_HEIGHT] = 10; node_1 = node_0.getChildAt(1); node_1.layout.position[POSITION_TOP] = 0; node_1.layout.position[POSITION_LEFT] = 40; node_1.layout.dimensions[DIMENSION_WIDTH] = 40; node_1.layout.dimensions[DIMENSION_HEIGHT] = 10; node_1 = node_0.getChildAt(2); node_1.layout.position[POSITION_TOP] = 10; node_1.layout.position[POSITION_LEFT] = 0; node_1.layout.dimensions[DIMENSION_WIDTH] = 40; node_1.layout.dimensions[DIMENSION_HEIGHT] = 10; } } test("should layout flex-wrap", root_node, root_layout); } [Test] public void TestCase135() { TestCSSNode root_node = new TestCSSNode(); { TestCSSNode node_0 = root_node; node_0.style.direction = CSSDirection.RTL; node_0.style.flexDirection = CSSFlexDirection.Row; node_0.style.flexWrap = CSSWrap.Wrap; node_0.style.dimensions[DIMENSION_WIDTH] = 100; addChildren(node_0, 3); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.style.dimensions[DIMENSION_WIDTH] = 40; node_1.style.dimensions[DIMENSION_HEIGHT] = 10; node_1 = node_0.getChildAt(1); node_1.style.dimensions[DIMENSION_WIDTH] = 40; node_1.style.dimensions[DIMENSION_HEIGHT] = 10; node_1 = node_0.getChildAt(2); node_1.style.dimensions[DIMENSION_WIDTH] = 40; node_1.style.dimensions[DIMENSION_HEIGHT] = 10; } } TestCSSNode root_layout = new TestCSSNode(); { TestCSSNode node_0 = root_layout; node_0.layout.position[POSITION_TOP] = 0; node_0.layout.position[POSITION_LEFT] = 0; node_0.layout.dimensions[DIMENSION_WIDTH] = 100; node_0.layout.dimensions[DIMENSION_HEIGHT] = 20; addChildren(node_0, 3); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.layout.position[POSITION_TOP] = 0; node_1.layout.position[POSITION_LEFT] = 60; node_1.layout.dimensions[DIMENSION_WIDTH] = 40; node_1.layout.dimensions[DIMENSION_HEIGHT] = 10; node_1 = node_0.getChildAt(1); node_1.layout.position[POSITION_TOP] = 0; node_1.layout.position[POSITION_LEFT] = 20; node_1.layout.dimensions[DIMENSION_WIDTH] = 40; node_1.layout.dimensions[DIMENSION_HEIGHT] = 10; node_1 = node_0.getChildAt(2); node_1.layout.position[POSITION_TOP] = 10; node_1.layout.position[POSITION_LEFT] = 60; node_1.layout.dimensions[DIMENSION_WIDTH] = 40; node_1.layout.dimensions[DIMENSION_HEIGHT] = 10; } } test("should layout flex-wrap in rtl", root_node, root_layout); } [Test] public void TestCase136() { TestCSSNode root_node = new TestCSSNode(); { TestCSSNode node_0 = root_node; node_0.style.flexWrap = CSSWrap.Wrap; node_0.style.dimensions[DIMENSION_HEIGHT] = 100; addChildren(node_0, 2); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.style.dimensions[DIMENSION_HEIGHT] = 100; node_1 = node_0.getChildAt(1); node_1.style.dimensions[DIMENSION_HEIGHT] = 200; } } TestCSSNode root_layout = new TestCSSNode(); { TestCSSNode node_0 = root_layout; node_0.layout.position[POSITION_TOP] = 0; node_0.layout.position[POSITION_LEFT] = 0; node_0.layout.dimensions[DIMENSION_WIDTH] = 0; node_0.layout.dimensions[DIMENSION_HEIGHT] = 100; addChildren(node_0, 2); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.layout.position[POSITION_TOP] = 0; node_1.layout.position[POSITION_LEFT] = 0; node_1.layout.dimensions[DIMENSION_WIDTH] = 0; node_1.layout.dimensions[DIMENSION_HEIGHT] = 100; node_1 = node_0.getChildAt(1); node_1.layout.position[POSITION_TOP] = 0; node_1.layout.position[POSITION_LEFT] = 0; node_1.layout.dimensions[DIMENSION_WIDTH] = 0; node_1.layout.dimensions[DIMENSION_HEIGHT] = 200; } } test("should layout flex wrap with a line bigger than container", root_node, root_layout); } [Test] public void TestCase137() { TestCSSNode root_node = new TestCSSNode(); { TestCSSNode node_0 = root_node; node_0.style.dimensions[DIMENSION_WIDTH] = 100; node_0.style.dimensions[DIMENSION_HEIGHT] = 200; node_0.style.maxWidth = 90; node_0.style.maxHeight = 190; } TestCSSNode root_layout = new TestCSSNode(); { TestCSSNode node_0 = root_layout; node_0.layout.position[POSITION_TOP] = 0; node_0.layout.position[POSITION_LEFT] = 0; node_0.layout.dimensions[DIMENSION_WIDTH] = 90; node_0.layout.dimensions[DIMENSION_HEIGHT] = 190; } test("should use max bounds", root_node, root_layout); } [Test] public void TestCase138() { TestCSSNode root_node = new TestCSSNode(); { TestCSSNode node_0 = root_node; node_0.style.dimensions[DIMENSION_WIDTH] = 100; node_0.style.dimensions[DIMENSION_HEIGHT] = 200; node_0.style.minWidth = 110; node_0.style.minHeight = 210; } TestCSSNode root_layout = new TestCSSNode(); { TestCSSNode node_0 = root_layout; node_0.layout.position[POSITION_TOP] = 0; node_0.layout.position[POSITION_LEFT] = 0; node_0.layout.dimensions[DIMENSION_WIDTH] = 110; node_0.layout.dimensions[DIMENSION_HEIGHT] = 210; } test("should use min bounds", root_node, root_layout); } [Test] public void TestCase139() { TestCSSNode root_node = new TestCSSNode(); { TestCSSNode node_0 = root_node; node_0.style.dimensions[DIMENSION_WIDTH] = 100; node_0.style.dimensions[DIMENSION_HEIGHT] = 200; node_0.style.maxWidth = 90; node_0.style.maxHeight = 190; node_0.style.minWidth = 110; node_0.style.minHeight = 210; } TestCSSNode root_layout = new TestCSSNode(); { TestCSSNode node_0 = root_layout; node_0.layout.position[POSITION_TOP] = 0; node_0.layout.position[POSITION_LEFT] = 0; node_0.layout.dimensions[DIMENSION_WIDTH] = 110; node_0.layout.dimensions[DIMENSION_HEIGHT] = 210; } test("should use min bounds over max bounds", root_node, root_layout); } [Test] public void TestCase140() { TestCSSNode root_node = new TestCSSNode(); { TestCSSNode node_0 = root_node; node_0.style.dimensions[DIMENSION_WIDTH] = 100; node_0.style.dimensions[DIMENSION_HEIGHT] = 200; node_0.style.maxWidth = 80; node_0.style.maxHeight = 180; node_0.style.minWidth = 90; node_0.style.minHeight = 190; } TestCSSNode root_layout = new TestCSSNode(); { TestCSSNode node_0 = root_layout; node_0.layout.position[POSITION_TOP] = 0; node_0.layout.position[POSITION_LEFT] = 0; node_0.layout.dimensions[DIMENSION_WIDTH] = 90; node_0.layout.dimensions[DIMENSION_HEIGHT] = 190; } test("should use min bounds over max bounds and natural width", root_node, root_layout); } [Test] public void TestCase141() { TestCSSNode root_node = new TestCSSNode(); { TestCSSNode node_0 = root_node; node_0.style.dimensions[DIMENSION_WIDTH] = 100; node_0.style.dimensions[DIMENSION_HEIGHT] = 200; node_0.style.minWidth = -10; node_0.style.minHeight = -20; } TestCSSNode root_layout = new TestCSSNode(); { TestCSSNode node_0 = root_layout; node_0.layout.position[POSITION_TOP] = 0; node_0.layout.position[POSITION_LEFT] = 0; node_0.layout.dimensions[DIMENSION_WIDTH] = 100; node_0.layout.dimensions[DIMENSION_HEIGHT] = 200; } test("should ignore negative min bounds", root_node, root_layout); } [Test] public void TestCase142() { TestCSSNode root_node = new TestCSSNode(); { TestCSSNode node_0 = root_node; node_0.style.dimensions[DIMENSION_WIDTH] = 100; node_0.style.dimensions[DIMENSION_HEIGHT] = 200; node_0.style.maxWidth = -10; node_0.style.maxHeight = -20; } TestCSSNode root_layout = new TestCSSNode(); { TestCSSNode node_0 = root_layout; node_0.layout.position[POSITION_TOP] = 0; node_0.layout.position[POSITION_LEFT] = 0; node_0.layout.dimensions[DIMENSION_WIDTH] = 100; node_0.layout.dimensions[DIMENSION_HEIGHT] = 200; } test("should ignore negative max bounds", root_node, root_layout); } [Test] public void TestCase143() { TestCSSNode root_node = new TestCSSNode(); { TestCSSNode node_0 = root_node; node_0.style.maxWidth = 30; node_0.style.maxHeight = 10; node_0.setPadding(Spacing.LEFT, 20); node_0.setPadding(Spacing.TOP, 15); node_0.setPadding(Spacing.RIGHT, 20); node_0.setPadding(Spacing.BOTTOM, 15); } TestCSSNode root_layout = new TestCSSNode(); { TestCSSNode node_0 = root_layout; node_0.layout.position[POSITION_TOP] = 0; node_0.layout.position[POSITION_LEFT] = 0; node_0.layout.dimensions[DIMENSION_WIDTH] = 40; node_0.layout.dimensions[DIMENSION_HEIGHT] = 30; } test("should use padded size over max bounds", root_node, root_layout); } [Test] public void TestCase144() { TestCSSNode root_node = new TestCSSNode(); { TestCSSNode node_0 = root_node; node_0.style.minWidth = 50; node_0.style.minHeight = 40; node_0.setPadding(Spacing.LEFT, 20); node_0.setPadding(Spacing.TOP, 15); node_0.setPadding(Spacing.RIGHT, 20); node_0.setPadding(Spacing.BOTTOM, 15); } TestCSSNode root_layout = new TestCSSNode(); { TestCSSNode node_0 = root_layout; node_0.layout.position[POSITION_TOP] = 0; node_0.layout.position[POSITION_LEFT] = 0; node_0.layout.dimensions[DIMENSION_WIDTH] = 50; node_0.layout.dimensions[DIMENSION_HEIGHT] = 40; } test("should use min size over padded size", root_node, root_layout); } [Test] public void TestCase145() { TestCSSNode root_node = new TestCSSNode(); { TestCSSNode node_0 = root_node; node_0.style.flexDirection = CSSFlexDirection.Row; node_0.style.dimensions[DIMENSION_WIDTH] = 300; node_0.style.dimensions[DIMENSION_HEIGHT] = 200; addChildren(node_0, 3); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.style.flex = 1; node_1 = node_0.getChildAt(1); node_1.style.flex = 1; node_1.style.minWidth = 200; node_1 = node_0.getChildAt(2); node_1.style.flex = 1; } } TestCSSNode root_layout = new TestCSSNode(); { TestCSSNode node_0 = root_layout; node_0.layout.position[POSITION_TOP] = 0; node_0.layout.position[POSITION_LEFT] = 0; node_0.layout.dimensions[DIMENSION_WIDTH] = 300; node_0.layout.dimensions[DIMENSION_HEIGHT] = 200; addChildren(node_0, 3); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.layout.position[POSITION_TOP] = 0; node_1.layout.position[POSITION_LEFT] = 0; node_1.layout.dimensions[DIMENSION_WIDTH] = 50; node_1.layout.dimensions[DIMENSION_HEIGHT] = 200; node_1 = node_0.getChildAt(1); node_1.layout.position[POSITION_TOP] = 0; node_1.layout.position[POSITION_LEFT] = 50; node_1.layout.dimensions[DIMENSION_WIDTH] = 200; node_1.layout.dimensions[DIMENSION_HEIGHT] = 200; node_1 = node_0.getChildAt(2); node_1.layout.position[POSITION_TOP] = 0; node_1.layout.position[POSITION_LEFT] = 250; node_1.layout.dimensions[DIMENSION_WIDTH] = 50; node_1.layout.dimensions[DIMENSION_HEIGHT] = 200; } } test("should override flex direction size with min bounds", root_node, root_layout); } [Test] public void TestCase146() { TestCSSNode root_node = new TestCSSNode(); { TestCSSNode node_0 = root_node; node_0.style.direction = CSSDirection.RTL; node_0.style.flexDirection = CSSFlexDirection.Row; node_0.style.dimensions[DIMENSION_WIDTH] = 300; node_0.style.dimensions[DIMENSION_HEIGHT] = 200; addChildren(node_0, 3); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.style.flex = 1; node_1 = node_0.getChildAt(1); node_1.style.flex = 1; node_1.style.minWidth = 200; node_1 = node_0.getChildAt(2); node_1.style.flex = 1; } } TestCSSNode root_layout = new TestCSSNode(); { TestCSSNode node_0 = root_layout; node_0.layout.position[POSITION_TOP] = 0; node_0.layout.position[POSITION_LEFT] = 0; node_0.layout.dimensions[DIMENSION_WIDTH] = 300; node_0.layout.dimensions[DIMENSION_HEIGHT] = 200; addChildren(node_0, 3); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.layout.position[POSITION_TOP] = 0; node_1.layout.position[POSITION_LEFT] = 250; node_1.layout.dimensions[DIMENSION_WIDTH] = 50; node_1.layout.dimensions[DIMENSION_HEIGHT] = 200; node_1 = node_0.getChildAt(1); node_1.layout.position[POSITION_TOP] = 0; node_1.layout.position[POSITION_LEFT] = 50; node_1.layout.dimensions[DIMENSION_WIDTH] = 200; node_1.layout.dimensions[DIMENSION_HEIGHT] = 200; node_1 = node_0.getChildAt(2); node_1.layout.position[POSITION_TOP] = 0; node_1.layout.position[POSITION_LEFT] = 0; node_1.layout.dimensions[DIMENSION_WIDTH] = 50; node_1.layout.dimensions[DIMENSION_HEIGHT] = 200; } } test("should override flex direction size with min bounds in rtl", root_node, root_layout); } [Test] public void TestCase147() { TestCSSNode root_node = new TestCSSNode(); { TestCSSNode node_0 = root_node; node_0.style.flexDirection = CSSFlexDirection.Row; node_0.style.dimensions[DIMENSION_WIDTH] = 300; node_0.style.dimensions[DIMENSION_HEIGHT] = 200; addChildren(node_0, 3); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.style.flex = 1; node_1 = node_0.getChildAt(1); node_1.style.flex = 1; node_1.style.maxWidth = 110; node_1.style.minWidth = 90; node_1 = node_0.getChildAt(2); node_1.style.flex = 1; } } TestCSSNode root_layout = new TestCSSNode(); { TestCSSNode node_0 = root_layout; node_0.layout.position[POSITION_TOP] = 0; node_0.layout.position[POSITION_LEFT] = 0; node_0.layout.dimensions[DIMENSION_WIDTH] = 300; node_0.layout.dimensions[DIMENSION_HEIGHT] = 200; addChildren(node_0, 3); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.layout.position[POSITION_TOP] = 0; node_1.layout.position[POSITION_LEFT] = 0; node_1.layout.dimensions[DIMENSION_WIDTH] = 100; node_1.layout.dimensions[DIMENSION_HEIGHT] = 200; node_1 = node_0.getChildAt(1); node_1.layout.position[POSITION_TOP] = 0; node_1.layout.position[POSITION_LEFT] = 100; node_1.layout.dimensions[DIMENSION_WIDTH] = 100; node_1.layout.dimensions[DIMENSION_HEIGHT] = 200; node_1 = node_0.getChildAt(2); node_1.layout.position[POSITION_TOP] = 0; node_1.layout.position[POSITION_LEFT] = 200; node_1.layout.dimensions[DIMENSION_WIDTH] = 100; node_1.layout.dimensions[DIMENSION_HEIGHT] = 200; } } test("should not override flex direction size within bounds", root_node, root_layout); } [Test] public void TestCase148() { TestCSSNode root_node = new TestCSSNode(); { TestCSSNode node_0 = root_node; node_0.style.direction = CSSDirection.RTL; node_0.style.flexDirection = CSSFlexDirection.Row; node_0.style.dimensions[DIMENSION_WIDTH] = 300; node_0.style.dimensions[DIMENSION_HEIGHT] = 200; addChildren(node_0, 3); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.style.flex = 1; node_1 = node_0.getChildAt(1); node_1.style.flex = 1; node_1.style.maxWidth = 110; node_1.style.minWidth = 90; node_1 = node_0.getChildAt(2); node_1.style.flex = 1; } } TestCSSNode root_layout = new TestCSSNode(); { TestCSSNode node_0 = root_layout; node_0.layout.position[POSITION_TOP] = 0; node_0.layout.position[POSITION_LEFT] = 0; node_0.layout.dimensions[DIMENSION_WIDTH] = 300; node_0.layout.dimensions[DIMENSION_HEIGHT] = 200; addChildren(node_0, 3); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.layout.position[POSITION_TOP] = 0; node_1.layout.position[POSITION_LEFT] = 200; node_1.layout.dimensions[DIMENSION_WIDTH] = 100; node_1.layout.dimensions[DIMENSION_HEIGHT] = 200; node_1 = node_0.getChildAt(1); node_1.layout.position[POSITION_TOP] = 0; node_1.layout.position[POSITION_LEFT] = 100; node_1.layout.dimensions[DIMENSION_WIDTH] = 100; node_1.layout.dimensions[DIMENSION_HEIGHT] = 200; node_1 = node_0.getChildAt(2); node_1.layout.position[POSITION_TOP] = 0; node_1.layout.position[POSITION_LEFT] = 0; node_1.layout.dimensions[DIMENSION_WIDTH] = 100; node_1.layout.dimensions[DIMENSION_HEIGHT] = 200; } } test("should not override flex direction size within bounds in rtl", root_node, root_layout); } [Test] public void TestCase149() { TestCSSNode root_node = new TestCSSNode(); { TestCSSNode node_0 = root_node; node_0.style.flexDirection = CSSFlexDirection.Row; node_0.style.dimensions[DIMENSION_WIDTH] = 300; node_0.style.dimensions[DIMENSION_HEIGHT] = 200; addChildren(node_0, 3); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.style.flex = 1; node_1 = node_0.getChildAt(1); node_1.style.flex = 1; node_1.style.maxWidth = 60; node_1 = node_0.getChildAt(2); node_1.style.flex = 1; } } TestCSSNode root_layout = new TestCSSNode(); { TestCSSNode node_0 = root_layout; node_0.layout.position[POSITION_TOP] = 0; node_0.layout.position[POSITION_LEFT] = 0; node_0.layout.dimensions[DIMENSION_WIDTH] = 300; node_0.layout.dimensions[DIMENSION_HEIGHT] = 200; addChildren(node_0, 3); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.layout.position[POSITION_TOP] = 0; node_1.layout.position[POSITION_LEFT] = 0; node_1.layout.dimensions[DIMENSION_WIDTH] = 120; node_1.layout.dimensions[DIMENSION_HEIGHT] = 200; node_1 = node_0.getChildAt(1); node_1.layout.position[POSITION_TOP] = 0; node_1.layout.position[POSITION_LEFT] = 120; node_1.layout.dimensions[DIMENSION_WIDTH] = 60; node_1.layout.dimensions[DIMENSION_HEIGHT] = 200; node_1 = node_0.getChildAt(2); node_1.layout.position[POSITION_TOP] = 0; node_1.layout.position[POSITION_LEFT] = 180; node_1.layout.dimensions[DIMENSION_WIDTH] = 120; node_1.layout.dimensions[DIMENSION_HEIGHT] = 200; } } test("should override flex direction size with max bounds", root_node, root_layout); } [Test] public void TestCase150() { TestCSSNode root_node = new TestCSSNode(); { TestCSSNode node_0 = root_node; node_0.style.direction = CSSDirection.RTL; node_0.style.flexDirection = CSSFlexDirection.Row; node_0.style.dimensions[DIMENSION_WIDTH] = 300; node_0.style.dimensions[DIMENSION_HEIGHT] = 200; addChildren(node_0, 3); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.style.flex = 1; node_1 = node_0.getChildAt(1); node_1.style.flex = 1; node_1.style.maxWidth = 60; node_1 = node_0.getChildAt(2); node_1.style.flex = 1; } } TestCSSNode root_layout = new TestCSSNode(); { TestCSSNode node_0 = root_layout; node_0.layout.position[POSITION_TOP] = 0; node_0.layout.position[POSITION_LEFT] = 0; node_0.layout.dimensions[DIMENSION_WIDTH] = 300; node_0.layout.dimensions[DIMENSION_HEIGHT] = 200; addChildren(node_0, 3); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.layout.position[POSITION_TOP] = 0; node_1.layout.position[POSITION_LEFT] = 180; node_1.layout.dimensions[DIMENSION_WIDTH] = 120; node_1.layout.dimensions[DIMENSION_HEIGHT] = 200; node_1 = node_0.getChildAt(1); node_1.layout.position[POSITION_TOP] = 0; node_1.layout.position[POSITION_LEFT] = 120; node_1.layout.dimensions[DIMENSION_WIDTH] = 60; node_1.layout.dimensions[DIMENSION_HEIGHT] = 200; node_1 = node_0.getChildAt(2); node_1.layout.position[POSITION_TOP] = 0; node_1.layout.position[POSITION_LEFT] = 0; node_1.layout.dimensions[DIMENSION_WIDTH] = 120; node_1.layout.dimensions[DIMENSION_HEIGHT] = 200; } } test("should override flex direction size with max bounds in rtl", root_node, root_layout); } [Test] public void TestCase151() { TestCSSNode root_node = new TestCSSNode(); { TestCSSNode node_0 = root_node; node_0.style.flexDirection = CSSFlexDirection.Row; node_0.style.dimensions[DIMENSION_WIDTH] = 300; node_0.style.dimensions[DIMENSION_HEIGHT] = 200; addChildren(node_0, 3); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.style.flex = 1; node_1.style.maxWidth = 60; node_1 = node_0.getChildAt(1); node_1.style.flex = 1; node_1.style.maxWidth = 60; node_1 = node_0.getChildAt(2); node_1.style.flex = 1; node_1.style.maxWidth = 60; } } TestCSSNode root_layout = new TestCSSNode(); { TestCSSNode node_0 = root_layout; node_0.layout.position[POSITION_TOP] = 0; node_0.layout.position[POSITION_LEFT] = 0; node_0.layout.dimensions[DIMENSION_WIDTH] = 300; node_0.layout.dimensions[DIMENSION_HEIGHT] = 200; addChildren(node_0, 3); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.layout.position[POSITION_TOP] = 0; node_1.layout.position[POSITION_LEFT] = 0; node_1.layout.dimensions[DIMENSION_WIDTH] = 60; node_1.layout.dimensions[DIMENSION_HEIGHT] = 200; node_1 = node_0.getChildAt(1); node_1.layout.position[POSITION_TOP] = 0; node_1.layout.position[POSITION_LEFT] = 60; node_1.layout.dimensions[DIMENSION_WIDTH] = 60; node_1.layout.dimensions[DIMENSION_HEIGHT] = 200; node_1 = node_0.getChildAt(2); node_1.layout.position[POSITION_TOP] = 0; node_1.layout.position[POSITION_LEFT] = 120; node_1.layout.dimensions[DIMENSION_WIDTH] = 60; node_1.layout.dimensions[DIMENSION_HEIGHT] = 200; } } test("should ignore flex size if fully max bound", root_node, root_layout); } [Test] public void TestCase152() { TestCSSNode root_node = new TestCSSNode(); { TestCSSNode node_0 = root_node; node_0.style.direction = CSSDirection.RTL; node_0.style.flexDirection = CSSFlexDirection.Row; node_0.style.dimensions[DIMENSION_WIDTH] = 300; node_0.style.dimensions[DIMENSION_HEIGHT] = 200; addChildren(node_0, 3); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.style.flex = 1; node_1.style.maxWidth = 60; node_1 = node_0.getChildAt(1); node_1.style.flex = 1; node_1.style.maxWidth = 60; node_1 = node_0.getChildAt(2); node_1.style.flex = 1; node_1.style.maxWidth = 60; } } TestCSSNode root_layout = new TestCSSNode(); { TestCSSNode node_0 = root_layout; node_0.layout.position[POSITION_TOP] = 0; node_0.layout.position[POSITION_LEFT] = 0; node_0.layout.dimensions[DIMENSION_WIDTH] = 300; node_0.layout.dimensions[DIMENSION_HEIGHT] = 200; addChildren(node_0, 3); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.layout.position[POSITION_TOP] = 0; node_1.layout.position[POSITION_LEFT] = 240; node_1.layout.dimensions[DIMENSION_WIDTH] = 60; node_1.layout.dimensions[DIMENSION_HEIGHT] = 200; node_1 = node_0.getChildAt(1); node_1.layout.position[POSITION_TOP] = 0; node_1.layout.position[POSITION_LEFT] = 180; node_1.layout.dimensions[DIMENSION_WIDTH] = 60; node_1.layout.dimensions[DIMENSION_HEIGHT] = 200; node_1 = node_0.getChildAt(2); node_1.layout.position[POSITION_TOP] = 0; node_1.layout.position[POSITION_LEFT] = 120; node_1.layout.dimensions[DIMENSION_WIDTH] = 60; node_1.layout.dimensions[DIMENSION_HEIGHT] = 200; } } test("should ignore flex size if fully max bound in rtl", root_node, root_layout); } [Test] public void TestCase153() { TestCSSNode root_node = new TestCSSNode(); { TestCSSNode node_0 = root_node; node_0.style.flexDirection = CSSFlexDirection.Row; node_0.style.dimensions[DIMENSION_WIDTH] = 300; node_0.style.dimensions[DIMENSION_HEIGHT] = 200; addChildren(node_0, 3); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.style.flex = 1; node_1.style.minWidth = 120; node_1 = node_0.getChildAt(1); node_1.style.flex = 1; node_1.style.minWidth = 120; node_1 = node_0.getChildAt(2); node_1.style.flex = 1; node_1.style.minWidth = 120; } } TestCSSNode root_layout = new TestCSSNode(); { TestCSSNode node_0 = root_layout; node_0.layout.position[POSITION_TOP] = 0; node_0.layout.position[POSITION_LEFT] = 0; node_0.layout.dimensions[DIMENSION_WIDTH] = 300; node_0.layout.dimensions[DIMENSION_HEIGHT] = 200; addChildren(node_0, 3); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.layout.position[POSITION_TOP] = 0; node_1.layout.position[POSITION_LEFT] = 0; node_1.layout.dimensions[DIMENSION_WIDTH] = 120; node_1.layout.dimensions[DIMENSION_HEIGHT] = 200; node_1 = node_0.getChildAt(1); node_1.layout.position[POSITION_TOP] = 0; node_1.layout.position[POSITION_LEFT] = 120; node_1.layout.dimensions[DIMENSION_WIDTH] = 120; node_1.layout.dimensions[DIMENSION_HEIGHT] = 200; node_1 = node_0.getChildAt(2); node_1.layout.position[POSITION_TOP] = 0; node_1.layout.position[POSITION_LEFT] = 240; node_1.layout.dimensions[DIMENSION_WIDTH] = 120; node_1.layout.dimensions[DIMENSION_HEIGHT] = 200; } } test("should ignore flex size if fully min bound", root_node, root_layout); } [Test] public void TestCase154() { TestCSSNode root_node = new TestCSSNode(); { TestCSSNode node_0 = root_node; node_0.style.direction = CSSDirection.RTL; node_0.style.flexDirection = CSSFlexDirection.Row; node_0.style.dimensions[DIMENSION_WIDTH] = 300; node_0.style.dimensions[DIMENSION_HEIGHT] = 200; addChildren(node_0, 3); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.style.flex = 1; node_1.style.minWidth = 120; node_1 = node_0.getChildAt(1); node_1.style.flex = 1; node_1.style.minWidth = 120; node_1 = node_0.getChildAt(2); node_1.style.flex = 1; node_1.style.minWidth = 120; } } TestCSSNode root_layout = new TestCSSNode(); { TestCSSNode node_0 = root_layout; node_0.layout.position[POSITION_TOP] = 0; node_0.layout.position[POSITION_LEFT] = 0; node_0.layout.dimensions[DIMENSION_WIDTH] = 300; node_0.layout.dimensions[DIMENSION_HEIGHT] = 200; addChildren(node_0, 3); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.layout.position[POSITION_TOP] = 0; node_1.layout.position[POSITION_LEFT] = 180; node_1.layout.dimensions[DIMENSION_WIDTH] = 120; node_1.layout.dimensions[DIMENSION_HEIGHT] = 200; node_1 = node_0.getChildAt(1); node_1.layout.position[POSITION_TOP] = 0; node_1.layout.position[POSITION_LEFT] = 60; node_1.layout.dimensions[DIMENSION_WIDTH] = 120; node_1.layout.dimensions[DIMENSION_HEIGHT] = 200; node_1 = node_0.getChildAt(2); node_1.layout.position[POSITION_TOP] = 0; node_1.layout.position[POSITION_LEFT] = -60; node_1.layout.dimensions[DIMENSION_WIDTH] = 120; node_1.layout.dimensions[DIMENSION_HEIGHT] = 200; } } test("should ignore flex size if fully min bound in rtl", root_node, root_layout); } [Test] public void TestCase155() { TestCSSNode root_node = new TestCSSNode(); { TestCSSNode node_0 = root_node; node_0.style.dimensions[DIMENSION_WIDTH] = 300; node_0.style.dimensions[DIMENSION_HEIGHT] = 200; addChildren(node_0, 1); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.style.flex = 1; node_1.style.maxWidth = 310; node_1.style.minWidth = 290; } } TestCSSNode root_layout = new TestCSSNode(); { TestCSSNode node_0 = root_layout; node_0.layout.position[POSITION_TOP] = 0; node_0.layout.position[POSITION_LEFT] = 0; node_0.layout.dimensions[DIMENSION_WIDTH] = 300; node_0.layout.dimensions[DIMENSION_HEIGHT] = 200; addChildren(node_0, 1); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.layout.position[POSITION_TOP] = 0; node_1.layout.position[POSITION_LEFT] = 0; node_1.layout.dimensions[DIMENSION_WIDTH] = 300; node_1.layout.dimensions[DIMENSION_HEIGHT] = 200; } } test("should pre-fill child size within bounds", root_node, root_layout); } [Test] public void TestCase156() { TestCSSNode root_node = new TestCSSNode(); { TestCSSNode node_0 = root_node; node_0.style.dimensions[DIMENSION_WIDTH] = 300; node_0.style.dimensions[DIMENSION_HEIGHT] = 200; addChildren(node_0, 1); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.style.flex = 1; node_1.style.maxWidth = 290; } } TestCSSNode root_layout = new TestCSSNode(); { TestCSSNode node_0 = root_layout; node_0.layout.position[POSITION_TOP] = 0; node_0.layout.position[POSITION_LEFT] = 0; node_0.layout.dimensions[DIMENSION_WIDTH] = 300; node_0.layout.dimensions[DIMENSION_HEIGHT] = 200; addChildren(node_0, 1); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.layout.position[POSITION_TOP] = 0; node_1.layout.position[POSITION_LEFT] = 0; node_1.layout.dimensions[DIMENSION_WIDTH] = 290; node_1.layout.dimensions[DIMENSION_HEIGHT] = 200; } } test("should pre-fill child size within max bound", root_node, root_layout); } [Test] public void TestCase157() { TestCSSNode root_node = new TestCSSNode(); { TestCSSNode node_0 = root_node; node_0.style.dimensions[DIMENSION_WIDTH] = 300; node_0.style.dimensions[DIMENSION_HEIGHT] = 200; addChildren(node_0, 1); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.style.flex = 1; node_1.style.minWidth = 310; } } TestCSSNode root_layout = new TestCSSNode(); { TestCSSNode node_0 = root_layout; node_0.layout.position[POSITION_TOP] = 0; node_0.layout.position[POSITION_LEFT] = 0; node_0.layout.dimensions[DIMENSION_WIDTH] = 300; node_0.layout.dimensions[DIMENSION_HEIGHT] = 200; addChildren(node_0, 1); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.layout.position[POSITION_TOP] = 0; node_1.layout.position[POSITION_LEFT] = 0; node_1.layout.dimensions[DIMENSION_WIDTH] = 310; node_1.layout.dimensions[DIMENSION_HEIGHT] = 200; } } test("should pre-fill child size within min bounds", root_node, root_layout); } [Test] public void TestCase158() { TestCSSNode root_node = new TestCSSNode(); { TestCSSNode node_0 = root_node; node_0.style.maxWidth = 300; node_0.style.maxHeight = 700; node_0.style.minWidth = 100; node_0.style.minHeight = 500; addChildren(node_0, 2); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.style.dimensions[DIMENSION_WIDTH] = 200; node_1.style.dimensions[DIMENSION_HEIGHT] = 300; node_1 = node_0.getChildAt(1); node_1.style.dimensions[DIMENSION_WIDTH] = 200; node_1.style.dimensions[DIMENSION_HEIGHT] = 300; } } TestCSSNode root_layout = new TestCSSNode(); { TestCSSNode node_0 = root_layout; node_0.layout.position[POSITION_TOP] = 0; node_0.layout.position[POSITION_LEFT] = 0; node_0.layout.dimensions[DIMENSION_WIDTH] = 200; node_0.layout.dimensions[DIMENSION_HEIGHT] = 600; addChildren(node_0, 2); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.layout.position[POSITION_TOP] = 0; node_1.layout.position[POSITION_LEFT] = 0; node_1.layout.dimensions[DIMENSION_WIDTH] = 200; node_1.layout.dimensions[DIMENSION_HEIGHT] = 300; node_1 = node_0.getChildAt(1); node_1.layout.position[POSITION_TOP] = 300; node_1.layout.position[POSITION_LEFT] = 0; node_1.layout.dimensions[DIMENSION_WIDTH] = 200; node_1.layout.dimensions[DIMENSION_HEIGHT] = 300; } } test("should set parents size based on bounded children", root_node, root_layout); } [Test] public void TestCase159() { TestCSSNode root_node = new TestCSSNode(); { TestCSSNode node_0 = root_node; node_0.style.maxWidth = 100; node_0.style.maxHeight = 500; addChildren(node_0, 2); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.style.dimensions[DIMENSION_WIDTH] = 200; node_1.style.dimensions[DIMENSION_HEIGHT] = 300; node_1 = node_0.getChildAt(1); node_1.style.dimensions[DIMENSION_WIDTH] = 200; node_1.style.dimensions[DIMENSION_HEIGHT] = 300; } } TestCSSNode root_layout = new TestCSSNode(); { TestCSSNode node_0 = root_layout; node_0.layout.position[POSITION_TOP] = 0; node_0.layout.position[POSITION_LEFT] = 0; node_0.layout.dimensions[DIMENSION_WIDTH] = 100; node_0.layout.dimensions[DIMENSION_HEIGHT] = 500; addChildren(node_0, 2); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.layout.position[POSITION_TOP] = 0; node_1.layout.position[POSITION_LEFT] = 0; node_1.layout.dimensions[DIMENSION_WIDTH] = 200; node_1.layout.dimensions[DIMENSION_HEIGHT] = 300; node_1 = node_0.getChildAt(1); node_1.layout.position[POSITION_TOP] = 300; node_1.layout.position[POSITION_LEFT] = 0; node_1.layout.dimensions[DIMENSION_WIDTH] = 200; node_1.layout.dimensions[DIMENSION_HEIGHT] = 300; } } test("should set parents size based on max bounded children", root_node, root_layout); } [Test] public void TestCase160() { TestCSSNode root_node = new TestCSSNode(); { TestCSSNode node_0 = root_node; node_0.style.minWidth = 300; node_0.style.minHeight = 700; addChildren(node_0, 2); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.style.dimensions[DIMENSION_WIDTH] = 200; node_1.style.dimensions[DIMENSION_HEIGHT] = 300; node_1 = node_0.getChildAt(1); node_1.style.dimensions[DIMENSION_WIDTH] = 200; node_1.style.dimensions[DIMENSION_HEIGHT] = 300; } } TestCSSNode root_layout = new TestCSSNode(); { TestCSSNode node_0 = root_layout; node_0.layout.position[POSITION_TOP] = 0; node_0.layout.position[POSITION_LEFT] = 0; node_0.layout.dimensions[DIMENSION_WIDTH] = 300; node_0.layout.dimensions[DIMENSION_HEIGHT] = 700; addChildren(node_0, 2); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.layout.position[POSITION_TOP] = 0; node_1.layout.position[POSITION_LEFT] = 0; node_1.layout.dimensions[DIMENSION_WIDTH] = 200; node_1.layout.dimensions[DIMENSION_HEIGHT] = 300; node_1 = node_0.getChildAt(1); node_1.layout.position[POSITION_TOP] = 300; node_1.layout.position[POSITION_LEFT] = 0; node_1.layout.dimensions[DIMENSION_WIDTH] = 200; node_1.layout.dimensions[DIMENSION_HEIGHT] = 300; } } test("should set parents size based on min bounded children", root_node, root_layout); } [Test] public void TestCase161() { TestCSSNode root_node = new TestCSSNode(); { TestCSSNode node_0 = root_node; node_0.style.alignItems = CSSAlign.Stretch; node_0.style.dimensions[DIMENSION_WIDTH] = 1000; addChildren(node_0, 1); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.style.dimensions[DIMENSION_HEIGHT] = 100; node_1.style.maxWidth = 1100; node_1.style.maxHeight = 110; node_1.style.minWidth = 900; node_1.style.minHeight = 90; } } TestCSSNode root_layout = new TestCSSNode(); { TestCSSNode node_0 = root_layout; node_0.layout.position[POSITION_TOP] = 0; node_0.layout.position[POSITION_LEFT] = 0; node_0.layout.dimensions[DIMENSION_WIDTH] = 1000; node_0.layout.dimensions[DIMENSION_HEIGHT] = 100; addChildren(node_0, 1); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.layout.position[POSITION_TOP] = 0; node_1.layout.position[POSITION_LEFT] = 0; node_1.layout.dimensions[DIMENSION_WIDTH] = 1000; node_1.layout.dimensions[DIMENSION_HEIGHT] = 100; } } test("should keep stretched size within bounds", root_node, root_layout); } [Test] public void TestCase162() { TestCSSNode root_node = new TestCSSNode(); { TestCSSNode node_0 = root_node; node_0.style.alignItems = CSSAlign.Stretch; node_0.style.dimensions[DIMENSION_WIDTH] = 1000; addChildren(node_0, 1); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.style.dimensions[DIMENSION_HEIGHT] = 100; node_1.style.maxWidth = 900; node_1.style.maxHeight = 90; } } TestCSSNode root_layout = new TestCSSNode(); { TestCSSNode node_0 = root_layout; node_0.layout.position[POSITION_TOP] = 0; node_0.layout.position[POSITION_LEFT] = 0; node_0.layout.dimensions[DIMENSION_WIDTH] = 1000; node_0.layout.dimensions[DIMENSION_HEIGHT] = 90; addChildren(node_0, 1); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.layout.position[POSITION_TOP] = 0; node_1.layout.position[POSITION_LEFT] = 0; node_1.layout.dimensions[DIMENSION_WIDTH] = 900; node_1.layout.dimensions[DIMENSION_HEIGHT] = 90; } } test("should keep stretched size within max bounds", root_node, root_layout); } [Test] public void TestCase163() { TestCSSNode root_node = new TestCSSNode(); { TestCSSNode node_0 = root_node; node_0.style.alignItems = CSSAlign.Stretch; node_0.style.dimensions[DIMENSION_WIDTH] = 1000; addChildren(node_0, 1); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.style.dimensions[DIMENSION_HEIGHT] = 100; node_1.style.minWidth = 1100; node_1.style.minHeight = 110; } } TestCSSNode root_layout = new TestCSSNode(); { TestCSSNode node_0 = root_layout; node_0.layout.position[POSITION_TOP] = 0; node_0.layout.position[POSITION_LEFT] = 0; node_0.layout.dimensions[DIMENSION_WIDTH] = 1000; node_0.layout.dimensions[DIMENSION_HEIGHT] = 110; addChildren(node_0, 1); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.layout.position[POSITION_TOP] = 0; node_1.layout.position[POSITION_LEFT] = 0; node_1.layout.dimensions[DIMENSION_WIDTH] = 1100; node_1.layout.dimensions[DIMENSION_HEIGHT] = 110; } } test("should keep stretched size within min bounds", root_node, root_layout); } [Test] public void TestCase164() { TestCSSNode root_node = new TestCSSNode(); { TestCSSNode node_0 = root_node; node_0.style.flexDirection = CSSFlexDirection.Row; node_0.style.dimensions[DIMENSION_WIDTH] = 1000; addChildren(node_0, 1); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.style.dimensions[DIMENSION_HEIGHT] = 100; node_1.style.minWidth = 100; node_1.style.minHeight = 110; } } TestCSSNode root_layout = new TestCSSNode(); { TestCSSNode node_0 = root_layout; node_0.layout.position[POSITION_TOP] = 0; node_0.layout.position[POSITION_LEFT] = 0; node_0.layout.dimensions[DIMENSION_WIDTH] = 1000; node_0.layout.dimensions[DIMENSION_HEIGHT] = 110; addChildren(node_0, 1); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.layout.position[POSITION_TOP] = 0; node_1.layout.position[POSITION_LEFT] = 0; node_1.layout.dimensions[DIMENSION_WIDTH] = 100; node_1.layout.dimensions[DIMENSION_HEIGHT] = 110; } } test("should keep cross axis size within min bounds", root_node, root_layout); } [Test] public void TestCase165() { TestCSSNode root_node = new TestCSSNode(); { TestCSSNode node_0 = root_node; node_0.style.direction = CSSDirection.RTL; node_0.style.flexDirection = CSSFlexDirection.Row; node_0.style.dimensions[DIMENSION_WIDTH] = 1000; addChildren(node_0, 1); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.style.dimensions[DIMENSION_HEIGHT] = 100; node_1.style.minWidth = 100; node_1.style.minHeight = 110; } } TestCSSNode root_layout = new TestCSSNode(); { TestCSSNode node_0 = root_layout; node_0.layout.position[POSITION_TOP] = 0; node_0.layout.position[POSITION_LEFT] = 0; node_0.layout.dimensions[DIMENSION_WIDTH] = 1000; node_0.layout.dimensions[DIMENSION_HEIGHT] = 110; addChildren(node_0, 1); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.layout.position[POSITION_TOP] = 0; node_1.layout.position[POSITION_LEFT] = 900; node_1.layout.dimensions[DIMENSION_WIDTH] = 100; node_1.layout.dimensions[DIMENSION_HEIGHT] = 110; } } test("should keep cross axis size within min bounds in rtl", root_node, root_layout); } [Test] public void TestCase166() { TestCSSNode root_node = new TestCSSNode(); { TestCSSNode node_0 = root_node; node_0.style.dimensions[DIMENSION_WIDTH] = 1000; node_0.style.dimensions[DIMENSION_HEIGHT] = 1000; addChildren(node_0, 1); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.style.positionType = CSSPositionType.Absolute; node_1.style.maxWidth = 500; node_1.style.maxHeight = 600; node_1.style.position[POSITION_LEFT] = 100; node_1.style.position[POSITION_TOP] = 100; node_1.style.position[POSITION_RIGHT] = 100; node_1.style.position[POSITION_BOTTOM] = 100; } } TestCSSNode root_layout = new TestCSSNode(); { TestCSSNode node_0 = root_layout; node_0.layout.position[POSITION_TOP] = 0; node_0.layout.position[POSITION_LEFT] = 0; node_0.layout.dimensions[DIMENSION_WIDTH] = 1000; node_0.layout.dimensions[DIMENSION_HEIGHT] = 1000; addChildren(node_0, 1); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.layout.position[POSITION_TOP] = 100; node_1.layout.position[POSITION_LEFT] = 100; node_1.layout.dimensions[DIMENSION_WIDTH] = 500; node_1.layout.dimensions[DIMENSION_HEIGHT] = 600; } } test("should layout node with position absolute, top and left and max bounds", root_node, root_layout); } [Test] public void TestCase167() { TestCSSNode root_node = new TestCSSNode(); { TestCSSNode node_0 = root_node; node_0.style.dimensions[DIMENSION_WIDTH] = 1000; node_0.style.dimensions[DIMENSION_HEIGHT] = 1000; addChildren(node_0, 1); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.style.positionType = CSSPositionType.Absolute; node_1.style.minWidth = 900; node_1.style.minHeight = 1000; node_1.style.position[POSITION_LEFT] = 100; node_1.style.position[POSITION_TOP] = 100; node_1.style.position[POSITION_RIGHT] = 100; node_1.style.position[POSITION_BOTTOM] = 100; } } TestCSSNode root_layout = new TestCSSNode(); { TestCSSNode node_0 = root_layout; node_0.layout.position[POSITION_TOP] = 0; node_0.layout.position[POSITION_LEFT] = 0; node_0.layout.dimensions[DIMENSION_WIDTH] = 1000; node_0.layout.dimensions[DIMENSION_HEIGHT] = 1000; addChildren(node_0, 1); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.layout.position[POSITION_TOP] = 100; node_1.layout.position[POSITION_LEFT] = 100; node_1.layout.dimensions[DIMENSION_WIDTH] = 900; node_1.layout.dimensions[DIMENSION_HEIGHT] = 1000; } } test("should layout node with position absolute, top and left and min bounds", root_node, root_layout); } [Test] public void TestCase168() { TestCSSNode root_node = new TestCSSNode(); { TestCSSNode node_0 = root_node; node_0.style.flexDirection = CSSFlexDirection.Row; node_0.style.justifyContent = CSSJustify.Center; node_0.style.dimensions[DIMENSION_WIDTH] = 1000; node_0.style.dimensions[DIMENSION_HEIGHT] = 1000; addChildren(node_0, 1); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.style.flex = 1; node_1.style.dimensions[DIMENSION_HEIGHT] = 1000; node_1.style.maxWidth = 600; } } TestCSSNode root_layout = new TestCSSNode(); { TestCSSNode node_0 = root_layout; node_0.layout.position[POSITION_TOP] = 0; node_0.layout.position[POSITION_LEFT] = 0; node_0.layout.dimensions[DIMENSION_WIDTH] = 1000; node_0.layout.dimensions[DIMENSION_HEIGHT] = 1000; addChildren(node_0, 1); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.layout.position[POSITION_TOP] = 0; node_1.layout.position[POSITION_LEFT] = 200; node_1.layout.dimensions[DIMENSION_WIDTH] = 600; node_1.layout.dimensions[DIMENSION_HEIGHT] = 1000; } } test("should center flexible item with max size", root_node, root_layout); } [Test] public void TestCase169() { TestCSSNode root_node = new TestCSSNode(); { TestCSSNode node_0 = root_node; node_0.style.flexDirection = CSSFlexDirection.Row; node_0.style.dimensions[DIMENSION_WIDTH] = 1000; node_0.style.dimensions[DIMENSION_HEIGHT] = 1000; addChildren(node_0, 2); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.style.flex = 1; node_1.style.dimensions[DIMENSION_WIDTH] = 100; node_1.style.dimensions[DIMENSION_HEIGHT] = 1000; node_1 = node_0.getChildAt(1); node_1.style.flex = 1; node_1.style.dimensions[DIMENSION_WIDTH] = 100; node_1.style.dimensions[DIMENSION_HEIGHT] = 1000; node_1.style.maxWidth = 200; } } TestCSSNode root_layout = new TestCSSNode(); { TestCSSNode node_0 = root_layout; node_0.layout.position[POSITION_TOP] = 0; node_0.layout.position[POSITION_LEFT] = 0; node_0.layout.dimensions[DIMENSION_WIDTH] = 1000; node_0.layout.dimensions[DIMENSION_HEIGHT] = 1000; addChildren(node_0, 2); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.layout.position[POSITION_TOP] = 0; node_1.layout.position[POSITION_LEFT] = 0; node_1.layout.dimensions[DIMENSION_WIDTH] = 800; node_1.layout.dimensions[DIMENSION_HEIGHT] = 1000; node_1 = node_0.getChildAt(1); node_1.layout.position[POSITION_TOP] = 0; node_1.layout.position[POSITION_LEFT] = 800; node_1.layout.dimensions[DIMENSION_WIDTH] = 200; node_1.layout.dimensions[DIMENSION_HEIGHT] = 1000; } } test("should correctly size flexible items with flex basis and a max width", root_node, root_layout); } [Test] public void TestCase170() { TestCSSNode root_node = new TestCSSNode(); { TestCSSNode node_0 = root_node; node_0.style.dimensions[DIMENSION_WIDTH] = 400; node_0.style.dimensions[DIMENSION_HEIGHT] = 400; addChildren(node_0, 1); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.style.positionType = CSSPositionType.Absolute; node_1.setPadding(Spacing.LEFT, 10); node_1.setPadding(Spacing.TOP, 10); node_1.setPadding(Spacing.RIGHT, 10); node_1.setPadding(Spacing.BOTTOM, 10); node_1.setPadding(Spacing.START, 10); node_1.setPadding(Spacing.END, 10); node_1.style.position[POSITION_LEFT] = 100; node_1.style.position[POSITION_TOP] = 100; node_1.style.position[POSITION_RIGHT] = 100; node_1.style.position[POSITION_BOTTOM] = 100; addChildren(node_1, 1); { TestCSSNode node_2; node_2 = node_1.getChildAt(0); node_2.style.positionType = CSSPositionType.Absolute; node_2.style.position[POSITION_LEFT] = 10; node_2.style.position[POSITION_TOP] = 10; node_2.style.position[POSITION_RIGHT] = 10; node_2.style.position[POSITION_BOTTOM] = 10; } } } TestCSSNode root_layout = new TestCSSNode(); { TestCSSNode node_0 = root_layout; node_0.layout.position[POSITION_TOP] = 0; node_0.layout.position[POSITION_LEFT] = 0; node_0.layout.dimensions[DIMENSION_WIDTH] = 400; node_0.layout.dimensions[DIMENSION_HEIGHT] = 400; addChildren(node_0, 1); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.layout.position[POSITION_TOP] = 100; node_1.layout.position[POSITION_LEFT] = 100; node_1.layout.dimensions[DIMENSION_WIDTH] = 200; node_1.layout.dimensions[DIMENSION_HEIGHT] = 200; addChildren(node_1, 1); { TestCSSNode node_2; node_2 = node_1.getChildAt(0); node_2.layout.position[POSITION_TOP] = 10; node_2.layout.position[POSITION_LEFT] = 10; node_2.layout.dimensions[DIMENSION_WIDTH] = 180; node_2.layout.dimensions[DIMENSION_HEIGHT] = 180; } } } test("should layout absolutely positioned node with absolutely positioned padded parent", root_node, root_layout); } [Test] public void TestCase171() { TestCSSNode root_node = new TestCSSNode(); { TestCSSNode node_0 = root_node; node_0.style.dimensions[DIMENSION_WIDTH] = 400; node_0.style.dimensions[DIMENSION_HEIGHT] = 400; addChildren(node_0, 1); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.style.positionType = CSSPositionType.Absolute; node_1.setPadding(Spacing.LEFT, 10); node_1.setPadding(Spacing.TOP, 10); node_1.setPadding(Spacing.RIGHT, 10); node_1.setPadding(Spacing.BOTTOM, 10); node_1.setPadding(Spacing.START, 10); node_1.setPadding(Spacing.END, 10); node_1.setBorder(Spacing.LEFT, 1); node_1.setBorder(Spacing.TOP, 1); node_1.setBorder(Spacing.RIGHT, 1); node_1.setBorder(Spacing.BOTTOM, 1); node_1.setBorder(Spacing.START, 1); node_1.setBorder(Spacing.END, 1); node_1.style.position[POSITION_LEFT] = 100; node_1.style.position[POSITION_TOP] = 100; node_1.style.position[POSITION_RIGHT] = 100; node_1.style.position[POSITION_BOTTOM] = 100; addChildren(node_1, 1); { TestCSSNode node_2; node_2 = node_1.getChildAt(0); node_2.style.positionType = CSSPositionType.Absolute; node_2.style.position[POSITION_LEFT] = 10; node_2.style.position[POSITION_TOP] = 10; node_2.style.position[POSITION_RIGHT] = 10; node_2.style.position[POSITION_BOTTOM] = 10; } } } TestCSSNode root_layout = new TestCSSNode(); { TestCSSNode node_0 = root_layout; node_0.layout.position[POSITION_TOP] = 0; node_0.layout.position[POSITION_LEFT] = 0; node_0.layout.dimensions[DIMENSION_WIDTH] = 400; node_0.layout.dimensions[DIMENSION_HEIGHT] = 400; addChildren(node_0, 1); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.layout.position[POSITION_TOP] = 100; node_1.layout.position[POSITION_LEFT] = 100; node_1.layout.dimensions[DIMENSION_WIDTH] = 200; node_1.layout.dimensions[DIMENSION_HEIGHT] = 200; addChildren(node_1, 1); { TestCSSNode node_2; node_2 = node_1.getChildAt(0); node_2.layout.position[POSITION_TOP] = 11; node_2.layout.position[POSITION_LEFT] = 11; node_2.layout.dimensions[DIMENSION_WIDTH] = 178; node_2.layout.dimensions[DIMENSION_HEIGHT] = 178; } } } test("should layout absolutely positioned node with absolutely positioned padded and bordered parent", root_node, root_layout); } [Test] public void TestCase172() { TestCSSNode root_node = new TestCSSNode(); { TestCSSNode node_0 = root_node; node_0.style.dimensions[DIMENSION_WIDTH] = 400; node_0.style.dimensions[DIMENSION_HEIGHT] = 400; addChildren(node_0, 1); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.style.flex = 1; node_1.setPadding(Spacing.LEFT, 10); node_1.setPadding(Spacing.TOP, 10); node_1.setPadding(Spacing.RIGHT, 10); node_1.setPadding(Spacing.BOTTOM, 10); node_1.setPadding(Spacing.START, 10); node_1.setPadding(Spacing.END, 10); addChildren(node_1, 1); { TestCSSNode node_2; node_2 = node_1.getChildAt(0); node_2.style.positionType = CSSPositionType.Absolute; node_2.style.position[POSITION_LEFT] = 10; node_2.style.position[POSITION_TOP] = 10; node_2.style.position[POSITION_RIGHT] = 10; node_2.style.position[POSITION_BOTTOM] = 10; } } } TestCSSNode root_layout = new TestCSSNode(); { TestCSSNode node_0 = root_layout; node_0.layout.position[POSITION_TOP] = 0; node_0.layout.position[POSITION_LEFT] = 0; node_0.layout.dimensions[DIMENSION_WIDTH] = 400; node_0.layout.dimensions[DIMENSION_HEIGHT] = 400; addChildren(node_0, 1); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.layout.position[POSITION_TOP] = 0; node_1.layout.position[POSITION_LEFT] = 0; node_1.layout.dimensions[DIMENSION_WIDTH] = 400; node_1.layout.dimensions[DIMENSION_HEIGHT] = 400; addChildren(node_1, 1); { TestCSSNode node_2; node_2 = node_1.getChildAt(0); node_2.layout.position[POSITION_TOP] = 10; node_2.layout.position[POSITION_LEFT] = 10; node_2.layout.dimensions[DIMENSION_WIDTH] = 380; node_2.layout.dimensions[DIMENSION_HEIGHT] = 380; } } } test("should layout absolutely positioned node with padded flex 1 parent", root_node, root_layout); } [Test] public void TestCase173() { TestCSSNode root_node = new TestCSSNode(); { TestCSSNode node_0 = root_node; node_0.style.direction = CSSDirection.RTL; node_0.style.dimensions[DIMENSION_WIDTH] = 200; node_0.style.dimensions[DIMENSION_HEIGHT] = 200; addChildren(node_0, 2); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.style.flexDirection = CSSFlexDirection.Row; addChildren(node_1, 2); { TestCSSNode node_2; node_2 = node_1.getChildAt(0); node_2.style.dimensions[DIMENSION_WIDTH] = 50; node_2.style.dimensions[DIMENSION_HEIGHT] = 50; node_2 = node_1.getChildAt(1); node_2.style.dimensions[DIMENSION_WIDTH] = 50; node_2.style.dimensions[DIMENSION_HEIGHT] = 50; } node_1 = node_0.getChildAt(1); node_1.style.direction = CSSDirection.LTR; node_1.style.flexDirection = CSSFlexDirection.Row; addChildren(node_1, 2); { TestCSSNode node_2; node_2 = node_1.getChildAt(0); node_2.style.dimensions[DIMENSION_WIDTH] = 50; node_2.style.dimensions[DIMENSION_HEIGHT] = 50; node_2 = node_1.getChildAt(1); node_2.style.dimensions[DIMENSION_WIDTH] = 50; node_2.style.dimensions[DIMENSION_HEIGHT] = 50; } } } TestCSSNode root_layout = new TestCSSNode(); { TestCSSNode node_0 = root_layout; node_0.layout.position[POSITION_TOP] = 0; node_0.layout.position[POSITION_LEFT] = 0; node_0.layout.dimensions[DIMENSION_WIDTH] = 200; node_0.layout.dimensions[DIMENSION_HEIGHT] = 200; addChildren(node_0, 2); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.layout.position[POSITION_TOP] = 0; node_1.layout.position[POSITION_LEFT] = 0; node_1.layout.dimensions[DIMENSION_WIDTH] = 200; node_1.layout.dimensions[DIMENSION_HEIGHT] = 50; addChildren(node_1, 2); { TestCSSNode node_2; node_2 = node_1.getChildAt(0); node_2.layout.position[POSITION_TOP] = 0; node_2.layout.position[POSITION_LEFT] = 150; node_2.layout.dimensions[DIMENSION_WIDTH] = 50; node_2.layout.dimensions[DIMENSION_HEIGHT] = 50; node_2 = node_1.getChildAt(1); node_2.layout.position[POSITION_TOP] = 0; node_2.layout.position[POSITION_LEFT] = 100; node_2.layout.dimensions[DIMENSION_WIDTH] = 50; node_2.layout.dimensions[DIMENSION_HEIGHT] = 50; } node_1 = node_0.getChildAt(1); node_1.layout.position[POSITION_TOP] = 50; node_1.layout.position[POSITION_LEFT] = 0; node_1.layout.dimensions[DIMENSION_WIDTH] = 200; node_1.layout.dimensions[DIMENSION_HEIGHT] = 50; addChildren(node_1, 2); { TestCSSNode node_2; node_2 = node_1.getChildAt(0); node_2.layout.position[POSITION_TOP] = 0; node_2.layout.position[POSITION_LEFT] = 0; node_2.layout.dimensions[DIMENSION_WIDTH] = 50; node_2.layout.dimensions[DIMENSION_HEIGHT] = 50; node_2 = node_1.getChildAt(1); node_2.layout.position[POSITION_TOP] = 0; node_2.layout.position[POSITION_LEFT] = 50; node_2.layout.dimensions[DIMENSION_WIDTH] = 50; node_2.layout.dimensions[DIMENSION_HEIGHT] = 50; } } } test("should layout nested nodes with mixed directions", root_node, root_layout); } [Test] public void TestCase174() { TestCSSNode root_node = new TestCSSNode(); { TestCSSNode node_0 = root_node; node_0.style.flexDirection = CSSFlexDirection.Row; node_0.style.justifyContent = CSSJustify.SpaceBetween; node_0.style.flexWrap = CSSWrap.Wrap; node_0.style.dimensions[DIMENSION_WIDTH] = 320; node_0.style.dimensions[DIMENSION_HEIGHT] = 200; addChildren(node_0, 6); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.style.dimensions[DIMENSION_WIDTH] = 100; node_1.style.dimensions[DIMENSION_HEIGHT] = 100; node_1 = node_0.getChildAt(1); node_1.style.dimensions[DIMENSION_WIDTH] = 100; node_1.style.dimensions[DIMENSION_HEIGHT] = 100; node_1 = node_0.getChildAt(2); node_1.style.dimensions[DIMENSION_WIDTH] = 100; node_1.style.dimensions[DIMENSION_HEIGHT] = 100; node_1 = node_0.getChildAt(3); node_1.style.dimensions[DIMENSION_WIDTH] = 100; node_1.style.dimensions[DIMENSION_HEIGHT] = 100; node_1 = node_0.getChildAt(4); node_1.style.dimensions[DIMENSION_WIDTH] = 100; node_1.style.dimensions[DIMENSION_HEIGHT] = 100; node_1 = node_0.getChildAt(5); node_1.style.dimensions[DIMENSION_WIDTH] = 100; node_1.style.dimensions[DIMENSION_HEIGHT] = 100; } } TestCSSNode root_layout = new TestCSSNode(); { TestCSSNode node_0 = root_layout; node_0.layout.position[POSITION_TOP] = 0; node_0.layout.position[POSITION_LEFT] = 0; node_0.layout.dimensions[DIMENSION_WIDTH] = 320; node_0.layout.dimensions[DIMENSION_HEIGHT] = 200; addChildren(node_0, 6); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.layout.position[POSITION_TOP] = 0; node_1.layout.position[POSITION_LEFT] = 0; node_1.layout.dimensions[DIMENSION_WIDTH] = 100; node_1.layout.dimensions[DIMENSION_HEIGHT] = 100; node_1 = node_0.getChildAt(1); node_1.layout.position[POSITION_TOP] = 0; node_1.layout.position[POSITION_LEFT] = 110; node_1.layout.dimensions[DIMENSION_WIDTH] = 100; node_1.layout.dimensions[DIMENSION_HEIGHT] = 100; node_1 = node_0.getChildAt(2); node_1.layout.position[POSITION_TOP] = 0; node_1.layout.position[POSITION_LEFT] = 220; node_1.layout.dimensions[DIMENSION_WIDTH] = 100; node_1.layout.dimensions[DIMENSION_HEIGHT] = 100; node_1 = node_0.getChildAt(3); node_1.layout.position[POSITION_TOP] = 100; node_1.layout.position[POSITION_LEFT] = 0; node_1.layout.dimensions[DIMENSION_WIDTH] = 100; node_1.layout.dimensions[DIMENSION_HEIGHT] = 100; node_1 = node_0.getChildAt(4); node_1.layout.position[POSITION_TOP] = 100; node_1.layout.position[POSITION_LEFT] = 110; node_1.layout.dimensions[DIMENSION_WIDTH] = 100; node_1.layout.dimensions[DIMENSION_HEIGHT] = 100; node_1 = node_0.getChildAt(5); node_1.layout.position[POSITION_TOP] = 100; node_1.layout.position[POSITION_LEFT] = 220; node_1.layout.dimensions[DIMENSION_WIDTH] = 100; node_1.layout.dimensions[DIMENSION_HEIGHT] = 100; } } test("should correctly space wrapped nodes", root_node, root_layout); } [Test] public void TestCase175() { TestCSSNode root_node = new TestCSSNode(); { TestCSSNode node_0 = root_node; node_0.style.dimensions[DIMENSION_WIDTH] = 200; node_0.setPadding(Spacing.LEFT, 5); node_0.setPadding(Spacing.RIGHT, 5); node_0.setPadding(Spacing.START, 15); node_0.setPadding(Spacing.END, 15); addChildren(node_0, 1); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.style.dimensions[DIMENSION_HEIGHT] = 50; } } TestCSSNode root_layout = new TestCSSNode(); { TestCSSNode node_0 = root_layout; node_0.layout.position[POSITION_TOP] = 0; node_0.layout.position[POSITION_LEFT] = 0; node_0.layout.dimensions[DIMENSION_WIDTH] = 200; node_0.layout.dimensions[DIMENSION_HEIGHT] = 50; addChildren(node_0, 1); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.layout.position[POSITION_TOP] = 0; node_1.layout.position[POSITION_LEFT] = 15; node_1.layout.dimensions[DIMENSION_WIDTH] = 170; node_1.layout.dimensions[DIMENSION_HEIGHT] = 50; } } test("should give start/end padding precedence over left/right padding", root_node, root_layout); } [Test] public void TestCase176() { TestCSSNode root_node = new TestCSSNode(); { TestCSSNode node_0 = root_node; node_0.style.dimensions[DIMENSION_WIDTH] = 200; addChildren(node_0, 1); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.style.dimensions[DIMENSION_HEIGHT] = 50; node_1.setMargin(Spacing.LEFT, 5); node_1.setMargin(Spacing.RIGHT, 5); node_1.setMargin(Spacing.START, 15); node_1.setMargin(Spacing.END, 15); } } TestCSSNode root_layout = new TestCSSNode(); { TestCSSNode node_0 = root_layout; node_0.layout.position[POSITION_TOP] = 0; node_0.layout.position[POSITION_LEFT] = 0; node_0.layout.dimensions[DIMENSION_WIDTH] = 200; node_0.layout.dimensions[DIMENSION_HEIGHT] = 50; addChildren(node_0, 1); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.layout.position[POSITION_TOP] = 0; node_1.layout.position[POSITION_LEFT] = 15; node_1.layout.dimensions[DIMENSION_WIDTH] = 170; node_1.layout.dimensions[DIMENSION_HEIGHT] = 50; } } test("should give start/end margin precedence over left/right margin", root_node, root_layout); } [Test] public void TestCase177() { TestCSSNode root_node = new TestCSSNode(); { TestCSSNode node_0 = root_node; node_0.style.dimensions[DIMENSION_WIDTH] = 200; node_0.setBorder(Spacing.LEFT, 5); node_0.setBorder(Spacing.RIGHT, 5); node_0.setBorder(Spacing.START, 15); node_0.setBorder(Spacing.END, 15); addChildren(node_0, 1); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.style.dimensions[DIMENSION_HEIGHT] = 50; } } TestCSSNode root_layout = new TestCSSNode(); { TestCSSNode node_0 = root_layout; node_0.layout.position[POSITION_TOP] = 0; node_0.layout.position[POSITION_LEFT] = 0; node_0.layout.dimensions[DIMENSION_WIDTH] = 200; node_0.layout.dimensions[DIMENSION_HEIGHT] = 50; addChildren(node_0, 1); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.layout.position[POSITION_TOP] = 0; node_1.layout.position[POSITION_LEFT] = 15; node_1.layout.dimensions[DIMENSION_WIDTH] = 170; node_1.layout.dimensions[DIMENSION_HEIGHT] = 50; } } test("should give start/end border precedence over left/right border", root_node, root_layout); } [Test] public void TestCase178() { TestCSSNode root_node = new TestCSSNode(); { TestCSSNode node_0 = root_node; node_0.style.dimensions[DIMENSION_WIDTH] = 200; node_0.setPadding(Spacing.START, 15); node_0.setPadding(Spacing.END, 5); addChildren(node_0, 1); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.style.dimensions[DIMENSION_HEIGHT] = 50; } } TestCSSNode root_layout = new TestCSSNode(); { TestCSSNode node_0 = root_layout; node_0.layout.position[POSITION_TOP] = 0; node_0.layout.position[POSITION_LEFT] = 0; node_0.layout.dimensions[DIMENSION_WIDTH] = 200; node_0.layout.dimensions[DIMENSION_HEIGHT] = 50; addChildren(node_0, 1); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.layout.position[POSITION_TOP] = 0; node_1.layout.position[POSITION_LEFT] = 15; node_1.layout.dimensions[DIMENSION_WIDTH] = 180; node_1.layout.dimensions[DIMENSION_HEIGHT] = 50; } } test("should layout node with correct start/end padding", root_node, root_layout); } [Test] public void TestCase179() { TestCSSNode root_node = new TestCSSNode(); { TestCSSNode node_0 = root_node; node_0.style.direction = CSSDirection.RTL; node_0.style.dimensions[DIMENSION_WIDTH] = 200; node_0.setPadding(Spacing.START, 15); node_0.setPadding(Spacing.END, 5); addChildren(node_0, 1); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.style.dimensions[DIMENSION_HEIGHT] = 50; } } TestCSSNode root_layout = new TestCSSNode(); { TestCSSNode node_0 = root_layout; node_0.layout.position[POSITION_TOP] = 0; node_0.layout.position[POSITION_LEFT] = 0; node_0.layout.dimensions[DIMENSION_WIDTH] = 200; node_0.layout.dimensions[DIMENSION_HEIGHT] = 50; addChildren(node_0, 1); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.layout.position[POSITION_TOP] = 0; node_1.layout.position[POSITION_LEFT] = 5; node_1.layout.dimensions[DIMENSION_WIDTH] = 180; node_1.layout.dimensions[DIMENSION_HEIGHT] = 50; } } test("should layout node with correct start/end padding in rtl", root_node, root_layout); } [Test] public void TestCase180() { TestCSSNode root_node = new TestCSSNode(); { TestCSSNode node_0 = root_node; node_0.style.dimensions[DIMENSION_WIDTH] = 200; addChildren(node_0, 1); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.style.dimensions[DIMENSION_HEIGHT] = 50; node_1.setMargin(Spacing.START, 15); node_1.setMargin(Spacing.END, 5); } } TestCSSNode root_layout = new TestCSSNode(); { TestCSSNode node_0 = root_layout; node_0.layout.position[POSITION_TOP] = 0; node_0.layout.position[POSITION_LEFT] = 0; node_0.layout.dimensions[DIMENSION_WIDTH] = 200; node_0.layout.dimensions[DIMENSION_HEIGHT] = 50; addChildren(node_0, 1); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.layout.position[POSITION_TOP] = 0; node_1.layout.position[POSITION_LEFT] = 15; node_1.layout.dimensions[DIMENSION_WIDTH] = 180; node_1.layout.dimensions[DIMENSION_HEIGHT] = 50; } } test("should layout node with correct start/end margin", root_node, root_layout); } [Test] public void TestCase181() { TestCSSNode root_node = new TestCSSNode(); { TestCSSNode node_0 = root_node; node_0.style.dimensions[DIMENSION_WIDTH] = 200; addChildren(node_0, 1); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.style.direction = CSSDirection.RTL; node_1.style.dimensions[DIMENSION_HEIGHT] = 50; node_1.setMargin(Spacing.START, 15); node_1.setMargin(Spacing.END, 5); } } TestCSSNode root_layout = new TestCSSNode(); { TestCSSNode node_0 = root_layout; node_0.layout.position[POSITION_TOP] = 0; node_0.layout.position[POSITION_LEFT] = 0; node_0.layout.dimensions[DIMENSION_WIDTH] = 200; node_0.layout.dimensions[DIMENSION_HEIGHT] = 50; addChildren(node_0, 1); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.layout.position[POSITION_TOP] = 0; node_1.layout.position[POSITION_LEFT] = 5; node_1.layout.dimensions[DIMENSION_WIDTH] = 180; node_1.layout.dimensions[DIMENSION_HEIGHT] = 50; } } test("should layout node with correct start/end margin in rtl", root_node, root_layout); } [Test] public void TestCase182() { TestCSSNode root_node = new TestCSSNode(); { TestCSSNode node_0 = root_node; node_0.style.dimensions[DIMENSION_WIDTH] = 200; node_0.setBorder(Spacing.START, 15); node_0.setBorder(Spacing.END, 5); addChildren(node_0, 1); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.style.dimensions[DIMENSION_HEIGHT] = 50; } } TestCSSNode root_layout = new TestCSSNode(); { TestCSSNode node_0 = root_layout; node_0.layout.position[POSITION_TOP] = 0; node_0.layout.position[POSITION_LEFT] = 0; node_0.layout.dimensions[DIMENSION_WIDTH] = 200; node_0.layout.dimensions[DIMENSION_HEIGHT] = 50; addChildren(node_0, 1); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.layout.position[POSITION_TOP] = 0; node_1.layout.position[POSITION_LEFT] = 15; node_1.layout.dimensions[DIMENSION_WIDTH] = 180; node_1.layout.dimensions[DIMENSION_HEIGHT] = 50; } } test("should layout node with correct start/end border", root_node, root_layout); } [Test] public void TestCase183() { TestCSSNode root_node = new TestCSSNode(); { TestCSSNode node_0 = root_node; node_0.style.direction = CSSDirection.RTL; node_0.style.dimensions[DIMENSION_WIDTH] = 200; node_0.setBorder(Spacing.START, 15); node_0.setBorder(Spacing.END, 5); addChildren(node_0, 1); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.style.dimensions[DIMENSION_HEIGHT] = 50; } } TestCSSNode root_layout = new TestCSSNode(); { TestCSSNode node_0 = root_layout; node_0.layout.position[POSITION_TOP] = 0; node_0.layout.position[POSITION_LEFT] = 0; node_0.layout.dimensions[DIMENSION_WIDTH] = 200; node_0.layout.dimensions[DIMENSION_HEIGHT] = 50; addChildren(node_0, 1); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.layout.position[POSITION_TOP] = 0; node_1.layout.position[POSITION_LEFT] = 5; node_1.layout.dimensions[DIMENSION_WIDTH] = 180; node_1.layout.dimensions[DIMENSION_HEIGHT] = 50; } } test("should layout node with correct start/end border in rtl", root_node, root_layout); } [Test] public void TestCase184() { TestCSSNode root_node = new TestCSSNode(); { TestCSSNode node_0 = root_node; node_0.style.dimensions[DIMENSION_WIDTH] = 200; addChildren(node_0, 1); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.style.dimensions[DIMENSION_WIDTH] = 0; } } TestCSSNode root_layout = new TestCSSNode(); { TestCSSNode node_0 = root_layout; node_0.layout.position[POSITION_TOP] = 0; node_0.layout.position[POSITION_LEFT] = 0; node_0.layout.dimensions[DIMENSION_WIDTH] = 200; node_0.layout.dimensions[DIMENSION_HEIGHT] = 0; addChildren(node_0, 1); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.layout.position[POSITION_TOP] = 0; node_1.layout.position[POSITION_LEFT] = 0; node_1.layout.dimensions[DIMENSION_WIDTH] = 0; node_1.layout.dimensions[DIMENSION_HEIGHT] = 0; } } test("should layout node with a 0 width", root_node, root_layout); } [Test] public void TestCase185() { TestCSSNode root_node = new TestCSSNode(); { TestCSSNode node_0 = root_node; node_0.style.flexDirection = CSSFlexDirection.Row; node_0.style.alignItems = CSSAlign.FlexStart; node_0.style.dimensions[DIMENSION_WIDTH] = 100; node_0.style.dimensions[DIMENSION_HEIGHT] = 10; addChildren(node_0, 2); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.style.dimensions[DIMENSION_WIDTH] = 50; node_1.style.dimensions[DIMENSION_HEIGHT] = 10; node_1 = node_0.getChildAt(1); node_1.style.flexDirection = CSSFlexDirection.Column; node_1.style.alignItems = CSSAlign.FlexStart; node_1.style.flex = 1; node_1.style.dimensions[DIMENSION_HEIGHT] = 10; addChildren(node_1, 1); { TestCSSNode node_2; node_2 = node_1.getChildAt(0); node_2.style.flex = 1; node_2.style.dimensions[DIMENSION_HEIGHT] = 10; node_2.setMeasureFunction(sTestMeasureFunction); node_2.context = "measureWithMatchParent"; } } } TestCSSNode root_layout = new TestCSSNode(); { TestCSSNode node_0 = root_layout; node_0.layout.position[POSITION_TOP] = 0; node_0.layout.position[POSITION_LEFT] = 0; node_0.layout.dimensions[DIMENSION_WIDTH] = 100; node_0.layout.dimensions[DIMENSION_HEIGHT] = 10; addChildren(node_0, 2); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.layout.position[POSITION_TOP] = 0; node_1.layout.position[POSITION_LEFT] = 0; node_1.layout.dimensions[DIMENSION_WIDTH] = 50; node_1.layout.dimensions[DIMENSION_HEIGHT] = 10; node_1 = node_0.getChildAt(1); node_1.layout.position[POSITION_TOP] = 0; node_1.layout.position[POSITION_LEFT] = 50; node_1.layout.dimensions[DIMENSION_WIDTH] = 50; node_1.layout.dimensions[DIMENSION_HEIGHT] = 10; addChildren(node_1, 1); { TestCSSNode node_2; node_2 = node_1.getChildAt(0); node_2.layout.position[POSITION_TOP] = 0; node_2.layout.position[POSITION_LEFT] = 0; node_2.layout.dimensions[DIMENSION_WIDTH] = 50; node_2.layout.dimensions[DIMENSION_HEIGHT] = 10; } } } test("should correctly progagate size contraints from flexible parents", root_node, root_layout); } [Test] public void TestCase186() { TestCSSNode root_node = new TestCSSNode(); { TestCSSNode node_0 = root_node; node_0.style.flexDirection = CSSFlexDirection.Row; node_0.style.alignItems = CSSAlign.Stretch; node_0.style.dimensions[DIMENSION_WIDTH] = 150; addChildren(node_0, 2); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.style.flexDirection = CSSFlexDirection.Row; node_1.setMargin(Spacing.LEFT, 10); node_1.setMargin(Spacing.TOP, 10); addChildren(node_1, 1); { TestCSSNode node_2; node_2 = node_1.getChildAt(0); node_2.style.flexDirection = CSSFlexDirection.Row; addChildren(node_2, 1); { TestCSSNode node_3; node_3 = node_2.getChildAt(0); node_3.style.alignSelf = CSSAlign.Center; } } node_1 = node_0.getChildAt(1); node_1.style.dimensions[DIMENSION_HEIGHT] = 150; } } TestCSSNode root_layout = new TestCSSNode(); { TestCSSNode node_0 = root_layout; node_0.layout.position[POSITION_TOP] = 0; node_0.layout.position[POSITION_LEFT] = 0; node_0.layout.dimensions[DIMENSION_WIDTH] = 150; node_0.layout.dimensions[DIMENSION_HEIGHT] = 150; addChildren(node_0, 2); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.layout.position[POSITION_TOP] = 10; node_1.layout.position[POSITION_LEFT] = 10; node_1.layout.dimensions[DIMENSION_WIDTH] = 0; node_1.layout.dimensions[DIMENSION_HEIGHT] = 140; addChildren(node_1, 1); { TestCSSNode node_2; node_2 = node_1.getChildAt(0); node_2.layout.position[POSITION_TOP] = 0; node_2.layout.position[POSITION_LEFT] = 0; node_2.layout.dimensions[DIMENSION_WIDTH] = 0; node_2.layout.dimensions[DIMENSION_HEIGHT] = 140; addChildren(node_2, 1); { TestCSSNode node_3; node_3 = node_2.getChildAt(0); node_3.layout.position[POSITION_TOP] = 70; node_3.layout.position[POSITION_LEFT] = 0; node_3.layout.dimensions[DIMENSION_WIDTH] = 0; node_3.layout.dimensions[DIMENSION_HEIGHT] = 0; } } node_1 = node_0.getChildAt(1); node_1.layout.position[POSITION_TOP] = 0; node_1.layout.position[POSITION_LEFT] = 10; node_1.layout.dimensions[DIMENSION_WIDTH] = 0; node_1.layout.dimensions[DIMENSION_HEIGHT] = 150; } } test("should layout content of an item which is stretched late", root_node, root_layout); } [Test] public void TestCase187() { TestCSSNode root_node = new TestCSSNode(); { TestCSSNode node_0 = root_node; addChildren(node_0, 2); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); addChildren(node_1, 1); { TestCSSNode node_2; node_2 = node_1.getChildAt(0); node_2.style.dimensions[DIMENSION_WIDTH] = 200; node_2.style.dimensions[DIMENSION_HEIGHT] = 200; } node_1 = node_0.getChildAt(1); node_1.setMargin(Spacing.LEFT, 10); node_1.setMargin(Spacing.TOP, 10); addChildren(node_1, 1); { TestCSSNode node_2; node_2 = node_1.getChildAt(0); } } } TestCSSNode root_layout = new TestCSSNode(); { TestCSSNode node_0 = root_layout; node_0.layout.position[POSITION_TOP] = 0; node_0.layout.position[POSITION_LEFT] = 0; node_0.layout.dimensions[DIMENSION_WIDTH] = 200; node_0.layout.dimensions[DIMENSION_HEIGHT] = 210; addChildren(node_0, 2); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.layout.position[POSITION_TOP] = 0; node_1.layout.position[POSITION_LEFT] = 0; node_1.layout.dimensions[DIMENSION_WIDTH] = 200; node_1.layout.dimensions[DIMENSION_HEIGHT] = 200; addChildren(node_1, 1); { TestCSSNode node_2; node_2 = node_1.getChildAt(0); node_2.layout.position[POSITION_TOP] = 0; node_2.layout.position[POSITION_LEFT] = 0; node_2.layout.dimensions[DIMENSION_WIDTH] = 200; node_2.layout.dimensions[DIMENSION_HEIGHT] = 200; } node_1 = node_0.getChildAt(1); node_1.layout.position[POSITION_TOP] = 210; node_1.layout.position[POSITION_LEFT] = 10; node_1.layout.dimensions[DIMENSION_WIDTH] = 190; node_1.layout.dimensions[DIMENSION_HEIGHT] = 0; addChildren(node_1, 1); { TestCSSNode node_2; node_2 = node_1.getChildAt(0); node_2.layout.position[POSITION_TOP] = 0; node_2.layout.position[POSITION_LEFT] = 0; node_2.layout.dimensions[DIMENSION_WIDTH] = 190; node_2.layout.dimensions[DIMENSION_HEIGHT] = 0; } } } test("should layout items whose positioning is determined by sibling tree branches", root_node, root_layout); } [Test] public void TestCase188() { TestCSSNode root_node = new TestCSSNode(); { TestCSSNode node_0 = root_node; node_0.style.flexDirection = CSSFlexDirection.Row; addChildren(node_0, 3); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.style.alignSelf = CSSAlign.FlexStart; node_1.setMargin(Spacing.LEFT, 10); node_1.setMargin(Spacing.TOP, 10); node_1 = node_0.getChildAt(1); node_1.style.alignSelf = CSSAlign.Stretch; node_1.style.dimensions[DIMENSION_WIDTH] = 1; node_1 = node_0.getChildAt(2); node_1.style.dimensions[DIMENSION_HEIGHT] = 150; } } TestCSSNode root_layout = new TestCSSNode(); { TestCSSNode node_0 = root_layout; node_0.layout.position[POSITION_TOP] = 0; node_0.layout.position[POSITION_LEFT] = 0; node_0.layout.dimensions[DIMENSION_WIDTH] = 11; node_0.layout.dimensions[DIMENSION_HEIGHT] = 150; addChildren(node_0, 3); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.layout.position[POSITION_TOP] = 10; node_1.layout.position[POSITION_LEFT] = 10; node_1.layout.dimensions[DIMENSION_WIDTH] = 0; node_1.layout.dimensions[DIMENSION_HEIGHT] = 0; node_1 = node_0.getChildAt(1); node_1.layout.position[POSITION_TOP] = 0; node_1.layout.position[POSITION_LEFT] = 10; node_1.layout.dimensions[DIMENSION_WIDTH] = 1; node_1.layout.dimensions[DIMENSION_HEIGHT] = 150; node_1 = node_0.getChildAt(2); node_1.layout.position[POSITION_TOP] = 0; node_1.layout.position[POSITION_LEFT] = 11; node_1.layout.dimensions[DIMENSION_WIDTH] = 0; node_1.layout.dimensions[DIMENSION_HEIGHT] = 150; } } test("should layout child whose cross axis is null and whose alignSelf is stretch", root_node, root_layout); } [Test] public void TestCase189() { TestCSSNode root_node = new TestCSSNode(); { TestCSSNode node_0 = root_node; node_0.style.flexDirection = CSSFlexDirection.Row; addChildren(node_0, 2); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); addChildren(node_1, 1); { TestCSSNode node_2; node_2 = node_1.getChildAt(0); node_2.style.dimensions[DIMENSION_WIDTH] = 100; node_2.style.dimensions[DIMENSION_HEIGHT] = 100; } node_1 = node_0.getChildAt(1); node_1.style.dimensions[DIMENSION_WIDTH] = 100; addChildren(node_1, 1); { TestCSSNode node_2; node_2 = node_1.getChildAt(0); node_2.style.flexDirection = CSSFlexDirection.Column; node_2.style.alignItems = CSSAlign.Center; addChildren(node_2, 1); { TestCSSNode node_3; node_3 = node_2.getChildAt(0); node_3.style.dimensions[DIMENSION_WIDTH] = 50; node_3.style.dimensions[DIMENSION_HEIGHT] = 50; } } } } TestCSSNode root_layout = new TestCSSNode(); { TestCSSNode node_0 = root_layout; node_0.layout.position[POSITION_TOP] = 0; node_0.layout.position[POSITION_LEFT] = 0; node_0.layout.dimensions[DIMENSION_WIDTH] = 200; node_0.layout.dimensions[DIMENSION_HEIGHT] = 100; addChildren(node_0, 2); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.layout.position[POSITION_TOP] = 0; node_1.layout.position[POSITION_LEFT] = 0; node_1.layout.dimensions[DIMENSION_WIDTH] = 100; node_1.layout.dimensions[DIMENSION_HEIGHT] = 100; addChildren(node_1, 1); { TestCSSNode node_2; node_2 = node_1.getChildAt(0); node_2.layout.position[POSITION_TOP] = 0; node_2.layout.position[POSITION_LEFT] = 0; node_2.layout.dimensions[DIMENSION_WIDTH] = 100; node_2.layout.dimensions[DIMENSION_HEIGHT] = 100; } node_1 = node_0.getChildAt(1); node_1.layout.position[POSITION_TOP] = 0; node_1.layout.position[POSITION_LEFT] = 100; node_1.layout.dimensions[DIMENSION_WIDTH] = 100; node_1.layout.dimensions[DIMENSION_HEIGHT] = 100; addChildren(node_1, 1); { TestCSSNode node_2; node_2 = node_1.getChildAt(0); node_2.layout.position[POSITION_TOP] = 0; node_2.layout.position[POSITION_LEFT] = 0; node_2.layout.dimensions[DIMENSION_WIDTH] = 100; node_2.layout.dimensions[DIMENSION_HEIGHT] = 50; addChildren(node_2, 1); { TestCSSNode node_3; node_3 = node_2.getChildAt(0); node_3.layout.position[POSITION_TOP] = 0; node_3.layout.position[POSITION_LEFT] = 25; node_3.layout.dimensions[DIMENSION_WIDTH] = 50; node_3.layout.dimensions[DIMENSION_HEIGHT] = 50; } } } } test("should center items correctly inside a stretched layout", root_node, root_layout); } [Test] public void TestCase190() { TestCSSNode root_node = new TestCSSNode(); { TestCSSNode node_0 = root_node; node_0.style.dimensions[DIMENSION_WIDTH] = 100; node_0.style.dimensions[DIMENSION_HEIGHT] = 100; addChildren(node_0, 1); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.style.flex = -1; node_1.style.dimensions[DIMENSION_WIDTH] = 100; addChildren(node_1, 1); { TestCSSNode node_2; node_2 = node_1.getChildAt(0); node_2.style.dimensions[DIMENSION_WIDTH] = 100; node_2.style.dimensions[DIMENSION_HEIGHT] = 25; } } } TestCSSNode root_layout = new TestCSSNode(); { TestCSSNode node_0 = root_layout; node_0.layout.position[POSITION_TOP] = 0; node_0.layout.position[POSITION_LEFT] = 0; node_0.layout.dimensions[DIMENSION_WIDTH] = 100; node_0.layout.dimensions[DIMENSION_HEIGHT] = 100; addChildren(node_0, 1); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.layout.position[POSITION_TOP] = 0; node_1.layout.position[POSITION_LEFT] = 0; node_1.layout.dimensions[DIMENSION_WIDTH] = 100; node_1.layout.dimensions[DIMENSION_HEIGHT] = 25; addChildren(node_1, 1); { TestCSSNode node_2; node_2 = node_1.getChildAt(0); node_2.layout.position[POSITION_TOP] = 0; node_2.layout.position[POSITION_LEFT] = 0; node_2.layout.dimensions[DIMENSION_WIDTH] = 100; node_2.layout.dimensions[DIMENSION_HEIGHT] = 25; } } } test("should not shrink column node when there is space left over", root_node, root_layout); } [Test] public void TestCase191() { TestCSSNode root_node = new TestCSSNode(); { TestCSSNode node_0 = root_node; node_0.style.dimensions[DIMENSION_WIDTH] = 100; node_0.style.dimensions[DIMENSION_HEIGHT] = 100; addChildren(node_0, 1); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.style.flex = -1; node_1.style.dimensions[DIMENSION_WIDTH] = 100; addChildren(node_1, 1); { TestCSSNode node_2; node_2 = node_1.getChildAt(0); node_2.style.dimensions[DIMENSION_WIDTH] = 100; node_2.style.dimensions[DIMENSION_HEIGHT] = 200; } } } TestCSSNode root_layout = new TestCSSNode(); { TestCSSNode node_0 = root_layout; node_0.layout.position[POSITION_TOP] = 0; node_0.layout.position[POSITION_LEFT] = 0; node_0.layout.dimensions[DIMENSION_WIDTH] = 100; node_0.layout.dimensions[DIMENSION_HEIGHT] = 100; addChildren(node_0, 1); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.layout.position[POSITION_TOP] = 0; node_1.layout.position[POSITION_LEFT] = 0; node_1.layout.dimensions[DIMENSION_WIDTH] = 100; node_1.layout.dimensions[DIMENSION_HEIGHT] = 100; addChildren(node_1, 1); { TestCSSNode node_2; node_2 = node_1.getChildAt(0); node_2.layout.position[POSITION_TOP] = 0; node_2.layout.position[POSITION_LEFT] = 0; node_2.layout.dimensions[DIMENSION_WIDTH] = 100; node_2.layout.dimensions[DIMENSION_HEIGHT] = 200; } } } test("should shrink column node when there is not any space left over", root_node, root_layout); } [Test] public void TestCase192() { TestCSSNode root_node = new TestCSSNode(); { TestCSSNode node_0 = root_node; node_0.style.dimensions[DIMENSION_WIDTH] = 100; node_0.style.dimensions[DIMENSION_HEIGHT] = 100; addChildren(node_0, 3); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.style.dimensions[DIMENSION_WIDTH] = 100; node_1.style.dimensions[DIMENSION_HEIGHT] = 25; node_1 = node_0.getChildAt(1); node_1.style.flex = -1; node_1.style.dimensions[DIMENSION_WIDTH] = 100; addChildren(node_1, 1); { TestCSSNode node_2; node_2 = node_1.getChildAt(0); node_2.style.dimensions[DIMENSION_WIDTH] = 100; node_2.style.dimensions[DIMENSION_HEIGHT] = 30; } node_1 = node_0.getChildAt(2); node_1.style.dimensions[DIMENSION_WIDTH] = 100; node_1.style.dimensions[DIMENSION_HEIGHT] = 15; } } TestCSSNode root_layout = new TestCSSNode(); { TestCSSNode node_0 = root_layout; node_0.layout.position[POSITION_TOP] = 0; node_0.layout.position[POSITION_LEFT] = 0; node_0.layout.dimensions[DIMENSION_WIDTH] = 100; node_0.layout.dimensions[DIMENSION_HEIGHT] = 100; addChildren(node_0, 3); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.layout.position[POSITION_TOP] = 0; node_1.layout.position[POSITION_LEFT] = 0; node_1.layout.dimensions[DIMENSION_WIDTH] = 100; node_1.layout.dimensions[DIMENSION_HEIGHT] = 25; node_1 = node_0.getChildAt(1); node_1.layout.position[POSITION_TOP] = 25; node_1.layout.position[POSITION_LEFT] = 0; node_1.layout.dimensions[DIMENSION_WIDTH] = 100; node_1.layout.dimensions[DIMENSION_HEIGHT] = 30; addChildren(node_1, 1); { TestCSSNode node_2; node_2 = node_1.getChildAt(0); node_2.layout.position[POSITION_TOP] = 0; node_2.layout.position[POSITION_LEFT] = 0; node_2.layout.dimensions[DIMENSION_WIDTH] = 100; node_2.layout.dimensions[DIMENSION_HEIGHT] = 30; } node_1 = node_0.getChildAt(2); node_1.layout.position[POSITION_TOP] = 55; node_1.layout.position[POSITION_LEFT] = 0; node_1.layout.dimensions[DIMENSION_WIDTH] = 100; node_1.layout.dimensions[DIMENSION_HEIGHT] = 15; } } test("should not shrink column node with siblings when there is space left over", root_node, root_layout); } [Test] public void TestCase193() { TestCSSNode root_node = new TestCSSNode(); { TestCSSNode node_0 = root_node; node_0.style.dimensions[DIMENSION_WIDTH] = 100; node_0.style.dimensions[DIMENSION_HEIGHT] = 100; addChildren(node_0, 3); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.style.dimensions[DIMENSION_WIDTH] = 100; node_1.style.dimensions[DIMENSION_HEIGHT] = 25; node_1 = node_0.getChildAt(1); node_1.style.flex = -1; node_1.style.dimensions[DIMENSION_WIDTH] = 100; addChildren(node_1, 1); { TestCSSNode node_2; node_2 = node_1.getChildAt(0); node_2.style.dimensions[DIMENSION_WIDTH] = 100; node_2.style.dimensions[DIMENSION_HEIGHT] = 80; } node_1 = node_0.getChildAt(2); node_1.style.dimensions[DIMENSION_WIDTH] = 100; node_1.style.dimensions[DIMENSION_HEIGHT] = 15; } } TestCSSNode root_layout = new TestCSSNode(); { TestCSSNode node_0 = root_layout; node_0.layout.position[POSITION_TOP] = 0; node_0.layout.position[POSITION_LEFT] = 0; node_0.layout.dimensions[DIMENSION_WIDTH] = 100; node_0.layout.dimensions[DIMENSION_HEIGHT] = 100; addChildren(node_0, 3); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.layout.position[POSITION_TOP] = 0; node_1.layout.position[POSITION_LEFT] = 0; node_1.layout.dimensions[DIMENSION_WIDTH] = 100; node_1.layout.dimensions[DIMENSION_HEIGHT] = 25; node_1 = node_0.getChildAt(1); node_1.layout.position[POSITION_TOP] = 25; node_1.layout.position[POSITION_LEFT] = 0; node_1.layout.dimensions[DIMENSION_WIDTH] = 100; node_1.layout.dimensions[DIMENSION_HEIGHT] = 60; addChildren(node_1, 1); { TestCSSNode node_2; node_2 = node_1.getChildAt(0); node_2.layout.position[POSITION_TOP] = 0; node_2.layout.position[POSITION_LEFT] = 0; node_2.layout.dimensions[DIMENSION_WIDTH] = 100; node_2.layout.dimensions[DIMENSION_HEIGHT] = 80; } node_1 = node_0.getChildAt(2); node_1.layout.position[POSITION_TOP] = 85; node_1.layout.position[POSITION_LEFT] = 0; node_1.layout.dimensions[DIMENSION_WIDTH] = 100; node_1.layout.dimensions[DIMENSION_HEIGHT] = 15; } } test("should shrink column node with siblings when there is not any space left over", root_node, root_layout); } [Test] public void TestCase194() { TestCSSNode root_node = new TestCSSNode(); { TestCSSNode node_0 = root_node; node_0.style.dimensions[DIMENSION_WIDTH] = 100; node_0.style.dimensions[DIMENSION_HEIGHT] = 100; addChildren(node_0, 3); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.style.flex = -1; node_1.style.dimensions[DIMENSION_WIDTH] = 100; node_1.style.dimensions[DIMENSION_HEIGHT] = 30; node_1 = node_0.getChildAt(1); node_1.style.dimensions[DIMENSION_WIDTH] = 100; node_1.style.dimensions[DIMENSION_HEIGHT] = 40; node_1 = node_0.getChildAt(2); node_1.style.flex = -1; node_1.style.dimensions[DIMENSION_WIDTH] = 100; node_1.style.dimensions[DIMENSION_HEIGHT] = 50; } } TestCSSNode root_layout = new TestCSSNode(); { TestCSSNode node_0 = root_layout; node_0.layout.position[POSITION_TOP] = 0; node_0.layout.position[POSITION_LEFT] = 0; node_0.layout.dimensions[DIMENSION_WIDTH] = 100; node_0.layout.dimensions[DIMENSION_HEIGHT] = 100; addChildren(node_0, 3); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.layout.position[POSITION_TOP] = 0; node_1.layout.position[POSITION_LEFT] = 0; node_1.layout.dimensions[DIMENSION_WIDTH] = 100; node_1.layout.dimensions[DIMENSION_HEIGHT] = 22.5f; node_1 = node_0.getChildAt(1); node_1.layout.position[POSITION_TOP] = 22.5f; node_1.layout.position[POSITION_LEFT] = 0; node_1.layout.dimensions[DIMENSION_WIDTH] = 100; node_1.layout.dimensions[DIMENSION_HEIGHT] = 40; node_1 = node_0.getChildAt(2); node_1.layout.position[POSITION_TOP] = 62.5f; node_1.layout.position[POSITION_LEFT] = 0; node_1.layout.dimensions[DIMENSION_WIDTH] = 100; node_1.layout.dimensions[DIMENSION_HEIGHT] = 37.5f; } } test("should shrink column nodes proportional to their main size when there is not any space left over", root_node, root_layout); } [Test] public void TestCase195() { TestCSSNode root_node = new TestCSSNode(); { TestCSSNode node_0 = root_node; node_0.style.flexDirection = CSSFlexDirection.Row; node_0.style.dimensions[DIMENSION_WIDTH] = 100; node_0.style.dimensions[DIMENSION_HEIGHT] = 100; addChildren(node_0, 1); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.style.flex = -1; node_1.style.dimensions[DIMENSION_HEIGHT] = 100; addChildren(node_1, 1); { TestCSSNode node_2; node_2 = node_1.getChildAt(0); node_2.style.dimensions[DIMENSION_WIDTH] = 25; node_2.style.dimensions[DIMENSION_HEIGHT] = 100; } } } TestCSSNode root_layout = new TestCSSNode(); { TestCSSNode node_0 = root_layout; node_0.layout.position[POSITION_TOP] = 0; node_0.layout.position[POSITION_LEFT] = 0; node_0.layout.dimensions[DIMENSION_WIDTH] = 100; node_0.layout.dimensions[DIMENSION_HEIGHT] = 100; addChildren(node_0, 1); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.layout.position[POSITION_TOP] = 0; node_1.layout.position[POSITION_LEFT] = 0; node_1.layout.dimensions[DIMENSION_WIDTH] = 25; node_1.layout.dimensions[DIMENSION_HEIGHT] = 100; addChildren(node_1, 1); { TestCSSNode node_2; node_2 = node_1.getChildAt(0); node_2.layout.position[POSITION_TOP] = 0; node_2.layout.position[POSITION_LEFT] = 0; node_2.layout.dimensions[DIMENSION_WIDTH] = 25; node_2.layout.dimensions[DIMENSION_HEIGHT] = 100; } } } test("should not shrink visible row node when there is space left over", root_node, root_layout); } [Test] public void TestCase196() { TestCSSNode root_node = new TestCSSNode(); { TestCSSNode node_0 = root_node; node_0.style.flexDirection = CSSFlexDirection.Row; node_0.style.dimensions[DIMENSION_WIDTH] = 100; node_0.style.dimensions[DIMENSION_HEIGHT] = 100; addChildren(node_0, 1); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.style.flex = -1; node_1.style.dimensions[DIMENSION_HEIGHT] = 100; addChildren(node_1, 1); { TestCSSNode node_2; node_2 = node_1.getChildAt(0); node_2.style.dimensions[DIMENSION_WIDTH] = 200; node_2.style.dimensions[DIMENSION_HEIGHT] = 100; } } } TestCSSNode root_layout = new TestCSSNode(); { TestCSSNode node_0 = root_layout; node_0.layout.position[POSITION_TOP] = 0; node_0.layout.position[POSITION_LEFT] = 0; node_0.layout.dimensions[DIMENSION_WIDTH] = 100; node_0.layout.dimensions[DIMENSION_HEIGHT] = 100; addChildren(node_0, 1); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.layout.position[POSITION_TOP] = 0; node_1.layout.position[POSITION_LEFT] = 0; node_1.layout.dimensions[DIMENSION_WIDTH] = 100; node_1.layout.dimensions[DIMENSION_HEIGHT] = 100; addChildren(node_1, 1); { TestCSSNode node_2; node_2 = node_1.getChildAt(0); node_2.layout.position[POSITION_TOP] = 0; node_2.layout.position[POSITION_LEFT] = 0; node_2.layout.dimensions[DIMENSION_WIDTH] = 200; node_2.layout.dimensions[DIMENSION_HEIGHT] = 100; } } } test("should shrink visible row node when there is not any space left over", root_node, root_layout); } [Test] public void TestCase197() { TestCSSNode root_node = new TestCSSNode(); { TestCSSNode node_0 = root_node; node_0.style.flexDirection = CSSFlexDirection.Row; node_0.style.dimensions[DIMENSION_WIDTH] = 100; node_0.style.dimensions[DIMENSION_HEIGHT] = 100; addChildren(node_0, 3); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.style.dimensions[DIMENSION_WIDTH] = 25; node_1.style.dimensions[DIMENSION_HEIGHT] = 100; node_1 = node_0.getChildAt(1); node_1.style.flex = -1; node_1.style.dimensions[DIMENSION_HEIGHT] = 100; addChildren(node_1, 1); { TestCSSNode node_2; node_2 = node_1.getChildAt(0); node_2.style.dimensions[DIMENSION_WIDTH] = 30; node_2.style.dimensions[DIMENSION_HEIGHT] = 100; } node_1 = node_0.getChildAt(2); node_1.style.dimensions[DIMENSION_WIDTH] = 15; node_1.style.dimensions[DIMENSION_HEIGHT] = 100; } } TestCSSNode root_layout = new TestCSSNode(); { TestCSSNode node_0 = root_layout; node_0.layout.position[POSITION_TOP] = 0; node_0.layout.position[POSITION_LEFT] = 0; node_0.layout.dimensions[DIMENSION_WIDTH] = 100; node_0.layout.dimensions[DIMENSION_HEIGHT] = 100; addChildren(node_0, 3); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.layout.position[POSITION_TOP] = 0; node_1.layout.position[POSITION_LEFT] = 0; node_1.layout.dimensions[DIMENSION_WIDTH] = 25; node_1.layout.dimensions[DIMENSION_HEIGHT] = 100; node_1 = node_0.getChildAt(1); node_1.layout.position[POSITION_TOP] = 0; node_1.layout.position[POSITION_LEFT] = 25; node_1.layout.dimensions[DIMENSION_WIDTH] = 30; node_1.layout.dimensions[DIMENSION_HEIGHT] = 100; addChildren(node_1, 1); { TestCSSNode node_2; node_2 = node_1.getChildAt(0); node_2.layout.position[POSITION_TOP] = 0; node_2.layout.position[POSITION_LEFT] = 0; node_2.layout.dimensions[DIMENSION_WIDTH] = 30; node_2.layout.dimensions[DIMENSION_HEIGHT] = 100; } node_1 = node_0.getChildAt(2); node_1.layout.position[POSITION_TOP] = 0; node_1.layout.position[POSITION_LEFT] = 55; node_1.layout.dimensions[DIMENSION_WIDTH] = 15; node_1.layout.dimensions[DIMENSION_HEIGHT] = 100; } } test("should not shrink visible row node with siblings when there is space left over", root_node, root_layout); } [Test] public void TestCase198() { TestCSSNode root_node = new TestCSSNode(); { TestCSSNode node_0 = root_node; node_0.style.flexDirection = CSSFlexDirection.Row; node_0.style.dimensions[DIMENSION_WIDTH] = 100; node_0.style.dimensions[DIMENSION_HEIGHT] = 100; addChildren(node_0, 3); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.style.dimensions[DIMENSION_WIDTH] = 25; node_1.style.dimensions[DIMENSION_HEIGHT] = 100; node_1 = node_0.getChildAt(1); node_1.style.flex = -1; node_1.style.dimensions[DIMENSION_HEIGHT] = 100; addChildren(node_1, 1); { TestCSSNode node_2; node_2 = node_1.getChildAt(0); node_2.style.dimensions[DIMENSION_WIDTH] = 80; node_2.style.dimensions[DIMENSION_HEIGHT] = 100; } node_1 = node_0.getChildAt(2); node_1.style.dimensions[DIMENSION_WIDTH] = 15; node_1.style.dimensions[DIMENSION_HEIGHT] = 100; } } TestCSSNode root_layout = new TestCSSNode(); { TestCSSNode node_0 = root_layout; node_0.layout.position[POSITION_TOP] = 0; node_0.layout.position[POSITION_LEFT] = 0; node_0.layout.dimensions[DIMENSION_WIDTH] = 100; node_0.layout.dimensions[DIMENSION_HEIGHT] = 100; addChildren(node_0, 3); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.layout.position[POSITION_TOP] = 0; node_1.layout.position[POSITION_LEFT] = 0; node_1.layout.dimensions[DIMENSION_WIDTH] = 25; node_1.layout.dimensions[DIMENSION_HEIGHT] = 100; node_1 = node_0.getChildAt(1); node_1.layout.position[POSITION_TOP] = 0; node_1.layout.position[POSITION_LEFT] = 25; node_1.layout.dimensions[DIMENSION_WIDTH] = 60; node_1.layout.dimensions[DIMENSION_HEIGHT] = 100; addChildren(node_1, 1); { TestCSSNode node_2; node_2 = node_1.getChildAt(0); node_2.layout.position[POSITION_TOP] = 0; node_2.layout.position[POSITION_LEFT] = 0; node_2.layout.dimensions[DIMENSION_WIDTH] = 80; node_2.layout.dimensions[DIMENSION_HEIGHT] = 100; } node_1 = node_0.getChildAt(2); node_1.layout.position[POSITION_TOP] = 0; node_1.layout.position[POSITION_LEFT] = 85; node_1.layout.dimensions[DIMENSION_WIDTH] = 15; node_1.layout.dimensions[DIMENSION_HEIGHT] = 100; } } test("should shrink visible row node with siblings when there is not any space left over", root_node, root_layout); } [Test] public void TestCase199() { TestCSSNode root_node = new TestCSSNode(); { TestCSSNode node_0 = root_node; node_0.style.flexDirection = CSSFlexDirection.Row; node_0.style.dimensions[DIMENSION_WIDTH] = 100; node_0.style.dimensions[DIMENSION_HEIGHT] = 100; addChildren(node_0, 3); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.style.flex = -1; node_1.style.dimensions[DIMENSION_WIDTH] = 30; node_1.style.dimensions[DIMENSION_HEIGHT] = 100; node_1 = node_0.getChildAt(1); node_1.style.dimensions[DIMENSION_WIDTH] = 40; node_1.style.dimensions[DIMENSION_HEIGHT] = 100; node_1 = node_0.getChildAt(2); node_1.style.flex = -1; node_1.style.dimensions[DIMENSION_WIDTH] = 50; node_1.style.dimensions[DIMENSION_HEIGHT] = 100; } } TestCSSNode root_layout = new TestCSSNode(); { TestCSSNode node_0 = root_layout; node_0.layout.position[POSITION_TOP] = 0; node_0.layout.position[POSITION_LEFT] = 0; node_0.layout.dimensions[DIMENSION_WIDTH] = 100; node_0.layout.dimensions[DIMENSION_HEIGHT] = 100; addChildren(node_0, 3); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.layout.position[POSITION_TOP] = 0; node_1.layout.position[POSITION_LEFT] = 0; node_1.layout.dimensions[DIMENSION_WIDTH] = 22.5f; node_1.layout.dimensions[DIMENSION_HEIGHT] = 100; node_1 = node_0.getChildAt(1); node_1.layout.position[POSITION_TOP] = 0; node_1.layout.position[POSITION_LEFT] = 22.5f; node_1.layout.dimensions[DIMENSION_WIDTH] = 40; node_1.layout.dimensions[DIMENSION_HEIGHT] = 100; node_1 = node_0.getChildAt(2); node_1.layout.position[POSITION_TOP] = 0; node_1.layout.position[POSITION_LEFT] = 62.5f; node_1.layout.dimensions[DIMENSION_WIDTH] = 37.5f; node_1.layout.dimensions[DIMENSION_HEIGHT] = 100; } } test("should shrink visible row nodes when there is not any space left over", root_node, root_layout); } [Test] public void TestCase200() { TestCSSNode root_node = new TestCSSNode(); { TestCSSNode node_0 = root_node; node_0.style.flexDirection = CSSFlexDirection.Row; node_0.style.dimensions[DIMENSION_WIDTH] = 100; node_0.style.dimensions[DIMENSION_HEIGHT] = 100; addChildren(node_0, 1); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.style.overflow = CSSOverflow.Hidden; node_1.style.flex = -1; node_1.style.dimensions[DIMENSION_HEIGHT] = 100; addChildren(node_1, 1); { TestCSSNode node_2; node_2 = node_1.getChildAt(0); node_2.style.dimensions[DIMENSION_WIDTH] = 25; node_2.style.dimensions[DIMENSION_HEIGHT] = 100; } } } TestCSSNode root_layout = new TestCSSNode(); { TestCSSNode node_0 = root_layout; node_0.layout.position[POSITION_TOP] = 0; node_0.layout.position[POSITION_LEFT] = 0; node_0.layout.dimensions[DIMENSION_WIDTH] = 100; node_0.layout.dimensions[DIMENSION_HEIGHT] = 100; addChildren(node_0, 1); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.layout.position[POSITION_TOP] = 0; node_1.layout.position[POSITION_LEFT] = 0; node_1.layout.dimensions[DIMENSION_WIDTH] = 25; node_1.layout.dimensions[DIMENSION_HEIGHT] = 100; addChildren(node_1, 1); { TestCSSNode node_2; node_2 = node_1.getChildAt(0); node_2.layout.position[POSITION_TOP] = 0; node_2.layout.position[POSITION_LEFT] = 0; node_2.layout.dimensions[DIMENSION_WIDTH] = 25; node_2.layout.dimensions[DIMENSION_HEIGHT] = 100; } } } test("should not shrink hidden row node when there is space left over", root_node, root_layout); } [Test] public void TestCase201() { TestCSSNode root_node = new TestCSSNode(); { TestCSSNode node_0 = root_node; node_0.style.flexDirection = CSSFlexDirection.Row; node_0.style.dimensions[DIMENSION_WIDTH] = 100; node_0.style.dimensions[DIMENSION_HEIGHT] = 100; addChildren(node_0, 1); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.style.overflow = CSSOverflow.Hidden; node_1.style.flex = -1; node_1.style.dimensions[DIMENSION_HEIGHT] = 100; addChildren(node_1, 1); { TestCSSNode node_2; node_2 = node_1.getChildAt(0); node_2.style.dimensions[DIMENSION_WIDTH] = 200; node_2.style.dimensions[DIMENSION_HEIGHT] = 100; } } } TestCSSNode root_layout = new TestCSSNode(); { TestCSSNode node_0 = root_layout; node_0.layout.position[POSITION_TOP] = 0; node_0.layout.position[POSITION_LEFT] = 0; node_0.layout.dimensions[DIMENSION_WIDTH] = 100; node_0.layout.dimensions[DIMENSION_HEIGHT] = 100; addChildren(node_0, 1); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.layout.position[POSITION_TOP] = 0; node_1.layout.position[POSITION_LEFT] = 0; node_1.layout.dimensions[DIMENSION_WIDTH] = 100; node_1.layout.dimensions[DIMENSION_HEIGHT] = 100; addChildren(node_1, 1); { TestCSSNode node_2; node_2 = node_1.getChildAt(0); node_2.layout.position[POSITION_TOP] = 0; node_2.layout.position[POSITION_LEFT] = 0; node_2.layout.dimensions[DIMENSION_WIDTH] = 200; node_2.layout.dimensions[DIMENSION_HEIGHT] = 100; } } } test("should shrink hidden row node when there is not any space left over", root_node, root_layout); } [Test] public void TestCase202() { TestCSSNode root_node = new TestCSSNode(); { TestCSSNode node_0 = root_node; node_0.style.flexDirection = CSSFlexDirection.Row; node_0.style.dimensions[DIMENSION_WIDTH] = 100; node_0.style.dimensions[DIMENSION_HEIGHT] = 100; addChildren(node_0, 3); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.style.dimensions[DIMENSION_WIDTH] = 25; node_1.style.dimensions[DIMENSION_HEIGHT] = 100; node_1 = node_0.getChildAt(1); node_1.style.overflow = CSSOverflow.Hidden; node_1.style.flex = -1; node_1.style.dimensions[DIMENSION_HEIGHT] = 100; addChildren(node_1, 1); { TestCSSNode node_2; node_2 = node_1.getChildAt(0); node_2.style.dimensions[DIMENSION_WIDTH] = 30; node_2.style.dimensions[DIMENSION_HEIGHT] = 100; } node_1 = node_0.getChildAt(2); node_1.style.dimensions[DIMENSION_WIDTH] = 15; node_1.style.dimensions[DIMENSION_HEIGHT] = 100; } } TestCSSNode root_layout = new TestCSSNode(); { TestCSSNode node_0 = root_layout; node_0.layout.position[POSITION_TOP] = 0; node_0.layout.position[POSITION_LEFT] = 0; node_0.layout.dimensions[DIMENSION_WIDTH] = 100; node_0.layout.dimensions[DIMENSION_HEIGHT] = 100; addChildren(node_0, 3); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.layout.position[POSITION_TOP] = 0; node_1.layout.position[POSITION_LEFT] = 0; node_1.layout.dimensions[DIMENSION_WIDTH] = 25; node_1.layout.dimensions[DIMENSION_HEIGHT] = 100; node_1 = node_0.getChildAt(1); node_1.layout.position[POSITION_TOP] = 0; node_1.layout.position[POSITION_LEFT] = 25; node_1.layout.dimensions[DIMENSION_WIDTH] = 30; node_1.layout.dimensions[DIMENSION_HEIGHT] = 100; addChildren(node_1, 1); { TestCSSNode node_2; node_2 = node_1.getChildAt(0); node_2.layout.position[POSITION_TOP] = 0; node_2.layout.position[POSITION_LEFT] = 0; node_2.layout.dimensions[DIMENSION_WIDTH] = 30; node_2.layout.dimensions[DIMENSION_HEIGHT] = 100; } node_1 = node_0.getChildAt(2); node_1.layout.position[POSITION_TOP] = 0; node_1.layout.position[POSITION_LEFT] = 55; node_1.layout.dimensions[DIMENSION_WIDTH] = 15; node_1.layout.dimensions[DIMENSION_HEIGHT] = 100; } } test("should not shrink hidden row node with siblings when there is space left over", root_node, root_layout); } [Test] public void TestCase203() { TestCSSNode root_node = new TestCSSNode(); { TestCSSNode node_0 = root_node; node_0.style.flexDirection = CSSFlexDirection.Row; node_0.style.dimensions[DIMENSION_WIDTH] = 100; node_0.style.dimensions[DIMENSION_HEIGHT] = 100; addChildren(node_0, 3); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.style.dimensions[DIMENSION_WIDTH] = 25; node_1.style.dimensions[DIMENSION_HEIGHT] = 100; node_1 = node_0.getChildAt(1); node_1.style.overflow = CSSOverflow.Hidden; node_1.style.flex = -1; node_1.style.dimensions[DIMENSION_HEIGHT] = 100; addChildren(node_1, 1); { TestCSSNode node_2; node_2 = node_1.getChildAt(0); node_2.style.dimensions[DIMENSION_WIDTH] = 80; node_2.style.dimensions[DIMENSION_HEIGHT] = 100; } node_1 = node_0.getChildAt(2); node_1.style.dimensions[DIMENSION_WIDTH] = 15; node_1.style.dimensions[DIMENSION_HEIGHT] = 100; } } TestCSSNode root_layout = new TestCSSNode(); { TestCSSNode node_0 = root_layout; node_0.layout.position[POSITION_TOP] = 0; node_0.layout.position[POSITION_LEFT] = 0; node_0.layout.dimensions[DIMENSION_WIDTH] = 100; node_0.layout.dimensions[DIMENSION_HEIGHT] = 100; addChildren(node_0, 3); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.layout.position[POSITION_TOP] = 0; node_1.layout.position[POSITION_LEFT] = 0; node_1.layout.dimensions[DIMENSION_WIDTH] = 25; node_1.layout.dimensions[DIMENSION_HEIGHT] = 100; node_1 = node_0.getChildAt(1); node_1.layout.position[POSITION_TOP] = 0; node_1.layout.position[POSITION_LEFT] = 25; node_1.layout.dimensions[DIMENSION_WIDTH] = 60; node_1.layout.dimensions[DIMENSION_HEIGHT] = 100; addChildren(node_1, 1); { TestCSSNode node_2; node_2 = node_1.getChildAt(0); node_2.layout.position[POSITION_TOP] = 0; node_2.layout.position[POSITION_LEFT] = 0; node_2.layout.dimensions[DIMENSION_WIDTH] = 80; node_2.layout.dimensions[DIMENSION_HEIGHT] = 100; } node_1 = node_0.getChildAt(2); node_1.layout.position[POSITION_TOP] = 0; node_1.layout.position[POSITION_LEFT] = 85; node_1.layout.dimensions[DIMENSION_WIDTH] = 15; node_1.layout.dimensions[DIMENSION_HEIGHT] = 100; } } test("should shrink hidden row node with siblings when there is not any space left over", root_node, root_layout); } [Test] public void TestCase204() { TestCSSNode root_node = new TestCSSNode(); { TestCSSNode node_0 = root_node; node_0.style.flexDirection = CSSFlexDirection.Row; node_0.style.dimensions[DIMENSION_WIDTH] = 100; node_0.style.dimensions[DIMENSION_HEIGHT] = 100; addChildren(node_0, 3); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.style.overflow = CSSOverflow.Hidden; node_1.style.flex = -1; node_1.style.dimensions[DIMENSION_WIDTH] = 30; node_1.style.dimensions[DIMENSION_HEIGHT] = 100; node_1 = node_0.getChildAt(1); node_1.style.dimensions[DIMENSION_WIDTH] = 40; node_1.style.dimensions[DIMENSION_HEIGHT] = 100; node_1 = node_0.getChildAt(2); node_1.style.overflow = CSSOverflow.Hidden; node_1.style.flex = -1; node_1.style.dimensions[DIMENSION_WIDTH] = 50; node_1.style.dimensions[DIMENSION_HEIGHT] = 100; } } TestCSSNode root_layout = new TestCSSNode(); { TestCSSNode node_0 = root_layout; node_0.layout.position[POSITION_TOP] = 0; node_0.layout.position[POSITION_LEFT] = 0; node_0.layout.dimensions[DIMENSION_WIDTH] = 100; node_0.layout.dimensions[DIMENSION_HEIGHT] = 100; addChildren(node_0, 3); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.layout.position[POSITION_TOP] = 0; node_1.layout.position[POSITION_LEFT] = 0; node_1.layout.dimensions[DIMENSION_WIDTH] = 22.5f; node_1.layout.dimensions[DIMENSION_HEIGHT] = 100; node_1 = node_0.getChildAt(1); node_1.layout.position[POSITION_TOP] = 0; node_1.layout.position[POSITION_LEFT] = 22.5f; node_1.layout.dimensions[DIMENSION_WIDTH] = 40; node_1.layout.dimensions[DIMENSION_HEIGHT] = 100; node_1 = node_0.getChildAt(2); node_1.layout.position[POSITION_TOP] = 0; node_1.layout.position[POSITION_LEFT] = 62.5f; node_1.layout.dimensions[DIMENSION_WIDTH] = 37.5f; node_1.layout.dimensions[DIMENSION_HEIGHT] = 100; } } test("should shrink hidden row nodes proportional to their main size when there is not any space left over", root_node, root_layout); } [Test] public void TestCase205() { TestCSSNode root_node = new TestCSSNode(); { TestCSSNode node_0 = root_node; node_0.style.flexDirection = CSSFlexDirection.Row; node_0.style.dimensions[DIMENSION_WIDTH] = 213; node_0.style.dimensions[DIMENSION_HEIGHT] = 100; addChildren(node_0, 3); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.style.dimensions[DIMENSION_WIDTH] = 25; node_1.style.dimensions[DIMENSION_HEIGHT] = 100; node_1 = node_0.getChildAt(1); node_1.style.flexDirection = CSSFlexDirection.Row; node_1.style.alignItems = CSSAlign.FlexStart; node_1.style.flex = -1; node_1.style.dimensions[DIMENSION_HEIGHT] = 100; addChildren(node_1, 1); { TestCSSNode node_2; node_2 = node_1.getChildAt(0); node_2.setMeasureFunction(sTestMeasureFunction); node_2.context = "loooooooooong with space"; } node_1 = node_0.getChildAt(2); node_1.style.dimensions[DIMENSION_WIDTH] = 15; node_1.style.dimensions[DIMENSION_HEIGHT] = 100; } } TestCSSNode root_layout = new TestCSSNode(); { TestCSSNode node_0 = root_layout; node_0.layout.position[POSITION_TOP] = 0; node_0.layout.position[POSITION_LEFT] = 0; node_0.layout.dimensions[DIMENSION_WIDTH] = 213; node_0.layout.dimensions[DIMENSION_HEIGHT] = 100; addChildren(node_0, 3); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.layout.position[POSITION_TOP] = 0; node_1.layout.position[POSITION_LEFT] = 0; node_1.layout.dimensions[DIMENSION_WIDTH] = 25; node_1.layout.dimensions[DIMENSION_HEIGHT] = 100; node_1 = node_0.getChildAt(1); node_1.layout.position[POSITION_TOP] = 0; node_1.layout.position[POSITION_LEFT] = 25; node_1.layout.dimensions[DIMENSION_WIDTH] = 172; node_1.layout.dimensions[DIMENSION_HEIGHT] = 100; addChildren(node_1, 1); { TestCSSNode node_2; node_2 = node_1.getChildAt(0); node_2.layout.position[POSITION_TOP] = 0; node_2.layout.position[POSITION_LEFT] = 0; node_2.layout.dimensions[DIMENSION_WIDTH] = 172; node_2.layout.dimensions[DIMENSION_HEIGHT] = 18; } node_1 = node_0.getChildAt(2); node_1.layout.position[POSITION_TOP] = 0; node_1.layout.position[POSITION_LEFT] = 197; node_1.layout.dimensions[DIMENSION_WIDTH] = 15; node_1.layout.dimensions[DIMENSION_HEIGHT] = 100; } } test("should not shrink text node with siblings when there is space left over", root_node, root_layout); } [Test] public void TestCase206() { TestCSSNode root_node = new TestCSSNode(); { TestCSSNode node_0 = root_node; node_0.style.flexDirection = CSSFlexDirection.Row; node_0.style.dimensions[DIMENSION_WIDTH] = 140; node_0.style.dimensions[DIMENSION_HEIGHT] = 100; addChildren(node_0, 3); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.style.dimensions[DIMENSION_WIDTH] = 25; node_1.style.dimensions[DIMENSION_HEIGHT] = 100; node_1 = node_0.getChildAt(1); node_1.style.flexDirection = CSSFlexDirection.Row; node_1.style.alignItems = CSSAlign.FlexStart; node_1.style.flex = -1; node_1.style.dimensions[DIMENSION_HEIGHT] = 100; addChildren(node_1, 1); { TestCSSNode node_2; node_2 = node_1.getChildAt(0); node_2.style.flex = -1; node_2.setMeasureFunction(sTestMeasureFunction); node_2.context = "loooooooooong with space"; } node_1 = node_0.getChildAt(2); node_1.style.dimensions[DIMENSION_WIDTH] = 15; node_1.style.dimensions[DIMENSION_HEIGHT] = 100; } } TestCSSNode root_layout = new TestCSSNode(); { TestCSSNode node_0 = root_layout; node_0.layout.position[POSITION_TOP] = 0; node_0.layout.position[POSITION_LEFT] = 0; node_0.layout.dimensions[DIMENSION_WIDTH] = 140; node_0.layout.dimensions[DIMENSION_HEIGHT] = 100; addChildren(node_0, 3); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.layout.position[POSITION_TOP] = 0; node_1.layout.position[POSITION_LEFT] = 0; node_1.layout.dimensions[DIMENSION_WIDTH] = 25; node_1.layout.dimensions[DIMENSION_HEIGHT] = 100; node_1 = node_0.getChildAt(1); node_1.layout.position[POSITION_TOP] = 0; node_1.layout.position[POSITION_LEFT] = 25; node_1.layout.dimensions[DIMENSION_WIDTH] = 100; node_1.layout.dimensions[DIMENSION_HEIGHT] = 100; addChildren(node_1, 1); { TestCSSNode node_2; node_2 = node_1.getChildAt(0); node_2.layout.position[POSITION_TOP] = 0; node_2.layout.position[POSITION_LEFT] = 0; node_2.layout.dimensions[DIMENSION_WIDTH] = 100; node_2.layout.dimensions[DIMENSION_HEIGHT] = 36; } node_1 = node_0.getChildAt(2); node_1.layout.position[POSITION_TOP] = 0; node_1.layout.position[POSITION_LEFT] = 125; node_1.layout.dimensions[DIMENSION_WIDTH] = 15; node_1.layout.dimensions[DIMENSION_HEIGHT] = 100; } } test("should shrink text node with siblings when there is not any space left over", root_node, root_layout); } [Test] public void TestCase207() { TestCSSNode root_node = new TestCSSNode(); { TestCSSNode node_0 = root_node; node_0.style.flexDirection = CSSFlexDirection.Row; node_0.style.alignContent = CSSAlign.Stretch; node_0.style.alignItems = CSSAlign.FlexStart; node_0.style.flexWrap = CSSWrap.Wrap; node_0.style.dimensions[DIMENSION_WIDTH] = 300; node_0.style.dimensions[DIMENSION_HEIGHT] = 380; addChildren(node_0, 15); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.style.dimensions[DIMENSION_WIDTH] = 50; node_1.style.dimensions[DIMENSION_HEIGHT] = 50; node_1.setMargin(Spacing.LEFT, 10); node_1.setMargin(Spacing.TOP, 10); node_1.setMargin(Spacing.RIGHT, 10); node_1.setMargin(Spacing.BOTTOM, 10); node_1.setMargin(Spacing.START, 10); node_1.setMargin(Spacing.END, 10); node_1 = node_0.getChildAt(1); node_1.style.dimensions[DIMENSION_WIDTH] = 50; node_1.style.dimensions[DIMENSION_HEIGHT] = 50; node_1.setMargin(Spacing.LEFT, 10); node_1.setMargin(Spacing.TOP, 10); node_1.setMargin(Spacing.RIGHT, 10); node_1.setMargin(Spacing.BOTTOM, 10); node_1.setMargin(Spacing.START, 10); node_1.setMargin(Spacing.END, 10); node_1 = node_0.getChildAt(2); node_1.style.dimensions[DIMENSION_WIDTH] = 50; node_1.style.dimensions[DIMENSION_HEIGHT] = 50; node_1.setMargin(Spacing.LEFT, 10); node_1.setMargin(Spacing.TOP, 10); node_1.setMargin(Spacing.RIGHT, 10); node_1.setMargin(Spacing.BOTTOM, 10); node_1.setMargin(Spacing.START, 10); node_1.setMargin(Spacing.END, 10); node_1 = node_0.getChildAt(3); node_1.style.dimensions[DIMENSION_WIDTH] = 50; node_1.style.dimensions[DIMENSION_HEIGHT] = 50; node_1.setMargin(Spacing.LEFT, 10); node_1.setMargin(Spacing.TOP, 10); node_1.setMargin(Spacing.RIGHT, 10); node_1.setMargin(Spacing.BOTTOM, 10); node_1.setMargin(Spacing.START, 10); node_1.setMargin(Spacing.END, 10); node_1 = node_0.getChildAt(4); node_1.style.dimensions[DIMENSION_WIDTH] = 50; node_1.style.dimensions[DIMENSION_HEIGHT] = 100; node_1.setMargin(Spacing.LEFT, 10); node_1.setMargin(Spacing.TOP, 10); node_1.setMargin(Spacing.RIGHT, 10); node_1.setMargin(Spacing.BOTTOM, 10); node_1.setMargin(Spacing.START, 10); node_1.setMargin(Spacing.END, 10); node_1 = node_0.getChildAt(5); node_1.style.alignSelf = CSSAlign.FlexStart; node_1.style.dimensions[DIMENSION_WIDTH] = 50; node_1.style.dimensions[DIMENSION_HEIGHT] = 50; node_1.setMargin(Spacing.LEFT, 10); node_1.setMargin(Spacing.TOP, 10); node_1.setMargin(Spacing.RIGHT, 10); node_1.setMargin(Spacing.BOTTOM, 10); node_1.setMargin(Spacing.START, 10); node_1.setMargin(Spacing.END, 10); node_1 = node_0.getChildAt(6); node_1.style.dimensions[DIMENSION_WIDTH] = 50; node_1.style.dimensions[DIMENSION_HEIGHT] = 50; node_1.setMargin(Spacing.LEFT, 10); node_1.setMargin(Spacing.TOP, 10); node_1.setMargin(Spacing.RIGHT, 10); node_1.setMargin(Spacing.BOTTOM, 10); node_1.setMargin(Spacing.START, 10); node_1.setMargin(Spacing.END, 10); node_1 = node_0.getChildAt(7); node_1.style.dimensions[DIMENSION_WIDTH] = 50; node_1.style.dimensions[DIMENSION_HEIGHT] = 100; node_1.setMargin(Spacing.LEFT, 10); node_1.setMargin(Spacing.TOP, 10); node_1.setMargin(Spacing.RIGHT, 10); node_1.setMargin(Spacing.BOTTOM, 10); node_1.setMargin(Spacing.START, 10); node_1.setMargin(Spacing.END, 10); node_1 = node_0.getChildAt(8); node_1.style.dimensions[DIMENSION_WIDTH] = 50; node_1.style.dimensions[DIMENSION_HEIGHT] = 50; node_1.setMargin(Spacing.LEFT, 10); node_1.setMargin(Spacing.TOP, 10); node_1.setMargin(Spacing.RIGHT, 10); node_1.setMargin(Spacing.BOTTOM, 10); node_1.setMargin(Spacing.START, 10); node_1.setMargin(Spacing.END, 10); node_1 = node_0.getChildAt(9); node_1.style.dimensions[DIMENSION_WIDTH] = 50; node_1.style.dimensions[DIMENSION_HEIGHT] = 50; node_1.setMargin(Spacing.LEFT, 10); node_1.setMargin(Spacing.TOP, 10); node_1.setMargin(Spacing.RIGHT, 10); node_1.setMargin(Spacing.BOTTOM, 10); node_1.setMargin(Spacing.START, 10); node_1.setMargin(Spacing.END, 10); node_1 = node_0.getChildAt(10); node_1.style.alignSelf = CSSAlign.FlexStart; node_1.style.dimensions[DIMENSION_WIDTH] = 50; node_1.style.dimensions[DIMENSION_HEIGHT] = 50; node_1.setMargin(Spacing.LEFT, 10); node_1.setMargin(Spacing.TOP, 10); node_1.setMargin(Spacing.RIGHT, 10); node_1.setMargin(Spacing.BOTTOM, 10); node_1.setMargin(Spacing.START, 10); node_1.setMargin(Spacing.END, 10); node_1 = node_0.getChildAt(11); node_1.style.dimensions[DIMENSION_WIDTH] = 50; node_1.style.dimensions[DIMENSION_HEIGHT] = 50; node_1.setMargin(Spacing.LEFT, 10); node_1.setMargin(Spacing.TOP, 10); node_1.setMargin(Spacing.RIGHT, 10); node_1.setMargin(Spacing.BOTTOM, 10); node_1.setMargin(Spacing.START, 10); node_1.setMargin(Spacing.END, 10); node_1 = node_0.getChildAt(12); node_1.style.dimensions[DIMENSION_WIDTH] = 50; node_1.style.dimensions[DIMENSION_HEIGHT] = 50; node_1.setMargin(Spacing.LEFT, 10); node_1.setMargin(Spacing.TOP, 10); node_1.setMargin(Spacing.RIGHT, 10); node_1.setMargin(Spacing.BOTTOM, 10); node_1.setMargin(Spacing.START, 10); node_1.setMargin(Spacing.END, 10); node_1 = node_0.getChildAt(13); node_1.style.alignSelf = CSSAlign.FlexStart; node_1.style.dimensions[DIMENSION_WIDTH] = 50; node_1.style.dimensions[DIMENSION_HEIGHT] = 50; node_1.setMargin(Spacing.LEFT, 10); node_1.setMargin(Spacing.TOP, 10); node_1.setMargin(Spacing.RIGHT, 10); node_1.setMargin(Spacing.BOTTOM, 10); node_1.setMargin(Spacing.START, 10); node_1.setMargin(Spacing.END, 10); node_1 = node_0.getChildAt(14); node_1.style.dimensions[DIMENSION_WIDTH] = 50; node_1.style.dimensions[DIMENSION_HEIGHT] = 50; node_1.setMargin(Spacing.LEFT, 10); node_1.setMargin(Spacing.TOP, 10); node_1.setMargin(Spacing.RIGHT, 10); node_1.setMargin(Spacing.BOTTOM, 10); node_1.setMargin(Spacing.START, 10); node_1.setMargin(Spacing.END, 10); } } TestCSSNode root_layout = new TestCSSNode(); { TestCSSNode node_0 = root_layout; node_0.layout.position[POSITION_TOP] = 0; node_0.layout.position[POSITION_LEFT] = 0; node_0.layout.dimensions[DIMENSION_WIDTH] = 300; node_0.layout.dimensions[DIMENSION_HEIGHT] = 380; addChildren(node_0, 15); { TestCSSNode node_1; node_1 = node_0.getChildAt(0); node_1.layout.position[POSITION_TOP] = 10; node_1.layout.position[POSITION_LEFT] = 10; node_1.layout.dimensions[DIMENSION_WIDTH] = 50; node_1.layout.dimensions[DIMENSION_HEIGHT] = 50; node_1 = node_0.getChildAt(1); node_1.layout.position[POSITION_TOP] = 10; node_1.layout.position[POSITION_LEFT] = 80; node_1.layout.dimensions[DIMENSION_WIDTH] = 50; node_1.layout.dimensions[DIMENSION_HEIGHT] = 50; node_1 = node_0.getChildAt(2); node_1.layout.position[POSITION_TOP] = 10; node_1.layout.position[POSITION_LEFT] = 150; node_1.layout.dimensions[DIMENSION_WIDTH] = 50; node_1.layout.dimensions[DIMENSION_HEIGHT] = 50; node_1 = node_0.getChildAt(3); node_1.layout.position[POSITION_TOP] = 10; node_1.layout.position[POSITION_LEFT] = 220; node_1.layout.dimensions[DIMENSION_WIDTH] = 50; node_1.layout.dimensions[DIMENSION_HEIGHT] = 50; node_1 = node_0.getChildAt(4); node_1.layout.position[POSITION_TOP] = 92.5f; node_1.layout.position[POSITION_LEFT] = 10; node_1.layout.dimensions[DIMENSION_WIDTH] = 50; node_1.layout.dimensions[DIMENSION_HEIGHT] = 100; node_1 = node_0.getChildAt(5); node_1.layout.position[POSITION_TOP] = 92.5f; node_1.layout.position[POSITION_LEFT] = 80; node_1.layout.dimensions[DIMENSION_WIDTH] = 50; node_1.layout.dimensions[DIMENSION_HEIGHT] = 50; node_1 = node_0.getChildAt(6); node_1.layout.position[POSITION_TOP] = 92.5f; node_1.layout.position[POSITION_LEFT] = 150; node_1.layout.dimensions[DIMENSION_WIDTH] = 50; node_1.layout.dimensions[DIMENSION_HEIGHT] = 50; node_1 = node_0.getChildAt(7); node_1.layout.position[POSITION_TOP] = 92.5f; node_1.layout.position[POSITION_LEFT] = 220; node_1.layout.dimensions[DIMENSION_WIDTH] = 50; node_1.layout.dimensions[DIMENSION_HEIGHT] = 100; node_1 = node_0.getChildAt(8); node_1.layout.position[POSITION_TOP] = 225; node_1.layout.position[POSITION_LEFT] = 10; node_1.layout.dimensions[DIMENSION_WIDTH] = 50; node_1.layout.dimensions[DIMENSION_HEIGHT] = 50; node_1 = node_0.getChildAt(9); node_1.layout.position[POSITION_TOP] = 225; node_1.layout.position[POSITION_LEFT] = 80; node_1.layout.dimensions[DIMENSION_WIDTH] = 50; node_1.layout.dimensions[DIMENSION_HEIGHT] = 50; node_1 = node_0.getChildAt(10); node_1.layout.position[POSITION_TOP] = 225; node_1.layout.position[POSITION_LEFT] = 150; node_1.layout.dimensions[DIMENSION_WIDTH] = 50; node_1.layout.dimensions[DIMENSION_HEIGHT] = 50; node_1 = node_0.getChildAt(11); node_1.layout.position[POSITION_TOP] = 225; node_1.layout.position[POSITION_LEFT] = 220; node_1.layout.dimensions[DIMENSION_WIDTH] = 50; node_1.layout.dimensions[DIMENSION_HEIGHT] = 50; node_1 = node_0.getChildAt(12); node_1.layout.position[POSITION_TOP] = 307.5f; node_1.layout.position[POSITION_LEFT] = 10; node_1.layout.dimensions[DIMENSION_WIDTH] = 50; node_1.layout.dimensions[DIMENSION_HEIGHT] = 50; node_1 = node_0.getChildAt(13); node_1.layout.position[POSITION_TOP] = 307.5f; node_1.layout.position[POSITION_LEFT] = 80; node_1.layout.dimensions[DIMENSION_WIDTH] = 50; node_1.layout.dimensions[DIMENSION_HEIGHT] = 50; node_1 = node_0.getChildAt(14); node_1.layout.position[POSITION_TOP] = 307.5f; node_1.layout.position[POSITION_LEFT] = 150; node_1.layout.dimensions[DIMENSION_WIDTH] = 50; node_1.layout.dimensions[DIMENSION_HEIGHT] = 50; } } test("should layout with alignContent: stretch, and alignItems: flex-start", root_node, root_layout); } /** END_GENERATED **/ } }
34.451672
137
0.645547
[ "BSD-3-Clause" ]
jordwalke/css-layout
src/csharp/Facebook.CSSLayout.Tests/LayoutEngineTest.cs
341,106
C#
using Newtonsoft.Json; using Newtonsoft.Json.Linq; using System.Net.Http; using System.Threading.Tasks; using TechTalk.SpecFlow; namespace CaseManagement.HumanTasks.Acceptance.Tests.Steps { [Binding] public class DataExtractSteps { private readonly ScenarioContext _scenarioContext; public DataExtractSteps(ScenarioContext scenarioContext) { _scenarioContext = scenarioContext; } [When("extract JSON from body")] public async Task WhenExtractFromBody() { var httpResponseMessage = _scenarioContext["httpResponseMessage"] as HttpResponseMessage; var json = await httpResponseMessage.Content.ReadAsStringAsync().ConfigureAwait(false); _scenarioContext.Set(JsonConvert.DeserializeObject<JObject>(json), "jsonHttpBody"); } [When("extract JSON from body into '(.*)'")] public async Task WhenExtractFromBodyIntoKey(string key) { var httpResponseMessage = _scenarioContext["httpResponseMessage"] as HttpResponseMessage; var json = await httpResponseMessage.Content.ReadAsStringAsync().ConfigureAwait(false); _scenarioContext.Set(JsonConvert.DeserializeObject<JObject>(json), key); } [When("extract '(.*)' from JSON body into '(.*)'")] public void WhenExtractJSONKeyFromBody(string selector, string key) { var jsonHttpBody = _scenarioContext["jsonHttpBody"] as JObject; var val = jsonHttpBody.SelectToken(selector); if (val != null) { _scenarioContext.Set(val.ToString(), key); } } } }
35.914894
101
0.656398
[ "Apache-2.0" ]
lulzzz/CaseManagement
tests/CaseManagement.HumanTasks.Acceptance.Tests/Steps/DataExtractSteps.cs
1,690
C#
using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; using System.Xml; using System.Xml.Linq; using UnityEditor; using UnityEngine; namespace Tiled2Unity { // Concentrates on the Xml file being imported partial class ImportTiled2Unity { public static readonly string ThisVersion = "0.9.13.0"; public void XmlImported(string xmlPath) { XDocument xml = XDocument.Load(xmlPath); CheckVersion(xmlPath, xml); // Import asset files. // (Note that textures should be imported before meshes) ImportTexturesFromXml(xml); CreateMaterialsFromInternalTextures(xml); ImportMeshesFromXml(xml); } private void CheckVersion(string xmlPath, XDocument xml) { string version = xml.Root.Attribute("version").Value; if (version != ThisVersion) { Debug.LogWarning(string.Format("Imported Tiled2Unity file '{0}' was exported with version {1}. We are expecting version {2}", xmlPath, version, ThisVersion)); } } private void ImportTexturesFromXml(XDocument xml) { var texData = xml.Root.Elements("ImportTexture"); foreach (var tex in texData) { string name = tex.Attribute("filename").Value; string data = tex.Value; // The data is gzip compressed base64 string. We need the raw bytes. //byte[] bytes = ImportUtils.GzipBase64ToBytes(data); byte[] bytes = ImportUtils.Base64ToBytes(data); // Save and import the texture asset { string pathToSave = GetTextureAssetPath(name); ImportUtils.ReadyToWrite(pathToSave); File.WriteAllBytes(pathToSave, bytes); AssetDatabase.ImportAsset(pathToSave, ImportAssetOptions.ForceSynchronousImport); } // Create a material if needed in prepartion for the texture being successfully imported { string materialPath = GetMaterialAssetPath(name); Material material = AssetDatabase.LoadAssetAtPath(materialPath, typeof(Material)) as Material; if (material == null) { // We need to create the material afterall // Use our custom shader material = new Material(Shader.Find("Tiled/TextureTintSnap")); ImportUtils.ReadyToWrite(materialPath); AssetDatabase.CreateAsset(material, materialPath); } } } } private void CreateMaterialsFromInternalTextures(XDocument xml) { var texData = xml.Root.Elements("InternalTexture"); foreach (var tex in texData) { string texAssetPath = tex.Attribute("assetPath").Value; string materialPath = GetMaterialAssetPath(texAssetPath); Material material = AssetDatabase.LoadAssetAtPath(materialPath, typeof(Material)) as Material; if (material == null) { // Create our material material = new Material(Shader.Find("Tiled/TextureTintSnap")); // Assign to it the texture that is already internal to our Unity project Texture2D texture2d = AssetDatabase.LoadAssetAtPath(texAssetPath, typeof(Texture2D)) as Texture2D; material.SetTexture("_MainTex", texture2d); // Write the material to our asset database ImportUtils.ReadyToWrite(materialPath); AssetDatabase.CreateAsset(material, materialPath); } } } private void ImportMeshesFromXml(XDocument xml) { var meshData = xml.Root.Elements("ImportMesh"); foreach (var mesh in meshData) { // We're going to create/write a file that contains our mesh data as a Wavefront Obj file // The actual mesh will be imported from this Obj file string fname = mesh.Attribute("filename").Value; string data = mesh.Value; // The data is in base64 format. We need it as a raw string. string raw = ImportUtils.Base64ToString(data); // Save and import the asset string pathToMesh = GetMeshAssetPath(fname); ImportUtils.ReadyToWrite(pathToMesh); File.WriteAllText(pathToMesh, raw, Encoding.UTF8); AssetDatabase.ImportAsset(pathToMesh, ImportAssetOptions.ForceSynchronousImport); } } } }
39.309524
174
0.572986
[ "MIT" ]
VirtualPythonLLC/Trans-Mutation
Transmutation/Assets/Tiled2Unity/Scripts/Editor/ImportTiled2Unity.Xml.cs
4,955
C#
/* * Copyright (c) 2012 Stephen A. Pratt * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ using org.critterai.nmgen; using org.critterai.nav; namespace org.critterai.nmbuild { /// <summary> /// A task used to manage the build of an <see cref="IncrementalBuilder"/> object. /// </summary> /// <remarks> /// <para> /// The primary purpose of this class is to run the builder on a background thread. /// It handles aborts and exception handling, which are not possible if the /// builder is run directly on a thread. /// </para> /// </remarks> public sealed class NMGenTask : BuildTask<NMGenAssets> { private readonly IncrementalBuilder mBuilder; private NMGenTask(IncrementalBuilder builder, int priority) : base(priority) { mBuilder = builder; } /// <summary> /// If true, the task is safe to run on its own thread. /// </summary> /// <remarks> /// <para> /// Will be true if the root builder is thread-safe. /// </para> /// </remarks> public override bool IsThreadSafe { get { return mBuilder.IsThreadSafe; } } /// <summary> /// The x-index of the tile within the tile grid. (x, z) /// </summary> public int TileX { get { return mBuilder.TileX; } } /// <summary> /// The z-index of the tile within the tile grid. (x, z) /// </summary> public int TileZ { get { return mBuilder.TileZ; } } /// <summary> /// Creates a new task. /// </summary> /// <param name="builder">The builder to manage.</param> /// <param name="priority">The task priority.</param> /// <returns>A task, or null on error.</returns> public static NMGenTask Create(IncrementalBuilder builder, int priority) { if (builder == null || builder.IsFinished) return null; return new NMGenTask(builder, priority); } /// <summary> /// Performs a work increment. /// </summary> /// <returns>True if the task is not yet finished. Otherwise false.</returns> protected override bool LocalUpdate() { mBuilder.Build(); return !mBuilder.IsFinished; // Go to false when IsFinished. } /// <summary> /// Gets the result of the completed task. /// </summary> /// <param name="result">The result of the completed task.</param> /// <returns> /// True if the result is available, false if the task should abort with no result. /// (I.e. An internal abort.) /// </returns> protected override bool GetResult(out NMGenAssets result) { AddMessages(mBuilder.GetMessages()); switch (mBuilder.State) { case NMGenState.Complete: result = mBuilder.Result; return true; case NMGenState.NoResult: result = new NMGenAssets(mBuilder.TileX, mBuilder.TileZ, null, null); return true; default: result = new NMGenAssets(); return false; } } } }
36.25
93
0.578643
[ "MIT" ]
hjjss/critterai
src/main/Assets/CAI/nmbuild/Editor/NMGenTask.cs
4,497
C#
#define Graph_And_Chart_PRO using ChartAndGraph.Common; using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace ChartAndGraph.DataSource { /// <summary> /// base class for all data sources /// </summary> internal abstract class ChartDataSourceBase { public class DataValueChangedEventArgs : EventArgs { public ChartItemIndex ItemIndex { get; private set; } public double OldValue { get; private set; } public double NewValue { get; private set; } public bool MinMaxChanged { get; private set; } public DataValueChangedEventArgs(int group,int category,double oldValue,double newValue,bool minMaxChanged) { ItemIndex = new ChartItemIndex(group, category); OldValue = oldValue; NewValue = newValue; MinMaxChanged = minMaxChanged; } } public event EventHandler DataStructureChanged; public event Action<string,int,string,int> ItemsReplaced; public event EventHandler<DataValueChangedEventArgs> DataValueChanged; protected void OnDataStructureChanged() { if (DataStructureChanged != null) DataStructureChanged(this, EventArgs.Empty); } protected void OnItemsReplaced(string first, int firstIndex, string second, int secondIndex) { if (ItemsReplaced != null) ItemsReplaced(first, firstIndex, second, secondIndex); } protected void OnDataValueChanged(DataValueChangedEventArgs data) { if (DataValueChanged != null) DataValueChanged(this, data); } public abstract double[,] getRawData(); public abstract ChartColumnCollection Columns { get;} public abstract ChartRowCollection Rows { get; } } }
33.912281
119
0.635282
[ "MIT" ]
FrozenSonar/Fencing3DNEAT
Assets/Chart And Graph/Script/DataSource/ChartDataSourceBase.cs
1,933
C#
using Hyperledger.Indy.DidApi; using Hyperledger.Indy.LedgerApi; using Microsoft.VisualStudio.TestTools.UnitTesting; using Newtonsoft.Json.Linq; using System; using System.Threading.Tasks; namespace Hyperledger.Indy.Test.LedgerTests { [TestClass] public class NymRequestTest : IndyIntegrationTestWithPoolAndSingleWallet { private const string _dest = "FYmoFw55GeQH7SRFa37dkx1d2dZ3zUF8ckg7wmL7ofN4"; private const string _role = "STEWARD"; private const string _alias = "some_alias"; [TestMethod] public async Task TestBuildNymRequestWorksForOnlyRequiredFields() { var expectedResult = string.Format("\"identifier\":\"{0}\",\"operation\":{{\"dest\":\"{1}\",\"type\":\"1\"}}", DID, _dest); var nymRequest = await Ledger.BuildNymRequestAsync(DID, _dest, null, null, null); Assert.IsTrue(nymRequest.Contains(expectedResult)); } [TestMethod] public async Task TestBuildNymRequestWorksForEmptyRole() { var expectedResult = string.Format("\"identifier\":\"{0}\",\"operation\":{{\"dest\":\"{1}\",\"role\":null,\"type\":\"1\"}}", DID, _dest); var nymRequest = await Ledger.BuildNymRequestAsync(DID, _dest, null, null, string.Empty); Assert.IsTrue(nymRequest.Contains(expectedResult)); } [TestMethod] public async Task TestBuildNymRequestWorksForOnlyOptionalFields() { var expectedResult = string.Format("\"identifier\":\"{0}\"," + "\"operation\":{{" + "\"alias\":\"{1}\"," + "\"dest\":\"{2}\"," + "\"role\":\"2\"," + "\"type\":\"1\"," + "\"verkey\":\"{3}\"" + "}}", DID, _alias, _dest, VERKEY_TRUSTEE); var nymRequest = await Ledger.BuildNymRequestAsync(DID, _dest, VERKEY_TRUSTEE, _alias, _role); Assert.IsTrue(nymRequest.Contains(expectedResult)); } [TestMethod] public async Task TestBuildGetNymRequestWorks() { var expectedResult = String.Format("\"identifier\":\"{0}\",\"operation\":{{\"type\":\"105\",\"dest\":\"{1}\"}}", DID, _dest); var nymRequest = await Ledger.BuildGetNymRequestAsync(DID, _dest); Assert.IsTrue(nymRequest.Contains(expectedResult)); } [TestMethod] public async Task TestBuildGetNymRequestWorksForDefaultSubmitter() { await Ledger.BuildGetNymRequestAsync(null, _dest); } [TestMethod] public async Task TestNymRequestWorksWithoutSignature() { var didResult = await Did.CreateAndStoreMyDidAsync(wallet, "{}"); var did = didResult.Did; var nymRequest = await Ledger.BuildNymRequestAsync(did, did, null, null, null); var response = await Ledger.SubmitRequestAsync(pool, nymRequest); CheckResponseType(response, "REQNACK"); } [TestMethod] public async Task TestSendNymRequestsWorksForOnlyRequiredFields() { var trusteeDidResult = await Did.CreateAndStoreMyDidAsync(wallet, TRUSTEE_IDENTITY_JSON); var trusteeDid = trusteeDidResult.Did; var myDidResult = await Did.CreateAndStoreMyDidAsync(wallet, "{}"); var myDid = myDidResult.Did; var nymRequest = await Ledger.BuildNymRequestAsync(trusteeDid, myDid, null, null, null); var nymResponse = await Ledger.SignAndSubmitRequestAsync(pool, wallet, trusteeDid, nymRequest); Assert.IsNotNull(nymResponse); } [TestMethod] public async Task TestSendNymRequestsWorksForOptionalFields() { var trusteeDidResult = await Did.CreateAndStoreMyDidAsync(wallet, TRUSTEE_IDENTITY_JSON); var trusteeDid = trusteeDidResult.Did; var myDidResult = await Did.CreateAndStoreMyDidAsync(wallet, "{}"); var myDid = myDidResult.Did; var myVerKey = myDidResult.VerKey; var nymRequest = await Ledger.BuildNymRequestAsync(trusteeDid, myDid, myVerKey, _alias, _role); var nymResponse = await Ledger.SignAndSubmitRequestAsync(pool, wallet, trusteeDid, nymRequest); Assert.IsNotNull(nymResponse); } [TestMethod] public async Task TestGetNymRequestWorks() { var didResult = await Did.CreateAndStoreMyDidAsync(wallet, TRUSTEE_IDENTITY_JSON); var did = didResult.Did; var getNymRequest = await Ledger.BuildGetNymRequestAsync(did, did); var getNymResponse = await Ledger.SubmitRequestAsync(pool, getNymRequest); var getNymResponseObj = JObject.Parse(getNymResponse); Assert.AreEqual(did, (string)getNymResponseObj["result"]["dest"]); } [TestMethod] public async Task TestSendNymRequestsWorksForWrongSignerRole() { var trusteeDidResult = await Did.CreateAndStoreMyDidAsync(wallet, TRUSTEE_IDENTITY_JSON); var trusteeDid = trusteeDidResult.Did; var myDidResult = await Did.CreateAndStoreMyDidAsync(wallet, "{}"); var myDid = myDidResult.Did; var nymRequest = await Ledger.BuildNymRequestAsync(trusteeDid, myDid, null, null, null); await Ledger.SignAndSubmitRequestAsync(pool, wallet, trusteeDid, nymRequest); var myDidResult2 = await Did.CreateAndStoreMyDidAsync(wallet, "{}"); var myDid2 = myDidResult2.Did; var nymRequest2 = await Ledger.BuildNymRequestAsync(myDid, myDid2, null, null, null); var response = await Ledger.SignAndSubmitRequestAsync(pool, wallet, myDid, nymRequest2); CheckResponseType(response, "REQNACK"); } [TestMethod] public async Task TestSendNymRequestsWorksForUnknownSigner() { var trusteeDidJson = "{\"seed\":\"000000000000000000000000Trustee9\"}"; var trusteeDidResult = await Did.CreateAndStoreMyDidAsync(wallet, trusteeDidJson); var trusteeDid = trusteeDidResult.Did; var myDidResult = await Did.CreateAndStoreMyDidAsync(wallet, "{}"); var myDid = myDidResult.Did; var nymRequest = await Ledger.BuildNymRequestAsync(trusteeDid, myDid, null, null, null); var response = await Ledger.SignAndSubmitRequestAsync(pool, wallet, myDid, nymRequest); CheckResponseType(response, "REQNACK"); } [TestMethod] public async Task TestNymRequestsWorks() { var trusteeDidResult = await Did.CreateAndStoreMyDidAsync(wallet, TRUSTEE_IDENTITY_JSON); var trusteeDid = trusteeDidResult.Did; var myDidResult = await Did.CreateAndStoreMyDidAsync(wallet, "{}"); var myDid = myDidResult.Did; var myVerKey = myDidResult.VerKey; var nymRequest = await Ledger.BuildNymRequestAsync(trusteeDid, myDid, myVerKey, null, null); await Ledger.SignAndSubmitRequestAsync(pool, wallet, trusteeDid, nymRequest); var getNymRequest = await Ledger.BuildGetNymRequestAsync(myDid, myDid); var getNymResponse = PoolUtils.EnsurePreviousRequestAppliedAsync(pool, getNymRequest, response => { return CompareResponseType(response, "REPLY"); }); Assert.IsNotNull(getNymResponse); } [TestMethod] public async Task TestSendNymRequestsWorksForWrongRole() { var ex = await Assert.ThrowsExceptionAsync<InvalidStructureException>(() => Ledger.BuildNymRequestAsync(DID, _dest, null, null, "WRONG_ROLE") ); } } }
41.632979
162
0.631532
[ "Apache-2.0" ]
AYCH-Inc/aych.hyperindy
wrappers/dotnet/indy-sdk-dotnet-test/LedgerTests/NymRequestTest.cs
7,829
C#
// Copyright (c) MASA Stack All rights reserved. // Licensed under the MIT License. See LICENSE.txt in the project root for license information. namespace Masa.Contrib.Dispatcher.Events.HandlerOrder.Tests.Events; public record CalculateEvent : Event { public int ParameterA { get; set; } public int ParameterB { get; set; } public int Result { get; set; } }
26.785714
95
0.728
[ "MIT" ]
Sky-nt/MASA.Contrib
test/Masa.Contrib.Dispatcher.Events.HandlerOrder.Tests/Events/CalculateEvent.cs
377
C#
using TopupPortal.Domain.Common; using TopupPortal.Domain.Entities; namespace TopupPortal.Domain.Events { public class TodoItemCompletedEvent : DomainEvent { public TodoItemCompletedEvent(Product item) { Item = item; } public Product Item { get; } } }
19.4375
53
0.646302
[ "MIT" ]
gagan2015/cleanarchitectureproto
src/Domain/Events/TodoItemCompletedEvent.cs
313
C#
/* * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). * You may not use this file except in compliance with the License. * A copy of the License is located at * * http://aws.amazon.com/apache2.0 * * or in the "license" file accompanying this file. This file is distributed * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either * express or implied. See the License for the specific language governing * permissions and limitations under the License. */ /* * Do not modify this file. This file is generated from the iot-2015-05-28.normal.json service model. */ using System; using System.Collections.Generic; using System.Globalization; using System.IO; using System.Net; using System.Text; using System.Xml.Serialization; using Amazon.IoT.Model; using Amazon.Runtime; using Amazon.Runtime.Internal; using Amazon.Runtime.Internal.Transform; using Amazon.Runtime.Internal.Util; using ThirdParty.Json.LitJson; namespace Amazon.IoT.Model.Internal.MarshallTransformations { /// <summary> /// Response Unmarshaller for ListThingGroups operation /// </summary> public class ListThingGroupsResponseUnmarshaller : JsonResponseUnmarshaller { /// <summary> /// Unmarshaller the response from the service to the response class. /// </summary> /// <param name="context"></param> /// <returns></returns> public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext context) { ListThingGroupsResponse response = new ListThingGroupsResponse(); context.Read(); int targetDepth = context.CurrentDepth; while (context.ReadAtDepth(targetDepth)) { if (context.TestExpression("nextToken", targetDepth)) { var unmarshaller = StringUnmarshaller.Instance; response.NextToken = unmarshaller.Unmarshall(context); continue; } if (context.TestExpression("thingGroups", targetDepth)) { var unmarshaller = new ListUnmarshaller<GroupNameAndArn, GroupNameAndArnUnmarshaller>(GroupNameAndArnUnmarshaller.Instance); response.ThingGroups = unmarshaller.Unmarshall(context); continue; } } return response; } /// <summary> /// Unmarshaller error response to exception. /// </summary> /// <param name="context"></param> /// <param name="innerException"></param> /// <param name="statusCode"></param> /// <returns></returns> public override AmazonServiceException UnmarshallException(JsonUnmarshallerContext context, Exception innerException, HttpStatusCode statusCode) { var errorResponse = JsonErrorResponseUnmarshaller.GetInstance().Unmarshall(context); errorResponse.InnerException = innerException; errorResponse.StatusCode = statusCode; var responseBodyBytes = context.GetResponseBodyBytes(); using (var streamCopy = new MemoryStream(responseBodyBytes)) using (var contextCopy = new JsonUnmarshallerContext(streamCopy, false, null)) { if (errorResponse.Code != null && errorResponse.Code.Equals("InternalFailureException")) { return InternalFailureExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidRequestException")) { return InvalidRequestExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse); } if (errorResponse.Code != null && errorResponse.Code.Equals("ResourceNotFoundException")) { return ResourceNotFoundExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse); } if (errorResponse.Code != null && errorResponse.Code.Equals("ThrottlingException")) { return ThrottlingExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse); } } return new AmazonIoTException(errorResponse.Message, errorResponse.InnerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, errorResponse.StatusCode); } private static ListThingGroupsResponseUnmarshaller _instance = new ListThingGroupsResponseUnmarshaller(); internal static ListThingGroupsResponseUnmarshaller GetInstance() { return _instance; } /// <summary> /// Gets the singleton. /// </summary> public static ListThingGroupsResponseUnmarshaller Instance { get { return _instance; } } } }
40.953125
187
0.622091
[ "Apache-2.0" ]
philasmar/aws-sdk-net
sdk/src/Services/IoT/Generated/Model/Internal/MarshallTransformations/ListThingGroupsResponseUnmarshaller.cs
5,242
C#
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // Общие сведения об этой сборке предоставляются следующим набором // набора атрибутов. Измените значения этих атрибутов, чтобы изменить сведения, // связанные со сборкой. [assembly: AssemblyTitle("ConsoleApp1")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("ConsoleApp1")] [assembly: AssemblyCopyright("Copyright © 2019")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Установка значения False для параметра ComVisible делает типы в этой сборке невидимыми // для компонентов COM. Если необходимо обратиться к типу в этой сборке через // COM, задайте атрибуту ComVisible значение TRUE для этого типа. [assembly: ComVisible(false)] // Следующий GUID служит для идентификации библиотеки типов, если этот проект будет видимым для COM [assembly: Guid("9d306b19-f000-4bc4-845a-b0f88b7a6dc7")] // Сведения о версии сборки состоят из следующих четырех значений: // // Основной номер версии // Дополнительный номер версии // Номер сборки // Редакция // // Можно задать все значения или принять номер сборки и номер редакции по умолчанию. // используя "*", как показано ниже: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")]
1,425
1,425
0.763509
[ "MIT" ]
stryaponoff/chromatic-tuner
test/ConsoleApp1/ConsoleApp1/Properties/AssemblyInfo.cs
2,005
C#
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace NNbt.Serialization { [AttributeUsage(AttributeTargets.Property)] public class NbtPropertyAttribute : Attribute { public TagType? Type { get; set; } public string Name { get; set; } public NbtPropertyAttribute () { } public NbtPropertyAttribute (string name) { Name = name; } public NbtPropertyAttribute (TagType propertyType) { Type = propertyType; } } public class NbtListAttribute : NbtPropertyAttribute { public TagType? SubType { get; set; } public NbtListAttribute () : base(TagType.List) { } public NbtListAttribute (string name) : base(TagType.List) { Name = name; } public NbtListAttribute (TagType subType) : base(TagType.List) { SubType = subType; } } [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct)] public class NbtTypeResolverAttribute : Attribute { public Type Type { get; set; } public NbtTypeResolverAttribute (Type type) { Type = type; } } }
21.8
70
0.571101
[ "MIT" ]
Jorch72/CS-NNBT
NNBT/Serialization/Attributes.cs
1,310
C#
// Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information. // Ported from um/MsHTML.h in the Windows SDK for Windows 10.0.22000.0 // Original source is Copyright © Microsoft. All rights reserved. using NUnit.Framework; using System; using System.Runtime.InteropServices; using static TerraFX.Interop.Windows.IID; namespace TerraFX.Interop.Windows.UnitTests; /// <summary>Provides validation of the <see cref="IHTMLBaseFontElement" /> struct.</summary> public static unsafe partial class IHTMLBaseFontElementTests { /// <summary>Validates that the <see cref="Guid" /> of the <see cref="IHTMLBaseFontElement" /> struct is correct.</summary> [Test] public static void GuidOfTest() { Assert.That(typeof(IHTMLBaseFontElement).GUID, Is.EqualTo(IID_IHTMLBaseFontElement)); } /// <summary>Validates that the <see cref="IHTMLBaseFontElement" /> struct is blittable.</summary> [Test] public static void IsBlittableTest() { Assert.That(Marshal.SizeOf<IHTMLBaseFontElement>(), Is.EqualTo(sizeof(IHTMLBaseFontElement))); } /// <summary>Validates that the <see cref="IHTMLBaseFontElement" /> struct has the right <see cref="LayoutKind" />.</summary> [Test] public static void IsLayoutSequentialTest() { Assert.That(typeof(IHTMLBaseFontElement).IsLayoutSequential, Is.True); } /// <summary>Validates that the <see cref="IHTMLBaseFontElement" /> struct has the correct size.</summary> [Test] public static void SizeOfTest() { if (Environment.Is64BitProcess) { Assert.That(sizeof(IHTMLBaseFontElement), Is.EqualTo(8)); } else { Assert.That(sizeof(IHTMLBaseFontElement), Is.EqualTo(4)); } } }
36.176471
145
0.696477
[ "MIT" ]
reflectronic/terrafx.interop.windows
tests/Interop/Windows/Windows/um/MsHTML/IHTMLBaseFontElementTests.cs
1,847
C#
/* * Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). * You may not use this file except in compliance with the License. * A copy of the License is located at * * http://aws.amazon.com/apache2.0 * * or in the "license" file accompanying this file. This file is distributed * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either * express or implied. See the License for the specific language governing * permissions and limitations under the License. */ /* * Do not modify this file. This file is generated from the ssm-2014-11-06.normal.json service model. */ using System; using System.Collections.Generic; using System.Globalization; using System.IO; using System.Net; using System.Text; using System.Xml.Serialization; using Amazon.SimpleSystemsManagement.Model; using Amazon.Runtime; using Amazon.Runtime.Internal; using Amazon.Runtime.Internal.Transform; using Amazon.Runtime.Internal.Util; using ThirdParty.Json.LitJson; namespace Amazon.SimpleSystemsManagement.Model.Internal.MarshallTransformations { /// <summary> /// Response Unmarshaller for IdempotentParameterMismatchException Object /// </summary> public class IdempotentParameterMismatchExceptionUnmarshaller : IErrorResponseUnmarshaller<IdempotentParameterMismatchException, JsonUnmarshallerContext> { /// <summary> /// Unmarshaller the response from the service to the response class. /// </summary> /// <param name="context"></param> /// <returns></returns> public IdempotentParameterMismatchException Unmarshall(JsonUnmarshallerContext context) { return this.Unmarshall(context, new ErrorResponse()); } /// <summary> /// Unmarshaller the response from the service to the response class. /// </summary> /// <param name="context"></param> /// <param name="errorResponse"></param> /// <returns></returns> public IdempotentParameterMismatchException Unmarshall(JsonUnmarshallerContext context, ErrorResponse errorResponse) { context.Read(); IdempotentParameterMismatchException unmarshalledObject = new IdempotentParameterMismatchException(errorResponse.Message, errorResponse.InnerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, errorResponse.StatusCode); int targetDepth = context.CurrentDepth; while (context.ReadAtDepth(targetDepth)) { } return unmarshalledObject; } private static IdempotentParameterMismatchExceptionUnmarshaller _instance = new IdempotentParameterMismatchExceptionUnmarshaller(); /// <summary> /// Gets the singleton. /// </summary> public static IdempotentParameterMismatchExceptionUnmarshaller Instance { get { return _instance; } } } }
36.576471
163
0.686073
[ "Apache-2.0" ]
DetlefGolze/aws-sdk-net
sdk/src/Services/SimpleSystemsManagement/Generated/Model/Internal/MarshallTransformations/IdempotentParameterMismatchExceptionUnmarshaller.cs
3,109
C#
namespace TurnipCalculator.Behaviors { public enum NavigationViewHeaderMode { Always, Never, Minimal } }
14.2
40
0.605634
[ "MIT" ]
gabbybilka/animalcrossing-uwp
TurnipCalculator/TurnipCalculator/Behaviors/NavigationViewHeaderMode.cs
144
C#
using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Runtime.InteropServices.WindowsRuntime; using Windows.ApplicationModel; using Windows.ApplicationModel.Activation; using Windows.Foundation; using Windows.Foundation.Collections; using Windows.UI.Xaml; using Windows.UI.Xaml.Controls; using Windows.UI.Xaml.Controls.Primitives; using Windows.UI.Xaml.Data; using Windows.UI.Xaml.Input; using Windows.UI.Xaml.Media; using Windows.UI.Xaml.Navigation; namespace HealthyWork.WIN_IoT.Tests { /// <summary> /// Provides application-specific behavior to supplement the default Application class. /// </summary> sealed partial class App : Application { /// <summary> /// Initializes the singleton application object. This is the first line of authored code /// executed, and as such is the logical equivalent of main() or WinMain(). /// </summary> public App() { this.InitializeComponent(); this.Suspending += OnSuspending; } /// <summary> /// Invoked when the application is launched normally by the end user. Other entry points /// will be used such as when the application is launched to open a specific file. /// </summary> /// <param name="e">Details about the launch request and process.</param> protected override void OnLaunched(LaunchActivatedEventArgs e) { #if DEBUG if (System.Diagnostics.Debugger.IsAttached) { this.DebugSettings.EnableFrameRateCounter = true; } #endif Frame rootFrame = Window.Current.Content as Frame; // Do not repeat app initialization when the Window already has content, // just ensure that the window is active if (rootFrame == null) { // Create a Frame to act as the navigation context and navigate to the first page rootFrame = new Frame(); rootFrame.NavigationFailed += OnNavigationFailed; if (e.PreviousExecutionState == ApplicationExecutionState.Terminated) { //TODO: Load state from previously suspended application } // Place the frame in the current Window Window.Current.Content = rootFrame; } Microsoft.VisualStudio.TestPlatform.TestExecutor.UnitTestClient.CreateDefaultUI(); // Ensure the current window is active Window.Current.Activate(); Microsoft.VisualStudio.TestPlatform.TestExecutor.UnitTestClient.Run(e.Arguments); } /// <summary> /// Invoked when Navigation to a certain page fails /// </summary> /// <param name="sender">The Frame which failed navigation</param> /// <param name="e">Details about the navigation failure</param> void OnNavigationFailed(object sender, NavigationFailedEventArgs e) { throw new Exception("Failed to load Page " + e.SourcePageType.FullName); } /// <summary> /// Invoked when application execution is being suspended. Application state is saved /// without knowing whether the application will be terminated or resumed with the contents /// of memory still intact. /// </summary> /// <param name="sender">The source of the suspend request.</param> /// <param name="e">Details about the suspend request.</param> private void OnSuspending(object sender, SuspendingEventArgs e) { var deferral = e.SuspendingOperation.GetDeferral(); //TODO: Save application state and stop any background activity deferral.Complete(); } } }
37.38835
99
0.63464
[ "MIT" ]
davidgonzalezbarbe/HealthyWork
HealthyWork.WIN_IoT.Tests/UnitTestApp.xaml.cs
3,853
C#
using System.Linq; using Vim.Extensions; using Xunit; using System; using System.Collections.Generic; namespace Vim.UnitTest { public abstract class SettingsCommonTest { private readonly IVimSettings _settings; protected SettingsCommonTest() { _settings = Create(); } protected abstract string ToggleSettingName { get; } protected abstract string NumberSettingName { get; } protected abstract IVimSettings Create(); protected Setting ToggleSetting { get { return _settings.GetSetting(ToggleSettingName).Value; } } protected Setting NumberSetting { get { return _settings.GetSetting(NumberSettingName).Value; } } #region Derived Implementations public sealed class LocalSettingsTest : SettingsCommonTest { protected override string ToggleSettingName { get { return LocalSettingNames.NumberName; } } protected override string NumberSettingName { get { return LocalSettingNames.ShiftWidthName; } } protected override IVimSettings Create() { return new LocalSettings(new GlobalSettings()); } } public sealed class GlobalSettingsTest : SettingsCommonTest { protected override string ToggleSettingName { get { return GlobalSettingNames.IgnoreCaseName; } } protected override string NumberSettingName { get { return GlobalSettingNames.ScrollOffsetName; } } protected override IVimSettings Create() { return new GlobalSettings(); } } public sealed class WindowSettingsTest : SettingsCommonTest { protected override string ToggleSettingName { get { return WindowSettingNames.CursorLineName; } } protected override string NumberSettingName { get { return WindowSettingNames.ScrollName; } } protected override IVimSettings Create() { return new WindowSettings(new GlobalSettings()); } } #endregion /// <summary> /// Value returned from all should be immutable /// </summary> [Fact] public void SettingsAreImmutable() { var all = _settings.Settings; var value = all.Single(x => x.Name == NumberSettingName); var prev = value.Value.AsNumber().Item; Assert.NotEqual(42, prev); Assert.True(_settings.TrySetValue(NumberSettingName, SettingValue.NewNumber(42))); value = all.Single(x => x.Name == NumberSettingName); Assert.Equal(prev, value.Value.AsNumber().Item); } /// <summary> /// Every setting should be accessible by their name /// </summary> [Fact] public void GetSettingByName() { foreach (var setting in _settings.Settings) { var found = _settings.GetSetting(setting.Name); Assert.True(found.IsSome()); Assert.Equal(setting.Name, found.Value.Name); Assert.Equal(setting.Abbreviation, found.Value.Abbreviation); } } /// <summary> /// Every setting should be accessible by their abbreviation /// </summary> [Fact] public void GetSettingByAbbreviation() { foreach (var setting in _settings.Settings) { var found = _settings.GetSetting(setting.Abbreviation); Assert.True(found.IsSome()); Assert.Equal(setting.Name, found.Value.Name); Assert.Equal(setting.Abbreviation, found.Value.Abbreviation); } } [Fact] public void GetSettingMissing() { var found = _settings.GetSetting("NotASettingName"); Assert.True(found.IsNone()); } [Fact] public void TrySetValue1() { Assert.True(_settings.TrySetValue(GlobalSettingNames.IgnoreCaseName, SettingValue.NewToggle(true))); var value = _settings.GetSetting(GlobalSettingNames.IgnoreCaseName); Assert.True(value.IsSome()); Assert.True(value.Value.Value.AsToggle().Item); } [Fact] public void TrySetValue2() { Assert.True(_settings.TrySetValue(GlobalSettingNames.ScrollOffsetName, SettingValue.NewNumber(42))); var value = _settings.GetSetting(GlobalSettingNames.ScrollOffsetName); Assert.True(value.IsSome()); Assert.Equal(42, value.Value.Value.AsNumber().Item); } /// <summary> /// Set by abbreviation /// </summary> [Fact] public void TrySetValue3() { foreach (var cur in _settings.Settings) { SettingValue value = null; if (cur.Kind.IsToggle) { value = SettingValue.NewToggle(true); } else if (cur.Kind.IsString) { value = SettingValue.NewString("foo"); } else if (cur.Kind.IsNumber) { value = SettingValue.NewNumber(42); } else { throw new Exception("failed"); } Assert.True(_settings.TrySetValue(cur.Abbreviation, value)); } } [Fact] public void TrySetValueFromString1() { foreach (var cur in _settings.Settings) { string value = null; if (cur.Kind.IsToggle) { value = "true"; } else if (cur.Kind.IsString) { value = "hello world"; } else if (cur.Kind.IsNumber) { value = "42"; } else { throw new Exception("failed"); } Assert.True(_settings.TrySetValueFromString(cur.Name, value)); } } /// <summary> /// Now by abbreviation /// </summary> [Fact] public void TrySetValueFromString2() { foreach (var cur in _settings.Settings) { string value = null; if (cur.Kind.IsToggle) { value = "true"; } else if (cur.Kind.IsString) { value = "hello world"; } else if (cur.Kind.IsNumber) { value = "42"; } else { throw new Exception("failed"); } Assert.True(_settings.TrySetValueFromString(cur.Abbreviation, value)); } } [Fact] public void SetByAbbreviation_Number() { Assert.True(_settings.TrySetValueFromString(NumberSetting.Abbreviation, "2")); Assert.Equal(2, NumberSetting.Value.AsNumber().Item); } [Fact] public void SetByAbbreviation_Toggle() { Assert.True(_settings.TrySetValueFromString(ToggleSetting.Abbreviation, "true")); Assert.True(ToggleSetting.Value.AsToggle().Item); } [Fact] public void SettingChanged1() { var didRun = false; _settings.SettingChanged += (unused, args) => { var setting = args.Setting; Assert.Equal(ToggleSettingName, setting.Name); Assert.True(setting.Value.AsToggle().Item); didRun = true; }; _settings.TrySetValue(ToggleSettingName, SettingValue.NewToggle(true)); Assert.True(didRun); } [Fact] public void SettingChanged2() { var didRun = false; _settings.SettingChanged += (unused, args) => { var setting = args.Setting; Assert.Equal(ToggleSettingName, setting.Name); Assert.True(setting.Value.AsToggle().Item); didRun = true; }; _settings.TrySetValueFromString(ToggleSettingName, "true"); Assert.True(didRun); } [Fact] public void SettingsShouldStartAsDefault() { foreach (var setting in _settings.Settings) { Assert.True(setting.IsValueDefault); } } } }
31.260726
113
0.487753
[ "Apache-2.0" ]
jhamm/VsVim
Test/VimCoreTest/SettingsCommonTest.cs
9,474
C#
using System.Collections; using System.Collections.Generic; using UnityEngine; public class EnemyMovement : MonoBehaviour { public float enemyDist; public float enemyDir; public float enemyVolume; AudioSource enemySound; // Use this for initialization void Start () { enemySound = GetComponent<AudioSource>(); } // Update is called once per frame void Update () { } }
17.772727
44
0.736573
[ "Unlicense" ]
paosalcedo/AudioOnlyGame
Audio Final/Assets/Scripts/EnemyMovement.cs
393
C#
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Windows.Input; using AssemblyDefender.UI; using System.ComponentModel; using System.Reflection; namespace AssemblyDefender.UI.Model { public static class Commands { private static ICommand[] _commands = new ICommand[(int)CommandID.Last + 1]; [System.Reflection.Obfuscation(Feature = "rename,remove", Exclude = true)] public static DelegateCommand New { get { return Get(CommandID.New); } } [System.Reflection.Obfuscation(Feature = "rename,remove", Exclude = true)] public static DelegateCommand Open { get { return Get(CommandID.Open); } } [System.Reflection.Obfuscation(Feature = "rename,remove", Exclude = true)] public static DelegateCommand<bool> Save { get { return Get<bool>(CommandID.Save); } } [System.Reflection.Obfuscation(Feature = "rename,remove", Exclude = true)] public static DelegateCommand Exit { get { return Get(CommandID.Exit); } } [System.Reflection.Obfuscation(Feature = "rename,remove", Exclude = true)] public static DelegateCommand Refresh { get { return Get(CommandID.Refresh); } } [System.Reflection.Obfuscation(Feature = "rename,remove", Exclude = true)] public static DelegateCommand ViewSearch { get { return Get(CommandID.ViewSearch); } } [System.Reflection.Obfuscation(Feature = "rename,remove", Exclude = true)] public static DelegateCommand ViewDecodeStackTrace { get { return Get(CommandID.ViewDecodeStackTrace); } } [System.Reflection.Obfuscation(Feature = "rename,remove", Exclude = true)] public static DelegateCommand ViewStartPage { get { return Get(CommandID.ViewStartPage); } } [System.Reflection.Obfuscation(Feature = "rename,remove", Exclude = true)] public static DelegateCommand AddAssembly { get { return Get(CommandID.AddAssembly); } } [System.Reflection.Obfuscation(Feature = "rename,remove", Exclude = true)] public static DelegateCommand RemoveAssembly { get { return Get(CommandID.RemoveAssembly); } } [System.Reflection.Obfuscation(Feature = "rename,remove", Exclude = true)] public static DelegateCommand Build { get { return Get(CommandID.Build); } } [System.Reflection.Obfuscation(Feature = "rename,remove", Exclude = true)] public static DelegateCommand<string> GoWeb { get { return Get<string>(CommandID.GoWeb); } } [System.Reflection.Obfuscation(Feature = "rename,remove", Exclude = true)] public static DelegateCommand RegisterProduct { get { return Get(CommandID.RegisterProduct); } } [System.Reflection.Obfuscation(Feature = "rename,remove", Exclude = true)] public static DelegateCommand About { get { return Get(CommandID.About); } } [System.Reflection.Obfuscation(Feature = "rename,remove", Exclude = true)] public static DelegateCommand GoBack { get { return Get(CommandID.GoBack); } } [System.Reflection.Obfuscation(Feature = "rename,remove", Exclude = true)] public static DelegateCommand GoForward { get { return Get(CommandID.GoForward); } } [System.Reflection.Obfuscation(Feature = "rename,remove", Exclude = true)] public static DelegateCommand ExpandAll { get { return Get(CommandID.ExpandAll); } } [System.Reflection.Obfuscation(Feature = "rename,remove", Exclude = true)] public static DelegateCommand CollapseAll { get { return Get(CommandID.CollapseAll); } } private static DelegateCommand Get(CommandID commandID) { int index = (int)commandID; var command = _commands[index] as DelegateCommand; if (command == null) { command = new DelegateCommand(); _commands[index] = command; } return command; } private static DelegateCommand<T> Get<T>(CommandID commandID) { int index = (int)commandID; var command = _commands[index] as DelegateCommand<T>; if (command == null) { command = new DelegateCommand<T>(); _commands[index] = command; } return command; } private enum CommandID { New, Open, Save, Exit, Refresh, ViewSearch, ViewDecodeStackTrace, ViewStartPage, AddAssembly, RemoveAssembly, Build, GoWeb, RegisterProduct, ReportBug, About, GoBack, GoForward, ExpandAll, CollapseAll, Last = CollapseAll, } } }
24.794286
78
0.706153
[ "MIT" ]
nickyandreev/AssemblyDefender
src/AssemblyDefender.UI.Model/Commands.cs
4,339
C#
using System.Collections.Generic; using Content.Shared.Damage; using Content.Shared.Sound; using Robust.Shared.GameObjects; using Robust.Shared.Maths; using Robust.Shared.Serialization.Manager.Attributes; namespace Content.Server.Weapon.Melee.EnergySword { [RegisterComponent, ComponentProtoName("EnergySword")] internal class EnergySwordComponent : Component { public Color BladeColor = Color.DodgerBlue; public bool Hacked = false; public bool Activated = false; [DataField("hitSound")] public SoundSpecifier HitSound { get; set; } = new SoundPathSpecifier("/Audio/Weapons/eblade1.ogg"); [DataField("activateSound")] public SoundSpecifier ActivateSound { get; set; } = new SoundPathSpecifier("/Audio/Weapons/ebladeon.ogg"); [DataField("deActivateSound")] public SoundSpecifier DeActivateSound { get; set; } = new SoundPathSpecifier("/Audio/Weapons/ebladeoff.ogg"); [DataField("colorOptions")] public List<Color> ColorOptions = new() { Color.Tomato, Color.DodgerBlue, Color.Aqua, Color.MediumSpringGreen, Color.MediumOrchid }; [DataField("litDamageBonus", required: true)] public DamageSpecifier LitDamageBonus = default!; } }
32.463415
117
0.673929
[ "MIT" ]
Nousagi37/space-station-14
Content.Server/Weapon/Melee/EnergySword/Components/EnergySwordComponent.cs
1,331
C#
using System; using System.Collections.Generic; using System.IO; using System.Windows.Forms; using System.Xml; using Mage; using MageDisplayLib; using System.Reflection; using MageFilePackager.Properties; using PRISM.Logging; namespace MageFilePackager { public partial class FilePackagerForm : Form { // Ignore Spelling: Mage private const string TagJobIDs = "Job_ID_List"; private const string TagJobIDsFromDatasets = "Jobs_From_Dataset_List"; private const string TagDatasetList = "Datasets"; private const string TagDatasetIDList = "Dataset_List"; private const string TagDataPackageID = "Data_Package"; private const string TagDataPackageDsIDs = "Data_Package_Datasets"; private const string TagDataPackageDetails = "Data_Package_Details"; private const string FileListLabelPrefix = "Files From "; // Current Mage pipeline that is running or has most recently run private ProcessingPipeline _mCurrentPipeline; // Current command that is being executed or has most recently been executed private MageCommandEventArgs _mCurrentCmd; // Object that sent the current command private object _mCurrentCmdSender; /// <summary> /// Constructor /// </summary> public FilePackagerForm() { _mCurrentCmdSender = null; _mCurrentCmd = null; _mCurrentPipeline = null; InitializeComponent(); SetFormTitle(); SetTags(); SetAboutText(); // These settings are loaded from file MageConcatenator.exe.config // Typically gigasax and DMS5 Globals.DMSServer = Settings.Default.DMSServer; Globals.DMSDatabase = Settings.Default.DMSDatabase; txtServer.Text = "DMS Server: " + Globals.DMSServer; ModuleDiscovery.DMSServerOverride = Globals.DMSServer; ModuleDiscovery.DMSDatabaseOverride = Globals.DMSDatabase; try { // Set up configuration directory and files SavedState.SetupConfigFiles("MageFilePackager"); } catch (Exception ex) { MessageBox.Show("Error loading settings: " + ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } // These settings are loaded from file MageFilePackager.exe.config // Typically gigasax and DMS5 Globals.DMSServer = Settings.Default.DMSServer; Globals.DMSDatabase = Settings.Default.DMSDatabase; ModuleDiscovery.DMSServerOverride = Globals.DMSServer; ModuleDiscovery.DMSDatabaseOverride = Globals.DMSDatabase; try { // Configure logging var logFilePath = Path.Combine(SavedState.DataDirectory, "log.txt"); const bool appendDateToBaseName = false; FileLogger.ChangeLogFileBaseName(logFilePath, appendDateToBaseName); FileLogger.WriteLog(BaseLogger.LogLevels.INFO, "Starting MageFilePackager"); } catch (Exception ex) { MessageBox.Show("Error instantiating trace log: " + ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } // Setup UI component panels SetupStatusPanel(); SetupCommandHandler(); filePackageMgmtPanel1.FileSourceList = FileListDisplayControl; filePackageMgmtPanel1.FileListLabelPrefix = FileListLabelPrefix; // Setup context menus for list displays // ReSharper disable once ObjectCreationAsStatement new GridViewDisplayActions(JobListDisplayControl); // ReSharper disable once ObjectCreationAsStatement new GridViewDisplayActions(FileListDisplayControl); // Connect click events lblAboutLink.LinkClicked += LblAboutLinkLinkClicked; // Connect callbacks for UI panels //-- FileProcessingPanel1.GetSelectedFileInfo += GetSelectedFileItem; //-- FileProcessingPanel1.GetSelectedOutputInfo += GetSelectedOutputItem; SetupFlexQueryPanels(); // Must be done before restoring saved state try { // Restore settings to UI component panels SavedState.RestoreSavedPanelParameters(PanelSupport.GetParameterPanelList(this)); } catch (Exception ex) { MessageBox.Show("Error restoring saved settings; will auto-delete SavedState.xml. Message details: " + ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); // Delete the SavedState.xml file try { File.Delete(SavedState.FilePath); } catch (Exception ex2) { // Ignore errors here Console.WriteLine("Error deleting SavedState file: " + ex2.Message); } } AdjustInitialUIState(); } private void SetAboutText() { txtAbout1.Text = "Mage File packager can build download package manifests by searching for files from DMS datasets, analysis jobs, and data packages."; txtAbout2.Text = "Written by Gary Kiebel in 2012 for the Department of Energy (PNNL, Richland, WA)"; lblAboutLink.Text = "http://prismwiki.pnl.gov/wiki/Mage_Suite"; } private void SetFormTitle() { var objVersion = Assembly.GetExecutingAssembly().GetName().Version; var version = string.Format("{0}.{1}.{2}", objVersion.Major, objVersion.Minor, objVersion.Build); txtVersion.Text = string.Format("Version {0} ({1})", version, Globals.PROGRAM_DATE_SHORT); } /// <summary> /// Set labeling for UI panels /// </summary> private void SetTags() { JobListTabPage.Tag = TagJobIDs; JobsFromDatasetIDTabPage.Tag = TagJobIDsFromDatasets; DatasetTabPage.Tag = TagDatasetList; DatasetIDTabPage.Tag = TagDatasetIDList; DataPackageJobsTabPage.Tag = TagDataPackageID; DataPackageDatasetsTabPage.Tag = TagDataPackageDsIDs; DataPackageDetailsTabPage.Tag = TagDataPackageDetails; } // Command Processing /// <summary> /// Execute a command by building and running the appropriate pipeline /// (alternatively, cancel a running pipeline) /// </summary> /// <param name="sender">(ignored)</param> /// <param name="command">Command to execute</param> // ReSharper disable once UnusedMember.Global public void DoCommand(object sender, MageCommandEventArgs command) { // Remember who sent us the command _mCurrentCmdSender = sender; // ReSharper disable once ConvertIfStatementToSwitchStatement if (command.Action == "display_reloaded") { _mCurrentCmd = command; AdjustPostCommandUIState(null); return; } // Cancel the currently running pipeline if (command.Action == "cancel_operation" && _mCurrentPipeline?.Running == true) { _mCurrentPipeline.Cancel(); return; } // Don't allow another pipeline if one is currently running if (_mCurrentPipeline?.Running == true) { MessageBox.Show("Pipeline is already active", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } // Construct suitable Mage pipeline for the given command // and run that pipeline BuildAndRunPipeline(command); } /// <summary> /// Construct and run a Mage pipeline for the given command /// </summary> /// <param name="command"></param> private void BuildAndRunPipeline(MageCommandEventArgs command) { var mode = (command.Mode == "selected") ? DisplaySourceMode.Selected : DisplaySourceMode.All; try { // Build and run the pipeline appropriate to the command ISinkModule sink; string queryDefXML; switch (command.Action) { case "get_entities_from_query": queryDefXML = GetQueryDefinition(out var queryName); if (string.IsNullOrEmpty(queryDefXML)) { MessageBox.Show("Unknown query type '" + queryName + "'. Your QueryDefinitions.xml file is out-of-date", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } var queryParameters = GetRuntimeParamsForEntityQuery(); if (!ValidQueryParameters(queryName, queryParameters)) { return; } sink = JobListDisplayControl.MakeSink(command.Mode); _mCurrentPipeline = Pipelines.MakeJobQueryPipeline(sink, queryDefXML, queryParameters); break; case "get_entities_from_flex_query": queryDefXML = ModuleDiscovery.GetQueryXMLDef(command.Mode); var builder = JobFlexQueryPanel.GetSQLBuilder(queryDefXML); if (builder.HasPredicate) { var reader = new SQLReader(builder); sink = JobListDisplayControl.MakeSink("Jobs"); _mCurrentPipeline = ProcessingPipeline.Assemble("Get Jobs", reader, sink); } else { MessageBox.Show("You must define one or more search criteria before searching", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); _mCurrentPipeline = null; return; } break; case "get_files_from_entities": var entityType = JobListDisplayControl.PageTitle; var runtimeParams = GetRuntimeParamsForEntityFileType(entityType); var source = new GVPipelineSource(JobListDisplayControl, mode); sink = FileListDisplayControl.MakeSink("Files"); _mCurrentPipeline = Pipelines.MakeFileListPipeline(source, sink, runtimeParams); break; default: return; } if (_mCurrentPipeline != null) { _mCurrentCmd = command; // Clear any warnings statusPanel1.ClearWarnings(); _mCurrentPipeline.OnStatusMessageUpdated += statusPanel1.HandleStatusMessageUpdated; _mCurrentPipeline.OnWarningMessageUpdated += statusPanel1.HandleWarningMessageUpdated; _mCurrentPipeline.OnRunCompleted += statusPanel1.HandleCompletionMessageUpdate; _mCurrentPipeline.OnRunCompleted += HandlePipelineCompletion; EnableCancel(true); _mCurrentPipeline.Run(); } } catch (Exception e) { MessageBox.Show(e.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } } private bool ValidQueryParameters(string queryName, Dictionary<string, string> queryParameters) { var msg = string.Empty; var filterDefined = false; // ReSharper disable LoopCanBeConvertedToQuery foreach (var entry in queryParameters) { // ReSharper restore LoopCanBeConvertedToQuery if (!string.IsNullOrEmpty(entry.Key) && !string.IsNullOrEmpty(entry.Value)) { if (entry.Value.Trim().Length > 0) { filterDefined = true; break; } } } if (!filterDefined) { msg = queryName switch { TagJobIDs => "Job ID list cannot be empty", TagJobIDsFromDatasets => "Dataset list cannot be empty", TagDatasetIDList => "Dataset ID list cannot be empty", TagDataPackageID or TagDataPackageDsIDs => "Please enter a data package ID", TagDataPackageDetails => "Please enter one or more data package IDs", _ => "You must define one or more search criteria before searching for jobs", }; } // FUTURE: validation for TagDataPackageDetails?? if (string.IsNullOrEmpty(msg) && (queryName == TagJobIDs || queryName == TagJobIDsFromDatasets || queryName == TagDatasetIDList)) { var cSepChars = new[] { ',', '\t' }; var sWarning = queryName == TagJobIDs ? "Job number '" : "Use dataset IDs, not dataset names: '"; // Validate that the job numbers or dataset IDs are all numeric foreach (var entry in queryParameters) { var sValue = entry.Value.Replace(Environment.NewLine, ","); var values = sValue.Split(cSepChars); foreach (var datasetID in values) { if (!int.TryParse(datasetID, out _)) { msg = sWarning + datasetID + "' is not numeric"; break; } } if (!string.IsNullOrEmpty(msg)) break; } } if (string.IsNullOrEmpty(msg)) return true; MessageBox.Show(msg, "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return false; } // Methods for setting UI state /// <summary> /// Set initial conditions for display components /// </summary> private void AdjustInitialUIState() { // Initial labels for display list control panels JobListDisplayControl.PageTitle = "Entities"; FileListDisplayControl.PageTitle = "Files"; JobDatasetIDList1.Legend = "(Dataset IDs)"; JobDatasetIDList1.ListName = "Dataset_ID"; // Disable certain UI component panels EntityFilePanel1.Enabled = false; EnableCancel(false); } /// <summary> /// Enable/Disable the cancel button /// </summary> /// <param name="enabled"></param> private void EnableCancel(bool enabled) { statusPanel1.ShowCancel = enabled; statusPanel1.EnableCancel = enabled; } /// <summary> /// Adjust the labeling and status of various UI components /// (called when a command pipeline completes via cross-thread invoke from HandleStatusMessageUpdated) /// </summary> /// <param name="status"></param> private void AdjustPostCommandUIState(object status) { if (_mCurrentCmd == null) return; EnableCancel(false); AdjustEntityFileTabLabels(); AdjustListDisplayTitleFromColumnDefs(); AdjustFileListLabels(); AdjustFileExtractionPanel(); AdjustFileProcessingPanels(); SavedState.SaveParameters(PanelSupport.GetParameterPanelList(this)); } /// <summary> /// Processing files is only possible when file list contains files, /// adjust the processing panels to inform user /// </summary> private void AdjustFileProcessingPanels() { //-- FileCopyPanel1.Enabled = FileListDisplayControl.ItemCount != 0; } /// <summary> /// Finding files for entities is only possible /// when there are entities in the entity list /// </summary> private void AdjustFileExtractionPanel() { var entityCount = JobListDisplayControl.ItemCount; EntityFilePanel1.Enabled = entityCount != 0; } /// <summary> /// Since the list of files can be derived from different sources, /// adjust the labeling to inform the user about which one was used /// </summary> private void AdjustFileListLabels() { switch (_mCurrentCmd.Action) { case "get_files_from_entities": FileListDisplayControl.PageTitle = FileListLabelPrefix + JobListDisplayControl.PageTitle; // FileCopyPanel1.ApplyPrefixToFileName = "Yes"; //-- FileCopyPanel1.PrefixColumnName = GetBestPrefixIDColumnName(FileListDisplayControl.ColumnDefs); break; /* case "get_files_from_local_directory": FileListDisplayControl.PageTitle = FileListLabelPrefix + "Local Directory"; break; case "get_files_from_local_manifest": FileListDisplayControl.PageTitle = FileListLabelPrefix + "Manifest"; break; */ } } /// <summary> /// Adjust tab label for file source actions according to entity type /// </summary> private void AdjustEntityFileTabLabels() { switch (_mCurrentCmd.Action) { case "get_entities_from_query": GetEntityFilesTabPage.Text = string.Format("Get Files From {0}", JobListDisplayControl.PageTitle); break; } } /// <summary> /// If the contents of a list display have been restored from file, /// make a guess at the type of information it contains /// according to the combination of columns it has, /// and set its title accordingly /// </summary> private void AdjustListDisplayTitleFromColumnDefs() { if (_mCurrentCmd.Action == "reload_list_display" || _mCurrentCmd.Action == "display_reloaded") { if (_mCurrentCmdSender is IMageDisplayControl ldc) { var type = ldc.PageTitle; var colNames = ldc.ColumnNames; if (colNames.Contains("Item")) { type = "Files"; } else if (colNames.Contains("Job")) { type = "Jobs"; } else if (colNames.Contains("Dataset_ID")) { type = "Datasets"; } ldc.PageTitle = type; } } } /// <summary> /// Control enable state of filter panel based on output tab choice /// </summary> private void EnableDisableOutputTabs() { // string mode = FilterOutputTabs.SelectedTab.Tag.ToString(); // if (mode == "Copy_Files") { // FileProcessingPanel1.Enabled = false; // } else { // if (FolderDestinationPanel1.Enabled || SQLiteDestinationPanel1.Enabled) { // FileProcessingPanel1.Enabled = true; // } // } } // Support methods for building runtime parameter lists from component panels /// <summary> /// Get XML definition for query with given name /// from external XML query definition file /// </summary> /// <param name="queryName"></param> private string GetQueryDefinition(out string queryName) { // Note: Tab page tag field contains name of query to look up in query def file Control queryPage = EntityListSourceTabs.SelectedTab; queryName = queryPage.Tag.ToString(); // Get XML query definitions from bin copy of file // not the one in AppData var doc = new XmlDocument(); doc.Load("QueryDefinitions.xml"); // Find query node by name var xpath = string.Format(".//query[@name='{0}']", queryName); var queryNode = doc.SelectSingleNode(xpath); return queryNode?.OuterXml ?? string.Empty; //-- return ModuleDiscovery.GetQueryXMLDef(queryName); } private Dictionary<string, string> GetRuntimeParamsForEntityQuery() { Control queryPage = EntityListSourceTabs.SelectedTab; var panel = PanelSupport.GetParameterPanel(queryPage); return panel.GetParameters(); } private Dictionary<string, string> GetRuntimeParamsForEntityFileType(string entityType) { var runtimeParams = new Dictionary<string, string> { {"FileSelectors", EntityFilePanel1.FileSelectors}, {"FileSelectionMode", EntityFilePanel1.FileSelectionMode}, {"IncludeFilesOrDirectories", EntityFilePanel1.IncludeFilesOrDirectories}, {"SearchInSubdirectories", EntityFilePanel1.SearchInSubdirectories}, {"SubdirectorySearchName", EntityFilePanel1.SubdirectorySearchName}, {"SourceDirectoryColumnName", "Directory"}, {"FileColumnName", "Name"} }; switch (entityType) { case "Jobs": runtimeParams.Add("OutputColumnList", "Item|+|text, Name|+|text, " + FileListInfoBase.COLUMN_NAME_FILE_SIZE + "|+|text, " + FileListInfoBase.COLUMN_NAME_FILE_DATE + "|+|text, Directory, Job, Dataset, Dataset_ID, Tool, Settings_File, Parameter_File, Instrument, Storage_Path, Purged, Archive_Path"); break; case "Datasets": runtimeParams.Add("OutputColumnList", "Item|+|text, Name|+|text, " + FileListInfoBase.COLUMN_NAME_FILE_SIZE + "|+|text, " + FileListInfoBase.COLUMN_NAME_FILE_DATE + "|+|text, Directory, Dataset, Dataset_ID, State, Instrument, Type, Storage_Path, Purged, Archive_Path"); break; default: runtimeParams.Add("OutputColumnList", "Item|+|text, Name|+|text, " + FileListInfoBase.COLUMN_NAME_FILE_SIZE + "|+|text, " + FileListInfoBase.COLUMN_NAME_FILE_DATE + "|+|text, Directory, *"); break; } return runtimeParams; } // Methods for handling status updates private delegate void CompletionStateUpdated(object status); private delegate void VoidFnDelegate(); /// <summary> /// Handle updating control enable status on completion of running pipeline /// </summary> /// <param name="sender">(ignored)</param> /// <param name="args">Contains status information to be displayed</param> private void HandlePipelineCompletion(object sender, MageStatusEventArgs args) { CompletionStateUpdated csu = AdjustPostCommandUIState; Invoke(csu, new object[] { null }); if (args.Message.StartsWith(SQLReader.SQL_COMMAND_ERROR)) MessageBox.Show(args.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); // Must use a delegate and Invoke to avoid "cross-thread operation not valid" exceptions VoidFnDelegate et = EnableDisableOutputTabs; Invoke(et); } private void LblAboutLinkLinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { try { LaunchMageFileProcessorHelpPage(); } catch (Exception ex) { MessageBox.Show("Unable to open link that was clicked: " + ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } } private void LaunchMageFileProcessorHelpPage() { // Change the color of the link text by setting LinkVisited // to true. lblAboutLink.LinkVisited = true; // Call the Process.Start method to open the default browser // with a URL: System.Diagnostics.Process.Start(lblAboutLink.Text); } // Panel Support Methods /// <summary> /// Set up status panel /// </summary> private void SetupStatusPanel() { statusPanel1.OwnerControl = this; } /// <summary> /// Wire up the command event in panels that have it /// to the DoCommand event handler method /// </summary> private void SetupCommandHandler() { // Get reference to the method that handles command events var methodInfo = GetType().GetMethod("DoCommand"); Control subjectControl = this; PanelSupport.DiscoverAndConnectCommandHandlers(subjectControl, methodInfo); } /// <summary> /// Initialize parameters for flex query panels /// </summary> private void SetupFlexQueryPanels() { JobFlexQueryPanel.QueryName = "Job_Flex_Query"; JobFlexQueryPanel.SetColumnPickList(new[] { "Job", "State", "Dataset", "Dataset_ID", "Tool", "Parameter_File", "Settings_File", "Instrument", "Experiment", "Campaign", "Organism", "Organism DB", "Protein Collection List", "Protein Options", "Comment", "Results Folder", "Folder", "Dataset_Created", "Job_Finish", "Request_ID" }); JobFlexQueryPanel.SetComparisionPickList(new[] { "ContainsText", "DoesNotContainText", "StartsWithText", "MatchesText", "MatchesTextOrBlank", "Equals", "NotEqual", "GreaterThan", "GreaterThanOrEqualTo", "LessThan", "LessThanOrEqualTo", "MostRecentWeeks", "LaterThan", "EarlierThan", "InList" }); } // Callback methods for UI Panel Use } }
42.774194
342
0.547044
[ "BSD-2-Clause" ]
PNNL-Comp-Mass-Spec/Mage
MageFilePackager/FilePackagerForm.cs
27,848
C#
namespace moe.yo3explorer.azusa.MediaLibrary.Boundary { partial class MediaPickerForm { /// <summary> /// Required designer variable. /// </summary> private System.ComponentModel.IContainer components = null; /// <summary> /// Clean up any resources being used. /// </summary> /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param> protected override void Dispose(bool disposing) { if (disposing && (components != null)) { components.Dispose(); } base.Dispose(disposing); } #region Windows Form Designer generated code /// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel(); this.label3 = new System.Windows.Forms.Label(); this.label2 = new System.Windows.Forms.Label(); this.shelfSelector1 = new moe.yo3explorer.azusa.MediaLibrary.Control.ShelfSelector(); this.label1 = new System.Windows.Forms.Label(); this.productComboBox = new System.Windows.Forms.ComboBox(); this.productAddButton = new System.Windows.Forms.Button(); this.addMediaButton = new System.Windows.Forms.Button(); this.mediaComboBox = new System.Windows.Forms.ComboBox(); this.confirm = new System.Windows.Forms.Button(); this.tableLayoutPanel1.SuspendLayout(); this.SuspendLayout(); // // tableLayoutPanel1 // this.tableLayoutPanel1.ColumnCount = 3; this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 100F)); this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F)); this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 32F)); this.tableLayoutPanel1.Controls.Add(this.label3, 0, 2); this.tableLayoutPanel1.Controls.Add(this.label2, 0, 1); this.tableLayoutPanel1.Controls.Add(this.shelfSelector1, 1, 0); this.tableLayoutPanel1.Controls.Add(this.label1, 0, 0); this.tableLayoutPanel1.Controls.Add(this.productComboBox, 1, 1); this.tableLayoutPanel1.Controls.Add(this.productAddButton, 2, 1); this.tableLayoutPanel1.Controls.Add(this.addMediaButton, 2, 2); this.tableLayoutPanel1.Controls.Add(this.mediaComboBox, 1, 2); this.tableLayoutPanel1.Controls.Add(this.confirm, 2, 3); this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill; this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 0); this.tableLayoutPanel1.Name = "tableLayoutPanel1"; this.tableLayoutPanel1.RowCount = 4; this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 32F)); this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 32F)); this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 32F)); this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 32F)); this.tableLayoutPanel1.Size = new System.Drawing.Size(318, 126); this.tableLayoutPanel1.TabIndex = 0; // // label3 // this.label3.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.label3.AutoSize = true; this.label3.Location = new System.Drawing.Point(53, 64); this.label3.Name = "label3"; this.label3.Size = new System.Drawing.Size(44, 13); this.label3.TabIndex = 4; this.label3.Text = "Medium"; // // label2 // this.label2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.label2.AutoSize = true; this.label2.Location = new System.Drawing.Point(50, 32); this.label2.Name = "label2"; this.label2.Size = new System.Drawing.Size(47, 13); this.label2.TabIndex = 2; this.label2.Text = "Produkt:"; // // shelfSelector1 // this.shelfSelector1.Location = new System.Drawing.Point(103, 3); this.shelfSelector1.Name = "shelfSelector1"; this.shelfSelector1.SelectedIndex = 0; this.shelfSelector1.Size = new System.Drawing.Size(175, 22); this.shelfSelector1.TabIndex = 0; // // label1 // this.label1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.label1.AutoSize = true; this.label1.Location = new System.Drawing.Point(59, 0); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(38, 13); this.label1.TabIndex = 1; this.label1.Text = "Regal:"; // // productComboBox // this.productComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.productComboBox.Enabled = false; this.productComboBox.FormattingEnabled = true; this.productComboBox.Location = new System.Drawing.Point(103, 35); this.productComboBox.Name = "productComboBox"; this.productComboBox.Size = new System.Drawing.Size(175, 21); this.productComboBox.TabIndex = 3; this.productComboBox.SelectedValueChanged += new System.EventHandler(this.productComboBox_SelectedValueChanged); // // productAddButton // this.productAddButton.Enabled = false; this.productAddButton.Image = global::moe.yo3explorer.azusa.Properties.Resources.add; this.productAddButton.Location = new System.Drawing.Point(289, 35); this.productAddButton.Name = "productAddButton"; this.productAddButton.Size = new System.Drawing.Size(26, 23); this.productAddButton.TabIndex = 5; this.productAddButton.UseVisualStyleBackColor = true; this.productAddButton.Click += new System.EventHandler(this.productAddButton_Click); // // addMediaButton // this.addMediaButton.Enabled = false; this.addMediaButton.Image = global::moe.yo3explorer.azusa.Properties.Resources.add; this.addMediaButton.Location = new System.Drawing.Point(289, 67); this.addMediaButton.Name = "addMediaButton"; this.addMediaButton.Size = new System.Drawing.Size(26, 23); this.addMediaButton.TabIndex = 6; this.addMediaButton.UseVisualStyleBackColor = true; // // mediaComboBox // this.mediaComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.mediaComboBox.Enabled = false; this.mediaComboBox.FormattingEnabled = true; this.mediaComboBox.Location = new System.Drawing.Point(103, 67); this.mediaComboBox.Name = "mediaComboBox"; this.mediaComboBox.Size = new System.Drawing.Size(175, 21); this.mediaComboBox.TabIndex = 7; this.mediaComboBox.SelectedIndexChanged += new System.EventHandler(this.mediaComboBox_SelectedIndexChanged); // // confirm // this.confirm.Enabled = false; this.confirm.Image = global::moe.yo3explorer.azusa.Properties.Resources.accept; this.confirm.Location = new System.Drawing.Point(289, 99); this.confirm.Name = "confirm"; this.confirm.Size = new System.Drawing.Size(26, 23); this.confirm.TabIndex = 8; this.confirm.UseVisualStyleBackColor = true; this.confirm.Click += new System.EventHandler(this.confirm_Click); // // MediaPickerForm // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(318, 126); this.Controls.Add(this.tableLayoutPanel1); this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow; this.MaximizeBox = false; this.MinimizeBox = false; this.Name = "MediaPickerForm"; this.Text = "MediaPickerForm"; this.tableLayoutPanel1.ResumeLayout(false); this.tableLayoutPanel1.PerformLayout(); this.ResumeLayout(false); } #endregion private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1; private System.Windows.Forms.Label label2; private Control.ShelfSelector shelfSelector1; private System.Windows.Forms.Label label1; private System.Windows.Forms.ComboBox productComboBox; private System.Windows.Forms.Label label3; private System.Windows.Forms.Button productAddButton; private System.Windows.Forms.Button addMediaButton; private System.Windows.Forms.ComboBox mediaComboBox; private System.Windows.Forms.Button confirm; } }
52.401042
154
0.629361
[ "BSD-2-Clause" ]
feyris-tan/azusa
AzusaERP/MediaLibrary/Boundary/MediaPickerForm.Designer.cs
10,063
C#
using System.Collections.Generic; using System.Text.RegularExpressions; using Rant.Stringes; using Rant.Stringes.Tokens; namespace Rant.Compiler { internal static class RantLexer { private const RegexOptions DefaultOptions = RegexOptions.Compiled | RegexOptions.ExplicitCapture; public static readonly Regex EscapeRegex = new Regex(@"\\((?<count>\d+((\.\d+)?[kMB])?),)?((?<code>[^u\s\r\n])|u(?<unicode>[0-9a-f]{4}))", DefaultOptions); public static readonly Regex RegexRegex = new Regex(@"//(.*?[^\\])?//i?", DefaultOptions); private static readonly Regex WeightRegex = new Regex(@"\*[ ]*(?<value>\d+(\.\d+)?)[ ]*\*", DefaultOptions); private static readonly Regex WhitespaceRegex = new Regex(@"\s+", DefaultOptions); private static readonly Regex BlackspaceRegex = new Regex(@"(^\s+|\s*[\r\n]+\s*|\s+$)", DefaultOptions | RegexOptions.Multiline); private static readonly Regex CommentRegex = new Regex(@"\s*#.*?(?=[\r\n]|$)", DefaultOptions | RegexOptions.Multiline); private static readonly Regex ConstantLiteralRegex = new Regex(@"""([^""]|"""")*""", DefaultOptions); internal static readonly LexerRules<R> Rules; private static Stringe TruncatePadding(Stringe input) { var ls = input.LeftPadded ? input.TrimStart() : input; return ls.RightPadded ? ls.TrimEnd() : ls; } static RantLexer() { Rules = new LexerRules<R> { {EscapeRegex, R.EscapeSequence}, {RegexRegex, R.Regex}, {ConstantLiteralRegex, R.ConstantLiteral}, {"[", R.LeftSquare}, {"]", R.RightSquare}, {"{", R.LeftCurly}, {"}", R.RightCurly}, {"(", R.LeftParen}, {")", R.RightParen}, {"<", R.LeftAngle}, {">", R.RightAngle}, {"|", R.Pipe}, {";", R.Semicolon}, {":", R.Colon}, {"@", R.At}, {"?", R.Question}, {"::", R.DoubleColon}, {"?!", R.Without}, {"-", R.Hyphen}, {"!", R.Exclamation}, {"$", R.Dollar}, {"=", R.Equal}, {"&", R.Ampersand}, {"%", R.Percent}, {"+", R.Plus}, {"^", R.Caret}, {WeightRegex, R.Weight}, {CommentRegex, R.Ignore, 3}, {BlackspaceRegex, R.Ignore, 2}, {WhitespaceRegex, R.Whitespace} }; Rules.AddUndefinedCaptureRule(R.Text, TruncatePadding); Rules.AddEndToken(R.EOF); Rules.IgnoreRules.Add(R.Ignore); } public static IEnumerable<Token<R>> GenerateTokens(string input) { var reader = new StringeReader(input); while (!reader.EndOfStringe) { yield return reader.ReadToken(Rules); } } } }
40.716216
163
0.511118
[ "MIT" ]
esaul/Rant
Rant/Engine/Compiler/RantLexer.cs
3,015
C#
// Copyright(c).NET Foundation and contributors. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. using System; using System.Text.Json.Serialization; namespace Microsoft.DotNet.Interactive.Formatting { public class TableSchemaFieldDescriptor { public TableSchemaFieldDescriptor(string name, TableSchemaFieldType? type = TableSchemaFieldType.Null, string description = null, string format= null) { if (string.IsNullOrWhiteSpace(name)) { throw new ArgumentException("Value cannot be null or whitespace.", nameof(name)); } Name = name; Description = description; Format = format; Type = type?? TableSchemaFieldType.Null; } [JsonPropertyName("name")] public string Name { get; } [JsonPropertyName("description"), JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] public string Description { get; } [JsonPropertyName("format"), JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] public string Format { get; } [JsonPropertyName( "type")] public TableSchemaFieldType Type { get; } } }
34.783784
158
0.665113
[ "MIT" ]
WhiteBlackGoose/interactive
src/Microsoft.DotNet.Interactive.Formatting/TableSchemaFieldDescriptor.cs
1,289
C#
using System; using System.Collections.Generic; using Domain.Model; using Domain.Repository.User; namespace Domain.Service.User { public class UserService : ServiceBase, IUserService { private readonly IUserRepository repository; /// <summary> /// コンストラクタ /// </summary> /// <param name="repository">ユーザーリポジトリ</param> public UserService(IUserRepository repository) { this.repository = repository; } /// <summary> /// ログイン /// </summary> /// <param name="userID">ユーザー名</param> /// <param name="password">パスワード</param> /// <returns></returns> public UserModel Login(string userID, string password) { return repository.Login(userID, password); } /// <summary> /// ユーザーリストを取得する /// </summary> /// <param name="searchCondition">検索条件</param> /// <returns>ユーザーリスト</returns> public List<UserModel> GetAllUsers(UserSearchCondition searchCondition) { return repository.GetAllUsers(searchCondition); } /// <summary> /// 検索結果のページ総数を取得する /// </summary> /// <param name="searchCondition">検索条件</param> /// <returns>ページ総数</returns> public int GetPageCount(UserSearchCondition searchCondition) { return getTotalPageCount(repository.GetRecordCount(searchCondition)); } /// <summary> /// ユーザーのページ分を取得する /// </summary> /// <param name="searchCondition">検索条件</param> /// <returns>ユーザーのリスト</returns> public List<UserModel> GetUsers(UserSearchCondition searchCondition) { return repository.GetUsers(searchCondition, PageCount); } /// <summary> /// ユーザーを取得する /// </summary> /// <param name="userID">ユーザー名</param> /// <returns>ユーザー情報(検索できない場合はnull)</returns> public UserModel Find(string userID) { return repository.Find(userID); } /// <summary> /// ユーザーの保存 /// </summary> /// <param name="passwordHash">パスワードハッシュ</param> /// <param name="entryDate">登録日時(未設定時null)</param> /// <returns>成否</returns> public UpdateResult Save(UserModel userData, string loginUserId, string passwordHash, DateTime? entryDate = null) { var result = UpdateResult.Error; // トランザクション作成 repository.BeginTransaction(); // 処理実行 var dbResult = false; var latestData = Find(userData.UserID); if(latestData == null) { if(entryDate.HasValue) { dbResult = repository.Append(userData, loginUserId, passwordHash, entryDate.Value); } } else { result = UpdateResult.ErrorVaersion; if(userData.EqualsVersion(latestData.ModifyVersion)){ dbResult = repository.Modify(userData, loginUserId, passwordHash); } } // コミットまたはロールバック if (dbResult) { repository.Commit(); result = UpdateResult.OK; } else { repository.Rollback(); } return result; } /// <summary> /// パスワード変更 /// </summary> /// <param name="userID">ユーザーID</param> /// <param name="password">現在のパスワード</param> /// <param name="newPassword">新しいパスワード</param> /// <returns>成否</returns> public UpdateResult ChangePassword(string userID, string password, string newPassword) { var result = UpdateResult.Error; // トランザクション作成 repository.BeginTransaction(); // 処理実行 var dbResult = repository.ChangePassword(userID, password, newPassword); // コミットまたはロールバック if (dbResult) { repository.Commit(); result = UpdateResult.OK; } else { repository.Rollback(); } return result; } } }
25.033784
117
0.609717
[ "MIT" ]
kazenetu/ASPdotNETCoreTest
Domain/Service/User/UserService.cs
4,187
C#
/* Copyright © Bryan Apellanes 2015 */ using System; using System.Collections.Generic; using System.Linq; using System.Linq.Expressions; using System.Text; using System.Threading.Tasks; using Bam.Net.Data; using Bam.Net; using Bam.Net.ExceptionHandling; using Bam.Net.Analytics; namespace Bam.Net.Analytics.Classification { public abstract class Classifier { public Classifier() { } /// <summary> /// When implemented, should return the probablity that the specified /// document is in the specified category /// </summary> /// <param name="documentString"></param> /// <param name="category"></param> /// <returns></returns> public abstract float Probability(string documentString, string category); public abstract string Classify(string documentString, string defaultCategory = "None"); IFeatureExtractor _featureExtractor; object _featureExtractorLock = new object(); public IFeatureExtractor FeatureExtractor { get { return _featureExtractorLock.DoubleCheckLock(ref _featureExtractor, () => new WordFeatureExtractor()); } set { _featureExtractor = value; } } /// <summary> /// Train the classifier assigning the specified doc to the /// specified category /// </summary> /// <param name="doc"></param> /// <param name="category"></param> public void Train(string doc, string category) { string[] features = ExtractFeatures(doc); for (int i = 0; i < features.Length; i++) { IncreaseFeature(features[i], category); } IncreaseCategory(category); } public float WeightedProbability(string feature, string category, float weight = 1, float assumedProbablity = 0.5F) { return WeightedProbability(feature, category, FeatureProbability, weight, assumedProbablity); } public float WeightedProbability(string feature, string category, Func<string, string, float> featureProbability, float weight = 1, float assumedProbablity = 0.5F) { float basicProb = featureProbability(feature, category); long featureCountInAllCategories = 0; Categories().Each(cat => { featureCountInAllCategories += FeatureCount(feature, cat); }); float weighted = ((weight*assumedProbablity)+(featureCountInAllCategories*basicProb))/(weight+featureCountInAllCategories); return weighted; } public virtual float FeatureProbability(string feature, string category) { long categorycount = DocumentsInCategoryCount(category); float result = 0; if (categorycount > 0) { long featureCount = FeatureCount(feature, category); long categoryCount = DocumentsInCategoryCount(category); if (featureCount > 0 && categoryCount > 0) { result = featureCount / categoryCount; } } return result; } public string[] Categories() { CategoryCollection all = Category.Where(c => c.Id != Dao.Null); return all.Select(c => c.Value).ToArray(); } /// <summary> /// Total number of documents (corresponds to totalcount in Collective Intelligence chapter 6) /// </summary> /// <returns></returns> public long DocumentCount() { CategoryCollection all = Category.Where(c => c.Id != Dao.Null); return (long)all.Select(c => c.DocumentCount).Sum(); } /// <summary> /// Total number of documents in a category (corresponds to catcount in Collective Intelligence chapter 6) /// </summary> /// <param name="category"></param> /// <returns></returns> public long DocumentsInCategoryCount(string category) { Category cat = GetCategory(category); return (long)cat.DocumentCount; } /// <summary> /// Increase the count of a feature/category pair /// </summary> /// <param name="feature"></param> /// <param name="category"></param> public void IncreaseFeature(string feature, string category) { Feature fRec = GetFeature(feature, category); fRec.FeatureToCategoryCount++; fRec.Save(); } public void IncreaseCategory(string category) { Category cRec = GetCategory(category); cRec.DocumentCount++; cRec.Save(); } public long FeatureCount(string feature, string category) { Category cRec = GetCategory(category); return FeatureCount(feature, cRec); } public long FeatureCount(string feature, Category cat) { Feature rec = Feature.OneWhere(fc => fc.Value == feature && fc.CategoryId == cat.Id); long result = 0; if (rec != null) { result = (long)rec.FeatureToCategoryCount; } return result; } /// <summary> /// Get a Category entry for the specified category, creating it if necessary /// </summary> /// <param name="category"></param> /// <returns></returns> protected static Category GetCategory(string category) { Category c = Category.OneWhere(col => col.Value == category); if (c == null) { c = new Category { Value = category, DocumentCount = 0 }; c.Save(); } return c; } protected static Feature GetFeature(string feature, string category) { Category c = GetCategory(category); return GetFeature(feature, c); } protected static Feature GetFeature(string feature, Category cat) { Feature f = Feature.OneWhere(col => col.Value == feature && col.CategoryId == cat.Id); if (f == null) { f = new Feature { Value = feature, CategoryId = cat.Id, FeatureToCategoryCount = 0 }; f.Save(); } return f; } object _extractFeaturesLock = new object(); Func<string, string[]> _extractFeatures; /// <summary> /// The delegate used for extracting features from a /// given string. Default is ExtractWords. /// </summary> public Func<string, string[]> ExtractFeatures { get { return _extractFeaturesLock.DoubleCheckLock(ref _extractFeatures, () => FeatureExtractor.ExtractFeatures); } set { _extractFeatures = value; } } } }
32.290749
171
0.544065
[ "MIT" ]
BryanApellanes/bam.net.shared
Analytics/Classification/Classifier.cs
7,331
C#
// Copyright (c) Brock Allen & Dominick Baier. All rights reserved. // Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information. using System.Threading.Tasks; using IdentityServer4.Models; namespace IdentityServer4.Validation { /// <summary> /// Interface for the token validator /// </summary> public interface ITokenValidator { /// <summary> /// Validates an access token. /// </summary> /// <param name="token">The access token.</param> /// <param name="expectedScope">The expected scope.</param> /// <returns></returns> Task<TokenValidationResult> ValidateAccessTokenAsync(string token, string expectedScope = null); /// <summary> /// Validates an identity token. /// </summary> /// <param name="token">The token.</param> /// <param name="clientId">The client identifier.</param> /// <param name="validateLifetime">if set to <c>true</c> the lifetime gets validated. Otherwise not.</param> /// <returns></returns> Task<TokenValidationResult> ValidateIdentityTokenAsync(string token, string clientId = null, bool validateLifetime = true); } }
39
131
0.645032
[ "Apache-2.0" ]
10088/IdentityServer4
src/IdentityServer4/src/Validation/ITokenValidator.cs
1,250
C#
using System; using System.Collections.Generic; using Newtonsoft.Json; using Kanyon.Kubernetes; namespace Kanyon.Kubernetes.Autoscaling.V1 { public partial class HorizontalPodAutoscalerSpec { /** <summary>upper limit for the number of pods that can be set by the autoscaler; cannot be smaller than MinReplicas.</summary> */ public int maxReplicas { get; set; } /** <summary>minReplicas is the lower limit for the number of replicas to which the autoscaler can scale down. It defaults to 1 pod. minReplicas is allowed to be 0 if the alpha feature gate HPAScaleToZero is enabled and at least one Object or External metric is configured. Scaling is active as long as at least one metric value is available.</summary> */ public int minReplicas { get; set; } /** <summary>CrossVersionObjectReference contains enough information to let you identify the referred resource.</summary> */ public Autoscaling.V1.CrossVersionObjectReference scaleTargetRef { get; set; } /** <summary>target average CPU utilization (represented as a percentage of requested CPU) over all the pods; if not specified the default autoscaling policy will be used.</summary> */ public int targetCPUUtilizationPercentage { get; set; } } }
67.473684
366
0.74181
[ "MIT" ]
ermontgo/kapitan
src/Kanyon.Kubernetes/Autoscaling/V1/HorizontalPodAutoscalerSpec.generated.cs
1,282
C#
public static class Program { private static Game game = null; private static void Main() { game = new Game(); game.Run(); } }
17.444444
36
0.56051
[ "MIT" ]
witcherofthorns/GLFW-IMGUI
Program.cs
159
C#
using System; using System.Collections.Generic; namespace Algorithms.Core.Graphs { /// <summary> /// The <tt>DegreesOfSeparation</tt> class provides a client for finding /// the degree of separation between one distinguished individual and /// every other individual in a social network. /// As an example, if the social network consists of actors in which /// two actors are connected by a link if they appeared in the same movie, /// and Kevin Bacon is the distinguished individual, then the client /// computes the Kevin Bacon number of every actor in the network. /// <p> /// The running time is proportional to the number of individuals and /// connections in the network. If the connections are given implicitly, /// as in the movie network example (where every two actors are connected /// if they appear in the same movie), the efficiency of the algorithm /// is improved by allowing both movie and actor vertices and connecting /// each movie to all of the actors that appear in that movie. /// </p> /// </summary> public class DegreesOfSeparation { private readonly SymbolGraph _sg; private readonly Graph _g; private readonly string _source; public DegreesOfSeparation(IList<string> lines, char delimiter, string source) { _sg = new SymbolGraph(lines, delimiter); _g = _sg.G; _source = source; } public void Find(string sink) { var s = _sg.Index(_source); var bfs = new BreadthFirstPaths(_g, s); if (_sg.Contains(sink)) { var t = _sg.Index(sink); if (bfs.HasPathTo(t)) { foreach (int v in bfs.PathTo(t)) { Console.WriteLine($" {_sg.Name(v)}"); } } else { Console.WriteLine("Not connected"); } } else { Console.WriteLine(" Not in database."); } } } }
33.661538
86
0.562157
[ "MIT" ]
v-bessonov/Algorithms-NET
Algorithms.Core/Graphs/DegreesOfSeparation.cs
2,190
C#