Exemple #1
0
 public void SaveSettings()
 {
     new XDocument(
         new XElement(Tag_Root,
                      new XElement(Tag_NamedPipeAddress, NamedPipeAddress),
                      new XElement(Tag_AutoConnect, AutoConnect.ToString()),
                      new XElement(Tag_TimePaddingForLoop, TimePaddingForLoop.ToString()),
                      new XElement(Tag_LoopSelection, LoopSelection.ToString()),
                      new XElement(Tag_LoopNumber, LoopNumber.ToString()),
                      new XElement(Tag_PlayMode, PlayMode.ToString()),
                      new XElement(Tag_Volume,
                                   new XElement(Tag_VolumeValue, VolumeValue.ToString()),
                                   new XElement(Tag_VolumeMute, VolumeMute.ToString())),
                      new XElement(Tag_Documents, DocumentByDocumentGuid.Select(x =>
                                                                                new XElement(Tag_Document, new XAttribute(Att_Document_Id, x.Key), new XElement(Tag_Document_Name, x.Value.Name), new XElement(Tag_Media, x.Value.Media)))),
                      new XElement(Tag_MinimalSeverityToShowInLog, MinimalSeverityToShowInLog.ToString()),
                      new XElement(Tag_Window,
                                   new XElement(Tag_Top, WindowTop.ToString()),
                                   new XElement(Tag_Left, WindowLeft.ToString()),
                                   new XElement(Tag_Width, WindowWidth.ToString()),
                                   new XElement(Tag_Height, WindowHeight.ToString()),
                                   new XElement(Tag_Maximized, WindowMaximized.ToString()),
                                   new XElement(Tag_AlwaysOnTop, AlwaysOnTop.ToString())),
                      new XElement(Tag_VlcLibPath, VlcLibPath),
                      new XElement(Tag_DoNotAskAgain, FontMissingWindowDoNotAskAgain.ToString()))
         ).Save(SettingsPath);
 }
Exemple #2
0
        public void WriteSettings()
        {
            try
            {
                IniFile ini = new IniFile(TargetFile);
                ini.IniWriteValue("config", "Volume", Volume.ToString());
                ini.IniWriteValue("config", "AyahLastOpen", AyahLastOpen.ToString());
                ini.IniWriteValue("config", "SurahLastOpen", SurahLastOpen.ToString());
                ini.IniWriteValue("config", "ReciterLastOpen", ReciterLastOpen.ToString());
                ini.IniWriteValue("config", "LanguageLastOpen", LanguageLastOpen.ToString());
                ini.IniWriteValue("config", "JuzLastOpen", JuzLastOpen.ToString());
                ini.IniWriteValue("config", "UrlRecitation", UrlRecitation);

                ini.IniWriteValue("config", "VerseSize", VerseSize.ToString());
                ini.IniWriteValue("config", "ClickMode", ClickMode.ToString());
                ini.IniWriteValue("config", "PlayMode", PlayMode.ToString());
                ini.IniWriteValue("config", "isVoiceEnable", isVoiceEnable.ToString());
                ini.IniWriteValue("config", "isGestureEnable", isGestureEnable.ToString());
                ini.IniWriteValue("config", "isAutoShutdownEnable", isAutoShutdownEnable.ToString());
                ini.IniWriteValue("config", "ShutdownTime", ShutdownTime.ToString());
            }
            catch
            {
                throw;
            }
        }
    private bool isCompleted;                   // If true the end of the Rail has been reached.

    private void FixedUpdate()
    {
        // If there is not rail exit.
        if (!rail)
        {
            return;
        }

        //Avoid using Catmull when less than 4 nodes exist.
        if (rail.nodes.Length < 4 && playMode.ToString().Equals("Catmull"))
        {
            Debug.LogWarning("Not enought nodes for Catmull (minimun of 4 nodes is required, switching to Linear)");
            playMode = PlayMode.Linear;
        }

        //Play the advance if it is not completed.
        if (!isCompleted)
        {
            Play(!isReversed);
        }
    }
Exemple #4
0
 // optional
 public void SetPlayMode(PlayMode newPlayMode)
 {
     UPnP.InvokeAction(_service, "SetPlayMode", InstanceId, newPlayMode.ToString());
 }
Exemple #5
0
 // optional
 public void SetPlayMode(PlayMode newPlayMode)
 {
     UPnP.InvokeAction(_service, "SetPlayMode", InstanceId, newPlayMode.ToString());
 }
 /// <summary>
 /// Change the PlayMode on the device
 /// </summary>
 /// <param name="NewMode">Desired Mode</param>
 public void SetPlayMode(PlayMode NewMode)
 {
     CpAVTransport.Enum_CurrentPlayMode RetVal = CpAVTransport.Enum_CurrentPlayMode._UNSPECIFIED_;
     AVTransport.SetUnspecifiedValue("Enum_CurrentPlayMode", NewMode.ToString());
     AVTransport.SetPlayMode((UInt32)this.AVTid, RetVal);
 }
Exemple #7
0
		/// <summary>
		/// Change the PlayMode on the device
		/// </summary>
		/// <param name="NewMode">Desired Mode</param>
		public void SetPlayMode(PlayMode NewMode)
		{
			CpAVTransport.Enum_CurrentPlayMode RetVal = CpAVTransport.Enum_CurrentPlayMode._UNSPECIFIED_;
			AVTransport.SetUnspecifiedValue("Enum_CurrentPlayMode",NewMode.ToString());
			AVTransport.SetPlayMode((UInt32)this.AVTid,RetVal);
		}
 public override string ToString()
 {
     return(string.Format("Profile[{0}]  PlayMode[{1}]  ServerName[{2}]  Level[{3}]", localProfileId, playMode.ToString(), serverName, level));
 }
Exemple #9
0
        public static void Attach(IView view)
        {
            _view = view;

            var curdir = AppDomain.CurrentDomain.BaseDirectory.TrimEnd(new char[] { '/', '\\' });

            _basepath   = Path.GetDirectoryName(curdir);
            _gamepath   = Path.Combine(_basepath, GameLocation);
            _updatepath = Path.Combine(_basepath, UpdateLocation);

            if (Path.GetFileName(curdir) == UpdateLocation)
            {
                // Update self
                var newdir = Path.Combine(_basepath, LauncherLocation);

                while (true)
                {
                    try
                    {
                        if (Directory.Exists(newdir))
                        {
                            Directory.Delete(newdir, true);
                        }
                        Helper.CopyDirectory(curdir, newdir);
                        break;
                    }
                    catch { }
                }

                if (Global.IsUnix)
                {
                    Process.Start("mono", Path.Combine(newdir, "Launcher.exe"));
                }
                else
                {
                    Process.Start(Path.Combine(newdir, "Launcher.exe"));
                }
                Process.GetCurrentProcess().Kill();
            }
            else
            {
                // Delete old update cache if found
                while (true)
                {
                    try
                    {
                        if (Directory.Exists(_updatepath))
                        {
                            Directory.Delete(_updatepath, true);
                        }
                        break;
                    }
                    catch { }
                }
            }

            var assembly          = typeof(MainWindow).GetTypeInfo().Assembly;
            var html              = "";
            var changeloglocation = Path.Combine(curdir, CacheLocation, "changelog.txt");
            var changelogtext     = "";
            var changelog         = "";
            var ulstarted         = false;

            // Read default HTML / CSS / JavaScript
            using (var stream = assembly.GetManifestResourceStream("Launcher.index.html"))
                using (var reader = new StreamReader(stream))
                    html = reader.ReadToEnd();

            // Download newest Launcher Info / Game Version Info / Changelog
            try
            {
                var client = new System.Net.WebClient();
                _gameversions = JsonConvert.DeserializeObject <VersionInfo[]>(client.DownloadString(GameVersions));

                _launcherversion = JsonConvert.DeserializeObject <VersionInfo>(client.DownloadString(LauncherVersion));

                if (!Directory.Exists(Path.Combine(curdir, CacheLocation)))
                {
                    Directory.CreateDirectory(Path.Combine(curdir, CacheLocation));
                }

                File.WriteAllText(changeloglocation, client.DownloadString(Changelog));
            }
            catch
            {
                _gameversions            = new VersionInfo[1];
                _launcherversion         = new VersionInfo();
                _launcherversion.Version = Assembly.GetEntryAssembly().GetName().Version.ToString();
                _view.ShowError("Could not download the metadata, starting in offline mode...");

                if (!Directory.Exists(_gamepath) || Directory.GetDirectories(_gamepath).Length == 0)
                {
                    _view.ShowError("No game version found, exiting...");
                    Process.GetCurrentProcess().Kill();
                }
                else
                {
                    _gameversions[0] = new VersionInfo {
                        Version = Directory.GetDirectories(_gamepath)[0]
                    }
                };
            }

            // Try and read changelog
            try
            {
                if (File.Exists(changeloglocation))
                {
                    changelog = File.ReadAllText(changeloglocation);
                }
            }
            catch { }

            changelogtext = CommonMark.CommonMarkConverter.Convert(changelog);

            _status = Status.Ready;
            ReloadPlay(false);

            _currentprogress = 100;
            _index           = 0;

            html = html.Replace("$PLAYTEXT", _playmode.ToString()).Replace("$CHANGELOG", changelogtext);
            _view.Attach(html, _gameversions);
        }
Exemple #10
0
        public void PlayGame(PlayMode mod = PlayMode.TwoPlayers)
        {
            int poz;

            if (mod == PlayMode.TwoPlayers)
            {
                Console.WriteLine("Character for player 1: {0} \tCharacter for player2: {1}", values[1], values[2]);
            }
            else
            {
                Console.WriteLine("You are player 1. Your character is:{0}", values[1]);
            }
            Console.WriteLine("Insert the number of line, number of column to make a move");
            Random r      = new Random();
            int    player = r.Next(0, 10);
            int    l      = 1,
                   c      = 1;

            while (this.CanContinue && !this.HaveWinner(l - 1, c - 1))
            {
                player = player % 2 + 1;
                ShowTable();
                if (mod == PlayMode.TwoPlayers || player == 1)
                {
                    do
                    {
                        Console.WriteLine("Player{0} make a valid move:", player);
                        do
                        {
                            Console.Write("Line:");
                        } while (!Int32.TryParse(Console.ReadLine(), out l) || l < 1 || l > 3);
                        do
                        {
                            Console.Write("Column:");
                        } while (!Int32.TryParse(Console.ReadLine(), out c) || c < 1 || c > 3);
                    } while (!this.ValidateMove(l - 1, c - 1, player));
                }
                else
                {
                    poz = MakeAMove(mod);
                    c   = poz % 3 + 1;
                    l   = poz / 3 + 1;
                    this.ValidateMove(l - 1, c - 1, player);
                }
            }

            ShowTable();

            if (this.HaveWinner(l - 1, c - 1))
            {
                if (mod == PlayMode.TwoPlayers || player == 1)
                {
                    Console.WriteLine("\n\n\t\tCONGRATULATIONS PLAYER{0}, you just win the game level:{1}", player, mod.ToString());
                }
                else
                {
                    Console.WriteLine("\n\n\t\tComputer just win the game :(");
                }
            }
            else
            {
                Console.WriteLine("\n\n\t\tGood game. This was a draw");
            }
        }