コード例 #1
0
 public override int GetHashCode()
 {
     unchecked
     {
         // Don't include base.GetHashCode, as RemoteTask.GetHashCode includes RemoteTask.Id
         // in the calculation, and this is a new guid generated for each new instance.
         // This would mean two instances that return true from Equals (i.e. value objects)
         // would have different hash codes
         return(AssemblyLocation != null?AssemblyLocation.GetHashCode() : 0);
     }
 }
コード例 #2
0
ファイル: AssetsPath.cs プロジェクト: BaseDorp/TankGame
        internal static bool IsRunningAsUPMPackage()
        {
            string unityPlasticDllPath = Path.GetFullPath(
                AssemblyLocation.GetAssemblyDirectory(
                    Assembly.GetAssembly(typeof(PlasticLocalization))));

            return(Directory.Exists(
                       Path.GetFullPath(Path.Combine(
                                            unityPlasticDllPath,
                                            // assets relative path when running as a UPM package
                                            "../../../Editor/PlasticSCM/Assets"))));
        }
コード例 #3
0
ファイル: AddinSearchDirectories.cs プロジェクト: merbla/Fody
    public void AddCurrentFodyDirectoryToAddinSearch()
    {
        Logger.LogInfo(string.Format("SolutionDirectoryPath: {0}", SolutionDirectoryPath));
        var fodyParentDirectory = Directory.GetParent(AssemblyLocation.CurrentDirectory()).FullName;

        if (!Directory.Exists(fodyParentDirectory))
        {
            Logger.LogInfo(string.Format("Skipped scanning '{0}' for weavers since it doesn't exist.", fodyParentDirectory));
            return;
        }

        AddWeaversFromDir(fodyParentDirectory);
    }
コード例 #4
0
    public void AddToolsAssemblyLocationToAddinSearch()
    {
        var parent = Directory.GetParent(AssemblyLocation.CurrentDirectory()).FullName;
        var assemblyLocationToolsDirectory = Path.GetFullPath(Path.Combine(parent, "Tools"));

        if (Directory.Exists(assemblyLocationToolsDirectory))
        {
            AddinSearchPaths.Add(assemblyLocationToolsDirectory);
        }
        else
        {
            Logger.LogInfo(string.Format("Could not search for addins in '{0}' because it does not exist", assemblyLocationToolsDirectory));
        }
    }
コード例 #5
0
    /// <summary>
    /// Initializes the module.
    /// </summary>
    public static void Initialize()
    {
        Logger.WriteInfo = s => Trace.WriteLine(s);
        var nativeBinaries = Path.Combine(AssemblyLocation.CurrentDirectory(), "NativeBinaries", GetProcessorArchitecture());
        var existingPath   = Environment.GetEnvironmentVariable("PATH");

        if (existingPath.Contains(nativeBinaries))
        {
            return;
        }
        var newPath = string.Concat(nativeBinaries, Path.PathSeparator, existingPath);

        Environment.SetEnvironmentVariable("PATH", newPath);
    }
コード例 #6
0
 public override int GetHashCode()
 {
     unchecked
     {
         // Don't include base.GetHashCode, as RemoteTask.GetHashCode includes RemoteTask.Id
         // in the calculation, and this is a new guid generated for each new instance.
         // This would mean two instances that return true from Equals (i.e. value objects)
         // would have different hash codes
         int result = (TypeName != null ? TypeName.GetHashCode() : 0);
         result = (result * 397) ^ (MethodName != null ? MethodName.GetHashCode() : 0);
         result = (result * 397) ^ (Parameters != null ? Parameters.GetHashCode() : 0);
         result = (result * 397) ^ (AssemblyLocation != null ? AssemblyLocation.GetHashCode() : 0);
         return(result);
     }
 }
コード例 #7
0
        static UninstallToolsGlobalConfig()
        {
            AssemblyLocation = Assembly.GetExecutingAssembly().Location;
            if (AssemblyLocation.ContainsAny(new[] { ".dll", ".exe" }, StringComparison.OrdinalIgnoreCase))
            {
                AssemblyLocation = PathTools.GetDirectory(AssemblyLocation);
            }

            QuestionableDirectoryNames = new[]
            {
                "install", "settings", "config", "configuration", "users", "data"
            }.AsEnumerable();

            DirectoryBlacklist = new[]
            {
                "Microsoft", "Microsoft Games", "Temp", "Programs", "Common", "Common Files", "Clients",
                "Desktop", "Internet Explorer", "Windows NT", "Windows Photo Viewer", "Windows Mail",
                "Windows Defender", "Windows Media Player", "Uninstall Information", "Reference Assemblies",
                "InstallShield Installation Information"
            }.AsEnumerable();

            StockProgramFiles = new[]
            {
                WindowsTools.GetEnvironmentPath(CSIDL.CSIDL_PROGRAM_FILES),
                WindowsTools.GetProgramFilesX86Path()
            }.Distinct().ToList().AsEnumerable();

            // JunkSearchDirs --------------
            var localData = WindowsTools.GetEnvironmentPath(CSIDL.CSIDL_LOCAL_APPDATA);
            var paths     = new List <string>
            {
                WindowsTools.GetEnvironmentPath(CSIDL.CSIDL_PROGRAMS),
                WindowsTools.GetEnvironmentPath(CSIDL.CSIDL_COMMON_PROGRAMS),
                WindowsTools.GetEnvironmentPath(CSIDL.CSIDL_APPDATA),
                WindowsTools.GetEnvironmentPath(CSIDL.CSIDL_COMMON_APPDATA),
                localData
                //Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) danger?
            };

            var vsPath = Path.Combine(localData, "VirtualStore");

            if (Directory.Exists(vsPath))
            {
                paths.AddRange(Directory.GetDirectories(vsPath));
            }

            JunkSearchDirs = paths.Distinct().ToList().AsEnumerable();
        }
コード例 #8
0
    public void Simple()
    {
        var path = Path.Combine(Directory.GetParent(AssemblyLocation.CurrentDirectory()).FullName, "Tools");

        Directory.CreateDirectory(path);
        var logger    = new Mock <BuildLogger>().Object;
        var processor = new AddinFinder
        {
            Logger      = logger,
            SolutionDir = "Solution"
        };

        processor.AddToolsAssemblyLocationToAddinSearch();
        var searchPaths = processor.AddinSearchPaths;

        Assert.AreEqual(path, searchPaths[0]);
    }
コード例 #9
0
    public void Found()
    {
        var currentDirectory = AssemblyLocation.CurrentDirectory();
        var combine          = Path.Combine(currentDirectory, @"..\..\WeaversProjectFileFinder\WithWeaver");
        var loggerMock       = new Mock <BuildLogger>();

        loggerMock.Setup(x => x.LogInfo(It.IsAny <string>()));

        var processor = new Processor
        {
            SolutionDirectoryPath = combine,
            Logger = loggerMock.Object
        };

        processor.FindWeaverProjectFile();
        Assert.IsTrue(processor.FoundWeaverProjectFile);
        loggerMock.Verify();
    }
コード例 #10
0
        private async Task <AssemblyData?> GetAssemblyDataAsync(AssemblyLocation location)
        {
            Task <byte[]?> dll = _contentFileReader.ReadBytesOrNullAsync(location.DllPath);

            Task <byte[]?> pdb = Debugger.IsAttached && location.PdbPath != null
                ? _contentFileReader.ReadBytesOrNullAsync(location.PdbPath)
                : Task.FromResult <byte[]?>(null);

            await Task.WhenAll(dll, pdb).ConfigureAwait(false);

            var dllBytes = dll.Result;
            var pdbBytes = pdb.Result;

            if (dllBytes == null)
            {
                return(null);
            }

            return(new AssemblyData(dllBytes, pdbBytes));
        }
コード例 #11
0
        public bool Equals(XunitTestTheoryTask other)
        {
            if (ReferenceEquals(null, other))
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            // Don't include base.Equals, as RemoteTask.Equals includes RemoteTask.Id
            // in the calculation, and this is a new guid generated for each new instance
            // Using RemoteTask.Id in the Equals means collapsing the return values of
            // IUnitTestElement.GetTaskSequence into a tree will fail (as no assembly,
            // or class tasks will return true from Equals)
            return(AssemblyLocation.Equals(other.AssemblyLocation) &&
                   TypeName.Equals(other.TypeName) &&
                   MethodName.Equals(other.MethodName) &&
                   TheoryName.Equals(other.TheoryName));
        }
コード例 #12
0
        static UninstallToolsGlobalConfig()
        {
            AssemblyLocation = Assembly.GetExecutingAssembly().Location;
            if (AssemblyLocation.ContainsAny(new[] { ".dll", ".exe" }, StringComparison.OrdinalIgnoreCase))
            {
                AssemblyLocation = PathTools.GetDirectory(AssemblyLocation);
            }

            var dir = new DirectoryInfo(AssemblyLocation);

            if (dir.Name.StartsWith("win-x") && dir.Parent != null)
            {
                dir = dir.Parent;
            }
            AppLocation = dir.FullName;

            UninstallerAutomatizerPath   = Path.Combine(AssemblyLocation, @"UninstallerAutomatizer.exe");
            UninstallerAutomatizerExists = File.Exists(UninstallerAutomatizerPath);

            QuestionableDirectoryNames = new[]
            {
                "install", "settings", "config", "configuration", "users", "data"
            }.AsEnumerable();

            DirectoryBlacklist = new[]
            {
                "Microsoft", "Microsoft Games", "Temp", "Programs", "Common", "Common Files", "Clients",
                "Desktop", "Internet Explorer", "Windows", "Windows NT", "Windows Photo Viewer", "Windows Mail",
                "Windows Defender", "Windows Media Player", "Uninstall Information", "Reference Assemblies",
                "InstallShield Installation Information", "Installer", "winsxs", "WindowsApps", "DirectX", "DirectXRedist"
            }.AsEnumerable();

            WindowsDirectory = WindowsTools.GetEnvironmentPath(CSIDL.CSIDL_WINDOWS);

            StockProgramFiles = new[]
            {
                WindowsTools.GetEnvironmentPath(CSIDL.CSIDL_PROGRAM_FILES),
                WindowsTools.GetProgramFilesX86Path()
            }.Distinct().ToList().AsEnumerable();

            // JunkSearchDirs --------------
            var localData = WindowsTools.GetEnvironmentPath(CSIDL.CSIDL_LOCAL_APPDATA);
            var paths     = new List <string>
            {
                WindowsTools.GetEnvironmentPath(CSIDL.CSIDL_PROGRAMS),
                WindowsTools.GetEnvironmentPath(CSIDL.CSIDL_COMMON_PROGRAMS),
                WindowsTools.GetEnvironmentPath(CSIDL.CSIDL_APPDATA),
                WindowsTools.GetEnvironmentPath(CSIDL.CSIDL_COMMON_APPDATA),
                localData
                //Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) danger?
            };

            var appDataParentDir = Path.GetDirectoryName(localData.TrimEnd('\\', '/', ' '));

            if (!string.IsNullOrEmpty(appDataParentDir))
            {
                var lowDir = Path.Combine(appDataParentDir, "LocalLow");
                if (Directory.Exists(lowDir))
                {
                    paths.Add(lowDir);
                }
            }

            var vsPath = Path.Combine(localData, "VirtualStore");

            if (Directory.Exists(vsPath))
            {
                paths.AddRange(Directory.GetDirectories(vsPath));
            }

            JunkSearchDirs = paths.Distinct().ToList().AsEnumerable();

            AppInfoCachePath = Path.Combine(AssemblyLocation, "InfoCache.xml");
        }
コード例 #13
0
    public void Setup()
    {
        var path = Path.Combine(AssemblyLocation.CurrentDirectory(), "CosturaAssemblyToReference.dll");

        File.Delete(path);
    }
コード例 #14
0
    static LandscapeDetailMaps()
    {
        var assemblyDirectory = AssemblyLocation.DirectoryFor(typeof(LandscapeDetailMaps));

        Directory = Path.Combine(assemblyDirectory, "ElectorateMaps");
    }
コード例 #15
0
    public void Existing()
    {
        var fodyDir = FodyDirectoryFinder.TreeWalkForToolsFodyDir(AssemblyLocation.CurrentDirectory());

        Assert.IsTrue(Directory.Exists(fodyDir));
    }
コード例 #16
0
    static AssemblyTimestamp()
    {
        var assemblyPath = AssemblyLocation.PathFor(typeof(AssemblyTimestamp));

        Value = File.GetCreationTimeUtc(assemblyPath);
    }
コード例 #17
0
    static PortraitDetailMaps()
    {
        var assemblyDirectory = AssemblyLocation.DirectoryFor(typeof(PortraitDetailMaps));

        Directory = Path.Combine(assemblyDirectory, "ElectorateMaps");
    }
コード例 #18
0
    public void Foo()
    {
        var currentDirectory = AssemblyLocation.CurrentDirectory();

        Debug.WriteLine(currentDirectory);
    }