void CreateFile() { try { if (System.IO.File.Exists(path)) { Debug.Log("STATO OK : il file esiste e sembra leggibile."); } else { FrameWrap wrapper = new FrameWrap(); // wrapper.frame_0 = frame_0; //Debug.Log("Creating File..."); /*string contents = JsonUtility.ToJson(wrapper, true); * System.IO.File.WriteAllText(path, contents);*/ string contents = JsonUtility.ToJson(wrapper, true); System.IO.File.WriteAllText(path, contents); Debug.Log("File creato"); } } catch (System.Exception ex) { Debug.Log(ex.Message); } //Debug.Log("Fuori dal try : STATO OK"); }
void acquisisci_frame(string contents) { //var map = new Dictionary<int, Frame>(); //Frame [] array; int i = 0; int pos = 0; int el = 0; do { int ini = contents.IndexOf("frame", pos); int dif = contents.IndexOf('"', ini) - ini; // Debug.Log(dif); contents = contents.Remove(ini, dif); //Debug.Log(contents); //restituisce una stringa parte dalla posizione e per tot elementi //Debug.Log(i); contents = contents.Insert(ini, "frame_primo"); //Debug.Log(contents); //Debug.Log(i); FrameWrap wrapper = JsonUtility.FromJson <FrameWrap>(contents); //Debug.Log(wrapper.frame_primo.person_0.joint_1.x); frames.Add(wrapper.frame_primo); i++; //Debug.Log(wrapper.frame_primo.person_0.joint_0.x); el = contents.IndexOf("frame", ini + 100); contents = contents.Remove(contents.IndexOf('{', 0) + 1, el - (contents.IndexOf('{', 0) + 2)); //if (contents.IndexOf("frame", 100) > 0) { contents = contents.Remove(contents.IndexOf('{', 0) + 1, el - (contents.IndexOf('{', 0) + 2)); }//tolgo un frame ogni due perchè ho troppi frame //Debug.Log(contents); } while (contents.IndexOf("frame", 100) > 0); }
public void Init(object sender, RoutedEventArgs ev) { this.savepath = folder; killProcessesCI(); //getFiles(); this.Closing += (s, e) => { killProcessesCI(); }; FrameWrap.Unloaded += (s, e) => { loader.IsBusy = true; }; FrameWrap.NavigationUIVisibility = NavigationUIVisibility.Hidden; FrameWrap.Navigate(new Content.Welcome()); if (File.Exists(Utility.LocalPath + "\\data\\music.mp3")) { bgaudio.LoadedBehavior = MediaState.Manual; bgaudio.Source = new Uri(Utility.LocalPath + "\\data\\music.mp3"); bgaudio.Volume = 0.2; bgaudio.Play(); } }
void acquisisci_frame(string contents) { int i = 0; int pos = 0; int el = 0; do { int ini = contents.IndexOf("frame", pos); int dif = contents.IndexOf('"', ini) - ini; contents = contents.Remove(ini, dif); contents = contents.Insert(ini, "frame_primo"); FrameWrap wrapper = JsonUtility.FromJson <FrameWrap>(contents); frames.Add(wrapper.frame_primo); i++; el = contents.IndexOf("frame", ini + 100); contents = contents.Remove(contents.IndexOf('{', 0) + 1, el - (contents.IndexOf('{', 0) + 2)); } while (contents.IndexOf("frame", 100) > 0); }