Esempio n. 1
0
        public formNotification(string Title, string Text, int Timeout, bool JovoUpdate, UtilityHandler _utility)
        {
            InitializeComponent();

            utility = _utility;
            update  = JovoUpdate;

            if (Timeout != 0)
            {
                timeoutTimer          = new Timer();
                timeoutTimer.Interval = Timeout;
                timeoutTimer.Tick    += timeoutTick;
                timeoutTimer.Start();
            }

            foreach (string line in Text.Split('\n'))
            {
                lblText.Size = new Size(lblText.Width, lblText.Height + 12);
                this.Size    = new Size(this.Width, this.Height + 12);
            }
            lblTitle.Text = Title;
            Text          = Text.Replace("\n", Environment.NewLine);
            lblText.Text  = Text;

            pbImage.Image = (update) ? Properties.Resources.Jovo_Logo1 : Properties.Resources.jovo_loading;

            this.Location    = new Point(Screen.PrimaryScreen.WorkingArea.Width - (this.Size.Width + 5), Screen.PrimaryScreen.WorkingArea.Height - (this.Size.Height + 5));
            pbImage.Location = new Point(13, (this.Size.Height - pbImage.Height) / 2);

            this.Click     += doWork_Click;
            lblTitle.Click += doWork_Click;
            lblText.Click  += doWork_Click;
            pbImage.Click  += doWork_Click;
        }
Esempio n. 2
0
        public formSettings(ModuleHandler _module, UtilityHandler _utility)
        {
            module  = _module;
            utility = _utility;
            InitializeComponent();

            this.Location = new Point(Screen.PrimaryScreen.WorkingArea.Width - (this.Size.Width + 5), Screen.PrimaryScreen.WorkingArea.Height - (this.Size.Height + 5));
        }
Esempio n. 3
0
        private void CopyAll(DirectoryInfo source, DirectoryInfo target, UtilityHandler utility)
        {
            foreach (FileInfo fi in source.GetFiles())
            {
                fi.CopyTo(Path.Combine(target.FullName, fi.Name), true);
            }

            foreach (DirectoryInfo diSourceSubDir in source.GetDirectories().Where(x => (x.Name != "Previous Versions") && x.Name != "Ready To Deploy").ToList())
            {
                DirectoryInfo nextTargetSubDir = target.CreateSubdirectory(diSourceSubDir.Name);
                CopyAll(diSourceSubDir, nextTargetSubDir, utility);
            }
        }
Esempio n. 4
0
        public formModules(ModuleHandler _module, UtilityHandler _utility)
        {
            module  = _module;
            utility = _utility;


            InitializeComponent();

            currentFilter = ButtonFilter.All;
            changelogOpen = false;

            GenerateButtons(currentFilter);
            GenerateHeaders();

            this.Location = new Point(Screen.PrimaryScreen.WorkingArea.Width - (this.Size.Width + 5), Screen.PrimaryScreen.WorkingArea.Height - (this.Size.Height + 5));
        }
Esempio n. 5
0
        public formMain(ModuleHandler _module, UtilityHandler _utility, KeyboardHook _hook)
        {
            utility = _utility;
            module  = _module;
            hook    = _hook;

            utility.IsDevUser = (Path.GetFileName(Path.GetDirectoryName(System.Reflection.Assembly.GetEntryAssembly().Location)) == "Debug") ? true : false;

            SystemEvents.SessionSwitch += new SessionSwitchEventHandler(SystemEvents_SessionSwitch);
            AppDomain.CurrentDomain.FirstChanceException += new EventHandler <FirstChanceExceptionEventArgs>(FirstChance_Handler);
            hook.KeyPressed += new EventHandler <KeyPressedEventArgs>(hook_KeyPressed);

            InitializeComponent();
            startupTimer.Start();
            utility.LogEvent("Program probably started OK");

            // Create NotifyIcon to sit in system tray
            icon.Text             = "Jovo" + ((utility.IsDevUser) ? " Development Enviroment" : "");
            icon.Icon             = (utility.IsDevUser) ? Properties.Resources.Jovo_Logo_TestEnv : Properties.Resources.Jovo_Logo;
            icon.Visible          = true;
            icon.ContextMenuStrip = menu;
            icon.MouseDown       += icon_Click;

            UpdateWorker.WorkerReportsProgress = true;
            UpdateWorker.DoWork             += UpdateWorker_DoWork;
            UpdateWorker.RunWorkerCompleted += UpdateWorker_RunWorkerCompleted;
            UpdateWorker.ProgressChanged    += UpdateWorker_ProgressChanged;
            utility.LogEvent("Module Updater starting...");
            UpdateWorker.RunWorkerAsync(true);

            JovoUpdateWorker.DoWork             += JovoUpdateWorker_DoWork;
            JovoUpdateWorker.RunWorkerCompleted += JovoUpdateWorker_RunWorkerCompleted;
            utility.LogEvent("Jovo Updater Starting...");
            JovoUpdateWorker.RunWorkerAsync();

            ConnectionWorker.WorkerReportsProgress = true;
            ConnectionWorker.DoWork             += ConnectionWorker_DoWork;
            ConnectionWorker.RunWorkerCompleted += ConnectionWorker_RunWorkerCompleted;
        }
Esempio n. 6
0
        /// <summary>
        /// The main entry point for the application.
        /// </summary>

        static void Main(string[] args)
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            ModuleHandler  module  = new ModuleHandler();
            UtilityHandler utility = new UtilityHandler();
            KeyboardHook   hook    = new KeyboardHook();

            utility.ArchiveLog();

            utility.LogEvent("############################ Program starting... ############################", true, true);
            module.GetSetDirectoryStructure(System.Reflection.Assembly.GetEntryAssembly().Location);

            utility.LogEvent("Startup Args received : " + args.Length);

            //foreach (string arg in args)
            //{
            //    utility.LogEvent("Start Argument : " + arg);
            //}

            if (args.Length >= 2)
            {
                //Module_Update_Remote_Path
                string[] temp = args[1].Split('\\');
                temp[temp.Length - 1] = "modules";
                string module_path = String.Join("\\", temp);


                Jovo.Default.Jovo_Updater_Local_Path   = args[0].Trim('"');
                Jovo.Default.Jovo_Update_Remote_Path   = args[1].Trim('"');
                Jovo.Default.Module_Update_Remote_Path = module_path;
                Jovo.Default.Save();
            }

            Application.Run(new formMain(module, utility, hook));
        }
Esempio n. 7
0
        public void GetModuleUpdates(UtilityHandler utility, BackgroundWorker worker, bool OutputResult = true)
        {
            GetModules();
            GetServerModules();

            foreach (ModuleData AvailableModule in ServerModules)
            {
                DirectoryInfo localDir        = new DirectoryInfo(AppModulePath + "\\" + AvailableModule.Name);
                ModuleData    InstalledModule = InstalledModules.Find(m => m == AvailableModule);

                if (!Directory.Exists(AppModulePath + "\\" + AvailableModule.Name))
                {
                    if (OutputResult)
                    {
                        utility.LogEvent("Installing module " + AvailableModule.Name);
                    }

                    worker.ReportProgress(0, new NotificationData()
                    {
                        Title = "Installing Module...", Text = AvailableModule.Name, Timeout = 5000, Method = "Show"
                    });

                    Directory.CreateDirectory(AppModulePath + "\\" + AvailableModule.Name);
                    CopyAll(new DirectoryInfo(AvailableModule.Path), localDir, utility);

                    worker.ReportProgress(0, new NotificationData()
                    {
                        Method = "Hide"
                    });
                }
                else if (AvailableModule > InstalledModule)
                {
                    utility.LogEvent($"Updating {InstalledModule.Name} v{InstalledModule.Version} to {AvailableModule.Version}");
                    worker.ReportProgress(0, new NotificationData()
                    {
                        Title = "Updating Module...", Text = AvailableModule.Name, Timeout = 5000, Method = "Show"
                    });

                    CopyAll(new DirectoryInfo(AvailableModule.Path), localDir, utility);

                    ModuleData newModuleVersion = JsonConvert.DeserializeObject <ModuleData>(File.ReadAllText(AppModulePath + "\\" + InstalledModule.Name + "\\manifest.json"));
                    if (newModuleVersion.IsActive != InstalledModule.IsActive)
                    {
                        newModuleVersion.IsActive = InstalledModule.IsActive;

                        string json = JsonConvert.SerializeObject(newModuleVersion, Formatting.Indented);
                        File.WriteAllText(AppModulePath + "\\" + InstalledModule.Name + "\\manifest.json", json);
                    }

                    worker.ReportProgress(0, new NotificationData()
                    {
                        Method = "Hide"
                    });
                }
            }

            if (ServerModules.Count > 0)
            {
                foreach (ModuleData data in InstalledModules)
                {
                    if (!ServerModules.Contains(data))
                    {
                        Directory.Delete(data.Path, true);
                        utility.LogEvent("Module not found on server (" + data.Name + "), Deleteing local module...");
                    }
                }
            }

            GetModules(OutputResult);
        }