Пример #1
0
        private static PA_DATA[] LoadCharacterAbilities(CharacterPresetId presetId)
        {
            try
            {
                String inputPath = DataResources.GetCsvCharacterAbilitiesPath(presetId);

                if (!File.Exists(inputPath))
                {
                    throw new FileNotFoundException($"File with {presetId}'s abilities not found: [{inputPath}]");
                }

                CharacterAbility[] abilities = CsvReader.Read <CharacterAbility>(inputPath);
                if (abilities.Length != 48)
                {
                    throw new NotSupportedException($"You must set 48 abilities, but there {abilities.Length}. Any number of abilities will be available after a game stabilization."); // TODO Json, Player, SettingsState, EqupUI, ff9feqp
                }
                PA_DATA[] result = new PA_DATA[abilities.Length];
                for (Int32 i = 0; i < abilities.Length; i++)
                {
                    CharacterAbility source = abilities[i];
                    result[i] = new PA_DATA(source.Id, source.Ap);
                }
                return(result);
            }
            catch (Exception ex)
            {
                throw new FileLoadException($"Failed to load {presetId}'s  learnable abilities.", ex);
            }
        }
Пример #2
0
        private static void OnHtmlTextChange(DependencyObject sender, DependencyPropertyChangedEventArgs e)
        {
            var obj      = sender as HtmlTextView;
            var template = DataResources.ReadFileFromResource("PlayniteUI.Resources.DescriptionView.html");

            template = template.Replace("{foreground}", obj.HtmlForeground.ToHtml());
            template = template.Replace("{link_foreground}", obj.LinkForeground.ToHtml());
            template = template.Replace("{font_family}", obj.HtmlFontFamily.ToString());
            obj.Text = template.Replace("{text}", e.NewValue?.ToString());
        }
 public void LoadFile(DataResources sourceType)
 {
     //ResourceManager.GetString(sourceType.ToString());
     var             assembly     = Assembly.GetExecutingAssembly();
     ResourceManager rm           = new ResourceManager("MockDataGenerator.Properties.Resources", assembly);
     MemoryStream    loadedSource = new MemoryStream(Encoding.ASCII.GetBytes(rm.GetString(sourceType.ToString())));
     //string resourceName = String.Format("{0}.{1}.txt", applicationResource, sourceType.ToString());
     //loadedSource = (MemoryStream)assembly.GetManifestResourceStream(resourceName);
     //LoadControl();
 }
Пример #4
0
 public static void Buildrule(SingleFieldDataSourceRule aRule, DataResources typeofInternalSource, int maxRecs, string startRange, string endRange, string regularExpression)
 {
     try
     {
         aRule.RangeStart        = startRange;
         aRule.RangeEnd          = endRange;
         aRule.RegularExpression = regularExpression;
         aRule.MaxRecords        = maxRecs;
     }
     catch (Exception e)
     {
         throw new Exception("Build SingleFieldDataSource rule failed");
     }
 }
Пример #5
0
 public static void Buildrule(MultiFieldDataSourceRule aRule, DataResources typeofInternalSource, int maxRecs, List <SearchField> selected, List <DataField> fieldDataMap, ListCtrlType ctrlType)
 {
     try
     {
         aRule.TypeofInternalSource = typeofInternalSource;
         aRule.SearchFields         = selected;
         aRule.FieldColumnMap       = fieldDataMap;
         aRule.MaxRecords           = maxRecs;
         aRule.SearchFields         = selected;
     }
     catch (Exception e)
     {
         throw new Exception("Build MultiField rule failed");
     }
 }
Пример #6
0
 public static ItemData FromItemBuildFileLine(string line)
 {
     //"item"   "item_id" 
     //上記形式 空白の数は不定 ""で囲ってない場合知らん
     if (string.IsNullOrEmpty(line))
     {
         return(null);
     }
     line = line.Trim();
     string[] temp = line.Split('"');
     if (temp.Length > 4)
     {
         return(DataResources.FindItemData(temp[3]));
     }
     return(null);
 }
        private void lstSources_SelectedIndexChanged(object sender, EventArgs e)
        {
            DataResources aSource = (DataResources)Enum.Parse(typeof(DataResources), lstSources.SelectedItem.ToString().Replace(" ", "_"));

            if (lastCtrl != null)
            {
                this.mainPanel.Controls.Remove((UserControl)lastCtrl);
            }
            switch (aSource)
            {
            case DataResources.Occupations:
            case DataResources.US_Companies:
            case DataResources.LastNames:
            case DataResources.List_Of_Streets:
            case DataResources.List_Of_Countires:
            case DataResources.Male_Names:
            case DataResources.Female_Names:
            case DataResources.European_Companies:
                lastCtrl = new SingleColumnListCtrl();
                break;

            case DataResources.US_Cities:
            case DataResources.Industry_Sectors:
                lastCtrl = new TreeListCtrl();
                break;

            case DataResources.List_Of_US_States:
            case DataResources.US_PostalCodes:
                lastCtrl = new MultiColumnListCrl();
                break;
            }

            lastCtrl.SourceType = aSource;
            this.mainPanel.Controls.Add(lastCtrl, 1, 0);
            this.mainPanel.SetRowSpan(lastCtrl, 2);
            lastCtrl.Dock = DockStyle.Fill;
            lastCtrl.LoadFile(aSource);
            if (editMode)
            {
                lastCtrl.EditRule(Result);
                editMode = false;
            }
        }