/// <summary> /// Constructs a new instance of the <see cref="Globals"/> class. /// </summary> private Globals() { //Initialize the variables string path = GetAppPath(); try { //If the application cannot write to its local path then it will attempt //to write in the personal path of the current user, under Application Data FileStream fs = File.Create(path + "test.dat"); fs.Close(); File.Delete(path + "test.dat"); } catch { path = System.Environment.GetFolderPath(System.Environment.SpecialFolder.ApplicationData) + "\\CrawlWave\\"; } appPath = String.Intern(path); logEventSource = String.Intern("CrawlWave.ClientScheduler"); logFileName = String.Intern(appPath + "CrawlWave.ClientScheduler.log"); settings = new ClientSettings(appPath + "data\\CrawlWave.Client.config.xml"); settings.LoadSettings(); clientInfo = new ClientInfo(); clientInfo.UserID = settings.UserID; clientInfo.ClientID = settings.ClientID; clientInfo.Version = Assembly.GetExecutingAssembly().GetName().Version.ToString(); systemLog = new SystemEventLogger(logEventSource); fileLog = new FileEventLogger(logFileName, true, logEventSource); }
private static void SolveInput(string[] args) { var input = args[0]; var eventLogger = new FileEventLogger(input.Replace(",", "")); var world = WorldBuilder.CreateForExercise2(input, eventLogger); var totalTime = world.Solve(); Console.WriteLine($"Total time {totalTime}"); }
/// <summary> /// Constructs a new instance of the <see cref="PluginController"/> class. /// </summary> public PluginController() { plugins = new List <PluginBase>(); runningPlugins = 0; loggers = new ArrayList(4); FileEventLogger log = Settings.Instance().Log; if (log != null) { loggers.Add(log); } }
/// <summary> /// The constructor is private so that only the class itself can create an instance. /// </summary> private Globals() { dbProvider = DBConnectionStringProvider.Instance(); appName = "CrawlWave.ServerManager"; appPath = GetAppPath(); loadedForms = new Hashtable(8); foreach (string formName in formNames) { loadedForms.Add(formName, null); } log = new FileEventLogger(appPath + appName + ".log", true, appName); }
/// <summary> /// The constructor is private so that only the class itself can create an instance. /// </summary> private Settings() { settings = new SWSettings(); try { log = new FileEventLogger(GetPath() + "CrawlWave.ServerWorker.log", true, "CrawlWave.ServerWorker"); } catch { log = null; } LoadSettings(); }
/// <summary> /// Constructs a new instance of the <see cref="Globals"/> class. /// </summary> private Globals() { //Initialize the variables. Interning the strings saves us some memory. userAgent = String.Intern("CrawlWave/1.2 (crawlwave[at]spiderwave.aueb.gr http://www.spiderwave.aueb.gr/"); string path = GetAppPath(); try { //If the application cannot write to its local path then it will attempt //to write in the personal path of the current user, under Application Data FileStream fs = File.Create(path + "test.dat"); fs.Close(); File.Delete(path + "test.dat"); } catch { path = System.Environment.GetFolderPath(System.Environment.SpecialFolder.ApplicationData) + "\\CrawlWave\\"; } appPath = String.Intern(path); dataPath = String.Intern(path + "data\\"); workPath = String.Intern(path + "work\\"); //if the data and work directories do not exist create them if (!Directory.Exists(dataPath)) { Directory.CreateDirectory(dataPath); } if (!Directory.Exists(workPath)) { Directory.CreateDirectory(workPath); } logEventSource = String.Intern("CrawlWave"); logFileName = String.Intern(dataPath + "CrawlWave.Client.log"); settings = new ClientSettings(dataPath + "CrawlWave.Client.Config.xml"); settings.LoadSettings(); clientInfo = new ClientInfo(); clientInfo.UserID = settings.UserID; clientInfo.ClientID = settings.ClientID; clientInfo.Version = Assembly.GetExecutingAssembly().GetName().Version.ToString(); systemLog = new SystemEventLogger(logEventSource); fileLog = new FileEventLogger(logFileName, true, logEventSource); }
/// <summary> /// Invoked when the application is launched normally by the end user. Other entry points /// will be used such as when the application is launched to open a specific file. /// </summary> /// <param name="e">Details about the launch request and process.</param> protected override async void OnLaunched(LaunchActivatedEventArgs e) { if (!(Window.Current.Content is Frame rootFrame)) { // Create a Frame to act as the navigation context and navigate to the first page rootFrame = new Frame(); rootFrame.NavigationFailed += this.OnNavigationFailed; if (e.PreviousExecutionState == ApplicationExecutionState.Terminated) { // TODO: Load state from previously suspended application } Eventlogger = new FileEventLogger(); this.AppDiagnostics = new AppDiagnostics(Eventlogger); MessageDialogManager = new MessageDialogManager(Window.Current.Dispatcher); await this.AppDiagnostics.StartRecordingDiagnosticsAsync(); // Place the frame in the current Window Window.Current.Content = rootFrame; } if (e.PrelaunchActivated) { return; } if (rootFrame.Content == null) { // When the navigation stack isn't restored navigate to the first page, // configuring the new page by passing required information as a navigation // parameter rootFrame.Navigate(typeof(MainPage), e.Arguments); } // Ensure the current window is active Window.Current.Activate(); }
private static void CreateTraces() { var inputs = new[] { "A", "B", "A,A", "B,B", "A,B", "A,B,B", "A,A,B,A,B,B,A,B", "A,B,B,B,A,B,A,A,A,B,B,B" }; inputs.ForEach(x => { var eventLogger = new FileEventLogger(x.Replace(",", "")); var world = WorldBuilder.CreateForExercise2(x, eventLogger); var totalTime = world.Solve(); Console.WriteLine($"Solve '{x}' total time '{totalTime}'"); }); }