public static bool TryCreate(ModList list, bool force = false)
        {
            var path = FilePath(list);

            if (File.Exists(path) && !force)
            {
                Log.Error("File exists: " + path);
                return(false);
            }

            try
            {
                Scribe.saver.InitSaving(path, RootElement);
                list.ExposeData();
                Scribe.saver.FinalizeSaving();
                Messages.Message(I18n.ModListCreated(list.Name), MessageTypeDefOf.TaskCompletion, false);
                ModLists.Add(list);
                return(true);
            }
            catch (Exception e)
            {
                Log.Error(e.Message);
                return(false);
            }
        }
Exemple #2
0
        public static bool TryCreate(ModList list, bool force = false)
        {
            var success = list.Save(force);

            if (success)
            {
                Messages.Message(I18n.ModListCreated(list.Name), MessageTypeDefOf.TaskCompletion, false);
            }
            return(success);
        }