Exemple #1
0
 // Helper function to save gestures to file.
 public bool saveToFile()
 {
     if (this.gr != null)
     {
         string path = this.file_save_combinations;
         if (!Path.IsPathRooted(path))
         {
             path = file_default_path + "/" + path;
         }
         int ret = this.gr.saveToFile(path);
         if (ret == 0)
         {
             this.ConsoleText.text = "Gesture file saved successfully";
             return(true);
         }
         else
         {
             this.ConsoleText.text = $"[ERROR] Failed to saved gesture file\n{path}\n{GestureRecognition.getErrorMessage(ret)}";
             return(false);
         }
     }
     else if (this.gc != null)
     {
         string path = this.file_save_combinations;
         if (!Path.IsPathRooted(path))
         {
             path = file_default_path + "/" + path;
         }
         int ret = this.gc.saveToFile(path);
         if (ret == 0)
         {
             this.ConsoleText.text = "Gesture combinations file saved successfully";
             return(true);
         }
         else
         {
             this.ConsoleText.text = $"[ERROR] Failed to save gesture combinations file\n{path}\n{GestureRecognition.getErrorMessage(ret)}";
             return(false);
         }
     }
     this.ConsoleText.text = "[ERROR] No Gesture Recognition object\nto save to file.";
     return(false);
 }