Load mod.html into the right pane when clicked. Refactoring.
This commit is contained in:
@@ -20,4 +20,6 @@
|
||||
}
|
||||
- (IBAction)launchGame:(id)sender;
|
||||
- (SidebarEntry *)sidebarModsTree;
|
||||
- (SidebarEntry *)sidebarOtherTree;
|
||||
|
||||
@end
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
- (void) awakeFromNib
|
||||
{
|
||||
game = [[GameInstall alloc] initWithPath:@"/Users/paul/src/OpenRA"];
|
||||
game = [[GameInstall alloc] initWithURL:[NSURL URLWithString:@"/Users/paul/src/OpenRA"]];
|
||||
sidebarItems = [[SidebarEntry headerWithTitle:@""] retain];
|
||||
[sidebarItems addChild:[self sidebarModsTree]];
|
||||
[sidebarItems addChild:[self sidebarOtherTree]];
|
||||
@@ -25,7 +25,7 @@
|
||||
[col setDataCell:imageAndTextCell];
|
||||
|
||||
[outlineView reloadData];
|
||||
[outlineView expandItem:[outlineView itemAtRow:1] expandChildren:YES];
|
||||
[outlineView expandItem:[outlineView itemAtRow:0] expandChildren:YES];
|
||||
[outlineView selectRowIndexes:[NSIndexSet indexSetWithIndex:1] byExtendingSelection:NO];
|
||||
}
|
||||
|
||||
@@ -111,10 +111,10 @@ objectValueForTableColumn:(NSTableColumn *)tableColumn
|
||||
- (BOOL)outlineView:(NSOutlineView *)outlineView shouldSelectItem:(id)item;
|
||||
{
|
||||
// don't allow headers to be selected
|
||||
if ([item isHeader])
|
||||
if ([item isHeader] || [item url] == nil)
|
||||
return NO;
|
||||
|
||||
// TODO: Display the webpage
|
||||
[[webView mainFrame] loadRequest:[NSURLRequest requestWithURL:[item url]]];
|
||||
|
||||
return YES;
|
||||
}
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
</object>
|
||||
<object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<integer value="57"/>
|
||||
<integer value="557"/>
|
||||
<integer value="57"/>
|
||||
</object>
|
||||
<object class="NSArray" key="IBDocument.PluginDependencies">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
@@ -347,7 +347,7 @@
|
||||
<int key="NSCellFlags">337772096</int>
|
||||
<int key="NSCellFlags2">2048</int>
|
||||
<string key="NSContents">Text Cell</string>
|
||||
<object class="NSFont" key="NSSupport" id="868513215">
|
||||
<object class="NSFont" key="NSSupport">
|
||||
<string key="NSName">LucidaGrande</string>
|
||||
<double key="NSSize">13</double>
|
||||
<int key="NSfFlags">1044</int>
|
||||
@@ -455,26 +455,6 @@
|
||||
<int key="NSvFlags">256</int>
|
||||
<object class="NSMutableArray" key="NSSubviews">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<object class="NSButton" id="430464371">
|
||||
<reference key="NSNextResponder" ref="257490795"/>
|
||||
<int key="NSvFlags">289</int>
|
||||
<string key="NSFrame">{{270, 53}, {111, 27}}</string>
|
||||
<reference key="NSSuperview" ref="257490795"/>
|
||||
<bool key="NSEnabled">YES</bool>
|
||||
<object class="NSButtonCell" key="NSCell" id="492098390">
|
||||
<int key="NSCellFlags">-2080244224</int>
|
||||
<int key="NSCellFlags2">134217728</int>
|
||||
<string key="NSContents">GO!</string>
|
||||
<reference key="NSSupport" ref="868513215"/>
|
||||
<reference key="NSControlView" ref="430464371"/>
|
||||
<int key="NSButtonFlags">-2033434369</int>
|
||||
<int key="NSButtonFlags2">160</int>
|
||||
<string key="NSAlternateContents"/>
|
||||
<string key="NSKeyEquivalent"/>
|
||||
<int key="NSPeriodicDelay">400</int>
|
||||
<int key="NSPeriodicInterval">75</int>
|
||||
</object>
|
||||
</object>
|
||||
<object class="WebView" id="90421773">
|
||||
<reference key="NSNextResponder" ref="257490795"/>
|
||||
<int key="NSvFlags">274</int>
|
||||
@@ -669,12 +649,12 @@
|
||||
<int key="connectionID">585</int>
|
||||
</object>
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBActionConnection" key="connection">
|
||||
<string key="label">launchGame:</string>
|
||||
<object class="IBOutletConnection" key="connection">
|
||||
<string key="label">webView</string>
|
||||
<reference key="source" ref="79272443"/>
|
||||
<reference key="destination" ref="430464371"/>
|
||||
<reference key="destination" ref="90421773"/>
|
||||
</object>
|
||||
<int key="connectionID">588</int>
|
||||
<int key="connectionID">590</int>
|
||||
</object>
|
||||
</object>
|
||||
<object class="IBMutableOrderedSet" key="objectRecords">
|
||||
@@ -911,7 +891,6 @@
|
||||
<reference key="object" ref="257490795"/>
|
||||
<object class="NSMutableArray" key="children">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<reference ref="430464371"/>
|
||||
<reference ref="90421773"/>
|
||||
</object>
|
||||
<reference key="parent" ref="991115689"/>
|
||||
@@ -974,20 +953,6 @@
|
||||
<reference key="object" ref="79272443"/>
|
||||
<reference key="parent" ref="0"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">586</int>
|
||||
<reference key="object" ref="430464371"/>
|
||||
<object class="NSMutableArray" key="children">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<reference ref="492098390"/>
|
||||
</object>
|
||||
<reference key="parent" ref="257490795"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">587</int>
|
||||
<reference key="object" ref="492098390"/>
|
||||
<reference key="parent" ref="430464371"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">589</int>
|
||||
<reference key="object" ref="90421773"/>
|
||||
@@ -1071,9 +1036,6 @@
|
||||
<string>579.IBPluginDependency</string>
|
||||
<string>58.IBPluginDependency</string>
|
||||
<string>58.ImportedFromIB2</string>
|
||||
<string>586.IBPluginDependency</string>
|
||||
<string>586.IBViewBoundsToFrameTransform</string>
|
||||
<string>587.IBPluginDependency</string>
|
||||
<string>589.IBPluginDependency</string>
|
||||
<string>589.IBViewBoundsToFrameTransform</string>
|
||||
<string>92.IBPluginDependency</string>
|
||||
@@ -1155,11 +1117,6 @@
|
||||
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<integer value="1"/>
|
||||
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<object class="NSAffineTransform">
|
||||
<bytes key="NSTransformStruct">P4AAAL+AAABDegAAwvoAAA</bytes>
|
||||
</object>
|
||||
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<string>com.apple.WebKitIBPlugin</string>
|
||||
<object class="NSAffineTransform">
|
||||
<bytes key="NSTransformStruct">AcJAAABDFwAAA</bytes>
|
||||
@@ -1184,7 +1141,7 @@
|
||||
</object>
|
||||
</object>
|
||||
<nil key="sourceID"/>
|
||||
<int key="maxID">589</int>
|
||||
<int key="maxID">590</int>
|
||||
</object>
|
||||
<object class="IBClassDescriber" key="IBDocument.Classes">
|
||||
<object class="NSMutableArray" key="referencedPartialClassDescriptions">
|
||||
@@ -1313,22 +1270,6 @@
|
||||
<string key="minorKey">AppKit.framework/Headers/NSUserInterfaceItemSearching.h</string>
|
||||
</object>
|
||||
</object>
|
||||
<object class="IBPartialClassDescription">
|
||||
<string key="className">NSButton</string>
|
||||
<string key="superclassName">NSControl</string>
|
||||
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||
<string key="majorKey">IBFrameworkSource</string>
|
||||
<string key="minorKey">AppKit.framework/Headers/NSButton.h</string>
|
||||
</object>
|
||||
</object>
|
||||
<object class="IBPartialClassDescription">
|
||||
<string key="className">NSButtonCell</string>
|
||||
<string key="superclassName">NSActionCell</string>
|
||||
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||
<string key="majorKey">IBFrameworkSource</string>
|
||||
<string key="minorKey">AppKit.framework/Headers/NSButtonCell.h</string>
|
||||
</object>
|
||||
</object>
|
||||
<object class="IBPartialClassDescription">
|
||||
<string key="className">NSCell</string>
|
||||
<string key="superclassName">NSObject</string>
|
||||
@@ -1613,6 +1554,76 @@
|
||||
<string key="minorKey">Foundation.framework/Headers/NSURLDownload.h</string>
|
||||
</object>
|
||||
</object>
|
||||
<object class="IBPartialClassDescription">
|
||||
<string key="className">NSObject</string>
|
||||
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||
<string key="majorKey">IBFrameworkSource</string>
|
||||
<string key="minorKey">WebKit.framework/Headers/WebDownload.h</string>
|
||||
</object>
|
||||
</object>
|
||||
<object class="IBPartialClassDescription">
|
||||
<string key="className">NSObject</string>
|
||||
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||
<string key="majorKey">IBFrameworkSource</string>
|
||||
<string key="minorKey">WebKit.framework/Headers/WebEditingDelegate.h</string>
|
||||
</object>
|
||||
</object>
|
||||
<object class="IBPartialClassDescription">
|
||||
<string key="className">NSObject</string>
|
||||
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||
<string key="majorKey">IBFrameworkSource</string>
|
||||
<string key="minorKey">WebKit.framework/Headers/WebFrameLoadDelegate.h</string>
|
||||
</object>
|
||||
</object>
|
||||
<object class="IBPartialClassDescription">
|
||||
<string key="className">NSObject</string>
|
||||
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||
<string key="majorKey">IBFrameworkSource</string>
|
||||
<string key="minorKey">WebKit.framework/Headers/WebJavaPlugIn.h</string>
|
||||
</object>
|
||||
</object>
|
||||
<object class="IBPartialClassDescription">
|
||||
<string key="className">NSObject</string>
|
||||
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||
<string key="majorKey">IBFrameworkSource</string>
|
||||
<string key="minorKey">WebKit.framework/Headers/WebPlugin.h</string>
|
||||
</object>
|
||||
</object>
|
||||
<object class="IBPartialClassDescription">
|
||||
<string key="className">NSObject</string>
|
||||
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||
<string key="majorKey">IBFrameworkSource</string>
|
||||
<string key="minorKey">WebKit.framework/Headers/WebPluginContainer.h</string>
|
||||
</object>
|
||||
</object>
|
||||
<object class="IBPartialClassDescription">
|
||||
<string key="className">NSObject</string>
|
||||
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||
<string key="majorKey">IBFrameworkSource</string>
|
||||
<string key="minorKey">WebKit.framework/Headers/WebPolicyDelegate.h</string>
|
||||
</object>
|
||||
</object>
|
||||
<object class="IBPartialClassDescription">
|
||||
<string key="className">NSObject</string>
|
||||
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||
<string key="majorKey">IBFrameworkSource</string>
|
||||
<string key="minorKey">WebKit.framework/Headers/WebResourceLoadDelegate.h</string>
|
||||
</object>
|
||||
</object>
|
||||
<object class="IBPartialClassDescription">
|
||||
<string key="className">NSObject</string>
|
||||
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||
<string key="majorKey">IBFrameworkSource</string>
|
||||
<string key="minorKey">WebKit.framework/Headers/WebScriptObject.h</string>
|
||||
</object>
|
||||
</object>
|
||||
<object class="IBPartialClassDescription">
|
||||
<string key="className">NSObject</string>
|
||||
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||
<string key="majorKey">IBFrameworkSource</string>
|
||||
<string key="minorKey">WebKit.framework/Headers/WebUIDelegate.h</string>
|
||||
</object>
|
||||
</object>
|
||||
<object class="IBPartialClassDescription">
|
||||
<string key="className">NSOutlineView</string>
|
||||
<string key="superclassName">NSTableView</string>
|
||||
@@ -1723,6 +1734,109 @@
|
||||
<string key="minorKey">AppKit.framework/Headers/NSWindowScripting.h</string>
|
||||
</object>
|
||||
</object>
|
||||
<object class="IBPartialClassDescription">
|
||||
<string key="className">WebView</string>
|
||||
<string key="superclassName">NSView</string>
|
||||
<object class="NSMutableDictionary" key="actions">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<object class="NSArray" key="dict.sortedKeys">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<string>goBack:</string>
|
||||
<string>goForward:</string>
|
||||
<string>makeTextLarger:</string>
|
||||
<string>makeTextSmaller:</string>
|
||||
<string>makeTextStandardSize:</string>
|
||||
<string>reload:</string>
|
||||
<string>reloadFromOrigin:</string>
|
||||
<string>stopLoading:</string>
|
||||
<string>takeStringURLFrom:</string>
|
||||
<string>toggleContinuousSpellChecking:</string>
|
||||
<string>toggleSmartInsertDelete:</string>
|
||||
</object>
|
||||
<object class="NSMutableArray" key="dict.values">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<string>id</string>
|
||||
<string>id</string>
|
||||
<string>id</string>
|
||||
<string>id</string>
|
||||
<string>id</string>
|
||||
<string>id</string>
|
||||
<string>id</string>
|
||||
<string>id</string>
|
||||
<string>id</string>
|
||||
<string>id</string>
|
||||
<string>id</string>
|
||||
</object>
|
||||
</object>
|
||||
<object class="NSMutableDictionary" key="actionInfosByName">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<object class="NSArray" key="dict.sortedKeys">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<string>goBack:</string>
|
||||
<string>goForward:</string>
|
||||
<string>makeTextLarger:</string>
|
||||
<string>makeTextSmaller:</string>
|
||||
<string>makeTextStandardSize:</string>
|
||||
<string>reload:</string>
|
||||
<string>reloadFromOrigin:</string>
|
||||
<string>stopLoading:</string>
|
||||
<string>takeStringURLFrom:</string>
|
||||
<string>toggleContinuousSpellChecking:</string>
|
||||
<string>toggleSmartInsertDelete:</string>
|
||||
</object>
|
||||
<object class="NSMutableArray" key="dict.values">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<object class="IBActionInfo">
|
||||
<string key="name">goBack:</string>
|
||||
<string key="candidateClassName">id</string>
|
||||
</object>
|
||||
<object class="IBActionInfo">
|
||||
<string key="name">goForward:</string>
|
||||
<string key="candidateClassName">id</string>
|
||||
</object>
|
||||
<object class="IBActionInfo">
|
||||
<string key="name">makeTextLarger:</string>
|
||||
<string key="candidateClassName">id</string>
|
||||
</object>
|
||||
<object class="IBActionInfo">
|
||||
<string key="name">makeTextSmaller:</string>
|
||||
<string key="candidateClassName">id</string>
|
||||
</object>
|
||||
<object class="IBActionInfo">
|
||||
<string key="name">makeTextStandardSize:</string>
|
||||
<string key="candidateClassName">id</string>
|
||||
</object>
|
||||
<object class="IBActionInfo">
|
||||
<string key="name">reload:</string>
|
||||
<string key="candidateClassName">id</string>
|
||||
</object>
|
||||
<object class="IBActionInfo">
|
||||
<string key="name">reloadFromOrigin:</string>
|
||||
<string key="candidateClassName">id</string>
|
||||
</object>
|
||||
<object class="IBActionInfo">
|
||||
<string key="name">stopLoading:</string>
|
||||
<string key="candidateClassName">id</string>
|
||||
</object>
|
||||
<object class="IBActionInfo">
|
||||
<string key="name">takeStringURLFrom:</string>
|
||||
<string key="candidateClassName">id</string>
|
||||
</object>
|
||||
<object class="IBActionInfo">
|
||||
<string key="name">toggleContinuousSpellChecking:</string>
|
||||
<string key="candidateClassName">id</string>
|
||||
</object>
|
||||
<object class="IBActionInfo">
|
||||
<string key="name">toggleSmartInsertDelete:</string>
|
||||
<string key="candidateClassName">id</string>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||
<string key="majorKey">IBFrameworkSource</string>
|
||||
<string key="minorKey">WebKit.framework/Headers/WebView.h</string>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
<int key="IBDocument.localizationMode">0</int>
|
||||
|
||||
@@ -10,13 +10,13 @@
|
||||
|
||||
@class Mod;
|
||||
@interface GameInstall : NSObject {
|
||||
NSString *gamePath;
|
||||
NSMutableString *utilityBuffer;
|
||||
NSURL *gameURL;
|
||||
}
|
||||
|
||||
-(id)initWithPath:(NSString *)path;
|
||||
-(id)initWithURL:(NSURL *)path;
|
||||
-(void)launchGame;
|
||||
- (void)runUtilityApp:(NSString *)arg handleOutput:(id)obj withMethod:(SEL)sel;
|
||||
- (NSString *)runUtilityQuery:(NSString *)arg;
|
||||
- (void)runUtilityQuery:(NSString *)arg handleOutput:(id)obj withMethod:(SEL)sel;
|
||||
- (NSArray *)installedMods;
|
||||
- (NSArray *)infoForMods:(NSArray *)mods;
|
||||
@end
|
||||
|
||||
@@ -11,47 +11,32 @@
|
||||
|
||||
@implementation GameInstall
|
||||
|
||||
-(id)initWithPath:(NSString *)path
|
||||
-(id)initWithURL:(NSURL *)url
|
||||
{
|
||||
self = [super init];
|
||||
if (self != nil)
|
||||
{
|
||||
gamePath = path;
|
||||
gameURL = url;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)dealloc
|
||||
{
|
||||
[utilityBuffer release];
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
-(void)clearBuffer
|
||||
{
|
||||
[utilityBuffer release];
|
||||
utilityBuffer = [[NSMutableString stringWithString:@""] retain];
|
||||
}
|
||||
|
||||
- (void)bufferData:(NSString *)string
|
||||
{
|
||||
if (string == nil) return;
|
||||
[utilityBuffer appendString:string];
|
||||
}
|
||||
|
||||
- (NSArray *)installedMods
|
||||
{
|
||||
[self clearBuffer];
|
||||
[self runUtilityApp:@"-l" handleOutput:self withMethod:@selector(bufferData:)];
|
||||
id mods = [[NSString stringWithString:utilityBuffer] stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
|
||||
id raw = [self runUtilityQuery:@"-l"];
|
||||
id mods = [raw stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
|
||||
return [mods componentsSeparatedByString:@"\n"];
|
||||
}
|
||||
|
||||
- (NSArray *)infoForMods:(NSArray *)mods
|
||||
{
|
||||
[self clearBuffer];
|
||||
[self runUtilityApp:[NSString stringWithFormat:@"-i=%@",[mods componentsJoinedByString:@","]] handleOutput:self withMethod:@selector(bufferData:)];
|
||||
NSArray *lines = [utilityBuffer componentsSeparatedByString:@"\n"];
|
||||
id query = [NSString stringWithFormat:@"-i=%@",[mods componentsJoinedByString:@","]];
|
||||
NSArray *lines = [[self runUtilityQuery:query] componentsSeparatedByString:@"\n"];
|
||||
|
||||
NSMutableArray *ret = [NSMutableArray array];
|
||||
NSMutableDictionary *fields = nil;
|
||||
@@ -63,6 +48,9 @@
|
||||
continue;
|
||||
|
||||
id kv = [line componentsSeparatedByString:@":"];
|
||||
if ([kv count] < 2)
|
||||
continue;
|
||||
|
||||
id key = [kv objectAtIndex:0];
|
||||
id value = [kv objectAtIndex:1];
|
||||
|
||||
@@ -76,7 +64,10 @@
|
||||
{
|
||||
// Commit prev mod
|
||||
if (current != nil)
|
||||
[ret addObject:[Mod modWithId:current fields:fields]];
|
||||
{
|
||||
id url = [gameURL URLByAppendingPathComponent:[NSString stringWithFormat:@"mods/%@",current]];
|
||||
[ret addObject:[Mod modWithId:current fields:fields baseURL:url]];
|
||||
}
|
||||
NSLog(@"Parsing mod %@",value);
|
||||
current = value;
|
||||
fields = [NSMutableDictionary dictionary];
|
||||
@@ -93,7 +84,7 @@
|
||||
{
|
||||
// Use LaunchServices because neither NSTask or NSWorkspace support Info.plist _and_ arguments pre-10.6
|
||||
NSString *path = [[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:@"OpenRA.app/Contents/MacOS/OpenRA"];
|
||||
NSArray *args = [NSArray arrayWithObjects:gamePath, @"mono", @"--debug", @"OpenRA.Game.exe", @"Game.Mods=ra",nil];
|
||||
NSArray *args = [NSArray arrayWithObjects:[gameURL absoluteString], @"mono", @"--debug", @"OpenRA.Game.exe", @"Game.Mods=ra",nil];
|
||||
|
||||
FSRef appRef;
|
||||
CFURLGetFSRef((CFURLRef)[NSURL URLWithString:path], &appRef);
|
||||
@@ -116,7 +107,7 @@
|
||||
SetFrontProcess(&psn);
|
||||
}
|
||||
|
||||
- (void)runUtilityApp:(NSString *)arg handleOutput:(id)obj withMethod:(SEL)sel
|
||||
- (NSString *)runUtilityQuery:(NSString *)arg
|
||||
{
|
||||
NSTask *aTask = [[NSTask alloc] init];
|
||||
NSPipe *aPipe = [NSPipe pipe];
|
||||
@@ -125,7 +116,29 @@
|
||||
NSMutableArray *taskArgs = [NSMutableArray arrayWithObject:@"OpenRA.Utility.exe"];
|
||||
[taskArgs addObject:arg];
|
||||
|
||||
[aTask setCurrentDirectoryPath:gamePath];
|
||||
[aTask setCurrentDirectoryPath:[gameURL absoluteString]];
|
||||
[aTask setLaunchPath:@"/Library/Frameworks/Mono.framework/Commands/mono"];
|
||||
[aTask setArguments:taskArgs];
|
||||
[aTask setStandardOutput:aPipe];
|
||||
[aTask setStandardError:[aTask standardOutput]];
|
||||
[aTask launch];
|
||||
NSData *data = [readHandle readDataToEndOfFile];
|
||||
[aTask release];
|
||||
|
||||
return [NSString stringWithUTF8String:[data bytes]];
|
||||
}
|
||||
|
||||
|
||||
- (void)runUtilityQuery:(NSString *)arg handleOutput:(id)obj withMethod:(SEL)sel
|
||||
{
|
||||
NSTask *aTask = [[NSTask alloc] init];
|
||||
NSPipe *aPipe = [NSPipe pipe];
|
||||
NSFileHandle *readHandle = [aPipe fileHandleForReading];
|
||||
|
||||
NSMutableArray *taskArgs = [NSMutableArray arrayWithObject:@"OpenRA.Utility.exe"];
|
||||
[taskArgs addObject:arg];
|
||||
|
||||
[aTask setCurrentDirectoryPath:[gameURL absoluteString]];
|
||||
[aTask setLaunchPath:@"/Library/Frameworks/Mono.framework/Commands/mono"];
|
||||
[aTask setArguments:taskArgs];
|
||||
[aTask setStandardOutput:aPipe];
|
||||
@@ -134,7 +147,7 @@
|
||||
NSData *inData = nil;
|
||||
while ((inData = [readHandle availableData]) && [inData length])
|
||||
[obj performSelector:sel withObject:[NSString stringWithUTF8String:[inData bytes]]];
|
||||
|
||||
[aTask waitUntilExit];
|
||||
[aTask release];
|
||||
}
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
#import <Cocoa/Cocoa.h>
|
||||
|
||||
@interface Mod : NSObject {
|
||||
NSURL *baseURL;
|
||||
NSString *mod;
|
||||
NSString *title;
|
||||
NSString *version;
|
||||
@@ -25,6 +26,8 @@
|
||||
@property (readonly) NSString *requires;
|
||||
@property (readonly) BOOL standalone;
|
||||
|
||||
+ (id)modWithId:(NSString *)mid fields:(id)fields;
|
||||
- (id)initWithId:(NSString *)mod fields:(NSDictionary *)fields;
|
||||
+ (id)modWithId:(NSString *)mid fields:(id)fields baseURL:(NSURL *)url;
|
||||
- (id)initWithId:(NSString *)anId fields:(NSDictionary *)fields baseURL:(NSURL *)url;
|
||||
|
||||
- (NSURL *)pageURL;
|
||||
@end
|
||||
|
||||
@@ -18,19 +18,20 @@
|
||||
@synthesize requires;
|
||||
@synthesize standalone;
|
||||
|
||||
+ (id)modWithId:(NSString *)mod fields:(id)fields
|
||||
+ (id)modWithId:(NSString *)mod fields:(id)fields baseURL:(NSURL *)url
|
||||
{
|
||||
id newObject = [[self alloc] initWithId:mod fields:fields];
|
||||
id newObject = [[self alloc] initWithId:mod fields:fields baseURL:url];
|
||||
[newObject autorelease];
|
||||
return newObject;
|
||||
}
|
||||
|
||||
- (id)initWithId:(NSString *)anId fields:(NSDictionary *)fields
|
||||
- (id)initWithId:(NSString *)anId fields:(NSDictionary *)fields baseURL:(NSURL *)url
|
||||
{
|
||||
self = [super init];
|
||||
if (self)
|
||||
{
|
||||
mod = anId;
|
||||
mod = [anId retain];
|
||||
baseURL = [url retain];
|
||||
title = [[fields objectForKey:@"Title"] retain];
|
||||
version = [[fields objectForKey:@"Version"] retain];
|
||||
author = [[fields objectForKey:@"Author"] retain];
|
||||
@@ -41,9 +42,10 @@
|
||||
return self;
|
||||
}
|
||||
|
||||
|
||||
- (void) dealloc
|
||||
{
|
||||
[mod release]; mod = nil;
|
||||
[baseURL release]; baseURL = nil;
|
||||
[title release]; title = nil;
|
||||
[version release]; version = nil;
|
||||
[author release]; author = nil;
|
||||
@@ -52,4 +54,9 @@
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
- (NSURL *)pageURL
|
||||
{
|
||||
return [baseURL URLByAppendingPathComponent:@"mod.html"];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@@ -28,5 +28,5 @@
|
||||
+ (id)entryWithMod:(Mod *)baseMod allMods:(NSArray *)allMods;
|
||||
- (id)initWithTitle:(NSString *)aTitle object:(id)anObject icon:(id)anIcon isHeader:(BOOL)aHeader;
|
||||
- (void)addChild:(id)child;
|
||||
|
||||
- (NSURL *)url;
|
||||
@end
|
||||
|
||||
@@ -68,6 +68,22 @@
|
||||
[children addObject:child];
|
||||
}
|
||||
|
||||
- (BOOL)shouldSelect
|
||||
{
|
||||
return [object shouldSelect];
|
||||
}
|
||||
|
||||
- (NSURL *)url
|
||||
{
|
||||
if (object == nil)
|
||||
{
|
||||
NSLog(@"object is nil");
|
||||
return nil;
|
||||
}
|
||||
|
||||
return [object pageURL];
|
||||
}
|
||||
|
||||
- (void) dealloc
|
||||
{
|
||||
[title release]; title = nil;
|
||||
|
||||
93
mods/cnc/mod.html
Normal file
93
mods/cnc/mod.html
Normal file
@@ -0,0 +1,93 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
|
||||
"http://www.w3.org/TR/html4/loose.dtd">
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<style>
|
||||
body { background-color: black; margin: 0px; color: White; font-family: Cambria, Georgia, Times New Roman, Serif; font-size: 12pt }
|
||||
h1 { font-family: Cambria, Georgia, Times New Roman, Serif }
|
||||
h2, h3 { font-family: Helvetica, Arial, Sans-Serif }
|
||||
|
||||
div#main
|
||||
{
|
||||
margin: 0 auto;
|
||||
padding: 20px 0px;
|
||||
width:100%;
|
||||
height:100%;
|
||||
}
|
||||
|
||||
div#header
|
||||
{
|
||||
margin-top: 30px;
|
||||
height: 66px;
|
||||
text-align:center;
|
||||
}
|
||||
|
||||
div.bar
|
||||
{
|
||||
border-top: solid 3px #650b03;
|
||||
border-bottom: solid 3px #650b03;
|
||||
background-color: #272d2c;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
div#header h1
|
||||
{
|
||||
margin: auto auto;
|
||||
padding-top:15px;
|
||||
}
|
||||
|
||||
div#content
|
||||
{
|
||||
text-align: justify;
|
||||
width:50%;
|
||||
padding-left:50px;
|
||||
}
|
||||
|
||||
div#buttons
|
||||
{
|
||||
position:absolute;
|
||||
bottom:0px;
|
||||
padding:20px;
|
||||
}
|
||||
|
||||
.button
|
||||
{
|
||||
border: solid 3px #650b03;
|
||||
border-radius: 10px;
|
||||
margin:10px;
|
||||
height:40px;
|
||||
width:150px;
|
||||
color:white;
|
||||
font-weight:bold;
|
||||
font-size:1em;
|
||||
background-color: #272d2c;
|
||||
}
|
||||
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div id="header" class="bar">
|
||||
<h1>Command & Conquer</h1>
|
||||
</div>
|
||||
|
||||
<div id="main">
|
||||
<div id="content">
|
||||
<h2>Latest News</h2>
|
||||
<div>
|
||||
<h3>Version XXYYZZ Available</h3>
|
||||
<ul>
|
||||
<li>Cool feature one</li>
|
||||
<li>Cool feature two</li>
|
||||
<li>Bugfixes!!!</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div id="buttons">
|
||||
<input type="button" class="button" value="Play" />
|
||||
<input type="button" class="button" value="Install Music" />
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
Reference in New Issue
Block a user