Exemplo n.º 1
0
        public static void Save()
        {
            string lfile = System.IO.Path.Combine(SysFolder, "library.xml");

            System.IO.Directory.CreateDirectory(System.IO.Path.GetDirectoryName(lfile));
            using (var fs = new System.IO.FileStream(lfile, System.IO.FileMode.Create))
                Util.Serialize(Library, fs);
            string sfile = System.IO.Path.Combine(SysFolder, "settings.xml");

            using (var fs = new System.IO.FileStream(sfile, System.IO.FileMode.Create))
                Util.Serialize(Settings, fs);
            ImageCache.Save();
        }
Exemplo n.º 2
0
Arquivo: Sys.cs Projeto: Erendel/7h
        /// <summary>
        /// Saves settings.xml, library.xml, and image cache.xml, and versions.xml to disk
        /// </summary>
        public static void Save()
        {
            SaveLibrary();

            SaveSettings();

            string pathToVersions = Path.Combine(SysFolder, "version.xml");

            using (var fs = new FileStream(pathToVersions, FileMode.Create))
                Util.Serialize(LastCheckedVersion, fs);

            ImageCache.Save();
        }
Exemplo n.º 3
0
        static Sys()
        {
            string appPath = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location);

            SysFolder = System.IO.Path.Combine(appPath, "7thWorkshop");
            _7HFolder = appPath;

            string sfile = System.IO.Path.Combine(SysFolder, "settings.xml");

            if (System.IO.File.Exists(sfile))
            {
                try {
                    Settings = Util.Deserialize <Settings>(sfile);
                } catch {
                    Sys.Message(new WMessage()
                    {
                        Text = "Error loading settings - please configure 7H using the Workshop/Settings menu"
                    });
                }
            }
            if (Settings == null)
            {
                Settings = new Settings();
                //Settings.UpdateUrl = System.Configuration.ConfigurationManager.AppSettings["UpdateUrl"];
                Settings.Options = GeneralOptions.AutoImportMods | GeneralOptions.SetEXECompatFlags;
                Settings.SubscribedUrls.Add("iros://Url/http$pastebin.com/raw.php?i=dDBkYkDu");
                Settings.SubscribedUrls.Add("iros://Url/http$pastebin.com/raw.php?i=QBGsgGK6");
            }

            string lfile = System.IO.Path.Combine(SysFolder, "library.xml");

            if (System.IO.File.Exists(lfile))
            {
                try {
                    Library = Util.Deserialize <Library>(lfile);
                } catch {
                    Sys.Message(new WMessage()
                    {
                        Text = "Error loading library file"
                    });
                }
            }
            if (Library == null)
            {
                Library = new Library();
            }
            _statuses = Library.Items.ToDictionary(i => i.ModID, _ => ModStatus.Installed);

            ImageCache = new ImageCache(System.IO.Path.Combine(SysFolder, "cache"));
        }
Exemplo n.º 4
0
        static Sys()
        {
            string appPath = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location);

            SysFolder = System.IO.Path.Combine(appPath, "7thWorkshop");
            _7HFolder = appPath;

            string sfile = System.IO.Path.Combine(SysFolder, "settings.xml");

            if (System.IO.File.Exists(sfile))
            {
                try {
                    Settings = Util.Deserialize <Settings>(sfile);
                } catch {
                    Sys.Message(new WMessage()
                    {
                        Text = "Error loading settings - please configure 7H using the Workshop/Settings menu"
                    });
                }
            }
            if (Settings == null)
            {
                Settings = new Settings();
                //Settings.UpdateUrl = System.Configuration.ConfigurationManager.AppSettings["UpdateUrl"];
                Settings.Options = GeneralOptions.AutoImportMods;
            }

            // if (Settings.ExtraFolders == null) Settings.ExtraFolders = new List<string>() { "music" };

            string lfile = System.IO.Path.Combine(SysFolder, "library.xml");

            if (System.IO.File.Exists(lfile))
            {
                try {
                    Library = Util.Deserialize <Library>(lfile);
                } catch {
                    Sys.Message(new WMessage()
                    {
                        Text = "Error loading library file"
                    });
                }
            }
            if (Library == null)
            {
                Library = new Library();
            }
            _statuses = Library.Items.ToDictionary(i => i.ModID, _ => ModStatus.Installed);

            ImageCache = new ImageCache(System.IO.Path.Combine(SysFolder, "cache"));
        }
Exemplo n.º 5
0
        /// <summary>
        /// Saves settings.xml, library.xml, and image cache.xml, and versions.xml to disk
        /// </summary>
        public static void Save()
        {
            string lfile          = Path.Combine(SysFolder, "library.xml");
            string sfile          = Path.Combine(SysFolder, "settings.xml");
            string pathToVersions = Path.Combine(SysFolder, "version.xml");

            Directory.CreateDirectory(Path.GetDirectoryName(lfile));

            using (var fs = new FileStream(lfile, FileMode.Create))
                Util.Serialize(Library, fs);

            using (var fs = new FileStream(sfile, FileMode.Create))
                Util.Serialize(Settings, fs);

            using (var fs = new FileStream(pathToVersions, FileMode.Create))
                Util.Serialize(LastCheckedVersion, fs);

            ImageCache.Save();
        }
Exemplo n.º 6
0
Arquivo: Sys.cs Projeto: Erendel/7h
        static Sys()
        {
            string appPath = Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location);

            _7HFolder = appPath;

            SysFolder = Path.Combine(appPath, "7thWorkshop");
            Directory.CreateDirectory(SysFolder);


            string sfile = Path.Combine(SysFolder, "settings.xml");

            if (File.Exists(sfile))
            {
                try
                {
                    Settings = Util.Deserialize <Settings>(sfile);
                }
                catch (Exception e)
                {
                    Sys.Message(new WMessage(StringKey.ErrorLoadingSettingsPleaseConfigure7H, WMessageLogLevel.Error, e));
                }
            }
            if (Settings == null)
            {
                Settings = Settings.UseDefaultSettings();
                Settings.IsFirstStart = true;
            }

            string lfile = Path.Combine(SysFolder, "library.xml");

            if (File.Exists(lfile))
            {
                try
                {
                    Library = Util.Deserialize <Library>(lfile);
                }
                catch (Exception e)
                {
                    Sys.Message(new WMessage(StringKey.ErrorLoadingLibraryFile, WMessageLogLevel.Error, e));
                }
            }

            if (Library == null)
            {
                Library = new Library();
            }

            if (Settings.HasOption(GeneralOptions.AutoUpdateMods))
            {
                Library.DefaultUpdate = UpdateType.Install;
            }

            _statuses = Library.Items.ToDictionary(i => i.ModID, _ => ModStatus.Installed);

            ImageCache = new ImageCache(Path.Combine(SysFolder, "cache"));

            AppVersion = new Version();

            string pathToVersions = Path.Combine(SysFolder, "version.xml");

            if (File.Exists(pathToVersions))
            {
                try
                {
                    LastCheckedVersion = Util.Deserialize <AvailableUpdate>(pathToVersions);
                }
                catch (Exception e)
                {
                    Sys.Message(new WMessage("Failed to open/deserialize version.xml", WMessageLogLevel.LogOnly, e));
                }
            }

            if (LastCheckedVersion == null)
            {
                LastCheckedVersion = new AvailableUpdate();
            }
        }