コード例 #1
0
        public FileStreamResult FileManagerPartialDownload()
        {
            var rootFolder = HomeControllerFileManagerSettings.Model + GetRequestFormPath(Request.Form);

            return(FileManagerExtension.DownloadFiles(HomeControllerFileManagerSettings.DownloadSettings,
                                                      rootFolder));
        }
コード例 #2
0
        // Shows the Delete Profile Canvas
        public async void DeleteProfile()
        {
            if (SelectedProfileManager.selectedProfile == null)
            {
                Debug.Log("You don't have any profile selected");
                return;
            }

            FileManagerExtension.DeleteDirectory(Path.Combine(mainDirectoryPath, SelectedProfileManager.selectedProfile.fullProfileName));
            SaveManager.profiles.Remove(SaveManager.profiles.FirstOrDefault(p => p.fullProfileName.Equals(SelectedProfileManager.selectedProfile.fullProfileName)));
            await SaveManager.SaveAllProfilesAsync(profilesPath);

            SaveManagerEvents.current.ProfileDeleted(SelectedProfileManager.selectedProfile);
        }
コード例 #3
0
        // When the Profiles Manager loads it sets it's values and it loads the profiles
        public async void Start()
        {
            SaveManagerEvents.current.OnProfileSaved      += OnProfileSaved;
            SaveManagerEvents.current.OnProfileDeleted    += OnProfileDeleted;
            SaveManagerEvents.current.OnProfileEdited     += OnProfileEdited;
            SaveManagerEvents.current.OnCreateProfile     += OnCreateProfile;
            SaveManagerEvents.current.OnAllProfilesSaved  += OnAllProfilesSaved;
            SaveManagerEvents.current.OnAllProfilesLoaded += OnAllProfilesLoaded;
            SaveManagerEvents.current.OnProfileLoaded     += OnProfileLoaded;

            //Sets the main path value for Profiles
            mainDirectoryPath = Path.Combine(Application.persistentDataPath, "Profiles");

            //Sets the profiles.dat path value
            profilesPath = mainDirectoryPath + "/profiles.dat";

            // Checks if the Profiles Folder Exists or not. If it doesn't exist it creates it.
            if (!Directory.Exists(mainDirectoryPath))
            {
                FileManagerExtension.CreateDirectory(mainDirectoryPath);
            }

            // Loads the event
            FileSystemEventsManager.FileSystemEvents(mainDirectoryPath);

            //Gets all Directories in the Profiles folder
            string[] profiles = FileManagerExtension.GetDirectories(mainDirectoryPath);

            // Shows the Create profile UI if player doesn't have any profiles
            if (!profiles.Any())
            {
                FirstTimePlaying();
                await SaveManager.SaveAllProfilesAsync(profilesPath);

                return;
            }

            await SaveManager.LoadAllProfilesAsync(profilesPath);

            for (int i = 0; i < profiles.Length; i++)
            {
                await LoadProfile(profiles.GetValue(i).ToString());
            }
        }
コード例 #4
0
        // This function is used to create a new profile
        public async void CreateProfile()
        {
            // Creates the unique profile ID
            string profileId = $"{Guid.NewGuid()}";

            if (string.IsNullOrEmpty(profileName.text))
            {
                Debug.Log("Profile name can't be empty or null");
                return;
            }

            // Checks if the Profile already exists or not.
            while (Directory.Exists($"{mainDirectoryPath}{profileName.text} {profileId}") || Directory.Exists($"{mainDirectoryPath}{profileName.text}"))
            {
                profileId = $"{profileId}{Guid.NewGuid()}";
            }

            string fullProfileName = $"{profileName.text} {profileId}";

            // Sets the paths needed for the profile
            string profilePath = Path.Combine(mainDirectoryPath, fullProfileName);

            string profileSavePath     = Path.Combine(profilePath, "Save");
            string profileSaveFilePath = Path.Combine(profileSavePath, "data.dat");
            string profileConfigPath   = Path.Combine(profilePath, "config.dat");
            string profileSettingsPath = Path.Combine(profilePath, "Settings.dat");

            if (!Directory.Exists(mainDirectoryPath))
            {
                FileManagerExtension.CreateDirectory(mainDirectoryPath);
            }

            FileManagerExtension.CreateDirectory(profileSavePath);

            FileManagerExtension.CreateFile(profileSaveFilePath);

            FileManagerExtension.CreateFile(profileSettingsPath);

            SaveManagerEvents.current.CreateProfile(profileName.text, fullProfileName, profileId);

            // Creates and saves the profile.
            await SaveManager.SaveProfileAsync(profileConfigPath, "DefaultProfilePicture.png", profileName.text, profileId, fullProfileName);
        }
コード例 #5
0
    // Save Game
    public static async Task SaveGameAsync(bool hasPlayed, int balance, Vector3 playerPosition, Quaternion playerRotation, Vector3 cameraPosition, Quaternion cameraRotation)
    {
        if (SelectedProfileManager.selectedProfile == null)
        {
            return;
        }

        string fullProfileName = SelectedProfileManager.selectedProfile.fullProfileName;

        GameData gameData = CreateGameData(hasPlayed, balance, playerPosition, playerRotation, cameraPosition, cameraRotation);

        if (gameData == null)
        {
            return;
        }

        string path    = Path.Combine(MainDirectoryPath, fullProfileName, "Save", "data.dat");
        string dirPath = Path.Combine(MainDirectoryPath, fullProfileName, "Save");

        if (!Directory.Exists(dirPath))
        {
            FileManagerExtension.CreateDirectory(dirPath);
        }

        string json = JsonUtility.ToJson(gameData);

        // Creates the unique Encryption key per profile
        string jsonEncryptedKey = "|9{Ajia:p,g<ae&)9KsLy7;<t9G5sJ>G";

        // If the value is longer then 32 characters it will make it 32 characters
        if (jsonEncryptedKey.Length > 32)
        {
            jsonEncryptedKey = jsonEncryptedKey.Truncate(32);
        }

        // Encryption process
        Rijndael crypto = new Rijndael();

        byte[] soup = crypto.Encrypt(json, jsonEncryptedKey);
        await AsyncHelperExtensions.WriteBytesAsync(path, soup);

        SaveManagerEvents.current.SaveGame(gameData, SelectedProfileManager.selectedProfile);
    }
コード例 #6
0
 public FileStreamResult ProcessBlueprintPartialDownload()
 {
     return(FileManagerExtension.DownloadFiles(ProcessBlueprintControllerProcessBlueprintSettings.CreateFileManagerDownloadSettings(), ProcessBlueprintControllerProcessBlueprintSettings.ProcessBlueprintFileSystemProvider));
 }
コード例 #7
0
        // This function is used to Edit an already existing profile
        public async void EditProfile()
        {
            if (SelectedProfileManager.selectedProfile == null)
            {
                Debug.Log("You don't have any profile selected");
                return;
            }

            if (string.IsNullOrEmpty(this.profileName.text))
            {
                Debug.Log("Profile name can't be empty or null");
                return;
            }

            string profileId       = SelectedProfileManager.selectedProfile.profileId;
            string profileName     = this.profileName.text;
            string fullProfileName = $"{this.profileName.text} {profileId}";

            // Checks if the Profile Name is the same
            if (fullProfileName.Equals(SelectedProfileManager.selectedProfile.fullProfileName, StringComparison.OrdinalIgnoreCase))
            {
                Debug.Log("You didn't change the profile name");
                return;
            }

            FileManagerExtension.MoveDirectory(Path.Combine(mainDirectoryPath, SelectedProfileManager.selectedProfile.fullProfileName), Path.Combine(mainDirectoryPath, fullProfileName));

            // Sets the paths needed for the profile
            string profilePath = Path.Combine(mainDirectoryPath, fullProfileName);

            string profileSavePath     = Path.Combine(profilePath, "Save");
            string profileSaveFilePath = Path.Combine(profileSavePath, "data.dat");
            string profileConfigPath   = Path.Combine(profilePath, "config.dat");
            string profileSettingsPath = Path.Combine(profilePath, "Settings.dat");


            if (!Directory.Exists(mainDirectoryPath))
            {
                FileManagerExtension.CreateDirectory(mainDirectoryPath);
            }

            if (!Directory.Exists(profileSavePath))
            {
                FileManagerExtension.CreateDirectory(profileSavePath);
            }

            if (!File.Exists(profileSaveFilePath))
            {
                FileManagerExtension.CreateFile(profileSaveFilePath);
            }

            if (!File.Exists(profileSettingsPath))
            {
                FileManagerExtension.CreateFile(profileSettingsPath);
            }


            // Deletes the old Profiles value from profiles.dat
            SaveManager.profiles.Remove(SaveManager.profiles.FirstOrDefault(p => p.fullProfileName.Equals(SelectedProfileManager.selectedProfile.fullProfileName)));
            await SaveManager.SaveAllProfilesAsync(profilesPath);

            if (SelectedProfileManager.selectedProfile == null)
            {
                Debug.Log("Failed to create profile reason unknown");
                return;
            }

            string profileImage = SelectedProfileManager.selectedProfile.profileImage;

            // Creates and saves the profile.
            await SaveManager.SaveProfileAsync(profileConfigPath, profileImage, profileName, profileId, fullProfileName);

            SaveManagerEvents.current.ProfileEdited(SaveManager.CreateProfile(profileId, profileImage, profileName, fullProfileName, false));

            SelectedProfileManager.selectedProfile = null;
        }
コード例 #8
0
 public FileStreamResult FileManagerPartialDownload()
 {
     return(FileManagerExtension.DownloadFiles(BibliotecaControllerFileManager1Settings.DownloadSettings, BibliotecaControllerFileManager1Settings.Model));
 }
コード例 #9
0
 public FileStreamResult FileManagerPartialDownload()
 {
     return(FileManagerExtension.DownloadFiles(ComunicadoControllerFileManagerSettings.CreateFileManagerDownloadSettings(), (string)Session["_folder_root"].ToString()));
 }
コード例 #10
0
 public FileStreamResult FileManagerPartialDownload()
 {
     return(FileManagerExtension.DownloadFiles("FileManager", HomeControllerFileManagerSettings.Model));
 }
コード例 #11
0
        public async Task <FileStreamResult> DownloadFiles(string downloadPath)
        {
            await _fileHandlerService.HandleOnDownloadAsync(downloadPath);

            return(FileManagerExtension.DownloadFiles(FileManagerHelper.CreateFileManagerDownloadSettings(), FileManagerConfig.RootFolder));
        }
コード例 #12
0
 public FileStreamResult FileManagerDownload()
 {
     return(FileManagerExtension.DownloadFiles(FileManagerHelper.GetSettings(), Server.MapPath("~/content/taxcare/")));
 }
コード例 #13
0
 public FileStreamResult FileManagerPartialDownload()
 {
     return(FileManagerExtension.DownloadFiles(FileManagerControllerFileManagerSettings.CreateFileManagerDownloadSettings(), FileManagerControllerFileManagerSettings.Model));
 }
コード例 #14
0
 public FileStreamResult BookFilePartialDownload()
 {
     return(FileManagerExtension.DownloadFiles(FileControllerBookFileSettings.DownloadSettings, FileControllerBookFileSettings.Model));
 }
コード例 #15
0
ファイル: TimeSheetsController.cs プロジェクト: aazizb/iws
 public FileStreamResult TimeSheetsFileManagerPartialDownload()
 {
     return(FileManagerExtension.DownloadFiles("TimeSheetsFileManager", TimeSheetsFileManagerSettings.Model));
 }