예제 #1
0
        /// <summary>
        /// attach to the onSave and onDelete event for all types
        /// </summary>
        public void AttachToAll()
        {
            LogHelper.Debug <uSync>("Attaching to Events - Start");

            if (uSyncSettings.Elements.DataTypes)
            {
                SyncDataType.AttachEvents();
            }

            if (uSyncSettings.Elements.DocumentTypes)
            {
                SyncDocType.AttachEvents();
            }

            if (uSyncSettings.Elements.MediaTypes)
            {
                SyncMediaTypes.AttachEvents();
            }

            if (uSyncSettings.Elements.Macros)
            {
                SyncMacro.AttachEvents();
            }

            if (uSyncSettings.Elements.Templates)
            {
                SyncTemplate.AttachEvents();
            }

            if (uSyncSettings.Elements.Stylesheets)
            {
                SyncStylesheet.AttachEvents();
            }

            if (uSyncSettings.Elements.Dictionary)
            {
                SyncLanguage.AttachEvents();
                SyncDictionary.AttachEvents();
            }

            if (uSyncSettings.Elements.MemberTypes)
            {
                SyncMemberType.AttachEvents();
                LogHelper.Info <uSync>("Attaching MemberTypes events");
            }

            LogHelper.Debug <uSync>("Attaching to Events - End");
        }
예제 #2
0
        /// <summary>
        /// save everything in the DB to disk.
        /// </summary>
        public void SaveAllToDisk()
        {
            LogHelper.Debug <uSync>("Saving to disk - start");

            if (uSyncSettings.Elements.DocumentTypes)
            {
                SyncDocType.SaveAllToDisk();
            }

            if (uSyncSettings.Elements.Macros)
            {
                SyncMacro.SaveAllToDisk();
            }

            if (uSyncSettings.Elements.MediaTypes)
            {
                SyncMediaTypes.SaveAllToDisk();
            }

            if (uSyncSettings.Elements.Templates)
            {
                SyncTemplate.SaveAllToDisk();
            }

            if (uSyncSettings.Elements.Stylesheets)
            {
                SyncStylesheet.SaveAllToDisk();
            }

            if (uSyncSettings.Elements.DataTypes)
            {
                SyncDataType.SaveAllToDisk();
            }

            if (uSyncSettings.Elements.Dictionary)
            {
                SyncLanguage.SaveAllToDisk();
                SyncDictionary.SaveAllToDisk();
            }

            if (uSyncSettings.Elements.MemberTypes)
            {
                SyncMemberType.SaveAllToDisk();
            }

            LogHelper.Debug <uSync>("Saving to Disk - End");
        }
예제 #3
0
        /// <summary>
        /// read all settings from disk and sync to the database
        /// </summary>
        public void ReadAllFromDisk()
        {
            if (!File.Exists(Path.Combine(IOHelper.MapPath(helpers.uSyncIO.RootFolder), "usync.stop")))
            {
                lock (_readSync)
                {
                    EventsPaused = true;

                    LogHelper.Debug <uSync>("Reading from Disk - starting");

                    if (uSyncSettings.Elements.Templates)
                    {
                        SyncTemplate.ReadAllFromDisk();
                    }

                    if (uSyncSettings.Elements.Stylesheets)
                    {
                        SyncStylesheet.ReadAllFromDisk();
                    }

                    if (uSyncSettings.Elements.DataTypes)
                    {
                        SyncDataType.ReadAllFromDisk();
                    }

                    if (uSyncSettings.Elements.DocumentTypes)
                    {
                        SyncDocType.ReadAllFromDisk();
                    }

                    if (uSyncSettings.Elements.Macros)
                    {
                        SyncMacro.ReadAllFromDisk();
                    }

                    if (uSyncSettings.Elements.MediaTypes)
                    {
                        SyncMediaTypes.ReadAllFromDisk();
                    }

                    if (uSyncSettings.Elements.Dictionary)
                    {
                        SyncLanguage.ReadAllFromDisk();
                        SyncDictionary.ReadAllFromDisk();
                    }

                    LogHelper.Debug <uSync>("Reading from Disk - End");

                    if (File.Exists(Path.Combine(IOHelper.MapPath(helpers.uSyncIO.RootFolder), "usync.once")))
                    {
                        LogHelper.Debug <uSync>("Renaming once file");

                        File.Move(Path.Combine(IOHelper.MapPath(helpers.uSyncIO.RootFolder), "usync.once"),
                                  Path.Combine(IOHelper.MapPath(helpers.uSyncIO.RootFolder), "usync.stop"));
                        LogHelper.Debug <uSync>("Once renamed to stop");
                    }

                    EventsPaused = false;
                }
            }
            else
            {
                LogHelper.Info <uSync>("Read stopped by usync.stop");
            }
        }