コード例 #1
0
ファイル: Form1.cs プロジェクト: zolcsieles/NoodleManager
        public Form1()
        {
            try
            {
                Octokit.GitHubClient github = new Octokit.GitHubClient(new Octokit.ProductHeaderValue("NoodleManager"));
                Octokit.Release      latest = github.Repository.Release.GetLatest("tommaier123", "NoodleManager").Result;

                if (GlobalVariables.TagName != latest.TagName)
                {
                    ErrorDialog  errorDialog = new ErrorDialog("New Update to " + latest.TagName + " available:" + Environment.NewLine + Environment.NewLine + latest.Body + Environment.NewLine + Environment.NewLine + "Do you want to Download it?");
                    DialogResult result      = errorDialog.ShowDialog();

                    if (result == DialogResult.OK)
                    {
#if DEBUG
#else
                        UpdateFiles();
#endif
                    }
                }
            }
            catch (Exception e)
            {
                using (StreamWriter sw = new StreamWriter(Path.Combine(Path.GetDirectoryName(System.Reflection.Assembly.GetEntryAssembly().Location), "Log.txt"), true))
                {
                    sw.WriteLine(e.ToString());
                }
            }

#if DEBUG
#else
            RegisterUriScheme();
#endif


            InitializeComponent();

            this.labelNM1.Text = GlobalVariables.TagName;

            Label te = new Label();
            te.Text      = "Mods Coming Soon";
            te.Size      = new Size(600, 300);
            te.Font      = new System.Drawing.Font("Microsoft Sans Serif", 30F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            te.ForeColor = System.Drawing.Color.White;
            modMenu.Controls.Add(te);

            this.pictureBoxNM1.SendToBack();

            this.FormBorderStyle = FormBorderStyle.None;
            this.DoubleBuffered  = true;
            this.SetStyle(ControlStyles.ResizeRedraw, true);

            this.searchMode.DataSource  = new string[] { "All", "Title", "Mapper", "Artist" };
            this.displayMode.DataSource = new string[] { "All", "Available", "Installed" };

            this.FormClosing += FormclosingCallback;

            this.searchText.KeyDown += new KeyEventHandler(this.SearchKeyDownCallback);

            if (!Directory.Exists(Path.Combine(Properties.Settings.Default.path, @"CustomSongs\")))
            {
                string reg = Encoding.Default.GetString((byte[])Registry.GetValue(@"HKEY_CURRENT_USER\SOFTWARE\Kluge Interactive\SynthRiders", "com.synthriders.installpath_h4259148619", ""));
                Properties.Settings.Default.path = string.Concat(reg.Split(Path.GetInvalidPathChars()));
                Properties.Settings.Default.Save();
            }

            if (!Directory.Exists(Path.Combine(Properties.Settings.Default.path, @"CustomSongs\")))
            {
                ShowSettings();
            }
            else
            {
                watcher = new FileSystemWatcher();
                string applicationLocation = System.Reflection.Assembly.GetEntryAssembly().Location;
                watcher.Path                = "./";
                watcher.NotifyFilter        = NotifyFilters.LastWrite;
                watcher.Filter              = "ToDownload.txt";
                watcher.Changed            += OnFileChanged;
                watcher.EnableRaisingEvents = true;

                this.songMenu.Focus();
                if (ReadDownloadFile() == false)
                {
                    DownloadString(baseurl + beatmapsurl + "&&sort=published_at,DESC");
                }
            }
        }
コード例 #2
0
        public Form1()
        {
            try
            {
                Octokit.GitHubClient github = new Octokit.GitHubClient(new Octokit.ProductHeaderValue("NoodleManager"));
                Octokit.Release      latest = github.Repository.Release.GetLatest("tommaier123", "NoodleManager").Result;

                if (Int32.Parse(GlobalVariables.TagName.Substring(1).Replace(".", "")) < Int32.Parse(latest.TagName.Substring(1).Replace(".", "")))
                {
                    ErrorDialog  errorDialog = new ErrorDialog("New Update to " + latest.TagName + " available:" + Environment.NewLine + Environment.NewLine + latest.Body + Environment.NewLine + Environment.NewLine + "Do you want to Download it?");
                    DialogResult result      = errorDialog.ShowDialog();

                    if (result == DialogResult.OK)
                    {
#if DEBUG
#else
                        UpdateFiles();
#endif
                    }
                }
            }
            catch (Exception e)
            {
                using (StreamWriter sw = new StreamWriter(Path.Combine(Path.GetDirectoryName(System.Reflection.Assembly.GetEntryAssembly().Location), "Log.txt"), true))
                {
                    sw.WriteLine(e.ToString());
                }
            }

#if DEBUG
#else
            RegisterUriScheme();
#endif


            InitializeComponent();

            this.labelNM1.Text = GlobalVariables.TagName;

            Label te = new Label();
            te.Text      = "Mods Coming Soon";
            te.Size      = new Size(600, 300);
            te.Font      = new System.Drawing.Font("Microsoft Sans Serif", 30F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            te.ForeColor = System.Drawing.Color.White;
            modMenu.Controls.Add(te);

            this.pictureBoxNM1.SendToBack();

            this.FormBorderStyle = FormBorderStyle.None;
            this.DoubleBuffered  = true;
            this.SetStyle(ControlStyles.ResizeRedraw, true);

            this.searchMode.DataSource  = new string[] { "All", "Title", "Mapper", "Artist" };
            this.displayMode.DataSource = new string[] { "All", "Available", "Installed" };

            this.FormClosing += FormclosingCallback;

            this.searchText.KeyDown += new KeyEventHandler(this.SearchKeyDownCallback);

            if (!settingsMenu.Check())
            {
                ShowSettings();
            }
            else
            {
                if (File.Exists("ToDownload.txt"))
                {
                    watcher = new FileSystemWatcher();
                    string applicationLocation = System.Reflection.Assembly.GetEntryAssembly().Location;
                    watcher.Path                = "./";
                    watcher.NotifyFilter        = NotifyFilters.LastWrite;
                    watcher.Filter              = "ToDownload.txt";
                    watcher.Changed            += OnFileChanged;
                    watcher.EnableRaisingEvents = true;
                }

                this.songMenu.Focus();
                if (ReadDownloadFile() == false)
                {
                    Search();
                }
            }
        }