mirror of
https://github.com/twiglet/cs2j.git
synced 2025-01-18 13:15:17 +01:00
Sync from svn trunk
This commit is contained in:
parent
4e9eef902d
commit
6262fde7e2
@ -18,6 +18,11 @@
|
|||||||
<Name>Keys</Name>
|
<Name>Keys</Name>
|
||||||
<Get>${this}.keySet()</Get>
|
<Get>${this}.keySet()</Get>
|
||||||
</Property>
|
</Property>
|
||||||
|
<Property>
|
||||||
|
<Type>System.Collections.ICollection</Type>
|
||||||
|
<Name>Values</Name>
|
||||||
|
<Get>${this}.values()</Get>
|
||||||
|
</Property>
|
||||||
</Properties>
|
</Properties>
|
||||||
<Methods>
|
<Methods>
|
||||||
<Method>
|
<Method>
|
||||||
|
@ -168,6 +168,96 @@
|
|||||||
<Import>java.util.TimeZone</Import>
|
<Import>java.util.TimeZone</Import>
|
||||||
</Imports>
|
</Imports>
|
||||||
<Java>(new DateTZ(${this}.getTime(), TimeZone.getTimeZone("UTC")))</Java>
|
<Java>(new DateTZ(${this}.getTime(), TimeZone.getTimeZone("UTC")))</Java>
|
||||||
|
</Method>
|
||||||
|
<Method>
|
||||||
|
<Return>System.DateTime</Return>
|
||||||
|
<Name>AddMinutes</Name>
|
||||||
|
<Params>
|
||||||
|
<Param>
|
||||||
|
<Type>System.Int32</Type>
|
||||||
|
<Name>amount</Name>
|
||||||
|
</Param>
|
||||||
|
</Params>
|
||||||
|
<Imports>
|
||||||
|
<Import>RusticiSoftware.System.DateTimeSupport</Import>
|
||||||
|
<Import>java.util.Calendar</Import>
|
||||||
|
</Imports>
|
||||||
|
<Java>DateTimeSupport.add(${this},Calendar.MINUTE,${amount})</Java>
|
||||||
|
</Method>
|
||||||
|
<Method>
|
||||||
|
<Return>System.DateTime</Return>
|
||||||
|
<Name>AddHours</Name>
|
||||||
|
<Params>
|
||||||
|
<Param>
|
||||||
|
<Type>System.Int32</Type>
|
||||||
|
<Name>amount</Name>
|
||||||
|
</Param>
|
||||||
|
</Params>
|
||||||
|
<Imports>
|
||||||
|
<Import>RusticiSoftware.System.DateTimeSupport</Import>
|
||||||
|
<Import>java.util.Calendar</Import>
|
||||||
|
</Imports>
|
||||||
|
<Java>DateTimeSupport.add(${this},Calendar.HOUR,${amount})</Java>
|
||||||
|
</Method>
|
||||||
|
<Method>
|
||||||
|
<Return>System.DateTime</Return>
|
||||||
|
<Name>AddMilliseconds</Name>
|
||||||
|
<Params>
|
||||||
|
<Param>
|
||||||
|
<Type>System.Int32</Type>
|
||||||
|
<Name>amount</Name>
|
||||||
|
</Param>
|
||||||
|
</Params>
|
||||||
|
<Imports>
|
||||||
|
<Import>RusticiSoftware.System.DateTimeSupport</Import>
|
||||||
|
<Import>java.util.Calendar</Import>
|
||||||
|
</Imports>
|
||||||
|
<Java>DateTimeSupport.add(${this},Calendar.MILLISECOND,${amount})</Java>
|
||||||
|
</Method>
|
||||||
|
<Method>
|
||||||
|
<Return>System.DateTime</Return>
|
||||||
|
<Name>AddSeconds</Name>
|
||||||
|
<Params>
|
||||||
|
<Param>
|
||||||
|
<Type>System.Int32</Type>
|
||||||
|
<Name>amount</Name>
|
||||||
|
</Param>
|
||||||
|
</Params>
|
||||||
|
<Imports>
|
||||||
|
<Import>RusticiSoftware.System.DateTimeSupport</Import>
|
||||||
|
<Import>java.util.Calendar</Import>
|
||||||
|
</Imports>
|
||||||
|
<Java>DateTimeSupport.add(${this},Calendar.SECOND,${amount})</Java>
|
||||||
|
</Method>
|
||||||
|
<Method>
|
||||||
|
<Return>System.DateTime</Return>
|
||||||
|
<Name>AddDays</Name>
|
||||||
|
<Params>
|
||||||
|
<Param>
|
||||||
|
<Type>System.Int32</Type>
|
||||||
|
<Name>amount</Name>
|
||||||
|
</Param>
|
||||||
|
</Params>
|
||||||
|
<Imports>
|
||||||
|
<Import>RusticiSoftware.System.DateTimeSupport</Import>
|
||||||
|
<Import>java.util.Calendar</Import>
|
||||||
|
</Imports>
|
||||||
|
<Java>DateTimeSupport.add(${this},Calendar.DAY_OF_YEAR,${amount})</Java>
|
||||||
|
</Method>
|
||||||
|
<Method>
|
||||||
|
<Return>System.DateTime</Return>
|
||||||
|
<Name>AddMonths</Name>
|
||||||
|
<Params>
|
||||||
|
<Param>
|
||||||
|
<Type>System.Int32</Type>
|
||||||
|
<Name>amount</Name>
|
||||||
|
</Param>
|
||||||
|
</Params>
|
||||||
|
<Imports>
|
||||||
|
<Import>RusticiSoftware.System.DateTimeSupport</Import>
|
||||||
|
<Import>java.util.Calendar</Import>
|
||||||
|
</Imports>
|
||||||
|
<Java>DateTimeSupport.add(${this},Calendar.MONTH,${amount})</Java>
|
||||||
</Method>
|
</Method>
|
||||||
</Methods>
|
</Methods>
|
||||||
</Class>
|
</Class>
|
||||||
|
@ -12,5 +12,13 @@
|
|||||||
<Type>System.String</Type>
|
<Type>System.String</Type>
|
||||||
<Get>System.getProperty("line.separator")</Get>
|
<Get>System.getProperty("line.separator")</Get>
|
||||||
</Property>
|
</Property>
|
||||||
|
<Property>
|
||||||
|
<Imports>
|
||||||
|
<Import>java.net.InetAddress</Import>
|
||||||
|
</Imports>
|
||||||
|
<Name>MachineName</Name>
|
||||||
|
<Type>System.String</Type>
|
||||||
|
<Get>InetAddress.getLocalHost().getHostName()</Get>
|
||||||
|
</Property>
|
||||||
</Properties>
|
</Properties>
|
||||||
</Class>
|
</Class>
|
||||||
|
@ -3,6 +3,10 @@
|
|||||||
xsi:SchemaLocation="http://www.w3.org/2001/XMLSchema file://C:/Documents%20and%20Settings/kevin.glynn/My%20Documents/CS2JLibrary/Translation.xsd"
|
xsi:SchemaLocation="http://www.w3.org/2001/XMLSchema file://C:/Documents%20and%20Settings/kevin.glynn/My%20Documents/CS2JLibrary/Translation.xsd"
|
||||||
>
|
>
|
||||||
<Name>System.IDisposable</Name>
|
<Name>System.IDisposable</Name>
|
||||||
|
<Java>IDisposable</Java>
|
||||||
|
<Imports>
|
||||||
|
<Import>RusticiSoftware.System.IDisposable</Import>
|
||||||
|
</Imports>
|
||||||
<Methods>
|
<Methods>
|
||||||
<Method>
|
<Method>
|
||||||
<Return>System.Void</Return>
|
<Return>System.Void</Return>
|
||||||
|
@ -61,7 +61,10 @@
|
|||||||
<Type>System.String</Type>
|
<Type>System.String</Type>
|
||||||
</Param>
|
</Param>
|
||||||
</Params>
|
</Params>
|
||||||
<Java>StringSupport.Compare(${arg1}, ${arg2))</Java>
|
<Java>StringSupport.Compare(${arg1}, ${arg2})</Java>
|
||||||
|
<Imports>
|
||||||
|
<Import>RusticiSoftware.System.StringSupport</Import>
|
||||||
|
</Imports>
|
||||||
</Method>
|
</Method>
|
||||||
<Method>
|
<Method>
|
||||||
<Return>System.Int32</Return>
|
<Return>System.Int32</Return>
|
||||||
@ -80,7 +83,10 @@
|
|||||||
<Type>System.Bool</Type>
|
<Type>System.Bool</Type>
|
||||||
</Param>
|
</Param>
|
||||||
</Params>
|
</Params>
|
||||||
<Java>StringSupport.Compare(${arg1}, ${arg2), ${isCaseSensitive})</Java>
|
<Java>StringSupport.Compare(${arg1}, ${arg2}, ${isCaseSensitive})</Java>
|
||||||
|
<Imports>
|
||||||
|
<Import>RusticiSoftware.System.StringSupport</Import>
|
||||||
|
</Imports>
|
||||||
</Method>
|
</Method>
|
||||||
<Method>
|
<Method>
|
||||||
<Return>System.String</Return>
|
<Return>System.String</Return>
|
||||||
|
@ -8,6 +8,11 @@
|
|||||||
<Constructors>
|
<Constructors>
|
||||||
</Constructors>
|
</Constructors>
|
||||||
<Properties>
|
<Properties>
|
||||||
|
<Property>
|
||||||
|
<Type>System.Boolean</Type>
|
||||||
|
<Name>IsAlive</Name>
|
||||||
|
<Get>${this}.isAlive()</Get>
|
||||||
|
</Property>
|
||||||
</Properties>
|
</Properties>
|
||||||
<Methods>
|
<Methods>
|
||||||
<Method>
|
<Method>
|
||||||
@ -21,5 +26,10 @@
|
|||||||
</Params>
|
</Params>
|
||||||
<Java>Thread.sleep(${sleepTime})</Java>
|
<Java>Thread.sleep(${sleepTime})</Java>
|
||||||
</Method>
|
</Method>
|
||||||
|
<Method>
|
||||||
|
<Return></Return>
|
||||||
|
<Name>Start</Name>
|
||||||
|
<Java>${this}.start()</Java>
|
||||||
|
</Method>
|
||||||
</Methods>
|
</Methods>
|
||||||
</Class>
|
</Class>
|
||||||
|
@ -22,6 +22,7 @@ package RusticiSoftware.System;
|
|||||||
|
|
||||||
import java.text.ParseException;
|
import java.text.ParseException;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.Calendar;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
|
||||||
@ -126,4 +127,12 @@ public class DateTimeSupport {
|
|||||||
throw new ParseException("Could not parse " + s + " as a date", 0);
|
throw new ParseException("Could not parse " + s + " as a date", 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static Date add(Date base,int field, int amount)
|
||||||
|
{
|
||||||
|
Calendar cal = Calendar.getInstance();
|
||||||
|
cal.setTime(base);
|
||||||
|
cal.add(field, amount);
|
||||||
|
return cal.getTime();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
5
CS2JLibrary/src/RusticiSoftware/System/IDisposable.java
Normal file
5
CS2JLibrary/src/RusticiSoftware/System/IDisposable.java
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
package RusticiSoftware.System;
|
||||||
|
|
||||||
|
public interface IDisposable {
|
||||||
|
void Dispose() throws Exception;
|
||||||
|
}
|
@ -36,18 +36,21 @@ import java.io.StringReader;
|
|||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
|
import org.w3c.dom.DOMImplementation;
|
||||||
import org.w3c.dom.Document;
|
import org.w3c.dom.Document;
|
||||||
import org.xml.sax.InputSource;
|
|
||||||
|
|
||||||
import com.sun.org.apache.xerces.internal.dom.DocumentImpl;
|
|
||||||
|
|
||||||
public class XmlDocument extends XmlNode {
|
public class XmlDocument extends XmlNode {
|
||||||
|
|
||||||
private static Logger logger = Logger.getLogger("com.rusticisoftware.scormcontentplayer");
|
private static Logger logger = Logger.getLogger("com.rusticisoftware.scormcontentplayer");
|
||||||
|
|
||||||
public XmlDocument()
|
public XmlDocument() throws ParserConfigurationException
|
||||||
{
|
{
|
||||||
setNode(new DocumentImpl());
|
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
|
||||||
|
DocumentBuilder builder = factory.newDocumentBuilder();
|
||||||
|
DOMImplementation impl = builder.getDOMImplementation();
|
||||||
|
|
||||||
|
Document doc = impl.createDocument(null,null,null);
|
||||||
|
setNode(doc);
|
||||||
}
|
}
|
||||||
public XmlDocument(Document d)
|
public XmlDocument(Document d)
|
||||||
{
|
{
|
||||||
|
@ -28,8 +28,6 @@ import org.w3c.dom.*;
|
|||||||
import org.xml.sax.InputSource;
|
import org.xml.sax.InputSource;
|
||||||
import org.xml.sax.SAXException;
|
import org.xml.sax.SAXException;
|
||||||
|
|
||||||
import com.sun.org.apache.xalan.internal.xsltc.runtime.AttributeList;
|
|
||||||
|
|
||||||
import javax.xml.parsers.DocumentBuilder;
|
import javax.xml.parsers.DocumentBuilder;
|
||||||
import javax.xml.parsers.DocumentBuilderFactory;
|
import javax.xml.parsers.DocumentBuilderFactory;
|
||||||
import javax.xml.parsers.ParserConfigurationException;
|
import javax.xml.parsers.ParserConfigurationException;
|
||||||
|
@ -31,17 +31,23 @@ import RusticiSoftware.System.Xml.XmlDocument;
|
|||||||
import RusticiSoftware.System.NotImplementedException;
|
import RusticiSoftware.System.NotImplementedException;
|
||||||
|
|
||||||
public class XmlTextReader {
|
public class XmlTextReader {
|
||||||
protected XmlDocument xmlDocument = new XmlDocument();
|
protected XmlDocument xmlDocument = null;
|
||||||
|
|
||||||
|
protected XmlDocument getXmlDocument() throws ParserConfigurationException {
|
||||||
|
if (xmlDocument == null) {
|
||||||
|
xmlDocument = new XmlDocument();
|
||||||
|
}
|
||||||
|
return xmlDocument;
|
||||||
|
}
|
||||||
public XmlTextReader() throws NotImplementedException {
|
public XmlTextReader() throws NotImplementedException {
|
||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
public XmlTextReader(StringReader stringReader) throws NotImplementedException, ParserConfigurationException, SAXException, IOException {
|
public XmlTextReader(StringReader stringReader) throws NotImplementedException, ParserConfigurationException, SAXException, IOException {
|
||||||
xmlDocument.load(stringReader);
|
getXmlDocument().load(stringReader);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String ToString() {
|
public String ToString() throws ParserConfigurationException {
|
||||||
return xmlDocument.getOuterXml();
|
return getXmlDocument().getOuterXml();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -24,6 +24,8 @@ package RusticiSoftware.System.Xml.Xsl;
|
|||||||
|
|
||||||
import java.io.StringWriter;
|
import java.io.StringWriter;
|
||||||
import java.io.StringReader;
|
import java.io.StringReader;
|
||||||
|
|
||||||
|
import javax.xml.parsers.ParserConfigurationException;
|
||||||
import javax.xml.transform.stream.StreamSource;
|
import javax.xml.transform.stream.StreamSource;
|
||||||
import javax.xml.transform.stream.StreamResult;
|
import javax.xml.transform.stream.StreamResult;
|
||||||
import javax.xml.transform.Transformer;
|
import javax.xml.transform.Transformer;
|
||||||
@ -40,7 +42,7 @@ public class XslTransform {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void load(XmlTextReader xmlTextReader, String ignore, String ignore2) throws TransformerConfigurationException {
|
public void load(XmlTextReader xmlTextReader, String ignore, String ignore2) throws TransformerConfigurationException, ParserConfigurationException {
|
||||||
String xmlString = xmlTextReader.ToString();
|
String xmlString = xmlTextReader.ToString();
|
||||||
StringReader stringReader = new StringReader(xmlString);
|
StringReader stringReader = new StringReader(xmlString);
|
||||||
StreamSource streamSource = new StreamSource(stringReader);
|
StreamSource streamSource = new StreamSource(stringReader);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user