//create a warp image without specifying dtype public WarpImageGeneric(uint uWidth, uint uHeight) { ra = new Coord(); dec = new Coord(); width = uWidth; height = uHeight; oName = ""; notes = ""; if (typeof(T) == typeof(double)) { idType = DTYPE.DOUBLE; } else if (typeof(T) == typeof(float)) { idType = DTYPE.FLOAT; } else if (typeof(T) == typeof(byte)) { idType = DTYPE.BYTE; } else if (typeof(T) == typeof(ushort)) { idType = DTYPE.INT16; } else if (typeof(T) == typeof(uint)) { idType = DTYPE.INT32; } else { throw new InvalidOperationException("Data type not a valid numeric type."); } data = new T[height, width]; }
public AdvancedPropertyList(ref UserData user_data) { if (user_data == null) { return; } Add(new AbilityBinding <double>(EnumItemOptionTable_Kor.DTYPE_KOR[DTYPE.ASPD], user_data.User_Item.Option_DTYPE[Enum.GetName(typeof(DTYPE), DTYPE.ASPD)], 0, Enum.GetName(typeof(DTYPE), DTYPE.ASPD))); Add(new AbilityBinding <double>(EnumItemOptionTable_Kor.DTYPE_KOR[DTYPE.MOVING_SPEED], user_data.User_Item.Option_DTYPE[Enum.GetName(typeof(DTYPE), DTYPE.MOVING_SPEED)], 0, Enum.GetName(typeof(DTYPE), DTYPE.MOVING_SPEED))); foreach (KeyValuePair <string, double> item in user_data.User_Item.Option_ITYPE) { ITYPE itype = (ITYPE)Enum.Parse(typeof(ITYPE), item.Key); if (EnumList.NormalProperty.Contains(itype)) { continue; } Add(new AbilityBinding <double>(EnumItemOptionTable_Kor.ITYPE_KOR[itype], (int)user_data.User_Item.Option_ITYPE[item.Key], 0, Enum.GetName(typeof(ITYPE), itype))); } foreach (KeyValuePair <string, double> item in user_data.User_Item.Option_DTYPE) { DTYPE dtype = (DTYPE)Enum.Parse(typeof(DTYPE), item.Key); if ((dtype == DTYPE.ASPD) || (dtype == DTYPE.MOVING_SPEED)) { continue; } Add(new AbilityBinding <double>(EnumItemOptionTable_Kor.DTYPE_KOR[dtype], user_data.User_Item.Option_DTYPE[item.Key], 0, Enum.GetName(typeof(DTYPE), dtype))); } }
//create a WarpImage of type DTYPE public WarpImageGeneric(uint uWidth, uint uHeight, DTYPE uType) { switch (uType) { case DTYPE.DOUBLE: { if (typeof(T) != typeof(double)) { throw new InvalidOperationException("Invlid Image Data type, expected " + typeof(double) + " got " + typeof(T)); } break; } case DTYPE.FLOAT: { if (typeof(T) != typeof(float)) { throw new InvalidOperationException("Invlid Image Data type, expected " + typeof(float) + " got " + typeof(T)); } break; } case DTYPE.BYTE: { if (typeof(T) != typeof(byte)) { throw new InvalidOperationException("Invlid Image Data type, expected " + typeof(byte) + " got " + typeof(T)); } break; } case DTYPE.INT16: { if (typeof(T) != typeof(ushort)) { throw new InvalidOperationException("Invlid Image Data type, expected " + typeof(ushort) + " got " + typeof(T)); } break; } case DTYPE.INT32: { if (typeof(T) != typeof(uint)) { throw new InvalidOperationException("Invlid Image Data type, expected " + typeof(uint) + " got " + typeof(T)); } break; } } ra = new Coord(); dec = new Coord(); width = uWidth; height = uHeight; oName = ""; notes = ""; idType = uType; data = new T[height, width]; }
//specify all fields of a complete warp image public WarpImageGeneric(uint uWidth, uint uHeight, DTYPE uType, string uOname, string uNotes, Coord uRA, Coord uDEC, T[,] uData) { switch (uType) { case DTYPE.DOUBLE: { if (typeof(T) != typeof(double)) { throw new InvalidOperationException("Invlid Image Data type, expected " + typeof(double) + " got " + typeof(T)); } break; } case DTYPE.FLOAT: { if (typeof(T) != typeof(float)) { throw new InvalidOperationException("Invlid Image Data type, expected " + typeof(float) + " got " + typeof(T)); } break; } case DTYPE.BYTE: { if (typeof(T) != typeof(byte)) { throw new InvalidOperationException("Invlid Image Data type, expected " + typeof(byte) + " got " + typeof(T)); } break; } case DTYPE.INT16: { if (typeof(T) != typeof(ushort)) { throw new InvalidOperationException("Invlid Image Data type, expected " + typeof(ushort) + " got " + typeof(T)); } break; } case DTYPE.INT32: { if (typeof(T) != typeof(uint)) { throw new InvalidOperationException("Invlid Image Data type, expected " + typeof(uint) + " got " + typeof(T)); } break; } } width = uWidth; height = uHeight; idType = uType; oName = uOname; notes = uNotes; ra = uRA; dec = uDEC; CopyData(ref data, uData, width, height); }
internal void SetTypeInfo() { // check user defined type first if (DTYPE.ToUpper() == "TABLE TYPE") { _typeInfo = new TypeInfo(UDT_SCHEMA, UDT_NAME); return; } // CLR compliant types _typeInfo = TypeMapping.GetClrTypeInfo(DTYPE, LENGTH, PRECISION, SCALE); }
public WarpImageGeneric(WarpImageGeneric <T> uImage) { idType = uImage.idType; ra = uImage.ra; dec = uImage.dec; oName = uImage.oName; notes = uImage.notes; width = uImage.width; height = uImage.height; data = new T[height, width]; CopyData(ref data, uImage.data, width, height); }
private void Add_Option_Click(object sender, RoutedEventArgs e) { StackPanel parentStackpanel = ((sender as Button).Parent as StackPanel).Parent as StackPanel; StackPanel OptionStack = parentStackpanel.Children[0] as StackPanel; ComboBox AddType = OptionStack.Children[0] as ComboBox; TextBox AddValue = OptionStack.Children[1] as TextBox; //if (DB_ListBox.SelectedItem == null) // return; if (Convert.ToInt32(AddValue.Text) == 0) { return; } string typeName = Convert.ToString(AddType.SelectedItem); switch (Convert.ToString(parentStackpanel.Tag)) { case "ITYPE": { ITYPE type = (ITYPE)Enum.Parse(typeof(ITYPE), typeName); now_item.i_option[type] = Convert.ToInt32(AddValue.Text); break; } case "DTYPE": { DTYPE type = (DTYPE)Enum.Parse(typeof(DTYPE), typeName); now_item.d_option[type] = Convert.ToDouble(AddValue.Text); break; } case "SETYPE": { STATUS_EFFECT_TYPE type = (STATUS_EFFECT_TYPE)Enum.Parse(typeof(STATUS_EFFECT_TYPE), typeName); now_item.se_option[type] = Convert.ToDouble(AddValue.Text); break; } case "IFTYPE": { TextBox PerValue = OptionStack.Children[2] as TextBox; IFTYPE type = (IFTYPE)Enum.Parse(typeof(IFTYPE), typeName); now_item.if_option[type] = new AbilityPerStatus(type, Convert.ToInt32(AddValue.Text), Convert.ToInt32(PerValue.Text)); break; } } SetNowItemOption(); AddType.SelectedIndex = 0; AddValue.Text = "0"; }
private void Del_Option_Click(object sender, RoutedEventArgs e) { StackPanel parentStackpanel = ((sender as Button).Parent as StackPanel).Parent as StackPanel; ListBox OptionList = parentStackpanel.Children[2] as ListBox; if (OptionList.SelectedItem == null) { return; } if (DB_ListBox.SelectedItem == null) { return; } switch (Convert.ToString(parentStackpanel.Tag)) { case "ITYPE": { string typeName = (OptionList.SelectedItem as ItemOption_Binding <ITYPE, int>).Type_name; ITYPE type = (ITYPE)Enum.Parse(typeof(ITYPE), typeName); now_item.i_option.Remove(type); break; } case "DTYPE": { string typeName = (OptionList.SelectedItem as ItemOption_Binding <DTYPE, double>).Type_name; DTYPE type = (DTYPE)Enum.Parse(typeof(DTYPE), typeName); now_item.d_option.Remove(type); break; } case "SETYPE": { string typeName = (OptionList.SelectedItem as ItemOption_Binding <STATUS_EFFECT_TYPE, double>).Type_name; STATUS_EFFECT_TYPE type = (STATUS_EFFECT_TYPE)Enum.Parse(typeof(STATUS_EFFECT_TYPE), typeName); now_item.se_option.Remove(type); break; } case "IFTYPE": { string typeName = (OptionList.SelectedItem as ItemOption_Binding).Type_name; IFTYPE type = (IFTYPE)Enum.Parse(typeof(IFTYPE), typeName); now_item.if_option.Remove(type); break; } } SetNowItemOption(); }
public static ITEM_OPTION_TYPE GET_ITEM_OPTION_TYPE(ref string option_name) { string intput_name = option_name; if (ITYPE_KOR.ContainsValue(option_name)) { ITYPE type = ITYPE_KOR.FirstOrDefault(x => x.Value == intput_name).Key; option_name = Enum.GetName(typeof(ITYPE), type); return(ITEM_OPTION_TYPE.ITYPE); } if (DTYPE_KOR.ContainsValue(option_name)) { DTYPE type = DTYPE_KOR.FirstOrDefault(x => x.Value == intput_name).Key; option_name = Enum.GetName(typeof(DTYPE), type); return(ITEM_OPTION_TYPE.DTYPE); } if (SE_ATK_RATE_TYPE_KOR.ContainsValue(option_name)) { SE_ATK_RATE_TYPE type = SE_ATK_RATE_TYPE_KOR.FirstOrDefault(x => x.Value == intput_name).Key; option_name = Enum.GetName(typeof(SE_ATK_RATE_TYPE), type); return(ITEM_OPTION_TYPE.SE_ATK_RATE_TYPE); } if (SE_REG_RATE_TYPE_KOR.ContainsValue(option_name)) { SE_REG_RATE_TYPE type = SE_REG_RATE_TYPE_KOR.FirstOrDefault(x => x.Value == intput_name).Key; option_name = Enum.GetName(typeof(SE_REG_RATE_TYPE), type); return(ITEM_OPTION_TYPE.SE_REG_RATE_TYPE); } if (TRIBE_DMG_TYPE_KOR.ContainsValue(option_name)) { TRIBE_DMG_TYPE type = TRIBE_DMG_TYPE_KOR.FirstOrDefault(x => x.Value == intput_name).Key; option_name = Enum.GetName(typeof(TRIBE_DMG_TYPE), type); return(ITEM_OPTION_TYPE.TRIBE_DMG_TYPE); } if (TRIBE_REG_TYPE_KOR.ContainsValue(option_name)) { TRIBE_REG_TYPE type = TRIBE_REG_TYPE_KOR.FirstOrDefault(x => x.Value == intput_name).Key; option_name = Enum.GetName(typeof(TRIBE_REG_TYPE), type); return(ITEM_OPTION_TYPE.TRIBE_REG_TYPE); } if (MONSTER_KINDS_DMG_TYPE_KOR.ContainsValue(option_name)) { MONSTER_KINDS_DMG_TYPE type = MONSTER_KINDS_DMG_TYPE_KOR.FirstOrDefault(x => x.Value == intput_name).Key; option_name = Enum.GetName(typeof(MONSTER_KINDS_DMG_TYPE), type); return(ITEM_OPTION_TYPE.MONSTER_KINDS_DMG_TYPE); } if (MONSTER_KINDS_REG_TYPE_KOR.ContainsValue(option_name)) { MONSTER_KINDS_REG_TYPE type = MONSTER_KINDS_REG_TYPE_KOR.FirstOrDefault(x => x.Value == intput_name).Key; option_name = Enum.GetName(typeof(MONSTER_KINDS_REG_TYPE), type); return(ITEM_OPTION_TYPE.MONSTER_KINDS_REG_TYPE); } if (MONSTER_SIZE_DMG_TYPE_KOR.ContainsValue(option_name)) { MONSTER_SIZE_DMG_TYPE type = MONSTER_SIZE_DMG_TYPE_KOR.FirstOrDefault(x => x.Value == intput_name).Key; option_name = Enum.GetName(typeof(MONSTER_SIZE_DMG_TYPE), type); return(ITEM_OPTION_TYPE.MONSTER_SIZE_DMG_TYPE); } if (MONSTER_SIZE_REG_TYPE_KOR.ContainsValue(option_name)) { MONSTER_SIZE_REG_TYPE type = MONSTER_SIZE_REG_TYPE_KOR.FirstOrDefault(x => x.Value == intput_name).Key; option_name = Enum.GetName(typeof(MONSTER_SIZE_REG_TYPE), type); return(ITEM_OPTION_TYPE.MONSTER_SIZE_REG_TYPE); } if (MONSTER_ELEMENT_DMG_TYPE_KOR.ContainsValue(option_name)) { MONSTER_ELEMENT_DMG_TYPE type = MONSTER_ELEMENT_DMG_TYPE_KOR.FirstOrDefault(x => x.Value == intput_name).Key; option_name = Enum.GetName(typeof(MONSTER_ELEMENT_DMG_TYPE), type); return(ITEM_OPTION_TYPE.MONSTER_ELEMENT_DMG_TYPE); } if (ELEMENT_DMG_TYPE_KOR.ContainsValue(option_name)) { ELEMENT_DMG_TYPE type = ELEMENT_DMG_TYPE_KOR.FirstOrDefault(x => x.Value == intput_name).Key; option_name = Enum.GetName(typeof(ELEMENT_DMG_TYPE), type); return(ITEM_OPTION_TYPE.ELEMENT_DMG_TYPE); } if (ELEMENT_REG_TYPE_KOR.ContainsValue(option_name)) { ELEMENT_REG_TYPE type = ELEMENT_REG_TYPE_KOR.FirstOrDefault(x => x.Value == intput_name).Key; option_name = Enum.GetName(typeof(ELEMENT_REG_TYPE), type); return(ITEM_OPTION_TYPE.ELEMENT_REG_TYPE); } if (ETC_DMG_TYPE_KOR.ContainsValue(option_name)) { ETC_DMG_TYPE type = ETC_DMG_TYPE_KOR.FirstOrDefault(x => x.Value == intput_name).Key; option_name = Enum.GetName(typeof(ETC_DMG_TYPE), type); return(ITEM_OPTION_TYPE.ETC_DMG_TYPE); } if (ETC_TYPE_KOR.ContainsValue(option_name)) { ETC_TYPE type = ETC_TYPE_KOR.FirstOrDefault(x => x.Value == intput_name).Key; option_name = Enum.GetName(typeof(ETC_TYPE), type); return(ITEM_OPTION_TYPE.ETC_TYPE); } return(ITEM_OPTION_TYPE.ETC_TYPE); }
public WarpImage16(uint uWidth, uint uHeight, DTYPE uType, string uOname, string uNotes, Coord uRA, Coord uDEC) : base(uWidth, uHeight, uType, uOname, uNotes, uRA, uDEC) { }
public WarpImage16(uint uWidth, uint uHeight, DTYPE uType) : base(uWidth, uHeight, uType) { }
public WarpImageF32(uint uWidth, uint uHeight, DTYPE uType, string uOname, string uNotes, Coord uRA, Coord uDEC, float[,] uData) : base(uWidth, uHeight, uType, uOname, uNotes, uRA, uDEC, uData) { }