public static IEnumerable <object> GetVariables(EVT t) { if (t != EVT.Process) { RegistryKey key; if (t == EVT.Machine) { key = RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, RegistryView.Default).OpenSubKey(SystemVars); } else { key = RegistryKey.OpenBaseKey(RegistryHive.CurrentUser, RegistryView.Default).OpenSubKey(UserVars); } var names = key.GetValueNames(); foreach (var k in names) { yield return(k); yield return(key.GetValueKind(k) == RVK.ExpandString); yield return(key.GetValue(k, null, RegistryValueOptions.DoNotExpandEnvironmentNames)); } yield break; } var env = Environment.GetEnvironmentVariables(t); foreach (DictionaryEntry item in env) { yield return(item.Key); yield return(null); yield return(item.Value); } }
public HitResourcegroup(string HitPath, string EVTPath, string HSMPath) { HitResource = new Hit(File.Open(HitPath, FileMode.Open, FileAccess.Read, FileShare.Read)); Events = new EVT(File.Open(EVTPath, FileMode.Open, FileAccess.Read, FileShare.Read)); if (HSMPath != "") { Symbols = new HSM(HSMPath); } }
/// <summary> /// Tests the DBPFArchive class. /// </summary> public static void DBPFTest() { Console.WriteLine("Attempting to parse XA..."); Console.WriteLine("Attempting to parse EVT..."); EVT Event = new EVT(File.Open(StartupPath + "\\sounddata\\tsov2.evt", FileMode.Open, FileAccess.Read, FileShare.Read)); Console.WriteLine("Attempting to parse TRK..."); TRK Track = FileManager.GetTRK(Event.Events[2].TrackID); }
static void Main(string[] args) { DELG dlG_time = new DELG(time); DELG dlg_multiCast; IAsyncResult asyncR; LOCK = new object(); loop = 0; evt += new EVT(state_display); var an_type = new { msg_pext = "pextension", msg_noext = "noextension" }; System.Threading.Thread thd_timeInvok = new System.Threading.Thread(new System.Threading.ThreadStart(dlG_time.Invoke)); System.Threading.Thread thd_paraExt = new System.Threading.Thread( new System.Threading.ThreadStart(() => { System.Threading.Parallel.For(0, 10, i => { Console.WriteLine(@"{0}", an_type.msg_pext); System.Threading.Thread.Sleep(1000); }); evt((object)an_type.msg_pext); })); System.Threading.Thread thd_noParaExt = new System.Threading.Thread( new System.Threading.ThreadStart(() => { for (int i = 0; i < 10; i++) { Console.WriteLine(@"{0}", an_type.msg_noext); System.Threading.Thread.Sleep(1000); } ; evt((object)an_type.msg_noext); })); asyncR = dlG_time.BeginInvoke((async) => { DELG d = (DELG)((System.Runtime.Remoting.Messaging.AsyncResult)async).AsyncDelegate; d.EndInvoke(async); Console.Write("Fin des traveaux"); }, dlG_time); dlg_multiCast = thd_paraExt.Start; dlg_multiCast += thd_noParaExt.Start; dlg_multiCast.Invoke(); while (!asyncR.IsCompleted) { Console.WriteLine("Travaux en cours..."); System.Threading.Thread.Sleep(5000); } Console.Read(); }
private HITResourceGroup LoadHitGroup(string HITPath, string EVTPath, string HSMPath) { var events = new EVT(EVTPath); var hitfile = new HITFile(HITPath); HSM hsmfile = null; if (HSMPath != null) { hsmfile = new HSM(HSMPath); } return(new HITResourceGroup() { evt = events, hit = hitfile, hsm = hsmfile }); }
private void ParseEVT(string path, bool UseDebug) { EVT evt = new EVT(path, UseDebug); }
static void Main(string[] args) { Dictionary <string, int> scoreTable = new Dictionary <string, int>() { { "Player 1", 0 }, { "Player 2", 0 }, { "Bank", 0 } }; DELG dlG_time = new DELG(time); DELG dlg_multiCast; IAsyncResult asyncR; LOCK = new object(); loop = 0; evt += new EVT(state_display); Thread thd_timeInvok = new Thread(new ThreadStart(dlG_time.Invoke)); Thread thd_game = new Thread(new ThreadStart(() => { Parallel.For(0, 10000, i => { List <Joueur> listJoueurs = new List <Joueur>(); listJoueurs.Add(new Joueur("Player 1", 2)); listJoueurs.Add(new Joueur("Player 2", 2)); listJoueurs.Add(new Joueur("Bank", 3)); Croupier croupier = new Croupier(listJoueurs); croupier.distributerCartes(); foreach (Joueur joueur in listJoueurs) { croupier.calculerScore(joueur); } string winnerName = croupier.designerVainqueur(); scoreTable[winnerName] += 1; Thread.Sleep(10); //Console.WriteLine(""); }); /* * for(int i = 0; i< 10000; i ++) * { * List<Joueur> listJoueurs = new List<Joueur>(); * * listJoueurs.Add(new Joueur("Player 1", 2)); * listJoueurs.Add(new Joueur("Player 2", 2)); * listJoueurs.Add(new Joueur("Bank", 3)); * * Croupier croupier = new Croupier(listJoueurs); * croupier.distributerCartes(); * * foreach (Joueur joueur in listJoueurs) * { * croupier.calculerScore(joueur); * } * * string winnerName = croupier.designerVainqueur(); * scoreTable[winnerName] += 1; * Thread.Sleep(10); * //Console.WriteLine(""); * } */ evt(); })); asyncR = dlG_time.BeginInvoke((async) => { DELG d = (DELG)((System.Runtime.Remoting.Messaging.AsyncResult)async).AsyncDelegate; d.EndInvoke(async); Console.WriteLine("Fin des traveaux"); }, dlG_time); dlg_multiCast = thd_game.Start; dlg_multiCast.Invoke(); while (!asyncR.IsCompleted) // Tant que le résult asyncR n'est pas complété, on affiche un message dans la console toutes les 5 secondes { Console.WriteLine("Travaux en cours..."); Thread.Sleep(5000); } Console.WriteLine("=================================="); Console.WriteLine(""); foreach (var scoreLine in scoreTable) { Console.WriteLine("Le nombre de victoires de " + scoreLine.Key + " est " + scoreLine.Value); } Console.WriteLine(""); Console.WriteLine("=================================="); Console.Read(); }