Skip to content

Commit

Permalink
Added some params options to write builder
Browse files Browse the repository at this point in the history
  • Loading branch information
Noggog committed Sep 2, 2024
1 parent 5f0f24d commit c831376
Showing 1 changed file with 113 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,14 @@ public IBinaryModdedWriteBuilderTargetChoice WithLoadOrder(
public IBinaryModdedWriteBuilderDataFolderChoice WithLoadOrder(
IEnumerable<ModKey> loadOrder);

/// <summary>
/// Writes the mod with the default load order and given data folder as reference.
/// </summary>
/// <param name="loadOrder">Load order</param>
/// <returns>Builder object to continue customization</returns>
public IBinaryModdedWriteBuilderDataFolderChoice WithLoadOrder(
params ModKey[] loadOrder);

/// <summary>
/// Writes the mod with the load order found in mod header, and with given data folder as reference.
/// </summary>
Expand Down Expand Up @@ -237,6 +245,18 @@ public BinaryModdedWriteBuilderDataFolderChoice<TModGetter> WithLoadOrder(
});
}
IBinaryModdedWriteBuilderDataFolderChoice IBinaryModdedWriteBuilderLoadOrderChoice.WithLoadOrder(IEnumerable<ModKey> loadOrder) => WithLoadOrder(loadOrder);

/// <summary>
/// Writes the mod with the default load order and given data folder as reference.
/// </summary>
/// <param name="loadOrder">Load order</param>
/// <returns>Builder object to continue customization</returns>
public BinaryModdedWriteBuilderDataFolderChoice<TModGetter> WithLoadOrder(
params ModKey[] loadOrder)
{
return WithLoadOrder((IEnumerable<ModKey>)loadOrder);
}
IBinaryModdedWriteBuilderDataFolderChoice IBinaryModdedWriteBuilderLoadOrderChoice.WithLoadOrder(ModKey[] loadOrder) => WithLoadOrder(loadOrder);

public BinaryModdedWriteBuilderDataFolderChoice<TModGetter> WithLoadOrderFromHeaderMasters()
{
Expand Down Expand Up @@ -400,6 +420,17 @@ public BinaryWriteBuilderDataFolderChoice<TModGetter> WithLoadOrder(
}
});
}

/// <summary>
/// Writes the mod with the default load order and given data folder as reference.
/// </summary>
/// <param name="loadOrder">Load order</param>
/// <returns>Builder object to continue customization</returns>
public BinaryWriteBuilderDataFolderChoice<TModGetter> WithLoadOrder(
params ModKey[] loadOrder)
{
return WithLoadOrder((IEnumerable<ModKey>)loadOrder);
}

public BinaryWriteBuilderDataFolderChoice<TModGetter> WithLoadOrderFromHeaderMasters()
{
Expand Down Expand Up @@ -780,6 +811,13 @@ IFileBinaryModdedWriteBuilder WithMastersListOrdering(
/// <returns>Builder object to continue customization</returns>
IFileBinaryModdedWriteBuilder WithExtraIncludedMasters(IEnumerable<ModKey> modKeys);

/// <summary>
/// Specifies a list of masters to include if they are not included naturally
/// </summary>
/// <param name="modKeys">Extra ModKeys to include</param>
/// <returns>Builder object to continue customization</returns>
IFileBinaryModdedWriteBuilder WithExtraIncludedMasters(params ModKey[] modKeys);

/// <summary>
/// Specifies a list of masters to set the mod to contain. <br />
/// This overrides all normally contained masters, and may result in a corrupted mod if set incorrectly. <br />
Expand All @@ -789,6 +827,15 @@ IFileBinaryModdedWriteBuilder WithMastersListOrdering(
/// <returns>Builder object to continue customization</returns>
IFileBinaryModdedWriteBuilder WithExplicitOverridingMasterList(IEnumerable<ModKey> modKeys);

/// <summary>
/// Specifies a list of masters to set the mod to contain. <br />
/// This overrides all normally contained masters, and may result in a corrupted mod if set incorrectly. <br />
/// If set after <see cref="WithExtraIncludedMasters" /> or <see cref="WithCkRequiredMasters"/>, they will be forgotten.
/// </summary>
/// <param name="modKeys">ModKeys to have the mod contain</param>
/// <returns>Builder object to continue customization</returns>
IFileBinaryModdedWriteBuilder WithExplicitOverridingMasterList(params ModKey[] modKeys);

/// <summary>
/// The Construction Kit complains when loading mods that do not have base masters listed. <br />
/// This call includes base masters even if they are not needed by the mod's content
Expand Down Expand Up @@ -1353,6 +1400,27 @@ public FileBinaryModdedWriteBuilder<TModGetter> WithExtraIncludedMasters(IEnumer
}
IFileBinaryModdedWriteBuilder IFileBinaryModdedWriteBuilder.WithExtraIncludedMasters(IEnumerable<ModKey> modKeys) => WithExtraIncludedMasters(modKeys);

/// <summary>
/// Specifies a list of masters to include if they are not included naturally <br/>
/// If called several times, the extra ModKeys will accumulate.
/// </summary>
/// <param name="modKeys">Extra ModKeys to include</param>
/// <returns>Builder object to continue customization</returns>
public FileBinaryModdedWriteBuilder<TModGetter> WithExtraIncludedMasters(params ModKey[] modKeys)
{
return this with
{
_params = _params with
{
_param = _params._param with
{
ExtraIncludeMasters = _params._param.ExtraIncludeMasters.EmptyIfNull().And(modKeys).Distinct().ToArray()
}
}
};
}
IFileBinaryModdedWriteBuilder IFileBinaryModdedWriteBuilder.WithExtraIncludedMasters(params ModKey[] modKeys) => WithExtraIncludedMasters(modKeys);

/// <summary>
/// Specifies a list of masters to set the mod to contain. <br />
/// This overrides all normally contained masters, and may result in a corrupted mod if set incorrectly. <br />
Expand All @@ -1375,6 +1443,19 @@ public FileBinaryModdedWriteBuilder<TModGetter> WithExplicitOverridingMasterList
}
IFileBinaryModdedWriteBuilder IFileBinaryModdedWriteBuilder.WithExplicitOverridingMasterList(IEnumerable<ModKey> modKeys) => WithExplicitOverridingMasterList(modKeys);

/// <summary>
/// Specifies a list of masters to set the mod to contain. <br />
/// This overrides all normally contained masters, and may result in a corrupted mod if set incorrectly. <br />
/// If set after <see cref="WithExtraIncludedMasters" /> or <see cref="WithCkRequiredMasters"/>, they will be forgotten.
/// </summary>
/// <param name="modKeys">ModKeys to have the mod contain</param>
/// <returns>Builder object to continue customization</returns>
public FileBinaryModdedWriteBuilder<TModGetter> WithExplicitOverridingMasterList(params ModKey[] modKeys)
{
return WithExplicitOverridingMasterList((IEnumerable<ModKey>)modKeys);
}
IFileBinaryModdedWriteBuilder IFileBinaryModdedWriteBuilder.WithExplicitOverridingMasterList(params ModKey[] modKeys) => WithExplicitOverridingMasterList(modKeys);

/// <summary>
/// The CK complains when loading mods that do not have base masters listed. <br />
/// This call includes base masters even if they are not needed by the mod's content
Expand Down Expand Up @@ -1935,6 +2016,26 @@ public FileBinaryWriteBuilder<TModGetter> WithExtraIncludedMasters(IEnumerable<M
};
}

/// <summary>
/// Specifies a list of masters to include if they are not included naturally <br/>
/// If called several times, the extra ModKeys will accumulate.
/// </summary>
/// <param name="modKeys">Extra ModKeys to include</param>
/// <returns>Builder object to continue customization</returns>
public FileBinaryWriteBuilder<TModGetter> WithExtraIncludedMasters(params ModKey[] modKeys)
{
return this with
{
_params = _params with
{
_param = _params._param with
{
ExtraIncludeMasters = _params._param.ExtraIncludeMasters.EmptyIfNull().And(modKeys).Distinct().ToArray()
}
}
};
}

/// <summary>
/// Specifies a list of masters to set the mod to contain. <br />
/// This overrides all normally contained masters, and may result in a corrupted mod if set incorrectly. <br />
Expand All @@ -1955,6 +2056,18 @@ public FileBinaryWriteBuilder<TModGetter> WithExplicitOverridingMasterList(IEnum
}
};
}

/// <summary>
/// Specifies a list of masters to set the mod to contain. <br />
/// This overrides all normally contained masters, and may result in a corrupted mod if set incorrectly. <br />
/// If set after <see cref="WithExtraIncludedMasters" /> or <see cref="WithCkRequiredMasters"/>, they will be forgotten.
/// </summary>
/// <param name="modKeys">ModKeys to have the mod contain</param>
/// <returns>Builder object to continue customization</returns>
public FileBinaryWriteBuilder<TModGetter> WithExplicitOverridingMasterList(params ModKey[] modKeys)
{
return WithExplicitOverridingMasterList((IEnumerable<ModKey>)modKeys);
}

/// <summary>
/// The CK complains when loading mods that do not have base masters listed. <br />
Expand Down

0 comments on commit c831376

Please sign in to comment.