public void Delete(Int32 index) { if (index > _quests.Length) { throw new IndexOutOfRangeException(); } Qst[] nQsts = new Qst[NumOfQuests - 1]; for (int i = 0, space = 0; i < NumOfQuests - 1; i++, space++) { nQsts[i] = new Qst(); if (i == index) { space++; } nQsts[i].Name = _quests[space].Name; nQsts[i].Description = _quests[space].Description; nQsts[i].DifficultyLevel = _quests[space].DifficultyLevel; nQsts[i].LevelOfFear = _quests[space].LevelOfFear; nQsts[i].MaxPlayers = _quests[space].MaxPlayers; nQsts[i].MaxPrice = _quests[space].MaxPrice; nQsts[i].MaxTime = _quests[space].MaxTime; nQsts[i].MinAge = _quests[space].MinAge; nQsts[i].MinPlayers = _quests[space].MinPlayers; nQsts[i].MinPrice = _quests[space].MinPrice; nQsts[i].NameOfTheOrganizer = _quests[space].NameOfTheOrganizer; nQsts[i].Rating = _quests[space].Rating; } NumOfQuests--; _quests = nQsts; Sort(); }
public void WriteQuest(Qst quest) { using (FileStream stream = new FileStream("Quest.bin", FileMode.OpenOrCreate, FileAccess.ReadWrite, FileShare.None)) { BinaryWriter writer = new BinaryWriter(stream, Encoding.Default); writer.Write(quest + "\n"); writer.Dispose(); } }
public void WriteQuest(Qst quest) { using (FileStream stream = new FileStream("Quest.txt", FileMode.OpenOrCreate, FileAccess.ReadWrite, FileShare.None)) { StreamWriter writer = new StreamWriter(stream); writer.AutoFlush = true; writer.WriteLine(quest.ToString()); writer.Dispose(); } }
public Object Clone() { Qst nqst = new Qst(); nqst.Description = Description; nqst.DifficultyLevel = DifficultyLevel; nqst.LevelOfFear = LevelOfFear; nqst.MaxPlayers = MaxPlayers; nqst.MaxPrice = MaxPrice; nqst.MaxTime = MaxTime; nqst.MinAge = MinAge; nqst.MinPlayers = MinPlayers; nqst.MinPrice = MinPrice; nqst.Name = Name; nqst.NameOfTheOrganizer = NameOfTheOrganizer; nqst.Rating = Rating; return(nqst); }
public void Add(String name, String description, int minPlayers, int maxPlayers, int maxTime, int minPrice, int maxPrice, int difficultyLevel, int levelOfFear, int minAge, double rating, String nameOfTheOrganizer) { Qst[] nquests = new Qst[NumOfQuests + 1]; for (int i = 0; i < NumOfQuests; i++) { nquests[i] = new Qst(); nquests[i].Description = _quests[i].Description; nquests[i].DifficultyLevel = _quests[i].DifficultyLevel; nquests[i].LevelOfFear = _quests[i].LevelOfFear; nquests[i].MaxPlayers = _quests[i].MaxPlayers; nquests[i].MaxPrice = _quests[i].MaxPrice; nquests[i].MaxTime = _quests[i].MaxTime; nquests[i].MinAge = _quests[i].MinAge; nquests[i].MinPlayers = _quests[i].MinPlayers; nquests[i].MinPrice = _quests[i].MinPrice; nquests[i].Name = _quests[i].Name; nquests[i].NameOfTheOrganizer = _quests[i].NameOfTheOrganizer; nquests[i].Rating = _quests[i].Rating; } nquests[NumOfQuests] = new Qst(); nquests[NumOfQuests].Description = description; nquests[NumOfQuests].DifficultyLevel = difficultyLevel; nquests[NumOfQuests].LevelOfFear = levelOfFear; nquests[NumOfQuests].MaxPlayers = maxPlayers; nquests[NumOfQuests].MaxPrice = maxPrice; nquests[NumOfQuests].MaxTime = maxTime; nquests[NumOfQuests].MinAge = minAge; nquests[NumOfQuests].MinPlayers = minPlayers; nquests[NumOfQuests].MinPrice = minPrice; nquests[NumOfQuests].Name = name; nquests[NumOfQuests].NameOfTheOrganizer = nameOfTheOrganizer; nquests[NumOfQuests].Rating = rating; _quests = nquests; NumOfQuests++; Sort(); }