Skip to content

Commit

Permalink
Merge pull request #217 from Grover-c13/3.2.1
Browse files Browse the repository at this point in the history
MultiAdmin Version 3.2.1 Update
  • Loading branch information
Dankrushen authored Jun 13, 2019
2 parents 953c72c + c9a4748 commit 0cef724
Show file tree
Hide file tree
Showing 10 changed files with 678 additions and 155 deletions.
202 changes: 169 additions & 33 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@

# Created by https://www.gitignore.io/api/git,rider,linux,macos,csharp,windows,monodevelop
# Edit at https://www.gitignore.io/?templates=git,rider,linux,macos,csharp,windows,monodevelop

### Csharp ###
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
##
Expand All @@ -13,6 +18,9 @@
# User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs

# Mono auto generated files
mono_crash.*

# Build results
[Dd]ebug/
[Dd]ebugPublic/
Expand Down Expand Up @@ -206,6 +214,8 @@ BundleArtifacts/
Package.StoreAssociation.xml
_pkginfo.txt
*.appx
*.appxbundle
*.appxupload

# Visual Studio cache files
# files ending in .cache can be ignored
Expand All @@ -231,8 +241,6 @@ orleans.codegen.cs
# Since there are multiple workflows, uncomment next line to ignore bower_components
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
#bower_components/
# ASP.NET Core default setup: bower directory is configured as wwwroot/lib/ and bower restore is true
**/wwwroot/lib/

# RIA/Silverlight projects
Generated_Code/
Expand All @@ -257,6 +265,7 @@ ServiceFabricBackup/
*.bim.layout
*.bim_*.settings
*.rptproj.rsuser
*- Backup*.rdl

# Microsoft Fakes
FakesAssemblies/
Expand Down Expand Up @@ -292,10 +301,6 @@ paket-files/
# FAKE - F# Make
.fake/

# JetBrains Rider
.idea/
*.sln.iml

# CodeRush personal settings
.cr/personal

Expand Down Expand Up @@ -340,37 +345,168 @@ ASALocalRun/
# BeatPulse healthcheck temp database
healthchecksdb

# Common IntelliJ Platform excludes
# Backup folder for Package Reference Convert tool in Visual Studio 2017
MigrationBackup/

### Git ###
# Created by git for backups. To disable backups in Git:
# $ git config --global mergetool.keepBackup false
*.orig

# Created by git when using merge tools for conflicts
*.BACKUP.*
*.BASE.*
*.LOCAL.*
*.REMOTE.*
*_BACKUP_*.txt
*_BASE_*.txt
*_LOCAL_*.txt
*_REMOTE_*.txt

### Linux ###

# temporary files which can be created if a process still has a handle open of a deleted file
.fuse_hidden*

# KDE directory preferences
.directory

# User specific
**/.idea/**/workspace.xml
**/.idea/**/tasks.xml
**/.idea/shelf/*
**/.idea/dictionaries
# Linux trash folder which might appear on any partition or disk
.Trash-*

# .nfs files are created when an open file is removed but is still being accessed
.nfs*

### macOS ###
# General
.DS_Store
.AppleDouble
.LSOverride

# Icon must end with two \r
Icon

# Thumbnails
._*

# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent

# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk

### MonoDevelop ###
#User Specific
*.usertasks

#Mono Project Files
*.resources
test-results/

### Rider ###
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and WebStorm
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839

# User-specific stuff
.idea/**/workspace.xml
.idea/**/tasks.xml
.idea/**/usage.statistics.xml
.idea/**/dictionaries
.idea/**/shelf

# Generated files
.idea/**/contentModel.xml

# Sensitive or high-churn files
**/.idea/**/dataSources/
**/.idea/**/dataSources.ids
**/.idea/**/dataSources.xml
**/.idea/**/dataSources.local.xml
**/.idea/**/sqlDataSources.xml
**/.idea/**/dynamic.xml

# Rider
# Rider auto-generates .iml files, and contentModel.xml
**/.idea/**/*.iml
**/.idea/**/contentModel.xml
**/.idea/**/modules.xml
.idea/**/dataSources/
.idea/**/dataSources.ids
.idea/**/dataSources.local.xml
.idea/**/sqlDataSources.xml
.idea/**/dynamic.xml
.idea/**/uiDesigner.xml
.idea/**/dbnavigator.xml

*.suo
*.user
.vs/
[Bb]in/
[Oo]bj/
_UpgradeReport_Files/
[Pp]ackages/
# Gradle
.idea/**/gradle.xml
.idea/**/libraries

# Gradle and Maven with auto-import
# When using Gradle or Maven with auto-import, you should exclude module files,
# since they will be recreated, and may cause churn. Uncomment if using
# auto-import.
# .idea/modules.xml
# .idea/*.iml
# .idea/modules

# CMake
cmake-build-*/

# Mongo Explorer plugin
.idea/**/mongoSettings.xml

# File-based project format
*.iws

# IntelliJ
out/

# mpeltonen/sbt-idea plugin
.idea_modules/

# JIRA plugin
atlassian-ide-plugin.xml

# Cursive Clojure plugin
.idea/replstate.xml

# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties

# Editor-based Rest Client
.idea/httpRequests

# Android studio 3.1+ serialized cache file
.idea/caches/build_file_checksums.ser

# JetBrains templates
**___jb_tmp___

### Windows ###
# Windows thumbnail cache files
Thumbs.db
Desktop.ini
.DS_Store
ehthumbs.db
ehthumbs_vista.db

# Dump file
*.stackdump

# Folder config file
[Dd]esktop.ini

# Recycle Bin used on file shares
$RECYCLE.BIN/

# Windows Installer files
*.cab
*.msi
*.msix
*.msm
*.msp

# Windows shortcuts
*.lnk

# End of https://www.gitignore.io/api/git,rider,linux,macos,csharp,windows,monodevelop
35 changes: 21 additions & 14 deletions MultiAdmin/Config/Config.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,33 +15,40 @@ public Config(string path)
ReadConfigFile(path);
}

public string ConfigPath { get; private set; }
private string internalConfigPath;

public string ConfigPath
{
get => internalConfigPath;
private set
{
try
{
internalConfigPath = Utils.GetFullPathSafe(value);
}
catch (Exception e)
{
internalConfigPath = value;
Program.LogDebugException(nameof(ConfigPath), e);
}
}
}

public void ReadConfigFile(string configPath)
{
if (string.IsNullOrEmpty(configPath)) return;

ConfigPath = configPath;
try
{
ConfigPath = Utils.GetFullPathSafe(ConfigPath);
}
catch (Exception e)
{
Program.LogDebugException(nameof(ReadConfigFile), e);
}

try
{
rawData = File.Exists(ConfigPath) ? File.ReadAllLines(ConfigPath, Encoding.UTF8) : new string[] { };
}
catch (Exception e)
{
new ColoredMessage[]
{
new ColoredMessage($"Error while reading config (Path = {ConfigPath ?? "Null"}):", ConsoleColor.Red),
new ColoredMessage(e.ToString(), ConsoleColor.Red)
}.WriteLines();
Program.LogDebugException(nameof(ReadConfigFile), e);

new ColoredMessage[] {new ColoredMessage($"Error while reading config (Path = {ConfigPath ?? "Null"}):", ConsoleColor.Red), new ColoredMessage(e.ToString(), ConsoleColor.Red)}.WriteLines();
}
}

Expand Down
52 changes: 37 additions & 15 deletions MultiAdmin/Config/ConfigHandler/ConfigEntry.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,6 @@ public abstract class ConfigEntry
/// </summary>
public string Key { get; }

/// <summary>
/// The name of the <see cref="ConfigEntry"/>.
/// </summary>
public string Name { get; }

/// <summary>
/// The description of the <see cref="ConfigEntry"/>.
/// </summary>
public string Description { get; }

/// <summary>
/// The type of the value of the <see cref="ConfigEntry"/>.
/// </summary>
Expand All @@ -38,15 +28,39 @@ public abstract class ConfigEntry
public abstract object ObjectDefault { get; set; }

/// <summary>
/// Creates a basic <see cref="ConfigEntry"/> with no values.
/// Whether to inherit this config value from the <see cref="ConfigRegister"/>'s parent <see cref="ConfigRegister"/>s if they support value inheritance.
/// </summary>
public bool Inherit { get; }

/// <summary>
/// The name of the <see cref="ConfigEntry"/>.
/// </summary>
public string Name { get; }

/// <summary>
/// The description of the <see cref="ConfigEntry"/>.
/// </summary>
public ConfigEntry(string key, string name = null, string description = null)
public string Description { get; }

/// <summary>
/// Creates a basic <see cref="ConfigEntry"/> with no values and indication for whether to inherit the value.
/// </summary>
public ConfigEntry(string key, bool inherit = true, string name = null, string description = null)
{
Key = key;
Name = name;

Inherit = inherit;

Name = name;
Description = description;
}

/// <summary>
/// Creates a basic <see cref="ConfigEntry"/> with no values.
/// </summary>
public ConfigEntry(string key, string name = null, string description = null) : this(key, true, name, description)
{
}
}

/// <inheritdoc />
Expand Down Expand Up @@ -81,11 +95,19 @@ public override object ObjectDefault

/// <inheritdoc />
/// <summary>
/// Creates a <see cref="ConfigEntry{T}" /> with the provided type and provided default value.
/// Creates a <see cref="ConfigEntry{T}" /> with the provided type, default value, and indication for whether to inherit the value.
/// </summary>
public ConfigEntry(string key, T defaultValue = default, string name = null, string description = null) : base(key, name, description)
public ConfigEntry(string key, T defaultValue = default, bool inherit = true, string name = null, string description = null) : base(key, inherit, name, description)
{
Default = defaultValue;
}

/// <inheritdoc />
/// <summary>
/// Creates a <see cref="ConfigEntry{T}" /> with the provided type and default value.
/// </summary>
public ConfigEntry(string key, T defaultValue = default, string name = null, string description = null) : this(key, defaultValue, true, name, description)
{
}
}
}
Loading

0 comments on commit 0cef724

Please sign in to comment.