Exemplo n.º 1
0
    public void GetMostRecentSave()
    {
        this.lastSave = DirectoryFunction.GetMostRecentFolder(this.directories);

        if (this.lastSave == "" && this.directories.Count > 0)
        {
            this.lastSave = this.directories[0];
        }
    }
Exemplo n.º 2
0
    public void Initialize()
    {
        this.loadingDataToDisplay = null;
        this.loadingDatas         = new List <LoadingData>();
        this.repositoryPath       = DirectoryFunction.CombinePath(DirectoryFunction.GetMyDocumentsPath(), SaveInformation.root);
        DirectoryFunction.CreateRepository(this.repositoryPath);

        this.InitializeLoadingDatas();
        this.GetMostRecentSave();
        this.partyName = "";
    }
Exemplo n.º 3
0
    private void CreateLanguageFilesIfDontExist()
    {
        DirectoryFunction.CreateRepository(this.repositoryPath);

        for (short i = 0; i < (int)e_language.SIZE; i++)
        {
            string filePath = DirectoryFunction.CombinePath(this.repositoryPath, ((e_language)i).ToString()) + this.extension;

            if (!(File.Exists(filePath)))
            {
                using (File.Create(filePath));
            }
        }
    }
Exemplo n.º 4
0
    public LanguageType LoadEditorLanguageData(e_language newLanguage, e_languageExtension newExtension)
    {
        string path = DirectoryFunction.CombinePath(this.repositoryPath, newLanguage.ToString()) + "." + newExtension.ToString().ToLower();

        //LanguageType languageData = new LanguageType();

        if (newExtension == e_languageExtension.Ini)
        {
            IniFile parser = new IniFile(path);
            return(new StringDictionary(parser.KeysValues).ToList());
        }
        else
        {
            return(SerializationTemplate.Load <LanguageType>(path, newExtension == e_languageExtension.Bin));
        }
    }
Exemplo n.º 5
0
    public void InitializeLoadingDatas()
    {
        this.directories = DirectoryFunction.GetSubDirectories(this.repositoryPath);
        this.directories.Sort((a, b) => { return((Directory.GetLastWriteTime(a) > Directory.GetLastWriteTime(b)) ? 1 : -1); });
        this.loadingDatas.Clear();

        foreach (string directory in directories)
        {
            LoadingData loadingData = new LoadingData();

            loadingData = SerializationTemplate.Load <LoadingData>(DirectoryFunction.CombinePath(
                                                                       DirectoryFunction.CombinePath(this.repositoryPath, directory), SaveInformation.loadingData));

            this.loadingDatas.Add(loadingData);
        }
    }
Exemplo n.º 6
0
    public void SaveEditorLanguageData(e_language newLanguage, e_languageExtension newExtension, LanguageType languageData)
    {
        string path = DirectoryFunction.CombinePath(this.repositoryPath, newLanguage.ToString()) + "." + newExtension.ToString().ToLower();

        if (newExtension == e_languageExtension.Ini)
        {
            IniFile          parser        = new IniFile(path);
            StringDictionary languageTexts = new StringDictionary();

            languageData.ForEach(node => languageTexts.Add(node.Key, node.Value));
            parser.SaveFile(languageTexts);
        }
        else
        {
            SerializationTemplate.Save <LanguageType>(path, languageData, newExtension == e_languageExtension.Bin);
        }
    }
Exemplo n.º 7
0
        /// <summary>
        /// Initialize viewmodel
        /// </summary>
        public DirectoryTypeEditorViewModel()
        {
            directoryClassificationService     = CommonServiceLocator.ServiceLocator.Current.GetInstance <IDirectoryClassificationService>();
            directoryTypeClassificationService = CommonServiceLocator.ServiceLocator.Current.GetInstance <IDirectoryTypeClassificationService>();

            var defaultFunction = new DirectoryFunction {
                DirectoryFunctionType = DirectoryFunctionType.Default, DisplayName = "Standard"
            };

            functions = new ObservableCollection <DirectoryFunction>
            {
                defaultFunction,
                new DirectoryFunction {
                    DirectoryFunctionType = DirectoryFunctionType.Workflow, DisplayName = "Workflow"
                }
            };

            selectedFunction = defaultFunction;
        }
Exemplo n.º 8
0
    public void ContinueParty(GameObject player, GameObject gameManager, SerializationInformation info)
    {
        string lastGame = DirectoryFunction.GetMostRecentFolder(info.Directories);

        if (lastGame == "")
        {
            lastGame = info.Directories[0];
        }

        for (short i = 0; i < info.Directories.Count; i++)
        {
            if (lastGame == info.Directories[i])
            {
                info.LoadingDataToDisplay = info.LoadingDatas[i];
                info.PartyName            = info.LoadingDataToDisplay.PartyName;
            }
        }
        this.InitializePlayerAndGameManagerBeforeLoadLevel(false, player, gameManager, info);

        Application.LoadLevel(info.LoadingDataToDisplay.SceneName);
    }
Exemplo n.º 9
0
    public void Initialize(e_language defaultLanguage = e_language.English, e_language currentLanguage = e_language.French, e_languageExtension extension = e_languageExtension.Ini)
    {
        this.defaultLanguageTexts = new StringDictionary();
        this.currentLanguageTexts = new StringDictionary();

        this.repositoryPath = DirectoryFunction.CombinePath(DirectoryFunction.CombinePath(DirectoryFunction.GetMyDocumentsPath(), "Blood Of Evil"), "Language");

        this.defaultLanguage = e_language.English;
        this.currentLanguage = e_language.French;

        this.languageList = new LanguageType();

        this.Extension            = "." + extension.ToString().ToLower();
        this.extensionEnumeration = extension;

        this.CreateLanguageFilesIfDontExist();

        //Use those 2 lines for Generate Files and save
        //this.AddPredefinedLanguageNodes();
        //this.Save();

        //Use this line to load your files
        this.Load();
    }
Exemplo n.º 10
0
        /// <summary>
        /// Initialize viewmodel
        /// </summary>
        /// <param name="model">Model instance</param>
        public void Initialize(DirectoryType model)
        {
            this.model = model;

            selectedFunction = functions.FirstOrDefault(x => x.DirectoryFunctionType == model.DirectoryFunction);
        }
Exemplo n.º 11
0
 private void ResetPath()
 {
     this.defaultPath = DirectoryFunction.CombinePath(this.repositoryPath, this.defaultLanguage.ToString()) + this.extension;
     this.currentPath = DirectoryFunction.CombinePath(this.repositoryPath, this.currentLanguage.ToString()) + this.extension;
 }