Example #1
0
 /// <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);
 }
Example #2
0
 /// <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();
 }
Example #3
0
 /// <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);
 }
Example #4
0
 /// <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);
 }