Exemplo n.º 1
0
        protected override void ResourceLoader()
        {
            base.ResourceLoader();

            for (int i = 0; i < Elements.Count; i++)
            {
                Console.WriteLine("{0}: {1} '{2}'", i, Elements[i].Type, Elements[i].Text);
            }

            Elements[OK_ELEMENT_INDEX].Activate +=
                delegate() {
                if (Ok != null)
                {
                    Ok();
                }
            };

            ListBoxElement list     = (ListBoxElement)Elements[HELPLIST_ELEMENT_INDEX];
            Tbl            help_txt = (Tbl)mpq.GetResource(Builtins.rez_HelpTxtTbl);

            for (int i = 0; i < help_txt.Strings.Length; i++)
            {
                list.AddItem(help_txt.Strings[i]);
            }
        }
Exemplo n.º 2
0
 /// <summary>
 /// Resolves the links.
 /// </summary>
 /// <param name="Twin">The twin.</param>
 public void ResolveLinks(Base NewParent)
 {
     foreach (Table Tbl in m_Tables)
     {
         Tbl.ResolveLinks(NewParent);
     }
 }
Exemplo n.º 3
0
    public static void Main(string[] args)
    {
        string filename = args[0];

        FileStream fs = File.OpenRead(filename);

        Tbl tbl = new Tbl();

        ((MpqResource)tbl).ReadFromStream(fs);

        Console.WriteLine("dumping {0}", filename);
        for (int i = 0; i < tbl.Strings.Length; i++)
        {
            Console.WriteLine("strings[{0}] = {1}", i, tbl.Strings[i]);
        }
    }
Exemplo n.º 4
0
        public unsafe DeserializeResult Deserialize(byte[] mass)
        {
            Table[]  tables;
            uint     userID;
            DateTime synchDT;
            int      SPos = Encoding.GetByteCount(Mark);

            {
                fixed(void *numPtr = &mass[mass.Length - 4])
                {
                    userID = *(uint *)numPtr;
                }

                fixed(void *numPtr = &mass[mass.Length - 8 - 4])
                {
                    synchDT = new DateTime(*(long *)numPtr);
                }
            }

            {
                int TableCount;
                fixed(void *numPtr = &mass[SPos])
                {
                    TableCount = *(int *)numPtr;
                }                               //количество таблиц

                SPos  += 4;
                tables = new Table[TableCount];
            }

            //гружу записи
            for (int i = 0; i < tables.Length; i++)
            {
                DataBase.ISTable Table;
                DataBase.ITable  Tbl;
                {
                    string TableName;
                    int    TableNameLength;
                    fixed(void *numPtr = &mass[SPos])
                    {
                        TableNameLength = *(int *)numPtr;
                    }                                    //длина имени таблицы

                    SPos     += sizeof(int);
                    TableName = Encoding.GetString(mass, SPos, TableNameLength);  //имя таблицы
                    SPos     += TableNameLength;

                    Tbl = _dataBase.Tables[TableName];
                    if (Tbl == null)
                    {
                        throw new Exception($"Таблица не найдена: \"{TableName}\"");
                    }

                    Table = Tbl.CreateSubTable(false);
                }

                int RowCount;
                fixed(void *numPtr = &mass[SPos])
                {
                    RowCount = *(int *)numPtr;
                }

                SPos += sizeof(int);

                int RowsDataLength, CheckRowsDataLength = 0;
                fixed(void *numPtr = &mass[SPos])
                {
                    RowsDataLength = *(int *)numPtr;
                }                                   //длина данных

                SPos += sizeof(int);

                var rows = new Row[RowCount];

                for (int j = 0; j < RowCount; j++)
                {
                    CheckRowsDataLength += sizeof(uint) + sizeof(int) + sizeof(DataBase.State);    //id+метка об удалении + длина записи
                    int RowDataLength, CheckRowDataLength = sizeof(uint) + sizeof(DataBase.State); //id+метка об удалении

                    fixed(void *numPtr = &mass[SPos])
                    {
                        RowDataLength = *(int *)numPtr;
                    }                                   //длина следующей записи

                    SPos += sizeof(int);

                    uint ID;
                    fixed(void *numPtr = &mass[SPos])
                    {
                        ID = *(uint *)numPtr;
                    }                         //идентификатор

                    SPos += sizeof(uint);

                    DataBase.State InUse;
                    fixed(void *numPtr = &mass[SPos])
                    {
                        InUse = *(DataBase.State *)numPtr;
                    }                                      //метка об удалении

                    SPos += sizeof(DataBase.State);

                    object[] Values;
                    int      ColumnIndex = 0;

                    Values = new object[Tbl.Columns.Count];
                    //Values[Values.Length - 1] = SPoolID;

                    rows[j] = new Row(ID, InUse, Values);

                    //тут важно, чтобы у всех таблиц были колонки relation spool и располагались в конце
                    for (int k = 0; k < Tbl.Columns.Count - 1; k++)
                    {
                        var column = Tbl.GetColumn(k);

                        if (!column.Protect)
                        {
                            switch (column.TypeCol)
                            {
                            case DataBase.Types.Bool:
                                fixed(void *numPtr = &mass[SPos])
                                {
                                    Values[k] = *(bool *)numPtr;
                                }

                                SPos += sizeof(bool);
                                CheckRowDataLength  += sizeof(bool);
                                CheckRowsDataLength += sizeof(bool);
                                break;

                            case DataBase.Types.AutoStatus:
                                fixed(void *numPtr = &mass[SPos])
                                {
                                    Values[k] = (*(bool *)numPtr ? DataBase.AutoStatus.Used : DataBase.AutoStatus.UnUse);
                                }

                                SPos += sizeof(bool);
                                CheckRowDataLength  += sizeof(bool);
                                CheckRowsDataLength += sizeof(bool);
                                break;

                            case DataBase.Types.Byte:
                                Values[k]            = mass[SPos];
                                SPos                += sizeof(byte);
                                CheckRowDataLength  += sizeof(byte);
                                CheckRowsDataLength += sizeof(byte);
                                break;

                            case DataBase.Types.DateTime:
                                fixed(void *numPtr = &mass[SPos])
                                {
                                    Values[k] = new DateTime(*(long *)numPtr);
                                }

                                SPos += sizeof(long);
                                CheckRowDataLength  += sizeof(long);
                                CheckRowsDataLength += sizeof(long);
                                break;

                            case DataBase.Types.Double:
                                fixed(void *numPtr = &mass[SPos])
                                {
                                    Values[k] = *(double *)numPtr;
                                }

                                SPos += sizeof(double);
                                CheckRowDataLength  += sizeof(double);
                                CheckRowsDataLength += sizeof(double);
                                break;

                            case DataBase.Types.Decimal:
                                fixed(void *numPtr = &mass[SPos])
                                {
                                    Values[k] = *(decimal *)numPtr;
                                }

                                SPos += sizeof(decimal);
                                CheckRowDataLength  += sizeof(decimal);
                                CheckRowsDataLength += sizeof(decimal);
                                break;

                            case DataBase.Types.Int64:
                                fixed(void *numPtr = &mass[SPos])
                                {
                                    Values[k] = *(long *)numPtr;
                                }

                                SPos += sizeof(long);
                                CheckRowDataLength  += sizeof(long);
                                CheckRowsDataLength += sizeof(long);
                                break;

                            case DataBase.Types.Int32:
                                fixed(void *numPtr = &mass[SPos])
                                {
                                    Values[k] = *(int *)numPtr;
                                }

                                SPos += sizeof(int);
                                CheckRowDataLength  += sizeof(int);
                                CheckRowsDataLength += sizeof(int);
                                break;

                            case DataBase.Types.RIU32:
                                fixed(void *numPtr = &mass[SPos])
                                {
                                    Values[k] = new RIU32(*(uint *)numPtr);
                                }

                                SPos += sizeof(uint);
                                CheckRowDataLength  += sizeof(uint);
                                CheckRowsDataLength += sizeof(uint);
                                break;

                            case DataBase.Types.String:    //тут надо бдительничать!
                                int StrLength;
                                fixed(void *numPtr = &mass[SPos])
                                {
                                    StrLength = *(int *)numPtr;
                                }

                                SPos += sizeof(int);
                                CheckRowDataLength  += sizeof(int);
                                CheckRowsDataLength += sizeof(int);

                                Values[k]            = Encoding.GetString(mass, SPos, StrLength);
                                SPos                += StrLength;
                                CheckRowDataLength  += StrLength;
                                CheckRowsDataLength += StrLength;
                                break;

                            default: throw new Exception("не поддерживаемый тип");
                            }
                            ColumnIndex++;
                        }
                    }

                    if (CheckRowDataLength != RowDataLength)
                    {
                        throw new Exception($"Сообщение повреждено: {tables[i].STable.Name} {(j + 1).ToString()}-{ID} CheckRowDataLength != RowDataLength({CheckRowDataLength}!={RowDataLength})");
                    }
                }

                tables[i] = new Table()
                {
                    STable = Table, Rows = rows
                };

                if (CheckRowsDataLength != RowsDataLength)
                {
                    throw new Exception($"Сообщение повреждено: {tables[i].STable.Name} CheckRowsDataLength != RowsDataLength({CheckRowsDataLength}!={RowsDataLength})");
                }
            }

            return(new DeserializeResult()
            {
                Tables = tables, SynchDate = synchDT, UserID = userID
            });
        }
Exemplo n.º 5
0
        public DBObjectsFiltering(ProjectDataBase dB)
        {
            timer.Tick    += ApplyTextFilter;
            timer.Interval = new TimeSpan(0, 0, 0, 0, 400);

            DataContext = dB;

            Mouse.OverrideCursor = Cursors.Wait;
            try
            {
                dB.UpdateFilterDataFromConfig();

                InitializeComponent();

                SqlConnection conn = new SqlConnection(dB.GetConnectionString());

                Server server = new Server(new ServerConnection(conn));

                if (!HasConnection(dB.GetConnectionString()))
                {
                    throw new Exception($@"Не удалось подключиться к серверу: {dB.Project.Server}");
                }

                Database dataBase = server.Databases.Cast <Database>().ToList().SingleOrDefault(d => d.Name == dB.Name);

                if (dataBase == null)
                {
                    MessageBox.Show($@"На сервере {dB.Project.Server} не найдена база данных: {dB.Name}");
                    return;
                }

                dataBase.Schemas.Cast <Schema>().ToList()
                .Where(s => !s.IsSystemObject || s.Name == "dbo").ToList()
                .ForEach(s =>
                {
                    string sName = $@"{s.Name}";
                    Sch sch      = dB.Schemas.SingleOrDefault(sh => sh.ToString() == sName);

                    if (sch == null)
                    {
                        var NewSchema = new Sch(sName);
                        dB.Schemas.Add(NewSchema);
                    }
                }
                         );

                dataBase.StoredProcedures.Cast <StoredProcedure>().ToList()
                .Where(sp => sp.Schema != "sys").ToList()
                .ForEach(sp =>
                {
                    string spName  = $@"{sp.Schema}.{sp.Name}";
                    Procedure proc = dB.Procedures.SingleOrDefault(s => s.ToString() == spName);

                    if (proc == null)
                    {
                        var NewProc = new Procedure(spName);
                        dB.Procedures.Add(NewProc);
                    }
                }
                         );

                dataBase.UserDefinedFunctions.Cast <UserDefinedFunction>().ToList()
                .Where(f => f.Schema != "sys").ToList()
                .ForEach(f =>
                {
                    string fnName = $@"{f.Schema}.{f.Name}";
                    Function fn   = dB.Functions.SingleOrDefault(fun => fun.ToString() == fnName);

                    if (fn == null)
                    {
                        var NewFn = new Function(fnName);
                        dB.Functions.Add(NewFn);
                    }
                }
                         );

                dataBase.Tables.Cast <Table>().ToList()
                .Where(t => t.Schema != "sys").ToList()
                .ForEach(t =>
                {
                    string tblName = $@"{t.Schema}.{t.Name}";
                    Tbl tbl        = dB.Tables.SingleOrDefault(tab => tab.ToString() == tblName);

                    if (tbl == null)
                    {
                        var NewTable = new Tbl(tblName);
                        dB.Tables.Add(NewTable);
                    }
                }
                         );

                Filtering();
            }
            finally
            {
                Mouse.OverrideCursor = null;
            }
        }
Exemplo n.º 6
0
		protected override void ResourceLoader ()
		{
			base.ResourceLoader ();

			/* create the element corresponding to the hud */
			hudElement = new ImageElement (this, 0, 0, 640, 480, TranslucentIndex);
			hudElement.Text = String.Format (Builtins.Game_ConsolePcx, Util.RaceCharLower[(int)Game.Instance.Race]);
			hudElement.Visible = true;
			Elements.Add (hudElement);

			/* create the portrait playing area */
			portraitElement = new MovieElement (this, 415, 415, 48, 48, false);
			portraitElement.Visible = true;
			Elements.Add (portraitElement);
			
			Pcx pcx = new Pcx ();
			pcx.ReadFromStream ((Stream)mpq.GetResource ("game\\tunit.pcx"), -1, -1);
			//unit_palette = pcx.Palette;

			pcx = new Pcx ();
			pcx.ReadFromStream ((Stream)mpq.GetResource ("tileset\\badlands\\dark.pcx"), 0, 0);
			tileset_palette = pcx.Palette;

			if (scenario.Tileset == Tileset.Platform) {
				Spk starfield = (Spk)mpq.GetResource ("parallax\\star.spk");

				starfield_layers = new Surface [starfield.Layers.Length];
				for (int i = 0; i < starfield_layers.Length; i ++) {
					starfield_layers[i] = new Surface (Painter.SCREEN_RES_X, Painter.SCREEN_RES_Y);

					starfield_layers[i].TransparentColor = Color.Black;

					for (int o = 0; o < starfield.Layers[i].Objects.Length; o ++) {
						ParallaxObject obj = starfield.Layers[i].Objects[o];

						starfield_layers[i].Fill (new Rectangle (new Point (obj.X, obj.Y), new Size (2,2)),
									  Color.White);
					}
				}
			}

			mapRenderer = new MapRenderer (mpq, scenario, Painter.SCREEN_RES_X, Painter.SCREEN_RES_Y);
			
			// load the cursors we'll show when scrolling with the mouse
			string[] cursornames = new string[] {
				"cursor\\ScrollUL.grp",
				"cursor\\ScrollU.grp",
				"cursor\\ScrollUR.grp",
				"cursor\\ScrollR.grp",
				"cursor\\ScrollDR.grp",
				"cursor\\ScrollD.grp",
				"cursor\\ScrollDL.grp",
				"cursor\\ScrollL.grp",
			};
			ScrollCursors = new CursorAnimator [cursornames.Length];
			for (int i = 0; i < cursornames.Length; i ++) {
				ScrollCursors[i] = new CursorAnimator ((Grp)mpq.GetResource (cursornames[i]),
								       effectpal.Palette);
				ScrollCursors[i].SetHotSpot (60, 60);
			}

			// load the mag cursors
			string[] magcursornames = new string[] {
				"cursor\\MagG.grp",
				"cursor\\MagY.grp",
				"cursor\\MagR.grp"
			};
			MagCursors = new CursorAnimator [magcursornames.Length];
			for (int i = 0; i < magcursornames.Length; i ++) {
				MagCursors[i] = new CursorAnimator ((Grp)mpq.GetResource (magcursornames[i]),
								    effectpal.Palette);
				MagCursors[i].SetHotSpot (60, 60);
			}

			// load the targeting cursors
			string[] targetcursornames = new string[] {
				"cursor\\TargG.grp",
				"cursor\\TargY.grp",
				"cursor\\TargR.grp"
			};
			TargetCursors = new CursorAnimator [targetcursornames.Length];
			for (int i = 0; i < targetcursornames.Length; i ++) {
				TargetCursors[i] = new CursorAnimator ((Grp)mpq.GetResource (targetcursornames[i]),
								       effectpal.Palette);
				TargetCursors[i].SetHotSpot (60, 60);
			}

			/* the following could be made global to speed up the entry to the game screen.. */
			statTxt = (Tbl)mpq.GetResource ("rez\\stat_txt.tbl");

			// load the wireframe image info
			wireframe = (Grp)mpq.GetResource ("unit\\wirefram\\wirefram.grp");

			// load the command icons
			cmdicons = (Grp)mpq.GetResource ("unit\\cmdbtns\\cmdicons.grp");
			pcx = new Pcx ();
			pcx.ReadFromStream ((Stream)mpq.GetResource ("unit\\cmdbtns\\ticon.pcx"), 0, 0);
			cmdicon_palette = pcx.Palette;

			// create the wireframe display element
			wireframeElement = new GrpElement (this, wireframe, cmdicon_palette, 170, 390);
			wireframeElement.Visible = false;
			Elements.Add (wireframeElement);

			labelElements = new LabelElement [(int)HudLabels.Count];

			labelElements[(int)HudLabels.UnitName] = new LabelElement (this, fontpal.Palette,
										   GuiUtil.GetFonts (Mpq)[1],
										   254, 390);
			labelElements[(int)HudLabels.ResourceUsed] = new LabelElement (this, fontpal.Palette,
										       GuiUtil.GetFonts (Mpq)[0],
										       292, 420);
			labelElements[(int)HudLabels.ResourceProvided] = new LabelElement (this, fontpal.Palette,
											   GuiUtil.GetFonts (Mpq)[0],
											   292, 434);
			labelElements[(int)HudLabels.ResourceTotal] = new LabelElement (this, fontpal.Palette,
											GuiUtil.GetFonts (Mpq)[0],
											292, 448);
			labelElements[(int)HudLabels.ResourceMax] = new LabelElement (this, fontpal.Palette,
										      GuiUtil.GetFonts (Mpq)[0],
										      292, 462);

			for (int i = 0; i < labelElements.Length; i ++)
				Elements.Add (labelElements[i]);

			cmdButtonElements = new GrpButtonElement[9];
			int x = 0;
			int y = 0;
			for (int i = 0; i < cmdButtonElements.Length; i ++) {
				cmdButtonElements[i] = new GrpButtonElement (this, cmdicons, cmdicon_palette, button_xs[x], button_ys[y]);
				x++;
				if (x == 3) {
					x = 0;
					y++;
				}
				cmdButtonElements[i].Visible = false;
				Elements.Add (cmdButtonElements[i]);
			}

			PlaceInitialUnits ();

			Events.Tick += ScrollTick;
		}
Exemplo n.º 7
0
        private void FrmDispRpt_Load(object sender, EventArgs e)
        {
            Form      frm = (Form)Application.OpenForms["FrmMDI"];
            MenuStrip ms  = (MenuStrip)frm.Controls["menuStrip1"];

            ms.Visible = false;

            this.WindowState = FormWindowState.Maximized;
            Application.DoEvents();
            Application.EnableVisualStyles();
            this.Text = Hdng;

            ReportDocument rd = new ReportDocument();

            rd.Load(Application.StartupPath + "\\Reports\\" + Rpt_Name);
            foreach (Table Tbl in rd.Database.Tables)
            {
                TableLogOnInfo tt = new TableLogOnInfo();
                tt.ConnectionInfo.ServerName = "orcl12c";
                tt.ConnectionInfo.UserID     = "c##hdmagazine";
                tt.ConnectionInfo.Password   = "******";
                Tbl.ApplyLogOnInfo(tt);
            }

            string msg = GetReportParamsAsText(rd);

            string[] prms = msg.Split('@');
            for (int i = 0; i < prms.Length; i++)
            {
                switch (prms[i].ToUpper())
                {
                case "LOGO":
                    da = new OracleDataAdapter("select * from mas_settings where Parameter='LOGO'", db.Con);
                    tb = new DataTable();
                    da.Fill(tb);
                    fs   = new FileStream(Application.StartupPath.ToString() + "\\Logo.jpg", FileMode.Create);
                    blob = (byte[])tb.Rows[0]["Image"];
                    fs.Write(blob, 0, blob.Length);
                    fs.Close();
                    fs = null;
                    rd.SetParameterValue("Logo", Application.StartupPath.ToString() + "\\Logo.jpg");
                    break;

                case "LH_H":
                    da = new OracleDataAdapter("select * from mas_settings where parameter='LH_HEAD'", db.Con);
                    tb = new DataTable();
                    da.Fill(tb);
                    fs   = new FileStream(Application.StartupPath.ToString() + "\\LH_H.jpg", FileMode.Create);
                    blob = (byte[])tb.Rows[0]["Image"];
                    fs.Write(blob, 0, blob.Length);
                    fs.Close();
                    fs = null;
                    rd.SetParameterValue("LH_H", Application.StartupPath.ToString() + "\\LH_H.jpg");
                    break;

                case "LH_F":
                    da = new OracleDataAdapter("select * from mas_settings where parameter='LH_FOOT'", db.Con);
                    tb = new DataTable();
                    da.Fill(tb);
                    fs   = new FileStream(Application.StartupPath.ToString() + "\\LH_F.jpg", FileMode.Create);
                    blob = (byte[])tb.Rows[0]["Image"];
                    fs.Write(blob, 0, blob.Length);
                    fs.Close();
                    fs = null;
                    rd.SetParameterValue("LH_F", Application.StartupPath.ToString() + "\\LH_F.jpg");
                    break;

                case "SIG_IMG":
                    da = new OracleDataAdapter("select * from mas_settings where parameter='SIG'", db.Con);
                    tb = new DataTable();
                    da.Fill(tb);
                    fs   = new FileStream(Application.StartupPath.ToString() + "\\SIG.jpg", FileMode.Create);
                    blob = (byte[])tb.Rows[0]["Image"];
                    fs.Write(blob, 0, blob.Length);
                    fs.Close();
                    fs = null;
                    rd.SetParameterValue("Sig_Img", Application.StartupPath.ToString() + "\\SIG.jpg");
                    break;

                case "PAN":
                    ds = db.GetTableData("select * from mas_settings where parameter='PAN'");
                    foreach (DataRow dr in ds.Tables[0].Rows)
                    {
                        rd.SetParameterValue("PAN", dr["Value"].ToString());
                    }
                    break;

                case "ST":
                    ds = db.GetTableData("select * from mas_settings where Parameter='ST_NO'");
                    foreach (DataRow dr in ds.Tables[0].Rows)
                    {
                        rd.SetParameterValue("ST", dr["Value"].ToString());
                    }
                    break;

                case "TAN":
                    ds = db.GetTableData("select * from mas_settings where parameter='TIN'");
                    foreach (DataRow dr in ds.Tables[0].Rows)
                    {
                        rd.SetParameterValue("TIN", dr["Value"].ToString());
                    }
                    break;

                case "CIN":
                    ds = db.GetTableData("select * from mas_settings where parameter='CIN'");
                    foreach (DataRow dr in ds.Tables[0].Rows)
                    {
                        rd.SetParameterValue("CIN", dr["Value"].ToString());
                    }
                    break;

                case "GSTIN":
                    ds = db.GetTableData("select * from mas_settings where parameter='GST NO'");
                    foreach (DataRow dr in ds.Tables[0].Rows)
                    {
                        rd.SetParameterValue("GSTIN", dr["Value"].ToString());
                    }
                    break;

                case "STATECODE":
                    ds = db.GetTableData("select * from mas_settings where parameter='STATE CODE'");
                    foreach (DataRow dr in ds.Tables[0].Rows)
                    {
                        rd.SetParameterValue("STATECODE", dr["Value"].ToString());
                    }
                    break;

                case "BANKNAME":
                    ds = db.GetTableData("select * from mas_settings where parameter='BANK NAME'");
                    foreach (DataRow dr in ds.Tables[0].Rows)
                    {
                        rd.SetParameterValue("BANKNAME", dr["Value"].ToString());
                    }
                    break;

                case "BANKBRANCH":
                    ds = db.GetTableData("select * from mas_settings where parameter='BRANCH NAME'");
                    foreach (DataRow dr in ds.Tables[0].Rows)
                    {
                        rd.SetParameterValue("BANKBRANCH", dr["Value"].ToString());
                    }
                    break;

                case "BANKCITY":
                    ds = db.GetTableData("select * from mas_settings where parameter='BANK CITY'");
                    foreach (DataRow dr in ds.Tables[0].Rows)
                    {
                        rd.SetParameterValue("BANKCITY", dr["Value"].ToString());
                    }
                    break;

                case "BANKSTATE":
                    ds = db.GetTableData("select * from mas_settings where parameter='BANK STATE'");
                    foreach (DataRow dr in ds.Tables[0].Rows)
                    {
                        rd.SetParameterValue("BANKSTATE", dr["Value"].ToString());
                    }
                    break;

                case "IFSC":
                    ds = db.GetTableData("select * from mas_settings where parameter='IFSC CODE'");
                    foreach (DataRow dr in ds.Tables[0].Rows)
                    {
                        rd.SetParameterValue("IFSC", dr["Value"].ToString());
                    }
                    break;

                case "MICR":
                    ds = db.GetTableData("select * from mas_settings where parameter='MICR CODE'");
                    foreach (DataRow dr in ds.Tables[0].Rows)
                    {
                        rd.SetParameterValue("MICR", dr["Value"].ToString());
                    }
                    break;

                case "ACNO":
                    ds = db.GetTableData("select * from mas_settings where parameter='CC ACNO'");
                    foreach (DataRow dr in ds.Tables[0].Rows)
                    {
                        rd.SetParameterValue("ACNO", dr["Value"].ToString());
                    }
                    break;
                }
            }

            rd.SetParameterValue("username", GlobalClass.UserName);
            rd.SetParameterValue("Company", "Shreya Broadcasting Pvt. Ltd.,");
            rd.SetParameterValue("Add1", "Plot No. 92, Road No. 1, Jubilee Hills, Hyderabad - 500 033");
            rd.SetParameterValue("Add2", "Tel: +91 40 2355 5555 Fax : 3061 6527 E-Mail: [email protected], www.hindudharmam.in");
            //parameter split by '@'
            //name and value split by '~'
            if (Prmtrs != null)
            {
                string[] p = Prmtrs.Split('@');
                for (int i = 1; i <= p.Length; i++)
                {
                    string[] k = p[i - 1].Split('~');
                    rd.SetParameterValue(k[0].ToString(), k[1].ToString());
                }
            }
            crystalReportViewer1.ReportSource = rd;

            if (Cnd != null)
            {
                crystalReportViewer1.SelectionFormula = Cnd;
            }

            crystalReportViewer1.ShowGroupTreeButton      = false;
            crystalReportViewer1.ShowParameterPanelButton = false;
            crystalReportViewer1.ShowCloseButton          = true;
            crystalReportViewer1.ShowExportButton         = true;
            crystalReportViewer1.ShowGotoPageButton       = true;
            crystalReportViewer1.ShowPageNavigateButtons  = true;
            crystalReportViewer1.ShowPrintButton          = true;
            crystalReportViewer1.ShowRefreshButton        = true;
            crystalReportViewer1.ShowTextSearchButton     = true;
            crystalReportViewer1.ShowZoomButton           = true;
            crystalReportViewer1.BringToFront();
            Application.DoEvents();
        }
Exemplo n.º 8
0
        protected override void ResourceLoader()
        {
            base.ResourceLoader();

            /* create the element corresponding to the hud */
            hudElement         = new ImageElement(this, 0, 0, 640, 480, TranslucentIndex);
            hudElement.Text    = String.Format(Builtins.Game_ConsolePcx, Util.RaceCharLower[(int)Game.Instance.Race]);
            hudElement.Visible = true;
            Elements.Add(hudElement);

            /* create the portrait playing area */
            portraitElement         = new MovieElement(this, 415, 415, 48, 48, false);
            portraitElement.Visible = true;
            Elements.Add(portraitElement);

            Pcx pcx = new Pcx();

            pcx.ReadFromStream((Stream)mpq.GetResource("game\\tunit.pcx"), -1, -1);
            //unit_palette = pcx.Palette;

            pcx = new Pcx();
            pcx.ReadFromStream((Stream)mpq.GetResource("tileset\\badlands\\dark.pcx"), 0, 0);
            tileset_palette = pcx.Palette;

            if (scenario.Tileset == Tileset.Platform)
            {
                Spk starfield = (Spk)mpq.GetResource("parallax\\star.spk");

                starfield_layers = new Surface [starfield.Layers.Length];
                for (int i = 0; i < starfield_layers.Length; i++)
                {
                    starfield_layers[i] = new Surface(Painter.SCREEN_RES_X, Painter.SCREEN_RES_Y);

                    starfield_layers[i].TransparentColor = Color.Black;

                    for (int o = 0; o < starfield.Layers[i].Objects.Length; o++)
                    {
                        ParallaxObject obj = starfield.Layers[i].Objects[o];

                        starfield_layers[i].Fill(new Rectangle(new Point(obj.X, obj.Y), new Size(2, 2)),
                                                 Color.White);
                    }
                }
            }

            mapRenderer = new MapRenderer(mpq, scenario, Painter.SCREEN_RES_X, Painter.SCREEN_RES_Y);

            // load the cursors we'll show when scrolling with the mouse
            string[] cursornames = new string[] {
                "cursor\\ScrollUL.grp",
                "cursor\\ScrollU.grp",
                "cursor\\ScrollUR.grp",
                "cursor\\ScrollR.grp",
                "cursor\\ScrollDR.grp",
                "cursor\\ScrollD.grp",
                "cursor\\ScrollDL.grp",
                "cursor\\ScrollL.grp",
            };
            ScrollCursors = new CursorAnimator [cursornames.Length];
            for (int i = 0; i < cursornames.Length; i++)
            {
                ScrollCursors[i] = new CursorAnimator((Grp)mpq.GetResource(cursornames[i]),
                                                      effectpal.Palette);
                ScrollCursors[i].SetHotSpot(60, 60);
            }

            // load the mag cursors
            string[] magcursornames = new string[] {
                "cursor\\MagG.grp",
                "cursor\\MagY.grp",
                "cursor\\MagR.grp"
            };
            MagCursors = new CursorAnimator [magcursornames.Length];
            for (int i = 0; i < magcursornames.Length; i++)
            {
                MagCursors[i] = new CursorAnimator((Grp)mpq.GetResource(magcursornames[i]),
                                                   effectpal.Palette);
                MagCursors[i].SetHotSpot(60, 60);
            }

            // load the targeting cursors
            string[] targetcursornames = new string[] {
                "cursor\\TargG.grp",
                "cursor\\TargY.grp",
                "cursor\\TargR.grp"
            };
            TargetCursors = new CursorAnimator [targetcursornames.Length];
            for (int i = 0; i < targetcursornames.Length; i++)
            {
                TargetCursors[i] = new CursorAnimator((Grp)mpq.GetResource(targetcursornames[i]),
                                                      effectpal.Palette);
                TargetCursors[i].SetHotSpot(60, 60);
            }

            /* the following could be made global to speed up the entry to the game screen.. */
            statTxt = (Tbl)mpq.GetResource("rez\\stat_txt.tbl");

            // load the wireframe image info
            wireframe = (Grp)mpq.GetResource("unit\\wirefram\\wirefram.grp");

            // load the command icons
            cmdicons = (Grp)mpq.GetResource("unit\\cmdbtns\\cmdicons.grp");
            pcx      = new Pcx();
            pcx.ReadFromStream((Stream)mpq.GetResource("unit\\cmdbtns\\ticon.pcx"), 0, 0);
            cmdicon_palette = pcx.Palette;

            // create the wireframe display element
            wireframeElement         = new GrpElement(this, wireframe, cmdicon_palette, 170, 390);
            wireframeElement.Visible = false;
            Elements.Add(wireframeElement);

            labelElements = new LabelElement [(int)HudLabels.Count];

            labelElements[(int)HudLabels.UnitName] = new LabelElement(this, fontpal.Palette,
                                                                      GuiUtil.GetFonts(Mpq)[1],
                                                                      254, 390);
            labelElements[(int)HudLabels.ResourceUsed] = new LabelElement(this, fontpal.Palette,
                                                                          GuiUtil.GetFonts(Mpq)[0],
                                                                          292, 420);
            labelElements[(int)HudLabels.ResourceProvided] = new LabelElement(this, fontpal.Palette,
                                                                              GuiUtil.GetFonts(Mpq)[0],
                                                                              292, 434);
            labelElements[(int)HudLabels.ResourceTotal] = new LabelElement(this, fontpal.Palette,
                                                                           GuiUtil.GetFonts(Mpq)[0],
                                                                           292, 448);
            labelElements[(int)HudLabels.ResourceMax] = new LabelElement(this, fontpal.Palette,
                                                                         GuiUtil.GetFonts(Mpq)[0],
                                                                         292, 462);

            for (int i = 0; i < labelElements.Length; i++)
            {
                Elements.Add(labelElements[i]);
            }

            cmdButtonElements = new GrpButtonElement[9];
            int x = 0;
            int y = 0;

            for (int i = 0; i < cmdButtonElements.Length; i++)
            {
                cmdButtonElements[i] = new GrpButtonElement(this, cmdicons, cmdicon_palette, button_xs[x], button_ys[y]);
                x++;
                if (x == 3)
                {
                    x = 0;
                    y++;
                }
                cmdButtonElements[i].Visible = false;
                Elements.Add(cmdButtonElements[i]);
            }

            PlaceInitialUnits();

            Events.Tick += ScrollTick;
        }