Example #1
0
int CIFStaticFortuna::ReadData(QSettings& set)
{
    ReadDev(set);
    ReadCompany(set);
    ReadOperator(set);
    ReadNetwork(set);
    ReadFtp(set);
    ReadLotbox(set);
    ReadPrize(set);
    ReadNotein(set);
    ReadNoteout(set);
    ReadCoiner(set);
    ReadTimer(set);
    ReadUps(set);
    ReadRedeembox(set);

    return 1;
}
Example #2
0
void MenuHandler(){
	short nArgs;
	int selectedNode;
	node * network = NULL;
	statistics * stats = NULL;
	char option, buffer[BUFFER_SIZE], arg1[BUFFER_SIZE], garbageDetector[BUFFER_SIZE];
	
	if(executeAtStart){
		network = ReadNetwork(path);
		if(network != NULL){
			stats = GetStatistics(network);
			PrintStatistics(stats);
			PrintExecutionTime();
			FreeEverything(network, stats);
			return;
		}
		else return;
	}
	
	// printing menu
	PrintMenu();
	printf("Please select an option\n");
	
	while(TRUE){
		// gets user commands and arguments
		printf("-> ");
		fgets (buffer, BUFFER_SIZE, stdin);
		nArgs = sscanf(buffer, "%c %s %s", &option, arg1, garbageDetector);
		
		// selects function based on user option
		////////// load
		if(option == 'f' && nArgs == 2){
			if(network != NULL) free(network);
			network = ReadNetwork(arg1);
			if(network != NULL) printf("Network loaded from file\n");
		}
		////////// route
		else if(option == 'r' && nArgs == 2) {
			if(network != NULL){
				selectedNode = atoi(arg1);
				if(selectedNode <= numberOfNodes && selectedNode > 0){
					results = FindRoutesToNode(network, selectedNode);
					PrintRoutingTable(network);
				}
				else printf("Please select valid node\n");
			}
			else printf("Please load a network first\n");
		}
		///////// statistics
		else if(option == 's' && nArgs == 1){
			if(network != NULL){
				stats = GetStatistics(network);
				PrintStatistics(stats);
				PrintExecutionTime();
			}
			else printf("Please load a network first\n");
		} 
		//////// others
		else if(option == 'h' && nArgs == 1) PrintMenu();
		else if(option == 'q' && nArgs == 1){
			FreeEverything(network, stats);
			printf("Project by: Diogo Salgueiro 72777 and Ricardo Ferro 72870\n");
			printf("Goodbye!\n");
			return;
		}
		else printf("Invalid command\n");
		
	}
};