public AdminWindow() { InitializeComponent(); words w = new words(); w.initialize(); }
public void writeWords(string w, string s, string tran) { index++; Array.Resize <int>(ref ID, (index)); Array.Resize <string>(ref word, (index)); Array.Resize <string>(ref status, (index)); Array.Resize <string>(ref translation, (index)); ID[index - 1] = index - 1; word[index - 1] = w; status[index - 1] = s; translation[index - 1] = tran; words wordd = new words(); wordd.index = index; wordd.ID = ID; wordd.word = word; wordd.status = status; wordd.translation = translation; String dir = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments); dir += "\\ArslanSoftware\\"; XmlSerializer serializer = new XmlSerializer(typeof(words)); using (TextWriter textWriter = new StreamWriter(dir + "words.xml")) { serializer.Serialize(textWriter, wordd); } }
public UserWindow(string un) { InitializeComponent(); username u = new username(); u.setname(un); u.writer(); words w = new words(); w.initialize(); }
public void ask() { words w = new words(); w.initialize(); q: Random rand = new Random(); int index = rand.Next(0, w.index); if (qns(index)) { ques = index; } else { goto q; } int indexa = rand.Next(0, 5); answer[indexa] = index; int c = 0; do { if (c != indexa) { e: int y = rand.Next(0, w.index); if (y != index) { if (ans(y)) { answer[c] = y; c++; } else { goto e; } } else { goto e; } } else { c++; } } while (c < 5); }
public void initialize() { String dir = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments); dir += "\\ArslanSoftware\\"; if (File.Exists(dir + "words.xml")) { words w = new words(); XmlSerializer deserializer = new XmlSerializer(typeof(words)); using (TextReader textReader = new StreamReader(dir + "words.xml")) { w = (words)deserializer.Deserialize(textReader); } index = w.index; ID = w.ID; word = w.word; translation = w.translation; status = w.status; } else { index = 10; ID = new int[index]; word = new string[index]; translation = new string[index]; status = new string[index]; ID[0] = 0; word[0] = "dictionary"; status[0] = "noun"; translation[0] = "словарь"; ID[1] = 1; word[1] = "know"; status[1] = "verb"; translation[1] = "знать"; ID[2] = 2; word[2] = "hair"; status[2] = "noun"; translation[2] = "волос"; ID[3] = 3; word[3] = "theme"; status[3] = "noun"; translation[3] = "тема"; ID[4] = 4; word[4] = "team"; status[4] = "noun"; translation[4] = "команда"; ID[5] = 5; word[5] = "beauty"; status[5] = "noun"; translation[5] = "красота"; ID[6] = 6; word[6] = "father"; status[6] = "noun"; translation[6] = "отец"; ID[7] = 7; word[7] = "file"; status[7] = "noun"; translation[7] = "файл"; ID[8] = 8; word[8] = "paper"; status[8] = "noun"; translation[8] = "бумага"; ID[9] = 9; word[9] = "news"; status[9] = "noun"; translation[9] = "новости"; words w = new words(); w.index = index; w.ID = ID; w.word = word; w.status = status; w.translation = translation; XmlSerializer serializer = new XmlSerializer(typeof(words)); using (TextWriter textWriter = new StreamWriter(dir + "words.xml")) { serializer.Serialize(textWriter, w); } } }