Esempio n. 1
0
    private IEnumerator TrackUnpackAsync(PoolHandle handle, string tarPath, string songsPath)
    {
        if (downloadRequest == null)
        {
            yield break;
        }

        string progress1 = "Unpacking file.  ";
        string progress2 = "Unpacking file.. ";
        string progress3 = "Unpacking file...";

        while (handle != null && !handle.done)
        {
            statusLabel.text = progress1;
            yield return(new WaitForSeconds(0.5f));

            if (handle == null || handle.done)
            {
                break;
            }
            statusLabel.text = progress2;
            yield return(new WaitForSeconds(0.5f));

            if (handle == null || handle.done)
            {
                break;
            }
            statusLabel.text = progress3;
            yield return(new WaitForSeconds(0.5f));
        }

        if (handle == null)
        {
            AddToDebugAndUiLog($"Unpacking the song package failed. Handle was null for {tarPath}.", true);
            statusLabel.text = "Failed. Handle was null";
        }
        else if (handle.done)
        {
            AddToDebugAndUiLog($"Finished unpacking the song package to {songsPath}");
            SetFinishedStatus();
            downloadPath.text = "";
            List <string> songDirs = SettingsManager.Instance.Settings.GameSettings.songDirs;
            if (!songDirs.Contains(songsPath))
            {
                songDirs.Add(songsPath);
                SettingsManager.Instance.Save();
            }
        }
        else
        {
            AddToDebugAndUiLog($"Unpacking the song package failed with an unknown error. Please check the log. File: {tarPath}", true);
            statusLabel.text = "Failed";
        }
        if (File.Exists(tarPath))
        {
            File.Delete(tarPath);
        }
    }
Esempio n. 2
0
 public void Dismiss()
 {
     if (IsLoaded)
     {
         uint handleValue = Handle.Value;
         NativeFunction.Natives.SET_SCALEFORM_MOVIE_AS_NO_LONGER_NEEDED(ref handleValue);
         Handle = new PoolHandle(handleValue);
     }
 }
Esempio n. 3
0
 public LoopedParticle(string assetName, string particleName, Vector3 position, Rotator rotation, float scale)
 {
     AssetName    = assetName;
     ParticleName = particleName;
     LoadAsset();
     Handle = NativeFunction.Natives.StartParticleFxLoopedAtCoord <uint>(particleName,
                                                                         position.X, position.Y, position.Z,
                                                                         rotation.Pitch, rotation.Roll, rotation.Yaw,
                                                                         scale,
                                                                         false, false, false, false);
 }
 public void CreatePool(Type classT, int autoCreateSize = 4, int allocGran = 4)
 {
     if (classT != null && autoCreateSize > 0)
     {
         PoolHandle handle = null;
         if (_objectPool.ContainsKey(classT) == false)
         {
             handle = new PoolHandle(classT, autoCreateSize, allocGran);
             _objectPool.Add(classT, handle);
         }
     }
 }
Esempio n. 5
0
 public LoopedParticle(string assetName, string particleName, Entity entity, Vector3 offset, Rotator rotation, float scale)
 {
     AssetName    = assetName;
     ParticleName = particleName;
     LoadAsset();
     Handle = NativeFunction.Natives.StartParticleFxLoopedOnEntity <uint>(particleName,
                                                                          entity,
                                                                          offset.X, offset.Y, offset.Z,
                                                                          rotation.Pitch, rotation.Roll, rotation.Yaw,
                                                                          scale,
                                                                          false, false, false);
 }
    private IEnumerator TrackUnpack(PoolHandle handle, string tarPath, string songsPath)
    {
        string progress1 = "unpacking file.  ";
        string progress2 = "unpacking file.. ";
        string progress3 = "unpacking file...";

        while (handle != null && !handle.done)
        {
            statusLabel.text = progress1;
            yield return(new WaitForSeconds(0.2f));

            if (handle == null || handle.done)
            {
                break;
            }
            statusLabel.text = progress2;
            yield return(new WaitForSeconds(0.2f));

            if (handle == null || handle.done)
            {
                break;
            }
            statusLabel.text = progress3;
            yield return(new WaitForSeconds(0.2f));
        }

        if (handle == null)
        {
            AddToLog($"Unpacking the song package failed! Handle was null for {tarPath}!");
            statusLabel.text = "Failed. Handle was null";
        }
        else if (handle.done)
        {
            AddToLog($"Unpacking the song package finished for {tarPath}.");
            statusLabel.text  = "Finished.";
            downloadPath.text = "";
            List <string> songDirs = SettingsManager.Instance.Settings.GameSettings.songDirs;
            if (!songDirs.Contains(songsPath))
            {
                songDirs.Add(songsPath);
                SettingsManager.Instance.Save();
            }
        }
        else
        {
            AddToLog($"Unpacking the song package failed! Unknown error, check log. File: {tarPath}!");
            statusLabel.text = "Failed.";
        }
        if (File.Exists(tarPath))
        {
            File.Delete(tarPath);
        }
    }
Esempio n. 7
0
 public LoopedParticle(string assetName, string particleName, Ped ped, PedBoneId bone, Vector3 offset, Rotator rotation, float scale)
 {
     AssetName    = assetName;
     ParticleName = particleName;
     LoadAsset();
     Handle = NativeFunction.Natives.StartParticleFxLoopedOnPedBone <uint>(particleName,
                                                                           ped,
                                                                           offset.X, offset.Y, offset.Z,
                                                                           rotation.Pitch, rotation.Roll, rotation.Yaw,
                                                                           ped.GetBoneIndex(bone),
                                                                           scale,
                                                                           false, false, false);
 }
Esempio n. 8
0
 public LoopedParticle(string assetName, string particleName, Entity entity, int boneIndex, Vector3 offset, Rotator rotation, float scale)
 {
     AssetName    = assetName;
     ParticleName = particleName;
     LoadAsset();
     Handle = NativeFunction.Natives.xC6EB449E33977F0B <uint>(particleName,
                                                              entity,
                                                              offset.X, offset.Y, offset.Z,
                                                              rotation.Pitch, rotation.Roll, rotation.Yaw,
                                                              boneIndex,
                                                              scale,
                                                              false, false, false); // _START_PARTICLE_FX_LOOPED_ON_ENTITY_BONE
 }
Esempio n. 9
0
        public SpanBuilder(
            ITraceReporter traceReporter,
            PoolHandle <Span> spanHandle,
            TraceContextScope contextScope,
            ITraceConfiguration configuration)
        {
            this.traceReporter = traceReporter;
            this.spanHandle    = spanHandle;
            this.contextScope  = contextScope;
            this.configuration = configuration;

            stopwatch        = Stopwatch.StartNew();
            parentSpan       = Context.Properties.Get <Span>(spanContextKey);
            spanContextScope = Context.Properties.Use(spanContextKey, Span);

            InitializeSpan();
            EnrichSpanWithInheritedFields();
            EnrichSpanWithContext();
        }
Esempio n. 10
0
    public T Fetch <T> (int autoCreateSize = 4, int allocGran = 4) where T : ISmartObj
    {
        Type classT = typeof(T);

        if (classT != null)
        {
            PoolHandle handle = null;
            if (_objectPool.ContainsKey(classT))
            {
                handle = _objectPool[classT];
            }
            else
            {
                handle = new PoolHandle(classT, autoCreateSize, allocGran);
                _objectPool.Add(classT, handle);
            }

            return((T)handle.Fetch());
        }

        return(default(T));
    }
    private void UnpackTar(string tarPath)
    {
        if (!File.Exists(tarPath))
        {
            AddToLog("Can not unpack file because it does not exist on the storage! Did the download fail?");
            return;
        }
        AddToLog("Preparing to unpack the downloaded song package.");
        string     songsPath = PersistentSongsPath();
        PoolHandle handle    = ThreadPool.QueueUserWorkItem(poolHandle =>
        {
            using (Stream tarStream = File.OpenRead(tarPath))
            {
                using (TarArchive archive = TarArchive.CreateInputTarArchive(tarStream))
                {
                    archive.ExtractContents(songsPath);
                    poolHandle.done = true;
                }
            }
        });

        StartCoroutine(TrackUnpack(handle, tarPath, songsPath));
    }
Esempio n. 12
0
    private void UnpackTar(string tarPath)
    {
        if (downloadRequest == null)
        {
            return;
        }

        if (!File.Exists(tarPath))
        {
            AddToDebugAndUiLog("Can not unpack file because it does not exist on the storage! Did the download fail?", true);
            return;
        }

        AddToDebugAndUiLog("Preparing to unpack the downloaded song package.");
        string     songsPath = PersistentSongsPath();
        PoolHandle handle    = ThreadPool.QueueUserWorkItem(poolHandle =>
        {
            using (Stream tarStream = File.OpenRead(tarPath))
            {
                using (TarArchive archive = TarArchive.CreateInputTarArchive(tarStream))
                {
                    try
                    {
                        archive.ExtractContents(songsPath);
                        poolHandle.done = true;
                    }
                    catch (Exception ex)
                    {
                        AddToDebugAndUiLog($"Unpacking failed: <color='red'>{ex.Message}</color>");
                        SetErrorStatus();
                    }
                }
            }
        });

        StartCoroutine(TrackUnpackAsync(handle, tarPath, songsPath));
    }
Esempio n. 13
0
 protected internal DashVehicle(PoolHandle handle) : base(handle)
 {
 }
Esempio n. 14
0
 private MyPed(PoolHandle handle) : base(handle)
 {
 }
Esempio n. 15
0
 public MyPooledObject(PoolHandle<MyPooledObject> handle)
 {
     _handle = handle;
 }
Esempio n. 16
0
 public WriteTask(PoolHandle <WriteTask> handle)
 {
     _handle = handle;
 }
 public WriteTask(PoolHandle<WriteTask> handle)
 {
     _handle = handle;
 }
Esempio n. 18
0
 public void Load()
 {
     Handle = new PoolHandle(NativeFunction.Natives.REQUEST_SCALEFORM_MOVIE<uint>(Name));
 }
    private IEnumerator TrackUnpackAsync(PoolHandle handle, string tarPath, string songsPath)
    {
        if (downloadRequest == null)
        {
            yield break;
        }

        string progress1 = "Unpacking file.  ";
        string progress2 = "Unpacking file.. ";
        string progress3 = "Unpacking file...";

        while (handle != null && !handle.done)
        {
            statusLabel.text = progress1;
            yield return new WaitForSeconds(0.5f);
            if (handle == null || handle.done)
            {
                break;
            }
            statusLabel.text = progress2;
            yield return new WaitForSeconds(0.5f);
            if (handle == null || handle.done)
            {
                break;
            }
            statusLabel.text = progress3;
            yield return new WaitForSeconds(0.5f);
        }

        if (handle == null)
        {
            AddToDebugAndUiLog($"Unpacking the song package failed. Handle was null for {tarPath}.", true);
            statusLabel.text = "Failed. Handle was null";

        }
        else if (handle.done)
        {
            AddToDebugAndUiLog($"Finished unpacking the song package to {songsPath}");
            SetFinishedStatus();
            downloadPath.text = "";
            List<string> songDirs = settings.GameSettings.songDirs;
            if (!songDirs.Contains(songsPath))
            {
                songDirs.Add(songsPath);
                settingsManager.Save();
            }
            // Reload SongMetas if they had been loaded already.
            if (SongMetaManager.IsSongScanFinished)
            {
                Debug.Log("Rescan songs after successful download.");
                SongMetaManager.ResetSongMetas();
                songMetaManager.ScanFilesIfNotDoneYet();
            }
        }
        else
        {
            AddToDebugAndUiLog($"Unpacking the song package failed with an unknown error. Please check the log. File: {tarPath}", true);
            statusLabel.text = "Failed";
        }
        if (File.Exists(tarPath))
        {
            File.Delete(tarPath);
        }
    }
Esempio n. 20
0
 private MyVehicle(PoolHandle handle) : base(handle)
 {
 }
Esempio n. 21
0
 public MyPooledObject(PoolHandle <MyPooledObject> handle)
 {
     _handle = handle;
 }
Esempio n. 22
0
 private Entry(PoolHandle <Entry> handle)
 {
     this.handle = handle;
 }