public static void CrashProcedure(Exception e) { StreamWriter crashLog = new StreamWriter("crash.txt", true); crashLog.WriteLine(e.ToString()); crashLog.Close(); Console.WriteLine("Editor crash: " + e.ToString() + "\n"); MessageBox.Show("ѕроизошел непредвиденный сбой в работе редактора.\n—ейчас произойдет завершение работы клиента (если запущен),\n и будет предложено сохранить изменени¤ (если есть).", "—бой", MessageBoxButtons.OK, MessageBoxIcon.Error); try { if (ClientLoader.m_clientProcess != null) { if (ClientLoader.m_clientProcess.HasExited == false) { ClientLoader.m_clientProcess.Kill(); } } } catch (System.ComponentModel.Win32Exception w) { Console.WriteLine("Can't close client: " + w.Message); } ClientMySQL mySql = new ClientMySQL(); HistoryProcessor.GetHProcessor().ProcessHistory(mySql, true); }
public override TestIteration GetNext() { var tuple = (Tuple <TestIteration, string>)HistoryProcessor.Next(); if (tuple != null) { Debug.WriteLine("Next from history"); _currentAnswer = tuple.Item2; return(tuple.Item1); } Debug.WriteLine("New next"); var test = new TestIteration(); KeyValuePair <string, string> pair = GetRandomPair(); _currentAnswer = pair.Value; test.Question = pair.Key; var variantes = new string[4]; test.Variantes = variantes; variantes[Randomize.GetNext(4)] = pair.Value; for (int i = 0; i < 4; i++) { if (String.IsNullOrEmpty(variantes[i])) { var s = GetRandomPair().Value; while (variantes.Contains(s)) { s = GetRandomPair().Value; } variantes[i] = s; } } HistoryProcessor.Add(Tuple.Create(test, _currentAnswer)); return(test); }
public ArrayList GetResoursesPaths() { if (m_resPaths == null) { // пройтись по истории и найти изначальное им¤ %) HistoryProcessor hproc = HistoryProcessor.GetHProcessor(); byte libFlag; String objectParent = hproc.FindObjectParent(m_objectName, out libFlag); String queryStr = ""; if (libFlag == 0) { queryStr = "SELECT `res` FROM `objects_map` WHERE `name`='" + objectParent + "'"; } else { queryStr = "SELECT `res` FROM `objects_lib` WHERE `id`='" + objectParent + "'"; } ArrayList queryResult = m_mySql.QueryA(queryStr); if (queryResult == null) { m_resPaths = new ArrayList(); m_resPaths.Add(GetGeometryPath() + "common"); } else { if (((Hashtable)(queryResult[0]))["res"] != null) { String objectRes = (String)((Hashtable)(queryResult[0]))["res"]; // пути к ресурсам m_resPaths = new ArrayList(); String[] splittedRes = objectRes.Split(';'); for (int splitItemIndex = 0; splitItemIndex < splittedRes.Length; splitItemIndex++) { if (splitItemIndex % 3 == 0) { if (splittedRes[splitItemIndex] == "") { break; } m_resPaths.Add(GetGeometryPath() + splittedRes[splitItemIndex].Substring(0, splittedRes[splitItemIndex].IndexOf("\\mesh.bmf.zip"))); } } } } } return(m_resPaths); }
public override string GetPrev() { var tuple = (Tuple <string, string>)HistoryProcessor.Prev(); if (tuple != null) { _currentAnswer = tuple.Item2; return(tuple.Item1); } return(null); }
public MainWindow() { InitializeComponent(); HexProcessor = new HexProcessor(); BinaryProcessor = new BinaryProcessor(); IntegerProcessor = new IntegerProcessor(); HistoryProcessor = new HistoryProcessor(); ReadFromClipboard(); }
public GroupForm() { groupId = -1; InitializeComponent(); m_mySql = new ClientMySQL(); m_mySql.Connect(); m_commander = Commander.GetCommander(); point = new Vector(); m_storage = HistoryProcessor.GetHProcessor(); }
public override TestIteration GetPrev() { var tuple = (Tuple <TestIteration, string>)HistoryProcessor.Prev(); if (tuple != null) { Debug.WriteLine("Prev from history"); _currentAnswer = tuple.Item2; return(tuple.Item1); } return(null); }
public override string GetNext() { var tuple = (Tuple <string, string>)HistoryProcessor.Next(); if (tuple != null) { _currentAnswer = tuple.Item2; return(tuple.Item1); } var pair = GetRandomPair(); _currentAnswer = pair.Key; HistoryProcessor.Add(Tuple.Create(pair.Value, pair.Key)); return(pair.Value); }
public void LoadFromHistoryWithInitializerEvent() { IEventStore store = new TestEventStore(); Guid id = Guid.NewGuid(); const int anIntValue = 19; store.Save(new List <EventStoreStream> { new EventStoreStream(new StreamIdentifier(typeof(TestAggregate).Name, id), new IEvent[] { new TestInitializationEvent(anIntValue), new TestEvent() }) }); HistoryProcessor processor = new HistoryProcessor(); IRepository repo = new Repository(store, processor); TestAggregate aggregate = repo.GetById <TestAggregate>(id); Assert.That(aggregate.InitialState, Is.EqualTo(anIntValue)); Assert.That(aggregate.StateUpdated, Is.True); }