Exemplo n.º 1
0
        public static CutDatabase GetCutDatabase()
        {
            if (instance == null)
            {
                //si le fichier de sauvegarde existe on charge le JSON
                string saveFolderPath = Path.Combine(Directory.GetParent(Path.GetDirectoryName(System.Reflection.Assembly.GetEntryAssembly().Location)).Parent.Parent.FullName, "Save");
                instance = new CutDatabase();
                System.Diagnostics.Debug.WriteLine(File.Exists(saveFolderPath + "\\instance_param.json"));
                System.Diagnostics.Debug.WriteLine(File.Exists(saveFolderPath + "\\db_save.json"));
                if (File.Exists(saveFolderPath + "\\instance_param.json") && File.Exists(saveFolderPath + "\\db_save.json"))
                {
                    System.Diagnostics.Debug.WriteLine("Lancement load");

                    instance.LoadFromJSON(saveFolderPath);
                }
                else
                {
                    string resourcesFolderPath = Path.Combine(Directory.GetParent(Path.GetDirectoryName(System.Reflection.Assembly.GetEntryAssembly().Location)).Parent.Parent.FullName, "Assets");
                    instance.CharacterRessourcesPath = new Uri(resourcesFolderPath + "\\" + "Character_db");
                    System.Diagnostics.Debug.WriteLine("Pas load");
                }
            }

            return(instance);
        }
Exemplo n.º 2
0
        private CutDatabase()
        {
            _cuts = new ObservableCollection <Cut>();
            string resourcesFolderPath = Path.Combine(Directory.GetParent(Path.GetDirectoryName(System.Reflection.Assembly.GetEntryAssembly().Location)).Parent.Parent.FullName, "Assets");

            CharacterRessourcesPath = new Uri(resourcesFolderPath + "\\" + "Character_db");
            instance = null;
            Messenger.Default.Register <NotificationMessage>(this, ChangeFolderPath);
        }
        public CharacterDataBase()
        {
            var tempDB = CutDatabase.GetCutDatabase();

            /* Parcours du fichier de personnages */

            if (tempDB.VideoPath == null)
            {
                foreach (string png in Directory.GetFiles(tempDB.CharacterRessourcesPath.OriginalString, "*.png"))
                {
                    string name = png.Split('\\').Last();
                    name = name.Split('(')[0];
                    DataBase.Add(new Character(new Uri(png), name));
                }
                TeamName = "Equipe";
            }
        }