Ejemplo n.º 1
0
        /// <summary>
        /// Create a new file and save the file group.
        /// </summary>
        /// <param name="fileGroup">The file group defining the new file.</param>
        public void CreateFile(FileGroup fileGroup)
        {
            fileGroup.SaveFields();
            if (!File.Exists(BuildFilePath(fileGroup.FilePath, fileGroup.FileName).Replace('/', '\\')))
            {
                var dataDef  = Settings.FindBaseFile(fileGroup.BaseFileName);
                var f        = GenDataBase.DataLoader.LoadData(BuildFilePath(dataDef.FilePath, dataDef.FileName)).AsDef();
                var d        = new GenDataBase(f);
                var fileName = BuildFilePath(fileGroup.FilePath, fileGroup.FileName);
                GenParameters.SaveToFile(d, fileName);
            }
            if (Settings.FindFileGroup(fileGroup.Name) == null)
            {
                Settings.Model.GenSettingsList[0].AddFileGroup(fileGroup.Name, fileGroup.FileName, fileGroup.FilePath,
                                                               fileGroup.BaseFileName, fileGroup.Profile, fileGroup.GeneratedFile);
            }

            if (fileGroup.BaseFileName == "Definition")
            {
                AddBaseFile(fileGroup);
            }

            SetFileGroup(fileGroup.Name);
            SaveSettings();
        }
Ejemplo n.º 2
0
        public void SaveFile(FileGroup fileGroup)
        {
            fileGroup.SaveFields();
            var fileName = BuildFilePath(fileGroup.FilePath, fileGroup.FileName);

            GenParameters.SaveToFile(GenDataBase, fileName);

            if (Settings.FindFileGroup(fileGroup.Name) == null)
            {
                Settings.GetFileGroups().Add(fileGroup);
            }
            SetFileGroup(fileGroup.Name);
            SaveSettings();
        }