This commit is contained in:
Robert Vokac 2024-12-17 16:19:45 +01:00
parent 97a9ae2462
commit 5c1033bdb3
Signed by: robertvokac
GPG Key ID: FB9CE8E20AADA55F
13 changed files with 177 additions and 12 deletions

View File

@ -0,0 +1,20 @@
/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
*/
package com.openeggbert.jdotnet.JDotNet;
import com.openeggbert.jdotnet.System.*;
import lombok.AllArgsConstructor;
/**
*
* @author robertvokac
*/
@AllArgsConstructor
public class JDotNetException extends RuntimeException {
public JDotNetException(String msg) {
super(msg);
}
}

View File

@ -10,8 +10,9 @@ package com.openeggbert.jdotnet.System;
*/
public interface EventHandler<T> {
void addValueChangedListener(ValueChangedListener<T> listener);
void removeValueChangedListener(ValueChangedListener<T> listener);
void addEventListener(EventListener<T> listener);
void removeEventListener(EventListener<T> listener);
void invoke(T eventArgs);
}

View File

@ -15,16 +15,23 @@ import java.util.List;
@AdditionalClassForDotNetSimulation
public class EventHandlerImpl<T> implements EventHandler<T> {
private final List<ValueChangedListener<T>> list = new ArrayList<>();
private final List<EventListener<T>> list = new ArrayList<>();
@Override
public void addValueChangedListener(ValueChangedListener<T> listener) {
public void addEventListener(EventListener<T> listener) {
list.add(listener);
}
@Override
public void removeValueChangedListener(ValueChangedListener<T> listener) {
public void removeEventListener(EventListener<T> listener) {
list.remove(listener);
}
@Override
public void invoke(T eventArgs) {
for(EventListener<T> e : list) {
e.onEventHappened(eventArgs);
}
}
}

View File

@ -11,8 +11,8 @@ import com.openeggbert.jdotnet.JDotNet.AdditionalClassForDotNetSimulation;
* @author robertvokac
*/
@AdditionalClassForDotNetSimulation
public interface ValueChangedListener<T>{
public interface EventListener<T>{
void onValueChanged(T eventArgs);
void onEventHappened(T eventArgs);
}

View File

@ -4,6 +4,7 @@
*/
package com.openeggbert.jdotnet.System;
import com.openeggbert.jdotnet.JDotNet.JDotNetException;
import lombok.AllArgsConstructor;
/**
@ -11,7 +12,7 @@ import lombok.AllArgsConstructor;
* @author robertvokac
*/
@AllArgsConstructor
public class Exception_ extends RuntimeException {
public class Exception_ extends JDotNetException {
public Exception_(String msg) {
super(msg);
}

View File

@ -4,18 +4,22 @@
*/
package com.openeggbert.jdotnet.System.Globalization;
import com.openeggbert.jdotnet.System.IFormatProvider;
import lombok.Getter;
/**
*
* @author robertvokac
*/
public class CultureInfo {
public class CultureInfo implements IFormatProvider {
public static CultureInfo getCurrentCulture() {
//todo
return null;
}
@Getter
private String TwoLetterISOLanguageName;
public static final CultureInfo InvariantCulture = new CultureInfo();//todo
// public String ToString(StringBuilder sb, int number) {
//
// }
}

View File

@ -2,12 +2,12 @@
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
*/
package com.openeggbert.jdotnet.System.Text;
package com.openeggbert.jdotnet.System;
/**
*
* @author robertvokac
*/
public class NewClass {
public interface IFormatProvider {
}

View File

@ -0,0 +1,26 @@
/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
*/
package com.openeggbert.jdotnet.System.IO;
import lombok.Getter;
/**
*
* @author robertvokac
*/
public enum FileMode {
CreateNew(1),
Create(2),
Open(3),
OpenOrCreate(4),
Truncate(5),
Append(6);
FileMode(int number) {
this.number = number;
}
@Getter
private final int number;
}

View File

@ -0,0 +1,15 @@
/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
*/
package com.openeggbert.jdotnet.System.IO.IsolatedStorage;
import com.openeggbert.jdotnet.System.Exception_;
/**
*
* @author robertvokac
*/
public class IsolatedStorageException extends Exception_ {
}

View File

@ -0,0 +1,27 @@
/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
*/
package com.openeggbert.jdotnet.System.IO.IsolatedStorage;
import com.openeggbert.jdotnet.System.IO.FileMode;
/**
*
* @author robertvokac
*/
public class IsolatedStorageFile {
public static IsolatedStorageFile GetUserStoreForApplication() {
return null;//todo
}
public boolean FileExists(String path) {
return true;//todo
}
public IsolatedStorageFileStream OpenFile(String path, FileMode mode) {
return null;//todo
}
public void DeleteFile(String path) {
//todo
}
}

View File

@ -0,0 +1,25 @@
/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
*/
package com.openeggbert.jdotnet.System.IO.IsolatedStorage;
/**
*
* @author robertvokac
*/
public class IsolatedStorageFileStream {
public int Read(byte[] buffer, int offset, int count)
{
return 0;//todo
}
public void Write(byte[] buffer, int offset, int count) {
//todo
}
public void Close() {
//todo
}
public int Length = 0;
}

View File

@ -0,0 +1,25 @@
/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
*/
package com.openeggbert.jdotnet.System.Text;
/**
*
* @author robertvokac
*/
public class Encoding {
public static final Encoding UTF8 = new Encoding();//todo
public String GetString(byte[] bytes, int index, int count) {
return "";
//todo
}
public byte[] GetBytes(String s) {
return null;
//todo
}
}

View File

@ -0,0 +1,14 @@
/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
*/
package com.openeggbert.jdotnet.System;
/**
*
* @author robertvokac
*/
public class TimeSpan {
public static TimeSpan FromTicks(long ticks) {return null;}
public static TimeSpan FromSeconds(double seconds) {return null;}
}