Beispiel #1
0
		public override void BuildFormula()
		{
			Formula = new FormulaBuilder();
			if (Device.GKReflectionItem.GKBases.Count == 0)
			{
				Formula.Add(FormulaOperationType.END);
				return;
			}
			int count;

			if (Device.DriverType == GKDriverType.FirefightingZonesMirror)
			{
				count = 0;
				foreach (var gkBase in Device.GKReflectionItem.Diretions)
				{
					Formula.AddGetWord(false, gkBase);
					count++;
					if (count > 1)
					{
						Formula.Add(FormulaOperationType.OR);
					}
				}
				Formula.Add(FormulaOperationType.CONST, 0, 0xFFF1);
				Formula.Add(FormulaOperationType.AND);

				count = 0;
				foreach (var gkBase in Device.GKReflectionItem.Zones)
				{
					Formula.AddGetWord(false, gkBase);
					count++;
					if (count > 1)
					{
						Formula.Add(FormulaOperationType.OR);
					}
				}
				if (count > 0)
				{
					Formula.Add(FormulaOperationType.CONST, 0, 0xE);
					Formula.Add(FormulaOperationType.AND);
					Formula.Add(FormulaOperationType.OR);
				}
				Formula.AddPutWord(false, Device);
			}
			else
			{
				count = 0;
				foreach (var gkBase in Device.GKReflectionItem.GKBases)
				{
					Formula.AddGetWord(false, gkBase);
					count++;
					if (count > 1)
					{
						Formula.Add(FormulaOperationType.OR);
					}
				}
				Formula.AddPutWord(false, Device);
			}

			Formula.Add(FormulaOperationType.CONST, 0, 0x400);
			Formula.AddPutWord(true, Device);
		}