예제 #1
0
        public void CBI1()
        {
            Subsystem ss = new Subsystem(Subsystem.SUB_600KHZ_VERT_PISTON_B, 1);
            AdcpSubsystemCommands ssc = new AdcpSubsystemCommands(new SubsystemConfiguration(ss, 4, 0));
            ssc.CBI_NumEnsembles = 3;
            ssc.CBI_BurstInterval = new TimeValue(0, 0, 1, 0);

            Assert.AreEqual("CBI[4] 00:00:01.00,3,1", ssc.CBI_CmdStr(), "CBI Cmd Str is incorrect.");
        }
	public SubsystemIO (Subsystem subsystem)
	{
		name = subsystem.name;
		UID = subsystem.UID;
		gameObject = subsystem.gameObject.ToString ();
		startCamDistance = subsystem.startCamDistance;
		startCamRotation = subsystem.startCamRotation;
		textAbout = subsystem.textAbout;
	}
예제 #3
0
        public void AdcpSubsystemConfigExist()
        {
            AdcpConfiguration config = new AdcpConfiguration();
            SerialNumber serial = new SerialNumber("01200000000000000000000000000004");
            Dictionary<string, AdcpSubsystemConfig> result = config.SetCepo("2", serial);

            Subsystem ss = new Subsystem("2", 0);                                   // Subsystem code and Index within serial number
            SubsystemConfiguration ssConfig = new SubsystemConfiguration(ss, 0, 0);        // Number of configurations for a given subsystem

            Assert.AreEqual(true, config.AdcpSubsystemConfigExist(ssConfig), "AdcpSubsystemConfigExist() is incorrect.");
        }
예제 #4
0
        /// <summary>
        /// Creates PE header builder.
        /// </summary>
        /// <exception cref="ArgumentOutOfRangeException">
        /// <paramref name="fileAlignment"/> is not power of 2 between 512 and 64K, or
        /// <paramref name="sectionAlignment"/> not power of 2 or it's less than <paramref name="fileAlignment"/>.
        /// </exception>
        public PEHeaderBuilder(
            Machine machine = 0,
            int sectionAlignment = 0x2000,
            int fileAlignment = 0x200,
            ulong imageBase = 0x00400000,
            byte majorLinkerVersion = 0x30, // (what is ref.emit using?)
            byte minorLinkerVersion = 0,
            ushort majorOperatingSystemVersion = 4,
            ushort minorOperatingSystemVersion = 0,
            ushort majorImageVersion = 0,
            ushort minorImageVersion = 0,
            ushort majorSubsystemVersion = 4,
            ushort minorSubsystemVersion = 0,
            Subsystem subsystem = Subsystem.WindowsCui,
            DllCharacteristics dllCharacteristics = DllCharacteristics.DynamicBase | DllCharacteristics.NxCompatible | DllCharacteristics.NoSeh | DllCharacteristics.TerminalServerAware,
            Characteristics imageCharacteristics = Characteristics.Dll,
            ulong sizeOfStackReserve = 0x00100000,
            ulong sizeOfStackCommit = 0x1000,
            ulong sizeOfHeapReserve = 0x00100000,
            ulong sizeOfHeapCommit = 0x1000)
        {
            if (fileAlignment < 512 || fileAlignment > 64 * 1024 || BitArithmetic.CountBits(fileAlignment) != 1)
            {
                Throw.ArgumentOutOfRange(nameof(fileAlignment));
            }

            if (sectionAlignment < fileAlignment || BitArithmetic.CountBits(sectionAlignment) != 1)
            {
                Throw.ArgumentOutOfRange(nameof(sectionAlignment));
            }

            Machine = machine;
            SectionAlignment = sectionAlignment;
            FileAlignment = fileAlignment;
            ImageBase = imageBase;
            MajorLinkerVersion = majorLinkerVersion;
            MinorLinkerVersion = minorLinkerVersion;
            MajorOperatingSystemVersion = majorOperatingSystemVersion;
            MinorOperatingSystemVersion = minorOperatingSystemVersion;
            MajorImageVersion = majorImageVersion;
            MinorImageVersion = minorImageVersion;
            MajorSubsystemVersion = majorSubsystemVersion;
            MinorSubsystemVersion = minorSubsystemVersion;
            Subsystem = subsystem;
            DllCharacteristics = dllCharacteristics;
            ImageCharacteristics = imageCharacteristics;
            SizeOfStackReserve = sizeOfStackReserve;
            SizeOfStackCommit = sizeOfStackCommit;
            SizeOfHeapReserve = sizeOfHeapReserve;
            SizeOfHeapCommit = sizeOfHeapCommit;
        }
예제 #5
0
        public void TestConstructor()
        {
            // Create a serial number
            string serialStr = "01300000000000000000000000000001";
            SerialNumber serialNum = new SerialNumber(serialStr);

            // Test the serial number
            Assert.AreEqual(serialStr, serialNum.ToString(), string.Format("Serial number strings did not match {0}  {1}", serialStr, serialNum.ToString()));
            Assert.AreEqual(1, serialNum.SubSystemsDict.Count, string.Format("Number of SubSystems did not match 1 {0}", serialNum.SubSystemsDict.Count));

            Subsystem ss = new Subsystem("3", 0);
            Assert.AreEqual(ss, serialNum.SubSystemsDict[0], string.Format("Subsystems do not match {0}  {1}", ss.ToString(), serialNum.SubSystemsDict[0].ToString()));

            Assert.AreEqual(1, serialNum.SystemSerialNumber, string.Format("Serial numbers do not match {0}  {1}", 1, serialNum.SystemSerialNumber));
        }
예제 #6
0
        public void TestConstructor()
        {
            Subsystem ss = new Subsystem(Subsystem.SUB_1_2MHZ_4BEAM_20DEG_PISTON_2, 0);         // 1200kHz
            SubsystemConfiguration ssConfig = new SubsystemConfiguration(ss, 0, 0);                    // 0 Config
            int cepoIndex = 0;
            AdcpSubsystemConfig asConfig = new AdcpSubsystemConfig(ssConfig);
            string asConfigStr = AdcpSubsystemConfig.GetString(ssConfig);

            Assert.AreEqual(asConfig.SubsystemConfig.CepoIndex, cepoIndex, "CepoIndex is incorrect.");
            //Assert.AreEqual(asConfig.Commands.CepoIndex, cepoIndex, "Commands CEPO index is incorrect.");
            Assert.AreEqual(asConfig.SubsystemConfig.SubSystem, ss, "Subsystem is incorrect.");
            Assert.AreEqual(asConfig.SubsystemConfig, ssConfig, "SubsystemConfiguration is incorrect.");
            Assert.AreEqual(asConfig.ToString(), "[0] 1.2 MHz 4 beam 20 degree piston", "ToString is incorrect.");
            Assert.AreEqual(asConfigStr, "[0] 1.2 MHz 4 beam 20 degree piston", "GetString is incorrect.");
        }
예제 #7
0
        public void Test150KhzFrequency()
        {
            // Create a serial number
            string serialStr = "01K00000000000000000000000000001";
            SerialNumber serialNum = new SerialNumber(serialStr);

            // Test the serial number
            Assert.AreEqual(serialStr, serialNum.ToString(), string.Format("Serial number strings did not match {0}  {1}", serialStr, serialNum.ToString()));
            Assert.AreEqual(1, serialNum.SubSystemsList.Count, string.Format("Number of SubSystems did not match 1 {0}", serialNum.SubSystemsList.Count));

            // Upper case K
            Subsystem ss = new Subsystem("K", 0);
            Assert.AreEqual(ss, serialNum.SubSystemsList[0], string.Format("Subsystems do not match {0}  {1}", ss.ToString(), serialNum.SubSystemsList[0].ToString()));

            // Lower case k
            Subsystem ss1 = new Subsystem("k", 0);
            Assert.AreNotEqual(ss1, serialNum.SubSystemsList[0], string.Format("Subsystems should not match {0}  {1}", ss1.ToString(), serialNum.SubSystemsList[0].ToString()));

            Assert.AreEqual(1, serialNum.SystemSerialNumber, string.Format("Serial numbers do not match {0}  {1}", 1, serialNum.SystemSerialNumber));
        }
예제 #8
0
 public PEHeaderBuilder(
     Machine machine = 0,
     int sectionAlignment = 0x2000,
     int fileAlignment = 0x200,
     ulong imageBase = 0x00400000,
     byte majorLinkerVersion = 0x30, // (what is ref.emit using?)
     byte minorLinkerVersion = 0,
     ushort majorOperatingSystemVersion = 4,
     ushort minorOperatingSystemVersion = 0,
     ushort majorImageVersion = 0,
     ushort minorImageVersion = 0,
     ushort majorSubsystemVersion = 4,
     ushort minorSubsystemVersion = 0,
     Subsystem subsystem = Subsystem.WindowsCui,
     DllCharacteristics dllCharacteristics = DllCharacteristics.DynamicBase | DllCharacteristics.NxCompatible | DllCharacteristics.NoSeh | DllCharacteristics.TerminalServerAware,
     Characteristics imageCharacteristics = Characteristics.Dll,
     ulong sizeOfStackReserve = 0x00100000,
     ulong sizeOfStackCommit = 0x1000,
     ulong sizeOfHeapReserve = 0x00100000,
     ulong sizeOfHeapCommit = 0x1000)
 {
     Machine = machine;
     SectionAlignment = sectionAlignment;
     FileAlignment = fileAlignment;
     ImageBase = imageBase;
     MajorLinkerVersion = majorLinkerVersion;
     MinorLinkerVersion = minorLinkerVersion;
     MajorOperatingSystemVersion = majorOperatingSystemVersion;
     MinorOperatingSystemVersion = minorOperatingSystemVersion;
     MajorImageVersion = majorImageVersion;
     MinorImageVersion = minorImageVersion;
     MajorSubsystemVersion = majorSubsystemVersion;
     MinorSubsystemVersion = minorSubsystemVersion;
     Subsystem = subsystem;
     DllCharacteristics = dllCharacteristics;
     ImageCharacteristics = imageCharacteristics;
     SizeOfStackReserve = sizeOfStackReserve;
     SizeOfStackCommit = sizeOfStackCommit;
     SizeOfHeapReserve = sizeOfHeapReserve;
     SizeOfHeapCommit = sizeOfHeapCommit;
 }
예제 #9
0
        public void TestAddSubsystem()
        {
            // Create a serial number
            string serialStr = "01300000000000000000000000000001";
            SerialNumber serial = new SerialNumber(serialStr);

            Subsystem ss1 = new Subsystem(Subsystem.SUB_1_2MHZ_4BEAM_20DEG_PISTON_2, 1);
            serial.AddSubsystem(ss1);

            Assert.AreEqual(2, serial.SubSystemsList.Count, "Dictionary count is incorrect.");

            Assert.AreEqual("320000000000000", serial.SubSystems, "Subsystem String is incorrect.");
            Assert.AreEqual(2, serial.SubSystemsList.Count, "Subsystem Dict Count is incorrect.");

            // Subsystem type 3
            Subsystem ss = new Subsystem("3", 0);
            Assert.AreEqual(ss, serial.SubSystemsList[0], string.Format("Subsystems do not match {0}  {1}", ss.ToString(), serial.SubSystemsList[0].ToString()));

            // Subsystem type 2
            Assert.AreEqual(ss1, serial.SubSystemsList[1], string.Format("Subsystems do not match {0}  {1}", ss1.ToString(), serial.SubSystemsList[1].ToString()));
        }
예제 #10
0
        public void TestJSON()
        {
            Subsystem ss = new Subsystem(Subsystem.SUB_1_2MHZ_4BEAM_20DEG_PISTON_2, 0);         // 1200kHz
            SubsystemConfiguration ssConfig = new SubsystemConfiguration(ss, 0, 0);                    // 0 Config
            int cepoIndex = 0;
            AdcpSubsystemConfig asConfig = new AdcpSubsystemConfig(ssConfig);

            string json = Newtonsoft.Json.JsonConvert.SerializeObject(asConfig);                                        // Serialize object to JSON
            AdcpSubsystemConfig newConfig = Newtonsoft.Json.JsonConvert.DeserializeObject<AdcpSubsystemConfig>(json);   // Deserialize the JSON

            Assert.AreEqual(asConfig.SubsystemConfig.CepoIndex, cepoIndex, "CepoIndex is incorrect.");
            //Assert.AreEqual(asConfig.Commands.CepoIndex, cepoIndex, "Commands CEPO index is incorrect.");
            Assert.AreEqual(asConfig.SubsystemConfig.SubSystem, ss, "Subsystem is incorrect.");
            Assert.AreEqual(asConfig.SubsystemConfig, ssConfig, "SubsystemConfiguration is incorrect.");
            Assert.AreEqual(asConfig.ToString(), "[0] 1.2 MHz 4 beam 20 degree piston", "ToString is incorrect.");

            Assert.AreEqual(newConfig.SubsystemConfig.CepoIndex, cepoIndex, "CepoIndex is incorrect.");
            //Assert.AreEqual(newConfig.Commands.CepoIndex, cepoIndex, "Commands CEPO index is incorrect.");
            Assert.AreEqual(newConfig.SubsystemConfig.SubSystem, ss, "Subsystem is incorrect.");
            Assert.AreEqual(newConfig.SubsystemConfig, ssConfig, "SubsystemConfiguration is incorrect.");
            Assert.AreEqual(newConfig.ToString(), "[0] 1.2 MHz 4 beam 20 degree piston", "ToString is incorrect.");
        }
예제 #11
0
        public void CWPP()
        {
            Subsystem ss = new Subsystem(Subsystem.SUB_600KHZ_VERT_PISTON_B, 1);
            AdcpSubsystemCommands ssc = new AdcpSubsystemCommands(new SubsystemConfiguration(ss, 7, 0));
            ssc.CWPP = 33;

            Assert.AreEqual("CWPP[7] 33", ssc.CWPP_CmdStr(7), "CWPP Cmd Str is incorrect.");
        }
예제 #12
0
        public void CWPBB1()
        {
            Subsystem ss = new Subsystem(Subsystem.SUB_600KHZ_VERT_PISTON_B, 1);
            AdcpSubsystemCommands ssc = new AdcpSubsystemCommands(new SubsystemConfiguration(ss, 4, 0));
            ssc.CWPBB_TransmitPulseType = AdcpSubsystemCommands.eCWPBB_TransmitPulseType.BROADBAND_PULSE_TO_PULSE;
            ssc.CWPBB_LagLength = 0.0024f;

            Assert.AreEqual("CWPBB[4] 3,0.0024", ssc.CWPBB_CmdStr(), "CWPBB Cmd Str is incorrect.");
        }
예제 #13
0
        public void CWPAI1()
        {
            Subsystem ss = new Subsystem(Subsystem.SUB_600KHZ_VERT_PISTON_B, 1);
            AdcpSubsystemCommands ssc = new AdcpSubsystemCommands(new SubsystemConfiguration(ss, 4, 0));
            ssc.CWPAI = new TimeValue(0, 0, 1, 0);

            Assert.AreEqual("CWPAI[4] 00:00:01.00", ssc.CWPAI_CmdStr(), "CWPAI Cmd Str is incorrect.");
        }
예제 #14
0
        public void CBTT1()
        {
            Subsystem ss = new Subsystem(Subsystem.SUB_600KHZ_VERT_PISTON_B, 1);
            AdcpSubsystemCommands ssc = new AdcpSubsystemCommands(new SubsystemConfiguration(ss, 4, 0));
            ssc.CBTT_SNRShallowDetectionThresh = 0.001f;
            ssc.CBTT_DepthSNR = 0.002f;
            ssc.CBTT_SNRDeepDetectionThresh = 0.003f;
            ssc.CBTT_DepthGain = 0.004f;

            Assert.AreEqual("CBTT[4] 0.001,0.002,0.003,0.004", ssc.CBTT_CmdStr(), "CBTT Cmd Str is incorrect.");
        }
예제 #15
0
        public void TestCWTTBP_CornerMax()
        {
            Subsystem ss = new Subsystem(Subsystem.SUB_600KHZ_VERT_PISTON_B, 1);
            AdcpSubsystemCommands ssc = new AdcpSubsystemCommands(new SubsystemConfiguration(ss, 0, 0));

            ssc.CWTTBP = AdcpSubsystemCommands.MAX_CWTTBP;

            Assert.AreEqual(AdcpSubsystemCommands.MAX_CWTTBP, ssc.CWTTBP, "CWTTBP is incorrect.");
        }
예제 #16
0
 public void AddRequires(Subsystem subsystem)
 {
     Requires(subsystem);
 }
예제 #17
0
 public bool isWeaponActive(Subsystem sub, WeaponType weapon)
 {
     return(activeWeapon[(int)sub] == weapon);
 }
예제 #18
0
        private void btnCommand_Click(object sender, EventArgs e)
        {
            string    strSender     = "";
            Subsystem ConfigureInfo = MachineInfo.SubsystemList.Find(str => str.Name == "试剂盘调试");

            switch (((SimpleButton)sender).Name)
            {
            case "btnClockwiseRotationOP1":
                strSender = ConfigureInfo.ComponetList.Find(componet => componet.Name == lblReagentDish1Debug.Text).CommandList.Find(command => command.FullName == btnClockwiseRotationOP1.Text).Name;
                break;

            case "btnContrarotateOP1":
                strSender = ConfigureInfo.ComponetList.Find(componet => componet.Name == lblReagentDish1Debug.Text).CommandList.Find(command => command.FullName == btnContrarotateOP1.Text).Name;
                break;

            case "btnRotateAR1":
                strSender = ConfigureInfo.ComponetList.Find(componet => componet.Name == lblReagentDish1Debug.Text).CommandList.Find(command => command.FullName == btnRotateAR1.Text).Name;
                break;

            case "btnRotateSS1":
                strSender = ConfigureInfo.ComponetList.Find(componet => componet.Name == lblReagentDish1Debug.Text).CommandList.Find(command => command.FullName == btnRotateSS1.Text).Name;
                break;

            case "btnOuterRingRestoration1":
                strSender = ConfigureInfo.ComponetList.Find(componet => componet.Name == lblReagentDish1Debug.Text).CommandList.Find(command => command.FullName == btnOuterRingRestoration1.Text).Name;
                break;

            case "btnOuterRingRestorationCS1":
                strSender = ConfigureInfo.ComponetList.Find(componet => componet.Name == lblReagentDish1Debug.Text).CommandList.Find(command => command.FullName == btnOuterRingRestorationCS1.Text).Name;
                break;

            case "btnInsideTrackRestoration1":
                strSender = ConfigureInfo.ComponetList.Find(componet => componet.Name == lblReagentDish1Debug.Text).CommandList.Find(command => command.FullName == btnInsideTrackRestoration1.Text).Name;
                break;

            case "btnInsideTrackRestorationCS1":
                strSender = ConfigureInfo.ComponetList.Find(componet => componet.Name == lblReagentDish1Debug.Text).CommandList.Find(command => command.FullName == btnInsideTrackRestorationCS1.Text).Name;
                break;

            case "btnReagentDishTBCS1":
                strSender = ConfigureInfo.ComponetList.Find(componet => componet.Name == lblReagentDish1Debug.Text).CommandList.Find(command => command.FullName == btnReagentDishTBCS1.Text).Name;
                break;

            case "btnBarCodeScanningCS1":
                strSender = ConfigureInfo.ComponetList.Find(componet => componet.Name == lblReagentDish1Debug.Text).CommandList.Find(command => command.FullName == btnBarCodeScanningCS1.Text).Name;
                break;

            case "btnBarCodeIO1":
                strSender = ConfigureInfo.ComponetList.Find(componet => componet.Name == lblReagentDish1Debug.Text).CommandList.Find(command => command.FullName == btnBarCodeIO1.Text).Name;
                break;

            case "btnBarCodeIC1":
                strSender = ConfigureInfo.ComponetList.Find(componet => componet.Name == lblReagentDish1Debug.Text).CommandList.Find(command => command.FullName == btnBarCodeIC1.Text).Name;
                break;

            case "btnClockwiseRotationOP2":
                strSender = ConfigureInfo.ComponetList.Find(componet => componet.Name == lblReagentDish2Debug.Text).CommandList.Find(command => command.FullName == btnClockwiseRotationOP2.Text).Name;
                break;

            case "btnContrarotateOP2":
                strSender = ConfigureInfo.ComponetList.Find(componet => componet.Name == lblReagentDish2Debug.Text).CommandList.Find(command => command.FullName == btnContrarotateOP2.Text).Name;
                break;

            case "btnRotateAR2":
                strSender = ConfigureInfo.ComponetList.Find(componet => componet.Name == lblReagentDish2Debug.Text).CommandList.Find(command => command.FullName == btnRotateAR2.Text).Name;
                break;

            case "btnRotateSS2":
                strSender = ConfigureInfo.ComponetList.Find(componet => componet.Name == lblReagentDish2Debug.Text).CommandList.Find(command => command.FullName == btnRotateSS2.Text).Name;
                break;

            case "btnOuterRingRestoration2":
                strSender = ConfigureInfo.ComponetList.Find(componet => componet.Name == lblReagentDish2Debug.Text).CommandList.Find(command => command.FullName == btnOuterRingRestoration2.Text).Name;
                break;

            case "btnOuterRingRestorationCS2":
                strSender = ConfigureInfo.ComponetList.Find(componet => componet.Name == lblReagentDish2Debug.Text).CommandList.Find(command => command.FullName == btnOuterRingRestorationCS2.Text).Name;
                break;

            case "btnInsideTrackRestoration2":
                strSender = ConfigureInfo.ComponetList.Find(componet => componet.Name == lblReagentDish2Debug.Text).CommandList.Find(command => command.FullName == btnInsideTrackRestoration2.Text).Name;
                break;

            case "btnInsideTrackRestorationCS2":
                strSender = ConfigureInfo.ComponetList.Find(componet => componet.Name == lblReagentDish2Debug.Text).CommandList.Find(command => command.FullName == btnInsideTrackRestorationCS2.Text).Name;
                break;

            case "btnReagentDishTBCS2":
                strSender = ConfigureInfo.ComponetList.Find(componet => componet.Name == lblReagentDish2Debug.Text).CommandList.Find(command => command.FullName == btnReagentDishTBCS2.Text).Name;
                break;

            case "btnBarCodeScanningCS2":
                strSender = ConfigureInfo.ComponetList.Find(componet => componet.Name == lblReagentDish2Debug.Text).CommandList.Find(command => command.FullName == btnBarCodeScanningCS2.Text).Name;
                break;

            case "btnBarCodeIO2":
                strSender = ConfigureInfo.ComponetList.Find(componet => componet.Name == lblReagentDish2Debug.Text).CommandList.Find(command => command.FullName == btnBarCodeIO2.Text).Name;
                break;

            case "btnBarCodeIC2":
                strSender = ConfigureInfo.ComponetList.Find(componet => componet.Name == lblReagentDish2Debug.Text).CommandList.Find(command => command.FullName == btnBarCodeIC2.Text).Name;
                break;

            default:
                break;
            }

            if (SendNetworkEvent != null && strSender != "")
            {
                SendNetworkEvent(strSender);
            }
        }
예제 #19
0
        public void TestChangeSubsystems1()
        {
            // Create a serial number
            string       serialStr = "01300000000000000000000000000001";
            SerialNumber serial    = new SerialNumber(serialStr);

            serial.SubSystems = "123456789ABCDEf";

            Assert.AreEqual("123456789ABCDEf", serial.SubSystems, "Subsystem String is incorrect.");
            Assert.AreEqual(15, serial.SubSystemsList.Count, "Subsystem Dict Count is incorrect.");

            // Subsystem type 1
            Subsystem ss = new Subsystem("1", 0);

            Assert.AreEqual(ss, serial.SubSystemsList[0], string.Format("Subsystems do not match {0}  {1}", ss.ToString(), serial.SubSystemsList[0].ToString()));

            // Subsystem type 2
            Subsystem ss1 = new Subsystem("2", 1);

            Assert.AreEqual(ss1, serial.SubSystemsList[1], string.Format("Subsystems do not match {0}  {1}", ss1.ToString(), serial.SubSystemsList[1].ToString()));

            // Subsystem type 3
            Subsystem ss2 = new Subsystem("3", 2);

            Assert.AreEqual(ss2, serial.SubSystemsList[2], string.Format("Subsystems do not match {0}  {1}", ss2.ToString(), serial.SubSystemsList[2].ToString()));

            // Subsystem type 4
            Subsystem ss3 = new Subsystem("4", 3);

            Assert.AreEqual(ss3, serial.SubSystemsList[3], string.Format("Subsystems do not match {0}  {1}", ss3.ToString(), serial.SubSystemsList[3].ToString()));

            // Subsystem type 5
            Subsystem ss4 = new Subsystem("5", 4);

            Assert.AreEqual(ss4, serial.SubSystemsList[4], string.Format("Subsystems do not match {0}  {1}", ss4.ToString(), serial.SubSystemsList[4].ToString()));

            // Subsystem type 6
            Subsystem ss5 = new Subsystem("6", 5);

            Assert.AreEqual(ss5, serial.SubSystemsList[5], string.Format("Subsystems do not match {0}  {1}", ss5.ToString(), serial.SubSystemsList[5].ToString()));

            // Subsystem type 7
            Subsystem ss6 = new Subsystem("7", 6);

            Assert.AreEqual(ss6, serial.SubSystemsList[6], string.Format("Subsystems do not match {0}  {1}", ss6.ToString(), serial.SubSystemsList[6].ToString()));

            // Subsystem type 8
            Subsystem ss7 = new Subsystem("8", 7);

            Assert.AreEqual(ss7, serial.SubSystemsList[7], string.Format("Subsystems do not match {0}  {1}", ss7.ToString(), serial.SubSystemsList[7].ToString()));

            // Subsystem type 9
            Subsystem ss8 = new Subsystem("9", 8);

            Assert.AreEqual(ss8, serial.SubSystemsList[8], string.Format("Subsystems do not match {0}  {1}", ss8.ToString(), serial.SubSystemsList[8].ToString()));

            // Subsystem type A
            Subsystem ss9 = new Subsystem("A", 9);

            Assert.AreEqual(ss9, serial.SubSystemsList[9], string.Format("Subsystems do not match {0}  {1}", ss9.ToString(), serial.SubSystemsList[9].ToString()));

            // Subsystem type B
            Subsystem ssB = new Subsystem("B", 10);

            Assert.AreEqual(ssB, serial.SubSystemsList[10], string.Format("Subsystems do not match {0}  {1}", ssB.ToString(), serial.SubSystemsList[10].ToString()));

            // Subsystem type C
            Subsystem ssC = new Subsystem("C", 11);

            Assert.AreEqual(ssC, serial.SubSystemsList[11], string.Format("Subsystems do not match {0}  {1}", ssC.ToString(), serial.SubSystemsList[11].ToString()));

            // Subsystem type D
            Subsystem ssD = new Subsystem("D", 12);

            Assert.AreEqual(ssD, serial.SubSystemsList[12], string.Format("Subsystems do not match {0}  {1}", ssD.ToString(), serial.SubSystemsList[12].ToString()));

            // Subsystem type E
            Subsystem ssE = new Subsystem("E", 13);

            Assert.AreEqual(ssE, serial.SubSystemsList[13], string.Format("Subsystems do not match {0}  {1}", ssE.ToString(), serial.SubSystemsList[13].ToString()));

            // Subsystem type f
            Subsystem ssf = new Subsystem("f", 14);

            Assert.AreEqual(ssf, serial.SubSystemsList[14], string.Format("Subsystems do not match {0}  {1}", ssf.ToString(), serial.SubSystemsList[14].ToString()));
        }
예제 #20
0
        /// <summary>
        /// Fill in PE header information into a PEHeaderBuilder used by PEBuilder.
        /// </summary>
        /// <param name="subsystem">Targeting subsystem</param>
        /// <param name="target">Target architecture to set in the header</param>
        public static PEHeaderBuilder Create(Subsystem subsystem, TargetDetails target, ulong imageBase)
        {
            bool is64BitTarget = target.PointerSize == sizeof(long);

            Characteristics imageCharacteristics = Characteristics.ExecutableImage | Characteristics.Dll;

            imageCharacteristics |= is64BitTarget ? Characteristics.LargeAddressAware : Characteristics.Bit32Machine;

            int  fileAlignment    = 0x200;
            bool isWindowsOr32bit = target.IsWindows || !is64BitTarget;

            if (isWindowsOr32bit)
            {
                // To minimize wasted VA space on 32-bit systems (regardless of OS),
                // align file to page boundaries (presumed to be 4K)
                //
                // On Windows we use 4K file alignment (regardless of ptr size),
                // per requirements of memory mapping API (MapViewOfFile3, et al).
                // The alternative could be using the same approach as on Unix, but that would result in PEs
                // incompatible with OS loader. While that is not a problem on Unix, we do not want that on Windows.
                fileAlignment = 0x1000;
            }

            int sectionAlignment = 0x1000;

            if (!isWindowsOr32bit)
            {
                // On 64bit Linux, we must match the bottom 12 bits of section RVA's to their file offsets. For this reason
                // we need the same alignment for both.
                //
                // In addition to that we specify section RVAs to be at least 64K apart, which is > page on most systems.
                // It ensures that the sections will not overlap when mapped from a singlefile bundle, which introduces a sub-page skew.
                //
                // Such format would not be accepted by OS loader on Windows, but it is not a problem on Unix.
                sectionAlignment = fileAlignment;
            }

            // Without NxCompatible the PE executable cannot execute on Windows ARM64
            DllCharacteristics dllCharacteristics =
                DllCharacteristics.DynamicBase |
                DllCharacteristics.NxCompatible |
                DllCharacteristics.TerminalServerAware;

            if (is64BitTarget)
            {
                dllCharacteristics |= DllCharacteristics.HighEntropyVirtualAddressSpace;
            }
            else
            {
                dllCharacteristics |= DllCharacteristics.NoSeh;
            }

            return(new PEHeaderBuilder(
                       machine: target.MachineFromTarget(),
                       sectionAlignment: sectionAlignment,
                       fileAlignment: fileAlignment,
                       imageBase: imageBase,
                       majorLinkerVersion: PEHeaderConstants.MajorLinkerVersion,
                       minorLinkerVersion: PEHeaderConstants.MinorLinkerVersion,
                       majorOperatingSystemVersion: PEHeaderConstants.MajorOperatingSystemVersion,
                       minorOperatingSystemVersion: PEHeaderConstants.MinorOperatingSystemVersion,
                       majorImageVersion: PEHeaderConstants.MajorImageVersion,
                       minorImageVersion: PEHeaderConstants.MinorImageVersion,
                       majorSubsystemVersion: PEHeaderConstants.MajorSubsystemVersion,
                       minorSubsystemVersion: PEHeaderConstants.MinorSubsystemVersion,
                       subsystem: subsystem,
                       dllCharacteristics: dllCharacteristics,
                       imageCharacteristics: imageCharacteristics,
                       sizeOfStackReserve: (is64BitTarget ? PE64HeaderConstants.SizeOfStackReserve : PE32HeaderConstants.SizeOfStackReserve),
                       sizeOfStackCommit: (is64BitTarget ? PE64HeaderConstants.SizeOfStackCommit : PE32HeaderConstants.SizeOfStackCommit),
                       sizeOfHeapReserve: (is64BitTarget ? PE64HeaderConstants.SizeOfHeapReserve : PE32HeaderConstants.SizeOfHeapReserve),
                       sizeOfHeapCommit: (is64BitTarget ? PE64HeaderConstants.SizeOfHeapCommit : PE32HeaderConstants.SizeOfHeapCommit)));
        }
예제 #21
0
        /// <summary>
        /// Fill in PE header information into a PEHeaderBuilder used by PEBuilder.
        /// </summary>
        /// <param name="relocsStripped">Relocs are not present in the PE executable</param>
        /// <param name="dllCharacteristics">Extra DLL characteristics to apply</param>
        /// <param name="subsystem">Targeting subsystem</param>
        /// <param name="target">Target architecture to set in the header</param>
        public static PEHeaderBuilder Create(Characteristics imageCharacteristics, DllCharacteristics dllCharacteristics, Subsystem subsystem, TargetDetails target)
        {
            bool is64BitTarget = target.PointerSize == sizeof(long);

            imageCharacteristics &= ~(Characteristics.Bit32Machine | Characteristics.LargeAddressAware);
            imageCharacteristics |= (is64BitTarget ? Characteristics.LargeAddressAware : Characteristics.Bit32Machine);

            ulong imageBase = PE32HeaderConstants.ImageBase;

            if (target.IsWindows && is64BitTarget && (imageBase <= uint.MaxValue))
            {
                // Base addresses below 4 GiB are reserved for WoW on x64 and disallowed on ARM64.
                // If the input assembly was compiled for anycpu, its base address is 32-bit and we need to fix it.
                imageBase = (imageCharacteristics & Characteristics.Dll) != 0 ? PE64HeaderConstants.DllImageBase : PE64HeaderConstants.ExeImageBase;
            }

            int fileAlignment = 0x200;

            if (!target.IsWindows && !is64BitTarget)
            {
                // To minimize wasted VA space on 32 bit systems align file to page bounaries (presumed to be 4K).
                fileAlignment = 0x1000;
            }

            int sectionAlignment = 0x1000;

            if (!target.IsWindows && is64BitTarget)
            {
                // On Linux, we must match the bottom 12 bits of section RVA's to their file offsets. For this reason
                // we need the same alignment for both.
                sectionAlignment = fileAlignment;
            }

            dllCharacteristics &= DllCharacteristics.AppContainer;

            // In Crossgen1, this is under a debug-specific condition 'if (0 == CLRConfig::GetConfigValue(CLRConfig::INTERNAL_NoASLRForNgen))'
            dllCharacteristics |= DllCharacteristics.DynamicBase;

            // Without NxCompatible the PE executable cannot execute on Windows ARM64
            dllCharacteristics |= DllCharacteristics.NxCompatible | DllCharacteristics.TerminalServerAware;

            if (is64BitTarget)
            {
                dllCharacteristics |= DllCharacteristics.HighEntropyVirtualAddressSpace;
            }
            else
            {
                dllCharacteristics |= DllCharacteristics.NoSeh;
            }

            return(new PEHeaderBuilder(
                       machine: target.MachineFromTarget(),
                       sectionAlignment: sectionAlignment,
                       fileAlignment: fileAlignment,
                       imageBase: imageBase,
                       majorLinkerVersion: PEHeaderConstants.MajorLinkerVersion,
                       minorLinkerVersion: PEHeaderConstants.MinorLinkerVersion,
                       majorOperatingSystemVersion: PEHeaderConstants.MajorOperatingSystemVersion,
                       minorOperatingSystemVersion: PEHeaderConstants.MinorOperatingSystemVersion,
                       majorImageVersion: PEHeaderConstants.MajorImageVersion,
                       minorImageVersion: PEHeaderConstants.MinorImageVersion,
                       majorSubsystemVersion: PEHeaderConstants.MajorSubsystemVersion,
                       minorSubsystemVersion: PEHeaderConstants.MinorSubsystemVersion,
                       subsystem: subsystem,
                       dllCharacteristics: dllCharacteristics,
                       imageCharacteristics: imageCharacteristics,
                       sizeOfStackReserve: (is64BitTarget ? PE64HeaderConstants.SizeOfStackReserve : PE32HeaderConstants.SizeOfStackReserve),
                       sizeOfStackCommit: (is64BitTarget ? PE64HeaderConstants.SizeOfStackCommit : PE32HeaderConstants.SizeOfStackCommit),
                       sizeOfHeapReserve: (is64BitTarget ? PE64HeaderConstants.SizeOfHeapReserve : PE32HeaderConstants.SizeOfHeapReserve),
                       sizeOfHeapCommit: (is64BitTarget ? PE64HeaderConstants.SizeOfHeapCommit : PE32HeaderConstants.SizeOfHeapCommit)));
        }
예제 #22
0
        private static void Main()
        {
            try
            {
                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);
                try
                {
                    if (File.Exists(Path.Combine(Application.StartupPath, Global.definition.ConfigFile)))
                    {
                        Global.config = Config.ParseXML(Path.Combine(Application.StartupPath, Global.definition.ConfigFile));
                    }
                }
                catch
                {
                    MessageBox.Show("設定をロードできませんでした。", "設定読み込み失敗", MessageBoxButtons.OK, MessageBoxIcon.Hand);
                }
                bool flag = true;
                if (Environment.GetCommandLineArgs().Length == 2)
                {
                    flag = false;
                    string a;
                    if ((a = Environment.GetCommandLineArgs()[1]) != null)
                    {
                        if (a == "/reg")
                        {
                            Native.SetSideFileRelate();
                            goto IL_104;
                        }
                        if (a == "/unreg")
                        {
                            Native.DeleteSideFileRelate();
                            goto IL_104;
                        }
                    }
                    string text = Environment.GetCommandLineArgs()[1];
                    if (File.Exists(text) && Path.GetExtension(text) == Global.definition.RuntimeArchiveExt)
                    {
                        if (Subsystem.InstallRuntime(text))
                        {
                            MessageBox.Show("指定されたランタイム " + Path.GetFileName(text) + " をインストールしました。", "新しいランタイムのインストール", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                        }
                        Global.state.ParseCommandline = true;
                    }
                    flag = true;
                }
IL_104:
                if (flag)
                {
                    Application.Run(new MainWindow());
                }
            }
            catch (Exception ex)
            {
                try
                {
                    using (StreamWriter streamWriter = new StreamWriter(Global.definition.Dump, true))
                    {
                        streamWriter.WriteLine("------------------------------------------------------------");
                        streamWriter.WriteLine("| Reported:" + DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss"));
                        streamWriter.WriteLine("------------------------------------------------------------");
                        streamWriter.WriteLine(ex.Message);
                        streamWriter.WriteLine(ex.Source);
                        streamWriter.WriteLine("*StackTrace");
                        streamWriter.WriteLine(ex.StackTrace);
                        streamWriter.Close();
                    }
                }
                catch
                {
                    MessageBox.Show("Error Dump Output Failed.", "Error Handling Fatal Error", MessageBoxButtons.OK, MessageBoxIcon.Hand);
                    Application.Exit();
                }
                MessageBox.Show(string.Concat(new string[]
                {
                    Global.definition.AppName,
                    "に致命的な障害が発生しました。",
                    Environment.NewLine,
                    Environment.NewLine,
                    ex.Message,
                    Environment.NewLine,
                    "強制終了します。ご迷惑をお掛けし、申し訳ございません。",
                    Environment.NewLine,
                    Environment.NewLine,
                    Global.definition.Dump,
                    "にエラーダンプを出力しました。"
                }), Global.definition.AppNameFull + " Fatal Error", MessageBoxButtons.OK, MessageBoxIcon.Hand);
                try
                {
                    Process.Start("notepad", Global.definition.Dump);
                }
                catch
                {
                }
            }
            finally
            {
                Application.Exit();
                Environment.Exit(-1);
            }
        }
예제 #23
0
        public bool Register(Subsystem subsystem)
        {
            var newApplication = Create(subsystem);

            return(newApplication != null);
        }
예제 #24
0
        public void CWPX1()
        {
            Subsystem ss = new Subsystem(Subsystem.SUB_600KHZ_VERT_PISTON_B, 1);
            AdcpSubsystemCommands ssc = new AdcpSubsystemCommands(new SubsystemConfiguration(ss, 4, 0));
            ssc.CWPX = 0.2345f;

            Assert.AreEqual("CWPX[4] 0.2345", ssc.CWPX_CmdStr(), "CWPX Cmd Str is incorrect.");
        }
예제 #25
0
        /// <summary>
        /// Fill in PE header information into a PEHeaderBuilder used by PEBuilder.
        /// </summary>
        /// <param name="subsystem">Targeting subsystem</param>
        /// <param name="target">Target architecture to set in the header</param>
        public static PEHeaderBuilder Create(Subsystem subsystem, TargetDetails target)
        {
            bool is64BitTarget = target.PointerSize == sizeof(long);

            Characteristics imageCharacteristics = Characteristics.ExecutableImage | Characteristics.Dll;

            imageCharacteristics |= is64BitTarget ? Characteristics.LargeAddressAware : Characteristics.Bit32Machine;

            ulong imageBase = is64BitTarget ? PE64HeaderConstants.DllImageBase : PE32HeaderConstants.ImageBase;

            int fileAlignment = 0x200;

            if (!target.IsWindows && !is64BitTarget)
            {
                // To minimize wasted VA space on 32-bit systems, align file to page boundaries (presumed to be 4K)
                fileAlignment = 0x1000;
            }

            int sectionAlignment = 0x1000;

            if (!target.IsWindows && is64BitTarget)
            {
                // On Linux, we must match the bottom 12 bits of section RVA's to their file offsets. For this reason
                // we need the same alignment for both.
                sectionAlignment = fileAlignment;
            }

            // Without NxCompatible the PE executable cannot execute on Windows ARM64
            DllCharacteristics dllCharacteristics =
                DllCharacteristics.DynamicBase |
                DllCharacteristics.NxCompatible |
                DllCharacteristics.TerminalServerAware;

            if (is64BitTarget)
            {
                dllCharacteristics |= DllCharacteristics.HighEntropyVirtualAddressSpace;
            }
            else
            {
                dllCharacteristics |= DllCharacteristics.NoSeh;
            }

            return(new PEHeaderBuilder(
                       machine: target.MachineFromTarget(),
                       sectionAlignment: sectionAlignment,
                       fileAlignment: fileAlignment,
                       imageBase: imageBase,
                       majorLinkerVersion: PEHeaderConstants.MajorLinkerVersion,
                       minorLinkerVersion: PEHeaderConstants.MinorLinkerVersion,
                       majorOperatingSystemVersion: PEHeaderConstants.MajorOperatingSystemVersion,
                       minorOperatingSystemVersion: PEHeaderConstants.MinorOperatingSystemVersion,
                       majorImageVersion: PEHeaderConstants.MajorImageVersion,
                       minorImageVersion: PEHeaderConstants.MinorImageVersion,
                       majorSubsystemVersion: PEHeaderConstants.MajorSubsystemVersion,
                       minorSubsystemVersion: PEHeaderConstants.MinorSubsystemVersion,
                       subsystem: subsystem,
                       dllCharacteristics: dllCharacteristics,
                       imageCharacteristics: imageCharacteristics,
                       sizeOfStackReserve: (is64BitTarget ? PE64HeaderConstants.SizeOfStackReserve : PE32HeaderConstants.SizeOfStackReserve),
                       sizeOfStackCommit: (is64BitTarget ? PE64HeaderConstants.SizeOfStackCommit : PE32HeaderConstants.SizeOfStackCommit),
                       sizeOfHeapReserve: (is64BitTarget ? PE64HeaderConstants.SizeOfHeapReserve : PE32HeaderConstants.SizeOfHeapReserve),
                       sizeOfHeapCommit: (is64BitTarget ? PE64HeaderConstants.SizeOfHeapCommit : PE32HeaderConstants.SizeOfHeapCommit)));
        }
예제 #26
0
        public void CWTBS()
        {
            Subsystem ss = new Subsystem(Subsystem.SUB_600KHZ_VERT_PISTON_B, 1);
            AdcpSubsystemCommands ssc = new AdcpSubsystemCommands(new SubsystemConfiguration(ss, 7, 0));
            ssc.CWTBS = 0.2345f;

            Assert.AreEqual("CWTBS[7] 0.2345", ssc.CWTBS_CmdStr(7), "CWTBS Cmd Str is incorrect.");
        }
예제 #27
0
        static int Main(string[] args)
        {
            // Begin the Logger
            ILog log = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);

            log.Info("STARTING HSF RUN"); //Do not delete

            // Set Defaults
            var  simulationInputFilePath = @"..\..\..\SimulationInput.XML";
            var  targetDeckFilePath = @"..\..\..\v2.2-300targets.xml";
            var  modelInputFilePath = @"..\..\..\DSAC_Static.xml";
            bool simulationSet = false, targetSet = false, modelSet = false;

            // Get the input filenames
            int i          = 0;

            foreach (var input in args)
            {
                i++;
                switch (input)
                {
                case "-s":
                    simulationInputFilePath = args[i];
                    simulationSet           = true;
                    break;

                case "-t":
                    targetDeckFilePath = args[i];
                    targetSet          = true;
                    break;

                case "-m":
                    modelInputFilePath = args[i];
                    modelSet           = true;
                    break;
                }
            }
            ///add usage statement

            if (!simulationSet)
            {
                log.Info("Using Default Simulation File");
            }

            if (!targetSet)
            {
                log.Info("Using Default Target File");
            }

            if (!modelSet)
            {
                log.Info("Using Default Model File");
            }


            // Initialize Output File
            var outputFileName = string.Format("output-{0:yyyy-MM-dd}-*", DateTime.Now);
            var outputPath = @"C:\HorizonLog\";
            var txt        = ".txt";

            string[] fileNames = System.IO.Directory.GetFiles(outputPath, outputFileName, System.IO.SearchOption.TopDirectoryOnly);
            double   number    = 0;

            foreach (var fileName in fileNames)
            {
                char version = fileName[fileName.Length - txt.Length - 1];
                if (number < Char.GetNumericValue(version))
                {
                    number = Char.GetNumericValue(version);
                }
            }
            number++;
            outputFileName = outputFileName.Remove(outputFileName.Length - 1) + number;
            outputPath    += outputFileName + txt;
            // Find the main input node from the XML input files
            XmlNode evaluatorNode = XmlParser.ParseSimulationInput(simulationInputFilePath);

            // Load the target deck into the targets list from the XML target deck input file
            Stack <Task> systemTasks   = new Stack <Task>();
            bool         targetsLoaded = Task.loadTargetsIntoTaskList(XmlParser.GetTargetNode(targetDeckFilePath), systemTasks);

            if (!targetsLoaded)
            {
                return(1);
            }

            // Find the main model node from the XML model input file
            var modelInputXMLNode = XmlParser.GetModelNode(modelInputFilePath);

            // Load the environment. First check if there is an ENVIRONMENT XMLNode in the input file
            Universe SystemUniverse = null;

            //Create singleton dependency dictionary
            Dependency dependencies = Dependency.Instance;

            // Initialize List to hold assets and subsystem nodes
            List <Asset>     assetList = new List <Asset>();
            List <Subsystem> subList   = new List <Subsystem>();

            // Maps used to set up preceeding nodes
            Dictionary <ISubsystem, XmlNode>      subsystemXMLNodeMap = new Dictionary <ISubsystem, XmlNode>();
            Dictionary <string, Subsystem>        subsystemMap        = new Dictionary <string, Subsystem>();
            List <KeyValuePair <string, string> > dependencyMap       = new List <KeyValuePair <string, string> >();
            List <KeyValuePair <string, string> > dependencyFcnMap    = new List <KeyValuePair <string, string> >();
            // Dictionary<string, ScriptedSubsystem> scriptedSubNames = new Dictionary<string, ScriptedSubsystem>();

            // Create Constraint list
            List <Constraint> constraintsList = new List <Constraint>();

            //Create Lists to hold all the initial condition and dependency nodes to be parsed later
            List <XmlNode> ICNodes         = new List <XmlNode>();
            List <XmlNode> DepNodes        = new List <XmlNode>();
            SystemState    initialSysState = new SystemState();

            // Set up Subsystem Nodes, first loop through the assets in the XML model input file
            foreach (XmlNode modelChildNode in modelInputXMLNode.ChildNodes)
            {
                if (modelChildNode.Name.Equals("ENVIRONMENT"))
                {
                    // Create the Environment based on the XMLNode
                    SystemUniverse = new Universe(modelChildNode);
                }
                if (modelChildNode.Name.Equals("ASSET"))
                {
                    Asset asset = new Asset(modelChildNode);
                    assetList.Add(asset);
                    // Loop through all the of the ChildNodess for this Asset
                    foreach (XmlNode childNode in modelChildNode.ChildNodes)
                    {
                        // Get the current Subsystem XML Node, and create it using the SubsystemFactory
                        if (childNode.Name.Equals("SUBSYSTEM"))
                        {  //is this how we want to do this?
                            // Check if the type of the Subsystem is scripted, networked, or other
                            string subName = SubsystemFactory.GetSubsystem(childNode, dependencies, asset, subsystemMap);
                            foreach (XmlNode ICorDepNode in childNode.ChildNodes)
                            {
                                if (ICorDepNode.Name.Equals("IC"))
                                {
                                    ICNodes.Add(ICorDepNode);
                                }
                                if (ICorDepNode.Name.Equals("DEPENDENCY"))
                                {
                                    string depSubName = "", depFunc = "";
                                    depSubName = Subsystem.parseNameFromXmlNode(ICorDepNode, asset.Name);
                                    dependencyMap.Add(new KeyValuePair <string, string>(subName, depSubName));

                                    if (ICorDepNode.Attributes["fcnName"] != null)
                                    {
                                        depFunc = ICorDepNode.Attributes["fcnName"].Value.ToString();
                                        dependencyFcnMap.Add(new KeyValuePair <string, string>(subName, depFunc));
                                    }
                                }
                            }
                        }
                        //Create a new Constraint
                        if (childNode.Name.Equals("CONSTRAINT"))
                        {
                            constraintsList.Add(ConstraintFactory.GetConstraint(childNode, subsystemMap, asset));
                        }
                    }
                    if (ICNodes.Count > 0)
                    {
                        initialSysState.Add(SystemState.setInitialSystemState(ICNodes, asset));
                    }
                    ICNodes.Clear();
                }
            }
            if (SystemUniverse == null)
            {
                SystemUniverse = new Universe();
            }

            foreach (KeyValuePair <string, Subsystem> sub in subsystemMap)
            {
                if (!sub.Value.GetType().Equals(typeof(ScriptedSubsystem)))//let the scripted subsystems add their own dependency collector
                {
                    sub.Value.AddDependencyCollector();
                }
                subList.Add(sub.Value);
            }
            log.Info("Subsystems and Constraints Loaded");

            //Add all the dependent subsystems to the dependent subsystem list of the subsystems
            foreach (KeyValuePair <string, string> depSubPair in dependencyMap)
            {
                Subsystem subToAddDep, depSub;
                subsystemMap.TryGetValue(depSubPair.Key, out subToAddDep);
                subsystemMap.TryGetValue(depSubPair.Value, out depSub);
                subToAddDep.DependentSubsystems.Add(depSub);
            }

            //give the dependency functions to all the subsytems that need them
            foreach (KeyValuePair <string, string> depFunc in dependencyFcnMap)
            {
                Subsystem subToAddDep;
                subsystemMap.TryGetValue(depFunc.Key, out subToAddDep);
                subToAddDep.SubsystemDependencyFunctions.Add(depFunc.Value, dependencies.GetDependencyFunc(depFunc.Value));
            }
            log.Info("Dependencies Loaded");

            SystemClass simSystem = new SystemClass(assetList, subList, constraintsList, SystemUniverse);

            if (simSystem.CheckForCircularDependencies())
            {
                throw new NotFiniteNumberException("System has circular dependencies! Please correct then try again.");
            }

            Evaluator             schedEvaluator = EvaluatorFactory.GetEvaluator(evaluatorNode, dependencies);
            Scheduler             scheduler      = new Scheduler(schedEvaluator);
            List <SystemSchedule> schedules      = scheduler.GenerateSchedules(simSystem, systemTasks, initialSysState);

            // Evaluate the schedules and set their values
            foreach (SystemSchedule systemSchedule in schedules)
            {
                systemSchedule.ScheduleValue = schedEvaluator.Evaluate(systemSchedule);
                bool canExtendUntilEnd = true;
                // Extend the subsystem states to the end of the simulation
                foreach (var subsystem in simSystem.Subsystems)
                {
                    if (systemSchedule.AllStates.Events.Count > 0)
                    {
                        if (!subsystem.CanExtend(systemSchedule.AllStates.Events.Peek(), simSystem.Environment, SimParameters.SimEndSeconds))
                        {
                            log.Error("Cannot Extend " + subsystem.Name + " to end of simulation");
                        }
                    }
                }
            }

            // Sort the sysScheds by their values
            schedules.Sort((x, y) => x.ScheduleValue.CompareTo(y.ScheduleValue));
            schedules.Reverse();
            double maxSched = schedules[0].ScheduleValue;

            i = 0;
            //Morgan's Way
            using (StreamWriter sw = File.CreateText(outputPath))
            {
                foreach (SystemSchedule sched in schedules)
                {
                    sw.WriteLine("Schedule Number: " + i + "Schedule Value: " + schedules[i].ScheduleValue);
                    foreach (var eit in sched.AllStates.Events)
                    {
                        if (i < 5)//just compare the first 5 schedules for now
                        {
                            sw.WriteLine(eit.ToString());
                        }
                    }
                    i++;
                }
                log.Info("Max Schedule Value: " + maxSched);
            }

            // Mehiel's way
            string stateDataFilePath = @"C:\HorizonLog\" + string.Format("output-{0:yyyy-MM-dd-hh-mm-ss}", DateTime.Now);

            SystemSchedule.WriteSchedule(schedules[0], stateDataFilePath);

            var csv = new StringBuilder();

            csv.Clear();
            foreach (var asset in simSystem.Assets)
            {
                File.WriteAllText(@"..\..\..\" + asset.Name + "_dynamicStateData.csv", asset.AssetDynamicState.ToString());
            }
            return(0);
            //   Console.ReadKey();
        }
예제 #28
0
 public void SetSub(Subsystem sub)
 {
     this.sub = sub;
 }
예제 #29
0
        private void btnCommand_Click(object sender, EventArgs e)
        {
            string    strSender     = "";
            Subsystem ConfigureInfo = MachineInfo.SubsystemList.Find(str => str.Name == "液路调试");

            switch (((SimpleButton)sender).Name)
            {
            case "btnCheckSamProWV":
                strSender = ConfigureInfo.ComponetList.Find(componet => componet.Name == lblSampleNeedle.Text).CommandList.Find(command => command.FullName == btnCheckSamProWV.Text).Name;
                break;

            case "btnDetectionReagentNeedle1":
                strSender = ConfigureInfo.ComponetList.Find(componet => componet.Name == lblReagentNeedle.Text).CommandList.Find(command => command.FullName == btnDetectionReagentNeedle1.Text).Name;
                break;

            case "btnDetectionReagentNeedle2":
                strSender = ConfigureInfo.ComponetList.Find(componet => componet.Name == lblReagentNeedle.Text).CommandList.Find(command => command.FullName == btnDetectionReagentNeedle2.Text).Name;
                break;

            case "btnDetectionIV":
                strSender = ConfigureInfo.ComponetList.Find(componet => componet.Name == lblEightJointsRinse.Text).CommandList.Find(command => command.FullName == btnDetectionIV.Text).Name;
                break;

            case "btnDetectionSV":
                strSender = ConfigureInfo.ComponetList.Find(componet => componet.Name == lblEightJointsRinse.Text).CommandList.Find(command => command.FullName == btnDetectionSV.Text).Name;
                break;

            case "btnStirrer1DFV":
                strSender = ConfigureInfo.ComponetList.Find(componet => componet.Name == lblStirrer.Text).CommandList.Find(command => command.FullName == btnStirrer1DFV.Text).Name;
                break;

            case "btnStirrer2DFV":
                strSender = ConfigureInfo.ComponetList.Find(componet => componet.Name == lblStirrer.Text).CommandList.Find(command => command.FullName == btnStirrer2DFV.Text).Name;
                break;

            case "btnChangingWater":
                strSender = ConfigureInfo.ComponetList.Find(componet => componet.Name == lblLiquidWay.Text).CommandList.Find(command => command.FullName == btnChangingWater.Text).Name;
                break;

            case "btnVacuumPumpVP3LLM":
                strSender = ConfigureInfo.ComponetList.Find(componet => componet.Name == lblLiquidWay.Text).CommandList.Find(command => command.FullName == btnVacuumPumpVP3LLM.Text).Name;
                break;

            case "btnConstantTempLLM":
                strSender = ConfigureInfo.ComponetList.Find(componet => componet.Name == lblLiquidWay.Text).CommandList.Find(command => command.FullName == btnConstantTempLLM.Text).Name;
                break;

            case "btnPureWaterTankLLM":
                strSender = ConfigureInfo.ComponetList.Find(componet => componet.Name == lblLiquidWay.Text).CommandList.Find(command => command.FullName == btnPureWaterTankLLM.Text).Name;
                break;

            case "btnOverflowTankLLM":
                strSender = ConfigureInfo.ComponetList.Find(componet => componet.Name == lblLiquidWay.Text).CommandList.Find(command => command.FullName == btnOverflowTankLLM.Text).Name;
                break;

            case "btnEquipmentStatusIE":
                strSender = ConfigureInfo.ComponetList.Find(componet => componet.Name == labelControl1.Text).CommandList.Find(command => command.FullName == btnEquipmentStatusIE.Text).Name;
                break;

            case "btnOpenGP":
                strSender = ConfigureInfo.ComponetList.Find(componet => componet.Name == lblGearPumpGP1.Text).CommandList.Find(command => command.FullName == btnOpenGP.Text).Name;
                break;

            case "btnCloseGP":
                strSender = ConfigureInfo.ComponetList.Find(componet => componet.Name == lblGearPumpGP1.Text).CommandList.Find(command => command.FullName == btnCloseGP.Text).Name;
                break;

            case "btnOpenNPP":
                strSender = ConfigureInfo.ComponetList.Find(componet => componet.Name == lblNegativePressurePumpVP2.Text).CommandList.Find(command => command.FullName == btnOpenNPP.Text).Name;
                break;

            case "btnCloseNPP":
                strSender = ConfigureInfo.ComponetList.Find(componet => componet.Name == lblNegativePressurePumpVP2.Text).CommandList.Find(command => command.FullName == btnCloseNPP.Text).Name;
                break;

            case "btnOpenVP":
                strSender = ConfigureInfo.ComponetList.Find(componet => componet.Name == lblVacuumPumpVP1.Text).CommandList.Find(command => command.FullName == btnOpenVP.Text).Name;
                break;

            case "btnCloseVP":
                strSender = ConfigureInfo.ComponetList.Find(componet => componet.Name == lblVacuumPumpVP1.Text).CommandList.Find(command => command.FullName == btnCloseVP.Text).Name;
                break;

            default:
                break;
            }

            if (SendNetworkEvent != null && strSender != "")
            {
                SendNetworkEvent(strSender);
            }
        }
예제 #30
0
        public void TestCWTTBP_BadMin()
        {
            Subsystem ss = new Subsystem(Subsystem.SUB_600KHZ_VERT_PISTON_B, 1);
            AdcpSubsystemCommands ssc = new AdcpSubsystemCommands(new SubsystemConfiguration(ss, 0, 0));

            ssc.CWTTBP = -154.235f;

            Assert.AreEqual(AdcpSubsystemCommands.DEFAULT_600_CWTTBP, ssc.CWTTBP, 0.0001, "CWTTBP is incorrect.");
        }
예제 #31
0
        public void Load(Subsystem subsystem)
        {
            foreach (var entry in GetFilesForSubsystem(subsystem))
            {
                _contentManager.LoadIniFile(entry);
            }

            // Load hardcoded files
            switch (subsystem)
            {
            case Subsystem.Core:
                switch (_gameDefinition.Game)
                {
                case SageGame.Bfme:
                case SageGame.Bfme2:
                case SageGame.Bfme2Rotwk:
                    _contentManager.LoadIniFile(@"Data\INI\Mouse.ini");
                    _contentManager.LoadIniFile(@"Data\INI\Water.ini");
                    _contentManager.LoadIniFile(@"Data\INI\WaterTextures.ini");
                    _contentManager.LoadIniFile(@"Maps\MapCache.ini");
                    break;

                case SageGame.Cnc3:
                    // TODO: Use .version file.
                    var manifestFileEntry  = _fileSystem.GetFile(@"Data\global_common.manifest");
                    var gameStream         = new GameStream(manifestFileEntry, _game);
                    var manifestFileEntry2 = _fileSystem.GetFile(@"Data\static_common.manifest");
                    var gameStream2        = new GameStream(manifestFileEntry2, _game);
                    break;
                }
                switch (_gameDefinition.Game)
                {
                case SageGame.Bfme:
                    _contentManager.LoadIniFile($@"Lang\{_contentManager.Language}\HeaderTemplate.ini");
                    break;

                case SageGame.Bfme2:
                case SageGame.Bfme2Rotwk:
                    _contentManager.LoadIniFile($@"HeaderTemplate.ini");
                    break;
                }
                break;

            case Subsystem.Players:
                switch (_gameDefinition.Game)
                {
                case SageGame.Bfme:
                case SageGame.Bfme2:
                case SageGame.Bfme2Rotwk:
                    _contentManager.LoadIniFile(@"Data\INI\ControlBarScheme.ini");
                    _contentManager.LoadIniFile(@"Data\INI\CommandSet.ini");
                    _contentManager.LoadIniFile(@"Data\INI\CommandButton.ini");
                    break;
                }
                break;

            case Subsystem.Audio:
                switch (_gameDefinition.Game)
                {
                case SageGame.Bfme:
                case SageGame.Bfme2:
                case SageGame.Bfme2Rotwk:
                    _contentManager.LoadIniFile(@"Data\INI\AudioSettings.ini");
                    _contentManager.LoadIniFile(@"Data\INI\SoundEffects.ini");
                    _contentManager.LoadIniFile(@"Data\INI\MiscAudio.ini");
                    _contentManager.LoadIniFile(@"Data\INI\Voice.ini");
                    break;
                }
                break;

            case Subsystem.Wnd:
                switch (_gameDefinition.Game)
                {
                case SageGame.Bfme:
                case SageGame.Bfme2:
                case SageGame.Bfme2Rotwk:
                    _contentManager.LoadIniFiles(@"Data\INI\MappedImages\HandCreated\");
                    _contentManager.LoadIniFiles(@"Data\INI\MappedImages\TextureSize_512\");
                    break;
                }
                break;
            }
        }
예제 #32
0
        public void TestDefaults75()
        {
            // Create the commands with the correct frequency in Subsystem
            Subsystem ss = new Subsystem(Subsystem.SUB_75KHZ_4BEAM_30DEG_ARRAY_L, 1);
            AdcpSubsystemCommands commands = new AdcpSubsystemCommands(new SubsystemConfiguration(ss, 0, 0));

            Assert.AreEqual(AdcpSubsystemCommands.DEFAULT_CWPON, commands.CWPON, "CWPON is incorrect.");

            Assert.AreEqual(AdcpSubsystemCommands.DEFAULT_CWPBB_TRANSMITPULSETYPE, commands.CWPBB_TransmitPulseType, "CWPBB Transmit Pulse Type is incorrect.");
            Assert.AreEqual(AdcpSubsystemCommands.DEFAULT_75_CWPBB_LAGLENGTH, commands.CWPBB_LagLength, "CWPBB Lag Length is incorrect.");

            Assert.AreEqual(AdcpSubsystemCommands.DEFAULT_75_CWPAP_NUMOFPINGSAVG, commands.CWPAP_NumPingsAvg, "CWPAP Num Pings Averaged is incorrect.");
            Assert.AreEqual(AdcpSubsystemCommands.DEFAULT_75_CWPAP_LAG, commands.CWPAP_Lag, "CWPAP Lag is incorrect.");
            Assert.AreEqual(AdcpSubsystemCommands.DEFAULT_75_CWPAP_BLANK, commands.CWPAP_Blank, "CWPAP Blank is incorrect.");
            Assert.AreEqual(AdcpSubsystemCommands.DEFAULT_75_CWPAP_BINSIZE, commands.CWPAP_BinSize, "CWPAP Bin Size is incorrect.");
            Assert.AreEqual(AdcpSubsystemCommands.DEFAULT_75_CWPAP_TIME_BETWEEN_PINGS, commands.CWPAP_TimeBetweenPing, "CWPAP Time between Pings is incorrect.");

            Assert.AreEqual(AdcpSubsystemCommands.DEFAULT_CWPBP_NUM_PING_AVG, commands.CWPBP_NumPingsAvg, "CWPBP Num Pings Averaged is incorrect.");
            Assert.AreEqual(AdcpSubsystemCommands.DEFAULT_75_CWPBP_WATER_BASE_PING_TIME, commands.CWPBP_TimeBetweenBasePings, "CWPBP Time Between Base Ping is incorrect.");

            Assert.AreEqual(AdcpSubsystemCommands.DEFAULT_CWPST_CORR_THRESH, commands.CWPST_CorrelationThresh, "CWPST Correlation is incorrect.");
            Assert.AreEqual(AdcpSubsystemCommands.DEFAULT_CWPST_QVEL_THRESH, commands.CWPST_QVelocityThresh, "CWPST Q velocity is incorrect.");
            Assert.AreEqual(AdcpSubsystemCommands.DEFAULT_CWPST_VVEL_THRESH, commands.CWPST_VVelocityThresh, "CWPST V Velocity is incorrect.");

            Assert.AreEqual(AdcpSubsystemCommands.DEFAULT_75_CWPBL, commands.CWPBL, "CWPBL is incorrect.");
            Assert.AreEqual(AdcpSubsystemCommands.DEFAULT_75_CWPBS, commands.CWPBS, "CWPBS is incorrect.");
            Assert.AreEqual(AdcpSubsystemCommands.DEFAULT_75_CWPX, commands.CWPX, "CWPX is incorrect.");
            Assert.AreEqual(AdcpSubsystemCommands.DEFAULT_75_CWPBN, commands.CWPBN, "CWPBN is incorrect.");
            Assert.AreEqual(AdcpSubsystemCommands.DEFAULT_75_CWPP, commands.CWPP, "CWPP is incorrect.");
            Assert.AreEqual(new TimeValue(), commands.CWPAI, "CWPAI is incorrect.");
            Assert.AreEqual(AdcpSubsystemCommands.DEFAULT_75_CWPTBP, commands.CWPTBP, "CWPTBP is incorrect.");

            Assert.AreEqual(new TimeValue(), commands.CBI_BurstInterval, "CBI Burst Interval is incorrect.");
            Assert.AreEqual(AdcpSubsystemCommands.DEFAULT_CBI_NUM_ENS, commands.CBI_NumEnsembles, "CBI Number of Ensemble is incorrect.");

            Assert.AreEqual(AdcpSubsystemCommands.DEFAULT_CBTON, commands.CBTON, "CBTON is incorrect.");

            Assert.AreEqual(AdcpSubsystemCommands.DEFAULT_CBTBB_MODE, commands.CBTBB_Mode, "CBTBB Mode is incorrect.");
            Assert.AreEqual(AdcpSubsystemCommands.DEFAULT_75_CBTBB_LONGRANGEDEPTH, commands.CBTBB_LongRangeDepth, "CBTBB Long Range Depth is incorrect.");
            Assert.AreEqual(AdcpSubsystemCommands.DEFAULT_CBTBB_PULSETOPULSE_LAG, commands.CBTBB_PulseToPulseLag, "CBTBB Pulse to Pulse Lag is incorrect.");

            Assert.AreEqual(AdcpSubsystemCommands.DEFAULT_CBTST_CORR_THRESH, commands.CBTST_CorrelationThresh, "CBTST Correlation is incorrect.");
            Assert.AreEqual(AdcpSubsystemCommands.DEFAULT_CBTST_QVEL_THRESHOLD, commands.CBTST_QVelocityThresh, "CBTST Q Velocity is incorrect.");
            Assert.AreEqual(AdcpSubsystemCommands.DEFAULT_CBTST_VVEL_THRESHOLD, commands.CBTST_VVelocityThresh, "CBTST V Velocity is incorrect.");

            Assert.AreEqual(AdcpSubsystemCommands.DEFAULT_75_CBTBL, commands.CBTBL, "CBTBL is incorrect.");
            Assert.AreEqual(AdcpSubsystemCommands.DEFAULT_75_CBTMX, commands.CBTMX, "CBTMX is incorrect.");
            Assert.AreEqual(AdcpSubsystemCommands.DEFAULT_75_CBTTBP, commands.CBTTBP, "CBTTBP is incorrect.");

            Assert.AreEqual(AdcpSubsystemCommands.DEFAULT_CBTT_SNR_SHALLOW_DET_THRESHOLD, commands.CBTT_SNRShallowDetectionThresh, "CBTT SNR is incorrect.");
            Assert.AreEqual(AdcpSubsystemCommands.DEFAULT_75_CBTT_DEPTH_SNR, commands.CBTT_DepthSNR, "CBTT Depth SNR is incorrect.");
            Assert.AreEqual(AdcpSubsystemCommands.DEFAULT_CBTT_SNR_DEEP_DET_THRESHOLD, commands.CBTT_SNRDeepDetectionThresh, "CBTT SNR Deep Depth Detection Threshold is incorrect.");
            Assert.AreEqual(AdcpSubsystemCommands.DEFAULT_75_CBTT_DEPTH_GAIN, commands.CBTT_DepthGain, "CBTT Depth Gain is incorrect.");

            Assert.AreEqual(AdcpSubsystemCommands.DEFAULT_CWTON, commands.CWTON, "CWTON is incorrect.");
            Assert.AreEqual(AdcpSubsystemCommands.DEFAULT_CWTBB, commands.CWTBB, "CWTBB is incorrect.");
            Assert.AreEqual(AdcpSubsystemCommands.DEFAULT_75_CWTBL, commands.CWTBL, "CWTBL is incorrect.");
            Assert.AreEqual(AdcpSubsystemCommands.DEFAULT_75_CWTBS, commands.CWTBS, "CWTBS is incorrect.");
            Assert.AreEqual(AdcpSubsystemCommands.DEFAULT_75_CWTTBP, commands.CWTTBP, "CWTTBP is incorrect.");
        }
예제 #33
0
        private IEnumerable <string> GetSubsystemEntryName(Subsystem subsystem)
        {
            // TODO: This should be stored in IGameDefinition
            switch (subsystem)
            {
            case Subsystem.Core:
                switch (_gameDefinition.Game)
                {
                case SageGame.Bfme:
                case SageGame.Bfme2:
                case SageGame.Bfme2Rotwk:
                    yield return("TheWritableGlobalData");

                    yield break;

                case SageGame.Cnc3:
                case SageGame.Cnc3KanesWrath:
                    yield return("GameEngine");

                    yield return("TheGameClient");

                    yield return("TheWritableGlobalData");

                    yield break;
                }
                break;

            case Subsystem.Audio:
                yield break;

            case Subsystem.ObjectCreation:
                switch (_gameDefinition.Game)
                {
                case SageGame.Bfme:
                case SageGame.Bfme2:
                case SageGame.Bfme2Rotwk:
                    yield return("TheThingFactory");

                    yield return("TheUpgradeCenter");

                    yield break;

                // TODO: Figure out how to load object config for C&C3 and later
                case SageGame.Cnc3:
                case SageGame.Cnc3KanesWrath:
                    yield break;
                }
                break;

            case Subsystem.Players:
                switch (_gameDefinition.Game)
                {
                case SageGame.Bfme:
                case SageGame.Bfme2:
                case SageGame.Bfme2Rotwk:
                case SageGame.Cnc3:
                case SageGame.Cnc3KanesWrath:
                    yield return("ThePlayerTemplateStore");

                    yield break;
                }
                break;

            case Subsystem.Locomotors:
                switch (_gameDefinition.Game)
                {
                case SageGame.Bfme:
                case SageGame.Bfme2:
                case SageGame.Bfme2Rotwk:
                case SageGame.Cnc3:
                case SageGame.Cnc3KanesWrath:
                    yield return("TheLocomotorStore");

                    yield break;
                }
                break;

            case Subsystem.Weapons:
                switch (_gameDefinition.Game)
                {
                case SageGame.Bfme:
                case SageGame.Bfme2:
                case SageGame.Bfme2Rotwk:
                case SageGame.Cnc3:
                case SageGame.Cnc3KanesWrath:
                    yield return("TheWeaponStore");

                    yield break;
                }
                break;

            case Subsystem.FXList:
                switch (_gameDefinition.Game)
                {
                case SageGame.Bfme:
                case SageGame.Bfme2:
                case SageGame.Bfme2Rotwk:
                    yield return("TheFXListStore");

                    yield break;
                }
                break;

            case Subsystem.Terrain:
                switch (_gameDefinition.Game)
                {
                case SageGame.Bfme:
                case SageGame.Bfme2:
                case SageGame.Bfme2Rotwk:
                case SageGame.Cnc3:
                case SageGame.Cnc3KanesWrath:
                    yield return("TheTerrainTypes");

                    yield return("TheTerrainRoads");

                    yield break;
                }
                break;

            case Subsystem.ParticleSystems:
                switch (_gameDefinition.Game)
                {
                case SageGame.Bfme:
                case SageGame.Bfme2:
                case SageGame.Bfme2Rotwk:
                    yield return("TheParticleSystemManager");

                    yield return("TheFXParticleSystemManager");

                    yield break;

                // TODO: Figure out how to load particle systems for C&C3 and later
                case SageGame.Cnc3:
                case SageGame.Cnc3KanesWrath:
                    yield break;
                }
                break;

            case Subsystem.Wnd:
                break;

            case Subsystem.Multiplayer:
                switch (_gameDefinition.Game)
                {
                case SageGame.Bfme:
                case SageGame.Bfme2:
                case SageGame.Bfme2Rotwk:
                    yield return("TheMultiplayerSettings");

                    yield break;
                }
                break;

            case Subsystem.LinearCampaign:
                switch (_gameDefinition.Game)
                {
                case SageGame.Bfme2:
                case SageGame.Bfme2Rotwk:
                case SageGame.Cnc3:
                case SageGame.Cnc3KanesWrath:
                    yield return("TheLinearCampaignManager");

                    yield break;
                    // TODO: Figure out how to load campaigns for RA3 and later
                }
                break;

            case Subsystem.Credits:
                yield return("Credits");

                yield break;

            case Subsystem.Damage:
                yield return("TheDamageFXStore");

                yield break;

            default:
                throw new ArgumentOutOfRangeException(nameof(subsystem), subsystem, null);
            }
        }
예제 #34
0
        public void TestToString()
        {
            Subsystem ss = new Subsystem(Subsystem.SUB_600KHZ_VERT_PISTON_B, 1);
            AdcpSubsystemCommands ssc = new AdcpSubsystemCommands(new SubsystemConfiguration(ss, 0, 0));

            string result = ssc.ToString();

            Assert.IsTrue(result.Contains(AdcpSubsystemCommands.CMD_CWPON), "CMD_CWPON is missing.");
            Assert.IsTrue(result.Contains(AdcpSubsystemCommands.CMD_CWPBB), "CMD_CWPBB is missing.");
            Assert.IsTrue(result.Contains(AdcpSubsystemCommands.CMD_CWPST), "CMD_CWPST is missing.");
            Assert.IsTrue(result.Contains(AdcpSubsystemCommands.CMD_CWPBL), "CMD_CWPBL is missing.");
            Assert.IsTrue(result.Contains(AdcpSubsystemCommands.CMD_CWPBS), "CMD_CWPBS is missing.");
            Assert.IsTrue(result.Contains(AdcpSubsystemCommands.CMD_CWPX), "CMD_CWPX is missing.");
            Assert.IsTrue(result.Contains(AdcpSubsystemCommands.CMD_CWPBN), "CMD_CWPBN is missing.");
            Assert.IsTrue(result.Contains(AdcpSubsystemCommands.CMD_CWPP), "CMD_CWPP is missing.");
            Assert.IsTrue(result.Contains(AdcpSubsystemCommands.CMD_CWPBP), "CMD_CWPBP is missing.");
            Assert.IsTrue(result.Contains(AdcpSubsystemCommands.CMD_CWPAI), "CMD_CWPAI is missing.");
            Assert.IsTrue(result.Contains(AdcpSubsystemCommands.CMD_CWPTBP), "CMD_CWPTBP is missing.");
            Assert.IsTrue(result.Contains(AdcpSubsystemCommands.CMD_CWPAP), "CMD_CWPAP is missing.");

            Assert.IsTrue(result.Contains(AdcpSubsystemCommands.CMD_CBI), "CMD_CBI is missing.");

            Assert.IsTrue(result.Contains(AdcpSubsystemCommands.CMD_CBTON), "CMD_CBTON is missing.");
            Assert.IsTrue(result.Contains(AdcpSubsystemCommands.CMD_CBTBB), "CMD_CBTBB is missing.");
            Assert.IsTrue(result.Contains(AdcpSubsystemCommands.CMD_CBTST), "CMD_CBTST is missing.");
            Assert.IsTrue(result.Contains(AdcpSubsystemCommands.CMD_CBTT), "CMD_CBTT is missing.");
            Assert.IsTrue(result.Contains(AdcpSubsystemCommands.CMD_CBTBL), "CMD_CBTBL is missing.");
            //Assert.IsTrue(result.Contains(AdcpSubsystemCommands.CMD_CBTMX), "CMD_CBTMX is missing.");         // Removed
            Assert.IsFalse(result.Contains(AdcpSubsystemCommands.CMD_CBTMX), "CMD_CBTMX is missing.");          // Removed
            Assert.IsTrue(result.Contains(AdcpSubsystemCommands.CMD_CBTTBP), "CMD_CBTTBP is missing.");

            Assert.IsTrue(result.Contains(AdcpSubsystemCommands.CMD_CWTON), "CMD_CWTON is missing.");
            Assert.IsTrue(result.Contains(AdcpSubsystemCommands.CMD_CWTBB), "CMD_CWTBB is missing.");
            Assert.IsTrue(result.Contains(AdcpSubsystemCommands.CMD_CWTBL), "CMD_CWTBL is missing.");
            Assert.IsTrue(result.Contains(AdcpSubsystemCommands.CMD_CWTBS), "CMD_CWTBS is missing.");
            Assert.IsTrue(result.Contains(AdcpSubsystemCommands.CMD_CWTTBP), "CMD_CWTTBP is missing.");
        }
예제 #35
0
        public void Load(Subsystem subsystem)
        {
            switch (subsystem)
            {
            case Subsystem.Core:
                LoadFiles(
                    @"Data\INI\Default\GameData.ini",
                    @"Data\INI\GameData.ini",
                    @"Data\INI\Mouse.ini",
                    @"Data\INI\Water.ini",
                    @"Data\INI\AudioSettings.ini",
                    $@"Data\{_contentManager.Language}\HeaderTemplate.ini",
                    @"Maps\MapCache.ini");

                break;

            case Subsystem.Audio:
                LoadFiles(
                    @"Data\INI\AudioSettings.ini",
                    @"Data\INI\SoundEffects.ini",
                    @"Data\INI\MiscAudio.ini",
                    @"Data\INI\Voice.ini");
                break;

            case Subsystem.ObjectCreation:
                LoadFiles(
                    @"Data\INI\Default\Object.ini",
                    @"Data\INI\Upgrade.ini",
                    @"Data\INI\Crate.ini");
                _contentManager.LoadIniFiles(@"Data\INI\Object");
                break;

            case Subsystem.Locomotors:
                LoadFiles(
                    @"Data\INI\Locomotor.ini");
                break;

            case Subsystem.Weapons:
                LoadFiles(
                    @"Data\INI\Weapon.ini");
                break;

            case Subsystem.FXList:
                LoadFiles(
                    @"Data\INI\FXList.ini");
                break;

            case Subsystem.Players:
                LoadFiles(
                    @"Data\INI\Default\PlayerTemplate.ini",
                    @"Data\INI\PlayerTemplate.ini",
                    @"Data\INI\ControlBarScheme.ini",
                    @"Data\INI\CommandSet.ini",
                    @"Data\INI\CommandButton.ini");
                break;

            case Subsystem.Terrain:
                LoadFiles(
                    @"Data\INI\Default\Terrain.ini",
                    @"Data\INI\Terrain.ini",
                    @"Data\INI\Default\Roads.ini",
                    @"Data\INI\Roads.ini");
                break;

            case Subsystem.ParticleSystems:
                LoadFiles(@"Data\INI\ParticleSystem.ini");
                break;

            case Subsystem.Wnd:
                LoadFiles(
                    @"Data\INI\WindowTransitions.ini",
                    @"Data\INI\ControlBarScheme.ini");
                _contentManager.LoadIniFiles(@"Data\INI\MappedImages\HandCreated\");
                _contentManager.LoadIniFiles(@"Data\INI\MappedImages\TextureSize_512\");
                break;

            case Subsystem.Multiplayer:
                LoadFiles(@"Data\INI\Multiplayer.ini");
                break;

            case Subsystem.LinearCampaign:
                LoadFiles(@"Data\INI\Campaign.ini");
                break;

            case Subsystem.Credits:
                LoadFiles(@"Data\INI\Credits.ini");
                break;

            case Subsystem.Damage:
                LoadFiles(@"Data\INI\DamageFX.ini");
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(subsystem), subsystem, null);
            }
        }
예제 #36
0
        public void CWPAP1()
        {
            Subsystem ss = new Subsystem(Subsystem.SUB_600KHZ_VERT_PISTON_B, 1);
            AdcpSubsystemCommands ssc = new AdcpSubsystemCommands(new SubsystemConfiguration(ss, 4, 0));
            ssc.CWPAP_NumPingsAvg = 3;
            ssc.CWPAP_Lag = 0.04565f;
            ssc.CWPAP_Blank = 1.5f;
            ssc.CWPAP_BinSize = 3.3f;
            ssc.CWPAP_TimeBetweenPing = 0.025f;

            Assert.AreEqual("CWPAP[4] 3,0.04565,1.5,3.3,0.025", ssc.CWPAP_CmdStr(), "CWPAP Cmd Str is incorrect.");
        }
		static void WriteUInt16(BinaryWriter writer, Subsystem? value) {
			if (value == null)
				writer.BaseStream.Position += 2;
			else
				writer.Write((ushort)value.Value);
		}
예제 #38
0
        public void CWPBP1()
        {
            Subsystem ss = new Subsystem(Subsystem.SUB_600KHZ_VERT_PISTON_B, 1);
            AdcpSubsystemCommands ssc = new AdcpSubsystemCommands(new SubsystemConfiguration(ss, 4, 0));
            ssc.CWPBP_NumPingsAvg = 3;
            ssc.CWPBP_TimeBetweenBasePings = 0.025f;

            Assert.AreEqual("CWPBP[4] 3,0.025", ssc.CWPBP_CmdStr(), "CWPBP Cmd Str is incorrect.");
        }
예제 #39
0
 public Task(Subsystem subsystem, string taskName)
 {
     associatedSubsystem = subsystem;
     name = taskName;
 }
예제 #40
0
        public void CWPST1()
        {
            Subsystem ss = new Subsystem(Subsystem.SUB_600KHZ_VERT_PISTON_B, 1);
            AdcpSubsystemCommands ssc = new AdcpSubsystemCommands(new SubsystemConfiguration(ss, 4, 0));
            ssc.CWPST_CorrelationThresh = 0.33f;
            ssc.CWPST_QVelocityThresh = 0.44f;
            ssc.CWPST_VVelocityThresh = 0.55f;

            Assert.AreEqual("CWPST[4] 0.33,0.44,0.55", ssc.CWPST_CmdStr(), "CWPST Cmd Str is incorrect.");
        }
예제 #41
0
        public void CWTTBP1()
        {
            Subsystem ss = new Subsystem(Subsystem.SUB_600KHZ_VERT_PISTON_B, 1);
            AdcpSubsystemCommands ssc = new AdcpSubsystemCommands(new SubsystemConfiguration(ss, 4, 0));
            ssc.CWTTBP = 0.001f;

            Assert.AreEqual("CWTTBP[4] 0.001", ssc.CWTTBP_CmdStr(), "CWTTBP Cmd Str is incorrect.");
        }
예제 #42
0
 public void SetSub(Subsystem sub)
 {
     this.sub = sub;
     propagateSub();
 }
예제 #43
0
        public void TestCBI_BurstInterval_CornerSeconds()
        {
            Subsystem ss = new Subsystem(Subsystem.SUB_600KHZ_VERT_PISTON_B, 1);
            AdcpSubsystemCommands ssc = new AdcpSubsystemCommands(new SubsystemConfiguration(ss, 0, 0));

            ssc.CBI_BurstInterval = new TimeValue(1, 17, 63, 4);

            Assert.AreEqual(new TimeValue(1, 18, 3, 4), ssc.CBI_BurstInterval, "CBI_BurstInterval is incorrect.");
        }
예제 #44
0
        public void CWTON_CmdStr2()
        {
            Subsystem ss = new Subsystem(Subsystem.SUB_600KHZ_VERT_PISTON_B, 1);
            AdcpSubsystemCommands ssc = new AdcpSubsystemCommands(new SubsystemConfiguration(ss, 4, 0));
            ssc.CWTON = true;

            Assert.AreEqual("CWTON[4] 1", ssc.CWTON_CmdStr(), "CWTON Cmd Str is incorrect.");
        }
예제 #45
0
        public void Load(Subsystem subsystem)
        {
            switch (subsystem)
            {
            case Subsystem.Core:
                LoadFiles(
                    @"Data\INI\Default\GameData.ini",
                    @"Data\INI\GameData.ini",
                    @"Data\INI\Mouse.ini",
                    @"Data\INI\Water.ini",
                    @"Data\INI\AudioSettings.ini",
                    $@"Data\{_contentManager.Language}\HeaderTemplate.ini",
                    @"Maps\MapCache.ini");

                break;

            case Subsystem.Audio:
                LoadFiles(
                    @"Data\INI\AudioSettings.ini",
                    @"Data\INI\SoundEffects.ini",
                    @"Data\INI\MiscAudio.ini",
                    @"Data\INI\Voice.ini",
                    @"Data\Ini\Music.ini");
                break;

            case Subsystem.ObjectCreation:
                LoadFiles(@"Data\INI\Default\Object.ini");
                _contentManager.LoadIniFiles(@"Data\INI\Object");
                // TODO: Not sure of order here, but they definitely need to be loaded after all the object ini files above.
                LoadFiles(
                    @"Data\INI\ObjectCreationList.ini",
                    @"Data\INI\Upgrade.ini",
                    @"Data\INI\Crate.ini");
                break;

            case Subsystem.Locomotors:
                LoadFiles(
                    @"Data\INI\Locomotor.ini");
                break;

            case Subsystem.Sciences:
                LoadFiles(
                    @"Data\INI\Science.ini");
                break;

            case Subsystem.Weapons:
                LoadFiles(
                    @"Data\INI\Weapon.ini");
                break;

            case Subsystem.FXList:
                LoadFiles(
                    @"Data\INI\FXList.ini");
                break;

            case Subsystem.Players:
                LoadFiles(
                    @"Data\INI\Default\PlayerTemplate.ini",
                    @"Data\INI\PlayerTemplate.ini",
                    @"Data\INI\ControlBarScheme.ini",
                    @"Data\INI\CommandSet.ini",
                    @"Data\INI\CommandButton.ini");
                break;

            case Subsystem.Terrain:
                LoadFiles(
                    @"Data\INI\Default\Terrain.ini",
                    @"Data\INI\Terrain.ini",
                    @"Data\INI\Default\Roads.ini",
                    @"Data\INI\Roads.ini");
                break;

            case Subsystem.ParticleSystems:
                LoadFiles(@"Data\INI\ParticleSystem.ini");
                break;

            case Subsystem.Wnd:
                LoadFiles(
                    @"Data\INI\WindowTransitions.ini",
                    @"Data\INI\ControlBarScheme.ini");
                _contentManager.LoadIniFiles(@"Data\INI\MappedImages\HandCreated");
                _contentManager.LoadIniFiles(@"Data\INI\MappedImages\TextureSize_512");
                break;

            case Subsystem.Multiplayer:
                LoadFiles(@"Data\INI\Multiplayer.ini");
                break;

            case Subsystem.LinearCampaign:
                LoadFiles(@"Data\INI\Campaign.ini");
                break;

            case Subsystem.Credits:
                LoadFiles(@"Data\INI\Credits.ini");
                break;

            case Subsystem.Damage:
                LoadFiles(@"Data\INI\DamageFX.ini");
                break;

            case Subsystem.SpecialPower:
                LoadFiles(@"Data\INI\Default\SpecialPower.ini");
                LoadFiles(@"Data\INI\SpecialPower.ini");
                break;

            case Subsystem.InGameUI:
                LoadFiles(@"Data\INI\InGameUI.ini");
                break;

            case Subsystem.Rank:
                LoadFiles(@"Data\INI\Rank.ini");
                break;

            case Subsystem.Animation2D:
                LoadFiles(@"Data\INI\Animation2D.ini");
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(subsystem), subsystem, null);
            }
        }
예제 #46
0
        public void TestCBI_BurstInterval_CornerOver()
        {
            Subsystem ss = new Subsystem(Subsystem.SUB_600KHZ_VERT_PISTON_B, 1);
            AdcpSubsystemCommands ssc = new AdcpSubsystemCommands(new SubsystemConfiguration(ss, 0, 0));

            ssc.CBI_BurstInterval = new TimeValue(502, 97, 83, 124);

            Assert.AreEqual(new TimeValue(503, 38, 24, 24), ssc.CBI_BurstInterval, "CBI_BurstInterval is incorrect.");
        }
예제 #47
0
        private void btnCommand_Click(object sender, EventArgs e)
        {
            string    strSender     = "";
            Subsystem ConfigureInfo = MachineInfo.SubsystemList.Find(str => str.Name == "反应盘调试");

            switch (((SimpleButton)sender).Name)
            {
            case "btninitializeRD":
                strSender = ConfigureInfo.ComponetList.Find(componet => componet.Name == lblResponseDishDebug.Text).CommandList.Find(command => command.FullName == btninitializeRD.Text).Name;
                break;

            case "btnLightPathAlignment":
                strSender = ConfigureInfo.ComponetList.Find(componet => componet.Name == lblResponseDishDebug.Text).CommandList.Find(command => command.FullName == btnLightPathAlignment.Text).Name;
                break;

            case "btnClockwiseRotationOP":
                strSender = ConfigureInfo.ComponetList.Find(componet => componet.Name == lblResponseDishDebug.Text).CommandList.Find(command => command.FullName == btnClockwiseRotationOP.Text).Name;
                break;

            case "btnContrarotateOP":
                strSender = ConfigureInfo.ComponetList.Find(componet => componet.Name == lblResponseDishDebug.Text).CommandList.Find(command => command.FullName == btnContrarotateOP.Text).Name;
                break;

            case "btnRotateAR":
                strSender = ConfigureInfo.ComponetList.Find(componet => componet.Name == lblResponseDishDebug.Text).CommandList.Find(command => command.FullName == btnRotateAR.Text).Name;
                break;

            case "btnRotateOCP":
                strSender = ConfigureInfo.ComponetList.Find(componet => componet.Name == lblResponseDishDebug.Text).CommandList.Find(command => command.FullName == btnRotateOCP.Text).Name;
                break;

            case "btnInitializeLocationCS":
                strSender = ConfigureInfo.ComponetList.Find(componet => componet.Name == lblResponseDishDebug.Text).CommandList.Find(command => command.FullName == btnInitializeLocationCS.Text).Name;
                break;

            case "btnLightPathAlignmentCS":
                strSender = ConfigureInfo.ComponetList.Find(componet => componet.Name == lblResponseDishDebug.Text).CommandList.Find(command => command.FullName == btnLightPathAlignmentCS.Text).Name;
                break;

            case "btninitializeER":
                strSender = ConfigureInfo.ComponetList.Find(componet => componet.Name == lblEightRinseDebug.Text).CommandList.Find(command => command.FullName == btninitializeER.Text).Name;
                break;

            case "btnToBottom":
                strSender = ConfigureInfo.ComponetList.Find(componet => componet.Name == lblEightRinseDebug.Text).CommandList.Find(command => command.FullName == btnToBottom.Text).Name;
                break;

            case "btnToTop":
                strSender = ConfigureInfo.ComponetList.Find(componet => componet.Name == lblEightRinseDebug.Text).CommandList.Find(command => command.FullName == btnToTop.Text).Name;
                break;

            case "btnUpCalibration":
                strSender = ConfigureInfo.ComponetList.Find(componet => componet.Name == lblEightRinseDebug.Text).CommandList.Find(command => command.FullName == btnUpCalibration.Text).Name;
                break;

            case "btnDownCalibration":
                strSender = ConfigureInfo.ComponetList.Find(componet => componet.Name == lblEightRinseDebug.Text).CommandList.Find(command => command.FullName == btnDownCalibration.Text).Name;
                break;

            case "btnSaveCalibration":
                strSender = ConfigureInfo.ComponetList.Find(componet => componet.Name == lblEightRinseDebug.Text).CommandList.Find(command => command.FullName == btnSaveCalibration.Text).Name;
                break;

            case "btnprobeTD":
                strSender = ConfigureInfo.ComponetList.Find(componet => componet.Name == lblResponseTC.Text).CommandList.Find(command => command.FullName == btnprobeTD.Text).Name;
                break;

            default:
                break;
            }

            if (SendNetworkEvent != null && strSender != "")
            {
                SendNetworkEvent(strSender);
            }
        }
예제 #48
0
        public PEBuilder(
            Machine machine,
            int sectionAlignment, 
            int fileAlignment, 
            ulong imageBase,
            byte majorLinkerVersion,
            byte minorLinkerVersion,
            ushort majorOperatingSystemVersion,
            ushort minorOperatingSystemVersion,
            ushort majorImageVersion,
            ushort minorImageVersion,
            ushort majorSubsystemVersion,
            ushort minorSubsystemVersion,
            Subsystem subsystem,
            DllCharacteristics dllCharacteristics,
            Characteristics imageCharacteristics,
            ulong sizeOfStackReserve,
            ulong sizeOfStackCommit,
            ulong sizeOfHeapReserve,
            ulong sizeOfHeapCommit,
            Func<BlobBuilder, ContentId> deterministicIdProvider = null)
        {
            Machine = machine;
            SectionAlignment = sectionAlignment;
            FileAlignment = fileAlignment;
            ImageBase = imageBase;
            MajorLinkerVersion = majorLinkerVersion;
            MinorLinkerVersion = minorLinkerVersion;
            MajorOperatingSystemVersion = majorOperatingSystemVersion;
            MinorOperatingSystemVersion = minorOperatingSystemVersion;
            MajorImageVersion = majorImageVersion;
            MinorImageVersion = minorImageVersion;
            MajorSubsystemVersion = majorSubsystemVersion;
            MinorSubsystemVersion = minorSubsystemVersion;
            Subsystem = subsystem;
            DllCharacteristics = dllCharacteristics;
            ImageCharacteristics = imageCharacteristics;
            SizeOfStackReserve = sizeOfStackReserve;
            SizeOfStackCommit = sizeOfStackCommit;
            SizeOfHeapReserve = sizeOfHeapReserve;
            SizeOfHeapCommit = sizeOfHeapCommit;
            IsDeterministic = deterministicIdProvider != null;
            IdProvider = deterministicIdProvider ?? GetCurrentTimeBasedIdProvider();

            _sections = new List<Section>();
        }
예제 #49
0
    public void SetWeapon(Subsystem sub, WeaponType weapon)
    {
        GameObject gunPoint;
        GameObject newGun;


        switch (sub)
        {
        case Subsystem.GUN_MAIN:
            gunPoint = player.transform.Find("GunPoint_Main").gameObject;
            break;

        case Subsystem.GUN_TLEFT:
            gunPoint = player.transform.Find("GunPoint_TLeft").gameObject;
            break;

        case Subsystem.GUN_TRIGHT:
            gunPoint = player.transform.Find("GunPoint_TRight").gameObject;
            break;

        case Subsystem.GUN_BLEFT:
            gunPoint = player.transform.Find("GunPoint_BLeft").gameObject;
            break;

        case Subsystem.GUN_BRIGHT:
            gunPoint = player.transform.Find("GunPoint_BRight").gameObject;
            break;

        default:
            Debug.Log("Unknown Subsystem type");
            return;
        }

        switch (weapon)
        {
        case WeaponType.REPEATER:
            newGun = ObjectPooler.GetObject("Player_Repeater");
            newGun.GetComponent <Weapon>().level = getSubLevel(sub, weapon);
            activeWeapon[(int)sub] = WeaponType.REPEATER;
            break;

        case WeaponType.SHOTGUN:
            newGun = ObjectPooler.GetObject("Player_ShotGun");
            newGun.GetComponent <Weapon>().level = getSubLevel(sub, weapon);
            activeWeapon[(int)sub] = WeaponType.SHOTGUN;
            break;

        default:
            Debug.Log("Unknown new Weapon Type");
            return;
        }

        //Pool Current Gun
        ObjectPooler.PoolObject(gunPoint.transform.GetChild(0).gameObject);

        //Set New Gun
        newGun.transform.parent        = gunPoint.transform;
        newGun.transform.localPosition = Vector3.zero;
        newGun.transform.localScale    = Vector3.one;
        newGun.transform.localRotation = Quaternion.Euler(Vector3.zero);

        player.weapons[(int)sub] = newGun.GetComponent <Weapon>();
        player.PropagateTag(player.transform);
    }
        internal ModulePropertiesForSerialization(
            Guid persistentIdentifier,
            CorFlags corFlags,
            int fileAlignment,
            int sectionAlignment,
            string targetRuntimeVersion,
            Machine machine,
            ulong baseAddress,
            ulong sizeOfHeapReserve,
            ulong sizeOfHeapCommit,
            ulong sizeOfStackReserve,
            ulong sizeOfStackCommit,
            DllCharacteristics dllCharacteristics,
            Characteristics imageCharacteristics,
            Subsystem subsystem,
            ushort majorSubsystemVersion,
            ushort minorSubsystemVersion,
            byte linkerMajorVersion,
            byte linkerMinorVersion)
        {
            this.PersistentIdentifier = persistentIdentifier;
            this.FileAlignment = fileAlignment;
            this.SectionAlignment = sectionAlignment;
            this.TargetRuntimeVersion = targetRuntimeVersion;
            this.Machine = machine;
            this.BaseAddress = baseAddress;
            this.SizeOfHeapReserve = sizeOfHeapReserve;
            this.SizeOfHeapCommit = sizeOfHeapCommit;
            this.SizeOfStackReserve = sizeOfStackReserve;
            this.SizeOfStackCommit = sizeOfStackCommit;
            this.LinkerMajorVersion = linkerMajorVersion;
            this.LinkerMinorVersion = linkerMinorVersion;
            this.MajorSubsystemVersion = majorSubsystemVersion;
            this.MinorSubsystemVersion = minorSubsystemVersion;
            this.ImageCharacteristics = imageCharacteristics;
            this.Subsystem = subsystem;

            this.DllCharacteristics = dllCharacteristics;
            this.CorFlags = corFlags;
        }
예제 #51
0
        // Token: 0x060000D6 RID: 214 RVA: 0x00013710 File Offset: 0x00011910
        private void OK_Click(object sender, EventArgs e)
        {
            try
            {
                base.Enabled = false;
                this.OK.Text = "生成中...";
                this.OK.Refresh();
                this.StatusText.Text = "プロジェクト生成準備中...";
                this.StatusText.Refresh();
                Global.config.lastData.ProjDir = this.RootDir.Text;
                string text = Path.Combine(this.RootDir.Text, this.ProjectName.Text);
                if (Directory.Exists(text) && MessageBox.Show(string.Concat(new string[]
                {
                    "ディレクトリ",
                    Environment.NewLine,
                    "\"",
                    text,
                    "\"",
                    Environment.NewLine,
                    "はすでに存在します。",
                    Environment.NewLine,
                    "中に含まれるファイルは上書きされてしまう事があります。",
                    Environment.NewLine,
                    "続行しますか?"
                }), "プロジェクト生成警告", MessageBoxButtons.OKCancel, MessageBoxIcon.Exclamation) == DialogResult.Cancel)
                {
                    return;
                }
                this.ProjectFile = Path.Combine(text, this.ProjectName.Text + Global.definition.ProjExt);
                string  text2   = Path.Combine(Path.GetDirectoryName(this.runtimes[this.RuntimeSet.SelectedIndex]), Path.GetFileNameWithoutExtension(this.runtimes[this.RuntimeSet.SelectedIndex]));
                Project project = new Project();
                project.Name    = this.ProjectName.Text;
                project.Runtime = this.runtimedatas[this.RuntimeSet.SelectedIndex];
                project.Config  = ConfigurationOwner.LoadXML(Path.Combine(text2, this.runtimedatas[this.RuntimeSet.SelectedIndex].Definitions.Configurations));
                if (project.Runtime.Definitions.LayerSize.bytesize != 0)
                {
                    project.LayerData  = new string[this.runtimedatas[this.RuntimeSet.SelectedIndex].Definitions.LayerSize.y];
                    project.LayerData2 = new string[this.runtimedatas[this.RuntimeSet.SelectedIndex].Definitions.LayerSize.y];
                    project.LayerData3 = new string[this.runtimedatas[this.RuntimeSet.SelectedIndex].Definitions.LayerSize.y];
                    project.LayerData4 = new string[this.runtimedatas[this.RuntimeSet.SelectedIndex].Definitions.LayerSize.y];
                }
                project.StageData  = new string[this.runtimedatas[this.RuntimeSet.SelectedIndex].Definitions.StageSize.y];
                project.StageData2 = new string[this.runtimedatas[this.RuntimeSet.SelectedIndex].Definitions.StageSize.y];
                project.StageData3 = new string[this.runtimedatas[this.RuntimeSet.SelectedIndex].Definitions.StageSize.y];
                project.StageData4 = new string[this.runtimedatas[this.RuntimeSet.SelectedIndex].Definitions.StageSize.y];
                project.MapData    = new string[this.runtimedatas[this.RuntimeSet.SelectedIndex].Definitions.MapSize.y];
                ChipDataClass chipDataClass = ChipDataClass.ParseXML(Path.Combine(text2, this.runtimedatas[this.RuntimeSet.SelectedIndex].Definitions.ChipDefinition));
                string        character     = chipDataClass.Mapchip[0].character;
                for (int i = 0; i < project.StageData.Length; i++)
                {
                    StringBuilder stringBuilder = new StringBuilder();
                    for (int j = 0; j < project.Runtime.Definitions.StageSize.x; j++)
                    {
                        stringBuilder.Append(character);
                    }
                    project.StageData[i] = stringBuilder.ToString();
                }
                project.StageData2 = (string[])project.StageData.Clone();
                project.StageData3 = (string[])project.StageData.Clone();
                project.StageData4 = (string[])project.StageData.Clone();
                character          = chipDataClass.WorldChip[0].character;
                for (int k = 0; k < project.MapData.Length; k++)
                {
                    StringBuilder stringBuilder2 = new StringBuilder();
                    for (int l = 0; l < project.Runtime.Definitions.MapSize.x; l++)
                    {
                        stringBuilder2.Append(character);
                    }
                    project.MapData[k] = stringBuilder2.ToString();
                }
                if (project.Runtime.Definitions.LayerSize.bytesize != 0)
                {
                    character = chipDataClass.Layerchip[0].character;
                    for (int m = 0; m < project.LayerData.Length; m++)
                    {
                        StringBuilder stringBuilder3 = new StringBuilder();
                        for (int n = 0; n < project.Runtime.Definitions.LayerSize.x; n++)
                        {
                            stringBuilder3.Append(character);
                        }
                        project.LayerData[m] = stringBuilder3.ToString();
                    }
                    project.LayerData2 = (string[])project.LayerData.Clone();
                    project.LayerData3 = (string[])project.LayerData.Clone();
                    project.LayerData4 = (string[])project.LayerData.Clone();
                }
                this.StatusText.Text = "HTMLデータ取得準備中...";
                this.StatusText.Refresh();
                string input = "";
                try
                {
                    input = Subsystem.LoadUnknownTextFile(this.ParseFile);
                }
                catch
                {
                    MessageBox.Show("ファイルをロードできませんでした。", "コンバート失敗", MessageBoxButtons.OK, MessageBoxIcon.Hand);
                    base.DialogResult = DialogResult.Cancel;
                    base.Close();
                }
                List <string> list = new List <string>();
                if (this.SeekHeaderFooter.Checked)
                {
                    Regex regex = new Regex("^.*?<[ ]*?APPLET .*?>", RegexOptions.IgnoreCase | RegexOptions.Singleline);
                    Match match = regex.Match(input);
                    if (match.Success)
                    {
                        project.Runtime.DefaultConfigurations.HeaderHTML = match.Value;
                    }
                    regex = new Regex("<[ ]*?/[ ]*?APPLET[ ]*?>.*$", RegexOptions.IgnoreCase | RegexOptions.Singleline);
                    match = regex.Match(input);
                    if (match.Success)
                    {
                        project.Runtime.DefaultConfigurations.FooterHTML = match.Value;
                    }
                }
                this.StatusText.Text = "HTMLデータ取得中...";
                this.StatusText.Refresh();

                Regex regex2       = new Regex(@"<[ ]*PARAM[ ]+NAME=""(?<name>.*?)""[ ]+VALUE=""(?<value>.*?)"".*?>", RegexOptions.IgnoreCase | RegexOptions.Singleline);
                Regex regex_script = new Regex(@"<[ ]*?script.*?>.*?new\s*?(JSMasao|CanvasMasao\.\s*?Game)", RegexOptions.IgnoreCase | RegexOptions.Singleline);
                if (regex_script.IsMatch(input))
                {
                    regex2 = new Regex(@"(""|')(?<name>.*?)(""|')\s*?:\s*?(""|')(?<value>.*?)(?<!\\)(""|')(,|\s*?)", RegexOptions.IgnoreCase | RegexOptions.Singleline);
                }

                Dictionary <string, string> dictionary = new Dictionary <string, string>();
                Match match2 = regex2.Match(input);
                while (match2.Success)
                {
                    dictionary[match2.Groups["name"].Value] = match2.Groups["value"].Value;
                    match2 = match2.NextMatch();
                }
                this.StatusText.Text = "マップソース生成中...";
                this.StatusText.Refresh();
                this.GetMapSource(ref project.MapData, project.Runtime.Definitions.MapName, project.Runtime.Definitions.MapSize, ref dictionary, chipDataClass.WorldChip);
                this.StatusText.Text = "ステージソース生成中[1/4]...";
                this.StatusText.Refresh();
                this.GetMapSource(ref project.StageData, project.Runtime.Definitions.ParamName, project.Runtime.Definitions.StageSize, ref dictionary, chipDataClass.Mapchip, project.Runtime.Definitions.StageSplit);
                this.StatusText.Text = "ステージソース生成中[2/4]...";
                this.StatusText.Refresh();
                this.GetMapSource(ref project.StageData2, project.Runtime.Definitions.ParamName2, project.Runtime.Definitions.StageSize, ref dictionary, chipDataClass.Mapchip, project.Runtime.Definitions.StageSplit);
                this.StatusText.Text = "ステージソース生成中[3/4]...";
                this.StatusText.Refresh();
                this.GetMapSource(ref project.StageData3, project.Runtime.Definitions.ParamName3, project.Runtime.Definitions.StageSize, ref dictionary, chipDataClass.Mapchip, project.Runtime.Definitions.StageSplit);
                this.StatusText.Text = "ステージソース生成中[4/4]...";
                this.StatusText.Refresh();
                this.GetMapSource(ref project.StageData4, project.Runtime.Definitions.ParamName4, project.Runtime.Definitions.StageSize, ref dictionary, chipDataClass.Mapchip, project.Runtime.Definitions.StageSplit);
                if (project.Runtime.Definitions.LayerSize.bytesize != 0)
                {
                    this.StatusText.Text = "レイヤーソース生成中[1/4]...";
                    this.StatusText.Refresh();
                    this.GetMapSource(ref project.LayerData, project.Runtime.Definitions.LayerName, project.Runtime.Definitions.LayerSize, ref dictionary, chipDataClass.Layerchip, project.Runtime.Definitions.LayerSplit);
                    this.StatusText.Text = "レイヤーソース生成中[2/4]...";
                    this.StatusText.Refresh();
                    this.GetMapSource(ref project.LayerData2, project.Runtime.Definitions.LayerName2, project.Runtime.Definitions.LayerSize, ref dictionary, chipDataClass.Layerchip, project.Runtime.Definitions.LayerSplit);
                    this.StatusText.Text = "レイヤーソース生成中[3/4]...";
                    this.StatusText.Refresh();
                    this.GetMapSource(ref project.LayerData3, project.Runtime.Definitions.LayerName3, project.Runtime.Definitions.LayerSize, ref dictionary, chipDataClass.Layerchip, project.Runtime.Definitions.LayerSplit);
                    this.StatusText.Text = "レイヤーソース生成中[4/4]...";
                    this.StatusText.Refresh();
                    this.GetMapSource(ref project.LayerData4, project.Runtime.Definitions.LayerName4, project.Runtime.Definitions.LayerSize, ref dictionary, chipDataClass.Layerchip, project.Runtime.Definitions.LayerSplit);
                }
                this.StatusText.Text = "パラメータ反映中...";
                this.StatusText.Refresh();

                var    s       = string.Join(string.Empty, project.MapData);
                string Mapdata = new string(s.Except(s.Where(ch => s.Count(c => c == ch) > 1)).ToArray());                 // 地図画面データを圧縮

                int num = 0;
                while (num < project.Config.Configurations.Length)
                {
                    switch (project.Config.Configurations[num].Type)
                    {
                    case ConfigParam.Types.b:
                    case ConfigParam.Types.b2:
                    case ConfigParam.Types.b0:
                        if (dictionary.ContainsKey(project.Config.Configurations[num].Name))
                        {
                            if (dictionary[project.Config.Configurations[num].Name] == "2" || dictionary[project.Config.Configurations[num].Name] == "0")
                            {
                                project.Config.Configurations[num].Value = "false";
                            }
                            else
                            {
                                project.Config.Configurations[num].Value = "true";
                            }
                        }
                        else
                        {
                            switch (project.Config.Configurations[num].Name)                             // 個別に初期値を設定
                            {
                            case "se_switch":
                            case "mcs_haikei_visible":
                            case "fx_bgm_loop":
                            case "se_filename":
                                project.Config.Configurations[num].Value =
                                    "false";
                                break;

                            case "pause_switch":
                            case "j_fire_mkf":
                                project.Config.Configurations[num].Value =
                                    "true";
                                break;
                            }
                        }
                        break;

                    case ConfigParam.Types.s:
                    case ConfigParam.Types.i:
                    case ConfigParam.Types.l:
                    case ConfigParam.Types.l_a:
                        goto IL_D9E;

                    case ConfigParam.Types.t:
                    {
                        string name = project.Config.Configurations[num].Name;

                        switch (name)                         // 個別に初期値を設定
                        {
                        case "serifu1": project.Config.Configurations[num].Value =
                            "人の命は、お金では買えないと言われています。\r\nしかし、お店へ行けば、SCOREで買えます。\r\n0";
                            break;

                        case "serifu2": project.Config.Configurations[num].Value =
                            "時は金なりと、言われています。しかし、\r\nお店なら、時間も買えます。\r\n店員さんて、グレートですね。";
                            break;

                        case "serifu3": project.Config.Configurations[num].Value =
                            "おはようございます。星と数字が付いた扉が、\r\nありますよね。あれは、ですねえ、その数だけ\r\n人面星を取ると、開くので、ございます。";
                            break;

                        case "serifu4": project.Config.Configurations[num].Value =
                            "LAST STAGEというのは、最終面の事ですわ。\r\nこれをクリアーすると、エンディングに、\r\n行けますのよ。がんばって下さいね。";
                            break;

                        case "serifu_key2_on": project.Config.Configurations[num].Value =
                            "3つのKEY2がないと、\r\nここから先へは進めないぜ。\r\nどこかで見つ付けてくれ。";
                            break;

                        case "hitokoto1": project.Config.Configurations[num].Value =
                            "今日は、いい天気だね。\r\n0\r\n0";
                            break;

                        case "hitokoto2": project.Config.Configurations[num].Value =
                            "ついに、ここまで来ましたね。\r\n0\r\n0";
                            break;

                        case "hitokoto3": project.Config.Configurations[num].Value =
                            "オレは、世界一になる男だ。\r\n0\r\n0";
                            break;

                        case "hitokoto4": project.Config.Configurations[num].Value =
                            "んちゃ!\r\n0\r\n0";
                            break;
                        }

                        List <string> list2 = new List <string>();

                        int num2 = 1;

                        Regex text_name_regex = new Regex(@"-(\d+)$");
                        Match text_name_match = text_name_regex.Match(name);
                        if (text_name_match.Success)
                        {
                            num2 = int.Parse(text_name_match.Groups[0].Value);
                            name = text_name_regex.Replace(name, string.Empty);
                        }

                        while (dictionary.ContainsKey(name + "-" + num2.ToString()))
                        {
                            list2.Add(dictionary[name + "-" + num2.ToString()]);
                            num2++;
                        }
                        if (list2.Count > 0)
                        {
                            if (project.Config.Configurations[num].Rows > list2.Count)
                            {
                                while (project.Config.Configurations[num].Rows > list2.Count)
                                {
                                    list2.Add("0");
                                }
                            }
                            else if (project.Config.Configurations[num].Rows < list2.Count)
                            {
                                list2.RemoveRange(project.Config.Configurations[num].Rows, list2.Count - project.Config.Configurations[num].Rows);
                            }
                            project.Config.Configurations[num].Value = string.Join(Environment.NewLine, list2.ToArray());
                            // 文字列に\"が含まれていた場合エスケープを戻す
                            project.Config.Configurations[num].Value = project.Config.Configurations[num].Value.Replace(@"\""", @"""");
                            project.Config.Configurations[num].Value = project.Config.Configurations[num].Value.Replace(@"\\", @"\");
                        }
                        break;
                    }

                    case ConfigParam.Types.f:
                    case ConfigParam.Types.f_i:
                    case ConfigParam.Types.f_a:
                        if (dictionary.ContainsKey(project.Config.Configurations[num].Name))
                        {
                            list.Add(dictionary[project.Config.Configurations[num].Name]);
                            project.Config.Configurations[num].Value = Path.GetFileName(dictionary[project.Config.Configurations[num].Name]);
                        }
                        break;

                    case ConfigParam.Types.c:
                    {
                        string[] array = new string[]
                        {
                            "red",
                            "green",
                            "blue"
                        };
                        int[]  array2 = new int[3];
                        string name = project.Config.Configurations[num].Name, param_name;
                        for (int num3 = 0; num3 < 3; num3++)
                        {
                            param_name = name.Replace("@", array[num3]);

                            // パラメータが存在しない または 数値に変換できない
                            if (!dictionary.ContainsKey(param_name) || !int.TryParse(dictionary[param_name], out array2[num3]))
                            {
                                // デフォルト値を代入
                                switch (param_name)
                                {
                                case "backcolor_red":
                                case "scorecolor_red":
                                case "scorecolor_green":
                                case "grenade_blue2":
                                case "mizunohadou_red":
                                case "firebar_green1":
                                case "firebar_blue1":
                                case "firebar_blue2":
                                case "kaishi_red":
                                case "kaishi_blue":
                                case "kaishi_green":
                                case "backcolor_red_s":
                                case "backcolor_blue_s":
                                case "backcolor_green_s":
                                case "backcolor_red_t":
                                    array2[num3] = 0;
                                    break;

                                case "backcolor_green":
                                case "backcolor_blue":
                                case "scorecolor_blue":
                                case "grenade_red1":
                                case "grenade_green1":
                                case "grenade_blue1":
                                case "grenade_red2":
                                case "grenade_green2":
                                case "mizunohadou_blue":
                                case "firebar_red1":
                                case "firebar_red2":
                                case "backcolor_green_t":
                                case "backcolor_blue_t":
                                    array2[num3] = 255;
                                    break;

                                case "mizunohadou_green":
                                    array2[num3] = 32;
                                    break;

                                case "firebar_green2":
                                case "backcolor_red_f":
                                    array2[num3] = 192;
                                    break;

                                case "backcolor_green_f":
                                case "backcolor_blue_f":
                                    array2[num3] = 48;
                                    break;
                                }
                            }
                        }

                        Colors colors = default(Colors);
                        colors.r = array2[0];
                        colors.g = array2[1];
                        colors.b = array2[2];
                        project.Config.Configurations[num].Value = colors.ToString();                         // 配列を文字列に変換 [r,g,b] => "r,g,b"

                        break;
                    }

                    default:
                        goto IL_D9E;
                    }
IL_DF3:
                    num++;
                    continue;
IL_D9E:
                    if (dictionary.ContainsKey(project.Config.Configurations[num].Name))
                    {
                        project.Config.Configurations[num].Value = dictionary[project.Config.Configurations[num].Name];
                        if (project.Config.Configurations[num].Type == ConfigParam.Types.s)                         // 文字列に\"が含まれていた場合エスケープを戻す
                        {
                            project.Config.Configurations[num].Value = project.Config.Configurations[num].Value.Replace(@"\""", @"""");
                            project.Config.Configurations[num].Value = project.Config.Configurations[num].Value.Replace(@"\\", @"\");
                        }
                        goto IL_DF3;
                    }
                    else if (project.Config.Configurations[num].Relation == "STAGENUM")
                    {
                        // アスキーコードで98('b')が地図画面に含まれている場合、ステージ2を選択できるように
                        // ステージ3、4も同様
                        int map_code_ASCII;
                        for (int i = 2; i <= 4; i++)
                        {
                            map_code_ASCII = i + 96;
                            if (Mapdata.Contains(((char)map_code_ASCII).ToString()))
                            {
                                project.Config.Configurations[num].Value = i.ToString();
                            }
                        }
                    }
                    else
                    {
                        switch (project.Config.Configurations[num].Name)                         // 個別に初期値を設定
                        {
                        case "j_hp_name":
                        case "now_loading":
                        case "oriboss_name":
                            project.Config.Configurations[num].Value =
                                "";
                            break;

                        case "time_max":
                        case "shop_item_teika7":
                            project.Config.Configurations[num].Value =
                                "300";
                            break;

                        case "gazou_scroll_speed_x":
                        case "gazou_scroll_speed_y":
                        case "second_gazou_scroll_speed_x":
                        case "second_gazou_scroll_speed_y":
                        case "oriboss_x":
                        case "oriboss_y":
                            project.Config.Configurations[num].Value =
                                "0";
                            break;

                        case "water_visible":
                        case "j_tail_type":
                        case "oriboss_hp":
                        case "oriboss_speed":
                        case "dokan_mode":
                            project.Config.Configurations[num].Value =
                                "1";
                            break;

                        case "boss_name":
                        case "boss2_name":
                        case "boss3_name":
                            project.Config.Configurations[num].Value =
                                "BOSS";
                            break;

                        case "mes1_name": project.Config.Configurations[num].Value =
                            "ダケシ";
                            break;

                        case "mes2_name": project.Config.Configurations[num].Value =
                            "エリコ";
                            break;

                        case "oriboss_width":
                        case "oriboss_height":
                            project.Config.Configurations[num].Value =
                                "32";
                            break;

                        case "door_score": project.Config.Configurations[num].Value =
                            "800";
                            break;

                        case "url1":
                        case "url2":
                        case "url3":
                            project.Config.Configurations[num].Value =
                                "http://www.yahoo.co.jp/";
                            break;

                        case "url4": project.Config.Configurations[num].Value =
                            "http://www.t3.rim.or.jp/~naoto/naoto.html";
                            break;
                        }
                    }
                    goto IL_DF3;
                }
                Directory.CreateDirectory(text);
                foreach (string text3 in Directory.GetFiles(text2, "*", SearchOption.TopDirectoryOnly))
                {
                    if (!(Path.GetFileName(text3) == this.runtimedatas[this.RuntimeSet.SelectedIndex].Definitions.Configurations))
                    {
                        string text4 = Path.Combine(text, Path.GetFileName(text3));
                        if (!File.Exists(text4) || MessageBox.Show(string.Concat(new string[]
                        {
                            text4,
                            Environment.NewLine,
                            "はすでに存在しています。",
                            Environment.NewLine,
                            "上書きしてもよろしいですか?"
                        }), "上書きの警告", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation) != DialogResult.No)
                        {
                            File.Copy(text3, text4, true);
                        }
                    }
                }
                foreach (string text5 in list)
                {
                    if (File.Exists(Path.Combine(Path.GetDirectoryName(this.ParseFile), text5)))
                    {
                        File.Copy(Path.Combine(Path.GetDirectoryName(this.ParseFile), text5), Path.Combine(text, Path.GetFileName(text5)), true);
                    }
                }
                project.SaveXML(this.ProjectFile);
            }
            catch (Exception ex)
            {
                MessageBox.Show(string.Concat(new string[]
                {
                    "プロジェクト生成に失敗しました。",
                    Environment.NewLine,
                    ex.Message,
                    Environment.NewLine,
                    ex.StackTrace
                }), "プロジェクト生成エラー", MessageBoxButtons.OK, MessageBoxIcon.Hand);
                return;
            }
            finally
            {
                this.OK.Text = "OK";
                base.Enabled = true;
            }
            base.DialogResult = DialogResult.OK;
            base.Close();
        }