Example #1
0
 internal void Clear()
 {
     ConfigValues.Clear();
     if (m_configWrapperDefinition != null)
     {
         m_configWrapperDefinition.Clear();
     }
 }
 //apply(ConfigValues values) Applies parameter values.
 public void Apply(ConfigValues configValues)
 {
     if (agc != null)
     {
         agc.Apply(configValues);
     }
     Debug.Log($"[{TAG}]: apply");
 }
Example #3
0
 public HarJsonBuilder(RequestDelegate next, HttpContext context, IConfiguration configuration, ConfigValues configValues)
 {
     _next          = next;
     _context       = context;
     _startDateTime = DateTime.UtcNow;
     _configuration = configuration;
     _configValues  = configValues;
 }
 public PowershellLegacyTokenizer(ConfigValues configValues) : base(configValues)
 {
     this.tokenVisitor = new PowershellLegacyTokenVisitor(
         this.OnFunctionVisit,
         this.OnConfigurationVisit,
         this.GetDslInstanceName,
         this.OnDslVisit);
 }
Example #5
0
 internal EditableRuleView(ConfigRule rule, int index, EditableRuleSet ruleSet, ConfigValues configValues)
 {
     _configValues = configValues;
     _configValues.PropertyChanged += OnConfigValuesPropertyChanged;
     _rule = rule.Clone();
     this.UpdateIndex(index);
     this.RuleSet = ruleSet;
 }
 public PowershellLegacyTokenizer(ConfigValues configValues) : base(configValues)
 {
     this.tokenVisitor = new PowershellLegacyTokenVisitor(
         this.OnFunctionVisit,
         this.OnConfigurationVisit,
         this.GetDslInstanceName,
         this.OnDslVisit);
 }
Example #7
0
        public async Task FolderToBlob()
        {
            var containerName = 'a' + Guid.NewGuid().ToString().Replace("-", "");
            var from          = string.Format("{0}\\{1}", Environment.CurrentDirectory, Guid.NewGuid());

            Directory.CreateDirectory(from);

            var random     = new Random();
            var count      = random.Next(1, 25);
            var toValidate = new List <Validation>(count);

            for (var i = 0; i < count; i++)
            {
                var v = new Validation
                {
                    Data     = new byte[64],
                    FileName = string.Format("{0}.{1}", Guid.NewGuid(), i),
                };

                var bytes = new byte[64];
                random.NextBytes(v.Data);

                File.WriteAllBytes(string.Format("{0}\\{1}", from, v.FileName), v.Data);

                toValidate.Add(v);
            }

            var config = new ConfigValues
            {
                Source = new DataSource
                {
                    Folder = from,
                },
                Destination = new DataSource
                {
                    ConnectionString = ConnectionString,
                    ContainerName    = containerName,
                },
                Direction = Direction.FolderToBlob,
            };

            var s = new Synchronizer(config);
            await s.Run();

            var to = new Container(containerName, ConnectionString);

            foreach (var v in toValidate)
            {
                var data = await to.Get(v.FileName);

                Assert.AreEqual(v.Data, data);
            }

            await to.Delete();

            Directory.Delete(from, true);
        }
 public PowershellBaseTokenizer(ConfigValues configValues)
 {
     this.configValues = configValues;
     this.dslAutoDiscovery = configValues.DslAutoDiscovery;
     this.dslCustomDictionary = configValues.DslCustomDictionary;
     // this is fix for performance issue in PSParser.Tokenize - when file contains Import - DSCResource pointing to a non-installed resource,
     // parsing takes long time and 'Unable to load resource' errors appear 
     this.parsePowershellDscWithExternalImports = configValues.ParsePowershellDSCWithExternalImports;
 }
Example #9
0
 public PowershellBaseTokenizer(ConfigValues configValues)
 {
     this.configValues        = configValues;
     this.dslAutoDiscovery    = configValues.DslAutoDiscovery;
     this.dslCustomDictionary = configValues.DslCustomDictionary;
     // this is fix for performance issue in PSParser.Tokenize - when file contains Import - DSCResource pointing to a non-installed resource,
     // parsing takes long time and 'Unable to load resource' errors appear
     this.parsePowershellDscWithExternalImports = configValues.ParsePowershellDSCWithExternalImports;
 }
 static Program()
 {
     GeneratorConfigurations = new ConfigValues();
     Debugger = new DebugConsole {
         DebugMessagesList = new List <string> {
             "New Beginnings!\n"
         }
     };
 }
        public void WriteConfigBit(ConfigSettings Setting, ConfigValues Value)
        {
            byte OldValue = GetRegister(0x00);
            byte NewValue = (byte)((~(byte)Setting & OldValue) | (byte)Value);

            Debug.WriteLine("Set Config Bit: Old:" + OldValue.ToString("X") + " New:" + NewValue.ToString("X"));

            SetRegister(0x00, NewValue);
        }
Example #12
0
 public ExcludeOrIncludeItemCommand(MainViewModel mainViewModel, TreeViewModel treeViewModel, FilesPatternProvider filesPatternProvider, ConfigValues configValues,
                                    ReindexSearchTreeCommand reindexSearchTreeCommand)
 {
     this.mainViewModel            = mainViewModel;
     this.treeViewModel            = treeViewModel;
     this.filesPatternProvider     = filesPatternProvider;
     this.configValues             = configValues;
     this.reindexSearchTreeCommand = reindexSearchTreeCommand;
 }
        public SettingsWindow(MainWindow mainWindow)
        {
            _values = Config.Values.Clone();
            _values.PropertyChanged += OnValuesPropertyChanged;
            _ruleSet = new EditableRuleSet(_values);

            InitializeComponent();
            this.Owner = mainWindow;
        }
Example #14
0
        public void CreateSnapshot()
        {
            var expected = true;
            var c        = new ConfigValues
            {
                CreateSnapshot = expected,
            };

            Assert.AreEqual(expected, c.CreateSnapshot);
        }
Example #15
0
        public void Echo()
        {
            var expected = true;
            var c        = new ConfigValues
            {
                Echo = expected,
            };

            Assert.AreEqual(expected, c.Echo);
        }
Example #16
0
        public void Echo()
        {
            var expected = true;
            var c = new ConfigValues
            {
                Echo = expected,
            };

            Assert.AreEqual(expected, c.Echo);
        }
Example #17
0
        public void CreateSnapshot()
        {
            var expected = true;
            var c = new ConfigValues
            {
                CreateSnapshot = expected,
            };

            Assert.AreEqual(expected, c.CreateSnapshot);
        }
Example #18
0
        public void Destination()
        {
            var expected = new DataSource();
            var c = new ConfigValues
            {
                Destination = expected,
            };

            Assert.AreEqual(expected, c.Destination);
        }
Example #19
0
        public void Source()
        {
            var expected = new DataSource();
            var c = new ConfigValues
            {
                Source = expected,
            };

            Assert.AreEqual(expected, c.Source);
        }
Example #20
0
        public void SyncDirection()
        {
            var expected = Direction.SqlToTable;
            var c        = new ConfigValues
            {
                Direction = expected,
            };

            Assert.AreEqual(expected, c.Direction);
        }
Example #21
0
        public void DeleteConfigValue(string configname)
        {
            ConfigValue configValue = ConfigValues.FirstOrDefault(t => t.ConfigName == configname);

            if (configValue != null)
            {
                ConfigValues.Remove(configValue);
            }
            SaveConfig();
        }
Example #22
0
        public void StorageAccountConnection()
        {
            var expected = Guid.NewGuid().ToString();
            var c        = new ConfigValues
            {
                StorageAccountConnection = expected,
            };

            Assert.AreEqual(expected, c.StorageAccountConnection);
        }
Example #23
0
        public void Source()
        {
            var expected = new DataSource();
            var c        = new ConfigValues
            {
                Source = expected,
            };

            Assert.AreEqual(expected, c.Source);
        }
Example #24
0
        public void SqlTableName()
        {
            var expected = Guid.NewGuid().ToString();
            var c        = new ConfigValues
            {
                SqlTableName = expected,
            };

            Assert.AreEqual(expected, c.SqlTableName);
        }
Example #25
0
        public void SyncDirection()
        {
            var expected = Direction.FolderToBlob;
            var c        = new ConfigValues
            {
                Direction = expected,
            };

            Assert.AreEqual(expected, c.Direction);
        }
Example #26
0
    //loadLastFetched() Obtains the cached data that is successfully fetched last time.
    public ConfigValues LoadLastFetched()
    {
        ConfigValues config = null;

        if (agc != null)
        {
            config = agc.LoadLastFetched();
        }
        return(config);
    }
Example #27
0
        public void Destination()
        {
            var expected = new DataSource();
            var c        = new ConfigValues
            {
                Destination = expected,
            };

            Assert.AreEqual(expected, c.Destination);
        }
Example #28
0
 public AI_nr2(GameLayer GL, ConfigValues config)
 {
     GameLayer              = GL;
     this.config            = config;
     ListOfBuildPositions   = new List <BuildableTile>();
     UtilityPositions       = new List <BuildableTile>();
     ResidencePositions     = new List <BuildableTile>();
     ListOfUtilityPositions = new List <BuildableTile>();
     BuiltResidences        = new List <BuildableTile>();
     BuiltUtilitys          = new List <BuildableTile>();
 }
Example #29
0
        private static void InitializeConfiguration()
        {
            Configuration.Values = ConfigValues.ReadFromFile();

            // ReSharper disable once ConvertIfStatementToNullCoalescingExpression
            if (Configuration.Values == null)
            {
                // File did not exist
                Configuration.Values = new ConfigValues();
            }
        }
Example #30
0
        public void ConstructorDirectionUnknown()
        {
            var config = new ConfigValues
            {
                Source      = new DataSource(),
                Destination = new DataSource(),
                Direction   = Direction.Unknown,
            };

            Assert.That(() => new Synchronizer(config), Throws.TypeOf <ArgumentException>());
        }
Example #31
0
        public void ConstructorDestinationNull()
        {
            var config = new ConfigValues
            {
                Source      = new DataSource(),
                Destination = null,
                Direction   = Direction.BlobToBlob,
            };

            Assert.That(() => new Synchronizer(config), Throws.TypeOf <ArgumentNullException>());
        }
Example #32
0
        public static ConfigValues GetConfigValues()
        {
            if (_jsonConfigValues == null) {
                _jsonConfigValues = LoadJson();
            }
            if (_configValues == null) {
                _configValues = new ConfigValues(_jsonConfigValues);
            }

            return _configValues;
        }
Example #33
0
        public void CacheControl()
        {
            var random   = new Random();
            var expected = random.Next();
            var c        = new ConfigValues
            {
                CacheControlDuration = expected,
            };

            Assert.AreEqual(expected, c.CacheControlDuration);
        }
Example #34
0
 internal void UpdateConfigValuesBasedOn(ConfigWrapper tmpConfigWrapper)
 {
     foreach (ConfigPropertyObject tmpPropertyObject in tmpConfigWrapper.ConfigValues.Values)
     {
         ConfigPropertyObject propertyObject;
         if (ConfigValues.TryGetValue(tmpPropertyObject.Name, out propertyObject))
         {
             propertyObject.Value = tmpPropertyObject.Value;
         }
     }
 }
Example #35
0
        public void CacheControl()
        {
            var random = new Random();
            var expected = random.Next();
            var c = new ConfigValues
            {
                CacheControlDuration = expected,
            };

            Assert.AreEqual(expected, c.CacheControlDuration);
        }
Example #36
0
        public static void Main(string[] args)
        {
            //Dessa här under kan användas för att rensa i aktiva spel ifall vi inte får starta ett nytt för det är så många på gång.
            //var hej = GameLayer.GetGames();
            //GameLayer.EndGame("5a638250-d4e0-4d87-832f-cb3bf02d78a1");
            //GameLayer.EndGame("2fb62f59-ba04-4b35-a871-6875312ac787");
            //GameLayer.EndGame("1a300ac5-c834-4582-8e4b-224af2a9d521");
            //GameLayer.EndGame("caea16a3-5d0c-41e3-9828-95d87cc95189");


            //log för att logga info om score över olika körningar och de olika parametrar som då fanns.
            Log.Logger = new LoggerConfiguration()
                         .MinimumLevel.Debug()
                         .WriteTo.Console()
                         .WriteTo.File("logs\\myapp.txt", rollingInterval: RollingInterval.Day)
                         .CreateLogger();

            //Obligatorisk hello world log
            Log.Information("Hello, world!");

            ConfigValues config = new ConfigValues();
            AI_nr2       AI     = new AI_nr2(GameLayer, config);


            //Ändra denna för att köra programmet i olika konfigurationer
            int runMode = 2;

            //1 = kör en gång som vanligt.
            //2 = kör 6 rundor
            //3 = kalibrera temp värden

            switch (runMode)
            {
            case 1:
                string endgame = RunOneGame(AI);
                Log.Information(endgame);
                break;

            case 2:
                RunFourGames(AI);
                break;

            case 3:

                break;

            default:
                break;
            }


            Log.CloseAndFlush();
        }
Example #37
0
        public WorkspaceDirectoryModel(ConfigValues configValues, CommandExecutor commandExecutor, MessageBoxHelper messageBoxHelper)
        {
            this.configValues     = configValues;
            this.commandExecutor  = commandExecutor;
            this.messageBoxHelper = messageBoxHelper;

            this.maxNumOfWorkspaceDirectories = configValues.MaxNumOfWorkspaceDirectories;
            this.WorkspaceDirectories         = new ObservableCollection <string>(configValues.WorkspaceDirectories);
            this.autoUpdateRootDirectory      = configValues.AutoUpdateRootDirectory;

            this.SanitizeWorkspaceDirectories();
        }
 public Powershell5Tokenizer(ConfigValues configValues) : base(configValues)
 {
     this.tokenVisitor = new Powershell5TokenVisitor(this.OnFunctionVisit,
                                                     this.OnConfigurationVisit,
                                                     this.OnClassVisit,
                                                     this.OnClassPropertyVisit,
                                                     this.OnClassConstructorVisit,
                                                     this.OnClassMethodVisit,
                                                     this.GetDslInstanceName,
                                                     this.OnDslVisit
                                                     );
 }
Example #39
0
        /// <summary>
        /// Process Settings for Facotry
        /// </summary>
        /// <returns>Storage Factory</returns>
        public virtual IConfigValues Process()
        {
            var config = new ConfigValues()
            {
                CreateSnapshot = bool.Parse(ConfigurationManager.AppSettings["CreateSnapshot"]),
                CacheControlDuration = int.Parse(ConfigurationManager.AppSettings["CacheControlDuration"]),
            };
            var source = new DataSource();
            var destination = new DataSource();

            switch (this.arguments.Count())
            {
                case 2:
                    source.Folder = this.arguments.ElementAt(0);
                    destination.Folder = this.arguments.ElementAt(1);
                    config.Direction = Direction.FolderToFolder;
                    break;
                case 3:
                    var first = this.arguments.ElementAt(0).ToLowerInvariant();
                    var connectionStringIndex = first.Contains("usedevelopmentstorage") || first.Contains("accountname") ? 0 : 1;

                    switch (connectionStringIndex)
                    {
                        case 0:
                            source.ConnectionString = this.arguments.ElementAt(0);
                            source.ContainerName = this.arguments.ElementAt(1);
                            destination.Folder = this.arguments.ElementAt(2);
                            config.Direction = Direction.BlobToFolder;
                            break;
                        case 1:
                            source.Folder = this.arguments.ElementAt(0);
                            destination.ConnectionString = this.arguments.ElementAt(1);
                            destination.ContainerName = this.arguments.ElementAt(2);
                            config.Direction = Direction.FolderToBlob;
                            break;
                    }
                    break;
                case 4:
                    source.ConnectionString = this.arguments.ElementAt(0);
                    source.ContainerName = this.arguments.ElementAt(1);
                    destination.ConnectionString = this.arguments.ElementAt(2);
                    destination.ContainerName = this.arguments.ElementAt(3);
                    config.Direction = Direction.BlobToBlob;
                    break;
            }
            config.Source = source;
            config.Destination = destination;
            
            return config;
        }
Example #40
0
 public Item2ViewModel(ConfigValues values)
 {
     _values = values;
 }
Example #41
0
        public void SyncDirection()
        {
            var expected = Direction.FolderToBlob;
            var c = new ConfigValues
            {
                Direction = expected,
            };

            Assert.AreEqual(expected, c.Direction);
        }