Skip to content

Tim-Unger/AiracGen

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AiracGen

Quickstart

  • Vars are explicitly declared on purpose to help with documentation

  • List<Airac> is always sorted by oldest first, you will need to run your own OrderBy() to re-sort the list to your liking

  • Ident is a string on purpose, if we used int, we would get incorrect idents when parsing (0901 would become 901 which is not a valid ident)

using AiracGen;

Generate Airacs in the future

int airacAmount = 100;

List<Airac> airacs = AiracGenerator.GenerateFuture(airacAmount);

Generate Airacs in the past

int airacAmount = 100;

List<Airac> airacs = AiracGenerator.GeneratePast(airacAmount);

Generate Airacs in the past and future

int pastAiracAmount = 10;
int futureAiracAmount = 100;

List<Airac> airacs = AiracGenerator.GeneratePastAndFuture(pastAiracAmount, futureAiracAmount);

Generate the current Airac

Airac currentAirac = AiracGenerator.GenerateCurrent();

Generate the next Airac

(optional) you can provide a "base" ident from which the next Airac will be returned

Airac nextAirac = AiracGenerator.GenerateNext((optional)string ident);

Generate the previous Airac

(optional) you can provide a "base" ident from which the previous Airac will be returned

Airac previousAirac = AiracGenerator.GeneratePrevious((optional)string ident);

Generate a single Airac by ident

Airac singleAirac = AiracGenerator.GenerateSingle("2301");

Generate multiple Airacs by ident

List<Airac> multipleAiracs = AiracGenerator.GenerateMultiple("2301", "2302", "2303");

Generate all Airacs in a given year

If you only provide a two char long year, the system will assume that you mean the current century

List<Airac> airacs23 = AiracGenerator.GenerateByYear(2023);

Extension Methods

Generate an Airac-JSON

You can run ToJson() on Airac and List<Airac>

string airacListJson = AiracGenerator.GenerateFuture(10).ToJson;
string airacJson = AiracGenerator.GenerateCurrent().ToJson;

Save an Airac-JSON

You can run SaveJson(strng path) on Airac and List<Airac>

This will save a .json to the provided path (you can use a full path (\airaclistname.json) or only the directory )

var currentDir = Environment.CurrentDirectory;
var airacs = AiracGenerator.GenerateFuture(10);
airacs.SaveJson(currentDir);

Get the next Airac based on the selected Airac

var nextAirac = AiracGenerator.GenerateSingle(2311).NextAirac();

Get the previous Airac based on the selected Airac

var nextAirac = AiracGenerator.GenerateSingle(2311).PreviousAirac();

AiracGenCLI

Simple Command-Application to quickly create a JSON with Airacs

Just define the amount of past and future airacs you want to generate (current airac will always be generated) The JSON will be written to \Airacs.json