Exemplo n.º 1
0
 public void Load(object data)
 {
     Element.classList.add("loading");
     try
     {
         if (Std.InstanceOf <ArrayBuffer>(data))
         {
             ScoreLoaded(ScoreLoader.LoadScoreFromBytes(Std.ArrayBufferToByteArray((ArrayBuffer)data)));
         }
         else if (Std.InstanceOf <Uint8Array>(data))
         {
             ScoreLoaded(ScoreLoader.LoadScoreFromBytes((byte[])data));
         }
         else if (JsTypeOf(data) == JsTypes.@string)
         {
             ScoreLoader.LoadScoreAsync((string)data, s => ScoreLoaded(s), e =>
             {
                 Error("import", e);
             });
         }
     }
     catch (Exception e)
     {
         Error("import", e);
     }
 }
Exemplo n.º 2
0
 public override void Load(object data)
 {
     if (Std.InstanceOf <ArrayBuffer>(data))
     {
         ScoreLoaded(ScoreLoader.LoadScoreFromBytes(Std.ArrayBufferToByteArray((ArrayBuffer)data)));
     }
     else if (Std.InstanceOf <Uint8Array>(data))
     {
         ScoreLoaded(ScoreLoader.LoadScoreFromBytes((byte[])data));
     }
     else if (JsTypeOf(data) == JsTypes.@string)
     {
         ScoreLoader.LoadScoreAsync((string)data, s => ScoreLoaded(s), e => console.error(e));
     }
 }
 private void Load(object data, int[] trackIndexes)
 {
     try
     {
         _trackIndexes = trackIndexes;
         if (Std.InstanceOf <ArrayBuffer>(data))
         {
             ScoreLoaded(ScoreLoader.LoadScoreFromBytes(Std.ArrayBufferToByteArray((ArrayBuffer)data)));
         }
         else if (Std.InstanceOf <Uint8Array>(data))
         {
             ScoreLoaded(ScoreLoader.LoadScoreFromBytes((byte[])data));
         }
         else if (JsContext.JsTypeOf(data) == JsTypes.@string)
         {
             ScoreLoader.LoadScoreAsync((string)data, ScoreLoaded, Error);
         }
     }
     catch (Exception e)
     {
         Error(e);
     }
 }