Beispiel #1
0
        public CharaMakeCustomizeFeature GetCharaMakeCustomizeFeature(int index, bool getBitMap)
        {
            try
            {
                using (TextFieldParser parser = new TextFieldParser(new StringReader(Resources.charamakecustomize_exh)))
                {
                    parser.TextFieldType = FieldType.Delimited;
                    parser.SetDelimiters(",");
                    int rowCount = 0;
                    parser.ReadFields();
                    while (!parser.EndOfData)
                    {
                        if (rowCount != index)
                        {
                            rowCount++;
                            parser.ReadFields();
                            continue;
                        }

                        CharaMakeCustomizeFeature feature = new CharaMakeCustomizeFeature();

                        feature.Index = index;

                        //Processing row
                        rowCount++;
                        string[] fields = parser.ReadFields();
                        int      fCount = 0;

                        foreach (string field in fields)
                        {
                            fCount++;

                            if (fCount == 2)
                            {
                                feature.FeatureID = int.Parse(field);
                            }

                            if (fCount == 3)
                            {
                                if (getBitMap)
                                {
                                    object O = Properties.Resources.ResourceManager.GetObject($"_{field}_tex");
                                    feature.Icon = (Image)O;
                                }
                            }
                        }

                        return(feature);
                    }
                }
            }
            catch (Exception exc)
            {
#if DEBUG
                throw exc;
#endif
            }

            return(null);
        }
Beispiel #2
0
        public void MakeCharaMakeFeatureList()
        {
            CharaMakeFeatures = new Dictionary <int, CharaMakeCustomizeFeature>();

            try
            {
                using (TextFieldParser parser = new TextFieldParser(new StringReader(Resources.charamakecustomize_exh)))
                {
                    parser.TextFieldType = FieldType.Delimited;
                    parser.SetDelimiters(",");
                    int rowCount = 0;
                    parser.ReadFields();
                    while (!parser.EndOfData)
                    {
                        CharaMakeCustomizeFeature feature = new CharaMakeCustomizeFeature();

                        feature.Index = rowCount;
                        //Processing row
                        rowCount++;
                        string[] fields = parser.ReadFields();
                        int      fCount = 0;

                        foreach (string field in fields)
                        {
                            fCount++;

                            if (fCount == 2)
                            {
                                feature.FeatureID = int.Parse(field);
                            }

                            if (fCount == 3)
                            {
                                object O = Properties.Resources.ResourceManager.GetObject($"_{field}_tex"); //Return an object from the image chan1.png in the project
                                feature.Icon = (Image)O;                                                    //Set the Image property of channelPic to the returned object as Image
                            }
                        }

                        //     Console.WriteLine($"{rowCount} - {feature.FeatureID}");
                        CharaMakeFeatures.Add(rowCount, feature);
                    }

                    //    Console.WriteLine($"{rowCount} charaMakeFeatures read");
                }
            }
            catch (Exception exc)
            {
                CharaMakeFeatures = null;
#if DEBUG
                throw exc;
#endif
            }
        }
Beispiel #3
0
        public void MakeCharaMakeFeatureList()
        {
            CharaMakeFeatures = new Dictionary <int, CharaMakeCustomizeFeature>();
            try
            {
                var sheet    = MainWindow.Realm.GameData.GetSheet <SaintCoinach.Xiv.CharaMakeCustomize>();
                int rowCount = 0;
                foreach (var test in sheet)
                {
                    rowCount++;
                    CharaMakeCustomizeFeature feature = new CharaMakeCustomizeFeature
                    {
                        //   Console.WriteLine($"{test.Key},{test.FeatureID}");
                        Index     = test.Key,
                        FeatureID = test.FeatureID
                    };
                    try
                    {
                        if (test.Icon == null)
                        {
                            feature.Icon = SpecialControl.GetImageStream((System.Drawing.Image)Properties.Resources.ResourceManager.GetObject("Corrupted"));
                        }
                        else
                        {
                            feature.Icon = CreateSource(test.Icon);
                        }
                    }
                    catch
                    {
                        using (StreamWriter writer = new StreamWriter("ErrorLog.txt", true))
                        {
                            writer.WriteLine($"Feature Image File ID Corrupted: {test.Key}");
                        }

                        feature.Icon = SpecialControl.GetImageStream((System.Drawing.Image)Properties.Resources.ResourceManager.GetObject("Corrupted"));
                    }
                    CharaMakeFeatures.Add(rowCount, feature);
                }
            }
            catch (Exception)
            {
            }
        }