public override bool Equals(object p_value) { if (p_value == this) { return(true); } if (!AOTHelper.IsNull(p_value)) { try { AOTKeyValuePair <TKey, TValue> v_castedObject = p_value as AOTKeyValuePair <TKey, TValue>; if (v_castedObject != null) { #pragma warning disable 618 if (((AOTHelper.IsNull(v_castedObject.Key) && AOTHelper.IsNull(this.Key)) || v_castedObject.Comparer.Equals(this.Key)) && #pragma warning restore 618 ((AOTHelper.IsNull(v_castedObject.Value) && AOTHelper.IsNull(this.Value)) || v_castedObject.Value.Equals(this.Value))) { return(true); } } } catch { } } return(false); }
public bool AOTCompileProgram(ProgramInformation program) { bool ok = true; lock (this) { if (!program.IsRunning) { foreach (var file in program.DllFiles) { if (!AOTHelper.Compile(System.IO.Path.Combine(program.Path, file))) { ok = false; break; } } ok = AOTHelper.Compile(program.ExeFile); } else { ok = false; } } return(ok); }
public static void UnmergeList <T>(this List <T> p_list, List <T> p_otherList) { if (p_otherList != null) { List <T> v_dummyList = new List <T>(); for (int i = 0; i < p_list.Count; i++) //foreach(T v_object in p_otherList) { T v_object = p_list[i]; if (!p_otherList.Contains(v_object)) { v_dummyList.Add(v_object); } } p_list.Clear(); for (int i = 0; i < v_dummyList.Count; i++) { try { T v_object = v_dummyList[i]; if (!AOTHelper.IsNull(v_object)) { p_list.Add(v_object); } } catch { UnityEngine.Debug.Log("An error occurred when trying to UnmergeList"); } } } }
public static int ObjectIndex <T>(this List <T> p_list, T p_object) { for (int i = 0; i < p_list.Count; i++) { if (AOTHelper.Equals(p_list[i], p_object)) { return(i); } } return(-1); }
public int ObjectIndex(T p_object) { for (int i = 0; i < this.Count; i++) { if (AOTHelper.Equals(this[i], p_object)) { return(i); } } return(-1); }
public bool ContainsNull() { for (int i = 0; i < this.Count; i++) { object v_object = this[i]; if (AOTHelper.IsNull(v_object)) { return(true); } } return(false); }
public TAOTPair GetPairByValue(TValue p_value) { foreach (TAOTPair v_pairValues in this) { try { if (AOTHelper.Equals(v_pairValues.Value, p_value)) { return(v_pairValues); } } catch { } } return(default(TAOTPair)); }
public bool ContainsValue(TValue p_value) { foreach (TAOTPair v_pairValue in this) { try { if (AOTHelper.Equals(v_pairValue.Value, p_value)) { return(true); } } catch { } } return(false); }
public bool ContainsKey(TKey p_key) { foreach (TAOTPair v_pairValue in this) { try { if (AOTHelper.Equals(v_pairValue.Key, p_key)) { return(true); } } catch { } } return(false); }
static bool AOTCompileAndShowDialog(string programFolder) { List <IStep> steps = new List <IStep> (); foreach (string file in Directory.EnumerateFiles(programFolder, "*.*").Where(s => s.EndsWith(".exe") || s.EndsWith(".dll"))) { steps.Add(new StepContainer(delegate() { return(AOTHelper.Compile(file)); }, new FileInfo(file).Name, "Failed to compile")); } var dialog = new StepDialog("Compiling", steps); return(dialog.Show()); }
public TAOTPair GetPairByKey(TKey p_key) { foreach (TAOTPair v_pairValues in this) { try { if (AOTHelper.Equals(v_pairValues.Key, p_key)) { //if(p_key.Equals(v_pairValues.Comparer)) return(v_pairValues); } } catch { } } return(default(TAOTPair)); }
public TKey GetKeyByValue(TValue p_value) { foreach (TAOTPair v_pairValues in this) { try { if (AOTHelper.Equals(v_pairValues.Value, p_value)) { //if(p_value.Equals(v_pairValues.Object)) return(v_pairValues.Key); } } catch { } } return(default(TKey)); }
public AOTList <TValue> GetAllValueByKey(TKey p_key) { AOTList <TValue> v_values = new AOTList <TValue> (); foreach (TAOTPair v_pairValues in this) { try { if (AOTHelper.Equals(v_pairValues.Key, p_key)) { //if(p_key.Equals(v_pairValues.Comparer)) v_values.Add(v_pairValues.Value); } } catch { } } return(v_values); }
public bool RemoveByKey(TKey p_key) { TAOTPair v_removePair = default(TAOTPair); foreach (TAOTPair v_pairValue in this) { try { if (AOTHelper.Equals(v_pairValue.Key, p_key)) { v_removePair = v_pairValue; break; } } catch { } } return(this.RemoveChecking(v_removePair)); }
public bool RemoveChecking(TValue p_value) { TAOTPair v_removePair = default(TAOTPair); foreach (TAOTPair v_pairValue in this) { try { if (AOTHelper.Equals(v_pairValue.Value, p_value)) { v_removePair = v_pairValue; break; } } catch { } } return(this.RemoveChecking(v_removePair)); }
public void RemoveNulls() { AOTList <T> v_newList = new AOTList <T>(); for (int i = 0; i < this.Count; i++) { T v_object = this[i]; if (!AOTHelper.IsNull(v_object)) { v_newList.Add(v_object); } } this.Clear(); foreach (T v_object in v_newList) { this.AddWithoutCallEvents(v_object); } }
/// <summary> /// Returns 'true' if the specified item is within the list. /// </summary> public bool Contains(T item) { if (buffer == null) { return(false); } for (int i = 0; i < Count; ++i) { if ( (AOTHelper.IsNull(buffer[i]) && AOTHelper.IsNull(item)) || (!AOTHelper.IsNull(buffer[i]) && buffer[i].Equals(item)) ) { return(true); } } return(false); }
public static bool AddChecking <T>(this List <T> p_list, T p_object) { bool v_sucess = false; try { if (p_list != null && !AOTHelper.IsNull(p_object) && !p_list.Contains(p_object)) { p_list.Add(p_object); v_sucess = true; } } catch { UnityEngine.Debug.Log("An error occurred when trying to AddChecking"); } return(v_sucess); }
public bool RemoveChecking(T p_object, bool p_removeNulls = true) { bool v_sucess = false; if (!AOTHelper.IsNull(p_object)) { if (p_removeNulls) { RemoveNulls(); } AOTList <T> v_newList = new AOTList <T>(); for (int i = 0; i < this.Count; i++) { try { T v_object = this[i]; if (!AOTHelper.Equals(p_object, v_object)) { v_newList.Add(v_object); } else { v_sucess = true; } } catch { UnityEngine.Debug.Log("An error occurred when trying to RemoveChecking"); v_sucess = true; } } this.Clear(); foreach (T v_object in v_newList) { this.AddWithoutCallEvents(v_object); } } if (v_sucess) { OnRemove(p_object); } return(v_sucess); }
public bool AddChecking(T p_object) { bool v_sucess = false; try { if (!AOTHelper.IsNull(p_object) && !this.Contains(p_object)) { this.Add(p_object); v_sucess = true; } } catch { UnityEngine.Debug.Log("An error occurred when trying to AddChecking"); } return(v_sucess); }
public void RemovePairsWithNullKeys() { AOTList <TAOTPair> v_newList = new AOTList <TAOTPair> (); foreach (TAOTPair v_pairValue in this) { try { if (!AOTHelper.IsNull(v_pairValue.Key)) { v_newList.Add(v_pairValue); } } catch { } } this.Clear(); foreach (TAOTPair v_pairValue in v_newList) { this.AddWithoutCallEvents(v_pairValue); } }
public static void RemoveNulls <T>(this List <T> p_list) where T : class { if (p_list != null) { List <T> v_newList = new List <T>(); for (int i = 0; i < p_list.Count; i++) { T v_object = p_list[i]; if (!AOTHelper.IsNull(v_object)) { v_newList.Add(v_object); } } p_list.Clear(); foreach (T v_object in v_newList) { p_list.Add(v_object); } } }
public void AddChecking(TKey p_key, TValue p_value) { bool v_found = false; foreach (TAOTPair v_pair in this) { try { if (AOTHelper.Equals(v_pair.Value, p_value) && AOTHelper.Equals(v_pair.Key, p_key)) { v_found = true; break; } } catch { } } if (!v_found) { Add(p_key, p_value); } }
public static bool RemoveChecking <T>(this List <T> p_list, T p_object, bool p_removeNulls = true) { bool v_sucess = false; if (p_list != null && !AOTHelper.IsNull(p_object)) { List <T> v_newList = new List <T>(); for (int i = 0; i < p_list.Count; i++) { try { T v_object = p_list[i]; if (!p_removeNulls || !AOTHelper.IsNull(v_object)) { if (!AOTHelper.Equals(p_object, v_object)) { v_newList.Add(v_object); } else { v_sucess = true; } } } catch { UnityEngine.Debug.Log("An error occurred when trying to RemoveChecking"); v_sucess = true; } } p_list.Clear(); foreach (T v_object in v_newList) { p_list.Add(v_object); } } return(v_sucess); }
public void AddReplacing(TKey p_key, TValue p_value) { bool v_found = false; for (int i = 0; i < this.Count; i++) { try { if (AOTHelper.Equals(this [i].Key, p_key)) { v_found = true; TAOTPair v_pair = new TAOTPair(); v_pair.Value = p_value; v_pair.Key = p_key; this [i] = v_pair; break; } } catch { } } if (!v_found) { Add(p_key, p_value); } }
static bool ShowProgramOptions(string programFolder) { string fileName = ""; try { fileName = Directory.EnumerateFiles(programFolder, "*.exe").First(); } catch { var info = new InfoDialog(programFolder + "is not executable", true, "Program"); info.Show(); Directory.Delete(programFolder, true); updateProgramList = true; return(true); } var dialog = new SelectDialog <string> (new string[] { "Run Program", "Debug Program", "Run In AOT", "AOT Compile", "Delete Program", }, "Options", true); dialog.Show(); if (!dialog.EscPressed) { Action programAction = null; switch (dialog.GetSelectionIndex()) { case 0: Lcd.Instance.Clear(); Lcd.Instance.DrawBitmap(monoLogo, new Point((int)(Lcd.Width - monoLogo.Width) / 2, 5)); Rectangle textRect = new Rectangle(new Point(0, Lcd.Height - (int)Font.SmallFont.maxHeight - 2), new Point(Lcd.Width, Lcd.Height - 2)); Lcd.Instance.WriteTextBox(Font.SmallFont, textRect, "Running...", true, Lcd.Alignment.Center); Lcd.Instance.Update(); programAction = () => RunAndWaitForProgram(fileName, ExecutionMode.Normal); break; case 1: programAction = () => RunAndWaitForProgram(fileName, ExecutionMode.Debug); break; case 2: if (!AOTHelper.IsFileCompiled(fileName)) { if (AOTCompileAndShowDialog(programFolder)) { programAction = () => RunAndWaitForProgram(fileName, ExecutionMode.AOT); } } else { programAction = () => RunAndWaitForProgram(fileName, ExecutionMode.AOT); } break; case 3: if (AOTHelper.IsFileCompiled(fileName)) { var questionDialog = new QuestionDialog("Progran already compiled. Recompile?", "AOT recompile"); if (questionDialog.Show()) { AOTCompileAndShowDialog(programFolder); } } else { AOTCompileAndShowDialog(programFolder); } break; case 4: var question = new QuestionDialog("Are you sure?", "Delete"); if (question.Show()) { var step = new StepContainer(() => { Directory.Delete(programFolder, true); return(true); }, "Deleting ", "Error deleting program"); var progressDialog = new ProgressDialog("Program", step); progressDialog.Show(); updateProgramList = true; } break; } if (programAction != null) { Console.WriteLine("Starting application"); programAction(); Console.WriteLine("Done running application"); } return(updateProgramList); } return(false); }