-
Notifications
You must be signed in to change notification settings - Fork 92
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
94d33d3
commit 77f6b1a
Showing
13 changed files
with
450 additions
and
347 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
54 changes: 54 additions & 0 deletions
54
OngekiFumenEditor/Kernel/ArgProcesser/DefaultArgProcessManager.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
using Caliburn.Micro; | ||
using OngekiFumenEditor.Base; | ||
using OngekiFumenEditor.Kernel.Audio; | ||
using OngekiFumenEditor.Modules.FumenVisualEditor; | ||
using OngekiFumenEditor.Modules.PreviewSvgGenerator; | ||
using OngekiFumenEditor.Parser; | ||
using OngekiFumenEditor.Properties; | ||
using OngekiFumenEditor.Utils; | ||
using OngekiFumenEditor.Utils.Logs.DefaultImpls; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.CommandLine; | ||
using System.CommandLine.Parsing; | ||
using System.ComponentModel.Composition; | ||
using System.IO; | ||
using System.Linq; | ||
using System.Reflection; | ||
using System.Threading.Tasks; | ||
using System.Windows; | ||
using OngekiFumenEditor.Modules.FumenConverter; | ||
using OngekiFumenEditor.Modules.FumenConverter.Kernel; | ||
using OngekiFumenEditor.Modules.OptionGeneratorTools.Base; | ||
using OngekiFumenEditor.Modules.OptionGeneratorTools.Kernel; | ||
using OngekiFumenEditor.Modules.OptionGeneratorTools.Models; | ||
using Expression = System.Linq.Expressions.Expression; | ||
using OngekiFumenEditor.Kernel.CommandExecutor.Attributes; | ||
|
||
namespace OngekiFumenEditor.Kernel.ArgProcesser | ||
{ | ||
[Export(typeof(IProgramArgProcessManager))] | ||
internal class DefaultArgProcessManager : IProgramArgProcessManager | ||
{ | ||
public async Task ProcessArgs(string[] args) | ||
{ | ||
if (args.Length == 0) | ||
return; | ||
|
||
//if args[0] is openable file likes .ogkr/.nyagekiProj/.nyageki ... | ||
if (args.IsOnlyOne(out var filePath)) | ||
{ | ||
if (File.Exists(filePath)) | ||
{ | ||
Log.LogInfo($"arg.filePath: {filePath}"); | ||
|
||
_ = Application.Current.Dispatcher.Invoke(async () => | ||
{ | ||
if (await DocumentOpenHelper.TryOpenAsDocument(filePath)) | ||
Application.Current?.MainWindow?.Focus(); | ||
}); | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
102 changes: 51 additions & 51 deletions
102
...esser/Attributes/OptionBindingAttrbute.cs → ...cutor/Attributes/OptionBindingAttrbute.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,52 +1,52 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Resources; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using OngekiFumenEditor.Properties; | ||
using OngekiFumenEditor.Utils; | ||
|
||
namespace OngekiFumenEditor.Kernel.ArgProcesser.Attributes | ||
{ | ||
public abstract class OptionBindingAttrbuteBase : Attribute | ||
{ | ||
public OptionBindingAttrbuteBase(string name, string description, object defaultValue, Type type) | ||
{ | ||
Name = name; | ||
Description = description; | ||
DefaultValue = defaultValue; | ||
Type = type; | ||
} | ||
|
||
public string Name { get; set; } | ||
public string Description { get; set; } | ||
public object DefaultValue { get; set; } | ||
public Type Type { get; } | ||
public bool Require { get; set; } | ||
} | ||
|
||
[AttributeUsage(AttributeTargets.Property)] | ||
public class OptionBindingAttrbute<T> : OptionBindingAttrbuteBase | ||
{ | ||
public OptionBindingAttrbute(string name, string description, T defaultValue) : base(name, description, defaultValue, typeof(T)) | ||
{ | ||
|
||
} | ||
} | ||
|
||
[AttributeUsage(AttributeTargets.Property)] | ||
public class LocalizableOptionBindingAttribute<T> : OptionBindingAttrbute<T> | ||
{ | ||
public LocalizableOptionBindingAttribute(string name, string resourceKey, T defaultValue, bool require = false) | ||
: base(name, Resources.ResourceManager.GetString(resourceKey) ?? string.Empty, defaultValue) | ||
{ | ||
Require = require; | ||
#if DEBUG | ||
// ReSharper disable once ConditionIsAlwaysTrueOrFalse | ||
if (string.IsNullOrWhiteSpace(Description)) | ||
Log.LogDebug($"Invalid resource key '{resourceKey}' for option '{name}'"); | ||
#endif | ||
} | ||
} | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Resources; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using OngekiFumenEditor.Properties; | ||
using OngekiFumenEditor.Utils; | ||
|
||
namespace OngekiFumenEditor.Kernel.CommandExecutor.Attributes | ||
{ | ||
public abstract class OptionBindingAttrbuteBase : Attribute | ||
{ | ||
public OptionBindingAttrbuteBase(string name, string description, object defaultValue, Type type) | ||
{ | ||
Name = name; | ||
Description = description; | ||
DefaultValue = defaultValue; | ||
Type = type; | ||
} | ||
|
||
public string Name { get; set; } | ||
public string Description { get; set; } | ||
public object DefaultValue { get; set; } | ||
public Type Type { get; } | ||
public bool Require { get; set; } | ||
} | ||
|
||
[AttributeUsage(AttributeTargets.Property)] | ||
public class OptionBindingAttrbute<T> : OptionBindingAttrbuteBase | ||
{ | ||
public OptionBindingAttrbute(string name, string description, T defaultValue) : base(name, description, defaultValue, typeof(T)) | ||
{ | ||
|
||
} | ||
} | ||
|
||
[AttributeUsage(AttributeTargets.Property)] | ||
public class LocalizableOptionBindingAttribute<T> : OptionBindingAttrbute<T> | ||
{ | ||
public LocalizableOptionBindingAttribute(string name, string resourceKey, T defaultValue, bool require = false) | ||
: base(name, Resources.ResourceManager.GetString(resourceKey) ?? string.Empty, defaultValue) | ||
{ | ||
Require = require; | ||
#if DEBUG | ||
// ReSharper disable once ConditionIsAlwaysTrueOrFalse | ||
if (string.IsNullOrWhiteSpace(Description)) | ||
Log.LogDebug($"Invalid resource key '{resourceKey}' for option '{name}'"); | ||
#endif | ||
} | ||
} | ||
} |
Oops, something went wrong.