Skip to content

Commit

Permalink
File Option to edit the Storage Folder.
Browse files Browse the repository at this point in the history
  • Loading branch information
ntn16104 committed Mar 27, 2021
1 parent 64cc7f3 commit d129da7
Showing 1 changed file with 24 additions and 10 deletions.
34 changes: 24 additions & 10 deletions templates/temp_index.html
Original file line number Diff line number Diff line change
Expand Up @@ -383,6 +383,7 @@ <h3 class="text-white-50 mx-auto mt-2 mb-5">This is a simulation project, implem
var reflectortoRouter;
var attackertoReflector;
var queueLimit;
var storageFolder;

if (file.type.match(textType)) {
var reader = new FileReader();
Expand All @@ -395,15 +396,6 @@ <h3 class="text-white-50 mx-auto mt-2 mb-5">This is a simulation project, implem
//document.getElementById("output").innerHTML= content;
var contents= content.split(/\s+/);

//packets = new Number(contents[0]);
//ddd = contents[1];
//ports = new Number(contents[2]);
//dx = new Number(contents[3]);
//skipsim = contents[4];
//outFile = contents[5];


//console.log(contents[22]);

packetsize = new Number(contents[1]);
rtsa = new Number(contents[2]);
Expand All @@ -427,17 +419,29 @@ <h3 class="text-white-50 mx-auto mt-2 mb-5">This is a simulation project, implem
attackerType = new Number(contents[20]);
amplification = new Number(contents[21]);


skipsim = contents[22]; // booleans
logfile = contents[23]; // booleans
summfile = contents[24]; // booleans

// Use try to prevent index out of bounds
try{
storageFolder = new String(contents[25]);
if (storageFolder == ""){
storageFolder = "Unnamed"
}
}
catch(err){
console.log(err);
}



console.log(packetsize);
console.log("The content is " + DDDstate);
console.log("Second content is " + skipsim);
document.getElementById("DDDstate").value = DDDstate;
document.getElementById("simOption").value = skipsim;
//document.getElementById("downOutput").value =outFile;
document.getElementById("summfile").value = summfile;
document.getElementById("logfile").value = logfile;

Expand Down Expand Up @@ -484,18 +488,26 @@ <h3 class="text-white-50 mx-auto mt-2 mb-5">This is a simulation project, implem
document.getElementById("downOutput").checked = true;

if(summfile =="Yes" || summfile == "yes"){
document.getElementById("downOutput").checked = true;
document.getElementById("summfile").checked = true;
summChanged();

}
else if(summfile =="No" || summfile == "no"){
document.getElementById("summfile").checked = false;
summChanged();
}
if(logfile =="Yes" || logfile =="yes"){
document.getElementById("downOutput").checked = checked;
document.getElementById("logfile").checked = true;
logChanged();
}
else if(logfile =="No" || logfile =="no"){
document.getElementById("logfile").checked = false;
logChanged();
}


}

if(summfile =="No" || summfile == "no"){
Expand All @@ -509,6 +521,8 @@ <h3 class="text-white-50 mx-auto mt-2 mb-5">This is a simulation project, implem
document.getElementById("downOutput").checked = false;
valueChanged();
}


}

reader.readAsText(file);
Expand Down

0 comments on commit d129da7

Please sign in to comment.