1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
6 * Moonlight List (moonlight-list@lists.ximian.com)
8 * Copyright 2008 Novell, Inc. (http://www.novell.com)
10 * See the LICENSE file included with the distribution for details.
21 #include "zip/unzip.h"
29 Xap::Unpack (const char *fname
)
34 if (!(xap_dir
= CreateTempDir (fname
)))
37 if (!(zipfile
= unzOpen (fname
))) {
43 // FIXME: at some point we'll want to pass 'true' here (as part of the
44 // fix for case-insensitive resource access)
45 if (!ExtractAll (zipfile
, xap_dir
, false)) {
55 Xap::Xap (XamlLoader
*loader
, char *xap_dir
, DependencyObject
*root
)
57 this->loader
= loader
;
58 this->xap_dir
= xap_dir
;
69 xap_create_from_file (XamlLoader
*loader
, const char *filename
)
71 char *xap_dir
= Xap::Unpack (filename
);
72 Type::Kind element_type
;
73 DependencyObject
*element
;
78 // Load the AppManifest file
79 char *manifest
= g_build_filename (xap_dir
, "AppManifest.xaml", NULL
);
80 element
= loader
->CreateDependencyObjectFromFile (manifest
, false, &element_type
);
83 if (element_type
!= Type::DEPLOYMENT
)
86 // TODO: Create a DependencyObject from the root node.
88 Xap
*xap
= new Xap (loader
, xap_dir
, element
);