├── asdfbe.png ├── GRBQicHsZ3.png ├── icon_file.ico ├── icon_file.png ├── icon_file.psd ├── ydGC874C0X.png ├── z17dYi6K4J.png ├── BCEdit180 ├── icon_file.ico ├── App.config ├── CodeEditing │ ├── InnerControlls.cs │ ├── EditorControls │ │ ├── BaseInstructionEditorControl.cs │ │ └── InstructionEditorControls.cs │ ├── BaseInnerControl.cs │ ├── Ignore__UC_for_designer.xaml.cs │ ├── Viewers │ │ ├── TypeDescriptorControl.cs │ │ ├── MethodDescriptorControl.cs │ │ └── HandleControl.cs │ ├── Ignore_UC_for_designer_2.xaml.cs │ ├── ListControls │ │ ├── BaseInstructionControl.cs │ │ └── InstructionControls.cs │ ├── Ignore__UC_for_designer.xaml │ ├── Ignore_UC_for_designer_2.xaml │ └── _hierarchy.txt ├── Properties │ ├── Settings.settings │ └── Settings.Designer.cs ├── DebugUtils.cs ├── Windows │ ├── ClassPathListWindow.xaml.cs │ ├── ErrorDialogWindow.xaml.cs │ ├── LabelSelectorWindow.xaml.cs │ ├── GenerateCodeSequenceWindow.xaml.cs │ ├── FlagEditorWindow.xaml.cs │ ├── FieldEditorWindow.xaml.cs │ ├── ActionProgressWindow.xaml.cs │ ├── ChangeInstructionWindow.xaml.cs │ ├── ErrorDialogWindow.xaml │ ├── WindowBase.cs │ ├── GenerateCodeSequenceWindow.xaml │ ├── ActionProgressWindow.xaml │ ├── FlagEditorWindow.xaml │ └── Base │ │ └── DialogBase.cs ├── Controls │ ├── InfoControls.cs │ └── Bars │ │ ├── VerticalButtonBarItem.cs │ │ └── VerticalButtonBar.cs ├── Annotations │ ├── AnnotationEditorControl.xaml.cs │ ├── AnnotationItemControl.xaml.cs │ ├── AnnotationEntryEditorControl.xaml.cs │ └── AnnotationItemControl.xaml ├── AppSettings │ └── AppSettingsXML.cs ├── LineNumbers │ └── LineNumberAdorder.cs ├── packages.config ├── WPFCommandManager.cs ├── Themes │ ├── ThemeTypes.cs │ ├── Controls.xaml.cs │ └── BaseInstructionStyles.xaml ├── Dialog │ ├── TypeEditorDialog.xaml.cs │ ├── Methods │ │ ├── MethodEditorDialog.xaml.cs │ │ ├── MethodDescEditorDialog.xaml.cs │ │ └── MethodAccessEditorDialog.xaml.cs │ ├── Class │ │ └── ClassAccessEditorDialog.xaml.cs │ └── Fields │ │ └── FieldAccessEditorDialog.xaml.cs ├── Converters │ ├── ItemNullToEnabledConverter.cs │ ├── OpCodeToDescriptionConverter.cs │ ├── TypeEqualityToTrueConverter.cs │ ├── NullToCollapsed.cs │ ├── EnumToStringConverter.cs │ ├── OpCodeToSimpleDescriptionConverter.cs │ ├── NullConverter.cs │ ├── FilePathToWindowTitleConverter.cs │ ├── FQCNToWindowTitleConverter.cs │ ├── BindLeftBorderToTabConverter.cs │ ├── ClassNameConverter.cs │ ├── EnumBooleanConverter.cs │ ├── BooleanConverter.cs │ ├── ConstPreviewConverter.cs │ ├── TypeDescriptorToStringConverter.cs │ └── BooleanToVisibilityConverter.cs ├── AttachedProperties │ └── TextBoxAP.cs └── Dialogs │ └── WindowsFileDialogs.cs ├── BCEdit180.Core ├── Utils │ ├── ClassUtils.cs │ ├── AppProxy.cs │ ├── InstructionUtils.cs │ ├── IListSelector.cs │ ├── CollectionUtils.cs │ └── ClassNameUtils.cs ├── IoC.cs ├── Window │ ├── IDialog.cs │ ├── IFileDialog.cs │ ├── ErrorDialogViewModel.cs │ ├── Dialogs.cs │ ├── IDialogManager.cs │ ├── ITypeEditors.cs │ ├── IAccessEditor.cs │ └── ActionProgressViewModel.cs ├── Modals │ └── IModalWindow.cs ├── Collections │ ├── IRemovable.cs │ └── ExtendedObservableCollection.cs ├── CodeEditing │ ├── Descriptors │ │ ├── DescriptorViewModel.cs │ │ └── TypeDescViewModel.cs │ ├── Bytecode │ │ ├── ILabelTargeter.cs │ │ ├── IBytecodeEditorAccess.cs │ │ ├── Instructions │ │ │ ├── LineNumberViewModel.cs │ │ │ ├── IntegerPushInstructionViewModel.cs │ │ │ ├── TypeInstructionViewModel.cs │ │ │ ├── LabelViewModel.cs │ │ │ ├── VariableInstructionViewModel.cs │ │ │ ├── IncrementInstructionViewModel.cs │ │ │ ├── MultiANewArrayInstructionViewModel.cs │ │ │ ├── LookupSwitchInstructionViewModel.cs │ │ │ └── StackMapFrameViewModel.cs │ │ └── Locals │ │ │ ├── LocalVariableTypeViewModel.cs │ │ │ └── LocalVariableViewModel.cs │ ├── Generate │ │ └── CodeGeneratorViewModel.cs │ ├── LabelSelectorViewModel.cs │ ├── OpcodeDescriptorViewModel.cs │ ├── ExceptionTable │ │ └── ExceptionTableViewModel.cs │ ├── InstructionEdit │ │ └── ChangeInstructionViewModel.cs │ └── CodeEditorViewModel.cs ├── Messaging │ ├── Messages │ │ ├── ErrorReporting │ │ │ ├── ClearMessages.cs │ │ │ ├── AddMessage.cs │ │ │ └── CheckField.cs │ │ └── BusyStateMessage.cs │ ├── IMessageReceiver.cs │ └── MessageDispatcher.cs ├── Editors │ ├── Const │ │ └── ConstType.cs │ ├── HandleViewModel.cs │ ├── MethodDescriptorViewModel.cs │ ├── FlagItemViewModel.cs │ └── MethodEditorViewModel.cs ├── IFieldDescriptable.cs ├── IMethodDescriptable.cs ├── Commands │ └── ICommandManager.cs ├── Dialog │ └── BaseDialogViewModel.cs ├── IApplicationProxy.cs ├── Annotations │ ├── AnnotationEntryEditorViewModel.cs │ ├── AnnotationEditorViewModel.cs │ └── Entries │ │ └── BooleanValueAnnotationEntryViewModel.cs ├── IUIManager.cs ├── BCEdit180.Core.csproj ├── ISaveable.cs ├── AttributeEditor │ ├── Classes │ │ ├── SourceFileViewModel.cs │ │ └── SourceDebugExtensionViewModel.cs │ └── targets.txt ├── ViewModels │ ├── InstructionClipboardViewModel.cs │ └── ReferenceObjectViewModel.cs ├── Serialisation │ └── InstructionSerialisers.cs ├── ClasspathEditor │ └── ClassPathItemViewModel.cs ├── ServiceManager.cs └── Searching │ └── TimedInputUpdate.cs ├── global.json ├── CSJavaClassLib └── CSJavaClassLib.csproj ├── JavaAsm ├── IDescriptor.cs ├── IO │ ├── ClassReaderState.cs │ ├── ClassWriterState.cs │ └── ConstantPoolEntries │ │ ├── Entry.cs │ │ ├── FieldReferenceEntry.cs │ │ ├── MethodReferenceEntry.cs │ │ ├── InterfaceMethodReferenceEntry.cs │ │ ├── EntryTag.cs │ │ ├── LongEntry.cs │ │ ├── IntegerEntry.cs │ │ ├── DoubleEntry.cs │ │ ├── Utf8Entry.cs │ │ ├── FloatEntry.cs │ │ ├── ClassEntry.cs │ │ ├── StringEntry.cs │ │ └── MethodTypeEntry.cs ├── ClassVersion.cs ├── JavaAsm.csproj ├── CustomAttributes │ ├── TypeAnnotation │ │ ├── TargetTypeKind.cs │ │ ├── TypeAnnotationTarget.cs │ │ ├── EmptyTarget.cs │ │ ├── OffsetTarget.cs │ │ ├── ThrowsTarget.cs │ │ ├── TypeParameterTarget.cs │ │ ├── CatchTarget.cs │ │ ├── SupertypeTarget.cs │ │ ├── FormalParameterTarget.cs │ │ ├── TypeParameterBoundTarget.cs │ │ ├── TypeArgumentTarget.cs │ │ ├── TargetType.cs │ │ ├── TypePath.cs │ │ └── LocalvarTarget.cs │ ├── SyntheticAttribute.cs │ ├── DeprecatedAttribute.cs │ ├── SourceDebugExtensionAttribute.cs │ ├── AnnotationDefaultAttribute.cs │ ├── SignatureAttribute.cs │ ├── SourceFileAttribute.cs │ ├── RuntimeVisibleAnnotationsAttribute.cs │ ├── RuntimeInvisibleAnnotationsAttribute.cs │ ├── ExceptionsAttribute.cs │ ├── RuntimeInvisibleTypeAnnotationsAttribute.cs │ ├── RuntimeVisibleTypeAnnotationsAttribute.cs │ └── LineNumberTableAttribute.cs ├── Instructions │ ├── Instruction.cs │ └── Types │ │ ├── LineNumber.cs │ │ ├── IncrementInstruction.cs │ │ ├── MultiANewArrayInstruction.cs │ │ ├── IntegerPushInstruction.cs │ │ ├── TypeInstruction.cs │ │ ├── LookupSwitchInstruction.cs │ │ ├── NewArrayInstruction.cs │ │ ├── TableSwitchInstruction.cs │ │ ├── Label.cs │ │ ├── FieldInstruction.cs │ │ ├── MethodInstruction.cs │ │ ├── JumpInstruction.cs │ │ └── VariableInstruction.cs ├── TryCatchNode.cs ├── Helpers │ └── ReadCountStream.cs ├── ClassName.cs └── ClassAccessModifiers.cs ├── .idea └── .idea.BCEdit180 │ └── .idea │ ├── vcs.xml │ ├── misc.xml │ ├── indexLayout.xml │ └── .gitignore └── JAsmLib └── JAsmLib.csproj /asdfbe.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AngryCarrot789/BCEdit180/HEAD/asdfbe.png -------------------------------------------------------------------------------- /GRBQicHsZ3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AngryCarrot789/BCEdit180/HEAD/GRBQicHsZ3.png -------------------------------------------------------------------------------- /icon_file.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AngryCarrot789/BCEdit180/HEAD/icon_file.ico -------------------------------------------------------------------------------- /icon_file.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AngryCarrot789/BCEdit180/HEAD/icon_file.png -------------------------------------------------------------------------------- /icon_file.psd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AngryCarrot789/BCEdit180/HEAD/icon_file.psd -------------------------------------------------------------------------------- /ydGC874C0X.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AngryCarrot789/BCEdit180/HEAD/ydGC874C0X.png -------------------------------------------------------------------------------- /z17dYi6K4J.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AngryCarrot789/BCEdit180/HEAD/z17dYi6K4J.png -------------------------------------------------------------------------------- /BCEdit180/icon_file.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AngryCarrot789/BCEdit180/HEAD/BCEdit180/icon_file.ico -------------------------------------------------------------------------------- /BCEdit180.Core/Utils/ClassUtils.cs: -------------------------------------------------------------------------------- 1 | namespace BCEdit180.Core.Utils { 2 | public static class ClassUtils { 3 | } 4 | } -------------------------------------------------------------------------------- /global.json: -------------------------------------------------------------------------------- 1 | { 2 | "sdk": { 3 | "version": "5.0", 4 | "rollForward": "latestMajor", 5 | "allowPrerelease": true 6 | } 7 | } -------------------------------------------------------------------------------- /BCEdit180.Core/IoC.cs: -------------------------------------------------------------------------------- 1 | namespace BCEdit180.Core { 2 | public static class IoC { 3 | public static IUIManager UI => ServiceManager.GetService(); 4 | } 5 | } -------------------------------------------------------------------------------- /BCEdit180.Core/Window/IDialog.cs: -------------------------------------------------------------------------------- 1 | namespace BCEdit180.Core.Window { 2 | public interface IDialog { 3 | bool DialogResult { get; set; } 4 | 5 | void Close(); 6 | } 7 | } -------------------------------------------------------------------------------- /CSJavaClassLib/CSJavaClassLib.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netstandard2.0 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /BCEdit180.Core/Utils/AppProxy.cs: -------------------------------------------------------------------------------- 1 | namespace BCEdit180.Core.Utils { 2 | public class AppProxy { 3 | public static IApplicationProxy Proxy => ServiceManager.GetService(); 4 | } 5 | } -------------------------------------------------------------------------------- /BCEdit180/App.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /JavaAsm/IDescriptor.cs: -------------------------------------------------------------------------------- 1 | namespace JavaAsm { 2 | /// 3 | /// Common interface for all descriptors 4 | /// 5 | public interface IDescriptor { 6 | IDescriptor Copy(); 7 | } 8 | } -------------------------------------------------------------------------------- /BCEdit180.Core/Modals/IModalWindow.cs: -------------------------------------------------------------------------------- 1 | using REghZy.MVVM.ViewModels; 2 | 3 | namespace BCEdit180.Core.Modals { 4 | public interface IModalWindow where T : BaseViewModel { 5 | T Model { get; set; } 6 | } 7 | } -------------------------------------------------------------------------------- /BCEdit180/CodeEditing/InnerControlls.cs: -------------------------------------------------------------------------------- 1 | using System.Windows.Controls; 2 | using BCEdit180.CodeEditing.ListControls; 3 | 4 | namespace BCEdit180.CodeEditing { 5 | public class MatchLabelControl : BaseInnerControl { } 6 | } -------------------------------------------------------------------------------- /JavaAsm/IO/ClassReaderState.cs: -------------------------------------------------------------------------------- 1 | namespace JavaAsm.IO { 2 | internal class ClassReaderState { 3 | public ClassNode ClassNode { get; set; } 4 | 5 | public ConstantPool ConstantPool { get; set; } 6 | } 7 | } -------------------------------------------------------------------------------- /JavaAsm/IO/ClassWriterState.cs: -------------------------------------------------------------------------------- 1 | namespace JavaAsm.IO { 2 | internal class ClassWriterState { 3 | public ClassNode ClassNode { get; set; } 4 | 5 | public ConstantPool ConstantPool { get; set; } 6 | } 7 | } -------------------------------------------------------------------------------- /BCEdit180.Core/Utils/InstructionUtils.cs: -------------------------------------------------------------------------------- 1 | namespace BCEdit180.Core.Utils { 2 | public class InstructionUtils { 3 | // instead, have the jump instruction view model store a reference to the label view model 4 | } 5 | } -------------------------------------------------------------------------------- /.idea/.idea.BCEdit180/.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /BCEdit180/CodeEditing/EditorControls/BaseInstructionEditorControl.cs: -------------------------------------------------------------------------------- 1 | using System.Windows.Controls; 2 | 3 | namespace BCEdit180.CodeEditing.EditorControls { 4 | public class BaseInstructionEditorControl : Control { 5 | 6 | } 7 | } -------------------------------------------------------------------------------- /BCEdit180.Core/Collections/IRemovable.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace BCEdit180.Core.Collections { 6 | public interface IRemovable { 7 | 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /BCEdit180.Core/CodeEditing/Descriptors/DescriptorViewModel.cs: -------------------------------------------------------------------------------- 1 | using JavaAsm; 2 | using REghZy.MVVM.ViewModels; 3 | 4 | namespace BCEdit180.Core.CodeEditing.Descriptors { 5 | public abstract class DescriptorViewModel : BaseViewModel { 6 | 7 | } 8 | } -------------------------------------------------------------------------------- /BCEdit180/Properties/Settings.settings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /.idea/.idea.BCEdit180/.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /BCEdit180.Core/Messaging/Messages/ErrorReporting/ClearMessages.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace BCEdit180.Core.Messaging.Messages.ErrorReporting { 6 | class ClearMessages { 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /.idea/.idea.BCEdit180/.idea/indexLayout.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /BCEdit180/DebugUtils.cs: -------------------------------------------------------------------------------- 1 | namespace BCEdit180 { 2 | public static class DebugUtils { 3 | public static string GetDebugString(object value) { 4 | return value == null ? "null (null)" : $"{value.GetType().Name} ({value})"; 5 | } 6 | } 7 | } -------------------------------------------------------------------------------- /BCEdit180.Core/CodeEditing/Bytecode/ILabelTargeter.cs: -------------------------------------------------------------------------------- 1 | using BCEdit180.Core.CodeEditing.Bytecode.Instructions; 2 | 3 | namespace BCEdit180.Core.CodeEditing.Bytecode { 4 | public interface ILabelTargeter { 5 | LabelViewModel TargetLabel { get; set; } 6 | } 7 | } -------------------------------------------------------------------------------- /JAsmLib/JAsmLib.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netstandard2.0 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /BCEdit180.Core/Editors/Const/ConstType.cs: -------------------------------------------------------------------------------- 1 | namespace BCEdit180.Core.Editors.Const { 2 | public enum ConstType { 3 | Integer, 4 | Long, 5 | Float, 6 | Double, 7 | String, 8 | Class, 9 | Handle, 10 | MethodDescriptor, 11 | } 12 | } -------------------------------------------------------------------------------- /BCEdit180.Core/IFieldDescriptable.cs: -------------------------------------------------------------------------------- 1 | using System.Windows.Input; 2 | using JavaAsm; 3 | 4 | namespace BCEdit180.Core { 5 | public interface IFieldDescriptable { 6 | TypeDescriptor FieldDescriptor { get; set; } 7 | 8 | ICommand EditFieldDescriptorCommand { get; } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /BCEdit180.Core/Messaging/Messages/BusyStateMessage.cs: -------------------------------------------------------------------------------- 1 | namespace BCEdit180.Core.Messaging.Messages { 2 | public class BusyStateMessage { 3 | public bool IsBusy { get; set; } 4 | 5 | public BusyStateMessage(bool isBusy = true) { 6 | this.IsBusy = isBusy; 7 | } 8 | } 9 | } -------------------------------------------------------------------------------- /BCEdit180.Core/IMethodDescriptable.cs: -------------------------------------------------------------------------------- 1 | using System.Windows.Input; 2 | using JavaAsm; 3 | 4 | namespace BCEdit180.Core { 5 | public interface IMethodDescriptable { 6 | MethodDescriptor MethodDescriptor { get; set; } 7 | 8 | ICommand EditMethodDescriptorCommand { get; } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /BCEdit180/Windows/ClassPathListWindow.xaml.cs: -------------------------------------------------------------------------------- 1 | using System.Windows; 2 | using BCEdit180.Windows.Base; 3 | 4 | namespace BCEdit180.Windows { 5 | public partial class ClassPathListWindow : DialogBase { 6 | public ClassPathListWindow() { 7 | InitializeComponent(); 8 | } 9 | } 10 | } -------------------------------------------------------------------------------- /BCEdit180.Core/Utils/IListSelector.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace BCEdit180.Core.Utils { 4 | public interface IListSelector { 5 | IEnumerable SelectedItems { get; } 6 | 7 | void BringIntoView(T value); 8 | 9 | void ScrollToSelectedItem(); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /BCEdit180.Core/Commands/ICommandManager.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace BCEdit180.Core.Commands { 4 | public interface ICommandManager { 5 | void AddRequerySuggestionHandler(EventHandler handler); 6 | void RemoveRequerySuggestionHandler(EventHandler handler); 7 | 8 | void InvalidateRequerySuggested(); 9 | } 10 | } -------------------------------------------------------------------------------- /JavaAsm/ClassVersion.cs: -------------------------------------------------------------------------------- 1 | namespace JavaAsm { 2 | /// 3 | /// Class file version enum 4 | /// 5 | public enum ClassVersion : ushort { 6 | Java1P1 = 45, 7 | Java1P2, 8 | Java1P3, 9 | Java1P4, 10 | Java5, 11 | Java6, 12 | Java7, 13 | Java8 14 | } 15 | } -------------------------------------------------------------------------------- /BCEdit180/Controls/InfoControls.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows.Controls; 7 | 8 | namespace BCEdit180.Controls { 9 | public class MethodInfoControl : Control {} 10 | public class FieldInfoControl : Control {} 11 | } 12 | -------------------------------------------------------------------------------- /.idea/.idea.BCEdit180/.idea/.gitignore: -------------------------------------------------------------------------------- 1 | # Default ignored files 2 | /shelf/ 3 | /workspace.xml 4 | # Rider ignored files 5 | /projectSettingsUpdater.xml 6 | /.idea.BCEdit180.iml 7 | /modules.xml 8 | /contentModel.xml 9 | # Datasource local storage ignored files 10 | /dataSources/ 11 | /dataSources.local.xml 12 | # Editor-based HTTP Client requests 13 | /httpRequests/ 14 | -------------------------------------------------------------------------------- /JavaAsm/JavaAsm.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netstandard2.0 5 | true 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /BCEdit180.Core/Dialog/BaseDialogViewModel.cs: -------------------------------------------------------------------------------- 1 | using REghZy.MVVM.ViewModels; 2 | 3 | namespace BCEdit180.Core.Dialog { 4 | public class BaseDialogViewModel : BaseViewModel { 5 | private string title; 6 | public string Title { 7 | get => this.title; 8 | set => RaisePropertyChanged(ref this.title, value); 9 | } 10 | } 11 | } -------------------------------------------------------------------------------- /BCEdit180.Core/Messaging/Messages/ErrorReporting/AddMessage.cs: -------------------------------------------------------------------------------- 1 | namespace BCEdit180.Core.Messaging.Messages.ErrorReporting { 2 | public class AddMessage { 3 | public string Message { get; set; } 4 | 5 | public AddMessage() { 6 | } 7 | 8 | public AddMessage(string message) { 9 | this.Message = message; 10 | } 11 | } 12 | } -------------------------------------------------------------------------------- /BCEdit180.Core/Messaging/Messages/ErrorReporting/CheckField.cs: -------------------------------------------------------------------------------- 1 | using BCEdit180.Core.ViewModels; 2 | 3 | namespace BCEdit180.Core.Messaging.Messages.ErrorReporting { 4 | public class CheckField { 5 | public FieldInfoViewModel Field { get; } 6 | 7 | public CheckField(FieldInfoViewModel field) { 8 | this.Field = field; 9 | } 10 | } 11 | } -------------------------------------------------------------------------------- /BCEdit180.Core/Utils/CollectionUtils.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace BCEdit180.Core.Utils { 4 | public static class CollectionUtils { 5 | public static void AddAll(this ICollection collection, IEnumerable items) { 6 | foreach (T item in items) { 7 | collection.Add(item); 8 | } 9 | } 10 | } 11 | } -------------------------------------------------------------------------------- /BCEdit180/CodeEditing/BaseInnerControl.cs: -------------------------------------------------------------------------------- 1 | using System.Windows.Controls; 2 | using REghZy.MVVM.ViewModels; 3 | 4 | namespace BCEdit180.CodeEditing { 5 | public class BaseInnerControl : Control { 6 | // public BaseViewModel ViewModel { 7 | // get => (BaseViewModel) this.DataContext; 8 | // set => this.DataContext = value; 9 | // } 10 | } 11 | } -------------------------------------------------------------------------------- /BCEdit180/Windows/ErrorDialogWindow.xaml.cs: -------------------------------------------------------------------------------- 1 | using BCEdit180.Windows.Base; 2 | 3 | namespace BCEdit180.Windows { 4 | /// 5 | /// Interaction logic for ErrorDialogWindow.xaml 6 | /// 7 | public partial class ErrorDialogWindow : DialogBase { 8 | public ErrorDialogWindow() { 9 | InitializeComponent(); 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /BCEdit180.Core/Window/IFileDialog.cs: -------------------------------------------------------------------------------- 1 | using System.Threading.Tasks; 2 | 3 | namespace BCEdit180.Core.Window { 4 | public interface IFileDialog { 5 | Task OpenFileDialog(string title, string filter, out string path); 6 | Task OpenSaveDialog(string title, string filter, out string path); 7 | Task OpenFolderDialog(string title, out string path); 8 | } 9 | } -------------------------------------------------------------------------------- /JavaAsm/CustomAttributes/TypeAnnotation/TargetTypeKind.cs: -------------------------------------------------------------------------------- 1 | namespace JavaAsm.CustomAttributes.TypeAnnotation { 2 | public enum TargetTypeKind { 3 | TypeParameter, 4 | Supertype, 5 | TypeParameterBound, 6 | Empty, 7 | FormalParameter, 8 | Throws, 9 | Localvar, 10 | Catch, 11 | Offset, 12 | TypeArgument 13 | } 14 | } -------------------------------------------------------------------------------- /BCEdit180/Windows/LabelSelectorWindow.xaml.cs: -------------------------------------------------------------------------------- 1 | using BCEdit180.Windows.Base; 2 | 3 | namespace BCEdit180.Windows { 4 | /// 5 | /// Interaction logic for JumpTargetSelectorWindow.xaml 6 | /// 7 | public partial class LabelSelectorWindow : DialogBase { 8 | public LabelSelectorWindow() { 9 | InitializeComponent(); 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /BCEdit180.Core/Window/ErrorDialogViewModel.cs: -------------------------------------------------------------------------------- 1 | using REghZy.MVVM.ViewModels; 2 | 3 | namespace BCEdit180.Core.Window { 4 | public class ErrorDialogViewModel : BaseViewModel { 5 | private string description; 6 | public string Description { 7 | get => this.description; 8 | set => RaisePropertyChanged(ref this.description, value); 9 | } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /BCEdit180/Annotations/AnnotationEditorControl.xaml.cs: -------------------------------------------------------------------------------- 1 | using System.Windows.Controls; 2 | 3 | namespace BCEdit180.Annotations { 4 | /// 5 | /// Interaction logic for AnnotationEditor.xaml 6 | /// 7 | public partial class AnnotationEditorControl : UserControl { 8 | public AnnotationEditorControl() { 9 | InitializeComponent(); 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /BCEdit180/Annotations/AnnotationItemControl.xaml.cs: -------------------------------------------------------------------------------- 1 | using System.Windows.Controls; 2 | 3 | namespace BCEdit180.Annotations { 4 | /// 5 | /// Interaction logic for AnnotationItemControl.xaml 6 | /// 7 | public partial class AnnotationItemControl : UserControl { 8 | public AnnotationItemControl() { 9 | InitializeComponent(); 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /BCEdit180.Core/IApplicationProxy.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Threading.Tasks; 3 | 4 | namespace BCEdit180.Core { 5 | public interface IApplicationProxy { 6 | void Shutdown(); 7 | 8 | void DispatchInvoke(Action action); 9 | 10 | Task DispatchInvokeAsync(Action action); 11 | 12 | void SyspendDispatcherForAction(Action action); 13 | 14 | bool IsRunning(); 15 | } 16 | } -------------------------------------------------------------------------------- /BCEdit180/CodeEditing/Ignore__UC_for_designer.xaml.cs: -------------------------------------------------------------------------------- 1 | using System.Windows.Controls; 2 | 3 | namespace BCEdit180.CodeEditing { 4 | /// 5 | /// Interaction logic for Ignore__UC_for_designer.xaml 6 | /// 7 | public partial class Ignore__UC_for_designer : UserControl { 8 | public Ignore__UC_for_designer() { 9 | InitializeComponent(); 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /BCEdit180/Windows/GenerateCodeSequenceWindow.xaml.cs: -------------------------------------------------------------------------------- 1 | using BCEdit180.Windows.Base; 2 | 3 | namespace BCEdit180.Windows { 4 | /// 5 | /// Interaction logic for GenerateCodeSequenceWindow.xaml 6 | /// 7 | public partial class GenerateCodeSequenceWindow : DialogBase { 8 | public GenerateCodeSequenceWindow() { 9 | InitializeComponent(); 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /BCEdit180/AppSettings/AppSettingsXML.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Xml.Serialization; 3 | 4 | namespace BCEdit180.AppSettings { 5 | public class AppSettingsXML { 6 | [XmlElement] 7 | public int Theme { get; set; } 8 | 9 | [XmlElement] 10 | public bool ShowClassListByDefault { get; set; } 11 | 12 | public List ClassPath { get; set; } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /BCEdit180/Annotations/AnnotationEntryEditorControl.xaml.cs: -------------------------------------------------------------------------------- 1 | using System.Windows.Controls; 2 | 3 | namespace BCEdit180.Annotations { 4 | /// 5 | /// Interaction logic for AnnotationEntryEditorControl.xaml 6 | /// 7 | public partial class AnnotationEntryEditorControl : UserControl { 8 | public AnnotationEntryEditorControl() { 9 | InitializeComponent(); 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /JavaAsm/Instructions/Instruction.cs: -------------------------------------------------------------------------------- 1 | namespace JavaAsm.Instructions { 2 | public abstract class Instruction { 3 | public InstructionList OwnerList { get; internal set; } 4 | 5 | public Instruction Previous { get; internal set; } 6 | 7 | public Instruction Next { get; internal set; } 8 | 9 | public abstract Opcode Opcode { get; set; } 10 | 11 | public abstract Instruction Copy(); 12 | } 13 | } -------------------------------------------------------------------------------- /JavaAsm/IO/ConstantPoolEntries/Entry.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | 3 | namespace JavaAsm.IO.ConstantPoolEntries { 4 | internal abstract class Entry { 5 | public abstract EntryTag Tag { get; } 6 | 7 | public abstract void ProcessFromConstantPool(ConstantPool constantPool); 8 | 9 | public abstract void Write(Stream stream); 10 | 11 | public abstract void PutToConstantPool(ConstantPool constantPool); 12 | } 13 | } -------------------------------------------------------------------------------- /BCEdit180/CodeEditing/Viewers/TypeDescriptorControl.cs: -------------------------------------------------------------------------------- 1 | using System.Windows.Controls; 2 | using BCEdit180.Core.CodeEditing.Descriptors; 3 | using BCEdit180.Core.Editors; 4 | 5 | namespace BCEdit180.CodeEditing.Viewers { 6 | public class TypeDescriptorControl : Control { 7 | public TypeDescViewModel TypeDesc { 8 | get => (TypeDescViewModel) this.DataContext; 9 | set => this.DataContext = value; 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /JavaAsm/IO/ConstantPoolEntries/FieldReferenceEntry.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | 3 | namespace JavaAsm.IO.ConstantPoolEntries { 4 | internal class FieldReferenceEntry : ReferenceEntry { 5 | public FieldReferenceEntry(ClassEntry @class, NameAndTypeEntry nameAndType) : base(@class, nameAndType) { } 6 | 7 | public override EntryTag Tag => EntryTag.FieldReference; 8 | 9 | public FieldReferenceEntry(Stream stream) : base(stream) { } 10 | } 11 | } -------------------------------------------------------------------------------- /JavaAsm/IO/ConstantPoolEntries/MethodReferenceEntry.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | 3 | namespace JavaAsm.IO.ConstantPoolEntries { 4 | internal class MethodReferenceEntry : ReferenceEntry { 5 | public MethodReferenceEntry(ClassEntry @class, NameAndTypeEntry nameAndType) : base(@class, nameAndType) { } 6 | 7 | public override EntryTag Tag => EntryTag.MethodReference; 8 | 9 | public MethodReferenceEntry(Stream stream) : base(stream) { } 10 | } 11 | } -------------------------------------------------------------------------------- /BCEdit180.Core/Annotations/AnnotationEntryEditorViewModel.cs: -------------------------------------------------------------------------------- 1 | using REghZy.MVVM.ViewModels; 2 | 3 | namespace BCEdit180.Core.Annotations { 4 | public class AnnotationEntryEditorViewModel : BaseViewModel { 5 | private ElementValueTagXAML selectedPrimitive; 6 | public ElementValueTagXAML SelectedPrimitive { 7 | get => this.selectedPrimitive; 8 | set => RaisePropertyChanged(ref this.selectedPrimitive, value); 9 | } 10 | } 11 | } -------------------------------------------------------------------------------- /JavaAsm/CustomAttributes/TypeAnnotation/TypeAnnotationTarget.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | using JavaAsm.IO; 3 | 4 | namespace JavaAsm.CustomAttributes.TypeAnnotation { 5 | public abstract class TypeAnnotationTarget { 6 | public abstract TargetTypeKind TargetTypeKind { get; } 7 | 8 | internal abstract void Write(Stream stream, ClassWriterState writerState); 9 | 10 | internal abstract void Read(Stream stream, ClassReaderState readerState); 11 | } 12 | } -------------------------------------------------------------------------------- /BCEdit180.Core/Annotations/AnnotationEditorViewModel.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.ObjectModel; 2 | using REghZy.MVVM.ViewModels; 3 | 4 | namespace BCEdit180.Core.Annotations { 5 | public class AnnotationEditorViewModel : BaseViewModel { 6 | public ObservableCollection Annotations { get; } 7 | 8 | public AnnotationEditorViewModel() { 9 | this.Annotations = new ObservableCollection(); 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /BCEdit180/LineNumbers/LineNumberAdorder.cs: -------------------------------------------------------------------------------- 1 | using System.Windows; 2 | using System.Windows.Documents; 3 | using System.Windows.Media; 4 | 5 | namespace BCEdit180.LineNumbers { 6 | public class LineNumberAdorder : Adorner { 7 | protected override void OnRender(DrawingContext drawingContext) { 8 | base.OnRender(drawingContext); 9 | } 10 | 11 | public LineNumberAdorder(UIElement adornedElement) : base(adornedElement) { 12 | 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /JavaAsm/CustomAttributes/TypeAnnotation/EmptyTarget.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | using JavaAsm.IO; 3 | 4 | namespace JavaAsm.CustomAttributes.TypeAnnotation { 5 | public class EmptyTarget : TypeAnnotationTarget { 6 | public override TargetTypeKind TargetTypeKind => TargetTypeKind.Empty; 7 | 8 | internal override void Write(Stream stream, ClassWriterState writerState) { } 9 | 10 | internal override void Read(Stream stream, ClassReaderState readerState) { } 11 | } 12 | } -------------------------------------------------------------------------------- /BCEdit180/packages.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /BCEdit180.Core/Window/Dialogs.cs: -------------------------------------------------------------------------------- 1 | namespace BCEdit180.Core.Window { 2 | public static class Dialogs { 3 | public static IDialogManager Message => ServiceManager.GetService(); 4 | 5 | public static ITypeEditors TypeEditor => ServiceManager.GetService(); 6 | 7 | public static IAccessEditor AccessEditor => ServiceManager.GetService(); 8 | 9 | public static IFileDialog File => ServiceManager.GetService(); 10 | } 11 | } -------------------------------------------------------------------------------- /BCEdit180.Core/CodeEditing/Bytecode/IBytecodeEditorAccess.cs: -------------------------------------------------------------------------------- 1 | namespace BCEdit180.Core.CodeEditing.Bytecode { 2 | /// 3 | /// This class requires access to the bytecode editor which created this instruction 4 | /// 5 | /// The bytecode editor reference is injected after the constructor for the instruction view model 6 | /// 7 | /// 8 | public interface IBytecodeEditorAccess { 9 | BytecodeEditorViewModel BytecodeEditor { get; set; } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /JavaAsm/IO/ConstantPoolEntries/InterfaceMethodReferenceEntry.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | 3 | namespace JavaAsm.IO.ConstantPoolEntries { 4 | internal class InterfaceMethodReferenceEntry : MethodReferenceEntry { 5 | public InterfaceMethodReferenceEntry(ClassEntry @class, NameAndTypeEntry nameAndType) : base(@class, nameAndType) { } 6 | 7 | public override EntryTag Tag => EntryTag.InterfaceMethodReference; 8 | 9 | public InterfaceMethodReferenceEntry(Stream stream) : base(stream) { } 10 | } 11 | } -------------------------------------------------------------------------------- /BCEdit180.Core/Editors/HandleViewModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using BCEdit180.Core.Dialog; 3 | using JavaAsm.Instructions.Types; 4 | using REghZy.MVVM.ViewModels; 5 | 6 | namespace BCEdit180.Core.Editors { 7 | public class HandleViewModel : BaseDialogViewModel { 8 | private Handle handle; 9 | public Handle Handle { 10 | get => this.handle; 11 | set => RaisePropertyChanged(ref this.handle, value); 12 | } 13 | 14 | public HandleViewModel() { 15 | } 16 | } 17 | } -------------------------------------------------------------------------------- /BCEdit180.Core/IUIManager.cs: -------------------------------------------------------------------------------- 1 | using System.Threading.Tasks; 2 | using BCEdit180.Core.Dialog; 3 | 4 | namespace BCEdit180.Core { 5 | public interface IUIManager { 6 | void ShowMessage(string title, string message); 7 | 8 | /// 9 | /// Shows a dialog using the given input view model, and passes the same view model as an out parameter (for convenience) 10 | /// 11 | /// 12 | bool ShowDialog(T input) where T : BaseDialogViewModel; 13 | } 14 | } -------------------------------------------------------------------------------- /JavaAsm/IO/ConstantPoolEntries/EntryTag.cs: -------------------------------------------------------------------------------- 1 | namespace JavaAsm.IO.ConstantPoolEntries { 2 | internal enum EntryTag : byte { 3 | Class = 7, 4 | FieldReference = 9, 5 | MethodReference = 10, 6 | InterfaceMethodReference = 11, 7 | String = 8, 8 | Integer = 3, 9 | Float = 4, 10 | Long = 5, 11 | Double = 6, 12 | NameAndType = 12, 13 | Utf8 = 1, 14 | MethodHandle = 15, 15 | MethodType = 16, 16 | InvokeDynamic = 18 17 | } 18 | } -------------------------------------------------------------------------------- /BCEdit180.Core/Window/IDialogManager.cs: -------------------------------------------------------------------------------- 1 | using System.Threading.Tasks; 2 | 3 | namespace BCEdit180.Core.Window { 4 | public interface IDialogManager { 5 | void ShowMessage(string header, string description); 6 | 7 | void ShowWarning(string header, string description); 8 | 9 | bool ConfirmOkCancel(string header, string description); 10 | 11 | bool ConfirmOkCancel(string header, string description, bool defaultResult); 12 | 13 | ActionProgressViewModel ShowProgressWindow(string header, string description = null); 14 | } 15 | } -------------------------------------------------------------------------------- /BCEdit180.Core/BCEdit180.Core.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netstandard2.0 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | ..\..\REghZy\DLL\REghZy.MVVM.dll 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /BCEdit180.Core/Messaging/IMessageReceiver.cs: -------------------------------------------------------------------------------- 1 | namespace BCEdit180.Core.Messaging { 2 | /// 3 | /// A class that can receive messages. This is the base class, without a receiver method, and shouldn't be used 4 | /// 5 | public interface IMessageReceiver { 6 | 7 | } 8 | 9 | /// 10 | /// A class that can receive a message 11 | /// 12 | /// 13 | public interface IMessageReceiver : IMessageReceiver { 14 | void HandleMessage(TMessage message); 15 | } 16 | } -------------------------------------------------------------------------------- /BCEdit180.Core/CodeEditing/Generate/CodeGeneratorViewModel.cs: -------------------------------------------------------------------------------- 1 | using System.Windows.Input; 2 | using REghZy.MVVM.Commands; 3 | using REghZy.MVVM.ViewModels; 4 | 5 | namespace BCEdit180.Core.CodeEditing.Generate { 6 | public class CodeGeneratorViewModel : BaseViewModel { 7 | public ICommand GenerateCodeSequenceCommand { get; } 8 | 9 | public CodeGeneratorViewModel() { 10 | this.GenerateCodeSequenceCommand = new RelayCommand(GenerateCodeSequenceAction); 11 | } 12 | 13 | public void GenerateCodeSequenceAction() { 14 | 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /JavaAsm/CustomAttributes/SyntheticAttribute.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | using JavaAsm.IO; 3 | 4 | namespace JavaAsm.CustomAttributes { 5 | public class SyntheticAttribute : CustomAttribute { 6 | internal override byte[] Save(ClassWriterState writerState, AttributeScope scope) => new byte[0]; 7 | } 8 | 9 | internal class SyntheticAttributeFactory : ICustomAttributeFactory { 10 | public SyntheticAttribute Parse(Stream attributeDataStream, uint attributeDataLength, ClassReaderState readerState, AttributeScope scope) => new SyntheticAttribute(); 11 | } 12 | } -------------------------------------------------------------------------------- /JavaAsm/CustomAttributes/DeprecatedAttribute.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | using JavaAsm.IO; 3 | 4 | namespace JavaAsm.CustomAttributes { 5 | public class DeprecatedAttribute : CustomAttribute { 6 | internal override byte[] Save(ClassWriterState writerState, AttributeScope scope) => new byte[0]; 7 | } 8 | 9 | internal class DeprecatedAttributeFactory : ICustomAttributeFactory { 10 | public DeprecatedAttribute Parse(Stream attributeDataStream, uint attributeDataLength, ClassReaderState readerState, AttributeScope scope) => new DeprecatedAttribute(); 11 | } 12 | } -------------------------------------------------------------------------------- /BCEdit180/WPFCommandManager.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Windows.Input; 3 | using BCEdit180.Core.Commands; 4 | 5 | namespace BCEdit180 { 6 | public class WPFCommandManager : ICommandManager { 7 | public void AddRequerySuggestionHandler(EventHandler handler) { 8 | CommandManager.RequerySuggested += handler; 9 | } 10 | 11 | public void RemoveRequerySuggestionHandler(EventHandler handler) { 12 | CommandManager.RequerySuggested -= handler; 13 | } 14 | 15 | public void InvalidateRequerySuggested() { 16 | CommandManager.InvalidateRequerySuggested(); 17 | } 18 | } 19 | } -------------------------------------------------------------------------------- /BCEdit180.Core/Window/ITypeEditors.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using BCEdit180.Core.Editors; 4 | using JavaAsm.Instructions; 5 | 6 | namespace BCEdit180.Core.Window { 7 | public interface ITypeEditors { 8 | bool EditFieldDialog(out FieldEditorViewModel editor, bool showFieldName = true); 9 | 10 | bool ChangeInstructionDialog(IEnumerable opcodes, out Opcode opcode); 11 | 12 | bool ChangeInstructionDialog(IEnumerable opcodes, in Opcode? defaultOpcode, out Opcode opcode); 13 | 14 | bool EditEnumFlagDialog(in TEnum template, out TEnum access) where TEnum : Enum ; 15 | } 16 | } -------------------------------------------------------------------------------- /BCEdit180/Windows/FlagEditorWindow.xaml.cs: -------------------------------------------------------------------------------- 1 | using BCEdit180.Core.Editors; 2 | using BCEdit180.Core.Modals; 3 | using BCEdit180.Windows.Base; 4 | 5 | namespace BCEdit180.Windows { 6 | /// 7 | /// Interaction logic for FlagEditorWindow.xaml 8 | /// 9 | public partial class FlagEditorWindow : DialogBase, IModalWindow { 10 | public FlagEditorViewModel Model { 11 | get => (FlagEditorViewModel) this.DataContext; 12 | set => this.DataContext = value; 13 | } 14 | 15 | public FlagEditorWindow() { 16 | InitializeComponent(); 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /BCEdit180.Core/ISaveable.cs: -------------------------------------------------------------------------------- 1 | namespace BCEdit180.Core { 2 | // This doesn't have any purpose, apart from readability 3 | 4 | /// 5 | /// A saveable object, that can load from an object, and save into an object 6 | /// 7 | /// 8 | public interface ISaveable { 9 | /// 10 | /// Loads the contents from the value into this class 11 | /// 12 | void Load(T node); 13 | 14 | /// 15 | /// Saves this class's content into the given value's contents 16 | /// 17 | void Save(T node); 18 | } 19 | } -------------------------------------------------------------------------------- /BCEdit180/Windows/FieldEditorWindow.xaml.cs: -------------------------------------------------------------------------------- 1 | using BCEdit180.Core.Editors; 2 | using BCEdit180.Core.Modals; 3 | using BCEdit180.Windows.Base; 4 | 5 | namespace BCEdit180.Windows { 6 | /// 7 | /// Interaction logic for FieldEditorWindow.xaml 8 | /// 9 | public partial class FieldEditorWindow : DialogBase, IModalWindow { 10 | public FlagEditorViewModel Model { 11 | get => (FlagEditorViewModel) this.DataContext; 12 | set => this.DataContext = value; 13 | } 14 | 15 | public FieldEditorWindow() { 16 | InitializeComponent(); 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /BCEdit180/Themes/ThemeTypes.cs: -------------------------------------------------------------------------------- 1 | namespace BCEdit180.Themes { 2 | public enum ThemeType { 3 | Dark, 4 | Red, 5 | Light, 6 | } 7 | 8 | public static class ThemeTypeExtension { 9 | public static string GetName(this ThemeType type) { 10 | switch (type) { 11 | case ThemeType.Light: 12 | return "LightTheme"; 13 | case ThemeType.Dark: 14 | return "SoftDark"; 15 | case ThemeType.Red: 16 | return "RedBlackTheme"; 17 | default: 18 | return null; 19 | } 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /BCEdit180/Windows/ActionProgressWindow.xaml.cs: -------------------------------------------------------------------------------- 1 | using BCEdit180.Core.Modals; 2 | using BCEdit180.Core.Window; 3 | using BCEdit180.Windows.Base; 4 | 5 | namespace BCEdit180.Windows { 6 | /// 7 | /// Interaction logic for LoadingClassWindow.xaml 8 | /// 9 | public partial class ActionProgressWindow : DialogBase, IModalWindow { 10 | public ActionProgressViewModel Model { 11 | get => (ActionProgressViewModel) this.DataContext; 12 | set => this.DataContext = value; 13 | } 14 | 15 | public ActionProgressWindow() { 16 | InitializeComponent(); 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /JavaAsm/Instructions/Types/LineNumber.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace JavaAsm.Instructions.Types { 4 | public class LineNumber : Instruction { 5 | public override Opcode Opcode { 6 | get => Opcode.None; 7 | set => throw new InvalidOperationException(GetType().Name + " does not have an instruction"); 8 | } 9 | 10 | public override Instruction Copy() { 11 | return new LineNumber() { 12 | Line = this.Line 13 | }; 14 | } 15 | 16 | public ushort Line { get; set; } 17 | 18 | public override string ToString() { 19 | return $"LINE {this.Line}"; 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /BCEdit180.Core/CodeEditing/LabelSelectorViewModel.cs: -------------------------------------------------------------------------------- 1 | using BCEdit180.Core.CodeEditing.Bytecode; 2 | using BCEdit180.Core.CodeEditing.Bytecode.Instructions; 3 | using BCEdit180.Core.Dialog; 4 | using REghZy.MVVM.ViewModels; 5 | 6 | namespace BCEdit180.Core.CodeEditing { 7 | public class LabelSelectorViewModel : BaseDialogViewModel, IBytecodeEditorAccess { 8 | public BytecodeEditorViewModel BytecodeEditor { get; set; } 9 | 10 | private BaseInstructionViewModel selectedInstruction; 11 | public BaseInstructionViewModel SelectedInstruction { 12 | get => this.selectedInstruction; 13 | set => RaisePropertyChanged(ref this.selectedInstruction, value); 14 | } 15 | } 16 | } -------------------------------------------------------------------------------- /JavaAsm/CustomAttributes/TypeAnnotation/OffsetTarget.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | using BinaryEncoding; 3 | using JavaAsm.IO; 4 | 5 | namespace JavaAsm.CustomAttributes.TypeAnnotation { 6 | public class OffsetTarget : TypeAnnotationTarget { 7 | public ushort Offset { get; set; } 8 | 9 | public override TargetTypeKind TargetTypeKind => TargetTypeKind.Offset; 10 | 11 | internal override void Write(Stream stream, ClassWriterState writerState) { 12 | Binary.BigEndian.Write(stream, this.Offset); 13 | } 14 | 15 | internal override void Read(Stream stream, ClassReaderState readerState) { 16 | this.Offset = Binary.BigEndian.ReadUInt16(stream); 17 | } 18 | } 19 | } -------------------------------------------------------------------------------- /BCEdit180.Core/Window/IAccessEditor.cs: -------------------------------------------------------------------------------- 1 | using System.Threading.Tasks; 2 | using JavaAsm; 3 | 4 | namespace BCEdit180.Core.Window { 5 | public interface IAccessEditor { 6 | Task EditClassAccess(out ClassAccessModifiers access); 7 | Task EditClassAccess(in ClassAccessModifiers template, out ClassAccessModifiers access); 8 | 9 | Task EditMethodAccess(out MethodAccessModifiers template); 10 | Task EditMethodAccess(in MethodAccessModifiers template, out MethodAccessModifiers access); 11 | 12 | Task EditFieldAccess(out FieldAccessModifiers access); 13 | Task EditFieldAccess(in FieldAccessModifiers template, out FieldAccessModifiers access); 14 | } 15 | } -------------------------------------------------------------------------------- /BCEdit180/Windows/ChangeInstructionWindow.xaml.cs: -------------------------------------------------------------------------------- 1 | using BCEdit180.Core.CodeEditing.InstructionEdit; 2 | using BCEdit180.Core.Modals; 3 | using BCEdit180.Windows.Base; 4 | 5 | namespace BCEdit180.Windows { 6 | /// 7 | /// Interaction logic for ChangeInstructionWindow.xaml 8 | /// 9 | public partial class ChangeInstructionWindow : DialogBase, IModalWindow { 10 | public ChangeInstructionViewModel Model { 11 | get => (ChangeInstructionViewModel) this.DataContext; 12 | set => this.DataContext = value; 13 | } 14 | 15 | public ChangeInstructionWindow() { 16 | InitializeComponent(); 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /BCEdit180/CodeEditing/Viewers/MethodDescriptorControl.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows; 7 | using System.Windows.Controls; 8 | using System.Windows.Controls.Primitives; 9 | using System.Windows.Input; 10 | using BCEdit180.Core.CodeEditing; 11 | using BCEdit180.Core.Editors; 12 | using JavaAsm; 13 | 14 | namespace BCEdit180.CodeEditing.Viewers { 15 | public class MethodDescriptorControl : Control { 16 | public MethodDescriptorViewModel MethodDescriptor { 17 | get => (MethodDescriptorViewModel) this.DataContext; 18 | set => this.DataContext = value; 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /BCEdit180.Core/AttributeEditor/Classes/SourceFileViewModel.cs: -------------------------------------------------------------------------------- 1 | using JavaAsm; 2 | using REghZy.MVVM.ViewModels; 3 | 4 | namespace BCEdit180.Core.AttributeEditor.Classes { 5 | public class SourceFileViewModel : BaseViewModel, ISaveable { 6 | private string sourceFile; 7 | public string SourceFile { 8 | get => this.sourceFile; 9 | set => RaisePropertyChanged(ref this.sourceFile, value); 10 | } 11 | 12 | public void Load(ClassNode node) { 13 | this.SourceFile = node.SourceFile; 14 | } 15 | 16 | public void Save(ClassNode node) { 17 | node.SourceFile = string.IsNullOrWhiteSpace(this.SourceFile) ? null : this.SourceFile; 18 | } 19 | } 20 | } -------------------------------------------------------------------------------- /JavaAsm/CustomAttributes/TypeAnnotation/ThrowsTarget.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | using BinaryEncoding; 3 | using JavaAsm.IO; 4 | 5 | namespace JavaAsm.CustomAttributes.TypeAnnotation { 6 | public class ThrowsTarget : TypeAnnotationTarget { 7 | public ushort ThrowsTypeIndex { get; set; } 8 | 9 | public override TargetTypeKind TargetTypeKind => TargetTypeKind.Throws; 10 | 11 | internal override void Write(Stream stream, ClassWriterState writerState) { 12 | Binary.BigEndian.Write(stream, this.ThrowsTypeIndex); 13 | } 14 | 15 | internal override void Read(Stream stream, ClassReaderState readerState) { 16 | this.ThrowsTypeIndex = Binary.BigEndian.ReadUInt16(stream); 17 | } 18 | } 19 | } -------------------------------------------------------------------------------- /BCEdit180.Core/AttributeEditor/Classes/SourceDebugExtensionViewModel.cs: -------------------------------------------------------------------------------- 1 | using JavaAsm; 2 | using REghZy.MVVM.ViewModels; 3 | 4 | namespace BCEdit180.Core.AttributeEditor.Classes { 5 | public class SourceDebugExtensionViewModel : BaseViewModel, ISaveable { 6 | private string value; 7 | public string Value { 8 | get => this.value; 9 | set => RaisePropertyChanged(ref this.value, value); 10 | } 11 | 12 | public void Load(ClassNode node) { 13 | this.Value = node.SourceDebugExtension; 14 | } 15 | 16 | public void Save(ClassNode node) { 17 | node.SourceDebugExtension = string.IsNullOrWhiteSpace(this.Value) ? null : this.Value; 18 | } 19 | } 20 | } -------------------------------------------------------------------------------- /JavaAsm/CustomAttributes/TypeAnnotation/TypeParameterTarget.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | using JavaAsm.Helpers; 3 | using JavaAsm.IO; 4 | 5 | namespace JavaAsm.CustomAttributes.TypeAnnotation { 6 | public class TypeParameterTarget : TypeAnnotationTarget { 7 | public byte TypeParameterIndex { get; set; } 8 | 9 | public override TargetTypeKind TargetTypeKind => TargetTypeKind.TypeParameter; 10 | 11 | internal override void Write(Stream stream, ClassWriterState writerState) { 12 | stream.WriteByte(this.TypeParameterIndex); 13 | } 14 | 15 | internal override void Read(Stream stream, ClassReaderState readerState) { 16 | this.TypeParameterIndex = stream.ReadByteFully(); 17 | } 18 | } 19 | } -------------------------------------------------------------------------------- /JavaAsm/CustomAttributes/TypeAnnotation/CatchTarget.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | using BinaryEncoding; 3 | using JavaAsm.IO; 4 | 5 | namespace JavaAsm.CustomAttributes.TypeAnnotation { 6 | public class CatchTarget : TypeAnnotationTarget { 7 | public ushort ExceptionTableIndex { get; set; } 8 | 9 | public override TargetTypeKind TargetTypeKind => TargetTypeKind.Catch; 10 | 11 | internal override void Write(Stream stream, ClassWriterState writerState) { 12 | Binary.BigEndian.Write(stream, this.ExceptionTableIndex); 13 | } 14 | 15 | internal override void Read(Stream stream, ClassReaderState readerState) { 16 | this.ExceptionTableIndex = Binary.BigEndian.ReadUInt16(stream); 17 | } 18 | } 19 | } -------------------------------------------------------------------------------- /JavaAsm/CustomAttributes/TypeAnnotation/SupertypeTarget.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | using BinaryEncoding; 3 | using JavaAsm.IO; 4 | 5 | namespace JavaAsm.CustomAttributes.TypeAnnotation { 6 | public class SupertypeTarget : TypeAnnotationTarget { 7 | public ushort SupertypeIndex { get; set; } 8 | 9 | public override TargetTypeKind TargetTypeKind => TargetTypeKind.Supertype; 10 | 11 | internal override void Write(Stream stream, ClassWriterState writerState) { 12 | Binary.BigEndian.Write(stream, this.SupertypeIndex); 13 | } 14 | 15 | internal override void Read(Stream stream, ClassReaderState readerState) { 16 | this.SupertypeIndex = Binary.BigEndian.ReadUInt16(stream); 17 | } 18 | } 19 | } -------------------------------------------------------------------------------- /JavaAsm/CustomAttributes/TypeAnnotation/FormalParameterTarget.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | using JavaAsm.Helpers; 3 | using JavaAsm.IO; 4 | 5 | namespace JavaAsm.CustomAttributes.TypeAnnotation { 6 | public class FormalParameterTarget : TypeAnnotationTarget { 7 | public byte FormalParameterIndex { get; set; } 8 | 9 | public override TargetTypeKind TargetTypeKind => TargetTypeKind.FormalParameter; 10 | 11 | internal override void Write(Stream stream, ClassWriterState writerState) { 12 | stream.WriteByte(this.FormalParameterIndex); 13 | } 14 | 15 | internal override void Read(Stream stream, ClassReaderState readerState) { 16 | this.FormalParameterIndex = stream.ReadByteFully(); 17 | } 18 | } 19 | } -------------------------------------------------------------------------------- /BCEdit180/Dialog/TypeEditorDialog.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows; 7 | using System.Windows.Controls; 8 | using System.Windows.Data; 9 | using System.Windows.Documents; 10 | using System.Windows.Input; 11 | using System.Windows.Media; 12 | using System.Windows.Media.Imaging; 13 | using System.Windows.Shapes; 14 | using BCEdit180.Windows.Base; 15 | 16 | namespace BCEdit180.Dialog { 17 | /// 18 | /// Interaction logic for TypeEditorDialog.xaml 19 | /// 20 | public partial class TypeEditorDialog : DialogBase { 21 | public TypeEditorDialog() { 22 | InitializeComponent(); 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /BCEdit180.Core/ViewModels/InstructionClipboardViewModel.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using BCEdit180.Core.CodeEditing.Bytecode.Instructions; 3 | using BCEdit180.Core.Collections; 4 | using REghZy.MVVM.ViewModels; 5 | 6 | namespace BCEdit180.Core.ViewModels { 7 | public class InstructionClipboardViewModel : BaseViewModel { 8 | public ExtendedObservableCollection Instructions { get; } 9 | 10 | public InstructionClipboardViewModel() { 11 | this.Instructions = new ExtendedObservableCollection(); 12 | } 13 | 14 | public void SetClipboard(IEnumerable list) { 15 | this.Instructions.Clear(); 16 | this.Instructions.AddRange(list); 17 | } 18 | } 19 | } -------------------------------------------------------------------------------- /BCEdit180/Dialog/Methods/MethodEditorDialog.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows; 7 | using System.Windows.Controls; 8 | using System.Windows.Data; 9 | using System.Windows.Documents; 10 | using System.Windows.Input; 11 | using System.Windows.Media; 12 | using System.Windows.Media.Imaging; 13 | using System.Windows.Shapes; 14 | using BCEdit180.Windows.Base; 15 | 16 | namespace BCEdit180.Dialog.Methods { 17 | /// 18 | /// Interaction logic for MethodEditorDialog.xaml 19 | /// 20 | public partial class MethodEditorDialog : DialogBase { 21 | public MethodEditorDialog() { 22 | InitializeComponent(); 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /BCEdit180/Dialog/Class/ClassAccessEditorDialog.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows; 7 | using System.Windows.Controls; 8 | using System.Windows.Data; 9 | using System.Windows.Documents; 10 | using System.Windows.Input; 11 | using System.Windows.Media; 12 | using System.Windows.Media.Imaging; 13 | using System.Windows.Shapes; 14 | using BCEdit180.Windows.Base; 15 | 16 | namespace BCEdit180.Dialog.Class { 17 | /// 18 | /// Interaction logic for ClassAccessEditorDialog.xaml 19 | /// 20 | public partial class ClassAccessEditorDialog : DialogBase { 21 | public ClassAccessEditorDialog() { 22 | InitializeComponent(); 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /BCEdit180/Dialog/Fields/FieldAccessEditorDialog.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows; 7 | using System.Windows.Controls; 8 | using System.Windows.Data; 9 | using System.Windows.Documents; 10 | using System.Windows.Input; 11 | using System.Windows.Media; 12 | using System.Windows.Media.Imaging; 13 | using System.Windows.Shapes; 14 | using BCEdit180.Windows.Base; 15 | 16 | namespace BCEdit180.Dialog.Fields { 17 | /// 18 | /// Interaction logic for FieldAccessEditorDialog.xaml 19 | /// 20 | public partial class FieldAccessEditorDialog : DialogBase { 21 | public FieldAccessEditorDialog() { 22 | InitializeComponent(); 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /BCEdit180/Dialog/Methods/MethodDescEditorDialog.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows; 7 | using System.Windows.Controls; 8 | using System.Windows.Data; 9 | using System.Windows.Documents; 10 | using System.Windows.Input; 11 | using System.Windows.Media; 12 | using System.Windows.Media.Imaging; 13 | using System.Windows.Shapes; 14 | using BCEdit180.Windows.Base; 15 | 16 | namespace BCEdit180.Dialog.Methods { 17 | /// 18 | /// Interaction logic for MethodDescEditorDialog.xaml 19 | /// 20 | public partial class MethodDescEditorDialog : DialogBase { 21 | public MethodDescEditorDialog() { 22 | InitializeComponent(); 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /BCEdit180/CodeEditing/Ignore_UC_for_designer_2.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows; 7 | using System.Windows.Controls; 8 | using System.Windows.Data; 9 | using System.Windows.Documents; 10 | using System.Windows.Input; 11 | using System.Windows.Media; 12 | using System.Windows.Media.Imaging; 13 | using System.Windows.Navigation; 14 | using System.Windows.Shapes; 15 | 16 | namespace BCEdit180.CodeEditing { 17 | /// 18 | /// Interaction logic for Ignore_UC_for_designer_2.xaml 19 | /// 20 | public partial class Ignore_UC_for_designer_2 : UserControl { 21 | public Ignore_UC_for_designer_2() { 22 | InitializeComponent(); 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /BCEdit180/Dialog/Methods/MethodAccessEditorDialog.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows; 7 | using System.Windows.Controls; 8 | using System.Windows.Data; 9 | using System.Windows.Documents; 10 | using System.Windows.Input; 11 | using System.Windows.Media; 12 | using System.Windows.Media.Imaging; 13 | using System.Windows.Shapes; 14 | using BCEdit180.Windows.Base; 15 | 16 | namespace BCEdit180.Dialog.Methods { 17 | /// 18 | /// Interaction logic for MethodAccessEditorDialog.xaml 19 | /// 20 | public partial class MethodAccessEditorDialog : DialogBase { 21 | public MethodAccessEditorDialog() { 22 | InitializeComponent(); 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /BCEdit180.Core/CodeEditing/OpcodeDescriptorViewModel.cs: -------------------------------------------------------------------------------- 1 | using REghZy.MVVM.ViewModels; 2 | 3 | namespace BCEdit180.Core.CodeEditing { 4 | public class OpcodeDescriptorViewModel : BaseViewModel { 5 | private string header; 6 | public string Header { 7 | get => this.header; 8 | set => RaisePropertyChanged(ref this.header, value); 9 | } 10 | 11 | private string stackTransition; 12 | public string StackTransition { 13 | get => this.stackTransition; 14 | set => RaisePropertyChanged(ref this.stackTransition, value); 15 | } 16 | 17 | private string description; 18 | public string Description { 19 | get => this.description; 20 | set => RaisePropertyChanged(ref this.description, value); 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /BCEdit180.Core/ViewModels/ReferenceObjectViewModel.cs: -------------------------------------------------------------------------------- 1 | using REghZy.MVVM.ViewModels; 2 | 3 | namespace BCEdit180.Core.ViewModels { 4 | /// 5 | /// Mainly used as a wrapper for strings, so that a list of text boxes 6 | /// can be used (as string is immutable, but this class is mutable) 7 | /// 8 | /// Type of object this stores 9 | public class ReferenceObjectViewModel : BaseViewModel { 10 | private T value; 11 | public T Value { 12 | get => this.value; 13 | set => RaisePropertyChanged(ref this.value, value); 14 | } 15 | 16 | public ReferenceObjectViewModel() { 17 | 18 | } 19 | 20 | public ReferenceObjectViewModel(T initialValue) { 21 | this.Value = initialValue; 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /BCEdit180.Core/Serialisation/InstructionSerialisers.cs: -------------------------------------------------------------------------------- 1 | namespace BCEdit180.Core.Serialisation { 2 | public class FieldInstruction___ {} 3 | public class IncrementInstruction___ {} 4 | public class IntegerPushInstruction___ {} 5 | public class InvokeDynamicInstruction___ {} 6 | public class JumpInstruction___ {} 7 | public class Label___ {} 8 | public class LdcInstruction___ {} 9 | public class LineNumber___ {} 10 | public class LookupSwitchInstruction___ {} 11 | public class MethodInstruction___ {} 12 | public class MultiANewArrayInstruction___ {} 13 | public class NewArrayInstruction___ {} 14 | public class SimpleInstruction___ {} 15 | public class StackMapFrame___ {} 16 | public class TableSwitchInstruction___ {} 17 | public class TypeInstruction___ {} 18 | public class VariableInstruction___ {} 19 | } -------------------------------------------------------------------------------- /JavaAsm/Instructions/Types/IncrementInstruction.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace JavaAsm.Instructions.Types { 4 | public class IncrementInstruction : Instruction { 5 | public override Opcode Opcode { 6 | get => Opcode.IINC; 7 | set => throw new InvalidOperationException(GetType().Name + " only has 1 opcode"); 8 | } 9 | 10 | public override Instruction Copy() { 11 | return new IncrementInstruction() { 12 | VariableIndex = this.VariableIndex, 13 | Value = this.Value 14 | }; 15 | } 16 | 17 | public ushort VariableIndex { get; set; } 18 | 19 | public short Value { get; set; } 20 | 21 | public override string ToString() { 22 | return $"{this.Opcode} {this.VariableIndex} {this.Value}"; 23 | } 24 | } 25 | } -------------------------------------------------------------------------------- /JavaAsm/TryCatchNode.cs: -------------------------------------------------------------------------------- 1 | using JavaAsm.Instructions.Types; 2 | 3 | namespace JavaAsm { 4 | /// 5 | /// try-catch node 6 | /// 7 | public class TryCatchNode { 8 | /// 9 | /// Start label of try-catch block 10 | /// 11 | public Label Start { get; set; } 12 | 13 | /// 14 | /// End label of try-catch block 15 | /// 16 | public Label End { get; set; } 17 | 18 | /// 19 | /// Exception handler label of try-catch block 20 | /// 21 | public Label Handler { get; set; } 22 | 23 | /// 24 | /// Exception's class name (or null if that try-catch catches all exceptions) 25 | /// 26 | public ClassName ExceptionClassName { get; set; } 27 | } 28 | } -------------------------------------------------------------------------------- /BCEdit180/Converters/ItemNullToEnabledConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Globalization; 3 | using System.Windows; 4 | using System.Windows.Data; 5 | 6 | namespace BCEdit180.Converters { 7 | public class ItemNullToEnabledConverter : IValueConverter { 8 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { 9 | bool invert = (parameter is string str && str == "Invert") ? false : true; 10 | 11 | if (value != null && value != DependencyProperty.UnsetValue) { 12 | return invert; 13 | } 14 | else { 15 | return !invert; 16 | } 17 | } 18 | 19 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { 20 | throw new NotImplementedException(); 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /JavaAsm/Instructions/Types/MultiANewArrayInstruction.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace JavaAsm.Instructions.Types { 4 | public class MultiANewArrayInstruction : Instruction { 5 | public override Opcode Opcode { 6 | get => Opcode.MULTIANEWARRAY; 7 | set => throw new InvalidOperationException(GetType().Name + " only has 1 instruction"); 8 | } 9 | 10 | public override Instruction Copy() { 11 | return new MultiANewArrayInstruction() { 12 | Type = this.Type.Copy(), 13 | Dimensions = this.Dimensions 14 | }; 15 | } 16 | 17 | public ClassName Type { get; set; } 18 | 19 | public byte Dimensions { get; set; } 20 | 21 | public override string ToString() { 22 | return $"{this.Opcode} {this.Type} {this.Dimensions}"; 23 | } 24 | } 25 | } -------------------------------------------------------------------------------- /JavaAsm/Instructions/Types/IntegerPushInstruction.cs: -------------------------------------------------------------------------------- 1 | using JavaAsm.Helpers; 2 | 3 | namespace JavaAsm.Instructions.Types { 4 | public class IntegerPushInstruction : Instruction { 5 | private Opcode opcode; 6 | 7 | public override Opcode Opcode { 8 | get => this.opcode; 9 | set => this.opcode = value.VerifyOpcode(nameof(value), Opcode.BIPUSH, Opcode.SIPUSH); 10 | } 11 | 12 | public override Instruction Copy() { 13 | return new IntegerPushInstruction(this.opcode) { 14 | Value = this.Value 15 | }; 16 | } 17 | 18 | public ushort Value { get; set; } 19 | 20 | public IntegerPushInstruction(Opcode opcode) { 21 | this.Opcode = opcode; 22 | } 23 | 24 | public override string ToString() { 25 | return $"{this.Opcode} {this.Value}"; 26 | } 27 | } 28 | } -------------------------------------------------------------------------------- /BCEdit180/Converters/OpCodeToDescriptionConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Globalization; 3 | using System.Windows; 4 | using System.Windows.Data; 5 | using BCEdit180.Core.CodeEditing; 6 | using JavaAsm.Instructions; 7 | 8 | namespace BCEdit180.Converters { 9 | public class OpCodeToDescriptionConverter : IValueConverter { 10 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { 11 | if (value == null || value == DependencyProperty.UnsetValue || !(value is Opcode)) { 12 | return DependencyProperty.UnsetValue; 13 | } 14 | 15 | return InstructionDescriptionRegistry.GetDescription((Opcode) value); 16 | } 17 | 18 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { 19 | throw new NotImplementedException(); 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /JavaAsm/Instructions/Types/TypeInstruction.cs: -------------------------------------------------------------------------------- 1 | using JavaAsm.Helpers; 2 | 3 | namespace JavaAsm.Instructions.Types { 4 | public class TypeInstruction : Instruction { 5 | private Opcode opcode; 6 | 7 | public override Opcode Opcode { 8 | get => this.opcode; 9 | set => this.opcode = value.VerifyOpcode(nameof(value), Opcode.NEW, Opcode.ANEWARRAY, Opcode.CHECKCAST, Opcode.INSTANCEOF); 10 | } 11 | 12 | public override Instruction Copy() { 13 | return new TypeInstruction(this.opcode) { 14 | Type = this.Type?.Copy() 15 | }; 16 | } 17 | 18 | public ClassName Type { get; set; } 19 | 20 | public TypeInstruction(Opcode opcode) { 21 | this.Opcode = opcode; 22 | } 23 | 24 | public override string ToString() { 25 | return $"{this.Opcode} {this.Type}"; 26 | } 27 | } 28 | } -------------------------------------------------------------------------------- /JavaAsm/CustomAttributes/TypeAnnotation/TypeParameterBoundTarget.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | using JavaAsm.Helpers; 3 | using JavaAsm.IO; 4 | 5 | namespace JavaAsm.CustomAttributes.TypeAnnotation { 6 | public class TypeParameterBoundTarget : TypeAnnotationTarget { 7 | public byte TypeParameterIndex { get; set; } 8 | 9 | public byte BoundIndex { get; set; } 10 | 11 | public override TargetTypeKind TargetTypeKind => TargetTypeKind.TypeParameterBound; 12 | 13 | internal override void Write(Stream stream, ClassWriterState writerState) { 14 | stream.WriteByte(this.TypeParameterIndex); 15 | stream.WriteByte(this.BoundIndex); 16 | } 17 | 18 | internal override void Read(Stream stream, ClassReaderState readerState) { 19 | this.TypeParameterIndex = stream.ReadByteFully(); 20 | this.BoundIndex = stream.ReadByteFully(); 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /BCEdit180/Converters/TypeEqualityToTrueConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Globalization; 3 | using System.Windows; 4 | using System.Windows.Data; 5 | 6 | namespace BCEdit180.Converters { 7 | public class TypeEqualityToTrueConverter : IValueConverter { 8 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { 9 | if (value == null || value == DependencyProperty.UnsetValue) { 10 | return DependencyProperty.UnsetValue; 11 | } 12 | 13 | if (parameter is Type target) { 14 | return target.IsAssignableFrom(value is Type type ? type : value.GetType()); 15 | } 16 | 17 | return DependencyProperty.UnsetValue; 18 | } 19 | 20 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { 21 | throw new NotImplementedException(); 22 | } 23 | } 24 | } -------------------------------------------------------------------------------- /JavaAsm/CustomAttributes/SourceDebugExtensionAttribute.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | using JavaAsm.Helpers; 3 | using JavaAsm.IO; 4 | 5 | namespace JavaAsm.CustomAttributes { 6 | public class SourceDebugExtensionAttribute : CustomAttribute { 7 | public string Value { get; set; } 8 | 9 | internal override byte[] Save(ClassWriterState writerState, AttributeScope scope) { 10 | return ModifiedUtf8Helper.Encode(this.Value); 11 | } 12 | } 13 | 14 | internal class SourceDebugExtensionFactory : ICustomAttributeFactory { 15 | public SourceDebugExtensionAttribute Parse(Stream attributeDataStream, uint attributeDataLength, ClassReaderState readerState, AttributeScope scope) { 16 | return new SourceDebugExtensionAttribute { 17 | Value = ModifiedUtf8Helper.Decode(attributeDataStream.ReadBytes(attributeDataLength)) 18 | }; 19 | } 20 | } 21 | } -------------------------------------------------------------------------------- /JavaAsm/CustomAttributes/TypeAnnotation/TypeArgumentTarget.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | using BinaryEncoding; 3 | using JavaAsm.Helpers; 4 | using JavaAsm.IO; 5 | 6 | namespace JavaAsm.CustomAttributes.TypeAnnotation { 7 | public class TypeArgumentTarget : TypeAnnotationTarget { 8 | public ushort Offset { get; set; } 9 | 10 | public byte TypeArgumentIndex { get; set; } 11 | 12 | public override TargetTypeKind TargetTypeKind => TargetTypeKind.TypeArgument; 13 | 14 | internal override void Write(Stream stream, ClassWriterState writerState) { 15 | Binary.BigEndian.Write(stream, this.Offset); 16 | stream.WriteByte(this.TypeArgumentIndex); 17 | } 18 | 19 | internal override void Read(Stream stream, ClassReaderState readerState) { 20 | this.Offset = Binary.BigEndian.ReadUInt16(stream); 21 | this.TypeArgumentIndex = stream.ReadByteFully(); 22 | } 23 | } 24 | } -------------------------------------------------------------------------------- /JavaAsm/Instructions/Types/LookupSwitchInstruction.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | 5 | namespace JavaAsm.Instructions.Types { 6 | public class LookupSwitchInstruction : Instruction { 7 | public override Opcode Opcode { 8 | get => Opcode.LOOKUPSWITCH; 9 | set => throw new InvalidOperationException(GetType().Name + " only has 1 instruction"); 10 | } 11 | 12 | public override Instruction Copy() { 13 | return new LookupSwitchInstruction() { 14 | Default = this.Default, 15 | MatchLabels = new List>(this.MatchLabels.Select(a => new KeyValuePair(a.Key, a.Value))) 16 | }; 17 | } 18 | 19 | public Label Default { get; set; } 20 | 21 | public List> MatchLabels { get; set; } = new List>(); 22 | } 23 | } -------------------------------------------------------------------------------- /JavaAsm/Instructions/Types/NewArrayInstruction.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace JavaAsm.Instructions.Types { 4 | public class NewArrayInstruction : Instruction { 5 | public override Opcode Opcode { 6 | get => Opcode.NEWARRAY; 7 | set => throw new InvalidOperationException(GetType().Name + " only has 1 instruction"); 8 | } 9 | 10 | public override Instruction Copy() { 11 | return new NewArrayInstruction() { 12 | ArrayType = this.ArrayType 13 | }; 14 | } 15 | 16 | public NewArrayTypeCode ArrayType { get; set; } 17 | 18 | public override string ToString() { 19 | return $"{this.Opcode} {this.ArrayType}"; 20 | } 21 | } 22 | 23 | public enum NewArrayTypeCode : byte { 24 | Boolean = 4, 25 | Character, 26 | Float, 27 | Double, 28 | Byte, 29 | Short, 30 | Integer, 31 | Long 32 | } 33 | } -------------------------------------------------------------------------------- /BCEdit180.Core/AttributeEditor/targets.txt: -------------------------------------------------------------------------------- 1 | Class: 2 | # SourceDebugExtension 3 | # SourceFile 4 | # EnclosingMethod 5 | # InnerClasses 6 | BootstrapMethods -- can this even be done? java-asm parses these only when method instructions are being parsed 7 | 8 | Fields: 9 | # ConstantValue -- no need to create a custom attribute editor for fields 10 | 11 | Methods: 12 | # Code 13 | Exceptions 14 | MethodParameters 15 | RuntimeInvisibleParameterAnnotations 16 | RuntimeVisibleParameterAnnotations 17 | AnnotationDefault 18 | 19 | Method Code: 20 | # LineNumberTable 21 | # LocalVariableTable 22 | LocalVariableTypeTable 23 | StackMapTable 24 | 25 | Class, Fields and Methods: 26 | # RuntimeInvisibleAnnotations -- custom annotation editor 27 | # RuntimeVisibleAnnotations -- custom annotation editor 28 | RuntimeInvisibleTypeAnnotations 29 | RuntimeVisibleTypeAnnotations 30 | Deprecated 31 | Signature 32 | Synthetic 33 | -------------------------------------------------------------------------------- /JavaAsm/Instructions/Types/TableSwitchInstruction.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace JavaAsm.Instructions.Types { 5 | public class TableSwitchInstruction : Instruction { 6 | public override Opcode Opcode { 7 | get => Opcode.TABLESWITCH; 8 | set => throw new InvalidOperationException(GetType().Name + " only has 1 opcode"); 9 | } 10 | 11 | public override Instruction Copy() { 12 | return new TableSwitchInstruction() { 13 | Default = this.Default, 14 | LowValue = this.LowValue, 15 | HighValue = this.HighValue, 16 | Labels = new List