private void wc_DownloadFinished(object sender, EventArgs e)
        {
            this.Dispatcher.Invoke(() =>
            {
                Download_text.Text = "Installing";
            });

            Corelib.Write("finished downloading Pakages REPO");

            ZipFile.ExtractToDirectory(destinationFile, destinationFolder);
            Corelib.Write("Extract Complete of Pakages REPO");
            foreach (string s in Directory.GetFiles(destinationFolder, "*.json"))
            {
                try
                {
                    File.Move(s, Corelib.PakagesFolder + Path.GetFileName(s));
                }
                catch (IOException ex)
                {
                    Corelib.Write(ex.ToString());
                }
            }
            Corelib.ClearDownloadsFolder();
            Corelib.Write("pakages are added, finished");
            this.Dispatcher.Invoke(() =>
            {
                Download_text.Text = "Done!";
            });
        }
Esempio n. 2
0
        private void ExportBtn_Click(object sender, EventArgs e)
        {
            Pakage p = new Pakage();

            p.Name = textBoxName.Text;

            p.Description = textBoxDescription.Text;
            p.Description = p.Description.Replace("{n}", Environment.NewLine);

            p.DownloadURL = textBoxURL.Text;

            p.exe = textBoxExe.Text;

            p.JName = textBoxJName.Text;

            p.args = textBoxArgs.Text;

            p.Password = textBoxPassword.Text;

            p.User = textBoxUser.Text;

            Program.Pakages.Add(p);
            Corelib lib = new Corelib();

            lib.ExportList(Program.Pakages);
            Program.Import();
            Close();
        }
Esempio n. 3
0
        private async void DownloadButtonClick(object sender, RoutedEventArgs s)
        {
            if (!Corelib.Current.IsInstalled)
            {
                Download_button.IsEnabled = false;
                Corelib.Downloading       = Corelib.Current;
                Corelib.Write(Corelib.Downloading.ToString() + " start downloading");
                if (!Config.StorePass && Corelib.Current.User != "")
                {
                    if (Corelib.Current.User != null)
                    {
                        Credentials c = new Credentials();
                        c.ShowDialog();
                    }
                }
                foreach (Button B in ButtonPanel.Children)
                {
                    if (B.Name == Corelib.Downloading.JName)
                    {
                        DownloadingBtn = B;
                    }
                }

                await Download();
            }
        }
        private async void Download_Button_Click(object sender, RoutedEventArgs e)
        {
            string User = User_textbox.Text;
            string Pass = Password_textbox.Text;
            string URL  = Link_Textbox.Text;

            WebClient WClient = new WebClient();

            WClient.Credentials              = new NetworkCredential(User, Pass);
            WClient.DownloadFileCompleted   += wc_DownloadFinished;
            WClient.DownloadProgressChanged += WClient_DownloadProgressChanged;
            try
            {
                await Task.Run(() => WClient.DownloadFileAsync(new System.Uri(URL), destinationFile));
            }
            catch (WebException ex)
            {
                Corelib.Write(ex.ToString());
                Notify.Show(new NotificationContent
                {
                    Title = "Download failed",
                    Type  = NotificationType.Error
                });
            }
        }
Esempio n. 5
0
 private void ImportButtonClicked(object sender, RoutedEventArgs s)
 {
     Corelib.Write("Import button clicked");
     Corelib.Import();
     AddButtons();
     Corelib.Write("Import button clicked - finished");
 }
Esempio n. 6
0
        private void window_FormClosing(Object sender, FormClosingEventArgs e)
        {
            Program.Export();
            Corelib lib = new Corelib();

            lib.Write("CLOSING");
        }
Esempio n. 7
0
        private void wc_DownloadFinished(object sender, EventArgs e)
        {
            Corelib.Write(Corelib.Downloading.ToString() + "finished downloading");

            this.Dispatcher.Invoke(() =>
            {
                DownloadingBtn.Content = Corelib.Downloading.Name;
                TaskBarItemInfoMainWindow.ProgressState = TaskbarItemProgressState.Paused;
                Download_button.Content = "Download app";
            });

            Corelib.Downloading.Install(Corelib.DownloadsFolder + Corelib.Downloading.JName + ".zip");

            this.Dispatcher.Invoke(() =>
            {
                TaskBarItemInfoMainWindow.ProgressState = TaskbarItemProgressState.None;
                Notify.Show(new NotificationContent
                {
                    Title = "Download Finished",
                    Type  = NotificationType.Success
                });
                Download_button.IsEnabled = true;
                UpdateImage();
            });
        }
Esempio n. 8
0
        private async Task Download()
        {
            WebClient WClient = new WebClient();

            WClient.Credentials                     = new NetworkCredential(Corelib.Downloading.User, Corelib.Downloading.Password);
            WClient.DownloadProgressChanged        += wc_DownloadProgressChanged;
            WClient.DownloadFileCompleted          += wc_DownloadFinished;
            TaskBarItemInfoMainWindow.ProgressState = TaskbarItemProgressState.Normal;
            try
            {
                await Task.Run(() => WClient.DownloadFileAsync
                               (
                                   new System.Uri(Corelib.Downloading.DownloadURL),
                                   Corelib.DownloadsFolder + Corelib.Downloading.JName + ".zip"
                               ));

                Notify.Show(new NotificationContent
                {
                    Title = "Download Started",
                    Type  = NotificationType.Information
                });
            }
            catch (WebException ex)
            {
                Corelib.Write(ex.ToString());
                Notify.Show(new NotificationContent
                {
                    Title = "Download failed",
                    Type  = NotificationType.Error
                });
            }
        }
Esempio n. 9
0
 private void CreatePakage_Closing(object sender, System.ComponentModel.CancelEventArgs e)
 {
     if (!Editing)
     {
         Pakage p = new Pakage()
         {
             Name        = NameBox.Text,
             DownloadURL = URLBox.Text,
             Description = DescriptionBox.Text.Replace("{n}", Environment.NewLine),
             JName       = JNameBox.Text,
             exe         = EXEBox.Text,
             args        = ArgsBox.Text,
             User        = UserBox.Text,
             Password    = PassBox.Password
         };
         Corelib.Pakages.Add(p);
     }
     else
     {
         Corelib.Current.Name        = NameBox.Text;
         Corelib.Current.DownloadURL = URLBox.Text;
         Corelib.Current.Description = DescriptionBox.Text.Replace("{n}", Environment.NewLine);
         Corelib.Current.JName       = JNameBox.Text;
         Corelib.Current.exe         = EXEBox.Text;
         Corelib.Current.args        = ArgsBox.Text;
         Corelib.Current.User        = UserBox.Text;
         Corelib.Current.User        = UserBox.Text;
         Corelib.Current.Password    = PassBox.Password;
     }
     Corelib.ExportList();
 }
Esempio n. 10
0
        public void UpdateImage()
        {
            //Stream AppICON = Application.GetResourceStream(new Uri("/Mstore.ico")).Stream;
            ImageSource ICON = this.Icon;

            //System.Drawing.Icon Ico = new System.Drawing.Icon(AppICON);
            if (Corelib.Current.IsInstalled)
            {
                try
                {
                    var    Ico = System.Drawing.Icon.ExtractAssociatedIcon(Corelib.AppsFolder + Corelib.Current.JName + "/" + Corelib.Current.exe);
                    IntPtr i   = Ico.ToBitmap().GetHbitmap();
                    ICON = Imaging.CreateBitmapSourceFromHBitmap(
                        i,
                        IntPtr.Zero,
                        Int32Rect.Empty,
                        System.Windows.Media.Imaging.BitmapSizeOptions.FromEmptyOptions()
                        );
                    DeleteObject(i);
                }
                catch (Exception e)
                {
                    Corelib.Write(e.ToString());
                }
            }
            EXE_Icon.Source = ICON;
        }
Esempio n. 11
0
        private void DeleteGameBtn_Click(object sender, EventArgs e)
        {
            Corelib lib = new Corelib();

            if (Program.current.IsInstalled)
            {
                Directory.Delete(lib.path + "Apps/" + Program.current.JName + "/", true);
                Program.current.IsInstalled = false;
                Program.UpdateIsInstalled();
            }
        }
Esempio n. 12
0
        private void wc_DownloadFinished(object sender, EventArgs e)
        {
            Corelib lib = new Corelib();

            lib.Write("Download done" + Program.Downloading.Name);
            Invoke(new Action(setIsInstalled));
            Program.Downloading.Install();
            Invoke(new Action(SetIsInstalled));
            lib.ExportList(Program.Pakages);
            InUse = false;
        }
Esempio n. 13
0
        private void ChangePathBtn_Click(object sender, EventArgs e)
        {
            using (var NewPath = new FolderBrowserDialog())
            {
                DialogResult result = NewPath.ShowDialog();

                if (result == DialogResult.OK && !string.IsNullOrWhiteSpace(NewPath.SelectedPath))
                {
                    Var.MstorePath     = Path.GetFullPath(NewPath.SelectedPath + "/");
                    ShowPathLabel.Text = Var.MstorePath;
                    Corelib lib = new Corelib();
                    MessageBox.Show("found: " + lib.path, "Message");
                    Program.Export();
                }
            }
        }
Esempio n. 14
0
 private void MainWindow_Loaded(object sender, RoutedEventArgs e)
 {
     //setup mstore
     Corelib.Setup();
     Corelib.Write("folder setup");
     Corelib.Import();
     Corelib.Write("inital import");
     AddButtons();
     Corelib.ClearDownloadsFolder();
     Corelib.Write("downloads cleared");
     if (Corelib.Current == null && Corelib.Pakages.Count > 0)
     {
         Corelib.Current = Corelib.Pakages[0];
         UpdateUI();
     }
 }
Esempio n. 15
0
 private void OpenRepoButtonClick(object sender, RoutedEventArgs s)
 {
     try
     {
         Process.Start
         (
             Environment.GetEnvironmentVariable("WINDIR") + @"\explorer.exe",
             Path.GetFullPath(Corelib.PakagesFolder)
         );
     }
     catch (System.ComponentModel.Win32Exception q)
     {
         Corelib.Write("     " + Corelib.PakagesFolder + "     ");
         Corelib.Write(q.Message);
     }
 }
Esempio n. 16
0
        private void OpenFolderBtn_Click(object sender, EventArgs e)
        {
            Corelib lib = new Corelib();

            try
            {
                Process.Start
                (
                    Environment.GetEnvironmentVariable("WINDIR") + @"\explorer.exe",
                    Path.GetFullPath(lib.path + "pakages/")
                );
            }
            catch (System.ComponentModel.Win32Exception q)
            {
                lib.Write("     " + lib.path + "     ");
                lib.Write(q.Message);
            }
        }
Esempio n. 17
0
 public async Task Download(Pakage p)
 {
     if (!p.IsInstalled)
     {
         InUse = true;
         Corelib Lib = new Corelib();
         Program.Downloading = p;
         using (WebClient wc = new WebClient())
         {
             wc.Credentials              = new NetworkCredential(Program.Downloading.User, Program.Downloading.Password);
             wc.DownloadProgressChanged += wc_DownloadProgressChanged;
             wc.DownloadFileCompleted   += wc_DownloadFinished;
             await Task.Run(() => wc.DownloadFileAsync
                            (
                                new System.Uri(Program.Downloading.DownloadURL),
                                Lib.path + Program.Downloading.JName + ".zip"
                            ));
         }
     }
 }
Esempio n. 18
0
        private void Click(object sender, RoutedEventArgs s)
        {
            String name;

            if (sender is Button)
            {
                name = (sender as Button).Name;
                foreach (Pakage p in Corelib.Pakages)
                {
                    if (name == p.JName)
                    {
                        Corelib.Current = p;
                    }
                }
                UpdateUI();
            }
            else
            {
                Corelib.Write("ERROR: click event not from button");
            }
        }
Esempio n. 19
0
        private void ButtonPanel_Drop(object sender, DragEventArgs e)
        {
            string[] files = (string[])e.Data.GetData(DataFormats.FileDrop);
            foreach (string f in files)
            {
                switch (Path.GetExtension(f))
                {
                case ".json":
                    Corelib.ImportF(f);
                    AddButtons();
                    break;

                case ".zip":
                    string folder = Corelib.DownloadsFolder + Path.GetFileName(f);
                    ZipFile.ExtractToDirectory(f, folder);
                    foreach (string s in Directory.GetFiles(folder, "*.json"))
                    {
                        try
                        {
                            Corelib.ImportF(s);
                            AddButtons();
                        }
                        catch (IOException ex)
                        {
                            Corelib.Write(ex.ToString());
                        }
                    }
                    Corelib.ClearDownloadsFolder();
                    break;
                }
            }
            Corelib.ExportList();
            Notify.Show(new NotificationContent
            {
                Title = "Import Finished",
                Type  = NotificationType.Success
            });
        }
Esempio n. 20
0
 private void Repo_window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
 {
     Corelib.Import();
     AddButtons();
 }
Esempio n. 21
0
 private void Export_Button_Click(object sender, RoutedEventArgs e)
 {
     Corelib.ExportList();
 }
Esempio n. 22
0
 private void MainWindow_Closing(object sender, System.ComponentModel.CancelEventArgs e)
 {
     Corelib.ExportList();
 }