Ejemplo n.º 1
0
        static void load_preferences()
        {
            try
            {
                Assembly ass      = Assembly.GetEntryAssembly();
                string   root_dir = FileName.Directory(ass.Location);
                string   filename = root_dir + "Preferences.xml";

                if (File.Exists(filename))
                {
                    SplashScreen.CurrentAction = "Loading user preferences";

                    Preferences prefs = Serialisation <Preferences> .Load(filename, SerialisationMode.XML);

                    if (prefs != null)
                    {
                        Session.Preferences = prefs;
                    }
                }
            }
            catch (Exception ex)
            {
                LogSystem.Trace(ex);
            }
        }
Ejemplo n.º 2
0
        static void init_logging()
        {
            try
            {
                // Logging
                string mp_dir = FileName.Directory(Application.ExecutablePath);

                // Make sure the log directory exists
                string logdir = mp_dir + "Log" + Path.DirectorySeparatorChar;
                if (!Directory.Exists(logdir))
                {
                    DirectoryInfo di = Directory.CreateDirectory(logdir);
                    if (di == null)
                    {
                        throw new UnauthorizedAccessException();
                    }
                }

                // Begin logging
                string logfile = logdir + DateTime.Now.Ticks + ".log";
                LogSystem.LogFile = logfile;
            }
            catch
            {
            }
        }
Ejemplo n.º 3
0
        private void NameBox_TextChanged(object sender, EventArgs e)
        {
            if (this.NameBox.Text == "")
            {
                this.OKBtn.Enabled = false;
                return;
            }
            Assembly      entryAssembly = Assembly.GetEntryAssembly();
            DirectoryInfo directoryInfo = new DirectoryInfo(FileName.Directory(entryAssembly.FullName));
            string        str           = string.Concat(directoryInfo, this.NameBox.Text, ".library");

            this.OKBtn.Enabled = !File.Exists(str);
        }
Ejemplo n.º 4
0
 private static void save_preferences()
 {
     try
     {
         string str  = FileName.Directory(Assembly.GetEntryAssembly().Location);
         string str1 = string.Concat(str, "Preferences.xml");
         Serialisation <Preferences> .Save(str1, Session.Preferences, SerialisationMode.XML);
     }
     catch (Exception exception)
     {
         LogSystem.Trace(exception);
     }
 }
Ejemplo n.º 5
0
        private static void check_for_logs()
        {
            string logFile = LogSystem.LogFile;

            if (logFile == null || logFile == "")
            {
                return;
            }
            if (!File.Exists(logFile))
            {
                return;
            }
            Process.Start(FileName.Directory(logFile));
        }
Ejemplo n.º 6
0
        static void load_libraries()
        {
            try
            {
                SplashScreen.CurrentAction = "Loading libraries...";

                Assembly ass      = Assembly.GetEntryAssembly();
                string   root_dir = FileName.Directory(ass.Location);

                string lib_dir = root_dir + "Libraries\\";
                if (!Directory.Exists(lib_dir))
                {
                    Directory.CreateDirectory(lib_dir);
                }

                // Move libraries from root directory
                string[] files = Directory.GetFiles(root_dir, "*.library");
                foreach (string filename in files)
                {
                    try
                    {
                        string lib_name = lib_dir + FileName.Name(filename) + ".library";

                        if (!File.Exists(lib_name))
                        {
                            File.Move(filename, lib_name);
                        }
                    }
                    catch (Exception ex)
                    {
                        LogSystem.Trace(ex);
                    }
                }

                // Load libraries
                string[] libraries = Directory.GetFiles(lib_dir, "*.library");
                SplashScreen.Actions = libraries.Length;
                foreach (string filename in libraries)
                {
                    Session.LoadLibrary(filename);
                }

                Session.Libraries.Sort();
            }
            catch (Exception ex)
            {
                LogSystem.Trace(ex);
            }
        }
Ejemplo n.º 7
0
        static void save_preferences()
        {
            try
            {
                Assembly ass      = Assembly.GetEntryAssembly();
                string   root_dir = FileName.Directory(ass.Location);
                string   filename = root_dir + "Preferences.xml";

                Serialisation <Preferences> .Save(filename, Session.Preferences, SerialisationMode.XML);
            }
            catch (Exception ex)
            {
                LogSystem.Trace(ex);
            }
        }
Ejemplo n.º 8
0
        static void check_for_logs()
        {
            string logfile = LogSystem.LogFile;

            if ((logfile == null) || (logfile == ""))
            {
                return;
            }

            if (!File.Exists(logfile))
            {
                return;
            }

            string logdir = FileName.Directory(logfile);

            Process.Start(logdir);
        }
Ejemplo n.º 9
0
 private static void init_logging()
 {
     try
     {
         string str  = FileName.Directory(Application.ExecutablePath);
         string str1 = string.Concat(str, "Log", Path.DirectorySeparatorChar);
         if (!Directory.Exists(str1) && Directory.CreateDirectory(str1) == null)
         {
             throw new UnauthorizedAccessException();
         }
         DateTime now  = DateTime.Now;
         string   str2 = string.Concat(str1, now.Ticks, ".log");
         LogSystem.LogFile = str2;
     }
     catch
     {
     }
 }
Ejemplo n.º 10
0
 private static void load_libraries()
 {
     try
     {
         Program.SplashScreen.CurrentAction = "Loading libraries...";
         string str  = FileName.Directory(Assembly.GetEntryAssembly().Location);
         string str1 = string.Concat(str, "Libraries\\");
         if (!Directory.Exists(str1))
         {
             Directory.CreateDirectory(str1);
         }
         string[] files = Directory.GetFiles(str, "*.library");
         for (int i = 0; i < (int)files.Length; i++)
         {
             string str2 = files[i];
             try
             {
                 string str3 = string.Concat(str1, FileName.Name(str2), ".library");
                 if (!File.Exists(str3))
                 {
                     File.Move(str2, str3);
                 }
             }
             catch (Exception exception)
             {
                 LogSystem.Trace(exception);
             }
         }
         string[] strArrays = Directory.GetFiles(str1, "*.library");
         Program.SplashScreen.Actions = (int)strArrays.Length;
         string[] strArrays1 = strArrays;
         for (int j = 0; j < (int)strArrays1.Length; j++)
         {
             Session.LoadLibrary(strArrays1[j]);
         }
         Session.Libraries.Sort();
     }
     catch (Exception exception1)
     {
         LogSystem.Trace(exception1);
     }
 }
Ejemplo n.º 11
0
        private static void load_preferences()
        {
            try
            {
                string str  = FileName.Directory(Assembly.GetEntryAssembly().Location);
                string str1 = string.Concat(str, "Preferences.xml");
                if (File.Exists(str1))
                {
                    Program.SplashScreen.CurrentAction = "Loading user preferences";
                    Preferences preference = Serialisation <Preferences> .Load(str1, SerialisationMode.XML);

                    if (preference != null)
                    {
                        Session.Preferences = preference;
                    }
                }
            }
            catch (Exception exception)
            {
                LogSystem.Trace(exception);
            }
        }
Ejemplo n.º 12
0
        private string get_manual_filename()
        {
            Assembly entryAssembly = Assembly.GetEntryAssembly();

            return(string.Concat(FileName.Directory(entryAssembly.FullName), "Manual.pdf"));
        }
Ejemplo n.º 13
0
        string get_manual_filename()
        {
            Assembly ass = Assembly.GetEntryAssembly();

            return(FileName.Directory(ass.FullName) + "Manual.pdf");
        }