当前位置: 首页>>代码示例>>C#>>正文


C# PlatformID类代码示例

本文整理汇总了C#中PlatformID的典型用法代码示例。如果您正苦于以下问题:C# PlatformID类的具体用法?C# PlatformID怎么用?C# PlatformID使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


PlatformID类属于命名空间,在下文中一共展示了PlatformID类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: LocalAppData

        public static string LocalAppData(PlatformID platform, string organization, string product)
        {
            if (organization == null)
                throw new ArgumentNullException(nameof(organization));
            if (product == null)
                throw new ArgumentNullException(nameof(product));
            if (product.Length == 0)
                throw new ArgumentException(nameof(product) + " may not have zero length");

            switch (platform)
            {
                case PlatformID.Win32NT:
                    return Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData),
                        ToUpper(organization), ToUpper(product));
                case PlatformID.MacOSX:
                    return Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Personal),
                        "Library", "Application Support", ToUpper(organization), ToUpper(product));
                case PlatformID.Unix:
                    var homeDirectory = Environment.GetFolderPath(Environment.SpecialFolder.Personal);
                    if (organization == "")
                    {
                        return Path.Combine(homeDirectory, ToDotLower(product));
                    }
                    else
                    {
                        return Path.Combine(homeDirectory, ToDotLower(organization), product.ToLower());
                    }
                default:
                    throw new PlatformNotSupportedException($"PlatformID={platform}");
            }
        }
开发者ID:btcsuite,项目名称:Paymetheus,代码行数:31,代码来源:Portability.cs

示例2: OSFilterAttribute

 public OSFilterAttribute(FilterActions action, PlatformID osType, FilterRules rule, string osVersion)
 {
     Action = action;
     OSType = osType;
     Rule = rule;
     Version = osVersion;
 }
开发者ID:CHOUAiB,项目名称:ModularFramework,代码行数:7,代码来源:OSFilterAttribute.cs

示例3: GetPlatformAssembly

		Assembly GetPlatformAssembly(PlatformID platformId)
		{
			var assemblyName = string.Empty;
			var currentAssembly = Assembly.GetExecutingAssembly();
			
			var uri = new Uri(currentAssembly.CodeBase);
			var directory = Path.GetDirectoryName(uri.AbsolutePath);
			
			
			switch( platformId )
			{
			case PlatformID.Unix: 
				assemblyName = "Forseti.OSX";
				break;
			case PlatformID.Win32NT:
				assemblyName = "Forseti.Windows";
				break;
			}
			assemblyName = string.Format ("{0}/{1}.dll",directory,assemblyName);
			
			if( System.IO.File.Exists(assemblyName) ) 
				return Assembly.LoadFile (assemblyName);
			
			return typeof(MainRegistry).Assembly;
		}
开发者ID:edgarbjorntvedt,项目名称:Forseti,代码行数:25,代码来源:MainRegistry.cs

示例4: Platform_Unsupported

 public void Platform_Unsupported(PlatformID platform)
 {
     // Arrange
     // Act
     // Assert
     Assert.Catch<PlatformNotSupportedException>(() => LibraryLoaderFactory.Create(platform));
 }
开发者ID:GeirGrusom,项目名称:PlatformInvoker,代码行数:7,代码来源:LibraryFactory_Tests.cs

示例5: ReadFileAttribute

 public ReadFileAttribute(PlatformID platformID,String file, String regex = null)
 {
     this.PlatformID = platformID;
     File = file;
     if (regex != null)
         Regex = new Regex(regex);
 }
开发者ID:aaasoft,项目名称:Quick.OwinMVC,代码行数:7,代码来源:SystemInfoUtils.cs

示例6: ShellCmdAttribute

 public ShellCmdAttribute(PlatformID platformID, String program, String arguments, String regex)
 {
     this.PlatformID = platformID;
     this.Program = program;
     this.Arguments = arguments;
     this.Regex = new Regex(regex);
 }
开发者ID:aaasoft,项目名称:Quick.OwinMVC,代码行数:7,代码来源:SystemInfoUtils.cs

示例7: OperatingSystem

		public OperatingSystem(PlatformID platformID, Version version) {
			if (version == null) {
				throw new ArgumentNullException("version");
			}
			this.platformID = platformID;
			this.version = version;
		}
开发者ID:bradparks,项目名称:DotNetAnywhere,代码行数:7,代码来源:OperatingSystem.cs

示例8: OperatingSystem

 public OperatingSystem(PlatformID platform, Version version)
 {
   Contract.Requires(platform >= PlatformID.Win32S)
   Contract.Requires(platform <= PlatformID.MacOSX)
   Contract.Requires(version != null);
   Contract.EnsuresOnThrow<ArgumentException>(true, "platform is not a PlatformID enumeration value.")
   Contract.EnsuresOnThrow<ArgumentNullException>(true, "version is null.")
 }
开发者ID:asvishnyakov,项目名称:CodeContracts,代码行数:8,代码来源:System.OperatingSystem.cs

示例9: Ctor

 public static void Ctor(PlatformID id, string versionString)
 {
     var os = new OperatingSystem(id, new Version(versionString));
     Assert.Equal(id, os.Platform);
     Assert.Equal(new Version(versionString), os.Version);
     Assert.Equal(string.Empty, os.ServicePack);
     Assert.NotEmpty(os.VersionString);
     Assert.Equal(os.VersionString, os.ToString());
 }
开发者ID:dotnet,项目名称:corefx,代码行数:9,代码来源:OperatingSystemTests.cs

示例10: CreateSilverlightSequence

        private static void CreateSilverlightSequence(IList<UnitTestTask> sequence, IUnitTestLaunch launch, UnitTestManager manager, PlatformID silverlightPlatform)
        {
            var silverlightRun = launch.GetOrCreateSilverlightRun(silverlightPlatform);

            sequence.AddSilverlightUnitTestTask(silverlightPlatform, manager);
            sequence.RemoveAssemblyLoadTasks();

            silverlightRun.AddTaskSequence(sequence);
        }
开发者ID:serbrech,项目名称:AgUnit,代码行数:9,代码来源:SilverlightPlatformSupportExtensions.cs

示例11: OperatingSystem

		public OperatingSystem (PlatformID platform, Version version)
		{
			if (version == null) {
				throw new ArgumentNullException ("version");
			}

			_platform = platform;
			_version = version;
		}
开发者ID:calumjiao,项目名称:Mono-Class-Libraries,代码行数:9,代码来源:OperatingSystem.cs

示例12: GetReferencedAssemblies

        protected override IEnumerable<string> GetReferencedAssemblies(PlatformID platformId)
        {
            foreach (var assembly in base.GetReferencedAssemblies(platformId) ?? Enumerable.Empty<string>())
            {
                yield return assembly;
            }

            yield return typeof(NotNullAttribute).Assembly.Location; // add reference to the annotations assembly
        }
开发者ID:prodot,项目名称:ReCommended-Extension,代码行数:9,代码来源:QuickFixAvailabilityTestBaseWithAnnotationAssemblyReference.cs

示例13: GetProfilePicture

    //google has been removed as we cannot get the picture without authenticating ourselves first.

    public static void GetProfilePicture(Action<Texture2D> callback, PlatformID platformID, string platformUserID)
    {
        GameObject profilePicPacket = new GameObject("ProfilePicPacket");

        ProfilePic pic = profilePicPacket.AddComponent<ProfilePic>();

        pic.callback = callback;

        pic.GetProfilePicture(platformID, platformUserID);
    }
开发者ID:hjupter,项目名称:CloudGoodsSDK,代码行数:12,代码来源:ProfilePic.cs

示例14: Create

        public static ILibraryLoader Create(PlatformID platform)
        {
            if(platform == PlatformID.Win32NT)
                return new WindowsLibraryLoader();

            if(platform == PlatformID.MacOSX || platform == PlatformID.Unix)
                return new UnixLibraryLoader();

            throw new PlatformNotSupportedException();
        }
开发者ID:GeirGrusom,项目名称:PlatformInvoker,代码行数:10,代码来源:LibraryLoaderFactory.cs

示例15: GetOSName

        private static string GetOSName(PlatformID platformId)
        {
            switch (platformId)
            {
                case PlatformID.Win32Windows:
                    return "Windows";

                case PlatformID.Win32NT:
                    return "Windows NT";
            }
            return platformId.ToString();
        }
开发者ID:nickchal,项目名称:pash,代码行数:12,代码来源:PSUserAgent.cs


注:本文中的PlatformID类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。