Ejemplo n.º 1
0
        static List <SDKVersion> GetInstalledVersions(string RootPath)
        {
            List <SDKVersion> Versions = new List <SDKVersion>();
            SDKVersion        Ver      = null;

            if (!System.IO.Directory.Exists(Path.Combine(RootPath, "emscripten")))
            {
                return(Versions);
            }

            string[] Directories = Directory.GetDirectories(Path.Combine(RootPath, "emscripten"), "*", SearchOption.TopDirectoryOnly);
            foreach (var Dir in Directories)
            {
                var VersionFilePath = Path.Combine(Dir, "emscripten-version.txt");
                if (System.IO.File.Exists(VersionFilePath))
                {
                    Ver           = new SDKVersion();
                    Ver.Version   = System.Version.Parse(ReadVersionFile(VersionFilePath));
                    Ver.Directory = Dir;
                    Versions.Add(Ver);
                }
            }

            Versions.Sort();
            return(Versions);
        }
Ejemplo n.º 2
0
 void Awake()
 {
     SDKVersion = Resources.Load <SDKVersion>("SDKVersion");
     if (SDKVersion == null)
     {
         DebugMy.Log("SDKVersion Not Exist !", this, true);
     }
 }
        /// <summary>
        /// 获取版本信息
        /// </summary>
        /// <param name="version">版本信息</param>
        /// <returns>返回0表示正常;返回负数请根据ErrorCodeUtil类注释查看;其他值请在官网-帮助中心查询</returns>
        public int ASFGetVersion(out SDKVersion version)
        {
            version = new SDKVersion();
            int         retCode    = -1;
            ASF_VERSION asfVersion = ASFFunctions.ASFGetVersion();

            version.version   = Marshal.PtrToStringAnsi(asfVersion.Version);
            version.buildDate = Marshal.PtrToStringAnsi(asfVersion.BuildDate);
            version.copyRight = Marshal.PtrToStringAnsi(asfVersion.CopyRight);
            return(retCode);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// 获取sdk版本信息
        /// </summary>
        /// <returns></returns>
        public SDKVersion GetVersion()
        {
            ASF_VERSION version;

            if (_version > 2 || EngineHandler != IntPtr.Zero)
            {
                if (_version > 2)
                {
                    version = ASFFunctions.ASFGetVersion();
                }
                else
                {
                    var r = ASFFunctions.Compatible.ASFGetVersion(EngineHandler);
                    version = Marshal.PtrToStructure <ASF_VERSION>(r);
                }
                Version = new SDKVersion(version);
            }
            return(Version);
        }
Ejemplo n.º 5
0
        /// <summary>
        /// return array is sorted with most recent sdk version at index 0.
        /// </summary>
        private static SDKVersion[] GetSortedSDKVersions(string[] versions)
        {
            SDKVersion[] sdkVersions = new SDKVersion[versions.Length];
            for (int i = 0; i < versions.Length; i++)
            {
                SDKVersion v = new SDKVersion();
                v.sdkVersion = versions[i];
                string sdk = versions[i];

                if (sdk.StartsWith("v"))
                {
                    sdk = sdk.Substring(1);
                }
                string[] sdkSplit = sdk.Split('.');
                if (sdkSplit.Length >= 2)
                {
                    Int32.TryParse(sdkSplit[0], out v.major);
                    v.minor = sdkSplit[1];
                }
                sdkVersions[i] = v;
            }
            Array.Sort <SDKVersion>(sdkVersions);
            return(sdkVersions);
        }
 /// <summary>
 /// Client Id and Secret for the OAuth
 /// </summary>
 /// <param name="clientId"></param>
 /// <param name="clientSecret"></param>
 public OAuthTokenCredential(string clientId, string clientSecret)
 {
     this.clientId = clientId;
     this.clientSecret = clientSecret;
     this.config = ConfigManager.GetConfigWithDefaults(ConfigManager.Instance.GetProperties());
     this.SdkVersion = new SDKVersionImpl();
 }
 /// <summary>
 /// Client Id and Secret for the OAuth
 /// </summary>
 /// <param name="clientId"></param>
 /// <param name="clientSecret"></param>
 public OAuthTokenCredential(string clientId, string clientSecret, Dictionary<string, string> config)
 {
     this.clientId = clientId;
     this.clientSecret = clientSecret;
     this.config = config != null ? ConfigManager.GetConfigWithDefaults(config) : ConfigManager.GetConfigWithDefaults(ConfigManager.Instance.GetProperties());
     this.SdkVersion = new SDKVersionImpl();
 }
Ejemplo n.º 8
0
        internal static string GetLatestMetadataPathForApiContract(string ApiContract, WindowsCompiler Compiler)
        {
            DirectoryReference SDKFolder;
            VersionNumber      SDKVersion;

            if (!WindowsPlatform.TryGetWindowsSdkDir("Latest", out SDKVersion, out SDKFolder))
            {
                return(string.Empty);
            }

            DirectoryReference ReferenceDir = DirectoryReference.Combine(SDKFolder, "References");

            if (DirectoryReference.Exists(ReferenceDir))
            {
                // Prefer a contract from a suitable SDK-versioned subdir of the references folder when available (starts with 15063 SDK)
                //Version WindowsSDKVersionMaxForToolchain = Compiler < WindowsCompiler.VisualStudio2017 ? HoloLens.MaximumSDKVersionForVS2015 : null;
                DirectoryReference SDKVersionedReferenceDir = DirectoryReference.Combine(ReferenceDir, SDKVersion.ToString());
                DirectoryReference ContractDir           = DirectoryReference.Combine(SDKVersionedReferenceDir, ApiContract);
                Version            ContractLatestVersion = null;
                FileReference      MetadataFileRef       = null;
                if (DirectoryReference.Exists(ContractDir))
                {
                    // Note: contract versions don't line up with Windows SDK versions (they're numbered independently as 1.0.0.0, 2.0.0.0, etc.)
                    ContractLatestVersion = FindLatestVersionDirectory(ContractDir.FullName, null);
                    MetadataFileRef       = FileReference.Combine(ContractDir, ContractLatestVersion.ToString(), ApiContract + ".winmd");
                }

                // Retry in unversioned references dir if we failed above.
                if (MetadataFileRef == null || !FileReference.Exists(MetadataFileRef))
                {
                    ContractDir = DirectoryReference.Combine(ReferenceDir, ApiContract);
                    if (DirectoryReference.Exists(ContractDir))
                    {
                        ContractLatestVersion = FindLatestVersionDirectory(ContractDir.FullName, null);
                        MetadataFileRef       = FileReference.Combine(ContractDir, ContractLatestVersion.ToString(), ApiContract + ".winmd");
                    }
                }
                if (MetadataFileRef != null && FileReference.Exists(MetadataFileRef))
                {
                    return(MetadataFileRef.FullName);
                }
            }

            return(string.Empty);
        }
Ejemplo n.º 9
0
 /// <summary>
 /// Client Id and Secret for the OAuth
 /// </summary>
 /// <param name="clientId"></param>
 /// <param name="clientSecret"></param>
 public OAuthTokenCredential(string clientId, string clientSecret, Dictionary<string, string> config)
 {
     this.ClientId = clientId;
     this.ClientSecret = clientSecret;
     this.config = config != null ? ConfigManager.GetConfigWithDefaults(config) : ConfigManager.GetConfigWithDefaults(ConfigManager.Instance.GetProperties());
     this.SdkVersion = new SDKVersionImpl();
     this.AccessTokenExpirationSafetyGapInSeconds = 120; // Default is 2 minute safety gap for token expiration.
 }
Ejemplo n.º 10
0
 public PaypalOauthClient(IHttpClientFactory httpClientFactory)
 {
     _httpClientFactory = httpClientFactory;
     _sdkVersion        = new SDKVersionImpl();
     AccessTokenExpirationSafetyGapInSeconds = 120;
 }