Example #1
0
        public void Restart()
        {
            var ci = new CoreInfo(emu);
            KnownCores[ci.CoreName] = ci;

            DoCurrentCoreTree(ci);
            DoAllCoresTree(ci);
        }
Example #2
0
        public override void Restart()
        {
            var ci = new CoreInfo(Emulator);

            KnownCores[ci.CoreName] = ci;

            DoCurrentCoreTree(ci);
            DoAllCoresTree(ci);
        }
        public void Restart()
        {
            var ci = new CoreInfo(emu);

            KnownCores[ci.CoreName] = ci;

            DoCurrentCoreTree(ci);
            DoAllCoresTree(ci);
        }
        private void DoAllCoresTree(CoreInfo current_ci)
        {
            CoreTree.ImageList = new ImageList();
            CoreTree.ImageList.Images.Add("Good", Properties.Resources.GreenCheck);
            CoreTree.ImageList.Images.Add("Bad", Properties.Resources.ExclamationRed);
            CoreTree.ImageList.Images.Add("Unknown", Properties.Resources.RetroQuestion);

            var possibleCoreTypes =
                Assembly
                .Load("BizHawk.Emulation.Cores")
                .GetTypes()
                .Where(t => typeof(IEmulator).IsAssignableFrom(t) && !t.IsAbstract)
                .Select(t => new
            {
                Type           = t,
                CoreAttributes = (CoreAttribute)t.GetCustomAttributes(typeof(CoreAttribute), false).First()
            })
                .OrderByDescending(t => t.CoreAttributes.Released)
                .ThenBy(t => t.CoreAttributes.CoreName)
                .ToList();

            toolStripStatusLabel1.Text = $"Total: {possibleCoreTypes.Count} Released: {KnownCores.Values.Count(c => c.Released)} Profiled: {KnownCores.Count}";

            CoreTree.Nodes.Clear();
            CoreTree.BeginUpdate();

            foreach (var ci in KnownCores.Values)
            {
                var coreNode = CreateCoreTree(ci);

                if (ci.CoreName == current_ci.CoreName)
                {
                    coreNode.Expand();
                }
                CoreTree.Nodes.Add(coreNode);
            }

            foreach (var t in possibleCoreTypes)
            {
                if (!KnownCores.ContainsKey(t.CoreAttributes.CoreName))
                {
                    string img      = "Unknown";
                    var    coreNode = new TreeNode
                    {
                        Text             = t.CoreAttributes.CoreName + (t.CoreAttributes.Released ? "" : " (UNRELEASED)"),
                        ForeColor        = t.CoreAttributes.Released ? Color.Black : Color.DarkGray,
                        ImageKey         = img,
                        SelectedImageKey = img,
                        StateImageKey    = img
                    };
                    CoreTree.Nodes.Add(coreNode);
                }
            }

            CoreTree.EndUpdate();
        }
Example #5
0
    private static CoreInfo CreateInfo()
    {
        var info = new CoreInfo();

        info.picId   = lastPicId;
        info.sliceId = lastSliceId;
        var puzzleInfo = Puzzle.Instance.CreateInfo();

        info.puzzleInfo = puzzleInfo;
        return(info);
    }
Example #6
0
        private void Bgw_DoWork()
        {
            if (CheckConfiguration())
            {
                string ArchiveDirectory = Configuration.ArchivPfad + "\\" + DateTime.Now.ToString("yyyy_MM_dd_hh_mm_ss");

                LogFile = DateTime.Now.ToString("yyyy_MM_dd_hh_mm_ss") + "_log.txt";
                Log("Zielverzeichnis: " + Configuration.ZielPfad);
                Log("Archivverzeichnis: " + ArchiveDirectory);
                Log("Logverzeichnis: " + Configuration.LogPfad);

                coreInfo = LoginPP(PictureparkService);

                if (coreInfo == null)
                {
                    return;
                }

                AssetFields = PictureparkService.GetAssetFields(coreInfo);

                //create temp directory for images or wipe content if already exists
                if (!CreateTempDirectory())
                {
                    return;
                }


                List <string> alreadyCheckedAssets = new List <string>();
                //get already completed assets from Completed.csv
                if (!GetAlreadyCheckedAssets(out alreadyCheckedAssets))
                {
                    return;
                }

                //get all aproved assets in given timespan
                if (!GetReviewedAssets(alreadyCheckedAssets))
                {
                    return;
                }

                //compare and synchronise images
                int failures = CompareAndSyncImages();

                MessageBox.Show("Abgleich abgeschlossen, " + failures + " fehlgeschlagen, mehr Informationen in der Logdatei");
                Log("Abgleich abgeschlossen, " + failures + " Bilder konnten nicht synchronisiert werden");

                //save last sync to config file
                Configuration.LetzterAbgleich = DateTime.Now;

                string strConfig = JsonConvert.SerializeObject(Configuration, Formatting.Indented);
                File.WriteAllText(ConfigPath, strConfig);
            }
        }
Example #7
0
        private static CoreInfo parseInfoFile(Stream stream, string bin)
        {
            var f       = new StreamReader(stream).ReadToEnd();
            var matches = parseRegex.Matches(f);

            if (matches.Count <= 0)
            {
                return(null);
            }

            var    core   = new CoreInfo(bin);
            string system = null;

            foreach (Match mm in matches)
            {
                if (mm.Success)
                {
                    switch (mm.Groups[1].ToString().ToLower())
                    {
                    case "corename":
                        core.Name = mm.Groups[2].ToString();
                        break;

                    case "display_name":
                        core.DisplayName = mm.Groups[2].ToString();
                        break;

                    case "systemname":
                        system = mm.Groups[2].ToString();
                        break;

                    case "supported_extensions":
                        core.SupportedExtensions = mm.Groups[2].ToString().Split('|');
                        for (var i = 0; i < core.SupportedExtensions.Length; ++i)
                        {
                            core.SupportedExtensions[i] = "." + core.SupportedExtensions[i];
                        }
                        break;

                    case "database":
                        core.Systems = mm.Groups[2].ToString().Split('|');
                        break;
                    }
                }
            }
            if (core.Systems == null && system != null)
            {
                core.Systems = new string[] { system }
            }
            ;
            core.Kind = CoreKind.Libretro;
            return(core);
        }
Example #8
0
        private CoreInfo GetCoreInfo(string name)
        {
            CoreInfo coreInfo = CoreInfos.SingleOrDefault(c => c.Name == name);

            if (coreInfo is null)
            {
                coreInfo = new CoreInfo {
                    Name = name
                };
                CoreInfos.Add(coreInfo);
            }

            return(coreInfo);
        }
Example #9
0
        private void DoCurrentCoreTree(CoreInfo ci)
        {
            CurrentCoreTree.ImageList = new ImageList();
            CurrentCoreTree.ImageList.Images.Add("Good", Properties.Resources.GreenCheck);
            CurrentCoreTree.ImageList.Images.Add("Bad", Properties.Resources.ExclamationRed);

            CurrentCoreTree.Nodes.Clear();
            CurrentCoreTree.BeginUpdate();
            var coreNode = CreateCoreTree(ci);

            coreNode.Expand();
            CurrentCoreTree.Nodes.Add(coreNode);
            CurrentCoreTree.EndUpdate();
        }
Example #10
0
        public override void OnInspectorGUI()
        {
            serializedObject.Update();

            string holojamData = "Not loaded";

            System.Version v = typeof(Configuration).Assembly.GetName().Version;
            if (v.Major > 0 || v.Minor > 0 || v.Revision > 0)
            {
                holojamData = "v" + v;
            }

            EditorGUILayout.LabelField("Holojam", holojamData);
            EditorGUILayout.LabelField("Core", CoreInfo.GetVersion());
        }
        public CoreInfo GetCoreInfoById([FromBody] int id)
        {
            //int coreid;
            //var coreIdString = GetSessionVariable("CoreId");
            //if (System.Int32.TryParse(coreIdString, out coreid))
            //{
            string coreInfoJson = RemoteProcedureCallClass
                                  .GetGameChannel()
                                  .GetCoreInfoById(id);
            CoreInfo coreInfo = coreInfoJson.FromJson <CoreInfo>();

            return(coreInfo);
            //}
            //return new CoreInfo();
        }
        public static async Task <EmbedBuilder> AugmentDiscordEmbed(this CoreInfo info, EmbedBuilder builder)
        {
            if (info.Launches == null)
            {
                return(builder);
            }

            var missions = info.Launches.Select(a => a.Value).Where(a => a != null).ToArray();

            if (missions.Length > 0)
            {
                builder = builder.WithDescription(string.Join("\n", missions.Select(MissionLine)));
            }

            return(builder);
        }
Example #13
0
        public ActionResult coreInfo()
        {
            var lastUpdate = CoreInfo.GetLastUpdate();
            var message    = Hot.GetHotNews();

            return(Json(new
            {
                LastUpdate = lastUpdate,
                WowToken = CoreInfo.GetWowToken(),
                LastUpdateString = Time.TimeStampToDateTime(lastUpdate).ToString("MM-dd HH:mm"),
                Hot1 = message[0],
                Hot2 = message[1],
                Hot3 = message[2],
            }
                        ));
        }
Example #14
0
        private string GetLandingsData(CoreInfo core)
        {
            var landings = new List <string>();

            if (core.AsdsAttempts > 0)
            {
                landings.Add($"ASDS attempts: {core.AsdsAttempts} ({core.AsdsLandings} with success)");
            }

            if (core.RtlsAttempts > 0)
            {
                landings.Add($"RTLS attempts: {core.RtlsAttempts} ({core.RtlsLandings} with success)");
            }

            return(landings.Any() ? string.Join("\r\n", landings) : "none");
        }
Example #15
0
        private int SetCore(Config config, VmessItem item)
        {
            if (item == null)
            {
                return(-1);
            }
            var coreType = LazyConfig.Instance.GetCoreType(item, item.configType);

            coreInfo = LazyConfig.Instance.GetCoreInfo(coreType);

            if (coreInfo == null)
            {
                return(-1);
            }
            return(0);
        }
Example #16
0
        private void DoAllCoresTree(CoreInfo current_ci)
        {
            CoreTree.ImageList = new ImageList();
            CoreTree.ImageList.Images.Add("Good", Properties.Resources.GreenCheck);
            CoreTree.ImageList.Images.Add("Bad", Properties.Resources.ExclamationRed);
            CoreTree.ImageList.Images.Add("Unknown", Properties.Resources.RetroQuestion);

            var possibleCoreTypes = CoreInventory.Instance.SystemsFlat
                                    .OrderByDescending(core => core.CoreAttr.Released)
                                    .ThenBy(core => core.Name)
                                    .ToList();

            toolStripStatusLabel1.Text = $"Total: {possibleCoreTypes.Count} Released: {KnownCores.Values.Count(c => c.Released)} Profiled: {KnownCores.Count}";

            CoreTree.Nodes.Clear();
            CoreTree.BeginUpdate();

            foreach (var ci in KnownCores.Values)
            {
                var coreNode = CreateCoreTree(ci);

                if (ci.CoreName == current_ci.CoreName)
                {
                    coreNode.Expand();
                }
                CoreTree.Nodes.Add(coreNode);
            }

            foreach (var core in possibleCoreTypes)
            {
                if (!KnownCores.ContainsKey(core.Name))
                {
                    string img      = "Unknown";
                    var    coreNode = new TreeNode
                    {
                        Text             = core.Name + (core.CoreAttr.Released ? "" : " (UNRELEASED)"),
                        ForeColor        = core.CoreAttr.Released ? Color.Black : Color.DarkGray,
                        ImageKey         = img,
                        SelectedImageKey = img,
                        StateImageKey    = img
                    };
                    CoreTree.Nodes.Add(coreNode);
                }
            }

            CoreTree.EndUpdate();
        }
        public static async Task <EmbedBuilder> DiscordEmbed(this CoreInfo info)
        {
            if (info == null)
            {
                throw new ArgumentNullException(nameof(info));
            }
            var color = info.Status switch
            {
                CoreStatus.Active => Color.Green,
                CoreStatus.Expended or CoreStatus.Lost => Color.Red,
                CoreStatus.Retired or CoreStatus.Inactive => Color.DarkGrey,
                _ => Color.Purple,
            };

            //Create text description
            var description = "";

            if (info.Launches is { Count : > 0 })
Example #18
0
        private int CoreLaunchDateComparer(CoreInfo a, CoreInfo b)
        {
            var firstOriginalLaunch  = a.Launches.Count > 0 ? a.Launches[0].Value.DateUtc : null;
            var secondOriginalLaunch = b.Launches.Count > 0 ? b.Launches[0].Value.DateUtc : null;

            if (firstOriginalLaunch.HasValue && !secondOriginalLaunch.HasValue)
            {
                return(-1);
            }

            if (secondOriginalLaunch.HasValue && !firstOriginalLaunch.HasValue)
            {
                return(1);
            }

            if (firstOriginalLaunch.HasValue && secondOriginalLaunch.HasValue)
            {
                return(firstOriginalLaunch.Value > secondOriginalLaunch.Value ? 1 : -1);
            }

            return(0);
        }
Example #19
0
        private void Awake()
        {
            // Local References
            playableEntity = transform.GetComponentInChildren <PlayableEntity>();

            // HUD
            if (GameObject.Find("HUDManager"))
            {
                CoreInfo info  = playableEntity.info;
                Stats    stats = playableEntity.stats;
                HUDManager.SetName(info.name);
                HUDManager.SetTitle(info.title);
                HUDManager.SetBars(stats.maxHealth, stats.health, stats.maxMana, stats.mana);
            }

            // Events
            GameObject.Find("Player Input").GetComponent <PlayerInput>().onActionTriggered += HandleAction;

            // Equipment
            equipment.Equip(startBackpack);
            equipment.Equip(startRSystem);
        }
Example #20
0
        public DiscordEmbed Build(CoreInfo core)
        {
            var embed = new DiscordEmbedBuilder
            {
                Title       = $"{core.Serial} (block {core.Block?.ToString() ?? "none"})",
                Description = $"{core.LastUpdate ?? "*No description at this moment :(*"}",
                Color       = new DiscordColor(Constants.EmbedColor),
                Thumbnail   = new DiscordEmbedBuilder.EmbedThumbnail()
                {
                    Url = Constants.SpaceXLogoImage
                }
            };

            var firstLaunch = core.Launches.Count > 0 ? core.Launches[0].Value : null;

            embed.AddField(":clock4: First launch time (UTC)", firstLaunch?.DateUtc?.ToString("D", CultureInfo.InvariantCulture) ?? "not launched yet", true);
            embed.AddField(":stadium: Current status", core.Status.ToString(), true);
            embed.AddField(":recycle: Landings", GetLandingsData(core));
            embed.AddField($":rocket: Missions ({core.Launches.Count})", GetMissionsList(core.Launches));
            embed.AddField("\u200b", "*Type `e!GetLaunch number` (e.g. e!GetLaunch 45) to get more detailed info about the mission.*");

            return(embed);
        }
Example #21
0
        public UpdateFileInfo()
        {
            Core            = new CoreInfo();
            Updater         = new CoreInfo();
            AviSynthPlugins = new ToolInfo();
            Profiles        = new ToolInfo();

            X264       = new ToolInfo();
            X26464     = new ToolInfo();
            FFMPEG     = new ToolInfo();
            Eac3To     = new ToolInfo();
            LsDvd      = new ToolInfo();
            MKVToolnix = new ToolInfo();
            Mplayer    = new ToolInfo();
            TSMuxeR    = new ToolInfo();
            MjpegTools = new ToolInfo();
            DVDAuthor  = new ToolInfo();
            MP4Box     = new ToolInfo();
            HcEnc      = new ToolInfo();
            OggEnc     = new ToolInfo();
            Lame       = new ToolInfo();
            VpxEnc     = new ToolInfo();
            BDSup2Sub  = new ToolInfo();
        }
Example #22
0
        private TreeNode CreateCoreTree(CoreInfo ci)
        {
            var ret = new TreeNode
            {
                Text      = ci.CoreName + (ci.Released ? "" : " (UNRELEASED)"),
                ForeColor = ci.Released ? Color.Black : Color.DarkGray
            };

            foreach (var service in ci.Services.Values)
            {
                string img         = service.Complete ? "Good" : "Bad";
                var    serviceNode = new TreeNode
                {
                    Text             = service.TypeName,
                    ForeColor        = service.Complete ? Color.Black : Color.Red,
                    ImageKey         = img,
                    SelectedImageKey = img,
                    StateImageKey    = img
                };

                foreach (var function in service.Functions)
                {
                    img = function.Complete ? "Good" : "Bad";
                    serviceNode.Nodes.Add(new TreeNode
                    {
                        Text             = function.TypeName,
                        ForeColor        = function.Complete ? Color.Black : Color.Red,
                        ImageKey         = img,
                        SelectedImageKey = img,
                        StateImageKey    = img
                    });
                }
                ret.Nodes.Add(serviceNode);
            }


            var knownServices = Emulation.Common.ReflectionCache.Types
                                .Where(t => typeof(IEmulatorService).IsAssignableFrom(t))
                                .Where(t => t != typeof(IEmulatorService))
                                .Where(t => t != typeof(ITextStatable)) // Hack for now, eventually we can get rid of this interface in favor of a default implementation
                                .Where(t => t.IsInterface);

            var additionalServices = knownServices
                                     .Where(t => !ci.Services.ContainsKey(t.ToString()))
                                     .Where(t => !ci.NotApplicableTypes.Contains(t.ToString()))
                                     .Where(t => !typeof(ISpecializedEmulatorService).IsAssignableFrom(t)); // We don't want to show these as unimplemented, they aren't expected services

            foreach (Type service in additionalServices)
            {
                string img         = "Bad";
                var    serviceNode = new TreeNode
                {
                    Text             = service.ToString(),
                    ForeColor        = Color.Red,
                    ImageKey         = img,
                    SelectedImageKey = img,
                    StateImageKey    = img
                };
                ret.Nodes.Add(serviceNode);
            }
            return(ret);
        }
Example #23
0
        private void DoAllCoresTree(CoreInfo current_ci)
        {
            CoreTree.ImageList = new ImageList();
            CoreTree.ImageList.Images.Add("Good", Properties.Resources.GreenCheck);
            CoreTree.ImageList.Images.Add("Bad", Properties.Resources.ExclamationRed);
            CoreTree.ImageList.Images.Add("Unknown", Properties.Resources.RetroQuestion);

            var possiblecoretypes =
                Assembly
                .Load("BizHawk.Emulation.Cores")
                .GetTypes()
                .Where(t => typeof(IEmulator).IsAssignableFrom(t) && !t.IsAbstract)
                .Select(t => new
                {
                    Type = t,
                    CoreAttributes = (CoreAttributes)t.GetCustomAttributes(typeof(CoreAttributes), false).First()
                })
                .OrderByDescending(t => t.CoreAttributes.Released)
                .ThenBy(t => t.CoreAttributes.CoreName)
                .ToList();

            toolStripStatusLabel1.Text = string.Format("Total: {0} Released: {1} Profiled: {2}",
                possiblecoretypes.Count,
                KnownCores.Values.Count(c => c.Released),
                KnownCores.Count);

            CoreTree.Nodes.Clear();
            CoreTree.BeginUpdate();

            foreach (var ci in KnownCores.Values)
            {
                var coreNode = CreateCoreTree(ci);

                if (ci.CoreName == current_ci.CoreName)
                {
                    coreNode.Expand();
                }
                CoreTree.Nodes.Add(coreNode);
            }

            foreach (var t in possiblecoretypes)
            {
                if (!KnownCores.ContainsKey(t.CoreAttributes.CoreName))
                {
                    string img = "Unknown";
                    var coreNode = new TreeNode
                    {
                        Text = t.CoreAttributes.CoreName + (t.CoreAttributes.Released ? string.Empty : " (UNRELEASED)"),
                        ForeColor = t.CoreAttributes.Released ? Color.Black : Color.DarkGray,
                        ImageKey = img,
                        SelectedImageKey = img,
                        StateImageKey = img
                    };
                    CoreTree.Nodes.Add(coreNode);
                }
            }

            CoreTree.EndUpdate();
        }
        private TreeNode CreateCoreTree(CoreInfo ci)
        {
            var ret = new TreeNode
            {
                Text      = ci.CoreName + (ci.Released ? string.Empty : " (UNRELEASED)"),
                ForeColor = ci.Released ? Color.Black : Color.DarkGray
            };

            foreach (var service in ci.Services.Values)
            {
                string img         = service.Complete ? "Good" : "Bad";
                var    serviceNode = new TreeNode
                {
                    Text             = service.TypeName,
                    ForeColor        = service.Complete ? Color.Black : Color.Red,
                    ImageKey         = img,
                    SelectedImageKey = img,
                    StateImageKey    = img
                };

                foreach (var function in service.Functions)
                {
                    img = function.Complete ? "Good" : "Bad";
                    serviceNode.Nodes.Add(new TreeNode
                    {
                        Text             = function.TypeName,
                        ForeColor        = function.Complete ? Color.Black : Color.Red,
                        ImageKey         = img,
                        SelectedImageKey = img,
                        StateImageKey    = img
                    });
                }
                ret.Nodes.Add(serviceNode);
            }


            var knownServies = Assembly.GetAssembly(typeof(IEmulator))
                               .GetTypes()
                               .Where(t => typeof(IEmulatorService).IsAssignableFrom(t))
                               .Where(t => t != typeof(IEmulatorService))
                               .Where(t => t.IsInterface)
                               .Select(t => t.ToString());

            var additionalServices = knownServies
                                     .Where(s => !ci.Services.ContainsKey(s))
                                     .Where(s => !ci.NotApplicableTypes.Contains(s));

            foreach (string servicename in additionalServices)
            {
                string img         = "Bad";
                var    serviceNode = new TreeNode
                {
                    Text             = servicename,
                    ForeColor        = Color.Red,
                    ImageKey         = img,
                    SelectedImageKey = img,
                    StateImageKey    = img
                };
                ret.Nodes.Add(serviceNode);
            }
            return(ret);
        }
Example #25
0
        private void DoCurrentCoreTree(CoreInfo ci)
        {
            CurrentCoreTree.ImageList = new ImageList();
            CurrentCoreTree.ImageList.Images.Add("Good", Properties.Resources.GreenCheck);
            CurrentCoreTree.ImageList.Images.Add("Bad", Properties.Resources.ExclamationRed);

            CurrentCoreTree.Nodes.Clear();
            CurrentCoreTree.BeginUpdate();
            var coreNode = CreateCoreTree(ci);
            coreNode.Expand();
            CurrentCoreTree.Nodes.Add(coreNode);
            CurrentCoreTree.EndUpdate();
        }
        public static void Load()
        {
            // try to load from cache
            if (Deserialize())
            {
                return;
            }

            // clear and add default cores
            cores = BuiltInCores.List.ToDictionary(pair => pair.Bin);

            // load info files
            Debug.WriteLine("Loading libretro core info files");
            var whiteList = File.Exists(WhiteListFilename) ? File.ReadAllLines(WhiteListFilename) : Resources.retroarch_whitelist.Split("\n\r".ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
            var regex     = new Regex("(^[^\\s]+)\\s+=\\s+\"?([^\"\\r\\n]*)\"?", RegexOptions.Multiline | RegexOptions.Compiled);
            var infoFiles = Directory.GetFiles(Shared.PathCombine(Program.BaseDirectoryInternal, "data", "libretro_cores"), "*.info");

            foreach (var file in infoFiles)
            {
                Match m = Regex.Match(Path.GetFileNameWithoutExtension(file), "^(.*)_libretro");
                if (m.Success && !string.IsNullOrEmpty(m.Groups[1].ToString()))
                {
                    var bin = m.Groups[1].ToString();
                    if (!whiteList.Contains(bin))
                    {
                        continue;
                    }

                    var f       = File.ReadAllText(file);
                    var matches = regex.Matches(f);
                    if (matches.Count <= 0)
                    {
                        continue;
                    }

                    var    core   = new CoreInfo(bin);
                    string system = null;
                    foreach (Match mm in matches)
                    {
                        if (mm.Success)
                        {
                            switch (mm.Groups[1].ToString().ToLower())
                            {
                            case "corename":
                                core.Name = mm.Groups[2].ToString();
                                break;

                            case "display_name":
                                core.DisplayName = mm.Groups[2].ToString();
                                break;

                            case "systemname":
                                system = mm.Groups[2].ToString();
                                break;

                            case "supported_extensions":
                                core.SupportedExtensions = mm.Groups[2].ToString().Split('|');
                                for (var i = 0; i < core.SupportedExtensions.Length; ++i)
                                {
                                    core.SupportedExtensions[i] = "." + core.SupportedExtensions[i];
                                }
                                break;

                            case "database":
                                core.Systems = mm.Groups[2].ToString().Split('|');
                                break;
                            }
                        }
                    }
                    if (core.Systems == null && system != null)
                    {
                        core.Systems = new string[] { system }
                    }
                    ;
                    core.Kind  = CoreKind.Libretro;
                    cores[bin] = core;
                }
            }
            new Thread(CoreCollection.UpdateWhitelist).Start();

            // cross indexing
            Debug.WriteLine("Building libretro core cross index");
            foreach (var c in cores)
            {
                if (c.Value.SupportedExtensions != null)
                {
                    foreach (var ext in c.Value.SupportedExtensions)
                    {
                        if (!extIndex.ContainsKey(ext))
                        {
                            extIndex[ext] = new List <CoreInfo>();
                        }
                        if (!extIndex[ext].Contains(c.Value))
                        {
                            extIndex[ext].Add(c.Value);
                        }
                    }
                }
                if (c.Value.Systems != null)
                {
                    foreach (var sys in c.Value.Systems)
                    {
                        if (!systemIndex.ContainsKey(sys))
                        {
                            systemIndex[sys] = new List <CoreInfo>();
                        }
                        if (!systemIndex[sys].Contains(c.Value))
                        {
                            systemIndex[sys].Add(c.Value);
                        }
                    }
                }
            }

            // save cache
            Serialize();
        }
Example #27
0
        public void AddOrUpdateCoreLoad(string name, double load)
        {
            CoreInfo coreInfo = GetCoreInfo(name);

            coreInfo.Load = load;
        }
Example #28
0
        public void AddOrUpdateCoreTemp(string name, double temp)
        {
            CoreInfo coreInfo = GetCoreInfo(name);

            coreInfo.Temp = temp;
        }
Example #29
0
 public CoreServerCtrl(CoreInfo coreInfo)
 {
     this.coreInfo = coreInfo;
 }
 public void ClickLevelDown()
 {
     CoreInfo.LevelDown();
     levelString.text = CoreInfo.LevelString;
 }
Example #31
0
        static void Main(string[] args)
        {
            SiftComparison(@"C:\temp\2.jpg", @"C:\temp\1.jpg");

            try
            {
                if (ConfigurationManager.AppSettings["address"] != "")
                {
                    var proxy = new WebProxy(ConfigurationManager.AppSettings["address"], true);
                    proxy.Credentials          = new NetworkCredential(ConfigurationManager.AppSettings["user"], ConfigurationManager.AppSettings["password"]);
                    WebRequest.DefaultWebProxy = proxy;
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine("ERROR: Please check proxy settings in KMB_ImageComparison.exe.config");
                Console.ReadLine();
                Environment.Exit(0);
            }

            PictureparkService.InnerChannel.OperationTimeout = new TimeSpan(0, 20, 0);

            while (true)
            {
                Console.WriteLine("Choose option: ");
                Console.WriteLine("1: Run comparison");
                Console.WriteLine("2: Generate configuration-file");

                switch (Console.ReadLine())
                {
                //run comparison
                case "1":
                    #region run comparison

                    LogFile = DateTime.Now.ToString("yyyyMMdd_hhmmss") + "_ImageComparison_Log.txt";
                    if (CheckConfiguration())
                    {
                        Log("Started comparison");

                        Log("Config file ok..");

                        //get asset fields
                        AssetFields = PictureparkService.GetAssetFields(coreInfo);

                        Log("Creating folder structure if not already existing");

                        //create temp folder if not already exists
                        string tempPath = Configuration.ResultPath + "\\temp";
                        if (!Directory.Exists(tempPath))
                        {
                            Directory.CreateDirectory(tempPath);
                        }

                        //higher PHASH score than 65 or SIFT matching above 100
                        string matchingFolder = Configuration.ResultPath + "\\01_matching";
                        if (!Directory.Exists(matchingFolder))
                        {
                            Directory.CreateDirectory(matchingFolder);
                        }
                        int matchingCount = 0;

                        //neither PHASH score above 65 or SIFT matching above 100
                        string noMatchingFolder = Configuration.ResultPath + "\\02_not_matching";
                        if (!Directory.Exists(noMatchingFolder))
                        {
                            Directory.CreateDirectory(noMatchingFolder);
                        }
                        int notMatchingCount = 0;

                        //create missing images folder if not already exists
                        string missingImgPath = Configuration.ResultPath + "\\03_missing_on_pp";
                        if (!Directory.Exists(missingImgPath))
                        {
                            Directory.CreateDirectory(missingImgPath);
                        }
                        int missingImgCount = 0;

                        //create multiple standard images folder if not already exists
                        string multipleStandardImgPath = Configuration.ResultPath + "\\04_multiple_w11_in_pp";
                        if (!Directory.Exists(multipleStandardImgPath))
                        {
                            Directory.CreateDirectory(multipleStandardImgPath);
                        }
                        int multipleW11Count = 0;

                        //create missing images folder if not already exists
                        string invalidAssetPath = Configuration.ResultPath + "\\05_invalid_asset_on_pp";
                        if (!Directory.Exists(invalidAssetPath))
                        {
                            Directory.CreateDirectory(invalidAssetPath);
                        }
                        int invalidAssetOnPPCount = 0;

                        int siftMatchingCount = 0;

                        //loop images in ImageFolder
                        DirectoryInfo imgDir = new DirectoryInfo(Configuration.ImagePath);

                        using (var client = new WebClient())
                        {
                            foreach (FileInfo fileToCheck in imgDir.GetFiles())
                            {
                                coreInfo = LoginPP(PictureparkService);

                                Log("Checking file: " + fileToCheck.Name);

                                //only check jpg files, ignore others
                                if (fileToCheck.Extension.ToLower() == ".jpg")
                                {
                                    string strObjId = fileToCheck.Name.Replace(fileToCheck.Extension, "");
                                    int    objId;
                                    if (int.TryParse(strObjId, out objId))
                                    {
                                        List <ComparisonOperation> comparisonOperations = new List <ComparisonOperation>();
                                        StringEqualOperation       stringEqualOperation = new StringEqualOperation()
                                        {
                                            FieldName = "OBJID", EqualString = objId.ToString()
                                        };
                                        comparisonOperations.Add(stringEqualOperation);
                                        AndOperation searchOperations = new AndOperation()
                                        {
                                            ComparisonOperations = comparisonOperations.ToArray()
                                        };

                                        ExtendedAssetFilter filter = new ExtendedAssetFilter()
                                        {
                                            AdditionalSelectFields = new string[] { "AssetName", "OBJID", "KeinDownloadOnline", "MP_Copyright" },
                                            SearchOperation        = searchOperations
                                        };

                                        AssetItemCollection collection = PictureparkService.GetAssets(coreInfo, filter);

                                        List <AssetItem> assets = collection.Assets
                                                                  .Where(a => a.FieldValues
                                                                         .Where(fv => fv.FieldId == GetFieldIdByName(AssetFields.ToList(), "AssetName"))
                                                                         .Any(fv => fv.StringValue.Substring(1, 3).ToLower() == "w11")).ToList();

                                        if (assets.Count() > 1)
                                        {
                                            //more than one w11 exists for this objId
                                            Log("More than one w11 exists for this objId");
                                            File.Move(fileToCheck.FullName, multipleStandardImgPath + "\\" + fileToCheck.Name);
                                            multipleW11Count++;
                                        }
                                        else if (assets.Count() == 1)
                                        {
                                            AssetItem asset = assets[0];

                                            List <AssetSelection> assetSelection = new List <AssetSelection>()
                                            {
                                                new AssetSelection()
                                                {
                                                    AssetId = asset.AssetId,
                                                    DerivativeDefinitionId = 7
                                                }
                                            };

                                            DownloadOptions downloadOptions = new DownloadOptions()
                                            {
                                                UserAction = UserAction.DerivativeDownload
                                            };

                                            Download download = new Download();

                                            try
                                            {
                                                download = PictureparkService.Download(coreInfo, assetSelection.ToArray(), downloadOptions);
                                            }
                                            catch (Exception ex)
                                            {
                                                File.Move(fileToCheck.FullName, invalidAssetPath + "\\" + fileToCheck.Name);
                                                Log("Problem with asset on picturepark");
                                                invalidAssetOnPPCount++;
                                                continue;
                                            }

                                            //download asset into temp directory
                                            string downloadFilePath = tempPath + "\\" + download.DownloadFileName;
                                            client.DownloadFile(download.URL, downloadFilePath);

                                            double phashScore = CompareImages(fileToCheck.FullName, downloadFilePath);

                                            Log("PHASH-Score: " + phashScore);

                                            int siftScore = 0;

                                            // PHASH does not match, check if SIFT finds matches
                                            if (phashScore < 0.65)
                                            {
                                                Log("PHASH-Score too low, checking SIFT Algorithm");
                                                siftScore = SiftComparison(fileToCheck.FullName, downloadFilePath);
                                                Log("SIFT-Score: " + siftScore);

                                                if (siftScore > 100)
                                                {
                                                    siftMatchingCount++;
                                                }
                                            }

                                            string folder;

                                            if (phashScore > 0.65 || siftScore > 100)
                                            {
                                                Log("Images match!");
                                                folder = matchingFolder;
                                                matchingCount++;
                                            }
                                            else
                                            {
                                                Log("Images do not match, lower PHASH than 0.65 and lower SIFT match than 100!");
                                                folder = noMatchingFolder;
                                                notMatchingCount++;
                                            }

                                            string fullObjId = "0000000".Substring(0, 7 - objId.ToString().Length) + objId.ToString();

                                            //move pair to folder
                                            File.Move(fileToCheck.FullName, folder + "\\" + fullObjId + "_mp.jpg");
                                            File.Move(downloadFilePath, folder + "\\" + fullObjId + "_pp.jpg");
                                        }
                                        else
                                        {
                                            //no asset found with this obj-id
                                            Log("No asset found for ObjId: " + objId.ToString());
                                            File.Move(fileToCheck.FullName, missingImgPath + "\\" + fileToCheck.Name);
                                            missingImgCount++;
                                        }
                                    }
                                    else
                                    {
                                        Log("Filename is not an obj-id, skipping");
                                    }
                                }
                                else
                                {
                                    Log("No jpg, skipping..");
                                }
                            }

                            Log("-------------------------");
                            Log("Image comparison finished");
                            Log("-------------------------");
                            Log("Total matches: " + matchingCount);
                            Log("Matches with PHASH: " + matchingCount + siftMatchingCount);
                            Log("Matches with SIFT: " + siftMatchingCount);
                            Log("-------------------------");
                            Log("Not matching: " + notMatchingCount);
                            Log("-------------------------");
                            Log("Missing assets in Picturepark: " + missingImgCount);
                            Log("-------------------------");
                            Log("Multiple W11 in Picturepark: " + multipleW11Count);
                            Log("-------------------------");
                            Log("Invalid assets in Picturepark: " + invalidAssetOnPPCount);
                            Log("-------------------------");
                        }
                    }
                    else
                    {
                        Log("Config file invalid, aborting");
                    }
                    #endregion
                    break;

                //generate config file
                case "2":
                    #region generate config file
                    if (File.Exists("Configuration.txt"))
                    {
                        Console.WriteLine("Configuration file already exists, overwrite with new one? (y)");
                        if (Console.ReadKey().Key.ToString().ToLower() != "y")
                        {
                            Console.WriteLine("Cancel..");
                            continue;
                        }
                    }

                    Configuration config = new Configuration()
                    {
                        ImagePath     = "PATH_TO_IMAGE_FOLDER",
                        ResultPath    = "PATH_TO_RESULTS_FOLDER",
                        LogPath       = "PATH_TO_LOG_FOLDER",
                        PP_CustomerId = 0,
                        PP_ClientGUID = "PP_CLIENT_GUID",
                        PP_Email      = "PP_EMAIL",
                        PP_Password   = "******"
                    };

                    File.WriteAllText("Configuration.txt", JsonConvert.SerializeObject(config, Formatting.Indented));

                    FileInfo fi = new FileInfo("Configuration.txt");
                    Console.WriteLine("Configuration file generated: " + fi.FullName);
                    #endregion
                    break;

                default:
                    Console.WriteLine("Invalid input..");
                    break;
                }
            }
        }
Example #32
0
        public void CreateWorld()
        {
            PhysicsEntity physics = GetChild <PhysicsEntity>();
            WorldEntity   world   = GetChild <WorldEntity>();

            //world.RemoveAllEntity();

            MapInfo mapInfo = JsonConvert.DeserializeObject <MapInfo>(File.ReadAllText(GetChild <DataReaderEntity>().GetYAMLObject(@"YAML\ServerConfig.yml").GetData <string>("Map")));

            //Fountain
            SpawnInfo blueSpawnInfo = mapInfo.blueSpawn;

            world.AddChild(new Fountain(new Vector2(blueSpawnInfo.x, blueSpawnInfo.y), 0, blueSpawnInfo.regainRadius, Team.Blue, this));

            SpawnInfo redSpawnInfo = mapInfo.redSpawn;

            world.AddChild(new Fountain(new Vector2(redSpawnInfo.x, redSpawnInfo.y), 0, redSpawnInfo.regainRadius, Team.Red, this));

            //MinionRelayPoint
            Dictionary <Team, Dictionary <int, Dictionary <int, Vector2> > > points = new Dictionary <Team, Dictionary <int, Dictionary <int, Vector2> > >();

            points.Add(Team.Blue, new Dictionary <int, Dictionary <int, Vector2> >());
            points[Team.Blue].Add(0, new Dictionary <int, Vector2>());
            points[Team.Blue].Add(1, new Dictionary <int, Vector2>());
            points[Team.Blue].Add(2, new Dictionary <int, Vector2>());
            points.Add(Team.Red, new Dictionary <int, Dictionary <int, Vector2> >());
            points[Team.Red].Add(0, new Dictionary <int, Vector2>());
            points[Team.Red].Add(1, new Dictionary <int, Vector2>());
            points[Team.Red].Add(2, new Dictionary <int, Vector2>());
            foreach (var minionRelayPoint in mapInfo.minionRelayPoints)
            {
                points[minionRelayPoint.blueTeam ? Team.Blue : Team.Red][minionRelayPoint.laneNum].Add(minionRelayPoint.index, new Vector2(minionRelayPoint.x, minionRelayPoint.y));
            }

            //Core
            CoreInfo blueCoreInfo = mapInfo.blueCore;

            world.AddChild(new Core(points[Team.Blue], new Vector2(blueCoreInfo.x, blueCoreInfo.y), blueCoreInfo.angle, blueCoreInfo.radius, Team.Blue, this));

            CoreInfo redCoreInfo = mapInfo.redCore;

            world.AddChild(new Core(points[Team.Red], new Vector2(redCoreInfo.x, redCoreInfo.y), redCoreInfo.angle, redCoreInfo.radius, Team.Red, this));

            world.GetChildren <Core>().ToList().ForEach(x => x.SetGoal());

            //Tower
            foreach (var towerInfo in mapInfo.towers)
            {
                world.AddChild(new Tower(towerInfo.height, new Vector2(towerInfo.x, towerInfo.y), towerInfo.angle, towerInfo.radius, towerInfo.blueTeam ? Team.Blue : Team.Red, this));
            }

            //Monster
            foreach (var monsterInfo in mapInfo.monsters)
            {
                world.AddChild(new Monster(monsterInfo.chaseRadius, monsterInfo.respawnTime, new Vector2(monsterInfo.x, monsterInfo.y), monsterInfo.angle, 0.3f, monsterInfo.type, this));
            }

            foreach (var edgeInfo in mapInfo.edges)
            {
                physics.CreateEdgeWall(new Vector2(edgeInfo.x0, edgeInfo.y0), new Vector2(edgeInfo.x1, edgeInfo.y1));
            }

            foreach (var circleInfo in mapInfo.circles)
            {
                physics.CreateCircleWall(circleInfo.radius, new Vector2(circleInfo.x, circleInfo.y));
            }

            foreach (var bushInfo in mapInfo.bushes)
            {
                List <Vector2> vertices = new List <Vector2>();
                vertices.Add(new Vector2(bushInfo.x0, bushInfo.y0));
                vertices.Add(new Vector2(bushInfo.x1, bushInfo.y1));
                vertices.Add(new Vector2(bushInfo.x2, bushInfo.y2));
                vertices.Add(new Vector2(bushInfo.x3, bushInfo.y3));
                physics.CreateBush(vertices);
            }

            GetChild <PathfindingEntity>().Load(GetChild <DataReaderEntity>().GetYAMLObject(@"YAML\ServerConfig.yml").GetData <string>("NavMesh"));
        }
Example #33
0
        private TreeNode CreateCoreTree(CoreInfo ci)
        {
            var ret = new TreeNode
            {
                Text = ci.CoreName + (ci.Released ? string.Empty : " (UNRELEASED)"),
                ForeColor = ci.Released ? Color.Black : Color.DarkGray
            };

            foreach (var service in ci.Services.Values)
            {
                string img = service.Complete ? "Good" : "Bad";
                var serviceNode = new TreeNode
                {
                    Text = service.TypeName,
                    ForeColor = service.Complete ? Color.Black : Color.Red,
                    ImageKey = img,
                    SelectedImageKey = img,
                    StateImageKey = img
                };

                foreach (var function in service.Functions)
                {
                    img = function.Complete ? "Good" : "Bad";
                    serviceNode.Nodes.Add(new TreeNode
                    {
                        Text = function.TypeName,
                        ForeColor = function.Complete ? Color.Black : Color.Red,
                        ImageKey = img,
                        SelectedImageKey = img,
                        StateImageKey = img
                    });
                }
                ret.Nodes.Add(serviceNode);
            }

            var knownServies = Assembly.GetAssembly(typeof(IEmulator))
                .GetTypes()
                .Where(t => typeof(IEmulatorService).IsAssignableFrom(t))
                .Where(t => t != typeof(IEmulatorService))
                .Where(t => t.IsInterface);

            var additionalServices = knownServies
                .Where(t => !ci.Services.ContainsKey(t.ToString()))
                .Where(t => !ci.NotApplicableTypes.Contains(t.ToString()))
                .Where(t => !typeof(ISpecializedEmulatorService).IsAssignableFrom(t)); // We don't want to show these as unimplemented, they aren't expected services

            foreach (Type service in additionalServices)
            {
                string img = "Bad";
                var serviceNode = new TreeNode
                {
                    Text = service.ToString(),
                    ForeColor = Color.Red,
                    ImageKey = img,
                    SelectedImageKey = img,
                    StateImageKey = img
                };
                ret.Nodes.Add(serviceNode);
            }
            return ret;
        }
Example #34
0
    static void ExportJson(string filename)
    {
        SpawnInfo blueSpawn = null, redSpawn = null;

        foreach (var obj in GameObject.FindGameObjectsWithTag("Spawn"))
        {
            SpawnBuilder builder = obj.GetComponent <SpawnBuilder>();
            if (builder.blueTeam)
            {
                blueSpawn = builder.GetInfo();
            }
            else
            {
                redSpawn = builder.GetInfo();
            }
        }

        CoreInfo blueCore = null, redCore = null;

        foreach (var obj in GameObject.FindGameObjectsWithTag("Core"))
        {
            CoreBuilder builder = obj.GetComponent <CoreBuilder>();
            if (builder.blueTeam)
            {
                blueCore = builder.GetInfo();
            }
            else
            {
                redCore = builder.GetInfo();
            }
        }

        List <TowerInfo> towers = new List <TowerInfo>();

        foreach (var obj in GameObject.FindGameObjectsWithTag("Tower"))
        {
            towers.Add(obj.GetComponent <TowerBuilder>().GetInfo());
        }

        List <MonsterInfo> monsters = new List <MonsterInfo>();

        foreach (var obj in GameObject.FindGameObjectsWithTag("Monster"))
        {
            monsters.Add(obj.GetComponent <MonsterBuilder>().GetInfo());
        }

        List <MinionRelayPointInfo> minionRelayPoints = new List <MinionRelayPointInfo>();

        foreach (var obj in GameObject.FindGameObjectsWithTag("MinionRelayPoint"))
        {
            minionRelayPoints.Add(obj.GetComponent <MinionRelayPointBuilder>().GetInfo());
        }

        List <EdgeInfo> edges = new List <EdgeInfo>();

        foreach (var obj in GameObject.FindGameObjectsWithTag("Edge"))
        {
            edges.Add(obj.GetComponent <EdgeBuilder>().GetInfo());
        }

        List <CircleInfo> circles = new List <CircleInfo>();

        foreach (var obj in GameObject.FindGameObjectsWithTag("Circle"))
        {
            circles.Add(obj.GetComponent <CircleBuilder>().GetInfo());
        }

        List <BushInfo> bushes = new List <BushInfo>();

        foreach (var obj in GameObject.FindGameObjectsWithTag("Bush"))
        {
            bushes.Add(obj.GetComponent <BushBuilder>().GetInfo());
        }

        MapInfo mapInfo = new MapInfo()
        {
            blueSpawn         = blueSpawn,
            redSpawn          = redSpawn,
            blueCore          = blueCore,
            redCore           = redCore,
            towers            = towers.ToArray(),
            monsters          = monsters.ToArray(),
            minionRelayPoints = minionRelayPoints.ToArray(),
            edges             = edges.ToArray(),
            circles           = circles.ToArray(),
            bushes            = bushes.ToArray()
        };

        string       json = JsonConvert.SerializeObject(mapInfo);
        StreamWriter sw   = new StreamWriter(filename + ".json", false);

        sw.WriteLine(json);
        sw.Flush();
        sw.Close();
    }