예제 #1
0
파일: AboutPage.cs 프로젝트: xnumad/Tanji
        private void GrabbedReleases(Task <IReadOnlyList <Release> > getReleasesTask)
        {
            IReadOnlyList <Release> releases = getReleasesTask.Result;

            Latest = releases.FirstOrDefault();

            foreach (Release release in releases)
            {
                string version = release.TagName.Substring(1);
                if (version == LocalVersion.ToString())
                {
                    Current = release;
                    break;
                }
            }
            if (Current == null)
            {
                Current = Latest;
            }
            if (!Latest.Prerelease && new Version(Latest.TagName.Substring(1)) > LocalVersion)
            {
                if ((bool)Program.Settings["PromptUpdateNotification"])
                {
                    if (MessageBox.Show($"An update has been found, would you like to be taken to the download page? ({Latest.TagName})",
                                        "Tanji - Alert!", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes)
                    {
                        Process.Start(Latest.HtmlUrl);
                    }
                }
            }
        }
예제 #2
0
        public void ToXml(string path)
        {
            XmlTextWriter xtw = new XmlTextWriter(path, UnicodeEncoding.UTF8);

            xtw.Formatting = Formatting.Indented;
            xtw.WriteStartDocument();
            xtw.WriteStartElement("ToDoDb");
            xtw.WriteAttributeString("Version", LocalVersion.ToString());

            xtw.WriteStartElement("Categories");
            foreach (Category c in Categories)
            {
                xtw.WriteStartElement("Category");
                xtw.WriteAttributeString("Name", c.Name);
                xtw.WriteStartElement("Tasks");
                foreach (Task t in c.Tasks)
                {
                    xtw.WriteStartElement("Task");
                    xtw.WriteAttributeString("Text", t.Text);
                    xtw.WriteAttributeString("IsDone", t.IsDone.ToString());
                    xtw.WriteAttributeString("DoneAt", t.DoneAt.ToString());
                    xtw.WriteEndElement();
                }
                xtw.WriteEndElement();
                xtw.WriteEndElement();
            }
            xtw.WriteEndElement();
            xtw.WriteEndElement();
            xtw.WriteEndDocument();
            xtw.Flush();
            xtw.Close();
        }
예제 #3
0
        private void GrabbedReleases(Task <IReadOnlyList <Release> > getReleasesTask)
        {
            IReadOnlyList <Release> releases = getReleasesTask.Result;

            Latest = releases.FirstOrDefault();

            if (Latest == null)
            {
                return;
            }

            foreach (Release release in releases)
            {
                string version = release.TagName.Substring(1);
                if (version == LocalVersion.ToString(3))
                {
                    Current = release;
                    break;
                }
            }

            if (Current == null)
            {
                Current = Latest;
            }

            if (!Latest.Prerelease && new Version(Latest.TagName.Substring(1)) > LocalVersion)
            {
                if (Program.Settings.PromptSelfUpdate)
                {
                    MainFrm.DisableAutoLaunch();

                    if (MessageBox.Show($"A launcher update has been found, would you like to be taken to the download page? ({Latest.TagName})",
                                        "HabboLauncher ~ Alert", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes)
                    {
                        Process.Start(Latest.HtmlUrl);
                    }
                }
            }
        }
예제 #4
0
        public void SaveToLocal()
        {
            var storageCommon = GetStorage <StorageCommon>();

            if (storageCommon != null)
            {
                _localVersion          -= 1;
                storageCommon.UpdatedAt = DeviceHelper.CurrentTimeMillis();
            }
            //fixed:ArgumentNullException: Value cannot be null. Parameter name: obj
            JsonSerializerSettings setting = new JsonSerializerSettings();

            setting.NullValueHandling = NullValueHandling.Ignore;
            string jsonData = JsonConvert.SerializeObject(storageMap, setting);

            byte[] encryptData = RijndaelManager.Instance.EncryptStringToBytes(jsonData);
            PlayerPrefs.SetString(storageKey, System.Convert.ToBase64String(encryptData));
            PlayerPrefs.SetString(localVersionKey, System.Convert.ToBase64String(RijndaelManager.Instance.EncryptStringToBytes(LocalVersion.ToString())));
            PlayerPrefs.SetString(remoteVersionAckKey, System.Convert.ToBase64String(RijndaelManager.Instance.EncryptStringToBytes(RemoteVersionACK.ToString())));
            PlayerPrefs.SetString(remoteVersionLocalKey, System.Convert.ToBase64String(RijndaelManager.Instance.EncryptStringToBytes(RemoteVersionSYN.ToString())));

            //DebugUtil.Log(" save local version : " + LocalVersion);
            //DebugUtil.Log(" save remote version ack: " + RemoteVersionACK);
            //DebugUtil.Log(" save remote version local: " + RemoteVersionSYN);
            //DebugUtil.Log(" save local storage json : " + jsonData);
            lastSavedLocalVersion = LocalVersion;
        }