• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# PlatformID类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: Proxy

        public Proxy(string path)
        {
            _PlatformID = Environment.OSVersion.Platform;

            if (_PlatformID == PlatformID.Unix)
            {
                _Invoke = new SoInvoke(path);
            }
            else
            {
                _Invoke = new DllInvoke(path);
            }
        }
开发者ID:ReinhardHsu,项目名称:XAPI2,代码行数:13,代码来源:Proxy.cs


示例17: GetProfilePic

    IEnumerator GetProfilePic(PlatformID platformID, string platformUserID)
    {
        string url = urlSocialPlay + "?PID=" + (int)platformID + "&PUID=" + platformUserID;

        WWW www = new WWW(url);
        yield return www;

        if (callback != null)
            callback(www.texture);

        //Event sent, lets destroy it.
        Destroy(gameObject);
    }
开发者ID:hjupter,项目名称:CloudGoodsSDK,代码行数:13,代码来源:ProfilePic.cs


示例18: OperatingSystem

 internal OperatingSystem(PlatformID platform, System.Version version, string servicePack)
 {
     if ((platform < PlatformID.Win32S) || (platform > PlatformID.MacOSX))
     {
         throw new ArgumentException(Environment.GetResourceString("Arg_EnumIllegalVal", new object[] { (int) platform }), "platform");
     }
     if (version == null)
     {
         throw new ArgumentNullException("version");
     }
     this._platform = platform;
     this._version = (System.Version) version.Clone();
     this._servicePack = servicePack;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:14,代码来源:OperatingSystem.cs


示例19: GetOrCreateSilverlightRun

        public static UnitTestRun GetOrCreateSilverlightRun(this IUnitTestLaunch launch, PlatformID silverlightPlatform)
        {
            var runs = launch.GetRuns();
            var silverlightRun = runs.Values.FirstOrDefault(run => run.GetSilverlightPlatformVersion() == silverlightPlatform.Version);

            if (silverlightRun == null)
            {
                var runtimeEnvironment = new RuntimeEnvironment { PlatformType = PlatformType.x86, PlatformVersion = PlatformVersion.v4_0 };
                silverlightRun = new UnitTestRun((UnitTestLaunch)launch, runtimeEnvironment);
                runs.Add(silverlightRun.ID, silverlightRun);
            }

            return silverlightRun;
        }
开发者ID:staxmanade,项目名称:AgUnit,代码行数:14,代码来源:UnitTestLaunchExtensions.cs


示例20: OperatingSystem

        internal OperatingSystem(PlatformID platform, Version version, string servicePack) {
            if( platform < PlatformID.Win32S || platform > PlatformID.Unix) {
                throw new ArgumentException(
                    String.Format(CultureInfo.CurrentCulture, Environment.GetResourceString("Arg_EnumIllegalVal"), (int)platform),
                    "platform");
            }

            if ((Object) version == null)
                throw new ArgumentNullException("version");

            _platform = platform;
            _version = (Version) version.Clone();
            _servicePack = servicePack;
        }
开发者ID:gbarnett,项目名称:shared-source-cli-2.0,代码行数:14,代码来源:operatingsystem.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# PlatformType类代码示例发布时间:2022-05-24
下一篇:
C# Platform类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap