private static FolderPathModel FolderPathBuilder(string id, string typeNameKey, string fmtype, string sfmType) { var fpm = new FolderPathModel(); if (fmtype == "small") { if (!string.IsNullOrEmpty(sfmType)) { //var sfmType = String.Empty; /* * 1. Архитектура решения = sfmType1 * * 2. Схема реализации = sfmType2 * * 3. КП подрядчиков = sfmType3 * * 4. Паспорт сделки = sfmType4 * */ fpm.AddRootPath(String.Format(@"C:\Documents\SmallProjects\{0}\{1}\{2}", typeNameKey, id, sfmType)); } else { fpm.AddRootPath(String.Format(@"C:\Documents\SmallProjects\{0}\{1}\Home", typeNameKey, id)); } } else if (fmtype == "big") { var rootPath = String.Format(@"C:\Documents\Projects\{0}\{1}\Home", typeNameKey, id); fpm.AddRootPath(rootPath); if (typeNameKey == "new_t_project")// добавляем еще папки по умолчанию { FolderSection folderSection = ConfigurationManager.GetSection("FolderSection") as FolderSection; if (folderSection == null) { throw new Exception("Exception text"); } else { for (int i = 0; i < folderSection.Folders.Count; i++) { var folder = folderSection.Folders[i]; var folderName = folder.FolderName; var subFolders = new List <FolderModel>(); for (int j = 0; j < folder.SubFolders.Count; j++) { var subFolder = folder.SubFolders[j]; var subfolderName = subFolder.SubFolderName; subFolders.Add(new FolderModel(subfolderName, new List <FolderModel>())); } var folderModel = new FolderModel(folderName, subFolders); fpm.AddFolderModel(folderModel); } } #region Old //var folderLoopCount = int.Parse(System.Configuration.ConfigurationManager.AppSettings["folderLoopCount"]); //for (int i = 0; i < folderLoopCount; i++) //{ // var keyIndex = "folder" + i; // var subPath = ""; // try // { // subPath = System.Configuration.ConfigurationManager.AppSettings[keyIndex]; // } // catch (Exception) // { // subPath = "Папка с таким именим не заведена в web.config"; // throw; // } // folderPaths.Add(String.Format(@"C:\Documents\Projects\{0}\{1}\Home\{2}", typeNameKey, id, subPath)); //} #endregion } else { } } return(fpm); }
public void Save(Stream stream) { using (var writer = new ProjectFileWriter(stream)) { if (ESystemInfo != null) { writer.WriteSection(new SectionInfo(ESystemInfo.SectionKey, ESystemInfo.SectionName, false, ESystemInfo.ToBytes())); } if (ProjectConfigInfo != null) { writer.WriteSection(new SectionInfo(ProjectConfigInfo.SectionKey, ProjectConfigInfo.SectionName, true, ProjectConfigInfo.ToBytes(Encoding))); } if (Resource != null) { writer.WriteSection(new SectionInfo(ResourceSectionInfo.SectionKey, ResourceSectionInfo.SectionName, false, Resource.ToBytes(Encoding))); } if (Code != null) { writer.WriteSection(new SectionInfo(CodeSectionInfo.SectionKey, CodeSectionInfo.SectionName, false, Code.ToBytes(Encoding))); } if (EPackageInfo != null) { writer.WriteSection(new SectionInfo(EPackageInfo.SectionKey, EPackageInfo.SectionName, true, EPackageInfo.ToBytes(Encoding))); } if (InitEcSectionInfo != null) { writer.WriteSection(new SectionInfo(InitEcSectionInfo.SectionKey, InitEcSectionInfo.SectionName, false, InitEcSectionInfo.ToBytes(Encoding))); } if (EcSection != null) { writer.WriteSection(new SectionInfo(0x0C007319, "易模块记录段", false, EcSection)); } if (EcSection2 != null) { writer.WriteSection(new SectionInfo(0x0F007319, "易模块记录段2", true, EcSection2)); } if (AuxiliarySection2 != null) { writer.WriteSection(new SectionInfo(0x0B007319, "辅助信息段2", true, AuxiliarySection2)); } if (LosableSection != null) { writer.WriteSection(new SectionInfo(LosableSectionInfo.SectionKey, LosableSectionInfo.SectionName, true, LosableSection.ToBytes(Encoding))); } if (AuxiliarySection3 != null) { writer.WriteSection(new SectionInfo(0x10007319, "辅助信息段3", true, AuxiliarySection3)); } if (EditInfoSection2 != null) { writer.WriteSection(new SectionInfo(0x09007319, "编辑信息段2", true, EditInfoSection2)); } if (AuxiliarySection1 != null) { writer.WriteSection(new SectionInfo(0x0A007319, "辅助信息段1", true, AuxiliarySection1)); } if (FolderSection != null) { writer.WriteSection(new SectionInfo(FolderSectionInfo.SectionKey, FolderSectionInfo.SectionName, true, FolderSection.ToBytes(Encoding))); } OtherSections?.ForEach(x => writer.WriteSection(x)); } }