Esempio n. 1
0
 private void tabControl_Selecting(object sender, TabControlCancelEventArgs e)
 {
     if (e.TabPageIndex == 2)
     {
         _settingsWorker = new SettingsWorker();
         _settingsWorker.ApplicationDataFolderUpdated   += SettingsWorker_ApplicationDataFolderUpdated;
         _settingsWorker.OutputFolderUpdated            += SettingsWorker_OutputFolderUpdated;
         _settingsWorker.UseSpecificOutputFolderUpdated += SettingsWorker_UseSpecificOutputFolderUpdated;
         _settingsWorker.SleepTimeUpdated    += SettingsWorker_SleepTimeUpdated;
         _settingsWorker.RootPathListUpdated += SettingsWorker_RootPathListUpdated;
         _settingsWorker.Initialize();
     }
     else if (_settingsWorker != null)
     {
         if (_settingsWorker.SetApplicationDataFolder(textBoxApplicationDataFolder.Text) &&
             _settingsWorker.SetSleepTime(textBoxSleepTime.Text) &&
             (!EngineSettings.UseSpecificOutputFolder || _settingsWorker.SetOutputFolder(textBoxOutputFolder.Text)))
         {
             _settingsWorker.Save();
             _settingsWorker.ApplicationDataFolderUpdated   -= SettingsWorker_ApplicationDataFolderUpdated;
             _settingsWorker.OutputFolderUpdated            -= SettingsWorker_OutputFolderUpdated;
             _settingsWorker.UseSpecificOutputFolderUpdated -= SettingsWorker_UseSpecificOutputFolderUpdated;
             _settingsWorker.SleepTimeUpdated    -= SettingsWorker_SleepTimeUpdated;
             _settingsWorker.RootPathListUpdated -= SettingsWorker_RootPathListUpdated;
             _settingsWorker = null;
         }
         else
         {
             e.Cancel = true;
         }
     }
     EnableControls(true);
 }
        public void SaveSettingsTest()
        {
            SettingsWorker settingsWorker = new SettingsWorker(settingsFileName);
            Settings       settings       = new Settings(
                consumerKey,
                consumerSecret,
                userAccessToken,
                userAccessSecret);

            settingsWorker.settings = settings;
            try
            {
                settingsWorker.SaveSettings();
                byte[] expected = Encoding.ASCII.GetBytes("{ \"consumerKey\":\"GsN18wtO5x3S6TMr7spFz4qMc\",\"consumerSecret\":\"43HHAMGtitcMKvWxK7CJ8eyVpEpiK9zUbyU4KSf4da1aFSRxTG\",\"userAccessSecret\":\"2ioYuJZIDEF8FTrWUifrzjsWYObqdiPSrt4Ic9iOEGuZJ\",\"userAccessToken\":\"892343342083780609-06JWHPF7d680xo64iGukHlVkeaGeaGE\"}");
                byte[] buf      = new byte[expected.Length];
                using (System.IO.Stream reader = new FileStream(settingsFileName, FileMode.Open))
                {
                    var input = reader.Read(buf, 0, buf.Length);
                    Assert.AreEqual(expected.ToString(), buf.ToString());
                }
            }
            catch (Exception e)
            {
                Assert.Fail(e.Message);
            }
        }
Esempio n. 3
0
 public MainForm()
 {
     InitializeComponent();
     _closing                  = false;
     _discardEvents            = false;
     _settingsWorker           = null;
     CommonWorker.ShowMessage += CommonWorker_ShowMessage;
 }
Esempio n. 4
0
        public void ImportHostInstanceSettings(string path)
        {
            var settingsWorker       = new SettingsWorker(Catalog.Instance, Catalog.Database);
            var hostInstanceSettings = Helper.BizTalkSettingsHelper.ParseHostInstancesSettings(path);

            ImportHostInstanceSettings(settingsWorker, hostInstanceSettings);

            RetrieveHostInstanceSetting(Name);
        }
Esempio n. 5
0
        private IoCContainer()
        {
            var settings = Settings.Settings.CreateDefault();
            var worker   = new SettingsWorker(PropertyNames.GetConfigPath(settings.ClientFolder),
                                              settings);

            RegisterAsSigleton <ISettings>(settings);
            RegisterAsSigleton <ISettingsWorker>(worker);
        }
Esempio n. 6
0
 public SettingsForm()
 {
     InitializeComponent();
     CommonWorker.ShowMessage += CommonWorker_ShowMessage;
     _worker = new SettingsWorker();
     _worker.DatabaseLocationUpdated           += SettingsWorker_DatabaseLocationUpdated;
     _worker.WorkingDirectoryUpdated           += SettingsWorker_WorkingDirectoryUpdated;
     _worker.VideoThumbnailsMakerUpdated       += SettingsWorker_VideoThumbnailsMakerUpdated;
     _worker.VideoThumbnailsMakerPresetUpdated += SettingsWorker_VideoThumbnailsMakerPresetUpdated;
     _worker.SourceListUpdated += SettingsWorker_SourceListUpdated;
 }
Esempio n. 7
0
        /// <summary>
        /// Import bizTalk Hosts settings
        /// </summary>
        /// <param name="settingsWorker">SettingsWorker</param>
        /// <param name="filePath">Settings file path</param>
        private void ImportBizTalkHostsSettings(SettingsWorker settingsWorker, string filePath, string hostToImport)
        {
            HostSettings hostSettings = BizTalkSettings.LoadBiztalkHostsSettings(filePath);

            foreach (var host in Host)
            {
                if (hostToImport.Equals(host.Name.ToString()))
                {
                    host.ImportHostSettings(settingsWorker, hostSettings);
                }
            }
        }
Esempio n. 8
0
        /// <summary>
        /// ImportBizTalkHostInstancesSettings
        /// </summary>
        /// <param name="path">Settings file path</param>
        private void ImportBizTalkHostInstancesSettings(SettingsWorker settingsWorker, string path, string hostToImport)
        {
            HostInstanceSettings hostInstanceSettings = Helper.BizTalkSettingsHelper.ParseHostInstancesSettings(path);

            foreach (var hostInstance in HostInstances)
            {
                if (hostToImport.Equals(hostInstance.HostName.ToString()))
                {
                    hostInstance.ImportHostInstanceSettings(settingsWorker, hostInstanceSettings);
                }
            }
        }
Esempio n. 9
0
        /// <summary>
        /// Import settings method
        /// </summary>
        /// <param name="path">settings file</param>
        public void ImportSettings(string path, string host)
        {
            var settingsWorker = new SettingsWorker(sqlInstanceName, databaseName);

            try
            {
                ImportBizTalkGroupSettings(settingsWorker, path);
                ImportBizTalkHostsSettings(settingsWorker, path, host);
                RetrieveGroupSettings();
            }
            catch (Exception)
            {
                throw;
            }
        }
Esempio n. 10
0
        internal void ImportHostSettings(SettingsWorker settingsWorker, HostSettings settings)
        {
            ExportedSettings exportedSettings = new ExportedSettings();

            exportedSettings.ExportedGroup = String.Format("{0}:{1}", Catalog.Instance.ToUpper(), Catalog.Database.ToUpper());
            exportedSettings.HostSettings  = settings;

            try
            {
                settingsWorker.ImportHostSettings(Name, Name, exportedSettings);
            }
            catch (Exception e)
            {
                throw new BtsException(settingsWorker.GetManagementExceptionDescription(e), e);
            }
        }
        public void LoadSettingsTest()
        {
            SettingsWorker settingsWorker = new SettingsWorker(settingsFileName);

            try
            {
                settingsWorker.LoadSettings();
                Assert.AreEqual(consumerKey, settingsWorker.settings.consumerKey);
                Assert.AreEqual(consumerSecret, settingsWorker.settings.consumerSecret);
                Assert.AreEqual(userAccessToken, settingsWorker.settings.userAccessToken);
                Assert.AreEqual(userAccessSecret, settingsWorker.settings.userAccessSecret);
            }
            catch (Exception e)
            {
                Assert.Fail(e.Message);
            }
        }
Esempio n. 12
0
        public void ImportHostInstanceSettings(SettingsWorker settingsWorker, HostInstanceSettings settings)
        {
            var exportedSettings = new ExportedSettings();

            exportedSettings.ExportedGroup        = String.Format("{0}:{1}", Catalog.Instance.ToUpper(), Catalog.Database.ToUpper());
            exportedSettings.HostInstanceSettings = settings;

            try
            {
                var hostInstanceName = String.Format("{0}:{1}", HostName, RunningServer);
                settingsWorker.ImportHostInstanceSettings(hostInstanceName, hostInstanceName, exportedSettings);
            }
            catch (System.Exception)
            {
                throw;
            }
        }
Esempio n. 13
0
        /// <summary>
        /// ImportBiztalkGroupSettings
        /// </summary>
        /// <param name="settingsWorker"></param>
        /// <param name="filePath"></param>
        private void ImportBizTalkGroupSettings(SettingsWorker settingsWorker, string filePath)
        {
            SettingsRoot groupSettings = BizTalkSettings.LoadBiztalkGroupSettings(filePath);


            try
            {
                ExportedSettings exportedSettings = new ExportedSettings();
                exportedSettings.ExportedGroup = String.Format("{0}:{1}", databaseName, databaseName);
                exportedSettings.GroupSettings = groupSettings;
                settingsWorker.ImportGroupSettings(exportedSettings);
            }

            catch (Exception exception)
            {
                throw exception;
            }
        }
        public void LoadSettingsFileNotExist()
        {
            string fileName = "NotExistFileName";

            if (File.Exists(fileName))
            {
                File.Delete(fileName);
            }
            SettingsWorker settingsWorker = new SettingsWorker(fileName);

            try
            {
                settingsWorker.LoadSettings();
                Assert.AreEqual(consumerKey, settingsWorker.settings.consumerKey);
                Assert.AreEqual(consumerSecret, settingsWorker.settings.consumerSecret);
                Assert.AreEqual("", settingsWorker.settings.userAccessToken);
                Assert.AreEqual("", settingsWorker.settings.userAccessSecret);
            }
            catch (Exception e)
            {
                Assert.Fail(e.Message);
            }
        }
Esempio n. 15
0
        public ViewWorker()
        {
            virusList = new List <AntivirusLibrary.Abstracts.FileWithSignature>();
            worker    = new SettingsWorker();
            Pages     = new List <Page>();
            ServerIp  = "127.0.0.1";
            ChangeInterfaceLanguage();
            indexLangItem     = -1;
            ExceptionList     = worker.ExceptionsWork.ExceptionFiles;
            DangerProcessList = new List <AntivirusLibrary.ProcessDange>();
            for (int i = 0; i < ItemsFile.Count; i++)
            {
                if (ItemsFile[i] == worker.SettingsLoaded.InterfaceLanguage)
                {
                    IndexLangItem = i;
                    break;
                }
            }

            CreteAntiwirusWorker();
            PropertyOfSettings();
            CreateVirusPage();
            CreateDangerProcessPage();
        }
Esempio n. 16
0
 public RootPathForm(SettingsWorker settingsWorker, RootPath rootPath)
 {
     InitializeComponent();
     _settingsWorker = settingsWorker;
     RootPath        = rootPath;
 }
Esempio n. 17
0
 public SettingsManagerController()
 {
     m_settingsWorker = new SettingsWorker();
 }