private void openFilesForEdition() { FormDefine defineFilePath = new FormDefine(LocRM.GetString("audioList", currentCulture), FileManipulation._listFolderName, "dir", "_audio", true, false); var result = defineFilePath.ShowDialog(); if (result == DialogResult.OK) { isListNameValid = true; string choosenList = defineFilePath.ReturnValue; if (choosenList == "") { isListNameValid = false; return; } // removes the _audio identification from file while editing (when its saved it is always added again) audioListNameTextBox.Text = choosenList; audioList = new StrList(choosenList, AUDIO); string[] filePaths = audioList.ListContent.ToArray(); DGVManipulation.ReadStringListIntoDGV(filePaths, audioPathDataGridView); numberFiles.Text = audioPathDataGridView.RowCount.ToString(); } }
private void ZDesselecionarTodos_Click(object sender, EventArgs e) { for (int i = 0; i < StrList.Items.Count; i++) { StrList.SetItemChecked(i, false); } }
public override bool Run(bool bAppend = false) { if (!System.IO.File.Exists(FilePath)) { return(false); } if (StrList == null) { StrList = new List <String>(); } else { StrList.Clear(); } using (StreamReader reader = System.IO.File.OpenText(FilePath)) { string line; while ((line = reader.ReadLine()) != null) { StrList.Add(line); } } return(true); }
private bool saveListFile(List <string> list, string fileName, string fileType, string type) { if ((MessageBox.Show(LocRM.GetString("wishToSave", currentCulture) + type + " '" + fileName + "' ?", "", MessageBoxButtons.OKCancel, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1) == DialogResult.OK)) { StrList strlist = ListController.CreateList(list, fileName, fileType); if (strlist.exists()) { DialogResult dialogResult = MessageBox.Show(LocRM.GetString("listExists", currentCulture), "", MessageBoxButtons.OKCancel); if (dialogResult == DialogResult.Cancel) { MessageBox.Show(LocRM.GetString("listNotSaved", currentCulture)); return(false); } } if (strlist.save()) { MessageBox.Show(LocRM.GetString("list", currentCulture) + fileName + LocRM.GetString("listSaveSuccess", currentCulture)); } return(true); } else { return(false); } }
private void UnselectAll_Click(object sender, EventArgs e) { for (int i = 0; i < StrList.Items.Count; i++) { StrList.SetItemChecked(i, false); } }
static public int constructor(IntPtr l) { try { int argc = LuaDLL.lua_gettop(l); StrList o; if (argc == 1) { o = new StrList(); pushValue(l, true); pushValue(l, o); return(2); } else if (argc == 2) { System.Collections.Generic.IEnumerable <System.String> a1; checkType(l, 2, out a1); o = new StrList(a1); pushValue(l, true); pushValue(l, o); return(2); } return(error(l, "New object failed.")); } catch (Exception e) { return(error(l, e)); } }
public void TestWordListExists() { List <string> list = new List <string>(wordList); StrList strList = new StrList(list, "padrao", "_words"); Assert.IsTrue(strList is StrList); }
public void StrListObjectTest() { List <string> list = new List <string>(new string[] { "element1", "element2", "element3" }); StrList strList = new StrList(list, "list"); Assert.IsTrue(strList is StrList); }
public void TestCreateWrongListType() { string listName = "list"; string wrongType = "wrong type"; List <string> list = new List <string>(new string[] { "element1", "element2", "element3" }); StrList actualStrList = new StrList(list, listName, wrongType); }
static public int Reverse(IntPtr l) { try { int argc = LuaDLL.lua_gettop(l); if (argc == 1) { StrList self = (StrList)checkSelf(l); self.Reverse(); pushValue(l, true); return(1); } else if (argc == 3) { StrList self = (StrList)checkSelf(l); System.Int32 a1; checkType(l, 2, out a1); System.Int32 a2; checkType(l, 3, out a2); self.Reverse(a1, a2); pushValue(l, true); return(1); } pushValue(l, false); LuaDLL.lua_pushstring(l, "No matched override function to call"); return(2); } catch (Exception e) { return(error(l, e)); } }
private void openFilesForEdition() { try { FormDefine defineFilePath = new FormDefine(LocRM.GetString("wordList", currentCulture), FileManipulation._listFolderName, "lst", "_words_color", true, false); var result = defineFilePath.ShowDialog(); if (result == DialogResult.OK) { isListNameValid = true; string fileName = defineFilePath.ReturnValue; if (fileName == "") { isListNameValid = false; return; } fileName = fileName.Remove(fileName.Length - 6); listNameTextBox.Text = fileName; string wFile = FileManipulation._listFolderName + "/" + fileName + "_words.lst"; string cFile = FileManipulation._listFolderName + "/" + fileName + "_color.lst"; if (!File.Exists(wFile) && !File.Exists(cFile)) { return; } if (File.Exists(wFile)) { string[] wordsArray = StrList.readListFile(wFile); foreach (string word in wordsArray) { wordsList.Add(word); } wordsListCheckBox.Checked = true; } if (File.Exists(cFile)) { string[] colorsArray = StrList.readListFile(cFile); foreach (string color in colorsArray) { colorsList.Add(color); } colorsListCheckBox.Checked = true; } addItems(); } else { wordsListCheckBox.Checked = true; colorsListCheckBox.Checked = true; } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
public void ReadStandardWordListTest() { string[] expected = wordList; string[] actual = StrList.readListFile(listsPath + "padrao_words.lst"); Assert.AreEqual(expected[0], actual[0]); Assert.AreEqual(expected[1], actual[1]); Assert.AreEqual(expected[2], actual[2]); Assert.AreEqual(expected[3], actual[3]); }
public void TestInitialize() { listsPath = Global.testFilesPath + Global.listFolderName; StrList.writeDefaultColorsList(listsPath); StrList.writeDefaultWordsList(listsPath); List <string> list = new List <string>(new string[] { "element1", "element2", "element3" }); testList = new StrList(list, "test", "_words"); }
public void TestStrListConstructor() { string listName = "list"; string listType = "_words"; List <string> list = new List <string>(new string[] { "element1", "element2", "element3" }); StrList actualStrList = new StrList(list, listName, listType); Assert.IsTrue(actualStrList is StrList); Assert.AreEqual(listName, actualStrList.ListName); Assert.AreEqual(listType, actualStrList.Type); }
public void TestInitialize() { Thread.CurrentThread.CurrentCulture = new CultureInfo("pt-BR"); System.Threading.Thread.CurrentThread.CurrentUICulture = CultureInfo.CreateSpecificCulture("pt-BR"); listsPath = Global.testFilesPath + Global.listFolderName; StrList.writeDefaultColorsList(listsPath); StrList.writeDefaultWordsList(listsPath); List <string> list = new List <string>(new string[] { "element1", "element2", "element3" }); testList = new StrList(list, "test", "_words"); }
private void textBox1_TextChanged(object sender, EventArgs e) { for (int i = 0; i < StrList.Items.Count; i++) { if (StrList.Items[i].ToString().ToLower().Contains(Pesquisar.Text.ToLower())) { StrList.SetSelected(i, true); break; } } }
private void StrList_MouseStopOver(object sender, MouseEventArgs e) { if (!ZScriptRef.Checked) { return; } int i = StrList.IndexFromPoint(e.Location); string Reference = RefScript[i]; Engine.ShowToolTip(Engine.LocationCalc(e.Location, 0, (Cursor.Current.Size.Height / 2)), Reference, Engine.LoadTranslation(Engine.TLID.Reference)); }
static public int get_Count(IntPtr l) { try { StrList self = (StrList)checkSelf(l); pushValue(l, true); pushValue(l, self.Count); return(2); } catch (Exception e) { return(error(l, e)); } }
static public int TrimExcess(IntPtr l) { try { StrList self = (StrList)checkSelf(l); self.TrimExcess(); pushValue(l, true); return(1); } catch (Exception e) { return(error(l, e)); } }
static public int AsReadOnly(IntPtr l) { try { StrList self = (StrList)checkSelf(l); var ret = self.AsReadOnly(); pushValue(l, true); pushValue(l, ret); return(2); } catch (Exception e) { return(error(l, e)); } }
public void Init() { m_DataChangeCallBackInfoPool.Init(null, null); StrList strlist = new StrList(); strlist.Add(string.Empty); strlist.Sort((a, b) => a.CompareTo(b)); List <int> intlist = new List <int>(); intlist.Add(1); intlist.Sort((a, b) => a.CompareTo(b)); int aa = null != strlist ? strlist.Count : intlist.Count; }
static public int ForEach(IntPtr l) { try { StrList self = (StrList)checkSelf(l); System.Action <System.String> a1; LuaDelegation.checkDelegate(l, 2, out a1); self.ForEach(a1); pushValue(l, true); return(1); } catch (Exception e) { return(error(l, e)); } }
static public int RemoveAt(IntPtr l) { try { StrList self = (StrList)checkSelf(l); System.Int32 a1; checkType(l, 2, out a1); self.RemoveAt(a1); pushValue(l, true); return(1); } catch (Exception e) { return(error(l, e)); } }
static public int BinarySearch(IntPtr l) { try { int argc = LuaDLL.lua_gettop(l); if (argc == 2) { StrList self = (StrList)checkSelf(l); System.String a1; checkType(l, 2, out a1); var ret = self.BinarySearch(a1); pushValue(l, true); pushValue(l, ret); return(2); } else if (argc == 3) { StrList self = (StrList)checkSelf(l); System.String a1; checkType(l, 2, out a1); System.Collections.Generic.IComparer <System.String> a2; checkType(l, 3, out a2); var ret = self.BinarySearch(a1, a2); pushValue(l, true); pushValue(l, ret); return(2); } else if (argc == 5) { StrList self = (StrList)checkSelf(l); System.Int32 a1; checkType(l, 2, out a1); System.Int32 a2; checkType(l, 3, out a2); System.String a3; checkType(l, 4, out a3); System.Collections.Generic.IComparer <System.String> a4; checkType(l, 5, out a4); var ret = self.BinarySearch(a1, a2, a3, a4); pushValue(l, true); pushValue(l, ret); return(2); } pushValue(l, false); LuaDLL.lua_pushstring(l, "No matched override function to call"); return(2); } catch (Exception e) { return(error(l, e)); } }
static public int AddRange(IntPtr l) { try { StrList self = (StrList)checkSelf(l); System.Collections.Generic.IEnumerable <System.String> a1; checkType(l, 2, out a1); self.AddRange(a1); pushValue(l, true); return(1); } catch (Exception e) { return(error(l, e)); } }
static public int Sort(IntPtr l) { try { int argc = LuaDLL.lua_gettop(l); if (argc == 1) { StrList self = (StrList)checkSelf(l); self.Sort(); pushValue(l, true); return(1); } else if (matchType(l, argc, 2, typeof(System.Comparison <System.String>))) { StrList self = (StrList)checkSelf(l); System.Comparison <System.String> a1; LuaDelegation.checkDelegate(l, 2, out a1); self.Sort(a1); pushValue(l, true); return(1); } else if (matchType(l, argc, 2, typeof(IComparer <System.String>))) { StrList self = (StrList)checkSelf(l); System.Collections.Generic.IComparer <System.String> a1; checkType(l, 2, out a1); self.Sort(a1); pushValue(l, true); return(1); } else if (argc == 4) { StrList self = (StrList)checkSelf(l); System.Int32 a1; checkType(l, 2, out a1); System.Int32 a2; checkType(l, 3, out a2); System.Collections.Generic.IComparer <System.String> a3; checkType(l, 4, out a3); self.Sort(a1, a2, a3); pushValue(l, true); return(1); } pushValue(l, false); LuaDLL.lua_pushstring(l, "No matched override function to call"); return(2); } catch (Exception e) { return(error(l, e)); } }
static public int set_Capacity(IntPtr l) { try { StrList self = (StrList)checkSelf(l); int v; checkType(l, 2, out v); self.Capacity = v; pushValue(l, true); return(1); } catch (Exception e) { return(error(l, e)); } }
public void Init() { string[] items = { "全部", "进行中", "可接取", "已完成", "未获取" }; m_DataChangeCallBackInfoPool.Init(32, () => { return(new DataChangeCallBackInfo()); }, v => { }); StrList strlist = new StrList(); strlist.Add(string.Empty); strlist.Sort((a, b) => a.CompareTo(b)); List <int> intlist = new List <int>(); intlist.Add(1); var sa = strlist[0]; intlist.Sort((a, b) => a.CompareTo(b)); int iaa = null != strlist ? strlist.Count : intlist.Count; int[] aa = new int[] { 1, 2, 3, 4, 5 }; int[,] bb = new int[, ] { { 1, 2 }, { 3, 4 }, { 5, 6 } }; var ia = bb[0, 1]; foreach (var s in strlist) { Console.WriteLine(s); } foreach (var v in aa) { Console.WriteLine(v); } foreach (var v in bb) { Console.WriteLine(v); } var act = (Action)(() => { Console.Write(ia); }); var cc = ToList(aa); List <Vector3> v3list = new List <Vector3>(); v3list.Add(Vector3.zero); Vector3List nv3list = new Vector3List(); nv3list.Add(Vector3.zero); var v3 = nv3list[0]; nv3list[0] = v3; var vv3 = ToArray(nv3list)[0]; ToArray(nv3list)[0] = vv3; }
static public int getItem(IntPtr l) { try { StrList self = (StrList)checkSelf(l); int v; checkType(l, 2, out v); var ret = self[v]; pushValue(l, true); pushValue(l, ret); return(2); } catch (Exception e) { return(error(l, e)); } }
static public int TrueForAll(IntPtr l) { try { StrList self = (StrList)checkSelf(l); System.Predicate <System.String> a1; LuaDelegation.checkDelegate(l, 2, out a1); var ret = self.TrueForAll(a1); pushValue(l, true); pushValue(l, ret); return(2); } catch (Exception e) { return(error(l, e)); } }