예제 #1
0
 private void AssignGuid(Level lvl, Guid guid, Schema instanceSchema, int run, string nickName)
 {
     Entity entity = null;
     try
     {
         entity = lvl.GetEntity(instanceSchema);
     }
     catch (Exception ex)
     {
         Debug.Write("Error", ex.Message);
     }
     try
     {
         if (!entity.IsValid())
         {
             entity = new Entity(instanceSchema);
         }
         Field field = instanceSchema.GetField("InstanceID");
         entity.Set<string>(field, guid.ToString());
         field = instanceSchema.GetField("RunID");
         entity.Set<int>(field, run);
         field = instanceSchema.GetField("NickName");
         entity.Set<string>(field, nickName);
         lvl.SetEntity(entity);
     }
     catch (Exception ex)
     {
         TaskDialog.Show("Error", ex.Message);
     }
 }