public void RemoveChunk() { var position = WindowState.CurrentPosition; var index = Montage.Chunks.FindChunkIndex(position); if (index == -1) { return; } var chunk = Montage.Chunks[index]; chunk.Mode = Mode.Undefined; if (index != Montage.Chunks.Count - 1 && Montage.Chunks[index + 1].Mode == Mode.Undefined) { chunk.Length += Montage.Chunks[index + 1].Length; Montage.Chunks.RemoveAt(index + 1); } if (index != 0 && Montage.Chunks[index - 1].Mode == Mode.Undefined) { chunk.StartTime = Montage.Chunks[index - 1].StartTime; chunk.Length += Montage.Chunks[index - 1].Length; Montage.Chunks.RemoveAt(index - 1); } Montage.SetChanged(); }
void Awake() { _montage = GameObject.Find("MainScene").GetComponent<Montage>(); _guistart = GameObject.Find("MainScene").GetComponent<GUIStart>(); _cb = GetComponent<GUIDialogBox>(); _plugPhoto = GameObject.Find("MainScene").GetComponent<PluginPhotoManagerGUI>(); #if UNITY_ANDROID //s'il y à un fichier autosave.cub enregistré, affichage boîte de dialogue proposant de charger cette scène if (PlayerPrefs.GetInt("autosave") == 1) { Debug.Log(" autosave à 1"); string path = usefullData.SavePath + "autosave" + usefullData.SaveNewFileExtention; if (File.Exists(path)) { _guistart.enabled = false; _askAutosave = true; _cb.showMe(true, GUI.depth); _cb.setBtns(TextManager.GetText("GUIMenuRight.Yes"), TextManager.GetText("GUIMenuRight.No")); _cb.setText(TextManager.GetText("GUIMenuRight.AskAutoSave1") + "\n" + TextManager.GetText("GUIMenuRight.AskAutoSave2")); } PlayerPrefs.SetInt("autosave", 0); } #endif }
static void Main(string[] args) { BoxService bService = new BoxService(); Box b1 = new Box { MinWatts = 1, MaxWatts = 80, Brand = "iStick Rim Leaf" }; Box b2 = new Box { MinWatts = 1, MaxWatts = 80, Brand = "iKuu i80" }; b1.Id = bService.Insert(b1); b2.Id = bService.Insert(b2); AtomiserService aService = new AtomiserService(); Atomiser a1 = new Atomiser { MinWatt = 1, MaxWatt = 80, Brand = "TFV V8 Baby", Ml = 4, Resistance = 0.4 }; Atomiser a2 = new Atomiser { MinWatt = 1, MaxWatt = 60, Brand = "Melo 5", Ml = 5, Resistance = 0.2 }; a1.Id = aService.Insert(a1); a2.Id = aService.Insert(a2); MontageService mService = new MontageService(); Montage m1 = new Montage { BoxId = b1.Id, AtomiserId = a2.Id, Nickname = "yolo" }; m1.Id = mService.Insert(m1); Console.ReadKey(); }
public async Task <ActionResult <Montage> > Create(Montage montage) { montage.ImageName = await SaveImage(montage.ImageFile); if (ModelState.IsValid) { _montageService.Create(montage); } return(RedirectToAction("Index")); }
public void NewEpisodeHere() { var index = Montage.Chunks.FindChunkIndex(WindowState.CurrentPosition); if (index != -1) { Montage.Chunks[index].StartsNewEpisode = !Montage.Chunks[index].StartsNewEpisode; Montage.SetChanged(); } }
public async Task <ActionResult> Edit(Montage montage) { var oldMontage = _montageService.Find(montage.Id); if (montage.ImageFile != null) { DeleteImage(oldMontage.ImageName); montage.ImageName = await SaveImage(montage.ImageFile); } if (ModelState.IsValid) { _montageService.Update(montage); return(RedirectToAction("Index")); } return(View(montage)); }
public List <Tuple <string, string> > GetListVariableOfIterator(Montage mtg) { List <Tuple <string, string> > ls = new List <Tuple <string, string> >(); ls.Add(new Tuple <string, string>(iteratorName, ExpressionType.STRUCT.ToString())); foreach (var item in mtg.symboleTabe) { if (item.Key.StartsWith(listData.name) && item.Key != listData.name) { string pattern = listData.name; Regex rgx = new Regex(pattern); string varK = rgx.Replace(item.Key, iteratorName, 1); ls.Add(new Tuple <string, string>(varK, item.Value)); } } return(ls); }
static public bool TestMain(string sourceFileName, string targetFilehtmlName, string targetFileJSName) { LogManager.logFilePath = @"C:\Users\j.folleas\Desktop\settings\logs.txt"; LogManager.EmptyLogs(); bool filemodified = false; String directoryPath = ""; for (int i = 0; i < sourceFileName.Split('\\').Length - 1; i++) { directoryPath += sourceFileName.Split('\\')[i] + '\\'; } Include.directoryPath = directoryPath; string sourceCopiedFileName = sourceFileName + ".comp"; try { File.Copy(sourceFileName, sourceCopiedFileName); } catch (Exception e) { Console.WriteLine("The file could not be read:"); Console.WriteLine(e.Message); } FileStream file = null; Scanner scn = null; Parser parser = null; Montage montage = null; PreProcessor.BDSIPath = @"C:\Users\j.folleas\Desktop\settings\SIDBTest.txt"; Program.mainMontage = PreProcessor.GetIncludeSIDB(); PreProcessor.AddIncludes(sourceCopiedFileName); // Read the document to do the precompiling phase string fileForPreCompiling = ""; try { // Open the text file using a stream reader. using (StreamReader sr = new StreamReader(sourceCopiedFileName)) { // Read the stream to a string, and write the string to the console. fileForPreCompiling = sr.ReadToEnd(); } } catch (Exception e) { Console.WriteLine("The file could not be read:"); Console.WriteLine(e.Message); } try { file = new FileStream(sourceFileName, FileMode.Open); scn = new Scanner(file); parser = new Parser(scn); Program.mainMontage.SetCoreFromOther(new Montage()); parser.montage = Program.mainMontage; parser.montage.AddSymboleFromPreCompile(fileForPreCompiling); parser.Parse(); montage = parser.montage; if (montage != null && !montage.errorList.Any() && !scn.hasErrors) { montage.WriteInFiles(targetFilehtmlName, targetFileJSName); Console.WriteLine("No Error!"); filemodified = true; } else { montage.PrintErrors(); } } catch (FileNotFoundException exnotfound) { Console.WriteLine(exnotfound.Message); } finally { file.Close(); } try { File.Delete(sourceCopiedFileName); } catch (Exception e) { Console.WriteLine("The file could not be read:"); Console.WriteLine(e.Message); } LogManager.DisplayLogs(); return(filemodified); }
static public Montage CompileMain(string sourceFileName, string targetFilehtmlName, string targetFileJSName, bool launch = true) { Montage resultMontage = new Montage(); LogManager.logFilePath = @"C:\Users\j.folleas\Desktop\settings\logs.txt"; LogManager.EmptyLogs(); String directoryPath = ""; for (int i = 0; i < sourceFileName.Split('\\').Length - 1; i++) { directoryPath += sourceFileName.Split('\\')[i] + '\\'; } Include.directoryPath = directoryPath; // We make a copy of the source file in order to return it // with all include into a single file string sourceCopiedFileName = sourceFileName + ".comp"; try { File.Copy(sourceFileName, sourceCopiedFileName); } catch (Exception e) { LogManager.AddLog("The main src file could not be read:"); LogManager.AddLog(e.Message); } FileStream file = null; Scanner scn = null; Parser parser = null; Montage montage = null; PreProcessor.BDSIPath = @"C:\Users\j.folleas\Desktop\settings\SIDB.txt"; mainMontage = PreProcessor.GetIncludeSIDB(); PreProcessor.AddIncludes(sourceCopiedFileName); // And of mae all include // Read the document to do the precompiling phase string fileForPreCompiling = ""; try { // Open the text file using a stream reader. using (StreamReader sr = new StreamReader(sourceFileName, true)) { // Read the stream to a string, and write the string to the console. fileForPreCompiling = sr.ReadToEnd(); } } catch (Exception e) { LogManager.AddLog("The main file comp could not be read:"); LogManager.AddLog(e.Message); } try { file = new FileStream(sourceFileName, FileMode.Open); scn = new Scanner(file, "GUESS"); parser = new Parser(scn); //Empty the core of the montage, now it only contain the declaration and // the affectations mainMontage.SetCoreFromOther(new Montage()); parser.montage = mainMontage; parser.montage.AddSymboleFromPreCompile(fileForPreCompiling); parser.Parse(); montage = parser.montage; Console.WriteLine("FIN DE LECTURE DU CODE "); Console.WriteLine(); if (montage != null && !montage.errorList.Any() && !scn.hasErrors && !PreProcessor.includesHasErros) { LogManager.AddLog("Compilation principale à réussie"); if (launch) { montage.WriteInFiles(targetFilehtmlName, targetFileJSName); System.Diagnostics.Process.Start(targetFilehtmlName); } resultMontage = montage; } else { LogManager.AddLog(montage.WriteErrors()); } } catch (FileNotFoundException exnotfound) { LogManager.AddLog("Lors de l'analyse du source"); LogManager.AddLog(exnotfound.Message); } finally { file.Close(); } try { File.Delete(sourceCopiedFileName); } catch (Exception e) { Console.WriteLine("When we try to delete the copied main src file:"); Console.WriteLine(e.Message); } return(resultMontage); }
public ObjectsModel(Montage m) { mainNode = GameObject.Find("MainNode"); _montage = m; }
public void SetChunkMode(Mode mode, bool ctrl) { SetChunkMode(WindowState.CurrentPosition, mode, ctrl); Montage.SetChanged(); }
public void Update(Montage montage) => _montages.ReplaceOne(sub => sub.Id == montage.Id, montage);
public Montage Create(Montage montage) { _montages.InsertOne(montage); return(montage); }