示例#1
0
        private static void OutputHtml(Project project, XmlOutputter xmlOutputter, Options options)
        {
            StageStopwatch.Restart();
            Report.NewStatus("Generating htmls... ");

            var reader = CreateSourceXml(project, options);

            var preProcess       = new XsltRunner(Path.Combine(EnvVar.ExecPath, "themes", options.ThemeName, "main_pre.xslt"));
            var preProcessResult = preProcess.Run(xmlOutputter.XDocument, Path.GetFullPath(options.OutputDirectory));

            if (options.SaveXmls)
            {
                preProcessResult.Save(EnvVar.XmlOutputPath(options.OutputDirectory, "documentation_file.xml"));
            }

            var htmlOutputter = new XsltRunner(Path.Combine(EnvVar.ExecPath, "themes", options.ThemeName, "main.xslt"));

            htmlOutputter.Run(
                preProcessResult.ToXDocument(),
                Path.GetFullPath(options.OutputDirectory) + EnvVar.Slash,
                new KeyValuePair <string, object>("verbose", Report.Verbose),
                new KeyValuePair <string, object>("source", reader));

            SaveTiming("html-output", StageStopwatch.ElapsedMilliseconds);
            Report.ContinueStatus("Done");
        }
示例#2
0
    public void init(EnvVar owner)
    {
        this.owner = owner;

        //	transform.parent = owner.transform;					// Set the model's parent to the gem.


        //Here we will assign a random position
        System.Random rng  = new System.Random();
        float         posx = rng.Next(-8, 8) * 1.0f;
        float         posy = rng.Next(-4, 4) * 1.0f;

        transform.position = new Vector3(posx, posy, 0);



        this.name = "EnvVarModel";                                                                              // Name the object.

        mat             = GetComponent <Renderer>().material;
        mat.shader      = Shader.Find("Sprites/Default");                       // Tell the renderer that our textures have transparency. // Get the material component of this quad object.
        mat.mainTexture = Resources.Load <Texture2D>("Textures/envTex");        // Set the texture.  Must be in Resources folder.
        //mat.color = new Color(1,1,1);
        transform.localScale = new Vector3(0.85f, 0.85f, 1);
        //this.owner.GetComponent<BoxCollider2D>().transform.position = transform.position;
    }
示例#3
0
        void ExtendFrame(Types.Environment env, string name, ParseTree nameAst)
        {
            var topFrame           = env.Frame;
            var currentStartPos    = nameAst.StartPos;
            var previousDefinition = topFrame.EntryFor(name);

            if (previousDefinition != null)
            {
                var sourceFile = SourceFile.FindSource(this.sources, previousDefinition.FileName);
                var pos        = Position.CalculatePosition(sourceFile, previousDefinition.StartPos);
                var message    = String.Format(
                    "Variable '{0}' is already defined in this frame in file '{1}', at line {2}, column {3}.",
                    name, pos.FileName, pos.Line, pos.Column);
                this.RaiseError(currentStartPos, nameAst.EndPos, message);
            }
            else
            {
                var newVar = new EnvVar()
                {
                    Name     = name,
                    FileName = this.fileName,
                    Place    = topFrame.Vars.Count,
                    StartPos = currentStartPos
                };
                topFrame.Vars.Add(newVar);
            }
        }
示例#4
0
 public static void RaiseEnvVariableChanged(EnvVar envVar)
 {
     if (EnvVariableChanged != null)
     {
         EnvVariableChanged(envVar);
     }
 }
示例#5
0
        public void TestConfigurationAndStartup()
        {
            using (EnvVar.Set("IGNITE_NATIVE_TEST_CLASSPATH", bool.TrueString))
            {
                Assert.IsNull(Ignition.TryGetIgnite());

                // Test default config (picks up app.config section).
                CheckCacheAndStop("myGrid1", IgniteDbConfiguration.DefaultCacheNamePrefix, new IgniteDbConfiguration());

                // Specific config section.
                CheckCacheAndStop("myGrid2", "cacheName2",
                                  new IgniteDbConfiguration("igniteConfiguration2", "cacheName2", null));

                // Specific config section, nonexistent cache.
                CheckCacheAndStop("myGrid2", "newCache",
                                  new IgniteDbConfiguration("igniteConfiguration2", "newCache", null));

                // In-code configuration.
                CheckCacheAndStop("myGrid3", "myCache",
                                  new IgniteDbConfiguration(new IgniteConfiguration(TestUtils.GetTestConfiguration())
                {
                    IgniteInstanceName = "myGrid3"
                }, new CacheConfiguration("myCache_metadata")
                {
                    CacheMode     = CacheMode.Replicated,
                    AtomicityMode = CacheAtomicityMode.Transactional
                },
                                                            new CacheConfiguration("myCache_data")
                {
                    CacheMode = CacheMode.Replicated
                }, null),
                                  CacheMode.Replicated);

                // Existing instance.
                var ignite = Ignition.Start(TestUtils.GetTestConfiguration());
                CheckCacheAndStop(null, "123", new IgniteDbConfiguration(ignite,
                                                                         new CacheConfiguration("123_metadata")
                {
                    Backups       = 1,
                    AtomicityMode = CacheAtomicityMode.Transactional
                },
                                                                         new CacheConfiguration("123_data"), null));

                // Non-tx meta cache.
                var ex = Assert.Throws <IgniteException>(() => CheckCacheAndStop(null, "123",
                                                                                 new IgniteDbConfiguration(TestUtils.GetTestConfiguration(),
                                                                                                           new CacheConfiguration("123_metadata"),
                                                                                                           new CacheConfiguration("123_data"), null)));

                Assert.AreEqual("EntityFramework meta cache should be Transactional.", ex.Message);

                // Same cache names.
                var ex2 = Assert.Throws <ArgumentException>(() => CheckCacheAndStop(null, "abc",
                                                                                    new IgniteDbConfiguration(TestUtils.GetTestConfiguration(),
                                                                                                              new CacheConfiguration("abc"),
                                                                                                              new CacheConfiguration("abc"), null)));

                Assert.IsTrue(ex2.Message.Contains("Meta and Data cache can't have the same name."));
            }
        }
示例#6
0
        void EnvVariableChanged(EnvVar envVar)
        {
            if (minimal)
            {
                return;
            }

            if (envVar == EnvVar.SkyCol)
            {
                ResetSky();
            }
            else if (envVar == EnvVar.FogCol)
            {
                UpdateFog();
            }
            else if (envVar == EnvVar.CloudsCol)
            {
                ResetClouds();
            }
            else if (envVar == EnvVar.CloudsLevel)
            {
                ResetSky();
                ResetClouds();
            }
        }
示例#7
0
 void EnvVariableChanged(EnvVar envVar)
 {
     if (envVar == EnvVar.EdgeBlock)
     {
         MakeTexture(ref edgesTex, ref lastEdgeTexLoc, map.Env.EdgeBlock);
         ResetEdges();
     }
     else if (envVar == EnvVar.SidesBlock)
     {
         MakeTexture(ref sidesTex, ref lastSideTexLoc, map.Env.SidesBlock);
         ResetSides();
     }
     else if (envVar == EnvVar.EdgeLevel || envVar == EnvVar.SidesOffset)
     {
         ResetSidesAndEdges();
     }
     else if (envVar == EnvVar.SunCol)
     {
         ResetEdges();
     }
     else if (envVar == EnvVar.ShadowCol)
     {
         ResetSides();
     }
 }
示例#8
0
 static void Main(string[] args)
 {
     Console.WriteLine("Redis_Hostname: " + EnvVar.AsString("Redis_Hostname"));
     Console.WriteLine("Redis_Port: " + EnvVar.AsString("Redis_Port"));
     Console.WriteLine("BoM_CsvFileName: " + EnvVar.AsString("BoM_CsvFileName"));
     var BomLoaded = new BoMServerMapping();
 }
示例#9
0
 public IEnumerable <ServerMappingEntry> Get()
 {
     using (var RedisConnection = new RedisClient(EnvVar.AsString("Redis_Hostname"), EnvVar.AsInt("Redis_Port")))
     {
         var RedisContext = RedisConnection.As <ServerMappingEntry>();
         return(RedisContext.GetAll());
     }
 }
示例#10
0
    public void spawnNewEnv()
    {
        GameObject envObject = new GameObject();
        EnvVar     newenv    = envObject.AddComponent <EnvVar>();

        newenv.init(this);
        this.envVariables.Add(newenv);
    }
示例#11
0
        internal void SetRevitDirectory(Application application)
        {
            var programm = EnvVar.ByName("ProgramW6432");
            var version  = application.VersionNumber;
            var path     = Path.Combine(programm, "Autodesk", $"Revit {version}");

            RevitDirectory = path;
        }
示例#12
0
 public void TestNewMode()
 {
     // Run "TestOldMode" in a separate process with changed setting.
     using (EnvVar.Set(BinaryUtils.IgniteBinaryMarshallerUseStringSerializationVer2, "true"))
     {
         TestUtils.RunTestInNewProcess(GetType().FullName, "TestOldMode");
     }
 }
示例#13
0
 void EnvVariableChanged(EnvVar envVar)
 {
     if (envVar != EnvVar.CloudsCol)
     {
         return;
     }
     MakeVb();
 }
示例#14
0
 void Set <T>(T value, ref T target, EnvVar var) where T : IEquatable <T>
 {
     if (value.Equals(target))
     {
         return;
     }
     target = value;
     game.MapEvents.RaiseEnvVariableChanged(var);
 }
示例#15
0
        private string CheckThemeExists(string propertyName, string themeName)
        {
            if (!Directory.Exists(Path.Combine(EnvVar.ThemeOutputPath(themeName))))
            {
                ReportError(new NotImplementedException($"A theme named '{themeName}' does not exist."), propertyName);
            }

            return(themeName);
        }
示例#16
0
 public void createInitialEnv()
 {
     for (int i = 0; i < this.maxEnv; i++)
     {
         GameObject envObject = new GameObject();
         EnvVar     newenv    = envObject.AddComponent <EnvVar>();
         newenv.init(this);
         this.envVariables.Add(newenv);
     }
 }
示例#17
0
 bool Set <T>(T value, ref T target, EnvVar var) where T : IEquatable <T>
 {
     if (value.Equals(target))
     {
         return(false);
     }
     target = value;
     game.WorldEvents.RaiseEnvVariableChanged(var);
     return(true);
 }
示例#18
0
        /// <summary>
        /// Gets the given envirnment variable.
        /// </summary>
        /// <param name="variable">Variable to return.</param>
        /// <returns>The value of the variable.</returns>
        public static string GetEnvironmentVariable(EnvVar variable)
        {
            string value = Environment.GetEnvironmentVariable(variable.ToString());

            if (value == null)
            {
                value = string.Empty;
            }

            return(value);
        }
示例#19
0
 void EnvVariableChanged(EnvVar envVar)
 {
     if (envVar == EnvVar.SunCol)
     {
         SetSun(game.World.Env.Sun);
     }
     else if (envVar == EnvVar.ShadowCol)
     {
         SetShadow(game.World.Env.Shadow);
     }
 }
示例#20
0
        /// <summary>
        ///     Get variable
        /// </summary>
        /// <param name="name">Name of variable</param>
        /// <param name="defaultValue">Default value of environment</param>
        /// <returns></returns>
        public static EnvVar <T> Get <T>(string name, T defaultValue)
        {
            if (EnvVar <T> .Vars.ContainsKey(name))
            {
                return(EnvVar <T> .Vars[name]);
            }

            var envVar = new EnvVar <T>(name, defaultValue);

            EnvVar <T> .Vars.Add(name, envVar);

            return(envVar);
        }
示例#21
0
 void EnvVariableChanged(EnvVar envVar)
 {
     if (envVar == EnvVar.SunCol || envVar == EnvVar.ShadowCol)
     {
         Refresh();
     }
     else if (envVar == EnvVar.EdgeLevel || envVar == EnvVar.SidesOffset)
     {
         int oldClip = builder.edgeLevel;
         builder.sidesLevel = Math.Max(0, game.World.Env.SidesHeight);
         builder.edgeLevel  = Math.Max(0, game.World.Env.EdgeHeight);
         RefreshBorders(Math.Max(oldClip, builder.edgeLevel));
     }
 }
示例#22
0
        public void FixtureSetUp()
        {
            _changedEnvVar = EnvVar.Set(Classpath.EnvIgniteNativeTestClasspath, bool.TrueString);

            Directory.SetCurrentDirectory(PathUtil.IgniteHome);

            // Copy file to a temp location and replace multicast IP finder with static.
            _configPath = Path.GetTempFileName();

            var configText = File.ReadAllText(PathUtil.ExamplesAppConfigPath)
                             .Replace("TcpDiscoveryMulticastIpFinder", "TcpDiscoveryStaticIpFinder");

            File.WriteAllText(_configPath, configText);

            _changedConfig = TestAppConfig.Change(_configPath);
        }
示例#23
0
        public void TestBaselineTopologyAutoAdjustEnabledDisabled()
        {
            using (EnvVar.Set("IGNITE_BASELINE_AUTO_ADJUST_FEATURE_SUPPORT", "true"))
            {
                using (var ignite = Ignition.Start(GetPersistentConfiguration()))
                {
                    ICluster cluster = ignite.GetCluster();
                    cluster.SetActive(true);

                    bool isEnabled = cluster.IsBaselineAutoAdjustEnabled();
                    cluster.SetBaselineAutoAdjustEnabledFlag(!isEnabled);

                    Assert.AreNotEqual(isEnabled, cluster.IsBaselineAutoAdjustEnabled());
                }
            }
        }
示例#24
0
        public static int Main(string[] args)
        {
#if DEBUG
            Report.SetDebugProfile();
#endif

#if !DEBUG
            AppDomain.CurrentDomain.UnhandledException += UnhandledExceptionTrapper;
            Report.SetReleaseProfile();
#endif

            TotalStopwatch.Restart();
            StageStopwatch.Restart();
            var options = new Options();
            GetCommandLineOptions(args, options);
            GetOptions(options.ProjectFilePath ?? EnvVar.DefaultInfoPath, options);
            Report.Verbose = options.Verbose;
            SaveTiming("options-parsing", StageStopwatch.ElapsedMilliseconds);

            var project = GetProject(options.SourceFilePaths, options.RunInSerial);

            var xmlOutputter = GetXmlOutputter(project, new XElement("Information", options.XmlInformation));
            if (options.SaveXmls)
            {
                xmlOutputter.SaveToDisk(EnvVar.XmlOutputPath(options.OutputDirectory, "project.xml"));
            }

            if (options.NoOutput)
            {
                return(0);
            }

            OutputTheme(options);
            OutputHtml(project, xmlOutputter, options);

            SaveTiming("total", TotalStopwatch.ElapsedMilliseconds);
            if (options.TimeOutput)
            {
                Directory.CreateDirectory(EnvVar.XmlOutputPath(options.OutputDirectory));
                TimingXml.Save(EnvVar.XmlOutputPath(options.OutputDirectory, "timings.xml"));
            }

            Report.NewStatus($@"Documentation can be found at '{Path.GetFullPath(options.OutputDirectory)}'");
            Report.NewStatus("Documentation generation complete.\n");
            return(0);
        }
示例#25
0
        public void TestBaselineTopologyAutoAdjustTimeoutWriteRead()
        {
            const long newTimeout = 333000;

            using (EnvVar.Set("IGNITE_BASELINE_AUTO_ADJUST_FEATURE_SUPPORT", "true"))
            {
                using (var ignite = Ignition.Start(GetPersistentConfiguration()))
                {
                    ICluster cluster = ignite.GetCluster();
                    cluster.SetActive(true);

                    cluster.SetBaselineAutoAdjustTimeout(newTimeout);

                    Assert.AreEqual(newTimeout, cluster.GetBaselineAutoAdjustTimeout());
                }
            }
        }
示例#26
0
        private static XmlReader CreateSourceXml(Project project, Options options)
        {
            var xElements =
                from source in project.Sources
                let highlighter = DocumentationManager.TryGetDefinitionByIdentifier(source.Language)
                                  select new XElement(
                    "File",
                    new XElement("Identifier", source.Identifier),
                    highlighter.HighlightLines(source.OriginalLines));
            var reader = new XDocument(new XElement("Source", xElements)).CreateReader();

            if (options.SaveXmls)
            {
                new XDocument(new XElement("Source", xElements)).Save(EnvVar.XmlOutputPath(options.OutputDirectory, "source.xml"));
            }

            return(reader);
        }
示例#27
0
        /// <summary>
        /// reads the PATH variable of the system
        /// </summary>
        private void FindSystemPath()
        {
            // get Path
            {
                char[] pathSep = new char[1];
                switch (Path.DirectorySeparatorChar)
                {
                case '/':     // Unix
                    pathSep[0] = ':';
                    break;

                case '\\':     // Win
                    pathSep[0] = ';';
                    break;

                default:
                    throw new NotSupportedException("Unknown system; directory separator seems to be '" + Path.DirectorySeparatorChar + "' ?");
                }

                // try to be as robust as possible...
                IDictionary allEnvVars = Environment.GetEnvironmentVariables();
                foreach (string EnvVar in allEnvVars.Keys)
                {
                    if (EnvVar.Equals("path", StringComparison.InvariantCultureIgnoreCase))
                    {
                        string   full = (string)allEnvVars[EnvVar];
                        string[] dirs = full.Split(pathSep, StringSplitOptions.RemoveEmptyEntries);

                        foreach (string d in dirs)
                        {
                            try {
                                DirectoryInfo dirInfo = new DirectoryInfo(d);
                                if (dirInfo.Exists)
                                {
                                    _Path.Add(dirInfo);
                                }
                            } catch (Exception) {
                            }
                        }
                    }
                }
            }
        }
示例#28
0
        public async Task Initialize()
        {
            var apiKey = new EnvVar <string>("SPNR_SCOPUS_API_KEY", null);

            // if (apiKey.Value == null)
            // {
            //     _logger.Warning("API Key is not set. Driver won't be used");
            //     return;
            // }

            var api = new ScopusSearchClient("https://api.elsevier.com/", "8d51321ac59b87444e3c31d5487e8542");

            var scopusSearchResult = await api.GetAsync <SearchResults <Scopus.Api.Client.Models.Search.Scopus> >("content/search/scopus", "query=AUTHOR-NAME(budylina e)");

            foreach (var scopus in scopusSearchResult.Data.Entry)
            {
                _logger.Information($"{scopus.PrismPublicationName}");
            }

            File.WriteAllText("./result.json", JsonConvert.SerializeObject(scopusSearchResult, Formatting.Indented));
        }
示例#29
0
        public void Run()
        {
            _logger.Information("Application started");

            Pi.Init <BootstrapWiringPi>();
            _logger.Information("Raspberry Pi bootstrapped");
            _logger.Information($"Raspberry Model: {Pi.Info.RaspberryPiVersion}");
            _logger.Information($"Debug mode: {EnvVar.DebugMode.Value}");
            _logger.Debug($"TERM={EnvVar.Get<string>("TERM", null).Value}");

            _speaker.Initialize();
            _laser.Initialize();

            _speaker.BeepAsync(SpeakerSound.Greet);
            _logger.Information("Application ready");

            ConsoleKeyInfo key;

            do
            {
                key = Console.ReadKey(true);

                _laser.Turned = key.Key switch
                {
                    ConsoleKey.D1 => true,
                    ConsoleKey.D2 => false,
                    _ => _laser.Turned
                };

                _speaker.BeepAsync(SpeakerSound.Beep);
            } while (key.Key != ConsoleKey.Enter);

            _logger.Information("Exiting");
            _laser.Turned = false;
            _speaker.Beep(SpeakerSound.Bye);
        }
    }
 internal void RaiseEnvVariableChanged(EnvVar envVar)
 {
     envArgs.Var = envVar; Raise(EnvVariableChanged, envArgs);
 }
示例#31
0
 internal void RaiseEnvVariableChanged( EnvVar envVar )
 {
     envArgs.Var = envVar; Raise( EnvVariableChanged, envArgs );
 }