示例#1
0
        private void OnProgressChanged(IntPtr converter, int progress)
        {
            string progressDescription = Toolset.GetProgressDescription(converter);

            Tracer.Trace(string.Format("T:{0} Conversion Progress Changed: ({1}) {2}", Thread.CurrentThread.Name, progress, progressDescription));

            try
            {
                var args = new ProgressChangeEventArgs
                {
                    Document            = ProcessingDocument,
                    Progress            = progress,
                    ProgressDescription = progressDescription
                };

                if (ProgressChange != null)
                {
                    ProgressChange(this, args);
                }
            }
            catch (Exception e)
            {
                Tracer.Warn(string.Format("T:{0} Exception in Progress event handler", Thread.CurrentThread.Name), e);
            }
        }
示例#2
0
        public void Regress27993_TrailingSlashTrimmedFromMSBuildToolsPath()
        {
            Toolset t;

            t = new Toolset("x", "C:", new ProjectCollection(), null);
            Assert.Equal(@"C:", t.ToolsPath);
            t = new Toolset("x", @"C:\", new ProjectCollection(), null);
            Assert.Equal(@"C:\", t.ToolsPath);
            t = new Toolset("x", @"C:\\", new ProjectCollection(), null);
            Assert.Equal(@"C:\", t.ToolsPath);

            t = new Toolset("x", @"C:\foo", new ProjectCollection(), null);
            Assert.Equal(@"C:\foo", t.ToolsPath);
            t = new Toolset("x", @"C:\foo\", new ProjectCollection(), null);
            Assert.Equal(@"C:\foo", t.ToolsPath);
            t = new Toolset("x", @"C:\foo\\", new ProjectCollection(), null);
            Assert.Equal(@"C:\foo\", t.ToolsPath); // trim at most one slash

            t = new Toolset("x", @"\\foo\share", new ProjectCollection(), null);
            Assert.Equal(@"\\foo\share", t.ToolsPath);
            t = new Toolset("x", @"\\foo\share\", new ProjectCollection(), null);
            Assert.Equal(@"\\foo\share", t.ToolsPath);
            t = new Toolset("x", @"\\foo\share\\", new ProjectCollection(), null);
            Assert.Equal(@"\\foo\share\", t.ToolsPath); // trim at most one slash
        }
示例#3
0
文件: Toolset_Tests.cs 项目: 3F/IeXod
        public void Regress27993_TrailingSlashTrimmedFromMSBuildToolsPath()
        {
            Toolset t;

            t = new Toolset("x", "C:");
            Assertion.AssertEquals(@"C:", t.ToolsPath);
            t = new Toolset("x", @"C:\");
            Assertion.AssertEquals(@"C:\", t.ToolsPath);
            t = new Toolset("x", @"C:\\");
            Assertion.AssertEquals(@"C:\", t.ToolsPath);

            t = new Toolset("x", @"C:\foo");
            Assertion.AssertEquals(@"C:\foo", t.ToolsPath);
            t = new Toolset("x", @"C:\foo\");
            Assertion.AssertEquals(@"C:\foo", t.ToolsPath);
            t = new Toolset("x", @"C:\foo\\");
            Assertion.AssertEquals(@"C:\foo\", t.ToolsPath); // trim at most one slash

            t = new Toolset("x", @"\\foo\share");
            Assertion.AssertEquals(@"\\foo\share", t.ToolsPath);
            t = new Toolset("x", @"\\foo\share\");
            Assertion.AssertEquals(@"\\foo\share", t.ToolsPath);
            t = new Toolset("x", @"\\foo\share\\");
            Assertion.AssertEquals(@"\\foo\share\", t.ToolsPath); // trim at most one slash
        }
示例#4
0
        private IntPtr CreateConverter(IDocument document)
        {
            IntPtr converter;

            {
                var config = Toolset.CreateGlobalSettings();

                ApplySettingsToConfig(config, document, true);

                converter = Toolset.CreateConverter(config);
            }

            foreach (var setting in document.GetObjects())
            {
                if (setting != null)
                {
                    var config = Toolset.CreateObjectSettings();

                    ApplySettingsToConfig(config, setting, false);

                    Toolset.AddObject(converter, config, setting.GetData());
                }
            }

            return(converter);
        }
示例#5
0
        /// <summary>
        /// This method determines where MSBuild.Exe is and sets the NodeExePath to that by default.
        /// </summary>
        private string FindMSBuildExe()
        {
            string location = _nodeExeLocation;

            // Use the location specified by the user in code.
            if (!string.IsNullOrEmpty(location) && CheckMSBuildExeExistsAt(location))
            {
                return(location);
            }

            // Try what we think is the current executable path.
            location = FileUtilities.CurrentExecutablePath;

            if (CheckMSBuildExeExistsAt(location))
            {
                return(location);
            }

            // Get the location pointed to by the MSBuildToolsPath in the "current" ToolsVersion
            // for this version of MSBuild. In certain strange circumstances (e.g. checked-in redist
            // the current toolset might not be available.  In which case, shrug and move on.)
            EnsureToolsets();
            Toolset currentToolset = _toolsetProvider.GetToolset(MSBuildConstants.CurrentToolsVersion);

            if (currentToolset != null && !string.IsNullOrEmpty(currentToolset.ToolsPath))
            {
                location = Path.Combine(currentToolset.ToolsPath, "MSBuild.exe");
                if (CheckMSBuildExeExistsAt(location))
                {
                    return(location);
                }
            }

            return(location);
        }
        private Task <bool> imageExists(string directory, Bitmap bitmap)
        {
            foreach (var file in Directory.EnumerateFiles(directory, "*.png", SearchOption.TopDirectoryOnly))
            {
                int      logoId;
                FileInfo fInfo = new FileInfo(file);

                if (int.TryParse(fInfo.Name.Replace(".png", "").Trim(), out logoId))
                {
                    if (logoId > 0 && logoId < 10000)
                    {
                        if (logoId == 3)
                        {
                            Console.Write(logoId);
                        }
                        using (var serverBM = new Bitmap(file))
                        {
                            if (Toolset.CompareBitmaps(bitmap, serverBM))
                            {
                                return(Task.FromResult <bool>(true));
                            }
                        }
                    }
                }
            }
            return(Task.FromResult <bool>(false));
        }
示例#7
0
        public void TestGenerateSubToolsetVersion_ExplicitlyPassedGlobalPropertyWins()
        {
            string originalVisualStudioVersion = Environment.GetEnvironmentVariable("VisualStudioVersion");

            try
            {
                Environment.SetEnvironmentVariable("VisualStudioVersion", ObjectModelHelpers.CurrentVisualStudioVersion);

                IDictionary <string, string> globalProperties = new Dictionary <string, string>();
                globalProperties.Add("VisualStudioVersion", "v13.0");

                ProjectCollection projectCollection = new ProjectCollection(globalProperties);
                Toolset           parentToolset     = projectCollection.GetToolset("4.0");

                Toolset t = new Toolset("Fake", parentToolset.ToolsPath, null, projectCollection, null, parentToolset.OverrideTasksPath);

                IDictionary <string, string> explicitGlobalProperties = new Dictionary <string, string>();
                explicitGlobalProperties.Add("VisualStudioVersion", "FakeSubToolset");

                Assert.Equal("FakeSubToolset", t.GenerateSubToolsetVersion(explicitGlobalProperties, 0));
            }
            finally
            {
                Environment.SetEnvironmentVariable("VisualStudioVersion", originalVisualStudioVersion);
            }
        }
示例#8
0
        private void OnPhaseChanged(IntPtr converter)
        {
            int    phaseNumber      = Toolset.GetPhaseNumber(converter);
            string phaseDescription = Toolset.GetPhaseDescription(converter, phaseNumber);

            Tracer.Trace(string.Format("T:{0} Conversion Phase Changed: #{1} {2}", Thread.CurrentThread.Name, phaseNumber, phaseDescription));

            try
            {
                if (PhaseChange != null)
                {
                    var args = new PhaseChangeEventArgs
                    {
                        Document         = ProcessingDocument,
                        PhaseNumber      = phaseNumber,
                        PhaseDescription = phaseDescription
                    };

                    PhaseChange(this, args);
                }
            }
            catch (Exception e)
            {
                Tracer.Warn(string.Format("T:{0} Exception in PhaseChange event handler", Thread.CurrentThread.Name), e);
            }
        }
示例#9
0
        public void ToolsetImportPropertiesNull()
        {
            BuildPropertyGroup buildPropertyGroup = null;
            Toolset            toolset            = new Toolset("toolversion", "c:\aPath", buildPropertyGroup);

            Assertion.AssertEquals(0, toolset.BuildProperties.Count);
        }
示例#10
0
    public override void Initialize(Toolset _toolSet)
    {
        if (particleSphere != null)
        {
            Destroy(particleSphere.gameObject);
        }

        base.Initialize(_toolSet);

        GameObject go;

        if (spherePos == null)
        {
            go             = Instantiate(sphere, ToolSet.transform);
            particleSphere = go.AddComponent <ParticleSphere>();
            particleSphere.Initialize(0.5f, MaterialHolder.DeleteSphereMat, ToolSet.ToolTopPos, new Vector3(0, 0, -1));
            particleSphere.DrawField = drawField;
        }
        else
        {
            go             = Instantiate(sphere, spherePos.transform);
            particleSphere = go.AddComponent <ParticleSphere>();
            particleSphere.Initialize(0.5f, MaterialHolder.DeleteSphereMat, Vector3.forward * 0.05f, Vector3.forward);
            particleSphere.DrawField = drawField;
        }

        go.name = "DeleteSphere";


        particleSphere.gameObject.SetActive(false);
    }
示例#11
0
        /// <summary>
        /// Reads all the toolsets and populates the given ToolsetCollection with them
        /// </summary>
        private void ReadEachToolset
        (
            Dictionary <string, Toolset> toolsets,
            PropertyDictionary <ProjectPropertyInstance> globalProperties,
            PropertyDictionary <ProjectPropertyInstance> initialProperties,
            bool accumulateProperties
        )
        {
            foreach (ToolsetPropertyDefinition toolsVersion in ToolsVersions)
            {
                // If there's already an existing toolset, it's of higher precedence, so
                // don't even bother to read this toolset in.
                if (!toolsets.ContainsKey(toolsVersion.Name))
                {
                    // We clone here because we don't want to interfere with the evaluation
                    // of subsequent Toolsets; otherwise, properties found during the evaluation
                    // of this Toolset would be persisted in initialProperties and appear
                    // to later Toolsets as Global or Environment properties from the Engine.
                    PropertyDictionary <ProjectPropertyInstance> initialPropertiesClone = new PropertyDictionary <ProjectPropertyInstance>(initialProperties);

                    Toolset toolset = ReadToolset(toolsVersion, globalProperties, initialPropertiesClone, accumulateProperties);

                    if (toolset != null)
                    {
                        toolsets[toolset.ToolsVersion] = toolset;
                    }
                }
            }
        }
示例#12
0
        public MSBuildEnvironmentRuntimeInformation()
        {
            var projectCollection = ProjectCollection.GlobalProjectCollection;

            toolset = projectCollection.GetToolset(projectCollection.DefaultToolsVersion);

            var envHelperType         = typeof(ProjectCollection).Assembly.GetType("Microsoft.Build.Shared.BuildEnvironmentHelper");
            var envHelperInstanceProp = envHelperType.GetProperty("Instance", BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Static);
            var buildEnvInstance      = envHelperInstanceProp.GetValue(null);
            var buildEnvType          = typeof(ProjectCollection).Assembly.GetType("Microsoft.Build.Shared.BuildEnvironment");

            T GetEnvHelperVal <T> (string propName)
            {
                var prop = buildEnvType.GetProperty(propName, BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance);

                return((T)prop.GetValue(buildEnvInstance));
            }

            var msbuildExtensionsPath = GetEnvHelperVal <string> ("MSBuildExtensionsPath");

            SdksPath = GetEnvHelperVal <string> ("MSBuildSDKsPath");

            SearchPaths = GetImportSearchPathsTable(toolset, msbuildExtensionsPath);

            sdkResolver = new MSBuildSdkResolver(BinPath, SdksPath);
        }
示例#13
0
    public override void Initialize(Toolset _toolSet)
    {
        base.Initialize(_toolSet);

        gameArea = InitializeGameArea.GameArea;

        xRange = (int)(System.Math.Floor((gameArea.MaxX - gameArea.MinX) / resolution));
        yRange = (int)(System.Math.Floor((gameArea.MaxY - gameArea.MinY) / resolution));
        zRange = (int)(System.Math.Floor((gameArea.MaxZ - gameArea.MinZ) / resolution));

        fieldContainer = new FieldPoint[xRange, yRange, zRange];

        GameObject spriteParent = new GameObject();

        spriteParent.name = "FieldSprites";

        for (int x = 0; x < xRange; ++x)
        {
            for (int y = 0; y < yRange; ++y)
            {
                for (int z = 0; z < zRange; ++z)
                {
                    FieldPoint fp = new FieldPoint(new Vector3(resolution * x + gameArea.MinX + resolution / 2, resolution * y + gameArea.MinY + resolution / 2,
                                                               resolution * z + gameArea.MinZ + resolution / 2));

                    fieldContainer[x, y, z] = fp;
                    fp.sprite = Instantiate(pointSprite, fp.pos, Quaternion.identity, spriteParent.transform);
                    fp.sprite.SetActive(false);
                }
            }
        }

        FieldPoint.Range = resolution * 3;
    }
示例#14
0
        private void evaluateProjects()
        {
            globalProperties = new Dictionary <String, String>();
            String vsDirectory = Context.Options.VSDirectory;

            if (String.IsNullOrEmpty(vsDirectory))
            {
                vsDirectory = Environment.GetEnvironmentVariable("VSINSTALLDIR");
            }
            if (String.IsNullOrEmpty(vsDirectory))
            {
                throw new ArgumentException("Visual Studio directory is not specified");
            }
            String msBuildDirectory = Context.Options.MSBuildDirectory;

            if (String.IsNullOrEmpty(msBuildDirectory))
            {
                msBuildDirectory = Path.Combine(vsDirectory, "MSBuild");
            }

            globalProperties.Add("VCTargetsPath", Path.Combine(vsDirectory, "Common7", "IDE", "VC", "VCTargets"));
            globalProperties.Add("MSBuildExtensionsPath", msBuildDirectory);

            var toolsVersion = Context.Options.ToolsVersion;

            projectCollection = new ProjectCollection();
            var toolset = new Toolset(toolsVersion, Path.Combine(msBuildDirectory, toolsVersion, "Bin"), projectCollection, string.Empty);

            projectCollection.AddToolset(toolset);

            foreach (var projectEntity in this.Entities <VcProjectEntity>().Where(x => x.Valid))
            {
                projectEntity.EvaluatedProject = evaluateProject(projectEntity.Root);
            }
        }
示例#15
0
        public void TestGenerateSubToolsetVersionWhenNoSubToolset()
        {
            string originalVisualStudioVersion = Environment.GetEnvironmentVariable("VisualStudioVersion");

            try
            {
                Environment.SetEnvironmentVariable("VisualStudioVersion", null);

                ProjectCollection projectCollection = new ProjectCollection();
                Toolset           parentToolset     = projectCollection.GetToolset("4.0");

                Toolset t = new Toolset("Fake", parentToolset.ToolsPath, null, projectCollection, null, parentToolset.OverrideTasksPath);

                string subToolsetVersion = t.GenerateSubToolsetVersion();

                if (Toolset.Dev10IsInstalled)
                {
                    Assert.Equal(Constants.Dev10SubToolsetValue, subToolsetVersion);
                }
                else
                {
                    Assert.Null(subToolsetVersion);
                }
            }
            finally
            {
                Environment.SetEnvironmentVariable("VisualStudioVersion", originalVisualStudioVersion);
            }
        }
示例#16
0
        private void button_Send_Click(object sender, EventArgs e)
        {
            var btn = sender as Button;

            btn.Enabled = false;
            if (this._parentForm.bw.IsBusy)
            {
                this.Visible = false;
                beginTimer();
                return;
            }
            this.button_Cancel.Enabled = false;
            this.label_Status.Text     = "Sending...";
            var strSMTPServer = ConfigurationManager.AppSettings.GetValues("SMTPServer").FirstOrDefault();

            try
            {
                Toolset.SendEmail(strSMTPServer, null, null, false, "FiOS Health Check", this._htmlFormatter, "*****@*****.**", new string[1] {
                    this.textBox_SendTo.Text
                }, null);
                this.label_Status.Text += "Sent!";
                OnEmailSent(EventArgs.Empty);
                this.DialogResult = System.Windows.Forms.DialogResult.OK;
                this.Close();
            }
            catch (Exception ex)
            {
                this.label_Status.Text += string.Format("Failed! - {0}{1}Please try again...", ex.Message, Environment.NewLine);
            }
            btn.Enabled = true;
            this.button_Cancel.Enabled = true;
        }
示例#17
0
        /// <summary>
        /// For a particular ToolsVersion, gather the list of default task registrations.
        /// </summary>
        private void GatherAndEvaluateDefaultTasksForToolsVersion(string toolsVersion, Project containingProject)
        {
            // Default task registrations are in terms of ToolsVersion, so if we've already seen this
            // ToolsVersion we don't need to redo that work.
            if (!_defaultTasksByToolset.ContainsKey(toolsVersion))
            {
                Toolset t = _privateCollection.GetToolset(toolsVersion);
                if (t == null)
                {
                    throw new LoggerException(String.Format(CultureInfo.CurrentCulture, "Why is toolset '{0}' missing??", toolsVersion));
                }

                // Gather the set of default tasks files.
                // Does NOT currently take into account override tasks.
                string[] defaultTasksFiles = Directory.GetFiles(t.ToolsPath, "*.*tasks", SearchOption.TopDirectoryOnly);

                HashSet <UsingTaskData> usingTasks = new HashSet <UsingTaskData>();
                foreach (string defaultTasksFile in defaultTasksFiles)
                {
                    ProjectRootElement pre = ProjectRootElement.Open(defaultTasksFile);
                    GatherAndEvaluatedTasksInFile(pre, containingProject, usingTasks);
                }

                _defaultTasksByToolset.Add(toolsVersion, usingTasks);
            }
        }
示例#18
0
        public void TestDefaultSubToolset()
        {
            Toolset t = GetFakeToolset(null /* no global properties */);

            // The highest one numerically -- in this case, v13.
            Assert.Equal("v13.0", t.DefaultSubToolsetVersion);
        }
示例#19
0
        public void TestDefaultWhenNoSubToolset()
        {
            string originalVisualStudioVersion = Environment.GetEnvironmentVariable("VisualStudioVersion");

            try
            {
                Environment.SetEnvironmentVariable("VisualStudioVersion", null);

                ProjectCollection projectCollection = new ProjectCollection();
                Toolset           parentToolset     = projectCollection.GetToolset(ObjectModelHelpers.MSBuildDefaultToolsVersion);

                Toolset t = new Toolset("Fake", parentToolset.ToolsPath, null, projectCollection, null, parentToolset.OverrideTasksPath);

                if (Toolset.Dev10IsInstalled)
                {
                    Assert.Equal(Constants.Dev10SubToolsetValue, t.DefaultSubToolsetVersion);
                }
                else
                {
                    Assert.Null(t.DefaultSubToolsetVersion);
                }
            }
            finally
            {
                Environment.SetEnvironmentVariable("VisualStudioVersion", originalVisualStudioVersion);
            }
        }
示例#20
0
        public void TestGenerateSubToolsetVersionWhenNoSubToolset()
        {
            if (NativeMethodsShared.IsUnixLike)
            {
                return; // "TODO: Under Unix this test throws. Investigate"
            }

            string originalVisualStudioVersion = Environment.GetEnvironmentVariable("VisualStudioVersion");

            try
            {
                Environment.SetEnvironmentVariable("VisualStudioVersion", null);

                ProjectCollection projectCollection = new ProjectCollection();
                Toolset           parentToolset     = projectCollection.GetToolset(ObjectModelHelpers.MSBuildDefaultToolsVersion);

                Toolset t = new Toolset("Fake", parentToolset.ToolsPath, null, projectCollection, null, parentToolset.OverrideTasksPath);

                string subToolsetVersion = t.GenerateSubToolsetVersion();

                if (Toolset.Dev10IsInstalled)
                {
                    Assert.Equal(Constants.Dev10SubToolsetValue, subToolsetVersion);
                }
                else
                {
                    Assert.Null(subToolsetVersion);
                }
            }
            finally
            {
                Environment.SetEnvironmentVariable("VisualStudioVersion", originalVisualStudioVersion);
            }
        }
示例#21
0
        public void AddNullToolset()
        {
            Engine  e       = new Engine();
            Toolset toolset = null;

            e.Toolsets.Add(toolset);
        }
示例#22
0
        public void IsReadOnly()
        {
            Engine  e       = new Engine();
            Toolset toolSet = new Toolset("version", @"c:\path");

            Assertion.AssertEquals(false, e.Toolsets.IsReadOnly);
        }
示例#23
0
        public void CancelHook(object s, ElapsedEventArgs args)
        {
            e = Toolset.ClosestToMouse(me);
            if (e == null)
            {
                return;
            }
            if (e.HasModifier("modifier_spirit_breaker_charge_of_darkness"))
            {
                return;
            }

            double  travelTime = HookPosition.Distance2D(me.Position) / 1600;
            Vector3 ePosition  = new Vector3((float)((travelTime) * Math.Cos(e.RotationRad) * e.MovementSpeed + e.NetworkPosition.X),
                                             (float)((travelTime) * Math.Sin(e.RotationRad) * e.MovementSpeed + e.NetworkPosition.Y), 0);

            if (e != null && e.NetworkActivity == NetworkActivity.Move && ePosition.Distance2D(HookPosition) > minRangeHook + Menu.Item("x").GetValue <Slider>().Value)
            {
                me.Stop();
                time.Stop();
            }
            else
            {
                if (Q != null)
                {
                    time.Stop();
                }
            }
        }
示例#24
0
 public void ToolsetCtorErrors3()
 {
     Assert.Throws <ArgumentException>(() =>
     {
         Toolset t = new Toolset(String.Empty, "x", new ProjectCollection(), null);
     }
                                       );
 }
示例#25
0
        public void CopyToTest_ArrayTooSmall()
        {
            Engine  e        = new Engine();
            Toolset toolset1 = new Toolset("v1", @"c:\path");

            e.Toolsets.Add(toolset1);
            e.Toolsets.CopyTo(new Toolset[e.Toolsets.Count - 1], 0);
        }
示例#26
0
 public void ToolsetCtorErrors2()
 {
     Assert.Throws <ArgumentNullException>(() =>
     {
         Toolset t = new Toolset("x", null, new ProjectCollection(), null);
     }
                                           );
 }
示例#27
0
        public void Remove()
        {
            Engine  e       = new Engine();
            Toolset toolSet = new Toolset("version", @"c:\path");

            e.Toolsets.Add(toolSet);
            e.Toolsets.Remove(toolSet);
        }
示例#28
0
    public override void Initialize(Toolset _toolSet)
    {
        base.Initialize(_toolSet);

        textMesh = GetComponent <TextMeshPro>();

        caption = textMesh.text;
    }
示例#29
0
    public override void Initialize(Toolset _toolSet)
    {
        base.Initialize(_toolSet);

        text = GetComponent <TextMeshPro>();

        player = ControllerReferences.MultiPlayer;
    }
示例#30
0
        // for 'default' tasks.
        BuildTaskDatabase(Toolset toolset)
        {
            ProjectRootElement root;

            using (var xml = XmlReader.Create(Path.Combine(toolset.ToolsPath, default_tasks_file)))
                root = ProjectRootElement.Create(xml);
            LoadUsingTasks(null, root.UsingTasks);
        }