Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Formatting and Github Actions #9

Merged
merged 4 commits into from
Jun 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
---
# We'll use defaults from the LLVM style, but with 4 columns indentation.
BasedOnStyle: LLVM
IndentWidth: 2
---
Language: Cpp
DeriveLineEnding: false
UseCRLF: true
DerivePointerAlignment: false
PointerAlignment: Left
AlignConsecutiveAssignments: true
AllowShortFunctionsOnASingleLine: Inline
AllowShortIfStatementsOnASingleLine: Never
AllowShortLambdasOnASingleLine: Empty
AlwaysBreakTemplateDeclarations: Yes
AccessModifierOffset: -2
AlignTrailingComments: true
SpacesBeforeTrailingComments: 2
NamespaceIndentation: Inner
MaxEmptyLinesToKeep: 1
BreakBeforeBraces: Custom
BraceWrapping:
AfterCaseLabel: false
AfterClass: true
AfterControlStatement: false
AfterEnum: true
AfterFunction: true
AfterNamespace: true
AfterStruct: true
AfterUnion: true
AfterExternBlock: true
BeforeCatch: false
BeforeElse: false
BeforeLambdaBody: false
BeforeWhile: false
IndentBraces: false
SplitEmptyFunction: false
SplitEmptyRecord: false
SplitEmptyNamespace: true
ColumnLimit: 88
ForEachMacros: ['Q_FOREACH', 'foreach']
1 change: 1 addition & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
f45b25a7b347ae5a42ca86ae60a47b177e9caf6e
7 changes: 7 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Set the default behavior, in case people don't have core.autocrlf set.
* text=auto

# Explicitly declare text files you want to always be normalized and converted
# to native line endings on checkout.
*.cpp text eol=crlf
*.h text eol=crlf
16 changes: 16 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Build Installer FOMOD C# Plugin

on:
push:
branches: master
pull_request:
types: [opened, synchronize, reopened]

jobs:
build:
runs-on: windows-2022
steps:
- name: Build Installer FOMOD C# Plugin
uses: ModOrganizer2/build-with-mob-action@master
with:
mo2-dependencies: cmake_common uibase
16 changes: 16 additions & 0 deletions .github/workflows/linting.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Lint Installer FOMOD C# Plugin

on:
push:
pull_request:
types: [opened, synchronize, reopened]

jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Check format
uses: ModOrganizer2/check-formatting-action@master
with:
check-path: "."
40 changes: 0 additions & 40 deletions appveyor.yml

This file was deleted.

4 changes: 3 additions & 1 deletion src/base_script.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ You should have received a copy of the GNU General Public License
along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>.
*/

// clang-format off

#include "base_script.h"

#include <filesystem>
Expand Down Expand Up @@ -678,4 +680,4 @@ namespace CSharp {
return true;
}

}
}
18 changes: 10 additions & 8 deletions src/base_script.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ You should have received a copy of the GNU General Public License
along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>.
*/

// clang-format off

#ifndef BASE_SCRIPT_H
#define BASE_SCRIPT_H

Expand Down Expand Up @@ -268,7 +270,7 @@ namespace CSharp {
/// The items, previews, and descriptions are repectively ordered. In other words,
/// the i-th item in <paramref name="p_strItems"/> uses the i-th preview in
/// <paramref name="p_strPreviewPaths"/> and the i-th description in <paramref name="p_strDescriptions"/>.
///
///
/// Similarly, the idices return as results correspond to the indices of the items in
/// <paramref name="p_strItems"/>.
/// </remarks>
Expand All @@ -294,7 +296,7 @@ namespace CSharp {
/// The items, previews, and descriptions are repectively ordered. In other words,
/// the i-th item in <paramref name="p_strItems"/> uses the i-th preview in
/// <paramref name="p_imgPreviews"/> and the i-th description in <paramref name="p_strDescriptions"/>.
///
///
/// Similarly, the idices return as results correspond to the indices of the items in
/// <paramref name="p_strItems"/>.
/// </remarks>
Expand Down Expand Up @@ -492,7 +494,7 @@ namespace CSharp {
/// <returns>The specified value as a string.</returns>
/// <seealso cref="GetPrefsIniInt(string, string)"/>
static String^ GetPrefsIniString(String^ p_strSection, String^ p_strKey) {
// This looks wrong? Yes! But that's what used in other mod managers...
// This looks wrong? Yes! But that's what used in other mod managers...
return GetIniString("FalloutPrefs.ini", p_strSection, p_strKey);
}

Expand All @@ -504,7 +506,7 @@ namespace CSharp {
/// <returns>The specified value as an integer.</returns>
/// <seealso cref="GetPrefsIniString(string, string)"/>
static int GetPrefsIniInt(String^ p_strSection, String^ p_strKey) {
// This looks wrong? Yes! But that's what used in other mod managers...
// This looks wrong? Yes! But that's what used in other mod managers...
return GetIniInt("FalloutPrefs.ini", p_strSection, p_strKey);
}

Expand All @@ -520,7 +522,7 @@ namespace CSharp {
static bool EditIni(String^ p_strSettingsFileName, String^ p_strSection, String^ p_strKey, String^ p_strValue);

/// <summary>
/// Sets the specified value in the Fallout.ini file to the given value.
/// Sets the specified value in the Fallout.ini file to the given value.
/// </summary>
/// <param name="p_strSection">The section in the Ini file to edit.</param>
/// <param name="p_strKey">The key in the Ini file to edit.</param>
Expand All @@ -541,10 +543,10 @@ namespace CSharp {
}

// BaseScript cannot be in a namespace:
public ref struct SelectOption: public CSharp::SelectOption {
SelectOption(System::String^ item, System::String^ preview, System::String^ desc) :
public ref struct SelectOption: public CSharp::SelectOption {
SelectOption(System::String^ item, System::String^ preview, System::String^ desc) :
CSharp::SelectOption(item, preview, desc) { }
};
public ref class BaseScript: public CSharp::BaseScriptImpl { };

#endif
#endif
4 changes: 3 additions & 1 deletion src/csharp_interface.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// clang-format off

#include "csharp_interface.h"

#include <fstream>
Expand Down Expand Up @@ -153,4 +155,4 @@ namespace CSharp {
return postInstall(tree);
}

}
}
54 changes: 27 additions & 27 deletions src/csharp_interface.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,35 +6,35 @@
#include "ifiletree.h"
#include "iplugininstaller.h"

namespace CSharp {
namespace CSharp
{

void init(MOBase::IOrganizer* moInfo);
void init(MOBase::IOrganizer* moInfo);

/**
* @brief Initialize the C# interface before starting an installation.
*
* @param installer The FOMOD C# installer.
* @param manager The installation manager from the installer.
* @param parentWidget The parent widget from the installer.
* @param tree The archive tree.
* @param extractedEntries A map from extracted entries to their extracted path.
*/
void beforeInstall(
MOBase::IPlugin const* installer,
MOBase::IInstallationManager* manager,
QWidget* parentWidget,
std::shared_ptr<MOBase::IFileTree> tree,
/**
* @brief Initialize the C# interface before starting an installation.
*
* @param installer The FOMOD C# installer.
* @param manager The installation manager from the installer.
* @param parentWidget The parent widget from the installer.
* @param tree The archive tree.
* @param extractedEntries A map from extracted entries to their extracted path.
*/
void beforeInstall(
MOBase::IPlugin const* installer, MOBase::IInstallationManager* manager,
QWidget* parentWidget, std::shared_ptr<MOBase::IFileTree> tree,
std::map<std::shared_ptr<const MOBase::FileTreeEntry>, QString> extractedEntries);

/**
* @brief Clear the C# interface after an installation.
*
* @param scriptPath Path to the script to execute.
* @param tree Reference where the final tree will be stored (in case of success.
*
* @return the installation result after performing post-installation.
*/
MOBase::IPluginInstaller::EInstallResult executeCSharpScript(QString scriptPath, std::shared_ptr<MOBase::IFileTree>& tree);
/**
* @brief Clear the C# interface after an installation.
*
* @param scriptPath Path to the script to execute.
* @param tree Reference where the final tree will be stored (in case of success.
*
* @return the installation result after performing post-installation.
*/
MOBase::IPluginInstaller::EInstallResult
executeCSharpScript(QString scriptPath, std::shared_ptr<MOBase::IFileTree>& tree);

}
#endif
} // namespace CSharp
#endif
6 changes: 4 additions & 2 deletions src/csharp_utils.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// clang-format off

#ifndef CSHARP_UTILS_H
#define CSHARP_UTILS_H

Expand All @@ -17,7 +19,7 @@ namespace CSharp {
*/
inline std::string to_string(System::String^ value) {
return msclr::interop::marshal_as<std::string>(value);
}
}
inline std::wstring to_wstring(System::String^ value) {
return msclr::interop::marshal_as<std::wstring>(value);
}
Expand All @@ -36,4 +38,4 @@ namespace CSharp {

}

#endif
#endif
Loading
Loading