Exemple #1
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");
            }
        }