Пример #1
0
        static void Main(string[] args)
        {
            Console.WriteLine("ctp map to online tuner file converter. ecusystems.ru");

            using (var openFile = new OpenFileDialog())
                using (var saveFile = new SaveFileDialog())
                {
                    openFile.InitialDirectory = saveFile.InitialDirectory = Application.StartupPath;
                    openFile.Filter           = saveFile.Filter = "Map files|*.j5;*.j7|All files|*.*";

                    openFile.Title = "Укажите карту ChipTunerPro 3.21 для преобразования";
                    saveFile.Title = "Укажите имя файла для сохранения карты OnlineTuner";

                    if (openFile.ShowDialog() != DialogResult.OK)
                    {
                        return;
                    }
                    if (saveFile.ShowDialog() != DialogResult.OK)
                    {
                        return;
                    }

                    var ctpMap = new CtpMap();
                    ctpMap.LoadFromFile(openFile.FileName);

                    ctpMap.SaveToFile(saveFile.FileName, true);
                }
        }
Пример #2
0
        private void LoadSupportedRamTables()
        {
            ramTables = new CtpMap();
            var path = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + @"\tables.map";

            ramTables.LoadFromFile(path);
        }
Пример #3
0
 public void OpenMap()
 {
     if (openMapDialog.ShowDialog() != DialogResult.OK)
     {
         return;
     }
     ctpMap = new CtpMap();
     //var path = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + @"\tables.map";
     //ctpMap.LoadFromFile(path);
 }
Пример #4
0
        public void Prepare(CaptureManager captureManager, CtpMap maps)
        {
            this.captureManager = captureManager;

            captureManager.OnCaptureTable  += FirmwareManagerOnOnCaptureTable;
            captureManager.OnEnabledChange += CaptureManagerOnOnEnabledChange;
            captureManager.onlineManager.OltProtocol.OnConnect    += OltProtocolOnConnect;
            captureManager.onlineManager.OltProtocol.OnDisconnect += OltProtocolOnConnect;
            ramTablesBS.DataSource =
                maps.Entries.Where(
                    item =>
                    (item.Entry2D != null && item.Entry2D.Convert.ExInfo.CaptureRamId != 0) ||
                    (item.Entry3D != null && item.Entry3D.Convert.ExInfo.CaptureRamId != 0));
            Enabled = captureManager.Enabled;
        }
Пример #5
0
        public void LoadMap(CtpMap map, bool clear = false)
        {
            var levels = new Dictionary <int, TreeNode>();

            if (clear)
            {
                Clear();
            }

            maps.Add(map);

            var node       = entriesTree.Nodes.Add(Guid.NewGuid().ToString(), map.Path, (byte)MapEntryType.Folder);
            var lastFolder = node;
            var level      = 1;

            levels.Add(level, node);

            foreach (var entry in map.Entries)
            {
                if (entry.Level > level)
                {
                    level++;
                    node = lastFolder;
                    if (!levels.ContainsKey(level))
                    {
                        levels.Add(level, node);
                    }
                    else
                    {
                        levels[level] = node;
                    }
                }
                else if (entry.Level < level)
                {
                    level      = entry.Level;
                    node       = levels[level];
                    lastFolder = node;
                }

                var item = AddTreeNode(entry, node);

                if (entry.Type == (byte)MapEntryType.Folder)
                {
                    lastFolder = item;
                }
            }
        }