public void TestMethod1_NewTemplateReadAndSave()
        {
            var openFileDialog = new Microsoft.Win32.OpenFileDialog()
            {
                Filter = "DLL Files (*.dll)|*.dll"
            };

            if (openFileDialog.ShowDialog() != true)
            {
                return;
            }

            string datPath = openFileDialog.FileName.Substring(0, openFileDialog.FileName.Length - 3) + "dat";

            DES.DesDecrypt(openFileDialog.FileName, datPath, "12345678");


            TowerTemplateReader templateReader = new TowerTemplateReader(TowerTypeEnum.LineTower);
            TowerTemplate       template       = templateReader.Read(datPath);


            string newDatPath = openFileDialog.FileName.Substring(0, openFileDialog.FileName.Length - 4) + "New.dat";
            NewTowerTemplateReader newTemplateReader = new NewTowerTemplateReader(TowerTypeEnum.LineTower);

            newTemplateReader.Save(newDatPath, template);

            TowerTemplate newTemplate = newTemplateReader.Read(newDatPath);
        }
        protected void ShowTemplateEditWindow(TowerTemplateStorageInfo templateInfo, bool isReadOnly)
        {
            TowerTemplate template = new TowerTemplate();

            //templateInfo 不是null,需要从project中读取模板
            if (templateInfo != null)
            {
                var proInstance = ProjectUtils.GetInstance();

                string path = isReadOnly ? proInstance.GetGeneralTowerTemplatePath(templateInfo.Name, templateInfo.TowerType)
                    : proInstance.GetProjectlTowerTemplatePath(templateInfo.Name, templateInfo.TowerType);

                NewTowerTemplateReader newTemplateReader = new NewTowerTemplateReader(TowerTypeStringConvert.TowerStringToType(templateInfo.TowerType));
                template = newTemplateReader.Read(path);
            }

            StruTemplateEditViewModel model = ViewModelSource.Create(() => new StruTemplateEditViewModel(template, isReadOnly));

            model.CloseEditTemplateWindowEvent += CloseTemplateEditWindow;
            editWindow             = new StruTemplateEditWindow();
            editWindow.DataContext = model;
            editWindow.ShowDialog();
        }