void Init( object sender, EventArgs args ) {
Server.InitLibrary( Environment.GetCommandLineArgs() );
Config.Load( false, false );
rankList = RankManager.Ranks.Select( r => r.Prefix + r.Name ).ToArray();
cFromRank.Items.AddRange( rankList );
cToRank.Items.AddRange( rankList );
using( LogRecorder recorder = new LogRecorder() ) {
AutoRankManager.Init();
if( recorder.HasMessages ) {
MessageBox.Show( recorder.MessageString, "Loading autorank.xml..." );
}
}
if( AutoRankManager.HasCriteria ) {
foreach( Criterion crit in AutoRankManager.Criteria ) {
ActionNode newNode = new ActionNode {
Action = ActionType.Automatic,
FromRank = crit.FromRank,
ToRank = crit.ToRank
};
if( crit.Condition is ConditionAND ) {
newNode.Op = GroupNodeType.AND;
} else if( crit.Condition is ConditionOR ) {
newNode.Op = GroupNodeType.OR;
} else if( crit.Condition is ConditionNAND ) {
newNode.Op = GroupNodeType.NAND;
} else if( crit.Condition is ConditionNOR ) {
newNode.Op = GroupNodeType.NOR;
} else {
throw new FormatException();
}
foreach( Condition subCondition in crit.Condition.Conditions ) {
ImportCondition( newNode, subCondition );
}
treeData.Nodes.Add( newNode );
newNode.UpdateLabel();
}
} else {
treeData.Nodes.Add( new ActionNode() );
}
treeData.ExpandAll();
treeData.SelectedNode = treeData.Nodes[0];
}