Esempio n. 1
0
        /// <summary>
        /// Save to <paramref name="fileName"/> the list of references
        /// </summary>
        /// <param name="fileName">output file name</param>
        /// <remarks>Do not write out the builtin references neither broken references. If you need to export a broken reference, first fix it</remarks>
        public override void Save(string fileName)
        {
            //Make sure the path exists
            MakePath(System.IO.Path.GetDirectoryName(fileName));

            using (StreamWriter sw = new StreamWriter(fileName)) {
                ExportObject export = new ExportObject(sw);

                export.WriteBegin(ClassName);
                foreach (Access.Reference reference in App.Application.References)
                {
                    if (!reference.BuiltIn && !reference.IsBroken)
                    {
                        export.WriteBegin("Reference", reference.Name);
                        export.WriteProperty("FullPath", reference.FullPath);
                        if (reference.Kind == Microsoft.Vbe.Interop.vbext_RefKind.vbext_rk_TypeLib)
                        {
                            export.WriteProperty("Guid", reference.Guid);
                            export.WriteProperty("Major", reference.Major);
                            export.WriteProperty("Minor", reference.Minor);
                            export.WriteEnd();
                        }
                    }
                }
                export.WriteEnd();
            }
        }
Esempio n. 2
0
        public override void Save(string fileName)
        {
            //Make sure the path exists
            MakePath(System.IO.Path.GetDirectoryName(fileName));

            using (StreamWriter sw = new StreamWriter(fileName)) {
                ExportObject export = new ExportObject(sw);

                dao.Database db = App.Application.CurrentDb();

                export.WriteBegin(ClassName);
                foreach (dao.Relation relation in db.Relations)
                {
                    export.WriteBegin("Relation", relation.Name);
                    export.WriteProperty("Attributes", relation.Attributes);
                    export.WriteProperty("ForeignTable", relation.ForeignTable);
                    export.WriteProperty("Table", relation.Table);
                    //try { export.WriteProperty("PartialReplica", relation.PartialReplica); } catch { }      //Accessing this property causes an exception ¿?
                    export.WriteBegin("Fields");
                    foreach (dao.Field fld in relation.Fields)
                    {
                        export.WriteBegin("Field");
                        export.WriteProperty("Name", fld.Name);
                        export.WriteProperty("ForeignName", fld.ForeignName);
                        export.WriteEnd();
                    }
                    export.WriteEnd();
                    export.WriteEnd();
                }
                export.WriteEnd();
            }
        }
Esempio n. 3
0
 /// <summary>
 /// Write the transformation result to a stream with help of an <see cref="ExportObject"/>
 /// </summary>
 /// <param name="export">helper class for write objects</param>
 /// <param name="property"><see cref="dao.Property"/> to transform to</param>
 public virtual void WriteTransform(ExportObject export, dao.Property property)
 {
     try {
         export.WriteProperty(property.Name, Transform(property));
     } catch {
         export.WriteProperty(property.Name, String.Empty);
     }
 }
Esempio n. 4
0
        public override void SaveProperties(ExportObject export)
        {
            PropertyCollectionDao propColl = new PropertyCollectionDao(daoField, daoField.Properties);

            propColl.TryWriteProperty(export, "Attributes");
            propColl.TryWriteProperty(export, "CollatingOrder");
            propColl.TryWriteProperty(export, "Type");
            propColl.TryWriteProperty(export, "Name");
            propColl.TryWriteProperty(export, "OrdinalPosition");
            propColl.TryWriteProperty(export, "Size");
            propColl.TryWriteProperty(export, "SourceField");
            propColl.TryWriteProperty(export, "SourceTable");
            propColl.TryWriteProperty(export, "DataUpdatable");
            propColl.TryWriteProperty(export, "DefaultValue");
            propColl.TryWriteProperty(export, "ValidationRule");
            propColl.TryWriteProperty(export, "ValidationText");
            propColl.TryWriteProperty(export, "Required");
            propColl.TryWriteProperty(export, "AllowZeroLength");
            propColl.TryWriteProperty(export, "VisibleValue");
            propColl.TryWriteProperty(export, "Description");
            propColl.TryWriteProperty(export, "DecimalPlaces");
            propColl.TryWriteProperty(export, "DisplayControl");
            if (propColl.PropertyHasValue("DisplayControl"))
            {
                switch (Convert.ToInt32(daoField.Properties["DisplayControl"].Value))
                {
                case 110:       //listbox
                    propColl.TryWriteProperty(export, "RowSourceType");
                    propColl.TryWriteProperty(export, "RowSource");
                    propColl.TryWriteProperty(export, "BoundColumn");
                    propColl.TryWriteProperty(export, "ColumnCount");
                    propColl.TryWriteProperty(export, "ColumnHeads");
                    propColl.TryWriteProperty(export, "ColumnWidths");
                    break;

                case 111:       //dropdown list
                    propColl.TryWriteProperty(export, "RowSourceType");
                    propColl.TryWriteProperty(export, "RowSource");
                    propColl.TryWriteProperty(export, "BoundColumn");
                    propColl.TryWriteProperty(export, "ColumnCount");
                    propColl.TryWriteProperty(export, "ColumnHeads");
                    propColl.TryWriteProperty(export, "ColumnWidths");
                    propColl.TryWriteProperty(export, "ListRows");
                    propColl.TryWriteProperty(export, "ListWidth");
                    propColl.TryWriteProperty(export, "LimitToList");
                    break;
                }
            }
            propColl.TryWriteProperty(export, "ColumnWidth");
            propColl.TryWriteProperty(export, "ColumnOrder");
            propColl.TryWriteProperty(export, "ColumnHidden");
            propColl.TryWriteProperty(export, "Format");
            propColl.TryWriteProperty(export, "Caption");
            propColl.TryWriteProperty(export, "UnicodeCompression");
            propColl.TryWriteProperty(export, "SmartTags");
            propColl.TryWriteProperty(export, "InputMask");
        }
Esempio n. 5
0
        public virtual void WriteTransform(ExportObject export, Access.AccessObjectProperty property)
        {
            object propertyValue;

            try {
                propertyValue = property.Value;
            } catch {
                propertyValue = String.Empty;
            }
            export.WriteProperty(property.Name, Transform(propertyValue));
        }
 public void TryWriteProperty(ExportObject export, string propertyName)
 {
     if (PropertyHasValue(propertyName))
     {
         export.WriteProperty(propertyName, Properties[propertyName].Value);
     }
     else
     {
         export.WriteProperty(propertyName);
     }
 }
Esempio n. 7
0
        /// <summary>
        /// Save table defintion to <paramref name="fileName"/>
        /// </summary>
        /// <param name="fileName">File name where save the table definition</param>
        public override void Save(string fileName)
        {
            MakePath(System.IO.Path.GetDirectoryName(fileName));

            dao.DBEngine dbEngine = new dao.DBEngine();
            dao.Database db       = dbEngine.OpenDatabase(App.FileName);
            dao.TableDef tbDef    = db.TableDefs[Name];

            using (StreamWriter sw = new StreamWriter(fileName)) {
                ExportObject export = new ExportObject(sw);
                //export.ListProperties(tbDef.Name, tbDef.Properties);
                export.WriteBegin(ClassName, TableName);
                export.WriteProperty("Attributes", tbDef.Attributes);
                export.WriteProperty("Connect", tbDef.Connect);
                export.WriteProperty("SourceTableName", tbDef.SourceTableName);
                export.WriteProperty("ValidationRule", tbDef.ValidationRule);
                export.WriteProperty("ValidationText", tbDef.ValidationText);

                PropertyCollectionDao propColl = new PropertyCollectionDao(tbDef, tbDef.Properties);
                propColl.TryWriteProperty(export, "Description");
                propColl.TryWriteProperty(export, "ConflictTable");
                propColl.TryWriteProperty(export, "ReplicaFilter");
                propColl.TryWriteProperty(export, "Orientation");
                propColl.TryWriteProperty(export, "OrderByOn");
                propColl.TryWriteProperty(export, "SubdatasheetName");
                propColl.TryWriteProperty(export, "LinkChildFields");
                propColl.TryWriteProperty(export, "LinkMasterFields");
                propColl.TryWriteProperty(export, "SubdatasheetHeight");
                propColl.TryWriteProperty(export, "SubdatasheetExpanded");
                propColl.TryWriteProperty(export, "DefaultView");
                propColl.TryWriteProperty(export, "OrderBy");

                export.WriteBegin("Fields");
                foreach (dao.Field field in tbDef.Fields)
                {
                    export.WriteObject(new Field(field));
                }
                export.WriteEnd();      //End Fields
                export.WriteBegin("Indexes");
                //TODO: Add new option menu to ignore linked tables errors if the linked document do not exist
                //      Check if the linked document exists before iterate the indexes collection
                foreach (dao.Index daoIndex in tbDef.Indexes)
                {
                    export.WriteObject(new Index(daoIndex));
                }
                export.WriteEnd();  //End Indexes
                export.WriteEnd();  //End Table
            }
            db.Close();
        }
Esempio n. 8
0
 public override void SaveProperties(ExportObject export)
 {
     export.WriteProperty("Name", daoIndex.Name);
     export.WriteProperty("Primary", daoIndex.Primary);
     export.WriteProperty("Unique", daoIndex.Unique);
     export.WriteProperty("IgnoreNulls", daoIndex.IgnoreNulls);
     export.WriteProperty("Required", daoIndex.Required);
     export.WriteBegin("Fields");
     dao.IndexFields idxFiels = (dao.IndexFields)daoIndex.Fields;
     for (int i = 0; i < idxFiels.Count; i++)
     {
         dao.Field fld = (dao.Field)idxFiels[i];
         export.WriteBegin("Field");
         export.WriteProperty("Name", fld.Name);
         export.WriteProperty("Attributes", fld.Attributes); //Descending order (dao.FieldAttributeEnum.dbDescending)
         export.WriteEnd();
     }
     export.WriteEnd();
 }
Esempio n. 9
0
        public override void Save(string fileName)
        {
            Dictionary <string, IPropertyTransform> propsToWrite = gatherProperties();

            //Make sure the path exists
            MakePath(System.IO.Path.GetDirectoryName(fileName));

            //Write the properties with help of an ExportObject
            using (StreamWriter sw = new StreamWriter(fileName)) {
                ExportObject export     = new ExportObject(sw);
                string       dbFileName = System.IO.Path.GetFileName(App.FileName);
                export.WriteBegin(ClassName, dbFileName);
                foreach (string item in propsToWrite.Keys)
                {
                    propsToWrite[item].WriteTransform(export, App.Application.CurrentProject.Properties[item]);
                }
                export.WriteEnd();
            }
        }
Esempio n. 10
0
 public abstract void SaveProperties(ExportObject export);
Esempio n. 11
0
 public override void WriteTransform(ExportObject export, Access.AccessObjectProperty accessObjectProperty)
 {
     //write nothing at all
 }
Esempio n. 12
0
 public override void WriteTransform(ExportObject export, dao.Property property)
 {
     //write nothing at all
 }