How to use GenX class of B package

Best Nunit code snippet using B.GenX

BuildSE.cs

Source:BuildSE.cs Github

copy

Full Screen

...25        /// <param name="e"></param>26        private void GenAss_Click(object sender, EventArgs e)27        {28            NativeMethods.SetFocus(IntPtr.Zero);29            this.AssProductTextBox.Text = GenX.GetUpdate();30            this.AssTitleTextBox.Text = GenX.GenerateIdentifier(15);31            this.AssDescriptTextBox.Text = GenX.GenerateIdentifier(15);32            this.AssCompanyTextBox.Text = GenX.GetUpdate();33            this.AssCopyrightTextBox.Text = GenX.GenerateIdentifier(15);34            this.AssVerTextBox.Text = Convert.ToString($"{GenX.Next(10)}.{GenX.Next(10)}.{GenX.Next(10)}.{GenX.Next(10)}");35            this.AssFileVerTextBox.Text = Convert.ToString($"{GenX.Next(10)}.{GenX.Next(10)}.{GenX.Next(10)}.{GenX.Next(10)}");36            this.AssGuidTextBox.Text = Guid.NewGuid().ToString();37        }3839        /// <summary>40        /// Выбор иконки для билд файла41        /// </summary>42        /// <param name="sender"></param>43        /// <param name="e"></param>44        private void SelectIcon_Click(object sender, EventArgs e)45        {46            string result = string.Empty;47            using var Open = new OpenFileDialog48            {49                Title = Thread.CurrentThread.CurrentCulture.TwoLetterISOLanguageName.Equals("en", StringComparison.InvariantCultureIgnoreCase)
...

Full Screen

Full Screen

DeterminingDnaHealth.cs

Source:DeterminingDnaHealth.cs Github

copy

Full Screen

1using System;2using System.Collections.Generic;3using System.Linq;4using System.Text;5using System.Threading;6using System.Threading.Tasks;7using HackerRank.AhoCorasick;8namespace HackerRank9{10    public class DeterminingDnaHealth11    {12        //int GeneCount, string[] Genes, int[] Health, string[] FirstLast, int Start, int End13        public long[] GetHealth(FunctionData Data)14        {15            long[] result = new long[2];16            long[] sequenceScores = new long[Data.GeneDataList.Count];17            // loop the sequences18            //for (int genx = 0; genx <= Data.GeneDataList.Count - 1; genx++)19            Parallel.For(0, Data.GeneDataList.Count, genx => 20            {21                GeneData geneData = Data.GeneDataList[genx];22                string sequence = geneData.Sequence;23                long seqTotal = 0;24                //loop genes25                //for (int index = geneData.First; index <= geneData.Last; index++)26                int first = geneData.First;27                int last = geneData.Last;28                //var pres = Parallel.For(first, last, index =>29                for (int index = first; index <= last; index++)30                {31                    {32                        string gene = Data.Genes[index];33                        int position = sequence.IndexOf(gene, 0);34                        while (position >= 0)35                        {36                            seqTotal += Data.GenesHealth[gene][index];37                            position = sequence.IndexOf(gene, ++position);38                        }39                    }40                }41                sequenceScores[genx] = seqTotal;42            });43            result[0] = sequenceScores.Min();44            result[1] = sequenceScores.Max();45            return result;46        }47        public long[] GetHealthAC(FunctionData Data)48        {49            long[] result = new long[2];50            long[] sequenceScores = new long[Data.GeneDataList.Count];51            // loop the sequences52            //for (int genx = 0; genx <= Data.GeneDataList.Count - 1; genx++)53            Parallel.For(0, Data.GeneDataList.Count, genx =>54            {55                GeneData geneData = Data.GeneDataList[genx];56                string sequence = geneData.Sequence;57                string text = geneData.Sequence;// "hello, hello and welcome to this beautiful world!";58                Trie trie = new Trie();59                trie.Add(Data.Genes);60                trie.Build();61                Dictionary<string, int> matches = trie.FindString(text);62                foreach(KeyValuePair<string, int> match in matches)63                {64                    sequenceScores[genx] += Data.GenesHealth[match.Key].ElementAt(match.Value - 1).Value;65                }66                67            });68            result[0] = sequenceScores.Min();69            result[1] = sequenceScores.Max();70            return result;71        }72    }73    public class FunctionData74    {75        public FunctionData()76        {77            GeneDataList = new List<GeneData>();78            GenesHealth = new Dictionary<string, Dictionary<int, int>>();79        }80        public int GeneCount { get; set; }81        public Dictionary<string, Dictionary<int, int>> GenesHealth { get; set; }82        public string[] Genes { get; set; }83        public int[] Health { get; set; }84        public List<GeneData> GeneDataList { get; set; }85        public int MinFirst { get; set; }86        public int MaxLast { get; set; }87    }88    public class GeneData89    {90        public int First { get; set; }91        public int Last { get; set; }92        public string Sequence { get; set; }93    }94}95/*96        //commented parallel97        public long[] GetHealth(FunctionData Data)98        {99            long[] result = new long[2];100            long[] sequenceScores = new long[Data.GeneDataList.Count];101            // loop the sequences102            for (int genx = 0; genx <= Data.GeneDataList.Count - 1; genx++)103            //Parallel.For(0, Data.GeneDataList.Count, genx => 104            {105                GeneData geneData = Data.GeneDataList[genx];106                string sequence = geneData.Sequence;107                long seqTotal = 0;108                //loop genes109                //for (int index = geneData.First; index <= geneData.Last; index++)110                int first = geneData.First;111                int last = geneData.Last;112                //var pres = Parallel.For(first, last, index =>113                for (int index = first; index <= last; index++)114                {115                    {116                        string gene = Data.Genes[index];117                        int position = sequence.IndexOf(gene, 0);118                        while (position >= 0)119                        {120                            seqTotal += Data.GenesHealth[gene][index];121                            position = sequence.IndexOf(gene, ++position);122                        }123                    }124                }//);125                sequenceScores[genx] = seqTotal;126            }//);127            result[0] = sequenceScores.Min();128            result[1] = sequenceScores.Max();129            return result;        130        }131        //swapped to loop gene sequence then search genes132        public long[] GetHealth(FunctionData Data)133        {134            long[] result = new long[2];135            long[] sequenceScores = new long[Data.GeneDataList.Count];136            // loop the sequences137            for (int genx = 0; genx <= Data.GeneDataList.Count - 1; genx++)138            {139                GeneData geneData = Data.GeneDataList[genx];140                string sequence = geneData.Sequence;141                long seqTotal = 0;142                //loop genes143                for (int index = geneData.First; index <= geneData.Last; index++)144                {145                    string gene = Data.Genes[index];146                    int position = sequence.IndexOf(gene, 0);147                    while (position >= 0)148                    {149                        seqTotal += Data.GenesHealth[gene][index];150                        position = sequence.IndexOf(gene, ++position);151                    }152                }153                sequenceScores[genx] = seqTotal;154            }155            result[0] = sequenceScores.Min();156            result[1] = sequenceScores.Max();157            return result;        158        }159        // loop genes then gene sequence160        for (int index = Data.MinFirst; index <= Data.MaxLast; index++)161        {162            //long seqTotal = 0;163            //loop genes164            for (int genx = 0; genx <= Data.GeneDataList.Count - 1; genx++)165            {166                GeneData geneData = Data.GeneDataList[genx];167                if (index >= geneData.First && index <= geneData.Last)168                {169                    string sequence = geneData.Sequence;170                    string gene = Data.Genes[index];171                    int position = sequence.IndexOf(gene, 0);172                    while (position >= 0)173                    {174                        //seqTotal += Data.GenesHealth[gene][index];175                        sequenceScores[genx] += Data.GenesHealth[gene][index];176                        position = sequence.IndexOf(gene, ++position);177                    }178                }179            }180        }181                    182                    //int len = gene.Length;183                    //int lengthSeq = sequence.Length - len;184                    //int position = 0;185                    if (sequence.Contains(gene))186                    {187                        for (int position = 0; position <= lengthSeq; position++)188                        {189                            string subSequence = sequence.Substring(position, len);190                            //check if substring matches gene, if so get score and add it.191                            if (subSequence == gene)192                            {193                                seqTotal += Data.GenesHealth[gene][index];// Data.Health[index];194                            }195                        }196                    }197                    198*loop sequence199            // loop the sequences200            for (int genx = 0; genx <= Data.GeneDataList.Count - 1; genx++)201            {202                GeneData geneData = Data.GeneDataList[genx];203                sequenceScores.Add(geneData.Sequence, 0); //initialize gene scores204                //loop genes205                for(int position = 0; position <= geneData.Sequence.Length; position++)206                {207                    for (int index = geneData.First; index <= geneData.Last; index++)208                    {209                        //pull sub string from start position to length of gene string210                        // make sure not to have an end point beyond the length of the string...211                        int len = Data.Genes[index].Length;212                        if (len + position <= geneData.Sequence.Length)213                        {214                            string subSequence = geneData.Sequence.Substring(position, len);215                            //check if substring matches gene, if so get score and add it.216                            if (subSequence == Data.Genes[index])217                            {218                                sequenceScores[geneData.Sequence] += Data.Health[index];219                            }220                        }221                    }222                }223            } 224//pull sub string from start position to length of gene string225// make sure not to have an end point beyond the length of the string...226int len = Data.Genes[index].Length;227if (len + position <= geneData.Sequence.Length)228{229    string subSequence = geneData.Sequence.Substring(position, len);230    //check if substring matches gene, if so get score and add it.231    if (subSequence == Data.Genes[index])232    {233        sequenceScores[geneData.Sequence] += Data.Health[index];234    }235}236for (int genx = 0; genx <= Data.GeneDataList.Count - 1; genx++)237{238GeneData geneData = Data.GeneDataList[genx];239sequenceScores.Add(geneData.Sequence, 0); //initialize gene scores240//loop genes241List<string> testedGenes = new List<string>(); // no need to process genes242for (int index = geneData.First; index <= geneData.Last; index++)243{244if (testedGenes.Contains(Data.Genes[index]) == false)245{246    Dictionary<int, int> range = Data.GenesHealth[Data.Genes[index]].Where(r => r.Key >= geneData.First && r.Key <= geneData.Last).ToDictionary(k => k.Key, v => v.Value);247    if (range.Count() > 1)248    {249        foreach (KeyValuePair<int, int> score in range)250        {251            sequenceScores[geneData.Sequence] += score.Value;252            //Data.GenesHealth[Data.Genes[index]][score.Key] = 0;253        }254        testedGenes.Add(Data.Genes[index]);255    }256    else257    {258        // test how many times gene is in sequence 259        int indexOf = geneData.Sequence.IndexOf(Data.Genes[index]);260        while (indexOf >= 0)261        {262            sequenceScores[geneData.Sequence] += Data.Health[index];263            indexOf = geneData.Sequence.IndexOf(Data.Genes[index], indexOf + 1);264        }265        testedGenes.Add(Data.Genes[index]);266    }267}268}269// check if there is more than one gene in the range.270} 271*/...

Full Screen

Full Screen

MWorld_PhazonMeteor.cs

Source:MWorld_PhazonMeteor.cs Github

copy

Full Screen

1#region Using directives23using System;45using Terraria;6using Terraria.ID;7using Terraria.ModLoader;8using Terraria.Localization;910using Microsoft.Xna.Framework;1112#endregion1314namespace MetroidMod.Common.Worlds15{16	public partial class MWorld : ModWorld17	{18		public static bool spawnedPhazonMeteor = false;1920		public static void AddPhazon()21		{22			int lX = 200;23			int hX = Main.maxTilesX - 200;24			int lY = (int)Main.worldSurface;25			int hY = Main.maxTilesY - 200;2627			int minSpread = 5;28			int maxSpread = 8;29			int minFrequency = 5;30			int maxFrequency = 8;3132			WorldGen.OreRunner(WorldGen.genRand.Next(lX, hX), WorldGen.genRand.Next(lY, hY), WorldGen.genRand.Next(minSpread, maxSpread + 1), WorldGen.genRand.Next(minFrequency, maxFrequency + 1), (ushort)ModContent.TileType<Tiles.PhazonTile>());33		}3435		public static void DropPhazonMeteor()36		{37			bool generateSuccessful = false;3839			if (Main.netMode == NetmodeID.MultiplayerClient)40			{41				return;42			}4344			// Check to get a valid position for the generation of a Phazon Meteorite.45			// There's a certain solid tile treshold (starting at 600, stopping at 100, cancelling the generation), which needs to be met46			// Before the meteorite is allowed to generate.47			float solidTileTreshhold = 600f;48			while (!generateSuccessful)49			{50				float spawnMargin = Main.maxTilesX * 0.08f;51				int genY = (int)(Main.worldSurface * 0.3);52				int genX = Main.rand.Next(150, Main.maxTilesX - 150);5354				// Do not allow a Phazon Meteorite to spawn too close to the center of the world (spawnpoint).55				while (Math.Abs(genX - Main.spawnTileX) < spawnMargin)56				{57					genX = Main.rand.Next(150, Main.maxTilesX - 150);58				}59				60				while (genY < Main.maxTilesY)61				{62					if (Main.tile[genX, genY].active() && Main.tileSolid[Main.tile[genX, genY].type] && !Main.tileSolidTop[Main.tile[genX, genY].type])63					{64						int genOffset = 15;65						int solidSpawnTiles = 0;6667						for (int x = genX - genOffset; x < genX + genOffset; x++)68						{69							for (int y = genY - genOffset; y < genY + genOffset; y++)70							{71								if (WorldGen.SolidTile(x, y))72								{73									solidSpawnTiles++;74									if (Main.tile[x, y].type == TileID.Cloud || Main.tile[x, y].type == TileID.Sunplate)75									{76										solidSpawnTiles -= 100;77									}78								}79								else if (Main.tile[x, y].liquid > 0)80								{81									solidSpawnTiles--;82								}83							}84						}85						if (solidSpawnTiles < solidTileTreshhold)86						{87							solidTileTreshhold -= 0.5f;88							break;89						}9091						if(TryGeneratePhazonMeteor(genX, genY))92						{93							generateSuccessful = true;94							break;95						}96					}97					genY++;98				}99				if (solidTileTreshhold < 100f)100				{101					return;102				}103			}104			105			if(generateSuccessful)106			{107				spawnedPhazonMeteor = true;108			}109		}110111		public static bool TryGeneratePhazonMeteor(int genX, int genY)112		{113			if (genX < 50 || genX > Main.maxTilesX - 50 ||114				genY < 50 || genY > Main.maxTilesY - 50)115			{116				return false;117			}118119			int spawnOffset = 35;120			Rectangle rectangle = new Rectangle((genX - spawnOffset) * 16, (genY - spawnOffset) * 16, spawnOffset * 32, spawnOffset * 32);121			122			// If there's a player within the spawn area of the Phazon Meteorite, disallow spawning.123			for (int i = 0; i < Main.maxPlayers; i++)124			{125				if (Main.player[i].active)126				{127					Rectangle playerRectangle = new Rectangle(128						(int)(Main.player[i].position.X + (Main.player[i].width / 2) - (NPC.sWidth / 2) - NPC.safeRangeX),129						(int)(Main.player[i].position.Y + (Main.player[i].height / 2) - (NPC.sHeight / 2) - NPC.safeRangeY),130						NPC.sWidth + NPC.safeRangeX * 2, NPC.sHeight + NPC.safeRangeY * 2131					);132133					if (rectangle.Intersects(playerRectangle))134					{135						return false;136					}137				}138			}139140			// If there's an NPC within the spawn area of the Phazon Meteorite, disallow spawning.141			for (int i = 0; i < Main.maxNPCs; i++)142			{143				if (Main.npc[i].active)144				{145					if (rectangle.Intersects(Main.npc[i].Hitbox))146					{147						return false;148					}149				}150			}151152			// If there's a chest within the spawn area of the Phazon Meteorite, disallow spawning.153			for (int x = genX - spawnOffset; x < genX + spawnOffset; x++)154			{155				for (int y = genY - spawnOffset; y < genY + spawnOffset; y++)156				{157					if (Main.tile[x, y].active() && TileID.Sets.BasicChest[Main.tile[x, y].type])158					{159						return false;160					}161				}162			}163164			// Initial spawn of Phazon Tiles, and removal of non-solid tiles.165			GeneratePhazonChunkAt(genX, genY, WorldGen.genRand.Next(17, 23), (x, y, margin) =>166			{167				if (y > genY + Main.rand.Next(-2, 3) - 5)168				{169					float distance = new Vector2(genX - x, genY - y).Length();170					if (distance < margin * 0.9f + Main.rand.Next(-4, 5))171					{172						if (!Main.tileSolid[Main.tile[x, y].type])173						{174							Main.tile[x, y].active(false);175						}176						Main.tile[x, y].type = (ushort)ModContent.TileType<Tiles.PhazonTile>();177					}178				}179			});180181			// Removal of tiles in the center of the 'crater'.182			GeneratePhazonChunkAt(genX, genY, WorldGen.genRand.Next(8, 14), (x, y, margin) =>183			{184				if (y > genY + Main.rand.Next(-2, 3) - 4)185				{186					float distance = new Vector2(genX - x, genY - y).Length();187					if (distance < margin * 0.8f + Main.rand.Next(-3, 4))188					{189						Main.tile[x, y].active(false);190					}191				}192			});193194			// Placement of Phazon Core tiles.195			GeneratePhazonChunkAt(genX, genY + 4, WorldGen.genRand.Next(4, 6), (x, y, margin) =>196			{197				if (y > genY + Main.rand.Next(-2, 3) - 5 && (Math.Abs(genX - x) + Math.Abs(genY - y)) < margin * 1.5 + Main.rand.Next(-5, 5))198				{199					if (!Main.tileSolid[Main.tile[x, y].type])200					{201						Main.tile[x, y].active(false);202					}203					WorldGen.PlaceTile(x, y, ModContent.TileType<Tiles.PhazonCore>(), true);204					WorldGen.SquareTileFrame(x, y);205				}206			});207208			// First generation spread pass of Phazon Tiles.209			GeneratePhazonChunkAt(genX, genY, WorldGen.genRand.Next(25, 35), (x, y, margin) =>210			{211				float distance = new Vector2(genX - x, genY - y).Length();212				if (distance < margin * 0.7f)213				{214					if (Main.tile[x, y].type == TileID.Trees || Main.tile[x, y].type == TileID.CorruptThorns || Main.tile[x, y].type == TileID.CrimtaneThorns)215					{216						WorldGen.KillTile(x, y, false, false, false);217					}218					Main.tile[x, y].liquid = 0;219				}220221				if (Main.tile[x, y].type == ModContent.TileType<Tiles.PhazonTile>())222				{223					if (!WorldGen.SolidTile(x - 1, y) && !WorldGen.SolidTile(x + 1, y) && !WorldGen.SolidTile(x, y - 1) && !WorldGen.SolidTile(x, y + 1))224					{225						Main.tile[x, y].active(false);226					}227					else if ((Main.tile[x, y].halfBrick() || Main.tile[x - 1, y].topSlope()) && !WorldGen.SolidTile(x, y + 1))228					{229						Main.tile[x, y].active(false);230					}231				}232233				WorldGen.SquareTileFrame(x, y);234				WorldGen.SquareWallFrame(x, y);235			});236237			// Second generation spread pass of Phazon Tiles.238			GeneratePhazonChunkAt(genX, genY, WorldGen.genRand.Next(23, 32), (x, y, margin) =>239			{240				if (y > genY + WorldGen.genRand.Next(-3, 4) - 3 && Main.tile[x, y].active() && Main.rand.Next(10) == 0)241				{242					float distance = new Vector2(genX - x, genY - y).Length();243					if (distance < margin * 0.8f)244					{245						if (Main.tile[x, y].type == TileID.Trees || Main.tile[x, y].type == TileID.CorruptThorns || Main.tile[x, y].type == TileID.CrimtaneThorns)246						{247							WorldGen.KillTile(x, y, false, false, false);248						}249						Main.tile[x, y].type = (ushort)ModContent.TileType<Tiles.PhazonTile>();250						WorldGen.SquareTileFrame(x, y);251					}252				}253			});254255			// Third generation spread pass of Phazon Tiles.256			GeneratePhazonChunkAt(genX, genY, WorldGen.genRand.Next(30, 38), (x, y, margin) =>257			{258				if (y > genY + WorldGen.genRand.Next(-2, 3) && Main.tile[x, y].active() && Main.rand.Next(20) == 0)259				{260					float distance = new Vector2(genX - x, genY - y).Length();261					if (distance < margin * 0.85f)262					{263						if (Main.tile[x, y].type == TileID.Trees || Main.tile[x, y].type == TileID.CorruptThorns || Main.tile[x, y].type == TileID.CrimtaneThorns)264						{265							WorldGen.KillTile(x, y, false, false, false);266						}267						Main.tile[x, y].type = (ushort)ModContent.TileType<Tiles.PhazonTile>();268						WorldGen.SquareTileFrame(x, y);269					}270				}271			});272273			if (Main.netMode == NetmodeID.SinglePlayer)274			{275				Main.NewText("A Phazon Meteor has landed!", 50, 255, 130, false);276			}277			else if (Main.netMode == NetmodeID.Server)278			{279				NetMessage.BroadcastChatMessage(NetworkText.FromLiteral("A Phazon Meteor has landed!"), new Color(50, 255, 130), -1);280			}281282			// Since we are not able to get here if we're in a multiplayer client session, removed the check.283			NetMessage.SendTileSquare(-1, genX, genY, 40, TileChangeType.None);284285			return (true);286		}287288		/// <summary>289		/// A helper method to spawn clusters of tiles for the Phazon Meteorite.290		/// </summary>291		/// <param name="genX">The X tile coordinate of the Phazon Meteorite spawn.</param>292		/// <param name="genY">The Y tile coordinate of the Phazon Meteorite spawn.</param>293		/// <param name="margin">The margin which is used to spread out tiles to a certain point around the spawn coordinates.</param>294		/// <param name="generationAction">The action to take for each tile within the chunk/spawn area.</param>295		private static void GeneratePhazonChunkAt(int genX, int genY, int margin, Action<int, int, int> generationAction)296		{297			for (int x = genX - margin; x < genX + margin; ++x)298			{299				for (int y = genY - margin; y < genY + margin; ++y)300				{301					generationAction(x, y, margin);302				}303			}304		}305	}306}
...

Full Screen

Full Screen

ScanrangeCalc.cs

Source:ScanrangeCalc.cs Github

copy

Full Screen

1using System;2using System.Collections.Generic;3using System.Linq;4using System.Text;5using UnityEngine;67public class ScanrangeCalc8{9    public ScanrangeCalc()10    {11        InitializeTables();12    }1314    private sbyte[,,] pTablesOffset = new sbyte[41, 41, 2];15    private int[,] pTablesCost = new int[41, 41];16    public int[,] pTablesVision = new int[41, 41];1718    public byte ScanShift = 7;1920    private bool SetCell(int x, int y, int height_origin, int height_cell)21    {22        int vision_previous = pTablesVision[x + pTablesOffset[x, y, 0], y + pTablesOffset[x, y, 1]];23        int cost = pTablesCost[x, y];24        pTablesVision[x, y] = vision_previous - (height_cell - height_origin + cost);25        return (pTablesVision[x, y] >= 0);26    }2728    public void InitializeTables()29    {30        uint ulScanShifted = 1u << ScanShift;3132        for (int i = 0; i <= 20; ++i)33        {34            for (int j = 0; j <= 20; ++j)35            {36                int v1 =  i > 0 || j > 0 ?  (int)(Math.Pow((j * j + i * i), 0.5) / Math.Max(i,j) * ulScanShifted) : 0;3738                pTablesCost[20 + i, 20 + j] = v1;39                pTablesCost[20 + i, 20 - j] = v1;40                pTablesCost[20 - i, 20 + j] = v1;41                pTablesCost[20 - i, 20 - j] = v1;4243                if (j < (i / 2))44                {45                    pTablesOffset[20 + i, 20 + j, 0] = -1;46                    pTablesOffset[20 + i, 20 + j, 1] = 0;47                    pTablesOffset[20 - i, 20 - j, 0] = 1;48                    pTablesOffset[20 - i, 20 - j, 1] = 0;49                    pTablesOffset[20 + i, 20 - j, 0] = -1;50                    pTablesOffset[20 + i, 20 - j, 1] = 0;51                    pTablesOffset[20 - i, 20 + j, 0] = 1;52                    pTablesOffset[20 - i, 20 + j, 1] = 0;5354                } 55                else if (j > (i * 2))56                {57                    pTablesOffset[20 + i, 20 + j, 0] = 0;58                    pTablesOffset[20 + i, 20 + j, 1] = -1;59                    pTablesOffset[20 - i, 20 - j, 0] = 0;60                    pTablesOffset[20 - i, 20 - j, 1] = 1;61                    pTablesOffset[20 + i, 20 - j, 0] = 0;62                    pTablesOffset[20 + i, 20 - j, 1] = 1;63                    pTablesOffset[20 - i, 20 + j, 0] = 0;64                    pTablesOffset[20 - i, 20 + j, 1] = -1;65                }66                else67                {68                    pTablesOffset[20 + i, 20 + j, 0] = -1;69                    pTablesOffset[20 + i, 20 + j, 1] = -1;70                    pTablesOffset[20 - i, 20 - j, 0] = 1;71                    pTablesOffset[20 - i, 20 - j, 1] = 1;72                    pTablesOffset[20 + i, 20 - j, 0] = -1;73                    pTablesOffset[20 + i, 20 - j, 1] = 1;74                    pTablesOffset[20 - i, 20 + j, 0] = 1;75                    pTablesOffset[20 - i, 20 + j, 1] = -1;76                }77            }78        }7980        pTablesCost[20, 20] = 0;81    }8283    private bool CheckValid(int x, int y)84    {85        return (x >= 8 && y >= 8 && x < MapLogic.Instance.Width - 8 && y < MapLogic.Instance.Height - 8);86    }8788    private int GetHeight(int x, int y)89    {90        if (x < 0 || y < 0 || x >= MapLogic.Instance.Width || y >= MapLogic.Instance.Height)91            return 0;92        return MapLogic.Instance.Nodes[x, y].Height;93    }9495    public void CalculateVision(int x, int y, float scanrangef)96    {97        // we need to make scanshifted scanrange from float.98        int scanrange = (int)scanrangef;99        scanrange = (scanrange << 8) | (int)((scanrangef - scanrange) * 255);100101        for (int ly = 0; ly < 41; ly++)102            for (int lx = 0; lx < 41; lx++)103                pTablesVision[lx, ly] = 0;104105        int vision = scanrange;106        int vision2 = (1 << (ScanShift - 1)) + (vision >> (8 - ScanShift));107108        int genX = x - 20;109        int genY = y - 20;110        int ht_origin = GetHeight(x, y);111112        pTablesVision[20, 20] = vision2;113        for(int i = 1; i < 20; i++)114        {115            bool fdisp = false;116            for(int j = -i; j < i+1; j++)117            {118                if(CheckValid(genX+(20+j), genY+(20-i)) &&119                   SetCell(20+j, 20-i, ht_origin, GetHeight(genX+(20+j), genY+(20-i))))120                    fdisp = true;121                if(CheckValid(genX+(20+j), genY+(20+i)) &&122                   SetCell(20+j, 20+i, ht_origin, GetHeight(genX+(20+j), genY+(20+i))))123                    fdisp = true;124                if(CheckValid(genX+(20-i), genY+(20+j)) &&125                   SetCell(20-i, 20+j, ht_origin, GetHeight(genX+(20-i), genY+(20+j))))126                    fdisp = true;127                if(CheckValid(genX+(20+i), genY+(20-j)) &&128                   SetCell(20+i, 20-j, ht_origin, GetHeight(genX+(20+i), genY+(20-j))))129                    fdisp = true;130            }131132		    if(!fdisp) break;133        }134    }
...

Full Screen

Full Screen

GenerateMap.cs

Source:GenerateMap.cs Github

copy

Full Screen

1using System.Collections;2using System.Collections.Generic;3using UnityEngine;4public class GenerateMap : MonoBehaviour5{6	/*7	public int mapHeight = 0;8	public int mapWidth =0;9	public Vector2 genPos = new Vector2(0,0);10	public bool gen = true;11	public int  ranNode;12	public enum RoomType13	{ 14		REST,15		COMBAT,16		TREASURE,17		SHOP18	};19	private int roomsGenerated;20	public int RoomMax;21    22	public void GenRooms(int mapHeight, int mapWidth, Vector2 genPos)23	{24		//set RoomMax in macros or alternatively ghaneg to global variable25		if (gen == true)26		{27			do28			{29				ranNode = Random.Range(0, 3);30				var roomType = RoomType.COMBAT;31				roomsGenerated++;32				if (roomsGenerated >= RoomMax)33				{34					gen = false;35				}36				if (ranNode == 0 && doorTop == false)37				{38					//Set random room placement39					doorTop = false;40					doorBottom = true;41					doorLeft = false;42					doorRight = false;43					//Door44					instance_create_layer(genX + (mapWidth / 2), genY + 46, "Doors", oDoorTop);45					genY -= mapHeight;46					//Main Room Obj47					instance_create_depth(genX, genY, depth, oRoom);48					//Room Type49					switch (roomType)50					{51						case 0: //Rest52								//DO SOMETHING53							instance_create_depth(genX + (mapWidth / 2), genY + (mapHeight / 2), depth, oRoomMob);54							break;55						case 1: //mob/Trap Room56							instance_create_depth(genX + (mapWidth / 2), genY + (mapHeight / 2), depth, oRoomMob);57							break;58						case 2: //Trap/Puzzle59							instance_create_depth(genX + (mapWidth / 2), genY + (mapHeight / 2), depth, oRoomTrap);60							break;61					}62					//Door63					instance_create_layer(genX + (mapWidth / 2), genY + (mapHeight - 46), "Doors", oDoorBottom);64				}65				if (ranNode == 1 && doorBottom == false)66				{67					//Set random room placement68					doorTop = true;69					doorBottom = false;70					doorLeft = false;71					doorRight = false;72					instance_create_layer(genX + (mapWidth / 2), genY + (mapHeight - 46), "Doors", oDoorBottom);73					genY += mapHeight;74					instance_create_depth(genX, genY, depth, oRoom);75					switch (roomType)76					{77						case 0: //Rest78								//DO SOMETHING79							instance_create_depth(genX + (mapWidth / 2), genY + (mapHeight / 2), depth, oRoomMob);80							break;81						case 1: //mob/Trap Room82							instance_create_depth(genX + (mapWidth / 2), genY + (mapHeight / 2), depth, oRoomMob);83							break;84						case 2: //Trap/Puzzle85							instance_create_depth(genX + (mapWidth / 2), genY + (mapHeight / 2), depth, oRoomTrap);86							break;87					}88					instance_create_layer(genX + (mapWidth / 2), genY + 46, "Doors", oDoorTop);89				}90				if (ranNode == 2 && doorRight == false)91				{92					//Set random room placement93					doorRight = false;94					doorTop = false;95					doorBottom = false;96					doorLeft = true;97					instance_create_layer(genX + (mapWidth - (46)), genY + (mapHeight / 2), "Doors", oDoorRight);98					genX += mapWidth;99					instance_create_depth(genX, genY, depth, oRoom);100					switch (roomType)101					{102						case 0: //Rest103								//DO SOMETHING104							instance_create_depth(genX + (mapWidth / 2), genY + (mapHeight / 2), depth, oRoomMob);105							break;106						case 1: //mob/Trap Room107							instance_create_depth(genX + (mapWidth / 2), genY + (mapHeight / 2), depth, oRoomMob);108							break;109						case 2: //Trap/Puzzle110							instance_create_depth(genX + (mapWidth / 2), genY + (mapHeight / 2), depth, oRoomTrap);111							break;112					}113					instance_create_layer(genX + 46, genY + (mapHeight / 2), "Doors", oDoorLeft);114				}115				if (ranNode == 3 && doorLeft == false)116				{117					//Set random room placement118					doorLeft = false;119					doorTop = false;120					doorBottom = false;121					doorRight = true;122					instance_create_layer(genX + 46, genY + (mapHeight / 2), "Doors", oDoorLeft);123					genX -= mapWidth;124					instance_create_depth(genX, genY, depth, oRoom);125					switch (roomType)126					{127						case 0: //Rest128								//DO SOMETHING129							instance_create_depth(genX + (mapWidth / 2), genY + (mapHeight / 2), depth, oRoomMob);130							break;131						case 1: //mob/Trap Room132							instance_create_depth(genX + (mapWidth / 2), genY + (mapHeight / 2), depth, oRoomMob);133							break;134						case 2: //Trap/Puzzle135							instance_create_depth(genX + (mapWidth / 2), genY + (mapHeight / 2), depth, oRoomTrap);136							break;137					}138					instance_create_layer(genX + (mapWidth - 46), genY + (mapHeight / 2), "Doors", oDoorRight);139				}140			}141			while (roomsGenerated >= RoomMax);142		}143	}*/144}...

Full Screen

Full Screen

TrelamiumTile.cs

Source:TrelamiumTile.cs Github

copy

Full Screen

1using Terraria;2using Terraria.ID;3using Terraria.ModLoader;4using Microsoft.Xna.Framework;5using TrelamiumTwo.Content.Items.Materials;6using TrelamiumTwo.Helpers;7namespace TrelamiumTwo.Common.Tiles8{9	public class TrelamiumTile : GlobalTile10	{11		private const float nutSpawnChance = 0.05f;12		private const float leafSpawnChance = 0.025f;13		private Player player;14		public override void RandomUpdate(int i, int j, int type)15		{16			if (Main.tile[i, j].nactive())17			{18				if ((type == TileID.Grass || type == TileID.HallowedGrass) && Main.rand.Next(55) == 0)19				{20					TryBloomRose(i, j);21				}22			}23		}24		public override void FloorVisuals(int type, Player player)25		{26			player.GetModPlayer<Players.TrelamiumPlayer>().onSand =27				(TileID.Sets.Conversion.Sand[type] || TileID.Sets.Conversion.Sandstone[type] || TileID.Sets.Conversion.HardenedSand[type]);28		}29		private void TryBloomRose(int genX, int genY)30		{31			int scatteredFlowerRadiusCheck = 5;32			int scatteredFlowerType = ModContent.TileType<Content.Tiles.Ambience.BloomRose>();33			if (genX < 95 || genX > Main.maxTilesX - 95 || genY < 95 || genY > Main.worldSurface)34			{35				return;36			}37			Tile topTile = Framing.GetTileSafely(genX, genY - 1);38			if (topTile.active() && topTile.type != scatteredFlowerType)39			{40				return;41			}42			int minX = Utils.Clamp(genX - scatteredFlowerRadiusCheck, 1, Main.maxTilesX - 2);43			int maxX = Utils.Clamp(genX + scatteredFlowerRadiusCheck, 1, Main.maxTilesX - 2);44			int minY = Utils.Clamp(genY - scatteredFlowerRadiusCheck, 1, Main.maxTilesY - 2);45			int maxY = Utils.Clamp(genY + scatteredFlowerRadiusCheck, 1, Main.maxTilesY - 2);46			for (int x = minX; x < maxX; ++x)47			{48				for (int y = minY; y < maxY; ++y)49				{50					Tile t = Framing.GetTileSafely(x, y);51					if (t.active() && t.type == scatteredFlowerType)52					{53						return;54					}55				}56			}57			WorldGen.PlaceTile(genX, genY - 1, scatteredFlowerType, true);58		}59		public override void KillTile(int i, int j, int type, ref bool fail, ref bool effectOnly, ref bool noItem)60		{61			player = Main.LocalPlayer;62			if (!effectOnly)63			{64				if (player.ZoneForest())65				{66					if (Main.netMode != NetmodeID.MultiplayerClient && type == TileID.Trees)67					{68						TrySpawnLeaf(i, j);69						TrySpawnNut(i, j, fail);70					}71				}72			}73		}74		private void TrySpawnNut(int x, int y, bool fail)75		{76			if (fail || Main.rand.NextFloat() > nutSpawnChance)77			{78				return;79			}80			while (y > 10 && Main.tile[x, y].active() && Main.tile[x, y].type == TileID.Trees)81			{82				y--;83			}84			y++;85			if (!IsTileALeafyTreeTop(x, y) || Collision.SolidTiles(x - 2, x + 2, y - 2, y + 2))86			{87				return;88			}89			Item.NewItem(new Vector2(x * 16, y * 16), ModContent.ItemType<Nut>(), Main.rand.Next(5));90		}91		private void TrySpawnLeaf(int x, int y)92		{93			if (Main.rand.NextFloat() > leafSpawnChance)94			{95				return;96			}97			while (y > 10 && Main.tile[x, y].active() && Main.tile[x, y].type == TileID.Trees)98			{99				y--;100			}101			y++;102			if (!IsTileALeafyTreeTop(x, y) || Collision.SolidTiles(x - 2, x + 2, y - 2, y + 2))103			{104				return;105			}106			int velocityXDir = Main.rand.Next(2) * 2 - 1;107			int projectileType = ModContent.ProjectileType<Content.Projectiles.Typeless.FallingLeaf>();108			Projectile.NewProjectile(x * 16, y * 16, Main.rand.NextFloat(2f) * velocityXDir, 0f, projectileType, 0, 0f, Player.FindClosest(new Vector2(x * 16, y * 16), 16, 16));109		}110		private bool IsTileALeafyTreeTop(int i, int j)111		{112			Tile tileSafely = Framing.GetTileSafely(i, j);113			if (tileSafely.active() && tileSafely.type == TileID.Trees)114			{115				if (tileSafely.frameX == 22 && tileSafely.frameY >= 198 && tileSafely.frameY <= 242)116				{117					return true;118				}119			}120			return false;121		}122	}123}...

Full Screen

Full Screen

BedCommand.cs

Source:BedCommand.cs Github

copy

Full Screen

1using System.Drawing;2using System.Drawing.Text;3using System.Threading.Tasks;4using DSharpPlus.CommandsNext;5using DSharpPlus.CommandsNext.Attributes;6using WinBot.Util;7using static WinBot.Util.ResourceManager;8using WinBot.Commands.Attributes;9namespace WinBot.Commands.Fun10{11    public class BedCommand : BaseCommandModule12    {13		[Command("bed")]14        [Description("Tell someone to go to bed.")]15        [Usage("[User] [Image: parz, agp, agp2, mehdi]")]16        [Category(Category.Fun)]17        public async Task bed(CommandContext Context, string screenname = "", string image = "parz")18        {19            // Randomize the image if no input was given20            if(image == "parz" || string.IsNullOrWhiteSpace(image))21                image = images[new System.Random().Next(0, images.Length)];22			// Select the image with some YanDev code23            string imageFile = GetResourcePath("parz.png", Util.ResourceType.Resource);24            float genX = 365f;25            float bedY = 506f;26            float userY = 615f;27            int fontSize = 70;28            if(image.ToLower() == "agp") {29                imageFile = GetResourcePath("agp.png", Util.ResourceType.Resource);30                genX = 125;31                bedY = 35;32                fontSize = 50;33                userY = 360;34            }35            else if(image.ToLower() == "agp2") {36                imageFile = GetResourcePath("agp2.png", Util.ResourceType.Resource);37                genX = 177.5f;38                bedY = 60;39                fontSize = 50;40                userY = 450;41            }42            else if(image.ToLower() == "mehdi") {43                imageFile = GetResourcePath("mehdi.png", Util.ResourceType.Resource);44                bedY = 100;45                genX = 307.5f; 46                userY = 680f;47            }48            // Load the font49            PrivateFontCollection fonts = new PrivateFontCollection();50            fonts.AddFontFile(GetResourcePath("impact.ttf", Util.ResourceType.Resource));51			52			// Create the image53            Bitmap img = new Bitmap(Bitmap.FromFile(imageFile));54			Graphics bmp = Graphics.FromImage(img);55    56			 // Set up the fonts and drawing stuff57            Font IMPACTfont = new Font(58                fonts.Families[0].Name,59                fontSize,60                FontStyle.Regular,61                GraphicsUnit.Pixel62            );63            SolidBrush brush;64			brush = new SolidBrush(System.Drawing.Color.White);65			StringFormat snFormat = new StringFormat();66			snFormat.Alignment = StringAlignment.Center;67			snFormat.LineAlignment = StringAlignment.Center;68			69			// Draw the text onto the image70            bmp.DrawString("GO TO BED", IMPACTfont, brush, genX, bedY, snFormat);71			bmp.DrawString(screenname.ToUpper(), IMPACTfont, brush, genX, userY, snFormat);72			73			// Save the image to a temporary file74            bmp.Save();75            string imagePath = TempManager.GetTempFile($"bed-{image}-{screenname}-{Context.User.Id}.png", true);76            img.Save(imagePath);77            await Context.Channel.SendFileAsync(imagePath);78            TempManager.RemoveTempFile($"bed-{image}-{screenname}-{Context.User.Id}.png");79		}80		81        static string[] images = { "NONE", "mehdi", "agp", "agp2" };82	}83}...

Full Screen

Full Screen

GreatDarkness.cs

Source:GreatDarkness.cs Github

copy

Full Screen

1using JetshiftMod.NPCs;2using JetshiftMod.Tiles;3using System;4using System.Collections.Generic;5using Microsoft.Xna.Framework;6using Microsoft.Xna.Framework.Graphics;7using Terraria;8using Terraria.Utilities;9using Terraria.DataStructures;10using Terraria.ID;11using Terraria.ModLoader;12using Terraria.World.Generation;13using Terraria.GameContent.Generation;14using BaseMod;1516namespace JetshiftMod.Worldgen17{18	public class GreatDarkness : MicroBiome19	{20        public override bool Place(Point origin, StructureMap structures)21        {22            //this handles generating the actual tiles, but you still need to add things like treegen etc. I know next to nothing about treegen so you're on your own there, lol.2324            Mod mod = JetshiftMod.instance;2526            Dictionary<Color, int> colorToTile = new Dictionary<Color, int>();27            colorToTile[new Color(51, 51, 51)] = mod.TileType("VoidOre");28			colorToTile[new Color(120, 120, 120)] = mod.TileType("Tenebricite");29            colorToTile[Color.Black] = -1; //don't touch when genning        3031            Dictionary<Color, int> colorToWall = new Dictionary<Color, int>();32			colorToWall[new Color(150, 150, 150)] = WallID.Stone;33            colorToWall[Color.Black] = -1; //don't touch when genning                3435            TexGen gen = BaseWorldGenTex.GetTexGenerator(mod.GetTexture("Worldgen/GreatDarkness"), colorToTile);36			int genX = origin.X - (gen.width / 3);37			int genY = origin.Y - 25;			38            gen.Generate(genX, genY, true, true);39            return true;40        }41	}4243	public class GreatDarknessDelete : MicroBiome44	{45		public override bool Place(Point origin, StructureMap structures)46		{47			//this handles generating the actual tiles, but you still need to add things like treegen etc. I know next to nothing about treegen so you're on your own there, lol.4849			Mod mod = JetshiftMod.instance;5051			Dictionary<Color, int> colorToTile = new Dictionary<Color, int>();52			colorToTile[new Color(51, 51, 51)] = -2;53			colorToTile[new Color(120, 120, 120)] = -2;54			colorToTile[new Color(150, 150, 150)] = -2;55			colorToTile[Color.Black] = -1;5657			Dictionary<Color, int> colorToWall = new Dictionary<Color, int>();58			colorToWall[new Color(150, 150, 150)] = -1;59            colorToWall[Color.Black] = -1; //don't touch when genning6061			TexGen gen = BaseWorldGenTex.GetTexGenerator(mod.GetTexture("Worldgen/GreatDarkness"), colorToTile);62			Point newOrigin = new Point(origin.X, origin.Y - 30);63			int genX = origin.X - (gen.width / 3);64			int genY = origin.Y - 25;		65			gen.Generate(genX, genY, true, true);						6667			return true;68		}69	}
...

Full Screen

Full Screen

GenX

Using AI Code Generation

copy

Full Screen

1using B;2{3    static void Main()4    {5        GenX g = new GenX();6    }7}8using A;9{10    static void Main()11    {12        GenY g = new GenY();13    }14}15using B;16{17    static void Main()18    {19        GenY g = new GenY();20    }21}22using A;23{24    static void Main()25    {26        A.GenX g = new A.GenX();27    }28}29using B;30{31    static void Main()32    {33        B.GenX g = new B.GenX();34    }35}

Full Screen

Full Screen

GenX

Using AI Code Generation

copy

Full Screen

1B.GenX x = new B.GenX();2x.Test();3C.GenX x = new C.GenX();4x.Test();5D.GenX x = new D.GenX();6x.Test();

Full Screen

Full Screen

GenX

Using AI Code Generation

copy

Full Screen

1using B;2{3  {4    public static void Main()5    {6      GenX g = new GenX();7    }8  }9}10using B;11{12  {13    public static void Main()14    {15      GenX g = new GenX();16    }17  }18}19using B;20{21  {22    public static void Main()23    {24      GenX g = new GenX();25    }26  }27}28using B;29{30  {31    public static void Main()32    {33      GenX g = new GenX();34    }35  }36}37using B;38{39  {40    public static void Main()41    {42      GenX g = new GenX();43    }44  }45}46using B;47{48  {49    public static void Main()50    {51      GenX g = new GenX();52    }53  }54}55using B;56{57  {58    public static void Main()59    {60      GenX g = new GenX();61    }62  }63}64using B;65{66  {67    public static void Main()68    {69      GenX g = new GenX();70    }71  }72}73using B;74{75  {76    public static void Main()77    {78      GenX g = new GenX();79    }80  }81}82using B;83{

Full Screen

Full Screen

GenX

Using AI Code Generation

copy

Full Screen

1using B;2{3    {4        public static void Main()5        {6            GenY obj = new GenY();7            obj.Show();8        }9    }10}11using B;12{13    {14        public static void Main()15        {16            GenX obj = new GenX();17            obj.Show();18        }19    }20}21using A;22{23    {24        public static void Main()25        {26            GenY obj = new GenY();27            obj.Show();28        }29    }30}31using A;32{33    {34        public static void Main()35        {36            GenX obj = new GenX();37            obj.Show();38        }39    }40}41Microsoft (R) Visual C# Compiler version 2.0.50727.4242for Microsoft (R) .NET Framework version 2.0.50727.42431.cs(6,21): error CS0246: The type or namespace name 'GenY' could not be found (are you missing a using directive or an assembly reference?)441.cs(7,13): error CS0246: The type or namespace name 'GenY' could not be found (are you missing a using directive or an assembly reference?)452.cs(6,21): error CS0246: The type or namespace name 'GenX' could not be found (are you missing a using directive or

Full Screen

Full Screen

GenX

Using AI Code Generation

copy

Full Screen

1using B;2{3  static void Main()4  {5    GenX<int> x = new GenX<int>();6  }7}8using A;9{10  static void Main()11  {12    GenY<int> y = new GenY<int>();13  }14}15using B;16{17  static void Main()18  {19    GenY<int> y = new GenY<int>();20  }21}

Full Screen

Full Screen

GenX

Using AI Code Generation

copy

Full Screen

1using B;2{3    static void Main()4    {5        GenX g = new GenX();6        g.Show();7    }8}9C:\Users\Public\Documents\Visual Studio 2010\Projects\GenX\GenX\2.cs(5,15): error CS0234: The type or namespace name `GenX' does not exist in the namespace `B'. Are you missing an assembly reference?10Compilation failed: 1 error(s), 0 warnings11using B.GenX;12using B::GenX;13using System;14using System.Collections.Generic;15using System.Linq;16using System.Text;17using System.Threading.Tasks;18using System;19using System.Collections.Generic;20using System.Linq;21using System.Text;22using System.Threading.Tasks;23using System;24using System.Collections.Generic;25using System.Linq;26using System.Text;27using System.Threading.Tasks;28using System;29using System.Collections.Generic;30using System.Linq;31using System.Text;32using System.Threading.Tasks;33using System;34using System.Collections.Generic;35using System.Linq;36using System.Text;37using System.Threading.Tasks;38using System;39using System.Collections.Generic;40using System.Linq;41using System.Text;42using System.Threading.Tasks;43using System;44using System.Collections.Generic;45using System.Linq;46using System.Text;47using System.Threading.Tasks;48using System;49using System.Collections.Generic;50using System.Linq;51using System.Text;52using System.Threading.Tasks;53using System;

Full Screen

Full Screen

GenX

Using AI Code Generation

copy

Full Screen

1using B;2{3    static void Main(string[] args)4    {5        GenX<int> obj = new GenX<int>();6        obj.Show();7    }8}9The using directive is used to import the namespace in the current namespace. It is also used to import the static members of a class or namespace

Full Screen

Full Screen

GenX

Using AI Code Generation

copy

Full Screen

1using B;2{3    static void Main()4    {5        GenX<int> obj = new GenX<int>(12);6        obj.Show();7    }8}

Full Screen

Full Screen

GenX

Using AI Code Generation

copy

Full Screen

1using B;2{3static void Main(string[] args)4{5GenX<int> g = new GenX<int>();6g.Print(100);7}8}9using B;10{11static void Main(string[] args)12{13GenX<int> g = new GenX<int>();14g.Print(100);15}16}17using B;18{19static void Main(string[] args)20{21GenX<int> g = new GenX<int>();22g.Print(100);23}24}25using B;26{27static void Main(string[] args)28{29GenX<int> g = new GenX<int>();30g.Print(100);31}32}33using B;34{35static void Main(string[] args)36{37GenX<int> g = new GenX<int>();38g.Print(100);39}40}41using B;42{43static void Main(string[] args)44{45GenX<int> g = new GenX<int>();46g.Print(100);47}48}49using B;50{51static void Main(string[] args)52{53GenX<int> g = new GenX<int>();54g.Print(100);55}56}

Full Screen

Full Screen

GenX

Using AI Code Generation

copy

Full Screen

1using B;2{3public static void Main()4{5GenX g = new GenX();6g.Show();7}8}9B.GenX.Show()10{11using B.GenX;12{13public static void Main()14{15GenX g = new GenX();16g.Show();17}18}19}20using B;21{22public void Show()23{24System.Console.WriteLine("B.GenX.Show()");25}26}27B.GenX.Show()28{29using B.GenX;30{31public static void Main()32{33GenX g = new GenX();34g.Show();35}36}37}38using B;39{40public void Show()41{42System.Console.WriteLine("B.GenX.Show()");43}44}45B.GenX.Show()46{47using B.GenX;48{49public static void Main()50{51GenX g = new GenX();52g.Show();53}54}55}56using B;57{58public void Show()59{60System.Console.WriteLine("B.GenX.Show()");61}62}63B.GenX.Show()

Full Screen

Full Screen

Nunit tutorial

Nunit is a well-known open-source unit testing framework for C#. This framework is easy to work with and user-friendly. LambdaTest’s NUnit Testing Tutorial provides a structured and detailed learning environment to help you leverage knowledge about the NUnit framework. The NUnit tutorial covers chapters from basics such as environment setup to annotations, assertions, Selenium WebDriver commands, and parallel execution using the NUnit framework.

Chapters

  1. NUnit Environment Setup - All the prerequisites and setup environments are provided to help you begin with NUnit testing.
  2. NUnit With Selenium - Learn how to use the NUnit framework with Selenium for automation testing and its installation.
  3. Selenium WebDriver Commands in NUnit - Leverage your knowledge about the top 28 Selenium WebDriver Commands in NUnit For Test Automation. It covers web browser commands, web element commands, and drop-down commands.
  4. NUnit Parameterized Unit Tests - Tests on varied combinations may lead to code duplication or redundancy. This chapter discusses how NUnit Parameterized Unit Tests and their methods can help avoid code duplication.
  5. NUnit Asserts - Learn about the usage of assertions in NUnit using Selenium
  6. NUnit Annotations - Learn how to use and execute NUnit annotations for Selenium Automation Testing
  7. Generating Test Reports In NUnit - Understand how to use extent reports and generate reports with NUnit and Selenium WebDriver. Also, look into how to capture screenshots in NUnit extent reports.
  8. Parallel Execution In NUnit - Parallel testing helps to reduce time consumption while executing a test. Deep dive into the concept of Specflow Parallel Execution in NUnit.

NUnit certification -

You can also check out the LambdaTest Certification to enhance your learning in Selenium Automation Testing using the NUnit framework.

YouTube

Watch this tutorial on the LambdaTest Channel to learn how to set up the NUnit framework, run tests and also execute parallel testing.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful