コード例 #1
0
        public void InitCloudProviders()
        {
            List <StorageID> lstCloud       = new List <StorageID>(CurrentUser.AvailableCloudProviders);
            StorageID        defaultStorage = CurrentUser.BestCloudStorage;

            foreach (StorageID sid in lstCloud)
            {
                cmbDefaultCloud.Items.Add(new ListItem(CloudStorageBase.CloudStorageName(sid), sid.ToString())
                {
                    Selected = defaultStorage == sid
                });
            }
            pnlDefaultCloud.Visible = lstCloud.Count > 1;   // only show a choice if more than one cloud provider is set up

            mvDropBoxState.SetActiveView(lstCloud.Contains(StorageID.Dropbox) ? vwDeAuthDropbox : vwAuthDropBox);
            mvGDriveState.SetActiveView(lstCloud.Contains(StorageID.GoogleDrive) ? vwDeAuthGDrive : vwAuthGDrive);
            mvOneDriveState.SetActiveView(lstCloud.Contains(StorageID.OneDrive) ? vwDeAuthOneDrive : vwAuthOneDrive);

            locAboutCloudStorage.Text   = Branding.ReBrand(Resources.Profile.AboutCloudStorage);
            lnkAuthDropbox.Text         = Branding.ReBrand(Resources.Profile.AuthorizeDropbox);
            lnkDeAuthDropbox.Text       = Branding.ReBrand(Resources.Profile.DeAuthDropbox);
            locDropboxIsAuthed.Text     = Branding.ReBrand(Resources.Profile.DropboxIsAuthed);
            lnkAuthorizeGDrive.Text     = Branding.ReBrand(Resources.Profile.AuthorizeGDrive);
            lnkDeAuthGDrive.Text        = Branding.ReBrand(Resources.Profile.DeAuthGDrive);
            locGoogleDriveIsAuthed.Text = Branding.ReBrand(Resources.Profile.GDriveIsAuthed);
            lnkAuthorizeOneDrive.Text   = Branding.ReBrand(Resources.Profile.AuthorizeOneDrive);
            lnkDeAuthOneDrive.Text      = Branding.ReBrand(Resources.Profile.DeAuthOneDrive);
            locOneDriveIsAuthed.Text    = Branding.ReBrand(Resources.Profile.OneDriveIsAuthed);

            rblCloudBackupAppendDate.SelectedValue = CurrentUser.OverwriteCloudBackup.ToString(CultureInfo.InvariantCulture);
        }
コード例 #2
0
        public void DeployLinuxServerS3(string BuildVersion)
        {
            string BuildBaseDir = CommandUtils.CombinePaths(
                BuildPatchToolStagingInfo.GetBuildRootPath(),
                GameName,
                BuildVersion
                );
            string LinuxServerBaseDir = CommandUtils.CombinePaths(BuildBaseDir, "LinuxServer");
            string ServerZipFilePath  = CommandUtils.CombinePaths(BuildBaseDir, "LinuxServer.zip");

            if (CommandUtils.FileExists_NoExceptions(ServerZipFilePath))
            {
                CommandUtils.Log("Skipping creating server zip file {0}, as it already exists.", ServerZipFilePath);
            }
            else
            {
                CommandUtils.Log("Compressing Linux server binaries to {0}", ServerZipFilePath);
                CommandUtils.ZipFiles(ServerZipFilePath, LinuxServerBaseDir, new FileFilter(FileFilterType.Include));
                CommandUtils.Log("Completed compressing Linux server binaries.");
            }

            S3Configuration  S3Config = new S3Configuration(this);
            CloudStorageBase S3       = S3Config.GetConnection();

            string S3Filename = string.Format("LinuxServer-{0}.zip", Changelist);
            bool   bSuccess   = false;
            int    Retries    = 0;
            int    MaxRetries = 5;

            do
            {
                CommandUtils.Log("Uploading server binaries zip file to Amazon S3 bucket {0}.", S3BucketName);
                bSuccess = S3.PostFile(S3BucketName, S3Filename, ServerZipFilePath, "application/zip").bSuccess;
                if (!bSuccess)
                {
                    bool bDoRetry = Retries + 1 < MaxRetries;
                    CommandUtils.LogWarning("Failed to post server binaries to S3 (attempt {0} of {1}). {2}.",
                                            Retries + 1,
                                            MaxRetries,
                                            bDoRetry ? "Sleeping for ten seconds before retrying" : "Not retrying"
                                            );
                    if (bDoRetry)
                    {
                        Thread.Sleep(10000);
                    }
                }
            } while (!bSuccess && Retries++ < MaxRetries);

            if (!bSuccess)
            {
                throw new AutomationException("Could not upload server binaries to S3.");
            }

            CommandUtils.Log("Server binaries uploaded successfully to S3.");
        }
コード例 #3
0
 public CloudStorageBase GetConnection()
 {
     if (Connection == null)
     {
         lock (m_lock)
         {
             if (Connection == null)
             {
                 Connection = CloudStorageBase.GetByName("GameServerManager");
                 Dictionary <string, object> CloudConfiguration = new Dictionary <string, object>
                 {
                     { "CredentialsFilePath", CredentialsFilePath },
                     { "CredentialsKey", CredentialsKey },
                     { "AWSRegion", AWSRegion }
                 };
                 Connection.Init(CloudConfiguration);
             }
         }
     }
     return(Connection);
 }
コード例 #4
0
 protected void ckGroupByMonth_CheckedChanged(object sender, EventArgs e)
 {
     CloudStorageBase.SetUsesFlatHierarchy(CurrentUser, !ckGroupByMonth.Checked);
 }