Пример #1
0
        /// <summary>
        /// Convenience function to instantiate a new Major Record and add it to the Group.<br />
        /// FormKey will be automatically assigned.
        /// </summary>
        /// <param name="group">Group to add a record to</param>
        /// <returns>New record already added to the Group</returns>
        public static TMajor AddNew <TMajor>(this IGroupCommon <TMajor> group)
            where TMajor : IMajorRecordInternal
        {
            var ret = MajorRecordInstantiator <TMajor> .Activator(
                group.SourceMod.GetNextFormKey(),
                group.SourceMod.GameRelease);

            group.Set(ret);
            return(ret);
        }
Пример #2
0
        /// <summary>
        /// Convenience function to instantiate a new Major Record and add it to the Group<br />
        /// </summary>
        /// <param name="group">Group to add a record to</param>
        /// <param name="formKey">FormKey assign the new record.</param>
        /// <returns>New record already added to the Group</returns>
        public static TMajor AddNew <TMajor>(this IGroupCommon <TMajor> group, FormKey formKey)
            where TMajor : IMajorRecordInternal, IBinaryItem
        {
            var ret = MajorRecordInstantiator <TMajor> .Activator(
                formKey,
                group.SourceMod.GameRelease);

            group.Set(ret);
            return(ret);
        }
Пример #3
0
        /// <summary>
        /// Convenience function to instantiate a new Major Record and add it to the Group.<br />
        /// FormKey will be automatically assigned based on the editorID given
        /// </summary>
        /// <param name="group">Group to add a record to</param>
        /// <param name="editorID">Editor ID to assign the new record, and use in any FormKey persistence logic.</param>
        /// <returns>New record already added to the Group</returns>
        public static TMajor AddNew <TMajor>(this IGroupCommon <TMajor> group, string?editorID)
            where TMajor : IMajorRecordInternal, IBinaryItem
        {
            var ret = MajorRecordInstantiator <TMajor> .Activator(
                group.SourceMod.GetNextFormKey(editorID),
                group.SourceMod.GameRelease);

            ret.EditorID = editorID;
            group.Set(ret);
            return(ret);
        }