protected override void addimage(location state, Brand brand, RotateFlipType rotate) { Bitmap bitmap; // �p�G�O�i�����P�N�]�w��ܵP���ϫ��A�_�h�N��ܪ��ߪ��P Resources.upbarnd if (brand.IsCanSee || state == location.South || ShowAll) bitmap = new Bitmap(brand.image); else bitmap = new Bitmap(Resources.upbarnd); // �]�w�P BrandBox tempBrandbox = new BrandBox(brand); // �]�w�۰��Y�� tempBrandbox.SizeMode = PictureBoxSizeMode.AutoSize; // �]�w��Z tempBrandbox.Margin = new Padding(0); tempBrandbox.Padding = new Padding(padding); // �n����� bitmap.RotateFlip(rotate); // ���� if (ShowAll && ShowBrandInfo) tempBrandbox.Click += new EventHandler(debug_Click); // �ƹ��ƥ� if ( state == location.South && brand.getClass() != Settings.Default.Flower && brand.Team < 1 ) { tempBrandbox.MouseMove += new MouseEventHandler(tempBrandbox_MouseMove); tempBrandbox.MouseLeave += new EventHandler(brandBox_MouseLeave); tempBrandbox.Click += new EventHandler(brandBox_MouseClick); // �@���ƥ� //if (ShowAll && ShowBrandInfo) // tempBrandbox.MouseHover += new EventHandler(debug_Click); //else // tempBrandbox.MouseHover -= new EventHandler(debug_Click); } else if (cheat && state != location.South) { tempBrandbox.MouseClick += new MouseEventHandler(cheat_MouseClick); } else { tempBrandbox.Click -= new EventHandler(brandBox_MouseClick); tempBrandbox.MouseClick -= new MouseEventHandler(cheat_MouseClick); } bitmap = ResizeBitmap(bitmap, Settings.Default.ResizePercentage); // �]�w�Ϥ� tempBrandbox.Image = bitmap; // �s�W�ܱ�� add_flowLayoutBrands(state, tempBrandbox); }
public ViewModel() { users = User.returnOneInstance(); msgs = Msg.returnOneInstance(); allOther = non_Observable.returnOneInstance(); checkCall = Msg_check.returnOneInstance(); loc = location.returnOneInstance(); }
public location Insert_location_select(int ID) { location = location.Select(ID); Insert_type_txt.Text = Convert.ToString(location.type); Insert_city_txt.Text = Convert.ToString(location.city); Insert_state_txt.Text = Convert.ToString(location.state); Insert_zip_txt.Text = Convert.ToString(location.zip); Insert_county_txt.Text = Convert.ToString(location.county); Insert_location_desc_txt.Text = Convert.ToString(location.location_desc); Insert_n_long_txt.Text = Convert.ToString(location.n_long); Insert_s_long_txt.Text = Convert.ToString(location.s_long); Insert_e_long_txt.Text = Convert.ToString(location.e_long); Insert_w_long_txt.Text = Convert.ToString(location.w_long); Insert_n_lat_txt.Text = Convert.ToString(location.n_lat); Insert_s_lat_txt.Text = Convert.ToString(location.s_lat); Insert_e_lat_txt.Text = Convert.ToString(location.e_lat); Insert_w_lat_txt.Text = Convert.ToString(location.w_lat); return location; }
public location Delete_location_select(int ID) { location = location.Select(ID); Delete_Location_ID_txt_lbl.Text = Convert.ToString(location.Location_ID); Delete_type_txt_lbl.Text = Convert.ToString(location.type); Delete_city_txt_lbl.Text = Convert.ToString(location.city); Delete_state_txt_lbl.Text = Convert.ToString(location.state); Delete_zip_txt_lbl.Text = Convert.ToString(location.zip); Delete_county_txt_lbl.Text = Convert.ToString(location.county); Delete_location_desc_txt_lbl.Text = Convert.ToString(location.location_desc); Delete_n_long_txt_lbl.Text = Convert.ToString(location.n_long); Delete_s_long_txt_lbl.Text = Convert.ToString(location.s_long); Delete_e_long_txt_lbl.Text = Convert.ToString(location.e_long); Delete_w_long_txt_lbl.Text = Convert.ToString(location.w_long); Delete_n_lat_txt_lbl.Text = Convert.ToString(location.n_lat); Delete_s_lat_txt_lbl.Text = Convert.ToString(location.s_lat); Delete_e_lat_txt_lbl.Text = Convert.ToString(location.e_lat); Delete_w_lat_txt_lbl.Text = Convert.ToString(location.w_lat); return location; }
//delegate void add_flowLayoutBrands_delegate(location state, BrandBox brandbox); public override void add_flowLayoutBrands(location state, BrandBox brandbox) { if (fl_Table.InvokeRequired) { fl_Table.Invoke(new add_flowLayoutBrands_delegate(add_flowLayoutBrands), new object[] { state, brandbox }); } else if (fl_Show_from_location(state).InvokeRequired) { fl_Show_from_location(state).Invoke(new add_flowLayoutBrands_delegate(add_flowLayoutBrands), new object[] { state, brandbox }); } else if (fl_Hand_from_location(state).InvokeRequired) { fl_Hand_from_location(state).Invoke(new add_flowLayoutBrands_delegate(add_flowLayoutBrands), new object[] { state, brandbox }); } else if (state == location.Table && brandbox.brand.IsCanSee == false) fl_Table.Controls.Add(brandbox); else if (brandbox.brand.IsCanSee == true && brandbox.brand.Team >= 1) fl_Show_from_location(state).Controls.Add(brandbox); else fl_Hand_from_location(state).Controls.Add(brandbox); }
private int CalculateQRB(string my_loc, string loc) { try { char[] from = new char[6]; char[] to = new char[6]; location from_spheric = new location(); location to_spheric = new location(); polar bearing = new polar(); int from_status, to_status; int distance = 0; my_loc = my_loc.ToLower(); loc = loc.ToLower(); from = my_loc.ToCharArray(); to = loc.ToCharArray(); from_status = convert(from, ref from_spheric); to_status = convert(to, ref to_spheric); if ((from_status + to_status) > 0) return (0); transform(ref from_spheric, ref to_spheric, ref bearing); distance = (int)bearing.distance; return distance; } catch (Exception ex) { Debug.Write(ex.ToString()); return 0; } }
private int transform(ref location from, ref location to, ref polar dd) { try { double temp, nominator, radius; radius = 180.0 / PI * (111.1451 + 0.56 * Math.Sin(to.latit + from.latit - PI / 2.0)); (dd.distance) = radius * Math.Acos(temp = (Math.Sin(to.latit) * Math.Sin(from.latit) + Math.Cos(to.latit) * Math.Cos(from.latit) * Math.Cos(to.longit - from.longit))); if (dd.distance < 0.1) { dd.direction = 0; } else { (dd.direction) = Math.Atan((Math.Cos(from.latit) * Math.Sin(to.longit - from.longit) * Math.Cos(to.latit)) / (nominator = (Math.Sin(to.latit) - temp * Math.Sin(from.latit)))); if (nominator < 0) dd.direction -= PI; if (dd.direction < 0) dd.direction += 2 * PI; } return 0; } catch (Exception ex) { Debug.Write(ex.ToString()); return 0; } }
public location location_insert() { location.type = Insert_type_txt.Text; location.city = Insert_city_txt.Text; location.state = Insert_state_txt.Text; location.zip = Convert.ToInt32(Insert_zip_txt.Text); location.county = Insert_county_txt.Text; location.location_desc = Insert_location_desc_txt.Text; location.n_long = Convert.ToDecimal(Insert_n_long_txt.Text); location.s_long = Convert.ToDecimal(Insert_s_long_txt.Text); location.e_long = Convert.ToDecimal(Insert_e_long_txt.Text); location.w_long = Convert.ToDecimal(Insert_w_long_txt.Text); location.n_lat = Convert.ToDecimal(Insert_n_lat_txt.Text); location.s_lat = Convert.ToDecimal(Insert_s_lat_txt.Text); location.e_lat = Convert.ToDecimal(Insert_e_lat_txt.Text); location.w_lat = Convert.ToDecimal(Insert_w_lat_txt.Text); location = location.Insert(location); Insert_location_GridView.DataBind(); Update_location_GridView.DataBind(); Delete_location_GridView.DataBind(); return location; }
public wrapped_common_type_node(PCUReader pr, type_node base_type, string name, SemanticTree.type_access_level type_access_level, common_namespace_node comprehensive_namespace, SymbolTable.ClassScope cs, location loc, int offset) : base(base_type, name, type_access_level, comprehensive_namespace, cs, loc) { this.pr = pr; this.offset = offset; }
/// <summary> /// �Ǧ^�u�ꪺ��m /// </summary> /// <param name="lo">��m</param> /// <returns>�����</returns> public location getRealPlace(location lo) { if (lo == location.North) return Up; else if (lo == location.South) return Down; else if (lo == location.East) return Right; else if (lo == location.West) return Left; return location.Table; }
protected void UPDATE(object sender, EventArgs e) { location = location_update(Convert.ToInt32(Update_location_GridView.SelectedValue)); }
return(obj.modData.ContainsKey(AutomationFactory.XSModDataKey) ? new Connector(location, tile) : null);
/// <summary> /// �ഫ����r�� /// </summary> /// <param name="lo">���</param> /// <returns>�r��</returns> internal string location_to_string(location lo) { if (lo == location.East) return Mahjong.Properties.Settings.Default.East; else if (lo == location.South) return Mahjong.Properties.Settings.Default.South; else if (lo == location.West) return Mahjong.Properties.Settings.Default.West; else if (lo == location.North) return Mahjong.Properties.Settings.Default.Nouth; else return ""; }
public OMP_ConstructionNotSupportedNow(location loc) : base(loc) { }
public OMP_BuildigError(Exception e, location loc) : base(e is CompilationErrorWithLocation ? ((CompilationErrorWithLocation)e).loc : loc) { _e = e; }
public ExtensionOperatorForPrimitiveType(location loc) : base(loc) { }
public OverrideOrReintroduceExpected(location loc) : base(loc) { }
public CompilerWarningWithLocation(location loc) { this.loc = loc; }
//public static async Task<bool> GenerateImageAsync(InMemoryRandomAccessStream ms, string newImageName) //{ // using (var a = ms.AsStream()) // { // byte[] b = new byte[a.Length]; // await a.ReadAsync(b, 0, (int)a.Length); // StorageFile sampleFile = await _originalFolder.CreateFileAsync(newImageName); // await FileIO.WriteBytesAsync(sampleFile, b); // } // return true; //} //public async Task<bool> GenerateResizedImageAsyncOld(int longWidth, double srcWidth, double srcHeight, InMemoryRandomAccessStream srcMemoryStream, string newImageName, location subFolder, int longHeight = 0) //{ // if (_localFolder == null) InitFolders(); // try // { // int width = 0, height = 0; // double factor = srcWidth / srcHeight; // if (factor < 1) // { // height = longWidth; // width = (int)(longWidth * factor); // } // else // { // width = longWidth; // height = (int)(longWidth / factor); // } // if (longHeight > 0) // { // width = longWidth; // height = longHeight; // } // WriteableBitmap wb = await BitmapFactory.New((int)srcWidth, (int)srcHeight).FromStream(srcMemoryStream); // //WRITEABLE BITMAP IS THROWING AN ERROR // var wbthumbnail = wb.Resize(width, height, Windows.UI.Xaml.Media.Imaging.WriteableBitmapExtensions.Interpolation.Bilinear); // switch (subFolder) // { // case location.MediumFolder: // StorageFile sampleFile1 = await _mediumFolder.CreateFileAsync(newImageName, CreationCollisionOption.ReplaceExisting); // await wbthumbnail.SaveToFile(sampleFile1, BitmapEncoder.PngEncoderId); // break; // case location.ThumbFolder: // StorageFile sampleFile2 = await _thumbFolder.CreateFileAsync(newImageName, CreationCollisionOption.ReplaceExisting); // await wbthumbnail.SaveToFile(sampleFile2, BitmapEncoder.PngEncoderId); // break; // case location.TileFolder: // StorageFile sampleFile3 = await _tileFolder.CreateFileAsync(newImageName, CreationCollisionOption.ReplaceExisting); // await wbthumbnail.SaveToFile(sampleFile3, BitmapEncoder.PngEncoderId); // break; // } // return true; // } // catch (Exception ex) // { // return false; // } //} public async Task<bool> GenerateResizedImageAsync(int longWidth, double srcWidth, double srcHeight, InMemoryRandomAccessStream srcMemoryStream, string newImageName, location subFolder, int longHeight = 0) { if (_localFolder == null) InitFolders(); if (srcMemoryStream.Size == 0) return false; try { int width = 0, height = 0; double factor = srcWidth / srcHeight; if (factor < 1) { height = longWidth; width = (int)(longWidth * factor); } else { width = longWidth; height = (int)(longWidth / factor); } if (longHeight > 0) { width = longWidth; height = longHeight; } if (subFolder == location.MediumFolder) { WriteableBitmap wb = await BitmapFactory.New((int)srcWidth, (int)srcHeight).FromStream(srcMemoryStream); var wbthumbnail = wb.Resize(width, height, Windows.UI.Xaml.Media.Imaging.WriteableBitmapExtensions.Interpolation.Bilinear); StorageFile sampleFile1 = await _mediumFolder.CreateFileAsync(newImageName, CreationCollisionOption.ReplaceExisting); await wbthumbnail.SaveToFile(sampleFile1, BitmapEncoder.PngEncoderId); } else if (subFolder == location.ThumbFolder) { WriteableBitmap wb = await BitmapFactory.New((int)srcWidth, (int)srcHeight).FromStream(srcMemoryStream); var wbthumbnail = wb.Resize(width, height, Windows.UI.Xaml.Media.Imaging.WriteableBitmapExtensions.Interpolation.Bilinear); StorageFile sampleFile2 = await _thumbFolder.CreateFileAsync(newImageName, CreationCollisionOption.ReplaceExisting); await wbthumbnail.SaveToFile(sampleFile2, BitmapEncoder.PngEncoderId); } else if (subFolder == location.TileFolder) { //https://social.msdn.microsoft.com/Forums/en-US/490b9c01-db4b-434f-8aff-d5c495e67e55/how-to-crop-an-image-using-bitmaptransform?forum=winappswithcsharp BitmapDecoder decoder = await BitmapDecoder.CreateAsync(srcMemoryStream); using (InMemoryRandomAccessStream ras = new InMemoryRandomAccessStream()) { BitmapEncoder enc = await BitmapEncoder.CreateForTranscodingAsync(ras, decoder); var h = longHeight / srcHeight; var w = longWidth / srcWidth; var r = Math.Max(h, w); enc.BitmapTransform.ScaledWidth = (uint)(srcWidth * r); enc.BitmapTransform.ScaledHeight = (uint)(srcHeight * r); BitmapBounds bounds = new BitmapBounds(); bounds.Width = (uint)longWidth; bounds.Height = (uint)longHeight; bounds.X = 0; bounds.Y = 0; enc.BitmapTransform.Bounds = bounds; await enc.FlushAsync(); WriteableBitmap wb = await BitmapFactory.New(longWidth, longHeight).FromStream(ras); StorageFile sampleFile3 = await _tileFolder.CreateFileAsync(newImageName, CreationCollisionOption.ReplaceExisting); await wb.SaveToFile(sampleFile3, BitmapEncoder.PngEncoderId); } } return true; } catch //(Exception ex) { return false; } }
private static void init_temp_methods_and_consts(common_namespace_node system_namespace, SymbolTable.Scope where_add, initialization_properties initialization_properties, location system_unit_location) { //SymbolTable.Scope sc = system_namespace.scope; SymbolTable.Scope sc = where_add; namespace_constant_definition _true_constant_definition = new namespace_constant_definition( PascalABCCompiler.TreeConverter.compiler_string_consts.true_const_name, SystemLibrary.true_constant, system_unit_location, system_namespace); system_namespace.constants.AddElement(_true_constant_definition); namespace_constant_definition _false_constant_definition = new namespace_constant_definition( PascalABCCompiler.TreeConverter.compiler_string_consts.false_const_name, SystemLibrary.false_constant, system_unit_location, system_namespace); system_namespace.constants.AddElement(_false_constant_definition); sc.AddSymbol(PascalABCCompiler.TreeConverter.compiler_string_consts.true_const_name, new PascalABCCompiler.TreeConverter.SymbolInfo(_true_constant_definition)); sc.AddSymbol(PascalABCCompiler.TreeConverter.compiler_string_consts.false_const_name, new PascalABCCompiler.TreeConverter.SymbolInfo(_false_constant_definition)); //TODO: Сделано по быстрому. Переделать. Можно просто один раз сериализовать модуль system и не инициализировать его всякий раз подобным образом. Неплохо-бы использовать NetHelper.GetMethod. Type tp = typeof(Console); compiled_function_node cfn; System.Type[] arr = new System.Type[1]; System.Reflection.MethodInfo mi; //TODO: Сделать узел или базовый метод создания и удаления объекта. common_namespace_function_node cnfn = new common_namespace_function_node(TreeConverter.compiler_string_consts.new_procedure_name, null, null, system_namespace, null); cnfn.parameters.AddElement(new common_parameter("ptr", SystemLibrary.pointer_type, SemanticTree.parameter_type.value, cnfn, concrete_parameter_type.cpt_var, null, null)); cnfn.SpecialFunctionKind = SemanticTree.SpecialFunctionKind.New; _NewProcedure = new PascalABCCompiler.TreeConverter.SymbolInfo(cnfn); _NewProcedure.symbol_kind = PascalABCCompiler.TreeConverter.symbol_kind.sk_overload_function; _NewProcedure.access_level = PascalABCCompiler.TreeConverter.access_level.al_public; _NewProcedureDecl = cnfn; sc.AddSymbol(TreeConverter.compiler_string_consts.new_procedure_name, _NewProcedure); cnfn = new common_namespace_function_node(TreeConverter.compiler_string_consts.dispose_procedure_name, null, null, system_namespace, null); cnfn.parameters.AddElement(new common_parameter("ptr", SystemLibrary.pointer_type, SemanticTree.parameter_type.value, cnfn, concrete_parameter_type.cpt_var, null, null)); _DisposeProcedure = new PascalABCCompiler.TreeConverter.SymbolInfo(cnfn); _DisposeProcedure.symbol_kind = PascalABCCompiler.TreeConverter.symbol_kind.sk_overload_function; _DisposeProcedure.access_level = PascalABCCompiler.TreeConverter.access_level.al_public; _DisposeProcedureDecl = cnfn; cnfn.SpecialFunctionKind = SemanticTree.SpecialFunctionKind.Dispose; sc.AddSymbol(TreeConverter.compiler_string_consts.dispose_procedure_name, _DisposeProcedure); cnfn = new common_namespace_function_node(TreeConverter.compiler_string_consts.new_array_procedure_name, compiled_type_node.get_type_node(typeof(Array)), null, system_namespace, null); cnfn.parameters.AddElement(new common_parameter("t", compiled_type_node.get_type_node(typeof(Type)), SemanticTree.parameter_type.value, cnfn, concrete_parameter_type.cpt_none, null, null)); cnfn.parameters.AddElement(new common_parameter("n", SystemLibrary.integer_type, SemanticTree.parameter_type.value, cnfn, concrete_parameter_type.cpt_none, null, null)); cnfn.SpecialFunctionKind = SemanticTree.SpecialFunctionKind.NewArray; _NewArrayProcedure = new PascalABCCompiler.TreeConverter.SymbolInfo(cnfn); _NewArrayProcedureDecl = cnfn; //sc.AddSymbol(TreeConverter.compiler_string_consts.new_procedure_name, _NewProcedure); basic_function_node break_procedure = new basic_function_node(SemanticTree.basic_function_type.none, null, true, PascalABCCompiler.TreeConverter.compiler_string_consts.break_procedure_name); break_procedure.compile_time_executor = initialization_properties.break_executor; sc.AddSymbol(PascalABCCompiler.TreeConverter.compiler_string_consts.break_procedure_name, new PascalABCCompiler.TreeConverter.SymbolInfo(break_procedure)); basic_function_node continue_procedure = new basic_function_node(SemanticTree.basic_function_type.none, null, true, PascalABCCompiler.TreeConverter.compiler_string_consts.continue_procedure_name); continue_procedure.compile_time_executor = initialization_properties.continue_executor; sc.AddSymbol(PascalABCCompiler.TreeConverter.compiler_string_consts.continue_procedure_name, new PascalABCCompiler.TreeConverter.SymbolInfo(continue_procedure)); basic_function_node exit_procedure = new basic_function_node(SemanticTree.basic_function_type.none, null, true, PascalABCCompiler.TreeConverter.compiler_string_consts.exit_procedure_name); exit_procedure.compile_time_executor = initialization_properties.exit_executor; sc.AddSymbol(PascalABCCompiler.TreeConverter.compiler_string_consts.exit_procedure_name, new PascalABCCompiler.TreeConverter.SymbolInfo(exit_procedure)); sc.AddSymbol(PascalABCCompiler.TreeConverter.compiler_string_consts.set_length_procedure_name, new PascalABCCompiler.TreeConverter.SymbolInfo(SystemLibrary.resize_func, PascalABCCompiler.TreeConverter.access_level.al_public, PascalABCCompiler.TreeConverter.symbol_kind.sk_overload_function)); }
/// <summary> /// �U�@�� /// </summary> public void nextPosition() { position = add(position); }
public static common_unit_node make_system_unit(SymbolTable.TreeConverterSymbolTable symbol_table, initialization_properties initialization_properties) { //TODO: В качестве location везде в этом методе следует указывать location system_unit-а. Имя файла мы знаем, а место - там где написано, что integer и прочие типы описаны как бы в модуле system. location system_unit_location = null; SymbolTable.UnitInterfaceScope main_scope = symbol_table.CreateUnitInterfaceScope(new SymbolTable.Scope[0]); SymbolTable.UnitImplementationScope impl_scope = symbol_table.CreateUnitImplementationScope(main_scope, new SymbolTable.Scope[0]); common_unit_node _system_unit = new common_unit_node(main_scope, impl_scope, null, null); common_namespace_node cnn = new common_namespace_node(null, _system_unit, PascalABCCompiler.TreeConverter.compiler_string_consts.system_unit_name, symbol_table.CreateScope(main_scope), system_unit_location); main_scope.AddSymbol(PascalABCCompiler.TreeConverter.compiler_string_consts.system_unit_name, new PascalABCCompiler.TreeConverter.SymbolInfo(cnn)); //SymbolTable.Scope sc = cnn.scope; SymbolTable.Scope sc = main_scope; //Добавляем типы. sc.AddSymbol(PascalABCCompiler.TreeConverter.compiler_string_consts.byte_type_name, new PascalABCCompiler.TreeConverter.SymbolInfo(SystemLibrary.byte_type)); //sc.AddSymbol(PascalABCCompiler.TreeConverter.compiler_string_consts.decimal_type_name, new PascalABCCompiler.TreeConverter.SymbolInfo(SystemLibrary.decimal_type)); sc.AddSymbol(PascalABCCompiler.TreeConverter.compiler_string_consts.sbyte_type_name, new PascalABCCompiler.TreeConverter.SymbolInfo(SystemLibrary.sbyte_type)); sc.AddSymbol(PascalABCCompiler.TreeConverter.compiler_string_consts.short_type_name, new PascalABCCompiler.TreeConverter.SymbolInfo(SystemLibrary.short_type)); sc.AddSymbol(PascalABCCompiler.TreeConverter.compiler_string_consts.ushort_type_name, new PascalABCCompiler.TreeConverter.SymbolInfo(SystemLibrary.ushort_type)); sc.AddSymbol(PascalABCCompiler.TreeConverter.compiler_string_consts.integer_type_name, new PascalABCCompiler.TreeConverter.SymbolInfo(SystemLibrary.integer_type)); sc.AddSymbol(PascalABCCompiler.TreeConverter.compiler_string_consts.uint_type_name, new PascalABCCompiler.TreeConverter.SymbolInfo(SystemLibrary.uint_type)); sc.AddSymbol(PascalABCCompiler.TreeConverter.compiler_string_consts.long_type_name, new PascalABCCompiler.TreeConverter.SymbolInfo(SystemLibrary.int64_type)); sc.AddSymbol(PascalABCCompiler.TreeConverter.compiler_string_consts.ulong_type_name, new PascalABCCompiler.TreeConverter.SymbolInfo(SystemLibrary.uint64_type)); sc.AddSymbol(PascalABCCompiler.TreeConverter.compiler_string_consts.float_type_name, new PascalABCCompiler.TreeConverter.SymbolInfo(SystemLibrary.float_type)); sc.AddSymbol(PascalABCCompiler.TreeConverter.compiler_string_consts.real_type_name, new PascalABCCompiler.TreeConverter.SymbolInfo(SystemLibrary.double_type)); sc.AddSymbol(PascalABCCompiler.TreeConverter.compiler_string_consts.char_type_name, new PascalABCCompiler.TreeConverter.SymbolInfo(SystemLibrary.char_type)); sc.AddSymbol(PascalABCCompiler.TreeConverter.compiler_string_consts.bool_type_name, new PascalABCCompiler.TreeConverter.SymbolInfo(SystemLibrary.bool_type)); sc.AddSymbol(PascalABCCompiler.TreeConverter.compiler_string_consts.string_type_name, new PascalABCCompiler.TreeConverter.SymbolInfo(SystemLibrary.string_type)); //sc.AddSymbol(PascalABCCompiler.TreeConverter.compiler_string_consts.object_type_name, new PascalABCCompiler.TreeConverter.SymbolInfo(SystemLibrary.object_type)); sc.AddSymbol(PascalABCCompiler.TreeConverter.compiler_string_consts.pointer_type_name, new PascalABCCompiler.TreeConverter.SymbolInfo(SystemLibrary.pointer_type)); //sc.AddSymbol(PascalABCCompiler.TreeConverter.compiler_string_consts.base_exception_class_name, new PascalABCCompiler.TreeConverter.SymbolInfo(SystemLibrary.exception_base_type)); sc.AddSymbol(PascalABCCompiler.TreeConverter.compiler_string_consts.base_array_type_name, new PascalABCCompiler.TreeConverter.SymbolInfo(SystemLibrary.array_base_type)); sc.AddSymbol(PascalABCCompiler.TreeConverter.compiler_string_consts.base_delegate_type_name, new PascalABCCompiler.TreeConverter.SymbolInfo(SystemLibrary.delegate_base_type)); //TODO: Переделать. Пусть таблица символов создается одна. Как статическая. compiled_type_node comp_byte_type = ((compiled_type_node)SystemLibrary.byte_type); compiled_type_node comp_sbyte_type = ((compiled_type_node)SystemLibrary.sbyte_type); compiled_type_node comp_short_type = ((compiled_type_node)SystemLibrary.short_type); compiled_type_node comp_ushort_type = ((compiled_type_node)SystemLibrary.ushort_type); compiled_type_node comp_integer_type = ((compiled_type_node)SystemLibrary.integer_type); compiled_type_node comp_uint_type = ((compiled_type_node)SystemLibrary.uint_type); compiled_type_node comp_long_type = ((compiled_type_node)SystemLibrary.int64_type); compiled_type_node comp_ulong_type = ((compiled_type_node)SystemLibrary.uint64_type); compiled_type_node comp_float_type = ((compiled_type_node)SystemLibrary.float_type); compiled_type_node comp_real_type = ((compiled_type_node)SystemLibrary.double_type); compiled_type_node comp_char_type = ((compiled_type_node)SystemLibrary.char_type); compiled_type_node comp_bool_type = ((compiled_type_node)SystemLibrary.bool_type); compiled_type_node comp_string_type = ((compiled_type_node)SystemLibrary.string_type); compiled_type_node comp_object_type = ((compiled_type_node)SystemLibrary.object_type); compiled_type_node comp_pointer_type = ((compiled_type_node)SystemLibrary.pointer_type); compiled_type_node comp_exception_type = ((compiled_type_node)SystemLibrary.exception_base_type); compiled_type_node comp_array_type = ((compiled_type_node)SystemLibrary.array_base_type); compiled_type_node comp_delegate_type = ((compiled_type_node)SystemLibrary.delegate_base_type); comp_byte_type.scope = new PascalABCCompiler.NetHelper.NetTypeScope(comp_byte_type.compiled_type, symbol_table); comp_sbyte_type.scope = new PascalABCCompiler.NetHelper.NetTypeScope(comp_sbyte_type.compiled_type, symbol_table); comp_short_type.scope = new PascalABCCompiler.NetHelper.NetTypeScope(comp_short_type.compiled_type, symbol_table); comp_ushort_type.scope = new PascalABCCompiler.NetHelper.NetTypeScope(comp_ushort_type.compiled_type, symbol_table); comp_integer_type.scope = new PascalABCCompiler.NetHelper.NetTypeScope(comp_integer_type.compiled_type, symbol_table); comp_uint_type.scope = new PascalABCCompiler.NetHelper.NetTypeScope(comp_uint_type.compiled_type, symbol_table); comp_long_type.scope = new PascalABCCompiler.NetHelper.NetTypeScope(comp_long_type.compiled_type, symbol_table); comp_ulong_type.scope = new PascalABCCompiler.NetHelper.NetTypeScope(comp_ulong_type.compiled_type, symbol_table); comp_real_type.scope = new PascalABCCompiler.NetHelper.NetTypeScope(comp_real_type.compiled_type, symbol_table); comp_char_type.scope = new PascalABCCompiler.NetHelper.NetTypeScope(comp_char_type.compiled_type, symbol_table); comp_bool_type.scope = new PascalABCCompiler.NetHelper.NetTypeScope(comp_bool_type.compiled_type, symbol_table); comp_string_type.scope = new PascalABCCompiler.NetHelper.NetTypeScope(comp_string_type.compiled_type, symbol_table); comp_object_type.scope = new PascalABCCompiler.NetHelper.NetTypeScope(comp_object_type.compiled_type, symbol_table); comp_pointer_type.scope = new PascalABCCompiler.NetHelper.NetTypeScope(comp_pointer_type.compiled_type, symbol_table); comp_exception_type.scope = new PascalABCCompiler.NetHelper.NetTypeScope(comp_exception_type.compiled_type, symbol_table); comp_array_type.scope = new PascalABCCompiler.NetHelper.NetTypeScope(comp_array_type.compiled_type, symbol_table); comp_delegate_type.scope = new PascalABCCompiler.NetHelper.NetTypeScope(comp_delegate_type.compiled_type, symbol_table); init_temp_methods_and_consts(cnn, sc, initialization_properties, system_unit_location); return(_system_unit); }
/// <summary> /// ���غc�l�w�] �F���F �}�l /// </summary> public Location() { round = location.East; winer = location.East; setPosition(); }
//setting ships for player private void SetShip(int player, int ship, location location, int direction) { int DierctionTemp; int valid = 0; char symbol = ShipName[ship][0]; index = LocToInt(location); //direction variable 0 = horizontal, 1 = vertical, //-1 control by radio button if (direction == -1) { if (Horizontal.Checked == true) { DierctionTemp = 0; } else { DierctionTemp = 1; } } else { DierctionTemp = direction; } //check valid for that player //show the symbol of ship on the button valid = ValidLocation(player, location, DierctionTemp, ship); if (valid == 1) { for (int i = 0; i < length[ship]; i++) { if (DierctionTemp == 0) { players[player].board[0, location.x_axis + i, location.y_axis] = symbol; GameButton[index + i].Text = symbol.ToString(); } else { players[player].board[0, location.x_axis, location.y_axis + i] = symbol; GameButton[index + i * 7].Text = symbol.ToString(); } } //show messeage of success setting LogText.Text = ShipName[ship] + " setting success \n\n\n"; SetShipOrder++; //SetShipOrder show which ship is setting right now. //if every ship is done, //show messeage box confirm is everything correct if (SetShipOrder < 5) { LogText.Text += "Choose location for " + ShipName[ship + 1]; } else { var result = MessageBox.Show("Is everything correct?", "Finish Setting", MessageBoxButtons.YesNo); if (result == DialogResult.Yes) { StartAttack(); } else { reset(); } } } else { LogText.Text = ShipName[ship] + " setting fail \n\n\n"; LogText.Text += "please choose location for "; LogText.Text += ShipName[ship] + " again"; } }
protected void INSERT(object sender, EventArgs e) { location = location_insert(); }
FlowLayoutPanel fl_Show_from_location(location state) { if (state == location.North) return fl_Up_Show; else if (state == location.West) return fl_Left_Show; else if (state == location.South) return fl_Down_Show; else if (state == location.East) return fl_Right_Show; else return fl_Table; }
/// <summary> /// Обрабатывает случай, когда левая часть присваивания имеет тип event. /// </summary> /// <returns>True - обработка прошла, иначе False.</returns> private bool ProcessAssignmentToEventIfPossible(assign _assign, addressed_expression to, expression_node from, location loc) { if ((to.semantic_node_type == semantic_node_type.static_event_reference) || (to.semantic_node_type == semantic_node_type.nonstatic_event_reference)) { statement_node event_assign = null; static_event_reference ser = (static_event_reference)to; expression_node right_del = convertion_data_and_alghoritms.convert_type(from, ser.en.delegate_type); switch (_assign.operator_type) { case Operators.AssignmentAddition: { if (to.semantic_node_type == semantic_node_type.static_event_reference) { event_assign = convertion_data_and_alghoritms.create_simple_function_call( ser.en.add_method, loc, right_del); } else { if (ser.en.semantic_node_type == semantic_node_type.compiled_event) { nonstatic_event_reference nser = (nonstatic_event_reference)ser; compiled_function_node cfn = (compiled_function_node)ser.en.add_method; compiled_function_call tmp_event_assign = new compiled_function_call(cfn, nser.obj, loc); tmp_event_assign.parameters.AddElement(right_del); event_assign = tmp_event_assign; } else if (ser.en.semantic_node_type == semantic_node_type.common_event) { nonstatic_event_reference nser = (nonstatic_event_reference)ser; common_method_node cfn = (common_method_node)ser.en.add_method; common_method_call tmp_event_assign = new common_method_call(cfn, nser.obj, loc); tmp_event_assign.parameters.AddElement(right_del); event_assign = tmp_event_assign; } } break; } case Operators.AssignmentSubtraction: { if (to.semantic_node_type == semantic_node_type.static_event_reference) { event_assign = convertion_data_and_alghoritms.create_simple_function_call( ser.en.remove_method, loc, right_del); } else { if (ser.en.semantic_node_type == semantic_node_type.compiled_event) { nonstatic_event_reference nser = (nonstatic_event_reference)ser; compiled_function_node cfn = (compiled_function_node)ser.en.remove_method; compiled_function_call tmp_event_assign = new compiled_function_call(cfn, nser.obj, loc); tmp_event_assign.parameters.AddElement(right_del); event_assign = tmp_event_assign; } else if (ser.en.semantic_node_type == semantic_node_type.common_event) { nonstatic_event_reference nser = (nonstatic_event_reference)ser; common_method_node cfn = (common_method_node)ser.en.remove_method; common_method_call tmp_event_assign = new common_method_call(cfn, nser.obj, loc); tmp_event_assign.parameters.AddElement(right_del); event_assign = tmp_event_assign; } } break; } default: { AddError(loc, "ASSIGN_TO_EVENT"); //throw new CanNotApplyThisOperationToEvent break; } } return_value(event_assign); return(true); } return(false); }
protected virtual void addimage(location state, Brand brand, RotateFlipType rotate) { Bitmap bitmap; // 如果是可視的牌就設定顯示牌的圖型,否則就顯示直立的牌 Resources.upbarnd if (brand.IsCanSee || state == location.South || ShowAll) bitmap = new Bitmap(ResourcesTool.getImage(brand)); else bitmap = new Bitmap(Resources.upbarnd); // 設定牌 BrandBox tempBrandbox = new BrandBox(brand); // 設定自動縮放 tempBrandbox.SizeMode = PictureBoxSizeMode.AutoSize; // 設定邊距 tempBrandbox.Margin = new Padding(0); tempBrandbox.Padding = new Padding(padding); // 要轉的角度 bitmap.RotateFlip(rotate); // 提示 if (ShowAll && ShowBrandInfo) tempBrandbox.Click += new EventHandler(debug_Click); // 滑鼠事件 if ( state == location.South && brand.getClass() != Settings.Default.Flower && brand.Team < 1 ) { tempBrandbox.MouseMove += new MouseEventHandler(tempBrandbox_MouseMove); tempBrandbox.MouseLeave += new EventHandler(brandBox_MouseLeave); tempBrandbox.Click += new EventHandler(brandBox_MouseClick); // 作弊事件 //if (ShowAll && ShowBrandInfo) // tempBrandbox.MouseHover += new EventHandler(debug_Click); //else // tempBrandbox.MouseHover -= new EventHandler(debug_Click); } else if (brand.Team >= 1) { tempBrandbox.BackColor = Color.DarkGreen; } else if (cheat && state != location.South) { tempBrandbox.MouseClick += new MouseEventHandler(cheat_MouseClick); } else { tempBrandbox.Click -= new EventHandler(brandBox_MouseClick); tempBrandbox.MouseClick -= new MouseEventHandler(cheat_MouseClick); } bitmap = ResizeBitmap(bitmap, Settings.Default.ResizePercentage); // 設定圖片 tempBrandbox.Image = bitmap; // 新增至控制項 add_flowLayoutBrands(state, tempBrandbox); }
//function to check is the fire location have ship or not private int ShotShip(int self, location locate) { int enemy = 0; int shipType = 0; int buttonNum = LocToInt(locate); if (self == 0) { enemy = 1; } //miss shoot if (players[enemy].board[0, locate.x_axis, locate.y_axis] == '?') { players[self].board[1, locate.x_axis, locate.y_axis] = 'M'; players[enemy].board[0, locate.x_axis, locate.y_axis] = 'M'; //change log text and button color to clearly show hit or miss //depend on which player change different button if (self == 0) { GameButton[buttonNum + TotalGrid].Text = "M"; GameButton[buttonNum + TotalGrid].BackColor = Color.PaleGreen; LogText.Text = "You miss at ["; LogText.Text += locate.x_axis.ToString(); LogText.Text += ","; LogText.Text += locate.y_axis.ToString(); LogText.Text += "]\n\n"; } else { GameButton[buttonNum].Text = "M"; GameButton[buttonNum].BackColor = Color.PaleGreen; } return(0); } else {//hit something //check which ship is hit switch (players[enemy].board[0, locate.x_axis, locate.y_axis]) { case 'A': shipType = 0; break; case 'B': shipType = 1; break; case 'S': shipType = 2; break; case 'D': shipType = 3; break; case 'P': shipType = 4; break; } //decrease the remain number for ship and total amount players[enemy].AllShip[shipType].remain--; players[enemy].TotalRemain--; //change log text and button color to clearly show hit or miss //depend on which player change different button if (self == 0) { LogText.Text = "You hit something at ["; LogText.Text += locate.x_axis.ToString(); LogText.Text += ","; LogText.Text += locate.y_axis.ToString(); LogText.Text += "]\n\n"; //if no part remain in certain ship //show log text, which ship is sink if (players[enemy].AllShip[shipType].remain == 0) { ChangeMesseage(shipType, 0); LogText.Text += ShipName[shipType] + " is sinked"; } EnemyRemain.Text = players[enemy].TotalRemain.ToString(); GameButton[buttonNum + TotalGrid].Text = "H"; GameButton[buttonNum + TotalGrid].BackColor = Color.Red; } else { GameButton[buttonNum].Text = "H"; ChangeMesseage(shipType, 1); GameButton[buttonNum].BackColor = Color.Red; } players[self].board[1, locate.x_axis, locate.y_axis] = 'H'; players[enemy].board[0, locate.x_axis, locate.y_axis] = 'H'; //if one player don't have any ship //show messeage check play again or close if (players[enemy].TotalRemain == 0) { LogText.Text = "Congrualoation Player" + (self + 1); var result = MessageBox.Show("Player " + (self + 1) + " is winner\n" + "Would you like to play again?", "Game Over", MessageBoxButtons.YesNo); if (result == DialogResult.Yes) { reset(); } else { this.Close(); } } return(1); } }
/// <summary> /// Обрабатывает случай, когда левая часть присваивания short string. /// </summary> /// <returns>True - обработка прошла, иначе False.</returns> private bool ProcessAssignmentToShortStringIfPossible(assign _assign, addressed_expression to, expression_node from, location loc) { if (_assign.operator_type == Operators.Assignment) { if (to is simple_array_indexing && (to as simple_array_indexing).simple_arr_expr.type.type_special_kind == type_special_kind.short_string) { expression_node expr = (to as simple_array_indexing).simple_arr_expr; expression_node ind_expr = (to as simple_array_indexing).ind_expr; from = convertion_data_and_alghoritms.convert_type(from, SystemLibrary.SystemLibrary.char_type); ind_expr = convertion_data_and_alghoritms.create_simple_function_call( SystemLibInitializer.SetCharInShortStringProcedure.sym_info as function_node, loc, expr, ind_expr, new int_const_node((expr.type as short_string_type_node).Length, null), from); return_value(find_operator(compiler_string_consts.assign_name, expr, ind_expr, get_location(_assign))); return(true); } if (to.type.type_special_kind == type_special_kind.short_string) { if (from.type is null_type_node) { AddError(get_location(_assign), "NIL_WITH_VALUE_TYPES_NOT_ALLOWED"); } expression_node clip_expr = convertion_data_and_alghoritms.create_simple_function_call( SystemLibInitializer.ClipShortStringProcedure.sym_info as function_node, loc, convertion_data_and_alghoritms.convert_type(from, SystemLibrary.SystemLibrary.string_type), new int_const_node((to.type as short_string_type_node).Length, null)); statement_node en = find_operator(compiler_string_consts.assign_name, to, clip_expr, get_location(_assign)); return_value(en); return(true); } } return(false); }
/// <summary> /// Обрабатывает случай, когда левая часть присваивания свойство. /// </summary> /// <returns>True - обработка прошла, иначе False.</returns> private bool ProcessAssignToPropertyIfPossible(assign _assign, addressed_expression to, location loc, expression_node from) { //проверка на обращение к полю записи возвращенной из функции с целью присваивания //нужно чтобы пользователь не мог менять временный обьект if (to.semantic_node_type == semantic_node_type.static_property_reference || to.semantic_node_type == semantic_node_type.non_static_property_reference) { property_node pn; if (to.semantic_node_type == semantic_node_type.static_property_reference) { pn = (to as static_property_reference).property; } else { pn = (to as non_static_property_reference).property; } var ot = MapCompositeAssignmentOperatorToSameBinaryOperator(_assign); var oper_ass_in_prop = ot != Operators.Undefined; if (_assign.operator_type == Operators.Assignment || oper_ass_in_prop) { if (oper_ass_in_prop) { if (pn.get_function == null) { AddError(loc, "THIS_PROPERTY_{0}_CAN_NOT_BE_READED", pn.name); } base_function_call prop_expr; if (to.semantic_node_type == semantic_node_type.non_static_property_reference) { prop_expr = create_not_static_method_call(pn.get_function, (to as non_static_property_reference).expression, loc, false); prop_expr.parameters.AddRange((to as non_static_property_reference).fact_parametres); } else { prop_expr = create_static_method_call(pn.get_function, loc, pn.comprehensive_type, false); prop_expr.parameters.AddRange((to as static_property_reference).fact_parametres); } from = find_operator(ot, prop_expr, from, loc); } if (to.semantic_node_type == semantic_node_type.static_property_reference) { static_property_reference spr = (static_property_reference)to; if (spr.property.set_function == null) { AddError(loc, "THIS_PROPERTY_{0}_CAN_NOT_BE_WRITED", spr.property.name); } check_property_params(spr, loc); function_node set_func = spr.property.set_function; from = convertion_data_and_alghoritms.convert_type(from, spr.property.property_type); spr.fact_parametres.AddElement(from); base_function_call bfc = create_static_method_call(set_func, loc, spr.property.comprehensive_type, true); bfc.parameters.AddRange(spr.fact_parametres); return_value((statement_node)bfc); } else if (to.semantic_node_type == semantic_node_type.non_static_property_reference) { non_static_property_reference nspr = (non_static_property_reference)to; check_property_params(nspr, loc); from = convertion_data_and_alghoritms.convert_type(from, nspr.property.property_type); nspr.fact_parametres.AddElement(from); //Обработка s[i]:='c' if (SystemUnitAssigned) { if (nspr.property.comprehensive_type == SystemLibrary.SystemLibrary.string_type) { if (nspr.property == SystemLibrary.SystemLibrary.string_type.default_property_node) { if (SystemLibInitializer.StringDefaultPropertySetProcedure != null) { expressions_list exl = new expressions_list(); exl.AddElement(nspr.expression); exl.AddElement(nspr.fact_parametres[0]); exl.AddElement(from); function_node fn = convertion_data_and_alghoritms.select_function(exl, SystemLibInitializer.StringDefaultPropertySetProcedure .SymbolInfo, loc); expression_node ret = convertion_data_and_alghoritms.create_simple_function_call(fn, loc, exl.ToArray()); return_value((statement_node)ret); return(true); } } } } if (nspr.property.set_function == null) { AddError(loc, "THIS_PROPERTY_{0}_CAN_NOT_BE_WRITED", nspr.property.name); } function_node set_func = nspr.property.set_function; base_function_call bfc = create_not_static_method_call(set_func, nspr.expression, loc, true); bfc.parameters.AddRange(nspr.fact_parametres); return_value((statement_node)bfc); } return(true); } } return(false); }
//enter a location, translate to index number //(0,0) will be 0, (0,1) will be 7 private int LocToInt(location location) { index = location.x_axis + location.y_axis * 7; return(index); }
public virtual void add_flowLayoutBrands(location state, BrandBox brandbox) { if (flowLayoutBrands[(int)state].InvokeRequired) { flowLayoutBrands[(int)state].Invoke(new add_flowLayoutBrands_delegate(add_flowLayoutBrands), new object[] { state, brandbox }); } else flowLayoutBrands[(int)state].Controls.Add(brandbox); }
var(location, qubits) = __in;
private int convert(char[] loc, ref location place) { try { int i; for (i = 0; i <= 1; i++) { if ((loc[i] < 'a') || (loc[i] > 'r')) return 1; } for (i = 2; i <= 3; i++) { if ((loc[i] < '0') || (loc[i] > '9')) return 1; } for (i = 4; i <= 5; i++) { if ((loc[i] < 'a') || (loc[i] > 'x')) return 1; } (place.latit) = 10 * (loc[1] - 'a') - 90; (place.latit) += loc[3] - '0'; (place.latit) += (loc[5] - 'a') / 24.0 + 1 / 48.0; (place.latit) *= PI / 180.0; (place.longit) = 20 * (loc[0] - 'a') - 180; (place.longit) += 2 * (loc[2] - '0'); (place.longit) += (loc[4] - 'a') / 12.0 + 1 / 24.0; (place.longit) *= PI / 180.0; return 0; } catch (Exception ex) { Debug.Write(ex.ToString()); return 1; } }
protected override void addimage(location state, Brand brand, RotateFlipType rotate) { Bitmap bitmap; // 如果是可視的牌就設定顯示牌的圖型,否則就顯示直立的牌 Resources.upbarnd if (brand.IsCanSee || state == location.South || ShowAll) { bitmap = new Bitmap(ResourcesTool.getImage(brand)); } else { bitmap = new Bitmap(Resources.upbarnd); } // 設定牌 BrandBox tempBrandbox = new BrandBox(brand); // 設定自動縮放 tempBrandbox.SizeMode = PictureBoxSizeMode.AutoSize; // 設定邊距 tempBrandbox.Margin = new Padding(0); tempBrandbox.Padding = new Padding(padding); // 要轉的角度 bitmap.RotateFlip(rotate); // 提示 if (ShowAll && ShowBrandInfo) { tempBrandbox.Click += new EventHandler(debug_Click); } // 滑鼠事件 if ( state == location.South && brand.getClass() != Settings.Default.Flower && brand.Team < 1 ) { tempBrandbox.MouseMove += new MouseEventHandler(tempBrandbox_MouseMove); tempBrandbox.MouseLeave += new EventHandler(brandBox_MouseLeave); tempBrandbox.Click += new EventHandler(brandBox_MouseClick); // 作弊事件 //if (ShowAll && ShowBrandInfo) // tempBrandbox.MouseHover += new EventHandler(debug_Click); //else // tempBrandbox.MouseHover -= new EventHandler(debug_Click); } else if (cheat && state != location.South) { tempBrandbox.MouseClick += new MouseEventHandler(cheat_MouseClick); } else { tempBrandbox.Click -= new EventHandler(brandBox_MouseClick); tempBrandbox.MouseClick -= new MouseEventHandler(cheat_MouseClick); } bitmap = ResizeBitmap(bitmap, Settings.Default.ResizePercentage); // 設定圖片 tempBrandbox.Image = bitmap; // 新增至控制項 add_flowLayoutBrands(state, tempBrandbox); }
private location ParseModel(LocationVM vm) { var locModel = new location(); locModel.id = vm.Id; locModel.location_name = vm.LocationName; return locModel; }
public override void visit(for_node _for_node) { #region MikhailoMMX, обработка omp parallel for bool isGenerateParallel = false; bool isGenerateSequential = true; if (OpenMP.ForsFound) { OpenMP.LoopVariables.Push(_for_node.loop_variable.name.ToLower()); //если в программе есть хоть одна директива parallel for - проверяем: if (DirectivesToNodesLinks.ContainsKey(_for_node) && OpenMP.IsParallelForDirective(DirectivesToNodesLinks[_for_node])) { //перед этим узлом есть директива parallel for if (CurrentParallelPosition == ParallelPosition.Outside) //входим в самый внешний параллельный for { if (_for_node.create_loop_variable || (_for_node.type_name != null)) { //сгенерировать сначала последовательную ветку, затем параллельную //устанавливаем флаг и продолжаем конвертирование, считая, что конвертируем последовательную ветку isGenerateParallel = true; CurrentParallelPosition = ParallelPosition.InsideSequential; //в конце за счет флага вернем состояние обратно и сгенерируем и параллельную ветку тоже } else { WarningsList.Add(new OMP_BuildigError(new Exception("Переменная параллельного цикла должна быть определена в заголовке цикла"), new location(_for_node.source_context.begin_position.line_num, _for_node.source_context.begin_position.column_num, _for_node.source_context.end_position.line_num, _for_node.source_context.end_position.column_num, new document(_for_node.source_context.FileName)))); } } else //уже генерируем одну из веток //если это параллельная ветка - последовательную генерировать не будем if (CurrentParallelPosition == ParallelPosition.InsideParallel) { isGenerateParallel = true; isGenerateSequential = false; } //else //а если последовательная - то флаг isGenerateParallel не установлен, сгенерируется только последовательная } } #endregion location loopVariableLocation = get_location(_for_node.loop_variable); var_definition_node vdn = null; expression_node left, right, res; expression_node initialValue = convert_strong(_for_node.initial_value); expression_node tmp = initialValue; if (initialValue is typed_expression) { initialValue = convert_typed_expression_to_function_call(initialValue as typed_expression); } if (initialValue.type == null) { initialValue = tmp; } statements_list head_stmts = new statements_list(loopVariableLocation); convertion_data_and_alghoritms.statement_list_stack_push(head_stmts); var early_init_loop_variable = false; // SSM 25/05/16 if (_for_node.type_name == null && !_for_node.create_loop_variable) { definition_node dn = context.check_name_node_type(_for_node.loop_variable.name, loopVariableLocation, general_node_type.variable_node); vdn = (var_definition_node)dn; if (context.is_loop_variable(vdn)) { AddError(get_location(_for_node.loop_variable), "CANNOT_ASSIGN_TO_LOOP_VARIABLE"); } if (!check_name_in_current_scope(_for_node.loop_variable.name)) { AddError(new ForLoopControlMustBeSimpleLocalVariable(loopVariableLocation)); } } else { //В разработке DS //throw new NotSupportedError(get_location(_for_node.type_name)); type_node tn; if (_for_node.type_name != null) { tn = convert_strong(_for_node.type_name); } else { tn = initialValue.type; } //if (tn == SystemLibrary.SystemLibrary.void_type && _for_node.type_name != null) // AddError(new VoidNotValid(get_location(_for_node.type_name))) if (_for_node.type_name != null) { check_for_type_allowed(tn, get_location(_for_node.type_name)); } vdn = context.add_var_definition(_for_node.loop_variable.name, get_location(_for_node.loop_variable), tn, initialValue /*, polymorphic_state.ps_common*/); vdn.polymorphic_state = polymorphic_state.ps_common; early_init_loop_variable = true; // SSM 25/05/16 } internal_interface ii = vdn.type.get_internal_interface(internal_interface_kind.ordinal_interface); if (ii == null) { AddError(new OrdinalTypeExpected(loopVariableLocation)); } ordinal_type_interface oti = (ordinal_type_interface)ii; location finishValueLocation = get_location(_for_node.finish_value); var_definition_node vdn_finish = context.create_for_temp_variable(vdn.type, finishValueLocation); //Это должно стоять раньше!! left = create_variable_reference(vdn_finish, loopVariableLocation); expression_node finishValue = convert_strong(_for_node.finish_value); right = finishValue; if (right is typed_expression) { right = convert_typed_expression_to_function_call(right as typed_expression); } res = find_operator(compiler_string_consts.assign_name, left, right, finishValueLocation); head_stmts.statements.AddElement(res); if (!early_init_loop_variable) // SSM 25/05/16 - for var i := f1() to f2() do без этой правки дважды вызывал f1() { left = create_variable_reference(vdn, loopVariableLocation); right = initialValue; res = find_operator(compiler_string_consts.assign_name, left, right, loopVariableLocation); head_stmts.statements.AddElement(res); } location initialValueLocation = get_location(_for_node.initial_value); statement_node sn_inc = null; expression_node sn_while = null; expression_node sn_init_while = null; left = create_variable_reference(vdn, initialValueLocation); right = create_variable_reference(vdn, finishValueLocation); expression_node right_border = create_variable_reference(vdn_finish, finishValueLocation); switch (_for_node.cycle_type) { case for_cycle_type.to: { sn_inc = convertion_data_and_alghoritms.create_simple_function_call(oti.inc_method, loopVariableLocation, left); sn_while = convertion_data_and_alghoritms.create_simple_function_call(oti.lower_method, finishValueLocation, right, right_border); sn_init_while = convertion_data_and_alghoritms.create_simple_function_call(oti.lower_eq_method, finishValueLocation, right, right_border); break; } case for_cycle_type.downto: { sn_inc = convertion_data_and_alghoritms.create_simple_function_call(oti.dec_method, loopVariableLocation, left); sn_while = convertion_data_and_alghoritms.create_simple_function_call(oti.greater_method, finishValueLocation, right, right_border); sn_init_while = convertion_data_and_alghoritms.create_simple_function_call(oti.greater_eq_method, finishValueLocation, right, right_border); break; } } CheckToEmbeddedStatementCannotBeADeclaration(_for_node.statements); //DarkStar Modifed //исправил ошибку: не работали break в циклах TreeRealization.for_node forNode = new TreeRealization.for_node(null, sn_while, sn_init_while, sn_inc, null, get_location(_for_node)); if (vdn.type == SystemLibrary.SystemLibrary.bool_type) { forNode.bool_cycle = true; } context.cycle_stack.push(forNode); context.loop_var_stack.Push(vdn); statements_list slst = new statements_list(get_location(_for_node.statements)); convertion_data_and_alghoritms.statement_list_stack_push(slst); context.enter_code_block_with_bind(); forNode.body = convert_strong(_for_node.statements); context.leave_code_block(); slst = convertion_data_and_alghoritms.statement_list_stack.pop(); if (slst.statements.Count > 0 || slst.local_variables.Count > 0) { slst.statements.AddElement(forNode.body); forNode.body = slst; } context.cycle_stack.pop(); context.loop_var_stack.Pop(); head_stmts = convertion_data_and_alghoritms.statement_list_stack.pop(); head_stmts.statements.AddElement(forNode); #region MikhailoMMX, обработка omp parallel for //флаг был установлен только если это самый внешний parallel for и нужно сгенерировать обе ветки //или если это вложенный parallel for, нужно сгенерировать обе ветки, но без проверки на OMP_Available //Последовательная ветка только что сгенерирована, теперь меняем состояние и генерируем параллельную if (isGenerateParallel) { CurrentParallelPosition = ParallelPosition.InsideParallel; statements_list stl = OpenMP.TryConvertFor(head_stmts, _for_node, forNode, vdn, initialValue, finishValue, this); CurrentParallelPosition = ParallelPosition.Outside; if (stl != null) { var f = _for_node.DescendantNodes().OfType <function_lambda_definition>().FirstOrDefault(); if (f != null) { AddError(get_location(f), "OPENMP_CONTROLLED_CONSTRUCTIONS_CANNOT_CONTAIN_LAMBDAS"); } OpenMP.LoopVariables.Pop(); return_value(stl); return; } } if (OpenMP.ForsFound) { OpenMP.LoopVariables.Pop(); } #endregion return_value(head_stmts); }
/// <summary> /// �U�@�� E->S->W->N /// </summary> public void next() { if (winer == location.North) { winer = add(winer); round = add(round); } else winer = add(winer); }
protected void Page_Load(object sender, EventArgs e) { string StudentUN = Page.RouteData.Values["Student"] as string; if (!Page.IsPostBack) { //Bind DDLs BindCountry(); BindNationality(); BindStatus(); //Load Data try { //Get the logged in User if any MembershipUser = Membership.GetUser(StudentUN); Session["MembershipUser"] = MembershipUser; //Check if there is a logged in User if (MembershipUser != null) { //Membership Data UserName.Text = MembershipUser.UserName.ToString(); Email.Text = MembershipUser.Email.ToString(); ////Disable controls //UserName.Enabled = false; //Email.Enabled = false; //Password.Enabled = false; //Confirm.Enabled = false; //Password.Visible = false; //lblPassword.Visible = false; //Confirm.Visible = false; //lblConfirm.Visible = false; //ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "AccountSetUpLogginIn", "GreyAccountInfo(" + '1' + ");", true); //$(".first").addClass("second"); //RALT Data // ToInt32 can throw FormatException or OverflowException. int UserId = -1; try { //Get the RALT data from membership accountID UserId = Convert.ToInt32(MembershipUser.ProviderUserKey.ToString()); UserData = (user)UserService.GetUserByMemberId(UserId); Session["UserData"] = (user)UserData; //Bind data if (!object.ReferenceEquals(UserData, null)) { FirstName.Text = UserData.first_name; Age.SelectedIndex = (int)UserData.age; LastName.Text = UserData.last_name; Nationality.SelectedValue = UserData.nationality; ddlStatus.SelectedValue = UserData.account_status; SkypeID.Text = UserData.skype_id; BindPayments(); //Check for location data location MyLocation = LocationService.GetUserById(UserData.user_id); if (!object.ReferenceEquals(MyLocation, null)) { //Address1.Text = MyLocation.line_1; //Address2.Text = MyLocation.line_2; //City.Text = MyLocation.city; //State.Text = MyLocation.state; //PostalCode.Text = MyLocation.postal_code; Country.SelectedValue = MyLocation.country_code_iso2; BindTimeZone(Country.SelectedValue); string ZoneId = Convert.ToString(MyLocation.zone_id); TimeZone.SelectedValue = ZoneId; } //Check for location data quickregistration MyReg = QuickRegService.GetObjectByUserId(UserData.user_id); if (!object.ReferenceEquals(MyReg, null)) { SpecialRequests.Text = MyReg.specialrequests; txtFrequency.Text = MyReg.classes.ToString(); txtLevel.Text = MyReg.languagel_evel.ToString(); txtPeriod.Text = MyReg.period; DateTime StartDate = (DateTime)MyReg.start_date; RentALanguageTeacher.user Admin = UserService.GetUserById(Convert.ToInt32(AppConfiguration.AdminID)); DateTime LocalStartDate = App_Code.TimeService.ConvertToMyTime(StartDate, Admin); txtStartDate.Text = LocalStartDate.Date.ToString("d"); TimeSpan span = new TimeSpan(0, 3, 0, 0, 0); txtBlockTime.Text = LocalStartDate.TimeOfDay.ToString() + " - " + LocalStartDate.TimeOfDay.Add(span).ToString(); Duration.Text = MyReg.class_duration.ToString(); Teacher.Text = MyReg.teacher; TeacherSkype.Text = MyReg.teacher_skypeid; FirstClass.Value = MyReg.first_class.ToString(); txtAdminComments.Text = MyReg.admin_comments; ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "SetFirstClass", "SetFirstClass();", true); } } } catch (FormatException) { //Console.WriteLine("Input string is not a sequence of digits."); throw; } catch (OverflowException) { //Console.WriteLine("The number cannot fit in an Int32."); throw; } } } catch (Exception ex) { App_Code.NotificationService.SendNotification("AccountSetupLoadError", ex.Message, "error", "4000"); } LockControls(); } }
/// <summary> /// �]�w�}�P��m /// </summary> public void setPosition() { switch (r.Next(4)) { case 0: position = location.North; break; case 1: position = location.East; break; case 2: position = location.South; break; case 3: position = location.West; break; } }
return(new DisplayStringHelper(this).GetStackTraceAsString(location, FrontEndContext.QualifierTable));
location add(location lo) { if (lo == location.East) return location.South; else if (lo == location.South) return location.West; else if (lo == location.West) return location.North; else if (lo == location.North) return location.East; else return location.East; }
public HttpResponseMessage GetListDetail(viewModelGetListPlace getListInfo) { //無論公開或私人都會用此功能 所以要找創建清單的userid非登入者的userid List <string> systemTagResult = new List <string>(); List <int> resultplaceid = new List <int>(); List <int> searchallplaceinlist = new List <int>(); List <int> intersectResult = new List <int>(); List <int> tagsList = new List <int>(); List <int> editorIDList = new List <int>(); List <int> kingTags = new List <int>(); List <listDetailPlace> resultPlaceInfo = new List <listDetailPlace>(); List <tTag> resultTagInfo = new List <tTag>(); placeListInfo infoItem = new placeListInfo(); int[] tFilterid = getListInfo.filter; int list_createrId = 0; int userlogin = 0; userlogin = userFactory.userIsLoginSession(userlogin); userlogin = userIsLoginCookie(userlogin); userFactory.userEventRecord(0, 1, db); var dataForm = new { info = infoItem, places = resultPlaceInfo, system_tags = systemTagResult, user_tags = resultTagInfo, editors_id = editorIDList }; var result = new { status = 0, msg = "fail", data = dataForm }; var listModel = db.placeLists.Where(p => p.id == getListInfo.list_id).FirstOrDefault(); //此結果為特定清單中全部的地點id //無論公開或私人都會用此功能 所以要找創建清單的userid非登入者的userid if (listModel != null) { var editInList = db.placeListRelationships.Where(p => p.placelist_id == getListInfo.list_id).Select(q => q.user_id).ToList(); if (editInList != null) { foreach (int i in editInList) { editorIDList.Add(i); } dataForm = new { info = infoItem, places = resultPlaceInfo, system_tags = systemTagResult, user_tags = resultTagInfo, editors_id = editorIDList }; } searchallplaceinlist = db.placeRelationships.Where(p => p.placelist_id == listModel.id).Select(q => q.place_id).ToList(); list_createrId = db.placeLists.Where(p => p.id == getListInfo.list_id).Select(q => q.user_id).FirstOrDefault(); var listCreator = db.users.Where(u => u.id == list_createrId).FirstOrDefault(); infoItem.id = listModel.id; infoItem.creator_id = listModel.user_id; infoItem.name = listModel.name; infoItem.creator_username = listCreator.name; infoItem.description = listModel.description; infoItem.privacy = listModel.privacy; infoItem.createdTime = listModel.created != null?listModel.created.ToString().Substring(0, 10) : ""; infoItem.updatedTime = listModel.updated != null?listModel.updated.ToString().Substring(0, 10) : ""; infoItem.coverImageURL = listModel.cover != null ? listModel.cover : null; dataForm = new { info = infoItem, places = resultPlaceInfo, system_tags = systemTagResult, user_tags = resultTagInfo, editors_id = editorIDList }; result = new { status = 1, msg = "success", data = dataForm }; } //此結果為特定清單中篩選出有標籤的地點id if (tFilterid != null && list_createrId != 0) { intersectResult = searchallplaceinlist; foreach (int i in tFilterid) { intersectResult = tagFactory.searchTag(0, ref intersectResult, i, db); } intersectResult = intersectResult.Distinct().ToList(); if (intersectResult.Count > 0) { foreach (int i in intersectResult) { var placeItem = db.places.Where(p => p.id == i).Select(q => q).FirstOrDefault(); if (placeItem != null) { if (placeItem.type != null) { systemTagResult.Add(placeItem.type); } listDetailPlace placeDetail = new listDetailPlace(); if (userlogin == 0) { placeDetail.king_tags = kingTags.ToArray(); } else { var hasKingTag = db.tagRelationships.Where(t => t.user_id == userlogin && t.place_id == i && (t.tag_id == 101 || t.tag_id == 102 || t.tag_id == 103)).Select(t => t.tag_id).ToList(); if (hasKingTag != null) { placeDetail.king_tags = hasKingTag.ToArray(); } } location detailPlaceLocation = new location(); placeDetail.id = placeItem.id; placeDetail.gmap_id = placeItem.gmap_id; placeDetail.name = placeItem.name; placeDetail.phone = placeItem.phone; placeDetail.address = placeItem.address; placeDetail.type = placeItem.type; placeDetail.photo_url = placeItem.photo != null ? placeItem.photo : null; detailPlaceLocation.lon = placeItem.longitude; detailPlaceLocation.lat = placeItem.latitude; placeDetail.location = detailPlaceLocation; resultPlaceInfo.Add(placeDetail); } tagsList.AddRange(db.tagRelationships.Where(p => p.place_id == i && p.user_id == list_createrId).Select(q => q.tag_id).ToList()); if (editorIDList.Count > 0) { foreach (int editorId in editorIDList) { tagsList.AddRange(db.tagRelationships.Where(p => p.place_id == i && p.user_id == editorId).Select(q => q.tag_id).ToList()); } } } tagsList = tagsList.Distinct().ToList(); systemTagResult = systemTagResult.Distinct().ToList(); dataForm = new { info = infoItem, places = resultPlaceInfo, system_tags = systemTagResult, user_tags = resultTagInfo, editors_id = editorIDList }; result = new { status = 1, msg = "success", data = dataForm }; } if (tagsList.Count > 0) { foreach (int i in tagsList) { var rtag = db.tags.Where(p => p.id == i && p.type == 2).Select(q => q).FirstOrDefault(); if (rtag != null) { tTag t = new tTag(); t.id = rtag.id; t.name = rtag.name; t.type = rtag.type; resultTagInfo.Add(t); } } } } return(Request.CreateResponse(HttpStatusCode.OK, result)); }
/// <summary> /// Convert IATI /// </summary> /// <returns></returns> //public IXmlResult ConvertIATIXML(IXmlResult objSource, IXmlResult objDestinaiton) //{ // if(objDestinaiton == null) // objDestinaiton = new XmlResultv2(); // //parse and assign // return objDestinaiton; //} public XmlResultv2 ConvertIATI105to201XML(XmlResultv1 objSource, XmlResultv2 objDestinaiton) { if (objDestinaiton == null) objDestinaiton = new XmlResultv2(); //iatiactivities if (objSource != null && objSource.iatiactivities != null && objSource.iatiactivities.Items != null) { objSource.iatiactivities.version = (decimal)2.02; //activity foreach (var item in objSource.iatiactivities.Items) { if (item.GetType() == typeof(AIMS_BD_IATI.Library.Parser.ParserIATIv1.iatiactivity)) { var activity = (AIMS_BD_IATI.Library.Parser.ParserIATIv1.iatiactivity)item; string srcIatiidentifier = ""; if (activity.Items != null) { foreach (var activityItem in activity.Items) { //iati-identifier if (activityItem.GetType() == typeof(AIMS_BD_IATI.Library.Parser.ParserIATIv1.iatiidentifier)) { var iatiidentifier = (AIMS_BD_IATI.Library.Parser.ParserIATIv1.iatiidentifier)activityItem; srcIatiidentifier = iatiidentifier.Text.n(0); } } var desActivity = objDestinaiton.iatiactivities.iatiactivity.FirstOrDefault(q => q.IatiIdentifier == srcIatiidentifier); //desActivity.AnyAttr[0].Prefix = ""; desActivity.AnyAttr[0].Value = "2.02"; var locations = new List<location>(); int otherIdentifierCounter = 0; foreach (var activityItem in activity.Items) { #region reporting-org if (activityItem.GetType() == typeof(AIMS_BD_IATI.Library.Parser.ParserIATIv1.reportingorg)) { var reportingorg = (AIMS_BD_IATI.Library.Parser.ParserIATIv1.reportingorg)activityItem; narrative[] arrynarrative = getNarrativeArray(reportingorg); desActivity.reportingorg.narrative = arrynarrative; } #endregion #region title else if (activityItem.GetType() == typeof(AIMS_BD_IATI.Library.Parser.ParserIATIv1.textType)) { var title = (AIMS_BD_IATI.Library.Parser.ParserIATIv1.textType)activityItem; narrative[] arrynarrative = getNarrativeArray(title); desActivity.title.narrative = arrynarrative; } #endregion #region description else if (activityItem.GetType() == typeof(AIMS_BD_IATI.Library.Parser.ParserIATIv1.description)) { var description = (AIMS_BD_IATI.Library.Parser.ParserIATIv1.description)activityItem; narrative[] arrynarrative = getNarrativeArray(description); desActivity.description = new iatiactivityDescription[1]; desActivity.description[0] = new iatiactivityDescription(); desActivity.description[0].narrative = arrynarrative; } #endregion #region participating-org else if (activityItem.GetType() == typeof(AIMS_BD_IATI.Library.Parser.ParserIATIv1.participatingorg)) { var participatingorg = (AIMS_BD_IATI.Library.Parser.ParserIATIv1.participatingorg)activityItem; narrative[] arrynarrative = getNarrativeArray(participatingorg); var targetParticipatingOrg = desActivity.participatingorg.FirstOrDefault(x => x.role == participatingorg.role && x.@ref == participatingorg.@ref && x.type == participatingorg.type); targetParticipatingOrg.role = getOrgRoleCode(participatingorg.role); targetParticipatingOrg.narrative = arrynarrative; } #endregion //recipient-country //Same //activity-status //Same #region activity-date else if (activityItem.GetType() == typeof(AIMS_BD_IATI.Library.Parser.ParserIATIv1.activitydate)) { var activitydate = (AIMS_BD_IATI.Library.Parser.ParserIATIv1.activitydate)activityItem; var targetActivitydate = desActivity.activitydate.FirstOrDefault(x => x.type == activitydate.type); targetActivitydate.type = getActivityDateCode(activitydate.type); } #endregion #region contact-info else if (activityItem.GetType() == typeof(AIMS_BD_IATI.Library.Parser.ParserIATIv1.contactinfo)) { var contactinfo = (AIMS_BD_IATI.Library.Parser.ParserIATIv1.contactinfo)activityItem; if (desActivity.contactinfo == null) desActivity.contactinfo = new contactinfo[1]; if (desActivity.contactinfo[0] == null) desActivity.contactinfo[0] = new contactinfo(); var desContactInfo = desActivity.contactinfo; foreach (var it in contactinfo.Items) { //organisation if (it.GetType() == typeof(AIMS_BD_IATI.Library.Parser.ParserIATIv1.textType)) //[textType has multiple] { var org = (AIMS_BD_IATI.Library.Parser.ParserIATIv1.textType)it; narrative[] arrynarrative2 = getNarrativeArray(org); desActivity.contactinfo[0].organisation = new textRequiredType(); desActivity.contactinfo[0].organisation.narrative = arrynarrative2; } //mailingaddress if (it.GetType() == typeof(AIMS_BD_IATI.Library.Parser.ParserIATIv1.contactinfoMailingaddress)) { var addr = (AIMS_BD_IATI.Library.Parser.ParserIATIv1.contactinfoMailingaddress)it; narrative[] arrynarrative2 = getNarrativeArray2(addr); desActivity.contactinfo[0].mailingaddress = new textRequiredType[1]; desActivity.contactinfo[0].mailingaddress[0] = new textRequiredType(); desActivity.contactinfo[0].mailingaddress[0].narrative = arrynarrative2; } } } #endregion #region location else if (activityItem.GetType() == typeof(AIMS_BD_IATI.Library.Parser.ParserIATIv1.location)) { var location = (AIMS_BD_IATI.Library.Parser.ParserIATIv1.location)activityItem; var locationV2 = new location(); foreach (var it in location.Items) { if (it.GetType() == typeof(AIMS_BD_IATI.Library.Parser.ParserIATIv1.locationCoordinates)) { var coordinate = (AIMS_BD_IATI.Library.Parser.ParserIATIv1.locationCoordinates)it; locationV2.point = new locationPoint { pos = coordinate.latitude + " " + coordinate.longitude }; } else if (it.GetType() == typeof(AIMS_BD_IATI.Library.Parser.ParserIATIv1.locationPoint)) { var point = (AIMS_BD_IATI.Library.Parser.ParserIATIv1.locationPoint)it; locationV2.point = new locationPoint { pos = point.Items.n(0).ToString() }; } else if (it.GetType() == typeof(AIMS_BD_IATI.Library.Parser.ParserIATIv1.locationAdministrative)) { var adm = (AIMS_BD_IATI.Library.Parser.ParserIATIv1.locationAdministrative)it; locationV2.administrative.Add(new locationAdministrative { vocabulary = adm.vocabulary, level = adm.level, code = adm.code }); } } locations.Add(locationV2); } #endregion //sector //same //policy-marker //same //collaboration-type //same //default-finance-type //same #region budget else if (activityItem.GetType() == typeof(AIMS_BD_IATI.Library.Parser.ParserIATIv1.budget)) { var budget = (AIMS_BD_IATI.Library.Parser.ParserIATIv1.budget)activityItem; foreach (var b in desActivity.budget) { b.type = budget.type == "Original" ? "1" : "2"; } } #endregion //planned-disbursement //not in 1.05 #region transaction else if (activityItem.GetType() == typeof(AIMS_BD_IATI.Library.Parser.ParserIATIv1.transaction)) { var transaction = (AIMS_BD_IATI.Library.Parser.ParserIATIv1.transaction)activityItem; var targettransaction = desActivity.transaction.FirstOrDefault(x => x.transactiontype.code == transaction.transactiontype.code); targettransaction.transactiontype.code = gettransactionCode(transaction.transactiontype.code); //------------------ } #endregion #region document - link else if (activityItem.GetType() == typeof(AIMS_BD_IATI.Library.Parser.ParserIATIv1.documentlink)) { var documentlink = (AIMS_BD_IATI.Library.Parser.ParserIATIv1.documentlink)activityItem; var d = documentlink.Items.FirstOrDefault(x => x.GetType() == typeof(textType)); if (d != null) { narrative[] arrynarrative = getNarrativeArray((textType)d); var targetdocumentlink = desActivity.documentlink.FirstOrDefault(x => x.url == documentlink.url); targetdocumentlink.title = new textRequiredType(); targetdocumentlink.title.narrative = arrynarrative; } } #endregion //conditions //Not in 1.05 //result //Not in 1.05 #region other-identifier else if (activityItem.GetType() == typeof(AIMS_BD_IATI.Library.Parser.ParserIATIv1.otheridentifier)) { var otheridentifier = (AIMS_BD_IATI.Library.Parser.ParserIATIv1.otheridentifier)activityItem; narrative[] arrynarrative = Statix.getNarativeArray(otheridentifier.ownername); var targetotheridentifier = desActivity.otheridentifier[otherIdentifierCounter]; targetotheridentifier.@ref = otheridentifier.Text.n(0); targetotheridentifier.type = "A1"; targetotheridentifier.ownerorg = new otheridentifierOwnerorg(); targetotheridentifier.ownerorg.@ref = otheridentifier.ownerref; targetotheridentifier.ownerorg.narrative = arrynarrative; targetotheridentifier.AnyAttr = null; otherIdentifierCounter++; } #endregion } desActivity.location = locations.ToArray(); } } } } //parse and assign return objDestinaiton; }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { //Bind DDLs // BindStatus(); //Load Data try { //Get the logged in User if any MembershipUser LoggedInMembershipUser; LoggedInMembershipUser = Membership.GetUser(); //Check if there is a logged in User if (LoggedInMembershipUser != null) { //Membership Data UserName.Text = LoggedInMembershipUser.UserName.ToString(); Email.Text = LoggedInMembershipUser.Email.ToString(); //Disable controls UserName.Enabled = false; Email.Enabled = false; // ToInt32 can throw FormatException or OverflowException. int UserId = -1; try { //Get the RALT data from membership accountID UserId = Convert.ToInt32(LoggedInMembershipUser.ProviderUserKey.ToString()); user UserData = UserService.GetUserByMemberId(UserId); //Bind data if (!object.ReferenceEquals(UserData, null)) { if (UserData.account_status == "Request Made") { ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "CompleteVerify", "CompleteStep(" + '0' + ");", true); PleasePayPanel.Visible = true; lblStatus.Visible = false; } else if (UserData.account_status == "Verified") { ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "CompleteVerify", "CompleteStep(" + '1' + ");", true); PleasePayPanel.Visible = true; lblStatus.Visible = false; } else if (UserData.account_status == "Email Sent") { ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "CompleteVerify", "CompleteStep(" + '2' + ");", true); PleasePayPanel.Visible = true; lblStatus.Visible = false; } else if (UserData.account_status == "Paid") { ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "CompleteVerify", "CompleteStep(" + '3' + ");", true); PleasePayPanel.Visible = false; } else if (UserData.account_status == "First Class") { ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "CompleteVerify", "CompleteStep(" + '4' + ");", true); PleasePayPanel.Visible = false; lblStatus.Visible = true; lblStatus.ForeColor = System.Drawing.ColorTranslator.FromHtml("#edac1c"); lblStatus.Text = "Rent a Language Teacher appreciates your business! Please purchase another package on our <a href='/Prices' Title='Prices'>Prices</a> page."; // } BindPayments(); //Check for location data location MyLocation = LocationService.GetUserById(UserData.user_id); if (!object.ReferenceEquals(MyLocation, null)) { } //Check for location data quickregistration MyReg = QuickRegService.GetObjectByUserId(UserData.user_id); if (!object.ReferenceEquals(MyReg, null)) { Teacher.Text = MyReg.teacher; TeacherSkype.Text = MyReg.teacher_skypeid; txtFirstClass.Text = App_Code.TimeService.ConvertToMyTime(Convert.ToDateTime(MyReg.first_class), UserData).ToString(); RentALanguageTeacher.user Admin = UserService.GetUserById(Convert.ToInt32(AppConfiguration.AdminID)); txtTeacherTime.Text = App_Code.TimeService.ConvertToMyTime(Convert.ToDateTime(MyReg.first_class), Admin).ToString(); //ddlStatus.SelectedValue = UserData.account_status; UserComments.Text = MyReg.student_comments; } } } catch (FormatException) { //Console.WriteLine("Input string is not a sequence of digits."); throw; } catch (OverflowException) { //Console.WriteLine("The number cannot fit in an Int32."); throw; } } } catch (Exception) { App_Code.NotificationService.SendNotification("StudentstatusErrorLoadError", "There was an error loading your account", "error", "4000"); } LockControls(); } }
public location location_update(int ID) { location = location.Select(ID); location.Location_ID = Convert.ToInt32(Update_Location_ID_txt.Text); location.type = Update_type_txt.Text; location.city = Update_city_txt.Text; location.state = Update_state_txt.Text; location.zip = Convert.ToInt32(Update_zip_txt.Text); location.county = Update_county_txt.Text; location.location_desc = Update_location_desc_txt.Text; location.n_long = Convert.ToDecimal(Update_n_long_txt.Text); location.s_long = Convert.ToDecimal(Update_s_long_txt.Text); location.e_long = Convert.ToDecimal(Update_e_long_txt.Text); location.w_long = Convert.ToDecimal(Update_w_long_txt.Text); location.n_lat = Convert.ToDecimal(Update_n_lat_txt.Text); location.s_lat = Convert.ToDecimal(Update_s_lat_txt.Text); location.e_lat = Convert.ToDecimal(Update_e_lat_txt.Text); location.w_lat = Convert.ToDecimal(Update_w_lat_txt.Text); location.Update(location); Insert_location_GridView.DataBind(); Update_location_GridView.DataBind(); Delete_location_GridView.DataBind(); return location; }
/// <summary> /// Проверяет, подходит ли функция для вызова с указанными параметрами /// </summary> /// <param name="candidate"></param> /// <param name="givenParameterTypes">Типы параметров, указанные пользователем</param> /// <returns></returns> private bool IsSuitableFunction( function_node candidate, type_node[] givenParameterTypes, expression_node patternInstance, location deconstructionLocation, out type_node[] parameterTypes) { parameterTypes = new type_node[givenParameterTypes.Length]; candidate.parameters[0].name = "Self"; // SSM 23.06.20 #2268 - это если в NET где-то такое нашли var selfParameter = candidate.is_extension_method ? candidate.parameters.FirstOrDefault(IsSelfParameter) : null; Debug.Assert(!candidate.is_extension_method || selfParameter != null, "Couldn't find self parameter in extension method"); var candidateParameterTypes = candidate.is_extension_method ? candidate.parameters.Where(x => !IsSelfParameter(x)).ToArray() : candidate.parameters.ToArray(); if (candidateParameterTypes.Length != givenParameterTypes.Length) { return(false); } // Разрешаем только deconstruct текущего класса, родительские в расчет не берем if (candidate is common_method_node commonMethod && !AreTheSameType(patternInstance.type, commonMethod.cont_type)) { return(false); } var genericDeduceNeeded = candidate.is_extension_method && candidate.is_generic_function; type_node[] deducedGenerics = new type_node[candidate.generic_parameters_count]; if (genericDeduceNeeded) { // Выводим дженерики по self var nils = new List <int>(); var deduceSucceded = generic_convertions.DeduceInstanceTypes(selfParameter.type, patternInstance.type, deducedGenerics, nils, candidate.get_generic_params_list()); if (!deduceSucceded || deducedGenerics.Contains(null)) { return(false); } } for (int i = 0; i < givenParameterTypes.Length; i++) { var givenParameter = givenParameterTypes[i]; var candidateParameter = candidateParameterTypes[i].type; if (genericDeduceNeeded && (candidateParameter.is_generic_parameter || candidateParameter.is_generic_type_instance)) { candidateParameter = InstantiateParameter(candidateParameter, deducedGenerics); } if (givenParameter != null && !AreTheSameType(candidateParameter, givenParameter)) { return(false); } parameterTypes[i] = candidateParameter; } return(true); }
protected void Insert_Select_Record(object sender, EventArgs e) { location = Insert_location_select(Convert.ToInt32(Insert_location_GridView.SelectedValue)); }
? CreatePrimitiveValue( location, primitiveType.BasicValueType,
protected void Update_Select_Record(object sender, EventArgs e) { location = Update_location_select(Convert.ToInt32(Update_location_GridView.SelectedValue)); }
public void DeleteAsync() { try { // Arrange. var context = new AutoTestDataContext(); // Add a user. var user = new user() { name = "user1" }; // Add a location with that userId. var location = new location() { name = "location1", user = user }; // Add a facility with that locationId. var facility = new facility() { name = "facility1", facilityType = "Commercial", location = location }; var facilityRepository = new Repository <facility>(context); var facilityService = new Service <facility>(facilityRepository); facilityService.Add(facility, "xingl"); var newfacility = new facility(); newfacility.name = "facility2"; newfacility.facilityType = "Government"; facilityService.Add(newfacility, "theox"); var facility3 = new facility(); facility3.name = "facility3"; facility3.facilityType = "Government"; facilityService.Add(facility3, "theox"); // Act. var result = new Service <facility>(new Repository <facility>(new AutoTestDataContext())).DeleteAsync(facility3.facilityId, "theox", softDelete: true).Result; var shouldNotHaveIt = new Service <facility>(new Repository <facility>(new AutoTestDataContext())).Queryable() .Where(i => i.facilityId == facility3.facilityId); var shouldHaveIt = new Service <facility>(new Repository <facility>(new AutoTestDataContext())).Queryable(includeSoftDeleted: true) .Where(i => i.facilityId == facility3.facilityId); // Assert. Assert.IsFalse(shouldNotHaveIt.Any()); Assert.IsTrue(shouldHaveIt.Any()); } finally { // Clean up database. var context = new AutoTestDataContextNonTrackerEnabled(); context.users.RemoveRange(context.users.ToList()); context.locations.RemoveRange(context.locations.ToList()); context.facilities.RemoveRange(context.facilities.ToList()); context.SaveChanges(); var context2 = new AutoTestDataContext(); context2.LogDetails.RemoveRange(context2.LogDetails.ToList()); context2.AuditLog.RemoveRange(context2.AuditLog.ToList()); context2.SaveChanges(); } }
this.GetGroup(location, visibleTiles, this.Fertilizer, HoeDirt.fertilizerLowQuality, HoeDirt.fertilizerHighQuality),
this.GetGroup(location, visibleTiles, this.SpeedGro, HoeDirt.speedGro, HoeDirt.superSpeedGro),
public location GetLocation(string address) { location ret = new location() { lat = 0, lng = 0 }; System.Net.WebClient wc = new System.Net.WebClient(); string surl = string.Format(url2, ak, HttpUtility.UrlEncode(address)); try { wc.Headers.Add("content-type", "application/json;charset=utf-8"); Console.WriteLine(surl +address); string ss = wc.DownloadString(surl); Console.WriteLine(ss); //ss = "{\"status\":0,\"result\":{\"location\":{\"lng\":1,\"lat\":1}}}"; locationResult loc = Newtonsoft.Json.JsonConvert.DeserializeObject<locationResult>(ss); if (loc != null && loc.status == "0") { ret = loc.result.location; } //Console.WriteLine(ss+","+ret); } catch (Exception err) { Console.WriteLine(err.Message); } return ret; }
public List <Station> ImminentStations(location Location) { return(stationService.ImminentStations(Location)); }
private void add_flowLayoutBrands(location state, BrandBox brandbox) { if (state == location.Table && brandbox.brand.IsCanSee == false) fl_Table.Controls.Add(brandbox); else if (brandbox.brand.IsCanSee == true && brandbox.brand.Team >= 1) fl_Show_from_location(state).Controls.Add(brandbox); else fl_Hand_from_location(state).Controls.Add(brandbox); }
/// <summary> /// 新增圖片反覆器 /// </summary> /// <param name="iterator">玩家反覆器</param> /// <param name="state">目前方位</param> /// <param name="rotate">圖片方向</param> protected virtual void addimage_iterator(Iterator iterator, location state, RotateFlipType rotate) { while (iterator.hasNext()) { Brand brand = (Brand)iterator.next(); addimage(state, brand, rotate); } }
this.GetGroup(location, visibleTiles, this.RetainingSoil, HoeDirt.waterRetentionSoil, HoeDirt.waterRetentionSoilQUality)
/// <summary> /// Преобразует в семантическое представление поля to и from, проводя семантические проверки. /// </summary> private void AssignCheckAndConvert(assign _assign, out addressed_expression to, out expression_node from) { internal_is_assign = true; to = convert_address_strong(_assign.to); internal_is_assign = false; if (to == null) { AddError(get_location(_assign.to), "CAN_NOT_ASSIGN_TO_LEFT_PART"); } //(ssyy) Вставляю проверки прямо сюда, т.к. запарился вылавливать другие случаи. bool flag; general_node_type node_type; if (convertion_data_and_alghoritms.check_for_constant_or_readonly(to, out flag, out node_type)) { if (flag) { AddError(to.location, "CAN_NOT_ASSIGN_TO_CONSTANT_OBJECT"); } else { AddError(new CanNotAssignToReadOnlyElement(to.location, node_type)); } } // SSM исправление Саушкина 10.03.16 var fromAsLambda = _assign.from as function_lambda_definition; if (fromAsLambda != null) { #region Вывод параметров лямбда-выражения LambdaHelper.InferTypesFromVarStmt(to.type, fromAsLambda, this); //lroman// #endregion var lambdaVisitMode = fromAsLambda.lambda_visit_mode; fromAsLambda.lambda_visit_mode = LambdaVisitMode.VisitForAdvancedMethodCallProcessing; from = convert_strong(_assign.from); fromAsLambda.lambda_visit_mode = lambdaVisitMode; } else { from = convert_strong(_assign.from); ProcessAssigntToAutoType(to, ref from); } // end //SSM 4.04.16 if (to.type is undefined_type) { to.type = from.type; } location loc = get_location(_assign); if (to is class_field_reference) { var classFieldRef = to as class_field_reference; if (classFieldRef.obj.type.type_special_kind == type_special_kind.record && classFieldRef.obj is base_function_call) { //исключим ситуацию обращения к массиву if (!(classFieldRef.obj is common_method_call && (classFieldRef.obj as common_method_call).obj.type.type_special_kind == type_special_kind.array_wrapper)) { AddError(loc, "LEFT_SIDE_CANNOT_BE_ASSIGNED_TO"); } } //else check_field_reference_for_assign(to as class_field_reference,loc); } if (context.is_in_cycle() && !SemanticRules.AllowChangeLoopVariable) { var_definition_node toAsVariable = GetLocalVariableFromAdressExpressionIfPossible(to); if (toAsVariable != null && context.is_loop_variable(toAsVariable)) { AddError(to.location, "CANNOT_ASSIGN_TO_LOOP_VARIABLE"); } } { var classFieldRef = (to as simple_array_indexing)?.simple_arr_expr as class_field_reference; if (classFieldRef?.obj is constant_node) { AddError(loc, "LEFT_SIDE_CANNOT_BE_ASSIGNED_TO"); } } }