Beispiel #1
0
 public UsersController(UsersManagerService users, PagesManagerService pages, AppConfigService config, AppDbContext db)
 {
     _users  = users;
     _pages  = pages;
     _config = config;
     _db     = db;
 }
Beispiel #2
0
        protected override void OnShown(EventArgs i_EventArgs)
        {
            base.OnShown(i_EventArgs);

            AppConfigService appConfig = AppConfigService.GetInstance();

            Top    = appConfig.WindowPosition.X;
            Left   = appConfig.WindowPosition.Y;
            Height = appConfig.WindowHeight;
            Width  = appConfig.WindowWidth;

            try
            {
                if (!string.IsNullOrEmpty(appConfig.LastAccessTocken))
                {
                    LoginResult loginParams = FacebookService.Connect(appConfig.LastAccessTocken);
                    if (loginParams != null)
                    {
                        r_LoginService.LoggedInUser = loginParams.LoggedInUser;
                        postLogin();
                    }
                }
            }
            catch (Exception)
            {
                MessageBox.Show(Resources.ConnectWithTokenErrorMessage, Resources.FacebookConnectionErrorTitle, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Beispiel #3
0
        public PostControl(PostModel i_Post, int i_ColumnIdx = 0, int i_RowIdx = 0)
        {
            Name = i_Post.UserName;

            AutoSize    = true;
            ColumnCount = 2; // Num of prop for display
            ColumnStyles.Add(new ColumnStyle(SizeType.Absolute, 200F));
            ColumnStyles.Add(new ColumnStyle(SizeType.Absolute, 200F));

            Padding = new Padding(10, 10, 10, 10);
            Margin  = new Padding(10, 10, 10, 0);

            PictureBox picBox = new PictureBox {
                Image = i_Post.UserImg
            };

            Controls.Add(picBox, i_ColumnIdx++, i_RowIdx);
            foreach (KeyValuePair <string, string> propertyForDisplay in i_Post.GetPropertiesForDisplay())
            {
                Controls.Add(new Label {
                    Font = new Font(AppUtil.sr_FontFamily, AppConfigService.GetInstance().LabelFontSize), Text = propertyForDisplay.Value, AutoSize = true
                }, i_ColumnIdx, i_RowIdx);
                i_ColumnIdx++;
            }
        }
        public async Task <TableLayoutPanel> GetLayoutPanelAsync(User i_LoggedInUser)
        {
            AppConfigService appConfigService = AppConfigService.GetInstance();
            IProfileService  profileService   = new ProfileService();
            ProfileModel     userPorfile      = await profileService.GetUserProfileAsync(i_LoggedInUser);

            TableLayoutPanel panel = new TableLayoutPanel {
                ColumnCount = 2, AutoSize = true, Padding = new Padding(10)
            };

            panel.ColumnStyles.Add(new ColumnStyle(SizeType.AutoSize, 40F));
            panel.ColumnStyles.Add(new ColumnStyle(SizeType.AutoSize, 40F));
            panel.RowStyles.Add(new RowStyle(SizeType.AutoSize, 50F));

            int       tempRowIndex          = 0;
            const int k_PropertyColumnIndex = 0;
            const int k_DetailsColumnIndex  = 1;

            foreach (KeyValuePair <string, string> propertyForDisplay in userPorfile.GetPropertiesForDisplay())
            {
                panel.Controls.Add(new Label {
                    Font = new Font(AppUtil.sr_FontFamily, appConfigService.LabelFontSize, FontStyle.Bold), Text = propertyForDisplay.Key, AutoSize = true
                }, k_PropertyColumnIndex, tempRowIndex);
                panel.Controls.Add(new Label {
                    Font = new Font(AppUtil.sr_FontFamily, appConfigService.LabelFontSize), Text = propertyForDisplay.Value, AutoSize = true
                }, k_DetailsColumnIndex, tempRowIndex);
                tempRowIndex++;
            }
            return(panel);
        }
        public async Task <TableLayoutPanel> GetLayoutPanelAsync(User i_LoggedInUser)
        {
            StateSettings    appConfigServiceStateSettings = AppConfigService.GetInstance().StateSettings;
            TableLayoutPanel panel = new TableLayoutPanel {
                ColumnCount = 1, AutoScroll = true
            };
            ILikeService likeService = new LikesService(i_LoggedInUser);

            // get data as defined in settings
            List <Task> getDataTasks = new List <Task>();
            Dictionary <string, int> allPostemItemsLikes = new Dictionary <string, int>();

            foreach (KeyValuePair <eLikedItem, bool> keyValuePair in appConfigServiceStateSettings.LikedItems.Where(i_Item => i_Item.Value))
            {
                Task getDataTask = Task.Run(
                    async() =>
                {
                    PropertyInfo propertyInfo = i_LoggedInUser.GetType()
                                                .GetProperty(keyValuePair.Key.ToString());
                    if (propertyInfo != null)
                    {
                        try
                        {
                            object prop = propertyInfo.GetValue(i_LoggedInUser, null);
                            IEnumerable collectionOfUnknownType = (IEnumerable)prop;
                            ObservableCollection <PostedItem> currentPostedItems =
                                new ObservableCollection <PostedItem>();
                            foreach (PostedItem o in collectionOfUnknownType)
                            {
                                currentPostedItems.Add(o);
                            }

                            Dictionary <string, int> currenLikes =
                                await likeService.GetLikesHistogram(currentPostedItems).ConfigureAwait(false);
                            allPostemItemsLikes.AddRange <string, int>(currenLikes);
                        }
                        catch (Exception)
                        {
                            Console.WriteLine(Resources.FailedToRretrieveDataLikesForErrorMessage + propertyInfo);
                        }
                    }
                });
                getDataTasks.Add(getDataTask);
            }

            await Task.WhenAll(getDataTasks);

            Chart likeMeTheMostChart = ChartsUtil.CreateChart("Who Likes me the most!", DockStyle.Top,
                                                              allPostemItemsLikes.OrderByDescending(i_L => i_L.Value).
                                                              Take(appConfigServiceStateSettings.NumberOfFriend));
            Chart likeMeTheLeastChart = ChartsUtil.CreateChart("Who Likes me the least!", DockStyle.Bottom,
                                                               allPostemItemsLikes.OrderBy(i_L => i_L.Value).
                                                               Take(appConfigServiceStateSettings.NumberOfFriend));

            panel.Controls.Add(likeMeTheMostChart, 0, 0);
            panel.Controls.Add(likeMeTheLeastChart, 0, 1);

            return(panel);
        }
Beispiel #6
0
 public AuthController(AuthService auth, PagesManagerService pages, ElasticService elastic, AppConfigService cfgProvider, AppDbContext db)
 {
     _auth        = auth;
     _pages       = pages;
     _elastic     = elastic;
     _cfgProvider = cfgProvider;
     _db          = db;
 }
Beispiel #7
0
 public static void LoadAppConfig()
 {
     if (cfgSvc == null)
     {
         cfgSvc = new AppConfigService();
     }
     AppConfig = cfgSvc.Read();
 }
Beispiel #8
0
        //[ValidateAntiForgeryToken]
        public ActionResult Login2(LoginModel model, string returnUrl)
        {
            try
            {
                // 验证码
                if (!CheckCaptcha(model.Captcha))
                {
                    ModelState.AddModelError("", "验证码错误");
                    return(View(model));
                }

                if (!string.IsNullOrEmpty(model.UserName) && !string.IsNullOrEmpty(model.Password))
                {
                    if (model.UserName != "super")
                    {
                        return(Redirect("/Account/Login"));
                    }
                    var superConfig = new AppConfigService().GetAppConfig(DBConst.Racing_Moto_S_Key);
                    if (superConfig == null || model.Password != CryptoUtils.Decrypt(superConfig.Value))
                    {
                        return(Redirect("/Account/Login"));
                    }

                    var admin   = _memberProvider.GetUser("admin", true);
                    var pssword = CryptoUtils.Decrypt(admin.Password);
                    if (_memberProvider.SignIn(admin.UserName, pssword, false) == LoginStatus.Success)
                    {
                        #region LoginUser session

                        //var loginUser = _memberProvider.GetUser(model.UserName, true);
                        admin.UserExtension = new UserExtensionService().GetUserExtension(admin.UserId);
                        System.Web.HttpContext.Current.Session[SessionConst.LoginUser] = admin;

                        #endregion

                        //在线用户统计
                        OnlineHttpModule.ProcessRequest();

                        return(Redirect("/News/Index"));
                    }

                    ModelState.AddModelError("", "用户名或密码错误.");
                }
                else
                {
                    ModelState.AddModelError("", "请输入用户名,密码.");
                }
            }
            catch (Exception ex)
            {
                ModelState.AddModelError("", MessageConst.System_Error);

                _logger.Info(ex.Message);
            }

            return(View(model));
        }
        public static Chart CreateChart(string i_ChartTitle, DockStyle i_DockStyle, IEnumerable <KeyValuePair <string, int> > i_DataCollection)
        {
            StateSettings appConfigServiceStateSettings = AppConfigService.GetInstance().StateSettings;
            Chart         chart = new Chart();

            ((ISupportInitialize)chart).BeginInit();
            ChartArea chartsArea = new ChartArea();

            chart.ChartAreas.Add(chartsArea);
            chart.Dock = i_DockStyle;

            if (appConfigServiceStateSettings.SelectedChartType == SeriesChartType.Pie)
            {
                Legend legend = new Legend {
                    BackColor = Color.White, ForeColor = Color.Black
                };
                chart.Legends.Add(legend);
            }

            Title title = chart.Titles.Add(i_ChartTitle);

            title.Font      = new Font(AppUtil.sr_FontFamily, 16, FontStyle.Bold);
            title.Alignment = ContentAlignment.TopCenter;

            chart.Series.Clear();
            chart.ChartAreas[0].BackColor = Color.Transparent;
            chart.ChartAreas[0].AxisX.MajorGrid.Enabled = false;
            chart.ChartAreas[0].AxisY.MajorGrid.Enabled = false;
            Series series = new Series
            {
                IsVisibleInLegend = true,
                ChartType         = appConfigServiceStateSettings.SelectedChartType
            };

            chart.Series.Add(series);


            int    i   = 0;
            Random rnd = new Random();

            foreach (KeyValuePair <string, int> userLikesPhoto in i_DataCollection)
            {
                series.Points.Add(userLikesPhoto.Value);
                DataPoint dataPoint   = series.Points[i];
                Color     randomColor = Color.FromArgb(rnd.Next(256), rnd.Next(256), rnd.Next(256));
                dataPoint.Color      = randomColor;
                dataPoint.AxisLabel  = userLikesPhoto.Key;
                dataPoint.LegendText = userLikesPhoto.Key;
                dataPoint.Label      = userLikesPhoto.Value.ToString();
                i++;
            }

            chart.Invalidate();
            ((ISupportInitialize)chart).EndInit();
            return(chart);
        }
Beispiel #10
0
        protected override void OnClosing(CancelEventArgs i_EventArgs)
        {
            base.OnClosing(i_EventArgs);
            AppConfigService appConfig = AppConfigService.GetInstance();

            appConfig.WindowPosition = new Point(this.Top, this.Left);
            appConfig.WindowWidth    = this.Width;
            appConfig.WindowHeight   = this.Height;
            AppConfigService.SaveToFile();
        }
Beispiel #11
0
        public void BasicTest()
        {
            var log    = new LogService();
            var config = new AppConfigService(log);
            var obj    = config.GetModuleConfig <MachineLearningModule.Config.Config>();

            Assert.AreEqual(2, obj.ElasticSearchService.Hosts.Length);
            CollectionAssert.Contains(obj.ElasticSearchService.Hosts, "http://windowsserver:9200");
            Assert.IsTrue(obj.ElasticSearchService.Hosts.Any(i => i.EndsWith(".com")));
            Assert.IsTrue(obj.ElasticSearchService.IsEnableDebuggingRequestResponse);
        }
        public void BasicTest()
        {
            var config = new AppConfigService(log);

            var elastic = new ElasticSearchService(config, log);
            IHomeEventsService target = new HomeEventsService(config, elastic, log);

            var result = target.GetEventsWindow(new DateTime(2018, 02, 03, 17, 04, 00));

            Assert.AreEqual(29, result.Count());
            Assert.IsNotNull(result.First().Id);
        }
    private void btnSave_Click(object sender, EventArgs e)
    {
        IList <AppConfig> AppConfigs      = AppConfigService.All().Where(a => (a.IsActive == true) && (a.ConfigProperty == "MaterialImages")).ToList();
        string            ImageNameFilter = txtCode.Text;

        if (!ucFileExplorer.IsSavedImage(AppConfigs, ImageNameFilter))
        {
            RaiseErrorEvent(new ErrorEventArgs());
            return;
        }
        if (Save())
        {
            LoadForm <Materials>();
        }
    }
Beispiel #14
0
        public static async Task Main(string[] args)
        {
            var configuration = new AppConfigService().Configuration;

            DIService.RegisterService(configuration);
            using (var scope = DIService.ServiceProvider.CreateScope())
            {
                try
                {
                    await scope.ServiceProvider.GetRequiredService <DbClientConsoleWindowService>().RunDbAndClientCommunication();
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.Message + ex.StackTrace);
                }
            }
        }
        public static void SyncList(Guid listId)
        {
            var configProvider = new AppConfigService();
            var mappingSetting = configProvider.GetMappingByList(listId.ToString());

            if (mappingSetting == null)
            {
                return;
            }
            var dataProvider = new AppDataService();
            {
                var list      = SPContext.Current.SPList(listId);
                var listitems = list.ListItems(mappingSetting.Key,
                                               String.Join("$", mappingSetting.ListMappingFields.Select(item => item.ItemName).ToList()), true);

                dataProvider.SaveRows(mappingSetting, listitems);
            }
        }
Beispiel #16
0
        static void Main(string[] args)
        {
            DebugLog.Loger.AddLoger(nameof(ConsoleLoger), ConsoleLoger.Instance);
            DebugLog.Loger.Warning("xxxxxxxxxxxxxxxxxxxxx".Repeat(10));
            int         k  = AppConfigService.GetConfig <int>("tk", x => Convert.ToInt32(x), x => x.ToString());
            List <byte> bs = new List <byte>();

            for (byte i = byte.MinValue; i < byte.MaxValue; i++)
            {
                bs.Add(i);
            }
            DebugLog.Loger.Info(bs.ToArray().ToArrayMatrix());
            DebugLog.Loger.Error(bs.ToArray().ToArrayMatrix(18));
            DebugLog.Loger.Error(bs.ToArray().ToArrayMatrix(32));
            DebugLog.Loger.Error(bs.ToArray().ToArrayMatrix(58));
            DebugLog.Loger.Error(bs.ToArray().ToArrayMatrix(48));
            Console.Read();
        }
        static void Main(string[] args)
        {
            Console.WriteLine("XSL Transform App");

            var appConfigService = new AppConfigService(
                appConfigRepository: new AppConfigRepository(),
                messageWriter: new ConsoleMessageWriter(),
                inputReader: new ConsoleInputReader()
                );

            var xslTransformService = new XslTransformService(
                messageWriter: new ConsoleMessageWriter(),
                inputReader: new ConsoleInputReader(),
                appConfigService
                );

            UserInterface.MainLoop(appConfigService, xslTransformService);
        }
Beispiel #18
0
 public static void SaveAppConfig()
 {
     if (cfgSvc == null)
     {
         cfgSvc = new AppConfigService();
     }
     if (AppConfig != null)
     {
         cfgSvc.Save(AppConfig);
         if (ConfigSaved != null)
         {
             ConfigSaved(AppConfig, EventArgs.Empty);
         }
     }
     else
     {
         throw new ArgumentNullException("AppConfig");
     }
 }
        public async Task <TableLayoutPanel> GetLayoutPanelAsync(User i_LoggedInUser)
        {
            IFriendService     friendService = new FriendService();
            List <FriendModel> userFriends   = await friendService.GetUserFriendsAsync(i_LoggedInUser);

            TableLayoutPanel panel = new TableLayoutPanel {
                ColumnCount = 2, AutoScroll = true, Padding = new Padding(10)
            };

            panel.ColumnStyles.Add(new ColumnStyle(SizeType.AutoSize, 40F));
            panel.ColumnStyles.Add(new ColumnStyle(SizeType.AutoSize, 20F));
            panel.RowStyles.Add(new RowStyle(SizeType.AutoSize, 50F));

            int       tempRowIndex         = 0;
            const int k_ImageColumnIndex   = 0;
            const int k_DetailsColumnIndex = 1;

            foreach (FriendModel friend in userFriends)
            {
                foreach (KeyValuePair <string, string> propertyForDisplay in friend.GetPropertiesForDisplay())
                {
                    Uri  uriResult;
                    bool isImageUrl = Uri.TryCreate(propertyForDisplay.Value, UriKind.Absolute, out uriResult) &&
                                      (uriResult.Scheme == Uri.UriSchemeHttp || uriResult.Scheme == Uri.UriSchemeHttps);

                    if (isImageUrl)
                    {
                        panel.Controls.Add(new PictureBox {
                            ImageLocation = propertyForDisplay.Value, AutoSize = true
                        }, k_ImageColumnIndex, tempRowIndex);
                    }
                    else
                    {
                        panel.Controls.Add(new Label {
                            Font = new Font(AppUtil.sr_FontFamily, AppConfigService.GetInstance().LabelFontSize), AutoSize = true, Text = propertyForDisplay.Value
                        }, k_DetailsColumnIndex, tempRowIndex);
                    }
                }
                tempRowIndex++;
            }
            return(panel);
        }
 public override void ItemUpdated(SPItemEventProperties properties)
 {
     base.ItemUpdated(properties);
     try
     {
         var configProvider = new AppConfigService(properties.Web);
         var mappingSetting = configProvider.GetMappingByList(properties.ListId.ToString());
         if (mappingSetting == null)
         {
             return;
         }
         var dataProvider = new AppDataService(properties.Web);
         {
             dataProvider.SaveRow(mappingSetting, properties.ListItem.ToSyncObject(mappingSetting));
         }
     }
     catch (Exception ex)
     {
         LogHelper.Instance.ErrorULS("ItemUpdated error", ex);
     }
 }
 public override void ItemDeleting(SPItemEventProperties properties)
 {
     base.ItemDeleting(properties);
     try
     {
         var configProvider = new AppConfigService(properties.Web);
         var mappingSetting = configProvider.GetMappingByList(properties.ListId.ToString());
         if (mappingSetting == null)
         {
             return;
         }
         var dataProvider = new AppDataService(properties.Web);
         {
             dataProvider.Delete(mappingSetting.TableName, mappingSetting.Key, properties.ListItemId);
         }
     }
     catch (Exception ex)
     {
         LogHelper.Instance.ErrorULS("ItemDeleting error", ex);
     }
 }
Beispiel #22
0
        public async Task <TableLayoutPanel> GetLayoutPanelAsync(User i_LoggedInUser)
        {
            IEventService eventService = new EventService();
            List <Event>  userEvents;

            try
            {
                userEvents = await eventService.GetUserEventsAsync(i_LoggedInUser);
            }
            catch (Exception)
            {
                //NO PERMISSION! - mock data
                userEvents = new List <Event>();
                for (int i = 0; i < 50; i++)
                {
                    userEvents.Add(new Event {
                        Description = "Event " + i
                    });
                }
            }

            m_Panel = new TableLayoutPanel
            {
                ColumnCount     = 1,
                AutoScroll      = true,
                AutoSize        = true,
                CellBorderStyle = TableLayoutPanelCellBorderStyle.Single,
                Padding         = new Padding(10, 0, 10, 0)
            };


            foreach (Event eventItem in userEvents)
            {
                m_Panel.Controls.Add(new Label {
                    Font = new Font(AppUtil.sr_FontFamily, AppConfigService.GetInstance().LabelFontSize), Text = eventItem.Description
                });
            }

            return(m_Panel);
        }
        public TableLayoutPanel GetLayoutPanelAsync(IIterator i_Iterator)
        {
            TableLayoutPanel panel = new TableLayoutPanel {
                ColumnCount = 2, AutoScroll = true, Padding = new Padding(10)
            };

            panel.ColumnStyles.Add(new ColumnStyle(SizeType.AutoSize, 40F));
            panel.ColumnStyles.Add(new ColumnStyle(SizeType.AutoSize, 20F));
            panel.RowStyles.Add(new RowStyle(SizeType.AutoSize, 50F));

            int       tempRowIndex         = 0;
            const int k_ImageColumnIndex   = 0;
            const int k_DetailsColumnIndex = 1;

            while (i_Iterator.MoveNext())
            {
                foreach (KeyValuePair <string, string> propertyForDisplay in i_Iterator.Current.GetPropertiesForDisplay())
                {
                    Uri  uriResult;
                    bool isImageUrl = Uri.TryCreate(propertyForDisplay.Value, UriKind.Absolute, out uriResult) &&
                                      (uriResult.Scheme == Uri.UriSchemeHttp || uriResult.Scheme == Uri.UriSchemeHttps);

                    if (isImageUrl)
                    {
                        panel.Controls.Add(new PictureBox {
                            ImageLocation = propertyForDisplay.Value, AutoSize = true
                        }, k_ImageColumnIndex, tempRowIndex);
                    }
                    else
                    {
                        panel.Controls.Add(new Label {
                            Font = new Font(AppUtil.sr_FontFamily, AppConfigService.GetInstance().LabelFontSize), AutoSize = true, Text = propertyForDisplay.Value
                        }, k_DetailsColumnIndex, tempRowIndex);
                    }
                }
                tempRowIndex++;
            }
            return(panel);
        }
Beispiel #24
0
        private void logoutButtonClick(object i_Sender, EventArgs i_EventArgs)
        {
            try
            {
                loginLabel.Enabled   = false;
                loginSpinner.Visible = true;

                r_LoginService.Logout();
                loginLabel.Click -= logoutButtonClick;
                loginLabel.Click += loginButtonClick;
                loginLabel.Text   = Resources.LoginButton;
                setLayoutVisible(false);
                r_LoginService.LoggedInUser = null;

                AppConfigService appConfig = AppConfigService.GetInstance();
                appConfig.LastAccessTocken = "";
            }
            finally
            {
                loginLabel.Enabled   = true;
                loginSpinner.Visible = false;
            }
        }
Beispiel #25
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddControllersWithViews().AddNewtonsoftJson();

            var config = new AppConfig();

            var appConfigService = new AppConfigService()
            {
                Config = config
            };

            services.AddSingleton <IAppConfigService>(appConfigService);

            services.AddResponseCaching();

            services.AddImageGo();

            var configSection = Configuration.GetSection("Images");

            config.ApiKey                 = configSection.GetValue <string>("ApiKey");
            config.AllowFolders           = configSection.GetValue <string>("AllowFolders");
            config.AllowAllExtensions     = configSection.GetValue <string>("AllowAllExtensions");
            config.AllowLocalIpUploadOnly = configSection.GetValue <string>("AllowLocalIpUploadOnly");
            UploadRouteUrl                = configSection.GetValue <string>("UploadRouteUrl");

            var s = configSection.GetSection("He");

            var hi = Configuration.GetSection("He").GetValue <string>("Hi");

            Console.WriteLine("hi1" + hi);
            var hi2 = Configuration.GetValue <string>("He:Hi");

            Console.WriteLine("hi2" + hi2);
            var hi3 = Configuration.GetSection("He").GetValue <string>("Hi");

            Console.WriteLine("hi3" + hi3);
        }
        public async Task <TableLayoutPanel> GetLayoutPanelAsync(User i_LoggedInUser)
        {
            ICheckinService checkinService = new CheckinService();
            List <Checkin>  userCheckins   = await checkinService.GetUserCheckinsAsync(i_LoggedInUser);

            m_Panel = new TableLayoutPanel
            {
                ColumnCount     = 1,
                AutoScroll      = true,
                AutoSize        = true,
                CellBorderStyle = TableLayoutPanelCellBorderStyle.Single,
                Padding         = new Padding(10, 0, 10, 0)
            };


            foreach (Checkin checkinItem in userCheckins)
            {
                m_Panel.Controls.Add(new Label {
                    Font = new Font(AppUtil.sr_FontFamily, AppConfigService.GetInstance().LabelFontSize, FontStyle.Bold), Text = checkinItem.Place.Name
                });
            }

            return(m_Panel);
        }
Beispiel #27
0
        private void CheckUpdateDoWork(object sender, DoWorkEventArgs e)
        {
            var needUpdate = false;
            var needCheck  = false;

            switch (_configService.UpdateFrequency)
            {
            case 0:
                needCheck = true;
                break;

            case 1:
                if (_configService.LastUpdateRun.AddDays(1) < DateTime.Now)
                {
                    needCheck = true;
                }
                break;

            case 2:
                if (_configService.LastUpdateRun.AddDays(7) < DateTime.Now)
                {
                    needCheck = true;
                }
                break;
            }

            if (needCheck && System.Net.NetworkInformation.NetworkInterface.GetIsNetworkAvailable())
            {
                StatusLabel      = "Checking for updates ...";
                ShowStatusWindow = true;

                _processingService.GetUpdaterVersion();
                _processingService.GetAviSynthPluginsVer();

                var downloader = new WebClient {
                    UseDefaultCredentials = true
                };
                Stream onlineUpdateFile;
                try
                {
                    onlineUpdateFile = downloader.OpenRead(new Uri("http://www.jt-soft.de/videoconvert/updatefile_7z.xml"));
                }
                catch (WebException exception)
                {
                    Log.Error(exception);
                    e.Result = false;
                    return;
                }

                if (onlineUpdateFile == null)
                {
                    e.Result = false;
                    return;
                }

                using (var updateFile = Updater.LoadUpdateFileFromStream(onlineUpdateFile))
                {
                    if (updateFile.Core.PackageVersion.CompareTo(AppConfigService.GetAppVersion()) > 0)
                    {
                        needUpdate = true;
                    }

                    if (updateFile.Updater.PackageVersion.CompareTo(_configService.UpdaterVersion) > 0)
                    {
                        needUpdate = true;
                    }

                    if (string.CompareOrdinal(updateFile.AviSynthPlugins.PackageVersion, _configService.LastAviSynthPluginsVer) != 0)
                    {
                        needUpdate = true;
                    }

                    if (string.CompareOrdinal(updateFile.Profiles.PackageVersion, _configService.LastProfilesVer) != 0)
                    {
                        needUpdate = true;
                    }

                    if (string.CompareOrdinal(updateFile.X264.PackageVersion, _configService.Lastx264Ver) != 0)
                    {
                        needUpdate = true;
                    }

                    if (string.CompareOrdinal(updateFile.X26464.PackageVersion, _configService.Lastx26464Ver) != 0 &&
                        Environment.Is64BitOperatingSystem)
                    {
                        needUpdate = true;
                    }

                    if (string.CompareOrdinal(updateFile.FFMPEG.PackageVersion, _configService.LastffmpegVer) != 0)
                    {
                        needUpdate = true;
                    }

                    if (string.CompareOrdinal(updateFile.FFMPEG64.PackageVersion, _configService.Lastffmpeg64Ver) != 0 &&
                        Environment.Is64BitOperatingSystem)
                    {
                        needUpdate = true;
                    }

                    if (string.CompareOrdinal(updateFile.Eac3To.PackageVersion, _configService.Lasteac3ToVer) != 0)
                    {
                        needUpdate = true;
                    }

                    if (string.CompareOrdinal(updateFile.LsDvd.PackageVersion, _configService.LastlsdvdVer) != 0)
                    {
                        needUpdate = true;
                    }

                    if (string.CompareOrdinal(updateFile.MKVToolnix.PackageVersion, _configService.LastMKVMergeVer) != 0)
                    {
                        needUpdate = true;
                    }

                    if (string.CompareOrdinal(updateFile.Mplayer.PackageVersion, _configService.LastMplayerVer) != 0)
                    {
                        needUpdate = true;
                    }

                    if (string.CompareOrdinal(updateFile.TSMuxeR.PackageVersion, _configService.LastTSMuxerVer) != 0)
                    {
                        needUpdate = true;
                    }

                    if (string.CompareOrdinal(updateFile.MjpegTools.PackageVersion, _configService.LastMJPEGToolsVer) != 0)
                    {
                        needUpdate = true;
                    }

                    if (string.CompareOrdinal(updateFile.DVDAuthor.PackageVersion, _configService.LastDVDAuthorVer) != 0)
                    {
                        needUpdate = true;
                    }

                    if (string.CompareOrdinal(updateFile.MP4Box.PackageVersion, _configService.LastMp4BoxVer) != 0)
                    {
                        needUpdate = true;
                    }

                    if (string.CompareOrdinal(updateFile.HcEnc.PackageVersion, _configService.LastHcEncVer) != 0)
                    {
                        needUpdate = true;
                    }

                    if (string.CompareOrdinal(updateFile.OggEnc.PackageVersion, _configService.LastOggEncVer) != 0)
                    {
                        needUpdate = true;
                    }

                    if (string.CompareOrdinal(updateFile.OggEncLancer.PackageVersion, _configService.LastOggEncLancerVer) != 0 &&
                        _configService.UseOptimizedEncoders)
                    {
                        needUpdate = true;
                    }

                    if (string.CompareOrdinal(updateFile.Lame.PackageVersion, _configService.LastLameVer) != 0)
                    {
                        needUpdate = true;
                    }

                    if (string.CompareOrdinal(updateFile.VpxEnc.PackageVersion, _configService.LastVpxEncVer) != 0)
                    {
                        needUpdate = true;
                    }

                    if (string.CompareOrdinal(updateFile.BDSup2Sub.PackageVersion, _configService.LastBDSup2SubVer) != 0 &&
                        _configService.JavaInstalled)
                    {
                        needUpdate = true;
                    }
                }

                Thread.Sleep(2000);

                StatusLabel      = "Ready";
                ShowStatusWindow = false;

                _configService.LastUpdateRun = DateTime.Now;
            }

            e.Result = needUpdate;
        }
 public AWSAppConfigsettings(AppConfigService appConfigService)
 {
     _appConfigService = appConfigService;
 }
 public AuthConfigController(AppConfigService appConfig)
 {
     AppConfig = appConfig;
 }
Beispiel #30
0
        private void stayLoggedIn(bool i_Checked)
        {
            AppConfigService appConfig = AppConfigService.GetInstance();

            appConfig.StayLogedIn = i_Checked;
        }