summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarc-André Lureau <marcandre.lureau@gmail.com>2013-01-03 13:34:35 +0100
committerMarc-André Lureau <marcandre.lureau@gmail.com>2013-01-06 16:38:26 +0100
commitace4b70a1519354b15e091d5d0a034b4457d4d7e (patch)
tree5927d97b8e74e6b65c8a5a39bcda986507402ffe
parent37d07cd2611fe2bdfacdf602061b221620eb5302 (diff)
downloadmsitools-ace4b70a1519354b15e091d5d0a034b4457d4d7e.tar.gz
msitools-ace4b70a1519354b15e091d5d0a034b4457d4d7e.tar.xz
msitools-ace4b70a1519354b15e091d5d0a034b4457d4d7e.zip
Populate Feature table
-rw-r--r--src/builder.vala4
-rw-r--r--src/msi.vala29
-rw-r--r--src/wix.vala18
3 files changed, 51 insertions, 0 deletions
diff --git a/src/builder.vala b/src/builder.vala
index e98706b..66fb671 100644
--- a/src/builder.vala
+++ b/src/builder.vala
@@ -63,6 +63,10 @@ namespace Wixl {
} else
warning ("unhandled parent type %s", comp.parent.name);
}
+
+ public override void visit_feature (WixFeature feature) throws GLib.Error {
+ db.table_feature.add (feature.Id, 2, int.parse (feature.Level), 0);
+ }
}
} // Wixl
diff --git a/src/msi.vala b/src/msi.vala
index 6333490..d8f9c8a 100644
--- a/src/msi.vala
+++ b/src/msi.vala
@@ -339,6 +339,32 @@ namespace Wixl {
}
}
+ class MsiTableFeature: MsiTable {
+ construct {
+ name = "Feature";
+ }
+
+ public void add (string Feature, int Display, int Level, int Attributes) throws GLib.Error {
+ var rec = new Libmsi.Record (4);
+ if (!rec.set_string (1, Feature) ||
+ !rec.set_int (2, Display) ||
+ !rec.set_int (3, Level) ||
+ !rec.set_int (4, Attributes))
+ throw new Wixl.Error.FAILED ("failed to add record");
+
+ records.append (rec);
+ }
+
+ public override void create (Libmsi.Database db) throws GLib.Error {
+ var query = new Libmsi.Query (db, "CREATE TABLE `Feature` (`Feature` CHAR(38) NOT NULL, `Feature_Parent` CHAR(38), `Title` CHAR(64) LOCALIZABLE, `Description` CHAR(255) LOCALIZABLE, `Display` INT, `Level` INT NOT NULL, `Directory_` CHAR(72), `Attributes` INT NOT NULL PRIMARY KEY `Feature`)");
+ query.execute (null);
+
+ query = new Libmsi.Query (db, "INSERT INTO `Feature` (`Feature`, `Display`, `Level`, `Attributes`) VALUES (?, ?, ?, ?)");
+ foreach (var r in records)
+ query.execute (r);
+ }
+ }
+
class MsiTable_Validation: MsiTable {
construct {
name = "_Validation";
@@ -406,6 +432,7 @@ namespace Wixl {
public MsiTableMedia table_media;
public MsiTableDirectory table_directory;
public MsiTableComponent table_component;
+ public MsiTableFeature table_feature;
HashTable<string, MsiTable> tables;
@@ -433,6 +460,7 @@ namespace Wixl {
table_media = new MsiTableMedia ();
table_directory = new MsiTableDirectory ();
table_component = new MsiTableComponent ();
+ table_feature = new MsiTableFeature ();
foreach (var t in new MsiTable[] {
new MsiTableAdminExecuteSequence (),
@@ -447,6 +475,7 @@ namespace Wixl {
table_property,
table_icon,
table_component,
+ table_feature,
new MsiTable_Validation ()
}) {
tables.insert (t.name, t);
diff --git a/src/wix.vala b/src/wix.vala
index 75c2119..1e94fc8 100644
--- a/src/wix.vala
+++ b/src/wix.vala
@@ -8,6 +8,7 @@ namespace Wixl {
public abstract void visit_media (WixMedia media) throws GLib.Error;
public abstract void visit_directory (WixDirectory dir) throws GLib.Error;
public abstract void visit_component (WixComponent comp) throws GLib.Error;
+ public abstract void visit_feature (WixFeature feature) throws GLib.Error;
}
public abstract class WixElement: Object {
@@ -144,6 +145,18 @@ namespace Wixl {
}
}
+ public class WixFeature: WixElement {
+ static construct {
+ name = "Feature";
+ }
+
+ public string Level { get; set; }
+
+ public override void accept (WixElementVisitor visitor) throws GLib.Error {
+ visitor.visit_feature (this);
+ }
+ }
+
public class WixProduct: WixElement {
static construct {
name = "Product";
@@ -194,6 +207,11 @@ namespace Wixl {
directory.load (child);
add_child (directory);
continue;
+ case "Feature":
+ var feature = new WixFeature ();
+ feature.load (child);
+ add_child (feature);
+ continue;
}
break;
}