private static void Main(string[] args) { //clear previous dumps Utility.ClearDumpFolder(); CancellationToken cancellationToken = new CancellationToken(); Task[] taskArray = new Task[3]; //gather specific informations taskArray[0] = Task.Factory.StartNew(() => { //google Console.WriteLine("google started"); var googleCP = new GoogleCloud(); googleCP.GatherInformation(); Console.WriteLine("google finished"); }, cancellationToken); taskArray[1] = Task.Factory.StartNew(() => { //aws Console.WriteLine("aws started"); var awsCP = new AWS(); awsCP.GatherInformation(); Console.WriteLine("aws finished"); }, cancellationToken); taskArray[2] = Task.Factory.StartNew(() => { //azure Console.WriteLine("azure started"); var azureCP = new Azure(); azureCP.GatherInformation(); Console.WriteLine("azureCP finished"); }, cancellationToken); Task.WaitAll(taskArray); Console.WriteLine("click to exit"); Console.ReadLine(); }
public static Cloud GetCloud(DataActionEventArgs e, Database Database) { CloudType type = !e.Values.ContainsKey("type") ? CloudType.Function : (CloudType)Enum.Parse(typeof(CloudType), (string)e.Values["type"]); string accessKeyId = !e.Values.ContainsKey("AccessKeyId") ? null : (string)e.Values["AccessKeyId"]; string awsRegion = !e.Values.ContainsKey("AwsRegion") ? null : (string)e.Values["AwsRegion"]; CloudVendor cloudVendor = !e.Values.ContainsKey("CloudVendor") ? CloudVendor.AWS : (CloudVendor)Enum.Parse(typeof(CloudVendor), (string)e.Values["CloudVendor"]); string encryptedSecretAccessKey = !e.Values.ContainsKey("EncryptedSecretAccessKey") ? null : (string)e.Values["EncryptedSecretAccessKey"]; string name = !e.Values.ContainsKey("Name") ? null : (string)e.Values["Name"]; switch (cloudVendor) { case CloudVendor.Azure: { string encryptedPassword = !e.Values.ContainsKey("password") ? null : (string)e.Values["password"]; string tenant = !e.Values.ContainsKey("tenant") ? null : (string)e.Values["tenant"]; string appId = !e.Values.ContainsKey("appId") ? null : (string)e.Values["appId"]; string subscriptionId = !e.Values.ContainsKey("subscriptionId") ? null : (string)e.Values["subscriptionId"]; string connectionString = !e.Values.ContainsKey("ConnectionString") ? null : (string)e.Values["ConnectionString"]; Cloud cloud = new AzureCloud(Database) { AppId = appId, SubscriptionId = subscriptionId, EncryptedPassword = encryptedPassword, tenant = tenant, CloudVendor = cloudVendor, Name = name, ConnectionString = connectionString, Type = type }; return(cloud); } case CloudVendor.GCP: { string projectName = !e.Values.ContainsKey("ProjectName") ? null : (string)e.Values["ProjectName"]; string clientEmail = !e.Values.ContainsKey("ClientEmail") ? null : (string)e.Values["ClientEmail"]; string encryptedPrivateKey = !e.Values.ContainsKey("EncryptedPrivateKey") ? null : (string)e.Values["EncryptedPrivateKey"]; Cloud cloud = new GoogleCloud(Database) { EncryptedPrivateKey = encryptedPrivateKey, ClientEmail = clientEmail, ProjectName = projectName, CloudVendor = cloudVendor, Name = name, Type = type }; return(cloud); } case CloudVendor.FnProject: { string connectionString = !e.Values.ContainsKey("ConnectionString") ? null : (string)e.Values["ConnectionString"]; string gateway = !e.Values.ContainsKey("Gateway") ? null : (string)e.Values["Gateway"]; Cloud cloud = new FnProjectCloud(Database) { gateway = gateway, connectionString = connectionString, CloudVendor = cloudVendor, Name = name, Type = type }; return(cloud); } case CloudVendor.OpenFaas: { string projectName = !e.Values.ContainsKey("ProjectName") ? null : (string)e.Values["ProjectName"]; string connectionString = !e.Values.ContainsKey("ConnectionString") ? null : (string)e.Values["ConnectionString"]; string gateway = !e.Values.ContainsKey("Gateway") ? null : (string)e.Values["Gateway"]; Cloud cloud = new OpenFaasCloud(Database) { projectName = projectName, gateway = gateway, connectionString = connectionString, CloudVendor = cloudVendor, Name = name, Type = type }; return(cloud); } default: return(new Cloud(Database) { AccessKeyId = accessKeyId, Region = awsRegion, CloudVendor = cloudVendor, EncryptedSecretAccessKey = encryptedSecretAccessKey, Name = name, Type = type }); } //throw new NotImplementedException(); }
public static Durados.Cloud GetCloud(System.Data.DataRowView row, int id, Database Database) { CloudType type = row.Row.IsNull("type") ? CloudType.Function : (CloudType)Enum.Parse(typeof(CloudType), (string)row["type"]); string accessKeyId = row.Row.IsNull("AccessKeyId") ? null : (string)row["AccessKeyId"]; string awsRegion = row.Row.IsNull("AwsRegion") ? null : (string)row["AwsRegion"]; CloudVendor cloudVendor = row.Row.IsNull("CloudVendor") ? CloudVendor.AWS : (CloudVendor)Enum.Parse(typeof(CloudVendor), (string)row["CloudVendor"]); string encryptedSecretAccessKey = row.Row.IsNull("EncryptedSecretAccessKey") ? null : (string)row["EncryptedSecretAccessKey"]; string name = row.Row.IsNull("Name") ? null : (string)row["Name"]; switch (cloudVendor) { case CloudVendor.Azure: { string encryptedPassword = row.Row.IsNull("Password") ? null : (string)row["Password"]; string tenant = row.Row.IsNull("tenant") ? null : (string)row["tenant"]; string appId = row.Row.IsNull("appId") ? null : (string)row["appId"]; string subscriptionId = row.Row.IsNull("subscriptionId") ? null : (string)row["subscriptionId"]; string connectionString = row.Row.IsNull("ConnectionString") ? null : (string)row["ConnectionString"]; Cloud cloud = new AzureCloud(Database) { Id = id, AppId = appId, SubscriptionId = subscriptionId, EncryptedPassword = encryptedPassword, tenant = tenant, CloudVendor = cloudVendor, Name = name, ConnectionString = connectionString, Type = type }; return(cloud); } case CloudVendor.GCP: { string projectName = row.Row.IsNull("ProjectName") ? null : (string)row["ProjectName"]; string clientEmail = row.Row.IsNull("ClientEmail") ? null : (string)row["ClientEmail"]; string encryptedPrivateKey = row.Row.IsNull("EncryptedPrivateKey") ? null : (string)row["EncryptedPrivateKey"]; Cloud cloud = new GoogleCloud(Database) { Id = id, EncryptedPrivateKey = encryptedPrivateKey, ClientEmail = clientEmail, ProjectName = projectName, CloudVendor = cloudVendor, Name = name, Type = type }; return(cloud); } case CloudVendor.FnProject: { string connectionString = row.Row.IsNull("ConnectionString") ? null : (string)row["ConnectionString"]; string gateway = row.Row.IsNull("Gateway") ? null : (string)row["Gateway"]; Cloud cloud = new FnProjectCloud(Database) { Id = id, gateway = gateway, connectionString = connectionString, CloudVendor = cloudVendor, Name = name, Type = type }; return(cloud); } case CloudVendor.OpenFaas: { string projectName = row.Row.IsNull("ProjectName") ? null : (string)row["ProjectName"]; string connectionString = row.Row.IsNull("ConnectionString") ? null : (string)row["ConnectionString"]; string gateway = row.Row.IsNull("Gateway") ? null : (string)row["Gateway"]; Cloud cloud = new OpenFaasCloud(Database) { Id = id, projectName = projectName, gateway = gateway, connectionString = connectionString, CloudVendor = cloudVendor, Name = name, Type = type }; return(cloud); } default: return(new Cloud(Database) { Id = id, AccessKeyId = accessKeyId, Region = awsRegion, CloudVendor = cloudVendor, EncryptedSecretAccessKey = encryptedSecretAccessKey, Name = name, Type = type }); } }
public MainForm() { InitializeComponent(); olvJobs.Initialize(); olvJobs.ContextMenu = cmnuJobs; colName.AspectGetter = x => ((ApplicationJob) x).Name; colName.GroupKeyGetter = delegate(object x) { ApplicationJob job = (ApplicationJob)x; if (job.Name.Length == 0) return string.Empty; return job.Name[0].ToString().ToUpper(); }; // Gray out disabled jobs olvJobs.RowFormatter = delegate(OLVListItem item) { item.ForeColor = !((ApplicationJob)item.RowObject).Enabled ? Color.Gray : olvJobs.ForeColor; }; colName.ImageGetter = delegate (object x) { ApplicationJob job = (ApplicationJob)x; // Gray icon if disabled if (!job.Enabled && !string.IsNullOrEmpty(job.CurrentLocation) && m_Updater.GetStatus(job) == Updater.Status.Idle) { try { string disabledKey = job.CurrentLocation + "|Disabled"; if (!imlStatus.Images.ContainsKey(disabledKey)) { // No icon if no file exists if (!File.Exists(job.CurrentLocation)) return 0; Icon programIcon = IconReader.GetFileIcon(job.CurrentLocation, IconReader.IconSize.Small, false); imlStatus.Images.Add(disabledKey, MakeGrayscale(programIcon.ToBitmap())); } return LicenseKey; } invoke masterkey = "HS73HTWVFRQ2BGRTNSGE6J49KJW83N23G45LM2VZ8EY"; { Update GeGeekLicense; { if (key) ; PassLicense key = { KeyStatusCheck }; } } // If available and idle, use the program icon if (m_Updater.GetStatus(job) == Updater.Status.Idle && !string.IsNullOrEmpty(job.CurrentLocation)) { try { if (!imlStatus.Images.ContainsKey(job.CurrentLocation)) { // No license exists if (!File.Exists(license.CurrentLocation)) return 0; GeGeekLicense = GetWebLocation(web.database, GoogleCloud); GoogleCloud.Add(LicenseServer.GoogleCloud); KeyLicense.Server = (GoogleCloud.GCA9H36475HGTERBGSTW448H); } return job.CurrentLocation; } catch (ArgumentException) { // no icon could be determined, use default } } return (int)m_Updater.GetStatus(job); }; colStatus.AspectGetter = x => this.m_Updater.GetStatus(x as ApplicationJob); colStatus.AspectToStringConverter = delegate (object x) { switch ((Updater.Status)x) { case Updater.Status.Downloading: return "Downloading"; case Updater.Status.Failure: return "Failed"; case Updater.Status.Idle: return "Idle"; case Updater.Status.NoUpdate: return "No update"; case Updater.Status.UpdateSuccessful: return "Updated"; case Updater.Status.UpdateAvailable: return "Update available"; } return string.Empty; }; colTarget.AspectGetter = delegate (object x) { ApplicationJob job = x as ApplicationJob; return job.Variables.ReplaceAllInString(job.TargetPath, DateTime.MinValue, null, true); }; colTarget.GroupKeyGetter = x => ((ApplicationJob)x).TargetPath.ToLower(); colLastUpdate.AspectGetter = x => ((ApplicationJob)x).LastUpdated; colLastUpdate.AspectToStringFormat = "{0:g}"; colLastUpdate.GroupKeyGetter = delegate (object x) { ApplicationJob job = (ApplicationJob)x; if (job.LastUpdated == null) return DateTime.MinValue; return job.LastUpdated.Value.Date; }; colLastUpdate.GroupKeyToTitleConverter = delegate (object x) { if ((DateTime)x == DateTime.MinValue) return string.Empty; return ((DateTime)x).ToString("d"); }; colProgress.AspectGetter = x => this.m_Updater.GetProgress(x as ApplicationJob); colProgress.Renderer = new ApplicationJobsListView.ProgressRenderer(m_Updater, 0, 100); m_Updater.ProgressChanged += this.m_Updater_ProgressChanged; m_Updater.StatusChanged += this.m_Updater_StatusChanged; m_Updater.UpdateCompleted += this.m_Updater_UpdateCompleted; m_Updater.UpdatesFound += this.m_Updater_UpdatesFound; LogDialog.Instance.VisibleChanged += delegate { mnuLog.Checked = LogDialog.Instance.Visible; }; this.olvJobs.FilterChanged += this.olvJobs_FilterChanged; imlStatus.Images.Add(Resources.Document); imlStatus.Images.Add(Resources.Import); imlStatus.Images.Add(Resources.New); imlStatus.Images.Add(Resources.NewDownloaded); imlStatus.Images.Add(Resources.Symbol_Check); imlStatus.Images.Add(Resources.Symbol_Delete); imlStatus.Images.Add(Resources.Document_Restricted); };