Example #1
0
        protected override void ResetParser(ResetReason reason)
        {
            keepAliveCount = 0;

            SipReader.Invalidate();

            if (mode == Modes.Ajax)
            {
                if (reason == ResetReason.ResetStateCalled)
                {
                    mode = Modes.Http;
                }
            }
        }
Example #2
0
 public override int GetHashCode()
 {
     unchecked
     {
         int hash = 13;
         hash = hash * 7 + (Name == null ? 0 : Name.GetHashCode());
         hash = hash * 7 + (ModelName == null ? 0 : ModelName.GetHashCode());
         hash = hash * 7 + (SerialCode == null ? 0 : SerialCode.GetHashCode());
         hash = hash * 7 + (BuildName == null ? 0 : BuildName.GetHashCode());
         hash = hash * 7 + BuildVersion.GetHashCode();
         hash = hash * 7 + HighestRevision.GetHashCode();
         hash = hash * 7 + ResetReason.GetHashCode();
         hash = hash * 7 + ResetException.GetHashCode();
         hash = hash * 7 + StopReason.GetHashCode();
         return(hash);
     }
 }
Example #3
0
        private void RequestReset(ResetReason resetReason)
        {
            switch (resetReason)
            {
            case ResetReason.SpotifyNotLaunched:
                Global.debugConsole?.WriteLine("Reset requested. Reason: Spotify is not launched.");
                this.spotifyRunning = false;
                this.spotifyHandle  = IntPtr.Zero;
                break;

            case ResetReason.SpotifyPaused:
                Global.debugConsole?.WriteLine("Reset requested. Reason: Spotify is paused.");
                this.spotifyRunning = false;
                this.spotifyHandle  = IntPtr.Zero;
                if (!Global.IsTextOverriden)
                {
                    this.CurrentPlayingTrack = null;
                }
                break;

            case ResetReason.NotNewSong:
                Global.debugConsole?.WriteLine("Reset requested. Reason: Current song playing is not new.");
                this.spotifyRunning = false;
                this.spotifyHandle  = IntPtr.Zero;
                break;

            case ResetReason.InvalidJson:
                Global.debugConsole?.WriteLine("Reset requested. Reason: Invalid Json.");
                this.spotifyRunning = false;
                this.spotifyHandle  = IntPtr.Zero;
                break;

            case ResetReason.ForceUpdateRequested:
                Global.debugConsole?.WriteLine("Reset requested. Reason: Force update requested by user.");
                this.spotifyRunning = false;
                this.spotifyHandle  = IntPtr.Zero;
                //this.refreshToken = String.Empty;
                //this.authorizationToken = String.Empty;
                ResetUpdateSpotifyTrackInformationTimer();
                //ResetUpdateAuthTokenTimer();
                break;

            default:
                break;
            }
        }
 protected abstract void ResetParser(ResetReason reason);
Example #5
0
 protected abstract void ResetParser(ResetReason reason);
Example #6
0
		protected override void ResetParser(ResetReason reason)
		{
			keepAliveCount = 0;

			SipReader.Invalidate();

			if (mode == Modes.Ajax)
			{
				if (reason == ResetReason.ResetStateCalled)
					mode = Modes.Http;
			}
		}
Example #7
0
		protected override void ResetParser(ResetReason reason)
		{
			InitializeHttpReader(true);
		}
Example #8
0
 protected override void ResetParser(ResetReason reason)
 {
     InitializeHttpReader(true);
 }
Example #9
0
        static public void ResetSettings(ResetReason r)
        {
            try
            {
                Directory.CreateDirectory(appDataFolder);
                //string path = @"settings.xml";
                //if (File.Exists(path))
                //{
                //    File.Delete(path);
                //}

                xDoc = new XDocument(
                    new XDeclaration("1.0", "utf-16", "true"),
                    new XElement("Settings",
                                 new XComment("----------ТОВА СА НАСТРОЙКИТЕ НА ПРОГРАМАТА ЗА КАЛКУЛИРАНЕ НА ЦЕНИ----------"),
                                 new XComment("Values must be decimals since decimal.TryParse is used!The rooms count can vary"),
                                 new XElement("Room", "DBLSV", new XAttribute("guests", 2), new XAttribute("low", 119), new XAttribute("high", "149"), new XAttribute("out", "79")),
                                 new XElement("Room", "DBL", new XAttribute("guests", 2), new XAttribute("low", 99), new XAttribute("high", "119"), new XAttribute("out", "59")),
                                 new XElement("Room", "DBLsSV", new XAttribute("guests", 2), new XAttribute("low", 109), new XAttribute("high", "139"), new XAttribute("out", "69")),
                                 new XElement("Room", "---------", new XAttribute("guests", 0), new XAttribute("low", 0), new XAttribute("high", "0"), new XAttribute("out", "0")),
                                 new XElement("Room", "SNGLSV", new XAttribute("guests", 1), new XAttribute("low", 99), new XAttribute("high", "119"), new XAttribute("out", "69")),
                                 new XElement("Room", "SNGL", new XAttribute("guests", 1), new XAttribute("low", 79), new XAttribute("high", "99"), new XAttribute("out", "49")),
                                 new XElement("Room", "SNGLsSV", new XAttribute("guests", 1), new XAttribute("low", 89), new XAttribute("high", "109"), new XAttribute("out", "59")),
                                 new XElement("Room", "--------", new XAttribute("guests", 0), new XAttribute("low", 0), new XAttribute("high", "0"), new XAttribute("out", "0")),
                                 new XElement("Room", "TRPL", new XAttribute("guests", 3), new XAttribute("low", 149), new XAttribute("high", "189"), new XAttribute("out", "99")),
                                 new XElement("Room", "-------", new XAttribute("guests", 0), new XAttribute("low", 0), new XAttribute("high", "0"), new XAttribute("out", "0")),
                                 new XElement("Room", "AP3", new XAttribute("guests", 4), new XAttribute("low", 199), new XAttribute("high", "249"), new XAttribute("out", "159")),
                                 new XElement("Room", "AP4", new XAttribute("guests", 4), new XAttribute("low", 199), new XAttribute("high", "249"), new XAttribute("out", "159")),
                                 new XElement("Room", "PresAP", new XAttribute("guests", 4), new XAttribute("low", 249), new XAttribute("high", "299"), new XAttribute("out", "239")),
                                 new XComment("Values must be integers since int.Parse is used!Exactly 4 dates must be defined!"),
                                 new XElement("Date", "Силен летен", new XAttribute("day", 1), new XAttribute("month", 7)),
                                 new XElement("Date", "Зимен сезон", new XAttribute("day", 1), new XAttribute("month", 10)),
                                 new XElement("Date", "Слаб летен - есен", new XAttribute("day", 16), new XAttribute("month", 9)),
                                 new XElement("Date", "Слаб летен - пролет", new XAttribute("day", 25), new XAttribute("month", 5)),
                                 new XElement("Setting", (int)Names.deposit, new XAttribute("option", 30)),
                                 new XElement("Setting", (int)Names.selectColor, new XAttribute("option", 3)),
                                 new XElement("Setting", (int)Names.addBedBigPercent, new XAttribute("option", 35)),
                                 new XElement("Setting", (int)Names.addBedSmallPercent, new XAttribute("option", 30))));
                xDoc.Save(Settings.settingsFile);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.ToString());
            }
            switch (r)
            {
            case ResetReason.newFile:
                MessageBox.Show("Нов файл с настройки беше създаден.");
                break;

            case ResetReason.syntaxError:
                MessageBox.Show("Файлът с настройки беше рестартиран поради грешка в текста.");
                break;

            case ResetReason.pricesError:
                MessageBox.Show("Файлът с настройки беше рестартиран, защото една или повече от ценните не бяха зададена коректно.\nЦените бяха променени на тези за 2018г.");
                break;

            case ResetReason.datesError:
                MessageBox.Show("Файлът с настройки беше рестартиран, защото една или повече от началните дати на сезоните не бяха зададени коректно.");
                break;

            default:
                MessageBox.Show("Файлът с настройките беше рестартиран.\nВсички дати, типове стаи и цени бяха рестартирани!\nЦените бяха променени на тези за 2018");
                break;
            }
        }