Jump to content
  • Advertisement
Sign in to follow this  
  • entries
    53
  • comments
    56
  • views
    33908

Something and nothing

Sign in to follow this  
aidan_walsh

335 views

Just a little check in.

Owing to terrible levels of sleep the last few nights, I haven't a lot of work done on the installer - not code-wise anyway. Actually, its not fair to say that its just becuase I'm tired, it also has a little to do with Stargate SG-1 Season 7, and Battlestar Galactica miniseries and Season 1 having come through the letter box yesterday morning [wink]

However, I have taken the time to clean up some of my data structure for the installer itself. The section of the document that acted as the file dictionary was a mess from the first draft. I spent a bit of time yesterday going through it, deciding what needed to be kept and what could be cut out, and basically sreamlining the entire thing. I'm happy with the results. Not only is it much easier to read and understand the specifics of each file, but I have also managed to clean up the layout of extra file tasks like shortcut creation, and file type association.

On top of this, I decided to enclose the file tag inside another tag, basedirectory. This will allow files to be placed outside the installation base directory.

Now just to do some similar work with the setting tags, and I can show you what the first spec of the XML Installer file will look like.




I have also been doing a little work by way of an example to my post Coding Common Decency (a post that, on reflection, I wish I had given one or two more drafts to). Nothing that has hit the compiler yet, so they could be buggy to hell, but I have cobbled together some base classes in Java and C# to illustrate just how easy and simple an oversight it is.

Networkable.cs
namespace Application
{
abstract public class Networkable
{
NetworkPermissionListener listener;

/*
* Checks if a user has set this feature to always be allowed, otherwise prompts the user for permission
*/

public Networkable
{
if(HasPermission())
Activate();
else
{
listener = new NetworkPermissionListener(this);
Prompt();
}
}

/*
* Check the programs configuration to see if this option has been enabled.
* If not, prompt the user to decide whether to allow the class to connect
*/

abstract public bool HasPermission();

/*
* Activates the Networkable feature. This is used to generate the UI (if any), and create the actual network connectivity.
*/

abstract void Activate();

/*
* Prompts the user to decide whether or not they want to allow the feature to connect to the network.
*/

abstract void Prompt();

/*
* Notifies the registered NetworkablePermissionListener that the user has granted permission. This method should
* only be called from prompt when the user has agreed to allow the feature to connect to the network.
*/

private void NotifyNetworkPermissionListener()
{
listener.GrantedPermission();
}
}

public class NetworkablePermissionListener()
{
private Networkable n;

public NetworkablePermissionListener(Networkable nable)
{
n = nable;
}

public void GrantedPermission()
{
n.activate();
}
}
}




Networkable.java
package net.aidanwalsh.application;

abstract class Networkable
{
private NetworkablePermissionListener listener;

/*
* Checks if a user has set this feature to always be allowed, otherwise prompts the user for permission
*/

public Networkable()
{
if(hasPermission())
activate();
else
{
prompt();

listener = new NetworkablePermissionListener(){
public void grantedPermission(Networkable n)
{
n.activate();
}
};
}

}

/*
* Check the programs configuration to see if this option has been enabled.
* If not, prompt the user to decide whether to allow the class to connect
*/

abstract boolean hasPermission();

/*
* Activates the Networkable feature. This is used to generate the UI (if any), and create the actual network connectivity.
*/

abstract void activate();

/*
* Prompts the user to decide whether or not they want to allow the feature to connect to the network.
*/

abstract void prompt();

/*
* Notifies the registered NetworkablePermissionListener that the user has granted permission. This method should
* only be called from prompt when the user has agreed to allow the feature to connect to the network.
*/

private void notifyNetworkablePermissionListener()
{
listener.grantedPermission(this);
}
}




NetworkablePermissionListener.java
package com.walsh.Application;

public interface NetworkablePermissionListener()
{
public void grantedPermission(Networkable n);
}






Brainfart of the Hour: So France says that sharing of copyrighted material over P2P is legal, eh? The lines between "private copying" and "mass distribution" have never been so blurred. Fair use is one thing, but IMO that does not and should not extend to making it available for public consumption. Perhaps thats an oversimplistic view, however.
Sign in to follow this  


0 Comments


Recommended Comments

There are no comments to display.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!