-
Notifications
You must be signed in to change notification settings - Fork 0
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
Showing
78 changed files
with
3,515 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
using System.Reactive.Linq; | ||
using Karoterra.AupDotNet; | ||
using Reactive.Bindings; | ||
using Reactive.Bindings.Extensions; | ||
|
||
namespace AupInfo.Core | ||
{ | ||
public class AupFile : DisposableBase | ||
{ | ||
public ReadOnlyReactivePropertySlim<string?> FilePath { get; } | ||
public ReadOnlyReactivePropertySlim<string?> FileName { get; } | ||
|
||
public ReactivePropertySlim<EditHandle?> EditHandle { get; } | ||
public ReactiveCollection<FilterProject> FilterProjects { get; } | ||
|
||
public ReactiveCommand Opened { get; } | ||
|
||
private readonly ReactivePropertySlim<string?> filepath; | ||
private AviUtlProject? aup = null; | ||
|
||
public AupFile() | ||
{ | ||
filepath = new ReactivePropertySlim<string?>(null) | ||
.AddTo(disposables); | ||
|
||
FilePath = filepath.ToReadOnlyReactivePropertySlim() | ||
.AddTo(disposables); | ||
FileName = filepath | ||
.Select(x => Path.GetFileName(x)) | ||
.ToReadOnlyReactivePropertySlim() | ||
.AddTo(disposables); | ||
|
||
EditHandle = new ReactivePropertySlim<EditHandle?>(null) | ||
.AddTo(disposables); | ||
FilterProjects = new ReactiveCollection<FilterProject>() | ||
.AddTo(disposables); | ||
|
||
Opened = new ReactiveCommand() | ||
.AddTo(disposables); | ||
} | ||
|
||
public void Open(string path) | ||
{ | ||
aup = new(path); | ||
EditHandle.Value = aup.EditHandle; | ||
filepath.Value = path; | ||
|
||
FilterProjects.ClearOnScheduler(); | ||
FilterProjects.AddRangeOnScheduler(aup.FilterProjects); | ||
|
||
Opened.Execute(); | ||
} | ||
|
||
public void Close() | ||
{ | ||
aup = null; | ||
EditHandle.Value = null; | ||
FilterProjects.ClearOnScheduler(); | ||
filepath.Value = null; | ||
} | ||
|
||
public void Save(string? path = null) | ||
{ | ||
if (aup == null) return; | ||
if (path == null) | ||
path = filepath.Value!; | ||
|
||
using var fs = File.Create(path); | ||
using BinaryWriter bw = new(fs); | ||
aup.Write(bw); | ||
} | ||
} | ||
} |
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,21 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>net6.0-windows</TargetFramework> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
<Version>0.1.0</Version> | ||
<Authors>karoterra</Authors> | ||
<Copyright>Copyright (c) 2022 karoterra</Copyright> | ||
<RepositoryUrl>https://github.com/karoterra/AupInfo</RepositoryUrl> | ||
<PackageProjectUrl>https://github.com/karoterra/AupInfo</PackageProjectUrl> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Karoterra.AupDotNet" Version="0.1.0" /> | ||
<PackageReference Include="Prism.Core" Version="8.1.97" /> | ||
<PackageReference Include="ReactiveProperty" Version="8.0.3" /> | ||
<PackageReference Include="System.Drawing.Common" Version="6.0.0" /> | ||
</ItemGroup> | ||
|
||
</Project> |
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,19 @@ | ||
using Prism.Ioc; | ||
using Prism.Modularity; | ||
|
||
namespace AupInfo.Core | ||
{ | ||
public class CoreModule : IModule | ||
{ | ||
public void OnInitialized(IContainerProvider containerProvider) | ||
{ | ||
} | ||
|
||
public void RegisterTypes(IContainerRegistry containerRegistry) | ||
{ | ||
containerRegistry.RegisterSingleton<AupFile>(); | ||
containerRegistry.RegisterSingleton<ExEditRepository>(); | ||
containerRegistry.RegisterSingleton<PsdToolKitRepository>(); | ||
} | ||
} | ||
} |
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,33 @@ | ||
using System.Reactive.Disposables; | ||
|
||
namespace AupInfo.Core | ||
{ | ||
public abstract class DisposableBase : IDisposable | ||
{ | ||
protected readonly CompositeDisposable disposables = new(); | ||
|
||
#region IDisposable | ||
|
||
protected bool disposedValue; | ||
|
||
protected virtual void Dispose(bool disposing) | ||
{ | ||
if (!disposedValue) | ||
{ | ||
if (disposing) | ||
{ | ||
disposables.Dispose(); | ||
} | ||
disposedValue = true; | ||
} | ||
} | ||
|
||
public void Dispose() | ||
{ | ||
Dispose(disposing: true); | ||
GC.SuppressFinalize(this); | ||
} | ||
|
||
#endregion | ||
} | ||
} |
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,26 @@ | ||
namespace AupInfo.Core | ||
{ | ||
public class ExEditFigure | ||
{ | ||
public string Name { get; } | ||
public string Kind { get; } | ||
|
||
public ExEditFigure(string name, string kind) | ||
{ | ||
Name = name; | ||
Kind = kind; | ||
} | ||
|
||
public override bool Equals(object? obj) | ||
{ | ||
return obj is ExEditFigure fig | ||
&& Name == fig.Name | ||
&& Kind == fig.Kind; | ||
} | ||
|
||
public override int GetHashCode() | ||
{ | ||
return Name.GetHashCode() ^ Kind.GetHashCode(); | ||
} | ||
} | ||
} |
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,38 @@ | ||
using Reactive.Bindings; | ||
using Reactive.Bindings.Extensions; | ||
|
||
namespace AupInfo.Core | ||
{ | ||
public enum ExEditFileLocation | ||
{ | ||
Path, | ||
Project, | ||
NotFound, | ||
} | ||
|
||
public class ExEditFile : DisposableBase | ||
{ | ||
public ReactivePropertySlim<string> FilePath { get; } | ||
public ReactivePropertySlim<string> FileType { get; } | ||
public ReactivePropertySlim<ExEditFileLocation> Location { get; } | ||
|
||
public ExEditFile(string path, string type, ExEditFileLocation location) | ||
{ | ||
FilePath = new ReactivePropertySlim<string>(path).AddTo(disposables); | ||
FileType = new ReactivePropertySlim<string>(type).AddTo(disposables); | ||
Location = new ReactivePropertySlim<ExEditFileLocation>(location).AddTo(disposables); | ||
} | ||
|
||
public override bool Equals(object? obj) | ||
{ | ||
return obj is ExEditFile file | ||
&& FilePath.Value == file.FilePath.Value | ||
&& FileType.Value == file.FileType.Value; | ||
} | ||
|
||
public override int GetHashCode() | ||
{ | ||
return FilePath.Value.GetHashCode() ^ FileType.Value.GetHashCode(); | ||
} | ||
} | ||
} |
Oops, something went wrong.