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 if (!ExtractAll (zipfile
, xap_dir
, CanonModeXap
)) {
53 Xap::Xap (XamlLoader
*loader
, char *xap_dir
, DependencyObject
*root
)
55 this->loader
= loader
;
56 this->xap_dir
= xap_dir
;
67 xap_create_from_file (XamlLoader
*loader
, const char *filename
)
69 char *xap_dir
= Xap::Unpack (filename
);
70 Type::Kind element_type
;
71 DependencyObject
*element
;
76 // Load the AppManifest file
77 char *manifest
= g_build_filename (xap_dir
, "appmanifest.xaml", NULL
);
78 element
= loader
->CreateDependencyObjectFromFile (manifest
, false, &element_type
);
81 if (element_type
!= Type::DEPLOYMENT
)
84 // TODO: Create a DependencyObject from the root node.
86 Xap
*xap
= new Xap (loader
, xap_dir
, element
);