﻿/****************************************************************
        _________  __           __ __   __          
        \_   ___ \|  |_________|__|  | |  |   ____  
        /    \  \/|  |  \_  __ \  |  | |  | _/ __ \ 
        \     \___|   Y  \  | \/  |  |_|  |_\  ___/ 
         \______  /___|  /__|  |__|____/____/\___  >
                \/     \/                        \/ 

                     .ed"""" """$$$$be.
                   -"           ^""**$$$e.  
                 ."                   '$$$c    
                /                      "4$$b   
               d  3                      $$$$   
               $  *                   .$$$$$$    
              .$  ^c           $$$$$e$$$$$$$$.
              d$L  4.         4$$$$$$$$$$$$$$b    
              $$$$b ^ceeeee.  4$$ECL.F*$$$$$$$   
  e$""=.      $$$$P d$$$$F $ $$$$$$$$$- $$$$$$  
 z$$b. ^c     3$$$F "$$$$b   $"$$$$$$$  $$$$*"      .=""$c
4$$$$L         $$P"  "$$b   .$ $$$$$...e$$         .=  e$$$.    
^*$$$$$c  %..   *c    ..    $$ 3$$$$$$$$$$eF     zP  d$$$$$     
  "**$$$ec   "   %ce""    $$$  $$$$$$$$$$*    .r" =$$$$P""
        "*$b.  "c  *$e.    *** d$$$$$"L$$    .d"  e$$***"
          ^*$$c ^$c $$$      4J$$$$$% $$$ .e*".eeP"
             "$$$$$$"'$=e....$*$$**$cz$$" "..d$*"
               "*$$$  *=%4.$ L L$ P3$$$F $$$P"
                  "$   "%*ebJLzb$e$$$$$b $P"
                    %..      4$$$$$$$$$$ "
                     $$$e   z$$$$$$$$$$%
                      "*$c  "$$$$$$$P"
                       ."""*$$$$$$$$bc
                    .-"    .$***$$$"""*e.
                 .-"    .e$"     "*$c  ^*b.
          .=*""""    .e$*"          "*bc  "*$e..
        .$"        .z*"               ^*$e.   "*****e.
        $$ee$c   .d"                     "*$.        3.
        ^*$E")$..$"                         *   .ee==d%
           $.d$$$*                           *  J$$$e*
            """""                              "$$$"

****************************************************************/

	Changelog:
	[+]		New functionality
	[-]		Removed functionality
	[!]		Bug fixed
	[#]		Changed behavior

	0.9.2
			Initial OneDrive 2019-05-15

	0.9.3
			[!] Some bugs fixed
			[#] Segments with fixed lunch/break can now be moved
				If a segment is moved the 'fixed' time is shifted so the break has always the same duration
			[+] Use arrow keys (<-- / -->) to move segments +/- 1 minute (popup shows starttime of segment during move)
			[+] If a segments endtime is changed in 'details' all the other segments after the changed one, that day, is moved to reflect the new endtime
			[#] Changed random generator
	0.9.4
			[#] TimescheduleDetail: Changed text "Starttid" => "Starttid Sen. WUG"
			[#]	TimeschedultCtrl: Popup text (description): "Grupp som startar senare"
			[+] If Latergroup is > 0 and latertime = "00:00:00" error messagebox
			[#] IsuCalcFSNewCompetition.Create(): Changed default for judging first/last to be equal per segment
			[#] IsuCalcFSNewCompetition.Create(): Changed segment status (short program) from "Before Draw" to "Starting Order Ready"
				Else Timeschedule link is not active in HTML
			[!] EVT_ID in timeschedule not set
			[#] New version of Newtonsoft.Json, not everything was saved ....
			[!] Try catch when saving timeschedule overview
			[#] decimal ToString("N0") to remove decimal places
			[!] MoveAllLaterSegments(): wrong start time as parameter when called from gantt1_ItemDoubleClick()
			    Moved ALL segments on the first day even though the change was on the second day
	0.9.5
			[#] All classes in IndTACompetitionExportXml.cs now have default values
			[!] OnReceiveLog(): InvokeRequired if other thread
			[!] Create empty PPC if no PPC found in IndTA export
			[!] Color array out of range in TimescheduleCtrl.cs
			[!] Administration: Trim strings when parsing IndTA mapping XLS (or else we could get e.g. an space after and wizard couldn't get right mapping)
			[!] Disable Timeschedule splitcontainer panel left
			[#] No back button on "Overview" page
			[+] If timeschedule is created and we go back and delete a skater, number of skaters in that class is changed but NOT the timeschedule.
			    A warning box is shown when deleting and the popup over the class in timeschedule states that it was changed.
				The flag is only resetted when you push OK in detail dialog.
			[!] Setup judges per category: When mapping JudgesPerCategory we mapped against ISUTypeLevelGender which can be same in lots of classes.
			    Now we map against IndTA class and discipline

	0.9.6
			[#] New IndTA XLS-file for mappings. New format.
			    Added Warmup SP/FS columns (as time, e.g. 06:00)
				Changed SP/FS columns format to: 
				   If IsuCalcFS default is used ==> 'X'
				   If not ==> performance time e.g. 02:40
			[!] Bugg in JudgeFirst/Last: if only one segment ==> SP was used, wrong!

	0.9.7	2019-08-26
			[!] IsuCalcFSImportEntries.GetCategory returned first IsuTypeLevelGender ==> more then one class can have the same IsuTypeLevelGender
			    New function IsuCalcFSImportEntries.GetCatAndSegment(SP_ID, ref cat)
			[#] New IndTA XML format: Skip coach ("Tränare") elements when iterating through IndTA exported XML file

	1.0.0	2019-08-26: First official release (0.9.7)

	1.0.1	2019-08-27
			[!] Resurface time was not filled (TimescheduleDetail): TIM_RESDR1 - TIM_RESDR5 was not set
			[!] Calculate warmupgroups must set: SCP_WUG01-SCP_WUG10
			[!] Only worked for SP: SCP_WUG01-SCP_WUG10, not set for FS
			[!] 15 min default on TIM_RESDR1 - TIM_RESDR9

	1.0.2	2019-08-28
			[#] Saves (in JSON) and set "Max skaters in warmup group"-numeric box (TimescheduleDetail:numMaxInWug)
			    Also when we doubleclick on segment the last setting is displayed in box.
			[#] Shows how many competitors in each class in Tab:Tävlande
			[#] Shows how many judges in each class in Tab:Domare
			[#] Shows how many competitors / day in Timeschedule:Overview

	1.0.3	2019-09-10
			[!] Timeschedule detail: Resurface after Warmup-group was max 5 ==> max 9
			[+] "Spara Tävling" button in caption
			[!] Changed all decimal values (XXX_ID) to only show integer (ToString("N0))
			[!] Remove all participants in a class ==> still one left. Should be zero
			[#] Warning if later start group is after all warmup groups.
			[!] Timeschedule detail: when init ==> Calculate duration of segment so Schedule-tab is up to date first time

	1.0.4
			[#] Competition name in caption
			[#] Footer in timeschedule overview changed to show wizard version
			[#] Later WUG change max 8 --> 9
			[#] Timeschedule detail: Resurface after Warmup-group max 10
			[!] Bugg if aborted import of saved competition
			[!] In timeschedule if num skaters =0
			[!] Set wrong TIM_ID to zero so when saved competition all 'real' TIM_ID's was set to 0

	1.0.5
			[!] Fixed in 1.0.2 but was commented in previous version. Now fixed again!
			    Saves (in JSON) and set "Max skaters in warmup group"-numeric box (TimescheduleDetail:numMaxInWug)
			    Also when we doubleclick on segment the last setting is displayed in box.
			[!] If Later WUG was removed (0) => time was set anyway
			[#] Updated BaseData to IsuCalcFS 3.5.5

	1.0.6
			[!] Bugg in PPC when only freeprogram (Minior). IsuCalcFS didn't behave as I was expected.
				PEL_1Nxxx is always SP, PEL_2Nxxx is always FS!
			[#] Added context menu for judges "Ändra Domare" (same as doubleclick)
			[#] Removed all "Spare" Clubs and judges when exporting to IsuCalcFS XML

	1.0.7
			[+] First attempt to support Synchro!!
			[!] When importing into IsuCalcFS ==> judges etc. is screwed up!!! All ID's are wrong
				version 1.0.6 is useless.
				Removed the code that 'removed all spare clubs and officials'
				Because IsuCalcFS just increment all ID's when an entry is created and doesn't give a damn about the ID's i've put there.....
				My bad ;)
			[#] All decimal ID was  e.g. "1.0" instead of no decimal places "1"
				New json.net class to handle decimals when serializing (save).
				
	1.0.8
			[!] Confusion between wizard and IsuCalcFS how to set "Later Warmup Group".
			    Wizard ==> Wug that should start later
				IsuCalc ==> After wug that should start later
			[!] When exporting: Removed all timeschedule that has start time before competition (not placed on competitiondays yet)
			[#] When more than 10 minutes between segment-end and next segment-start => show 'Break' in timeschedule overview
			[#] Creates HTML (Entries, Timeschedule and PDF) to publish on homesite, without having to start IsuCalcFS

	1.0.9
			[!] Large letters on HTML export fileextension.
			[#] Changed color in HTML

	1.0.10
			[#] Max 40 chars on Coach, MusicSP, MusicFS to solve the crash (IsuCalcFS) when importing in IsuCalcFS

	1.1.0	CANNOT USE PREVIOUS SAVED COMPETITIONS FROM EARLIER VERSIONS
			Minor version number update due to new import logic in IsuCalcFS 3.5.5 or 3.5.6
			[#] All spare officials is linked to first club, previous '0' (none)
			[#] Check for length in all EVT_xxx
			[#] Added TeamID to PCT_EXTDT
			[#] Changed XML template for import in ISU

	1.1.1	CANNOT USE PREVIOUS SAVED COMPETITIONS FROM EARLIER VERSIONS
			[#] Synchro is now supported but not much tested
			[#] Added Nation to Officials and Competitors
			[!] Changed XML template for import in ISU to solve bugg with clubs not all fields set
			[#] Changed XML template for import in ISU in order to add Nation + PCT_EXTDT
			[#] Changed XML template for import in ISU to different PCT name-fields if Synchro or Singel/Pair
			[#] Added ForeningID to clubs and changed field from uint to string internally
			[#] Changed internal struct 'BasicOfficial' to also hold club
			[#] Set PCT_NAT and PAR_NAT to 'SWE' if 'Nationality' is 'sverige'

	1.1.2
			[#] Changed IndTA adult-classes names
			[#] Removed Nation on competitors

	1.1.3
			[#] IndTA XML format changed: 2 new classes 'Avanmälan 1 program', 'Avanmälan 2 program'
			[#] IsuCalcFSNewCompetition.Create(). Array of not valid classes which is checked. Log if not valid.
			[#] Added Classname to logger output

	2.0.0	(2022 first version to support FSManager)
			[+]	Added functionality for FSManager
			[#]	New/Changed columns in XLS-file
			[#]	IndTAIsuCalcFSSegmentsMapping.xml added performance time, HalfTime and MaxInWUG
			[#]	IndTAIsuCalcFSSegmentsMapping-Star.xml new mapping for StarComp
			[#]	Removed Pair/Ice Dance. NOTE!!! NOT SUPPORTED ANYMORE
			[!] Fixed valid filename for IsuCalcFS import xml
			[#] Skip disciplines with 0 competitors
			[#] New logger (more info)
			[#] Changed to english language
			[+] Added functionality to import StarFS files, in order to create timeschedule

	2.0.1
			[!] When adding a judge ==> always 'Male'
			[#] StarFS timeschedule: JudgingFirst/Last changed to 30 sec
			[#] IndTA XML format changed: 1 new classes "Lagledare" ifrån IndTA fil

	2.0.2
			[#] Added birthday for person/participant to saved JSON
			[#] Allowed StarFS competitions to add judges and draw startorder/judges


	2.0.3
			[#] IndTA XML format changed: 1 new classes 'Reserver'
			[#] Show PCT_ID instead of PAR_ID in Competitors ListView

	2.0.4
			[!] When removing a competitor ==A searched for PAR_ID (but that was changed in prev ver, see above)

	2.0.5
			[#] Updated newtonsoft version
			[#] NEW BASE DATA

	2.0.6
			[#] Took away judge role SKD2. It's not supported in FSM

	2.0.7
			[#] "Föreningstävlingar" = StarFS

	2.0.8
			[#] "Home Page" =  https://skate.webbplatsen.net/

	2.0.9
			[#] "System 1" = StarFS

	2.1.0
			[#] Warning if judge declared as BOTH SKD and PD
	TODO:


