public IBufferReader Load(string uri) { uri = PolyInternalUtils.ConvertFilePathToHash(uri); string path = Path.Combine(uriBase, uri); long length = new FileInfo(path).Length; FileStream stream = new FileStream(path, FileMode.Open, FileAccess.Read); return(new BufferedStreamReader(stream, bufferSize, length)); }
/// <summary> /// Initializes Poly Toolkit runtime. Must be called once, before any other use of the library. /// Call only once in your app's lifetime, not once per scene (Poly Toolkit survives scene loads). /// </summary> public static void Init(PolyAuthConfig?authConfig, PolyCacheConfig?cacheConfig) { string objName = Application.isPlaying ? "Poly Main" : "Poly Main (EDITOR)"; PolyUtils.AssertTrue(instance == null, "PolyMainInternal.Init() already called. Can only be called once."); polyObject = PolyInternalUtils.CreateSingletonGameObject(objName); instance = polyObject.AddComponent <PolyMainInternal>(); instance.Setup(authConfig, cacheConfig); }
/// <summary> /// Initializes the authenticator. /// /// Note that if config.autoLaunchSignInFlow is true (default), the sign-in flow (browser-based) /// will be launched immediately (unless the user is already authenticated). /// /// If config.autoLaunchSignInFlow is false, then you will remain in unauthenticated state /// until you manually call LaunchSignInFlow(). /// </summary> /// <param name="config">The authentication configuration to use.</param> public static void Initialize(PolyAuthConfig config) { PolyUtils.AssertTrue(instance == null, "Authenticator.Initialize called twice."); GameObject hostObject = PolyInternalUtils.CreateSingletonGameObject("PolyToolkit Authenticator"); instance = hostObject.AddComponent <Authenticator>(); // Currently, authentication is only supported on Windows/Mac for now. PtDebug.LogFormat("Platform: {0}, authentication supported: {1}", Application.platform, instance.IsAuthenticationSupported); if (instance.IsAuthenticationSupported) { InitializeCertificateValidation(); instance.Setup(config); } }