Ejemplo n.º 1
0
 public void Start()
 {
     status = CompressState.Working;
     thread = new Thread(new ThreadStart(Work));
     thread.IsBackground = true;
     thread.Start();
 }
Ejemplo n.º 2
0
    private void Work()
    {
        try
        {
            if (!File.Exists(this.config.inFile))
            {
                status = CompressState.Error;
                if (finishCallback != null)
                {
                    finishCallback();
                }
                return;
            }
            input  = new FileStream(this.config.inFile, FileMode.Open);
            output = new FileStream(this.config.outFile, FileMode.OpenOrCreate);

            DoWork();

            output.Flush();
            output.Close();
            output.Dispose();
            input.Close();
            input.Dispose();
        }
        catch (System.Exception ex)
        {
            Debug.LogError(ex.Message);
        }

        if (input != null)
        {
            input.Close();
            input.Dispose();
        }

        if (output != null)
        {
            output.Close();
            output.Dispose();
        }

        status = CompressState.Finish;
        if (finishCallback != null)
        {
            finishCallback();
        }
    }