Welcome to mirror list, hosted at ThFree Co, Russian Federation.

extractor.h « bundle « cli « corehost « installer « src - github.com/dotnet/runtime.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 73b75ecdd099f8de0713dab1ec4cca9e3e9b1648 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

#ifndef __EXTRACTOR_H__
#define __EXTRACTOR_H__

#include "reader.h"
#include "manifest.h"

namespace bundle
{
    class extractor_t
    {
    public:
        extractor_t(const pal::string_t &bundle_id,
                    const pal::string_t& bundle_path,
                    const manifest_t &manifest)
            :m_extraction_dir(),
             m_working_extraction_dir(),
             m_manifest(manifest)
        {
            m_bundle_id = bundle_id;
            m_bundle_path = bundle_path;
        }

        pal::string_t& extract(reader_t& reader);

    private:
        pal::string_t& extraction_dir();
        pal::string_t& working_extraction_dir();

        void extract_new(reader_t& reader);
        void verify_recover_extraction(reader_t& reader);

        FILE* create_extraction_file(const pal::string_t& relative_path);
        void extract(const file_entry_t& entry, reader_t& reader);

        void begin();
        void commit_file(const pal::string_t& relative_path);
        void commit_dir();
        void clean();

        pal::string_t m_bundle_id;
        pal::string_t m_bundle_path;
        pal::string_t m_extraction_dir;
        pal::string_t m_working_extraction_dir;
        const manifest_t& m_manifest;
    };
}

#endif // __EXTRACTOR_H__