Exemplo n.º 1
0
        public List <Parameter> GetActiveParameters()
        {
            if (string.IsNullOrEmpty(Environment))
            {
                if (Parameters.Any())
                {
                    return(Parameters);
                }

                if (Environments.Any())
                {
                    return(Environments.First().Parameters);
                }
            }
            else
            {
                var environment = Environment.ToLower();
                foreach (var e in Environments)
                {
                    if (!string.IsNullOrEmpty(e.Name) && e.Name.ToLower() == environment)
                    {
                        return(e.Parameters);
                    }
                }
            }

            return(new List <Parameter>());
        }
Exemplo n.º 2
0
        protected override void ProcessRecord()
        {
            var qb = new QuerystringBuilder();

            if (Environments != null && Environments.Any())
            {
                List <string> envs = Environments.ToList().ConvertAll <string>(x => x.ToString().First().ToString().ToLower() + x.ToString().Substring(1));
                qb.Add("environments", string.Join(",", envs));
            }

            if (Ids != null && Ids.Any())
            {
                qb.Add("ids", string.Join(",", Ids));
            }

            if (Names != null && Names.Any())
            {
                qb.Add("names", string.Join(",", Names));
            }

            var preparedUrl = $"/public/protectionPolicies{qb.Build()}";
            var result      = Session.ApiClient.Get <IEnumerable <Model.ProtectionPolicy> >(preparedUrl);

            WriteObject(result, true);
        }
Exemplo n.º 3
0
        private async Task <bool> ExecuteAsync()
        {
            using (var client = new GrafanaClient(Host, AccessToken))
            {
                var deploy = new DeployImporter(
                    grafanaClient: client,
                    sourceTagValue: Tag,
                    dashboardDirectory: DashboardDirectory,
                    datasourceDirectory: DataSourceDirectory,
                    notificationDirectory: NotificationDirectory,
                    environments: Environments.Select(e => e.ItemSpec).ToArray(),
                    parametersFilePath: ParametersFile,
                    environment: Environment,
                    log: Log);

                try
                {
                    await deploy.ImportFromGrafana(DashboardId);
                }
                catch (HttpRequestException e)
                {
                    Log.LogErrorFromException(e,
                                              showStackTrace: false,
                                              showDetail: false,
                                              file: "MonitoringImport");
                    return(false);
                }
            }

            return(true);
        }
Exemplo n.º 4
0
 protected void Page_Load(object sender, EventArgs e)
 {
     Response.Cookies["loginreferrer"].Value   = "/admin/ip_networks.aspx";
     Response.Cookies["loginreferrer"].Expires = DateTime.Now.AddDays(30);
     if (Request.Cookies["adminid"] != null && Request.Cookies["adminid"].Value != "")
     {
         intProfile = Int32.Parse(Request.Cookies["adminid"].Value);
     }
     else
     {
         Response.Redirect("/admin/login.aspx");
     }
     oIPAddresses = new IPAddresses(intProfile, dsnIP, dsn);
     oEnvironment = new Environments(intProfile, dsn);
     oClass       = new Classes(intProfile, dsn);
     if (!IsPostBack)
     {
         LoadClasses();
         btnParent.Attributes.Add("onclick", "return OpenWindow('IPVLANBROWSER','" + hdnParent.ClientID + "','&control=" + hdnParent.ClientID + "&controltext=" + lblParent.ClientID + "',false,400,600);");
         btnDelete.Attributes.Add("onclick", "return confirm('Are you sure you want to delete this item?');");
         btnCancel.Attributes.Add("onclick", "return Cancel();");
         txtMin1.Attributes.Add("onkeyup", "CopyTextBox('" + txtMin1.ClientID + "','" + txtMax1.ClientID + "');");
         txtMin2.Attributes.Add("onkeyup", "CopyTextBox('" + txtMin2.ClientID + "','" + txtMax2.ClientID + "');");
         txtMin3.Attributes.Add("onkeyup", "CopyTextBox('" + txtMin3.ClientID + "','" + txtMax3.ClientID + "');");
         btnRelations.Attributes.Add("onclick", "return OpenWindow('NETWORKSRELATED','" + hdnId.ClientID + "','',false,'500',500);");
     }
 }
Exemplo n.º 5
0
 /// <summary>
 /// Initialises a new instance of the <see cref="ApiContext"/> class.
 /// </summary>
 public ApiContext(
     Environments env,
     AuthenticationMethod authMethod = AuthenticationMethod.PredefinedJWT)
 {
     Environment          = env;
     AuthenticationMethod = authMethod;
 }
Exemplo n.º 6
0
 protected void Page_Load(object sender, EventArgs e)
 {
     intProfile   = Int32.Parse(Request.Cookies["profileid"].Value);
     oPage        = new Pages(intProfile, dsn);
     oPlatform    = new Platforms(intProfile, dsn);
     oType        = new Types(intProfile, dsn);
     oLocation    = new Locations(intProfile, dsn);
     oAsset       = new Asset(intProfile, dsnAsset);
     oRacks       = new Racks(intProfile, dsn);
     oClasses     = new Classes(intProfile, dsn);
     oRooms       = new Rooms(intProfile, dsn);
     oFloor       = new Floor(intProfile, dsn);
     oEnvironment = new Environments(intProfile, dsn);
     oDepot       = new Depot(intProfile, dsn);
     oDepotRoom   = new DepotRoom(intProfile, dsn);
     oShelf       = new Shelf(intProfile, dsn);
     oUser        = new Users(intProfile, dsn);
     if (Request.QueryString["applicationid"] != null && Request.QueryString["applicationid"] != "")
     {
         intApplication = Int32.Parse(Request.QueryString["applicationid"]);
     }
     if (Request.QueryString["pageid"] != null && Request.QueryString["pageid"] != "")
     {
         intPage = Int32.Parse(Request.QueryString["pageid"]);
     }
     if (Request.Cookies["application"] != null && Request.Cookies["application"].Value != "")
     {
         intApplication = Int32.Parse(Request.Cookies["application"].Value);
     }
     if (!IsPostBack)
     {
         if (Request.QueryString["id"] != null && Request.QueryString["id"] != "")
         {
             LoadLists();
             Load(Int32.Parse(Request.QueryString["id"]));
             txtDate.Text = DateTime.Today.ToShortDateString();
             imgDate.Attributes.Add("onclick", "return ShowCalendar('" + txtDate.ClientID + "');");
             btnSubmit.Attributes.Add("onclick", "return ValidateText('" + txtAsset.ClientID + "','Please enter the asset tag')" +
                                      " && ValidateDropDown('" + ddlDepot.ClientID + "','Please make a selection for the location of the asset')" +
                                      " && ValidateText('" + txtDepotRoom.ClientID + "','Please enter the depot room')" +
                                      " && ValidateText('" + txtShelf.ClientID + "','Please enter the shelf')" +
                                      " && ValidateNumber0('" + txtPorts.ClientID + "','Please enter a valid number of available ports')" +
                                      " && ValidateHidden0('" + hdnLocation.ClientID + "','ddlState','Please select a location')" +
                                      " && ValidateText('" + txtRoom.ClientID + "','Please enter the room')" +
                                      " && ValidateText('" + txtRack.ClientID + "','Please enter the rack')" +
                                      " && ValidateText('" + txtRackPosition.ClientID + "','Please enter the rack position')" +
                                      " && ValidateDropDown('" + ddlEnvironment.ClientID + "','Please make a selection for the environment')" +
                                      " && ValidateDropDown('" + ddlClass.ClientID + "','Please make a selection for the current class')" +
                                      " && ValidateText('" + txtName.ClientID + "','Please enter the device name')" +
                                      " && ValidateNumber0('" + txtIP1.ClientID + "','Please enter a valid IP address')" +
                                      " && ValidateNumber0('" + txtIP2.ClientID + "','Please enter a valid IP address')" +
                                      " && ValidateNumber0('" + txtIP3.ClientID + "','Please enter a valid IP address')" +
                                      " && ValidateNumber0('" + txtIP4.ClientID + "','Please enter a valid IP address')" +
                                      " && ValidateDate('" + txtDate.ClientID + "','Please enter a valid date')" +
                                      ";");
             ddlClass.Attributes.Add("onchange", "PopulateEnvironments('" + ddlClass.ClientID + "','" + ddlEnvironment.ClientID + "',0);");
             ddlEnvironment.Attributes.Add("onchange", "UpdateDropDownHidden('" + ddlEnvironment.ClientID + "','" + hdnEnvironment.ClientID + "');");
         }
     }
 }
        protected override void ProcessRecord()
        {
            var queries = new Dictionary <string, string>();

            // Always include last run and stats
            queries.Add("includeLastRunAndStats", true.ToString().ToLower());

            if (OnlyActive.IsPresent)
            {
                queries.Add("isActive", true.ToString().ToLower());
            }

            if (OnlyInactive.IsPresent)
            {
                queries.Add("isActive", false.ToString().ToLower());
            }

            if (OnlyDeleted.IsPresent)
            {
                queries.Add("isDeleted", true.ToString().ToLower());
            }

            if (Ids != null && Ids.Any())
            {
                queries.Add("ids", string.Join(",", Ids));
            }

            if (Names != null && Names.Any())
            {
                queries.Add("names", string.Join(",", Names));
            }

            if (PolicyIds != null && PolicyIds.Any())
            {
                queries.Add("policyIds", string.Join(",", PolicyIds));
            }

            if (Environments != null && Environments.Any())
            {
                List <string> envs = Environments.ToList().ConvertAll <string>(x => x.ToString().First().ToString().ToLower() + x.ToString().Substring(1));
                queries.Add("environments", string.Join(",", envs));
            }

            var queryString = string.Empty;

            if (queries.Any())
            {
                queryString = "?" + string.Join("&", queries.Select(q => $"{q.Key}={q.Value}"));
            }

            var preparedUrl = $"/public/protectionJobs{queryString}";
            var results     = Session.ApiClient.Get <IEnumerable <Model.ProtectionJob> >(preparedUrl);

            // Hide deleted protection jobs unless explicitly asked for
            if (!OnlyDeleted.IsPresent)
            {
                results = results.Where(x => !(x.Name.StartsWith("_DELETED"))).ToList();
            }
            WriteObject(results, true);
        }
        private ClientConfig(
            Environments environment,
            String consumerKey,
            String consumerSecret,
            int clientTimeout,
            long maxResponseContentBufferSize,
            bool compressionEnabled)
        {
            if (String.IsNullOrEmpty(consumerKey))
            {
                throw new ArgumentException("securityConsumerKey property cannot be blank.");
            }

            if (String.IsNullOrEmpty(consumerSecret))
            {
                throw new ArgumentException("securityConsumerSecret property cannot be blank.");
            }

            if (clientTimeout < 0)
            {
                throw new ArgumentException("clientTimeout must be a positive number.");
            }

            if (maxResponseContentBufferSize < 0)
            {
                throw new ArgumentException("maxResponseContentBufferSize must be a positive number.");
            }

            Environment    = environment;
            ConsumerKey    = consumerKey;
            ConsumerSecret = consumerSecret;
            ClientTimeout  = clientTimeout;
            MaxResponseContentBufferSize = maxResponseContentBufferSize;
            CompressionEnabled           = compressionEnabled;
        }
Exemplo n.º 9
0
 public DeploymentActionResource ClearAllConditions()
 {
     Channels.Clear();
     Environments.Clear();
     TenantTags.Clear();
     return(this);
 }
        /// <summary>
        /// Writes profile to a specified path.
        /// </summary>
        /// <param name="path"></param>
        public void Save(string path)
        {
            if (string.IsNullOrEmpty(path))
            {
                throw new ArgumentNullException("path");
            }

            // Removing predefined environments
            foreach (string env in AzureEnvironment.PublicEnvironments.Keys)
            {
                Environments.Remove(env);
            }

            JsonProfileSerializer jsonSerializer = new JsonProfileSerializer();

            string contents     = jsonSerializer.Serialize(this);
            string diskContents = string.Empty;

            if (AzureSession.DataStore.FileExists(path))
            {
                diskContents = AzureSession.DataStore.ReadFileAsText(path);
            }

            if (diskContents != contents)
            {
                AzureSession.DataStore.WriteFile(path, contents);
            }
        }
Exemplo n.º 11
0
 /// <summary>
 /// create an environment
 /// </summary>
 /// <param name="env"></param>
 /// <param name="tenantId"></param>
 /// <returns>Success message</returns>
 public int CreateEnvironment(Environments env, int tenantId)
 {
     try
     {
         string userDefinedEnv = @"INSERT INTO [dbo].[UserDefinedEnvironments](Environment,TenantId)
                                     VALUES(@Environment,@TenantId)";
         int    insertedEnv    = 0;
         using (IDbConnection con = _Idbconnection)
         {
             con.Open();
             var sqlTrans = con.BeginTransaction();
             insertedEnv = con.Execute(userDefinedEnv, new
             {
                 Environment = env.Environment,
                 TenantId    = tenantId
             }, sqlTrans);
             if (insertedEnv > 0)
             {
                 sqlTrans.Commit();
             }
             else
             {
                 sqlTrans.Rollback();
             }
             con.Close();
         }
         return(insertedEnv);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Exemplo n.º 12
0
 protected void Page_Load(object sender, EventArgs e)
 {
     Response.Cookies["loginreferrer"].Value   = "/admin/forecast/ondemand_sending.aspx";
     Response.Cookies["loginreferrer"].Expires = DateTime.Now.AddDays(30);
     if (Request.Cookies["adminid"] != null && Request.Cookies["adminid"].Value != "")
     {
         intProfile = Int32.Parse(Request.Cookies["adminid"].Value);
     }
     else
     {
         Response.Redirect("/admin/login.aspx");
     }
     oOnDemandSending = new OnDemandSending(intProfile, dsn);
     oEnvironment     = new Environments(intProfile, dsn);
     oClass           = new Classes(intProfile, dsn);
     if (!IsPostBack)
     {
         LoadClasses();
         LoadLists();
         btnCancel.Attributes.Add("onclick", "return Cancel();");
         btnDelete.Attributes.Add("onclick", "return confirm('Are you sure you want to delete this item?');");
         ddlClass.Attributes.Add("onchange", "PopulateEnvironments('" + ddlClass.ClientID + "','" + ddlEnvironment.ClientID + "',0);");
         ddlEnvironment.Attributes.Add("onchange", "UpdateDropDownHidden('" + ddlEnvironment.ClientID + "','" + hdnEnvironment.ClientID + "');");
     }
 }
            /// <exception cref="Db4objects.Db4o.Ext.Db4oIOException"></exception>
            public override IBin Open(BinConfiguration config)
            {
                IBin bin = base.Open(config);

                ((IBlockSize)Environments.My(typeof(IBlockSize))).Register((IListener4)bin);
                return(bin);
            }
Exemplo n.º 14
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (Request.Cookies["adminid"] != null && Request.Cookies["adminid"].Value != "")
     {
         intProfile = Int32.Parse(Request.Cookies["adminid"].Value);
     }
     else
     {
         Reload();
     }
     oClass       = new Classes(intProfile, dsn);
     oEnvironment = new Environments(intProfile, dsn);
     btnClose.Attributes.Add("onclick", "return HidePanel();");
     if (Request.QueryString["id"] != null && Request.QueryString["id"] != "")
     {
         intClass = Int32.Parse(Request.QueryString["id"]);
     }
     if (!IsPostBack)
     {
         Load(null);
         if (intClass > 0)
         {
             lblName.Text = oClass.Get(intClass, "name");
         }
     }
 }
Exemplo n.º 15
0
        void ExecEnvDelete()
        {
            if (!(EnvList.SelectedItem is Environment env))
            {
                return;
            }

            if (Configuration.Instance.LocalSettings.ConfirmDelete)
            {
                if (MessageBoxResult.Yes != MessageBox.Show(
                        $"Are you sure you want to delete environment '{env.Name}'?",
                        Strings.APP_NAME,
                        MessageBoxButton.YesNo,
                        MessageBoxImage.Warning
                        ))
                {
                    return;
                }
            }

            var idx = EnvList.SelectedIndex;

            env.Delete();
            Environments.Remove(env);
            EnvList.SelectedIndex = Math.Min(idx, Environments.Count - 1);;
        }
Exemplo n.º 16
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (Request.Cookies["adminid"] != null && Request.Cookies["adminid"].Value != "")
     {
         intProfile = Int32.Parse(Request.Cookies["adminid"].Value);
     }
     else
     {
         Reload();
     }
     oIPAddresses = new IPAddresses(intProfile, dsnIP, dsn);
     oEnvironment = new Environments(intProfile, dsn);
     oClass       = new Classes(intProfile, dsn);
     btnClose.Attributes.Add("onclick", "return HidePanel();");
     if (Request.QueryString["id"] != null && Request.QueryString["id"] != "")
     {
         intNetwork = Int32.Parse(Request.QueryString["id"]);
     }
     if (!IsPostBack)
     {
         LoadClasses();
         if (intNetwork > 0)
         {
             lblName.Text = oIPAddresses.GetNetworkName(intNetwork);
         }
         // Expand Nodes
         foreach (TreeNode oChild in oTree.Nodes)
         {
             if (Expand(oChild) == true)
             {
                 oChild.Expand();
             }
         }
     }
 }
Exemplo n.º 17
0
 public void ChangeEnvironmentName(string oldEnvName, string newEnvName)
 {
     if (EnvExists(oldEnvName))
     {
         Environments[Environments.IndexOf(oldEnvName)] = newEnvName;
     }
 }
Exemplo n.º 18
0
 protected void Page_Load(object sender, EventArgs e)
 {
     Response.Cookies["loginreferrer"].Value   = "/admin/albert_ip.aspx";
     Response.Cookies["loginreferrer"].Expires = DateTime.Now.AddDays(30);
     if (Request.Cookies["adminid"] != null && Request.Cookies["adminid"].Value != "")
     {
         intProfile = Int32.Parse(Request.Cookies["adminid"].Value);
     }
     else
     {
         Response.Redirect("/admin/login.aspx");
     }
     oIPAddresses = new IPAddresses(0, dsnIP, dsn);
     oEnvironment = new Environments(0, dsn);
     oClass       = new Classes(0, dsn);
     oServer      = new Servers(0, dsn);
     if (!IsPostBack)
     {
         if (Request.QueryString["done"] != null)
         {
             panDone.Visible = true;
             lblImport.Text  = Request.QueryString["done"];
         }
         LoadClasses();
         btnImport.Attributes.Add("onclick", "return ValidateHidden0('" + hdnVLAN.ClientID + "','" + txtVLAN.ClientID + "','Please select a Network') && ValidateText('" + oFile.ClientID + "','Please select a file');");
     }
 }
Exemplo n.º 19
0
        /// <summary>
        /// Fetches an object starting at the local scope and then moving up
        /// the hierarchy
        /// </summary>
        /// <param name="key"></param>
        /// <returns></returns>
        private object FindVariable(string key)
        {
            Hash   scope    = Scopes.FirstOrDefault(s => s.ContainsKey(key));
            object variable = null;

            if (scope == null)
            {
                foreach (Hash e in Environments)
                {
                    if ((variable = LookupAndEvaluate(e, key)) != null)
                    {
                        scope = e;
                        break;
                    }
                }
            }
            scope    = scope ?? Environments.LastOrDefault() ?? Scopes.Last();
            variable = variable ?? LookupAndEvaluate(scope, key);

            variable = Liquidize(variable);
            if (variable is IContextAware)
            {
                ((IContextAware)variable).Context = this;
            }
            return(variable);
        }
Exemplo n.º 20
0
 protected void Page_Load(object sender, EventArgs e)
 {
     Response.Cookies["loginreferrer"].Value   = "/admin/ip_vlans.aspx";
     Response.Cookies["loginreferrer"].Expires = DateTime.Now.AddDays(30);
     if (Request.Cookies["adminid"] != null && Request.Cookies["adminid"].Value != "")
     {
         intProfile = Int32.Parse(Request.Cookies["adminid"].Value);
     }
     else
     {
         Response.Redirect("/admin/login.aspx");
     }
     oIPAddresses = new IPAddresses(intProfile, dsnIP, dsn);
     oEnvironment = new Environments(intProfile, dsn);
     oClass       = new Classes(intProfile, dsn);
     oLocation    = new Locations(intProfile, dsn);
     oResiliency  = new Resiliency(intProfile, dsn);
     if (!IsPostBack)
     {
         LoadLists();
         LoadClasses();
         oTreeview.ExpandDepth = 0;
         btnParent.Attributes.Add("onclick", "return OpenWindow('LOCATION_BROWSER','" + hdnParent.ClientID + "','&control=" + hdnParent.ClientID + "&controltext=" + lblParent.ClientID + "',false,400,600);");
         btnDelete.Attributes.Add("onclick", "return confirm('Are you sure you want to delete this item?');");
         btnCancel.Attributes.Add("onclick", "return Cancel();");
         ddlClass.Attributes.Add("onchange", "PopulateEnvironments('" + ddlClass.ClientID + "','" + ddlEnvironment.ClientID + "',0);");
         ddlEnvironment.Attributes.Add("onchange", "UpdateDropDownHidden('" + ddlEnvironment.ClientID + "','" + hdnEnvironment.ClientID + "');");
     }
 }
Exemplo n.º 21
0
        public EnvironmentConfiguration Verify(string environment)
        {
            if (string.IsNullOrWhiteSpace(environment))
            {
                throw new ConfigurationException(ExceptionMessages.MissingEnvironment);
            }

            var sb = new StringBuilder();

            var environmentConfig = Environments.FirstOrDefault(e => e.Name.ToUpper().Equals(environment.ToUpper()));

            if (null == environmentConfig)
            {
                throw new ConfigurationException($"The environment {environment} does not exist in config.json");
            }

            if (string.IsNullOrEmpty(environmentConfig.ConnectionString))
            {
                sb.AppendLine(ExceptionMessages.MissingConnectionString);
            }

            if (environmentConfig.ResetDatabase && string.IsNullOrWhiteSpace(environmentConfig.ResetConnectionString))
            {
                sb.AppendLine(ExceptionMessages.MissingResetConnectionString);
            }

            // if we have any errors throw an exception
            if (sb.Length > 0)
            {
                throw new ConfigurationException(sb.ToString());
            }

            return(environmentConfig);
        }
Exemplo n.º 22
0
		    public ParseColors(Environments env, Logger log) {
                this.env = env;
			    if (!File.Exists(env.ROOT + "lib" + env.DELIM + "colors.csv")) {
				    log.Report(2, "ParseColors", "File colors.csv does not exist");
				    return;
			    }
		    }
Exemplo n.º 23
0
 /// <exception cref="Db4objects.Db4o.Ext.Db4oIOException"></exception>
 public virtual IBin Open(BinConfiguration config)
 {
     IoAdapterStorage.IoAdapterBin bin = new IoAdapterStorage.IoAdapterBin(_io.Open(config
                                                                                    .Uri(), config.LockFile(), config.InitialLength(), config.ReadOnly()));
     ((IBlockSize)Environments.My(typeof(IBlockSize))).Register(bin);
     return(bin);
 }
Exemplo n.º 24
0
        public bool Parse(Lexer lexer, Token token, Attributes attributes)
        {
            var successfullyParsed = true;

            try
            {
                var environments = new Environments();

                environments.Push(new Environment()
                {
                    IsGlobal = true
                });

                attributes.AddAttribute(environments, "ENVS");

                successfullyParsed &= ParserFactory.GetEnvironmentParser().Parse(lexer, token, attributes);

                ValidateToken(lexer.GetCurrentToken(), TokenType.EndOfFile);
            }
            catch (Exception ex)
            {
                successfullyParsed = false;
                Logger(ex.Message);
            }

            return(successfullyParsed);
        }
Exemplo n.º 25
0
        private void LoadSettingFromDefaultFile(
            string fullPathToDirectory,
            Environments environment,
            FileFormats expectingFormat
            )
        {
            if (this.SettingsFilename == null)
            {
                return;
            }
            if (this.SettingsFilename.Count <= 0)
            {
                return;
            }

            var Environment = environment.ToString();

            if (!this.SettingsFilename.ContainsKey(Environment))
            {
                return;
            }
            this.LoadSettingFromFile(
                string.Format(@"{0}\{1}", fullPathToDirectory, this.SettingsFilename[Environment]),
                expectingFormat
                );
        }
Exemplo n.º 26
0
            /// <summary>
            /// Adds an event to the appropriate list for its type; returns the event.
            /// </summary>
            public Event Add(Event evnt)
            {
                switch (evnt)
                {
                case Event.Light e: Lights.Add(e); break;

                case Event.Sound e: Sounds.Add(e); break;

                case Event.SFX e: SFX.Add(e); break;

                case Event.Wind e: Wind.Add(e); break;

                case Event.Treasure e: Treasures.Add(e); break;

                case Event.Generator e: Generators.Add(e); break;

                case Event.Message e: Messages.Add(e); break;

                case Event.ObjAct e: ObjActs.Add(e); break;

                case Event.SpawnPoint e: SpawnPoints.Add(e); break;

                case Event.MapOffset e: MapOffsets.Add(e); break;

                case Event.Navmesh e: Navmeshes.Add(e); break;

                case Event.Environment e: Environments.Add(e); break;

                case Event.PseudoMultiplayer e: PseudoMultiplayers.Add(e); break;

                default:
                    throw new ArgumentException($"Unrecognized type {evnt.GetType()}.", nameof(evnt));
                }
                return(evnt);
            }
Exemplo n.º 27
0
        /// <summary>
        ///     Adds an environment and it's resources to the tree
        /// </summary>
        public void AddEnvironment(IEnvironmentModel environment)
        {
            VerifyArgument.IsNotNull("environment", environment);
            var environmentId = environment.ID;

            StudioResourceRepository.AddServerNode(new ExplorerItemModel(_connectControlSingleton, StudioResourceRepository)
            {
                ResourcePath  = "",
                DisplayName   = environment.Name,
                ResourceType  = ResourceType.Server,
                EnvironmentId = environment.ID,
                IsConnected   = false,
            });

            if (Environments.All(e => e.ID != environmentId))
            {
                Environments.Add(environment);
            }

            UpdateNavigationView();

            if (environment.Equals(EnvironmentRepository.Source) && environment.Connection != null)
            {
                environment.Connection.StartAutoConnect();
            }
        }
Exemplo n.º 28
0
        /// <summary>
        /// Tipo de negócio: E-COMMERCE
        /// </summary>
        /// <param name="environments">Escolha um "meio ambiente" você quer executar suas ações</param>
        /// <param name="token">token</param>
        /// <param name="key">chave</param>
        public WirecardClient(Environments environments, string token, string key)
        {
            if (!string.IsNullOrEmpty(_HttpClient.BusinessType))
            {
                if (_HttpClient.BusinessType != "E-COMMERCE")
                {
                    string newLine = Environment.NewLine;
                    throw new ArgumentException("Business type already defined: MARKETPLACE.");
                }
            }
            byte[] TextByte = Encoding.UTF8.GetBytes($"{token}:{key}");
            string base64   = Convert.ToBase64String(TextByte);
            Regex  regex    = new Regex(@"^[a-zA-Z0-9]{98}==$");
            Match  match    = regex.Match(base64);

            if (token.Length != 32 || key.Length != 40)
            {
                throw new ArgumentException("(token or key) invalid");
            }
            if (!match.Success)
            {
                throw new ArgumentException("base64 invalid");
            }
            //_HttpClient.uri = environments == Environments.SANDBOX ? BaseAddress.SANDBOX : BaseAddress.PRODUCTION;
            _HttpClient.SelectedEnvironment = environments;
            _HttpClient.base64       = base64;
            _HttpClient.BusinessType = "E-COMMERCE";
        }
Exemplo n.º 29
0
        private bool SaveImplementation(string fileName, bool saveAs)
        {
            try
            {
                if (!SaveMainConfiguration(fileName, saveAs))
                {
                    return(false);
                }


                foreach (var envrionment in Environments.OfType <EnvironmentSourceViewModel>())
                {
                    if (!envrionment.SaveDelta())
                    {
                        return(false);
                    }
                }

                IsDirty = false;
                return(true);
            }
            catch (Exception ex)
            {
                uiService.ShowMessageWpf(string.Format(CultureInfo.CurrentCulture, Resources.SaveApplicationErrorMessage, ex.Message),
                                         Resources.SaveApplicationErrorMessageTitle, MessageBoxButton.OK);

                return(false);
            }
        }
Exemplo n.º 30
0
 protected void Page_Load(object sender, EventArgs e)
 {
     Response.Cookies["loginreferrer"].Value   = "/admin/vmware/folders.aspx";
     Response.Cookies["loginreferrer"].Expires = DateTime.Now.AddDays(30);
     if (Request.Cookies["adminid"] != null && Request.Cookies["adminid"].Value != "")
     {
         intProfile = Int32.Parse(Request.Cookies["adminid"].Value);
     }
     else
     {
         Response.Redirect("/admin/login.aspx");
     }
     oVMWare      = new VMWare(intProfile, dsn);
     oEnvironment = new Environments(intProfile, dsn);
     oClass       = new Classes(intProfile, dsn);
     oLocation    = new Locations(intProfile, dsn);
     if (!IsPostBack)
     {
         LoadLists();
         LoadVirtualCenters();
         btnDelete.Attributes.Add("onclick", "return confirm('Are you sure you want to delete this item?');");
         btnCancel.Attributes.Add("onclick", "return Cancel();");
         btnLocations.Attributes.Add("onclick", "return OpenWindow('VMWARE_FOLDERS','" + hdnId.ClientID + "','',false,'650',500);");
         strLocation       = oLocation.LoadDDL("ddlState", "ddlCity", "ddlAddress", hdnLocation.ClientID, intLocation, true, "ddlCommon");
         hdnLocation.Value = intLocation.ToString();
         ddlClass.Attributes.Add("onchange", "PopulateEnvironments('" + ddlClass.ClientID + "','" + ddlEnvironment.ClientID + "',1);");
         ddlEnvironment.Attributes.Add("onchange", "UpdateDropDownHidden('" + ddlEnvironment.ClientID + "','" + hdnEnvironment.ClientID + "');");
     }
 }
 protected void Page_Load(object sender, EventArgs e)
 {
     Response.Cookies["loginreferrer"].Value   = "/admin/forecast/solution_codes_locations.aspx";
     Response.Cookies["loginreferrer"].Expires = DateTime.Now.AddDays(30);
     if (Request.Cookies["adminid"] != null && Request.Cookies["adminid"].Value != "")
     {
         intProfile = Int32.Parse(Request.Cookies["adminid"].Value);
     }
     else
     {
         Response.Redirect("/admin/login.aspx");
     }
     oLocation    = new Locations(intProfile, dsn);
     oSolution    = new Solution(intProfile, dsn);
     oEnvironment = new Environments(intProfile, dsn);
     oClass       = new Classes(intProfile, dsn);
     if (!IsPostBack)
     {
         LoadClasses();
         LoadLists();
         btnParent.Attributes.Add("onclick", "return OpenWindow('LOCATION_BROWSER','" + hdnParent.ClientID + "','&control=" + hdnParent.ClientID + "&controltext=" + lblParent.ClientID + "',false,400,600);");
         btnCancel.Attributes.Add("onclick", "return Cancel();");
         ddlClass.Attributes.Add("onchange", "PopulateEnvironments('" + ddlClass.ClientID + "','" + ddlEnvironment.ClientID + "',0);");
         ddlEnvironment.Attributes.Add("onchange", "UpdateDropDownHidden('" + ddlEnvironment.ClientID + "','" + hdnEnvironment.ClientID + "');");
     }
 }
Exemplo n.º 32
0
			public Game() {
				manager = new Manager();
				watcher = new Watcher(manager);
				instance = new Instance();
				save = new Save();
				env = new Environments();
				env.GUID = Guid.NewGuid();
			}
Exemplo n.º 33
0
		    public Database(Environments env) {
                log = new Logger(env);
                this.env = env;
                db = String.Format("{0}dat{1}store",env.ROOT,env.DELIM);
			    log.Report(0, "Database", "Creating DB");
			    Create();
			    Check();
		    }
Exemplo n.º 34
0
 /// <summary>
 /// Constructor for Every Test Factory
 /// </summary>
 static BaseDataFactory() 
 {
     if (!IsIntialized)
     {
         Environment = Helpers.Environment.GetConfigEnvironment();
         SetSdKparameters();
     }
 }
        public RequestTokenService(Environments.Environment environment, string consumerKey, AsymmetricAlgorithm privateKey)
            : base(consumerKey, privateKey)
        {
            this.environment = environment;

            // ignore possible security certificate errors
            ServicePointManager.ServerCertificateValidationCallback += (sender, cert, chain, sslPolicyErrors) => true;
        }
Exemplo n.º 36
0
 public Configuration(Environments environment, string terminalToken, string apiLogin, string apiPassword, X509Certificate certificate, Endpoints endpoint)
 {
     Environment = environment;
     TerminalToken = terminalToken;
     ApiLogin = apiLogin;
     ApiPassword = apiPassword;
     Certificate = certificate;
     Endpoint = endpoint;
 }
Exemplo n.º 37
0
 public void Write(Environments env, bool append) {
     string delim = env.DELIM.ToString();
     string root = env.ROOT;
     using (var writer = new StreamWriter(Path, append)) {
         writer.WriteLine(delim);
         writer.WriteLine(root);
         writer.Dispose();
     }
 }
 public RepositoryBase(Environments env)
 {
     log.Info("Set up Enviroment: "+env);
     switch (env)
     {
         case Environments.dev1:
             setupDev1();
             break;
         case Environments.test1:
             setupTest1();
             break;
     }
 }
Exemplo n.º 39
0
 public static string GetConfigValueByEnvironment(Environments environment, string keyPart)
 {
     try
     {
         var sdkConfigFile = ConfigurationManager.AppSettings["SDKConfig"];
         var configFileReader = new CustomConfigurationFileReader(sdkConfigFile);
         var config = configFileReader.Config;
         var setting = config.AppSettings.Settings[keyPart + "_" + environment.ToString()].Value;
         return setting;
     }
     catch (Exception)
     {
         return null;
     }
 }
Exemplo n.º 40
0
 public Environments Read() {
     Environments env = new Environments();
     using (var reader = new StreamReader(Path)) {
         string[] lines = reader.ReadToEnd().Split(new string[] { "\n\r" }, StringSplitOptions.None);
         for (int i = 0; i < lines.Length; ++i) {
             string line = lines[i];
             switch(line.Split(':')[0]) {
                 case "DELIM":
                     env.DELIM = Convert.ToChar(line.Split(':')[1]);
                     break;
                 case "ROOT":
                     env.ROOT = line.Split(':')[1];
                     break;
             }
         }
         reader.Dispose();
     }
     return env;
 }
Exemplo n.º 41
0
	public static void Main(string[] args) {
	    Console.WriteLine("Press 'q' to exit at anytime...\n\n");
        Environments env = new Environments();
        Config conf = new Config(env);
        env = conf.Env;
        Logger log = new Logger(env);
		Catcher catcher = new Catcher(env);
		Database db = new Database(env);
		do {
			while (!Console.KeyAvailable) {
				db.Check();
				catcher.Check();
				if (env.ERROR) {
					log.Report(2, "Debugger", "An unknown exception has occured");
					Environment.Exit(1);
				}
			}
		} while (Console.ReadKey(true).Key != ConsoleKey.Q);
		Environment.Exit(0);
	}
 public PrecheckoutDataService(Environments.Environment environment, string consumerKey, AsymmetricAlgorithm privateKey, String walletUrl)
     : base(consumerKey, privateKey)
 {
     this.environment = environment;
     this.walletUrl = walletUrl;
 }
 public DeleteSubscriberIdService(string consumerKey, AsymmetricAlgorithm privateKey, Environments.Environment environment)
     : base(consumerKey, privateKey)
 {
     this.environment = environment;
 }
 public PanEligibilityService(string consumerKey, AsymmetricAlgorithm privateKey, Environments.Environment environment)
     : base(consumerKey, privateKey)
 {
     this.environment = environment;
 }
 public ReasonCodesService(string consumerKey, AsymmetricAlgorithm privateKey, Environments.Environment environment)
     : base(consumerKey, privateKey)
 {
     this.environment = environment;
 }
 public RestaurantsLocalFavoritesService(string consumerKey, AsymmetricAlgorithm privateKey, Environments.Environment environment)
     : base(consumerKey, privateKey)
 {
     this.environment = environment;
 }
 /// <summary>
 /// Constructor to obtain API for calling into the Merchant Identifier service
 /// </summary>
 /// <param name="consumerKey">Developer Zone consumer key</param>
 /// <param name="privateKey">PrivateKey</param>
 /// <param name="environment">Environment.sandbox or Environment.product for sandbox access or production access respectively</param>
 public MerchantIdentifierService(string consumerKey, AsymmetricAlgorithm privateKey, Environments.Environment environment)
     : base(consumerKey, privateKey)
 {
     this.environment = environment;
 }
 public CountryAtmLocationService(string consumerKey, AsymmetricAlgorithm privateKey, Environments.Environment environment)
     : base(consumerKey, privateKey)
 {
     this.environment = environment;
 }
 public RewardProgramOfferingsService(Environments.Environment environment, string consumerKey, AsymmetricAlgorithm privateKey)
     : base(consumerKey, privateKey)
 {
     this.environment = environment;
 }
Exemplo n.º 50
0
 public static void SetConfigAppId(Environments environment, string AppId)
 {
     UpdateConfigSetting("AppId_" + environment.ToString(), AppId);
 }
 public MerchantLocationService(String consumerKey, AsymmetricAlgorithm privateKey, Environments.Environment environment)
     : base(consumerKey, privateKey)
 {
     this.environment = environment;
 }
Exemplo n.º 52
0
        public static void UpdateConfigValueByEnvironment(Environments environment, string keyPart, string value)
        {
            try
            {
                var sdkConfigFile = ConfigurationManager.AppSettings["SDKConfig"];
                var configFileReader = new CustomConfigurationFileReader(sdkConfigFile);
                var config = configFileReader.Config;
                //System.Configuration.Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
                config.AppSettings.Settings.Remove(keyPart + "_" + environment.ToString());
                config.AppSettings.Settings.Add(keyPart + "_" + environment.ToString(), value);
                config.Save(ConfigurationSaveMode.Modified);
            }
            catch (Exception)
            {
                //
            }

        }
Exemplo n.º 53
0
 public static void SetConfigEnvironment(Environments environmentId)
 {
     UpdateConfigSetting("Environment", environmentId.ToString());
 }
 public CountrySubdivisionsLocalFavoritesService(string consumerKey, AsymmetricAlgorithm privateKey, Environments.Environment environment)
     : base(consumerKey, privateKey)
 {
     this.environment = environment;
 }
 /// <summary>
 /// Constructor to obtain API for calling into the Lost/Stolen Account List service
 /// </summary>
 /// <param name="consumerKey">Developer Zone consumer key</param>
 /// <param name="privateKey">PrivateKey</param>
 /// <param name="environment">Environment.sandbox or Environment.product for sandbox access or production access respectively</param>
 public LostStolenService(string consumerKey, AsymmetricAlgorithm privateKey, Environments.Environment environment)
     : base(consumerKey, privateKey)
 {
     this.environment = environment;
 }
 public ShippingAddressVerificationService(Environments.Environment environment, string consumerKey, AsymmetricAlgorithm privateKey)
     : base(consumerKey, privateKey)
 {
     this.environment = environment;
 }
 public DeliveryChannelsService(string consumerKey, AsymmetricAlgorithm privateKey, Environments.Environment environment)
     : base(consumerKey, privateKey)
 {
     this.environment = environment;
 }
 public ProvisioningService(string consumerKey, AsymmetricAlgorithm privateKey, Environments.Environment environment)
     : base(consumerKey, privateKey)
 {
     this.environment = environment;
 }
 public WalletService(Environments.Environment environment, string consumerKey, AsymmetricAlgorithm privateKey)
     : base(consumerKey, privateKey)
 {
     this.environment = environment;
 }
 public RepoGoogle(Environments env)
     : base(env)
 {
 }