Beispiel #1
0
        /// <summary>
        /// Overwrite callsign.plc and callsign.lbk file. (Perhaps this might be only valid for 4.34)
        /// </summary>
        protected void SavePlcLbk()
        {
            string filename = appReg.GetInstallDir() + "/User/Config/" + appReg.GetPilotCallsign().ToString() + ".plc";

            if (!System.IO.File.Exists(filename))
            {
                byte[] nbs =
                {
                    0x9C, 0x02, 0x91, 0x0D, 0x9D, 0x0C, 0xD3, 0x45, 0xC9, 0x16, 0x90, 0x00, 0x8A, 0x07, 0xD8, 0x6A,
                    0xF4, 0x78, 0xF3, 0x69, 0xE4, 0x5D, 0xC3, 0xAF
                };
                System.IO.FileStream nfs = new System.IO.FileStream
                                               (filename, System.IO.FileMode.Create, System.IO.FileAccess.Write);
                nfs.Write(nbs, 0, nbs.Length);
                nfs.Close();
            }

            filename = appReg.GetInstallDir() + "/User/Config/" + appReg.GetPilotCallsign().ToString() + ".lbk";
            if (!System.IO.File.Exists(filename))
            {
                byte[] nbs =
                {
                    0x54, 0x5A, 0x53, 0x10, 0x2F, 0x28, 0x64, 0x62, 0x65, 0x45, 0x3C, 0x53, 0x26, 0x54, 0x74, 0x39,
                    0x58, 0x2B, 0x5F, 0x3A, 0x48, 0x58, 0x50, 0x4C, 0x4A, 0x57, 0x39, 0x19, 0x70, 0x03, 0x23, 0x5A,
                    0x35, 0x40, 0x37, 0x17, 0x5A, 0x3B, 0x48, 0x3C, 0x59, 0x2B, 0x6D, 0x0C, 0x60, 0x33, 0x69, 0x28,
                    0x38, 0x60, 0x3C, 0x2D, 0x6D, 0x02, 0x77, 0x05, 0x25, 0x68, 0x5F, 0x45, 0x41, 0x41, 0x41, 0x07,
                    0x12, 0x7E, 0x1D, 0x72, 0x1C, 0x3C, 0x55, 0x26, 0x06, 0x7F, 0x10, 0x65, 0x17, 0x37, 0xFA, 0xA4,
                    0xD7, 0xA3, 0xC6, 0xB4, 0xF2, 0x93, 0xFF, 0x9C, 0xF3, 0x9D, 0xBD, 0xD4, 0xA7, 0x87, 0xFE, 0x91,
                    0xE4, 0x96, 0xB6, 0xFB, 0x9A, 0xE9, 0x9D, 0xF8, 0x8A, 0xCC, 0xAD, 0xC1, 0xA2, 0xCD, 0xA3, 0x83,
                    0xEA, 0x99, 0xB9, 0xC0, 0xAF, 0xDA, 0xA8, 0x88, 0xC5, 0xA4, 0xD7, 0xA3, 0xC6, 0xB4, 0xF2, 0x93,
                    0xFF, 0x9C, 0xF3, 0x9D, 0xBD, 0xD4, 0xA7, 0x87, 0xFE, 0x91, 0xE4, 0x96, 0xB6, 0xFB, 0x9A, 0xE9,
                    0x9D, 0xF8, 0x8A, 0xCC, 0xCD, 0x4B, 0x28, 0x47, 0x29, 0x09, 0x60, 0x13, 0x33, 0x4A, 0x25, 0x50,
                    0x22, 0x02, 0x4F, 0x2E, 0x5D, 0x29, 0x4C, 0x3E, 0x78, 0x19, 0x75, 0x16, 0x79, 0x17, 0x37, 0x5E,
                    0x2D, 0x0D, 0x74, 0x1B, 0x6E, 0x1C, 0x3C, 0x71, 0x10, 0x63, 0x17, 0x72, 0xA2, 0xF5, 0x95, 0xF9,
                    0x9A, 0xF5, 0x9B, 0xBB, 0xD2, 0xA1, 0x81, 0xF8, 0x97, 0xE2, 0x90, 0xB0, 0xFD, 0x9C, 0xEF, 0x9B,
                    0xFE, 0x8C, 0xCA, 0xAB, 0xC7, 0xA4, 0xCB, 0xA5, 0x85, 0xEC, 0x9F, 0xBF, 0xC6, 0xA9, 0xDC, 0xAE,
                    0x8E, 0xC3, 0xA2, 0xD1, 0xA5, 0xC0, 0xB2, 0xF4, 0x95, 0xF9, 0x9A, 0xF5, 0x9B, 0xBB, 0xD2, 0xA1,
                    0x81, 0xF8, 0x97, 0xE2, 0x90, 0xB0, 0xFD, 0x9C, 0xEF, 0x9B, 0xFE, 0x8C, 0xCA, 0xAB, 0xC7, 0xA4,
                    0xCB, 0xA5, 0x85, 0xEC, 0x9F, 0xBF, 0xC6, 0xA9, 0xDC, 0xAE, 0x8E, 0xC3, 0xA2, 0xD1, 0xA5, 0xC0,
                    0xB2, 0xF4, 0x95, 0xF9, 0x9A, 0xF5, 0x9B, 0xBB, 0xD2, 0xA1, 0x81, 0xF8, 0x97, 0xE2, 0x90, 0xB0,
                    0xFD, 0x9C, 0xEF, 0x9B, 0xFE, 0x8C, 0xCA, 0xAB, 0xC7, 0xA4, 0xCB, 0xA5, 0x85, 0xEC, 0x9F, 0xBF,
                    0xC6, 0xA9, 0xDC, 0xAE, 0x8E, 0xC3, 0xA2, 0xD1, 0xA5, 0xC0, 0xB2, 0xF4, 0x95, 0xF9, 0x9A, 0xF5,
                    0x9B, 0xBB, 0xD2, 0xA1, 0x81, 0xF8, 0x97, 0xE2, 0x90, 0xB0, 0xFD, 0x9C, 0xEF, 0x9B, 0xFE, 0x8C,
                    0xCA, 0xAB, 0xC7, 0xA4, 0xCB, 0xA5, 0x85, 0xEC, 0x9F, 0xBF, 0xC6, 0xA9, 0xDC, 0xAE, 0x8E, 0xC3,
                    0xA2, 0xD1, 0xA5, 0xC0, 0xB2, 0xF4, 0x95, 0xF9, 0x9A, 0xF5, 0x9B, 0xBB, 0xD2, 0xA1, 0x81, 0xF8,
                    0x97, 0xE2, 0x90, 0xB0
                };
                System.IO.FileStream nfs = new System.IO.FileStream
                                               (filename, System.IO.FileMode.Create, System.IO.FileAccess.Write);
                nfs.Write(nbs, 0, nbs.Length);
                nfs.Close();
            }
        }
Beispiel #2
0
        /// <summary>
        /// As the name inplies...
        /// </summary>
        protected void SaveKeyMapping()
        {
            string filename    = appReg.GetInstallDir() + "/User/Config/BMS - Full.key";
            string fbackupname = appReg.GetInstallDir() + "/User/Config/Backup/BMS - Full.key";

            if (!System.IO.File.Exists(fbackupname))
            {
                System.IO.File.Copy(filename, fbackupname, true);
            }
            System.IO.StreamWriter sw = new System.IO.StreamWriter
                                            (filename, false, System.Text.Encoding.GetEncoding("utf-8"));
            for (int i = 0; i < keyFile.keyAssign.Length; i++)
            {
                sw.Write(keyFile.keyAssign[i].GetKeyLine());
            }
            for (int i = 0; i < deviceControl.devList.Count; i++)
            {
                sw.Write(deviceControl.joyAssign[i].GetKeyLineDX(i, deviceControl.devList.Count));
                // PRIMARY DEVICE POV
                if (((InGameAxAssgn)inGameAxis["Roll"]).GetDeviceNumber() == i)
                {
                    sw.Write(deviceControl.joyAssign[i].GetKeyLinePOV());
                }
            }
            sw.Close();

            filename = appReg.GetInstallDir() + "/User/Config/" + appReg.GetPilotCallsign().ToString() + ".pop";
            if (!System.IO.File.Exists(filename))
            {
                byte[] nbs =
                {
                    0x1B, 0x00, 0x00, 0x00, 0x00, 0x00, 0xA0, 0x42, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
                    0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x80, 0x3F, 0x63, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
                    0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0xA0, 0x40, 0x00, 0x00, 0x80, 0x3F, 0x1E, 0x1E, 0x7E, 0x3F,
                    0x1E, 0x1E, 0xFE, 0x3F, 0xD3, 0xD2, 0x9E, 0x41, 0x6A, 0x69, 0xB3, 0x42, 0x01, 0x00, 0x00, 0x00,
                    0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
                    0x03, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
                    0x02, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
                    0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
                    0x64, 0x00, 0x00, 0x00, 0x64, 0x00, 0x00, 0x00, 0x04, 0xFD, 0xFF, 0xFF, 0x04, 0xFD, 0xFF, 0xFF,
                    0x6C, 0xFE, 0xFF, 0xFF, 0xB6, 0xFF, 0xFF, 0xFF, 0xB6, 0xFF, 0xFF, 0xFF, 0x6A, 0xF6, 0xFF, 0xFF,
                    0x50, 0xFB, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x6A, 0xF6, 0xFF, 0xFF, 0xA4, 0xED, 0xFF, 0xFF,
                    0x47, 0xF3, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x04, 0xFD, 0xFF, 0xFF,
                    0x6C, 0xFE, 0xFF, 0xFF, 0xB6, 0xFF, 0xFF, 0xFF, 0xB6, 0xFF, 0xFF, 0xFF, 0x01, 0x00, 0x00, 0x00,
                    0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
                    0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0xFD, 0xFF, 0xFF, 0x04, 0xFD, 0xFF, 0xFF,
                    0x6C, 0xFE, 0xFF, 0xFF, 0xB6, 0xFF, 0xFF, 0xFF, 0xB6, 0xFF, 0xFF, 0xFF, 0x6A, 0xF6, 0xFF, 0xFF,
                    0x50, 0xFB, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x6A, 0xF6, 0xFF, 0xFF, 0xA4, 0xED, 0xFF, 0xFF,
                    0x47, 0xF3, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3F,
                    0x42, 0x4D, 0x53, 0x20, 0x2D, 0x20, 0x46, 0x75, 0x6C, 0x6C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
                    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
                    0x00, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x01, 0x01,
                    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3F, 0x05, 0x00, 0x00, 0x00,
                    0x28, 0x00, 0x00, 0x00, 0x0A, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00,
                    0x01, 0x42, 0x4D, 0x53, 0x20, 0x34, 0x2E, 0x33, 0x33, 0x2E, 0x32, 0x00, 0x00, 0x00, 0x00, 0x00,
                    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
                    0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0xF0, 0xD8, 0xFF, 0xFF
                };
                System.IO.FileStream nfs = new System.IO.FileStream
                                               (filename, System.IO.FileMode.Create, System.IO.FileAccess.Write);
                nfs.Write(nbs, 0, nbs.Length);
                nfs.Close();
            }
            fbackupname = appReg.GetInstallDir() + "/User/Config/Backup/" + appReg.GetPilotCallsign().ToString() + ".pop";
            if (!System.IO.File.Exists(fbackupname))
            {
                System.IO.File.Copy(filename, fbackupname, true);
            }
            System.IO.FileStream fs = new System.IO.FileStream
                                          (filename, System.IO.FileMode.Open, System.IO.FileAccess.Read);
            byte[] bs = new byte[fs.Length];
            fs.Read(bs, 0, bs.Length);
            fs.Close();
            // 42 4D 53 20 2D 20 46 75 6C 6C 00 00 00 00 00 00 // BMS - FULL
            bs[288 + 0]  = 0x42;
            bs[288 + 1]  = 0x4D;
            bs[288 + 2]  = 0x53;
            bs[288 + 3]  = 0x20;
            bs[288 + 4]  = 0x2D;
            bs[288 + 5]  = 0x20;
            bs[288 + 6]  = 0x46;
            bs[288 + 7]  = 0x75;
            bs[288 + 8]  = 0x6C;
            bs[288 + 9]  = 0x6C;
            bs[288 + 10] = 0x00;
            bs[288 + 11] = 0x00;
            bs[288 + 12] = 0x00;
            bs[288 + 13] = 0x00;
            bs[288 + 14] = 0x00;
            bs[288 + 15] = 0x00;

            bs[336] = 0x00; // TrackIR Z-Axis(0:Z-axis 1:FOV)
            if (mainWindow.Misc_TrackIRZ.IsChecked == true)
            {
                bs[336] = 0x01;
            }

            bs[341] = 0x00; // External Mouselook
            if (mainWindow.Misc_ExMouseLook.IsChecked == true)
            {
                bs[341] = 0x01;
            }

            bs[362] = 0x00; // Roll-linked NWS
            if (mainWindow.Misc_RollLinkedNWS.IsChecked == true)
            {
                bs[362] = 0x01;
            }

            // Smart Scaling
            if (mainWindow.Misc_SmartScalingOverride.IsChecked == true)
            {
                bs[12] = 0x05;   // Enabled
            }
            fs = new System.IO.FileStream
                     (filename, System.IO.FileMode.Create, System.IO.FileAccess.Write);
            fs.Write(bs, 0, bs.Length);
            fs.Close();
        }