Create version with get information
This commit is contained in:
@@ -34,6 +34,7 @@ struct URLLightshow {
|
||||
|
||||
class LightshowModel{
|
||||
var names : Array<Lightshow> = [] ;
|
||||
let extensionsFile : Array<String> = ["mp3", "wav", "fseq"];
|
||||
|
||||
init(){
|
||||
|
||||
@@ -74,26 +75,31 @@ class LightshowModel{
|
||||
|
||||
func setStudentAtIndex(_ index: Int, withdraw value : String){
|
||||
var filenameArray = value.split(separator: ".")
|
||||
filenameArray.remove(at: filenameArray.count - 1)
|
||||
let filenameExtension = String(filenameArray[filenameArray.count - 1]);
|
||||
|
||||
let valueNomalized = filenameArray.joined()
|
||||
|
||||
var foundLightshow : Lightshow! = nil;
|
||||
|
||||
for lightshow in names {
|
||||
if (lightshow.name == valueNomalized ){
|
||||
foundLightshow = lightshow;
|
||||
if (self.extensionsFile.contains(filenameExtension)){
|
||||
filenameArray.remove(at: filenameArray.count - 1)
|
||||
|
||||
let valueNomalized = filenameArray.joined()
|
||||
|
||||
var foundLightshow : Lightshow! = nil;
|
||||
|
||||
for lightshow in names {
|
||||
if (lightshow.name == valueNomalized ){
|
||||
foundLightshow = lightshow;
|
||||
}
|
||||
}
|
||||
if (foundLightshow == nil){
|
||||
foundLightshow = Lightshow(valueNomalized);
|
||||
names.append(foundLightshow)
|
||||
}
|
||||
if (filenameExtension == "mp3" || filenameExtension == "wav"){
|
||||
foundLightshow.urls.mp3 = value;
|
||||
} else if (value.contains(".fseq")){
|
||||
foundLightshow.urls.fseq = value;
|
||||
}
|
||||
}
|
||||
if (foundLightshow == nil){
|
||||
foundLightshow = Lightshow(valueNomalized);
|
||||
names.append(foundLightshow)
|
||||
}
|
||||
if (value.contains(".mp3")){
|
||||
foundLightshow.urls.mp3 = value;
|
||||
} else if (value.contains(".fseq")){
|
||||
foundLightshow.urls.fseq = value;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func resetStundent() -> Void {
|
||||
|
||||
Reference in New Issue
Block a user