Inheritance: MonoBehaviour
Example #1
0
 public int InsertKM(Info.KhuyenMaiInfo info)
 {
     int id = cn.ExecuteInsert("usp_InsertKhuyen",
         new string[] { "@MaHH", "@SLBan","@MaHH_KM","@SLKM","@NgayKM","@TrangThai" },
         new object[] { info.MaHH, info.SL,info.MaHHKM, info.SLKM, info.NgayKM,info.TrangThai });
     return id;
 }
Example #2
0
        /* プロパティ **********************************************************/
        /* メソッド **********************************************************/
        /// <summary>
        /// ファイルを読み込み、マップ情報を返す
        /// </summary>
        /// <param name="fileNames">ファイル名</param>
        /// <returns>マップ情報<para>圧縮ファイルの場合、一つのファイルに多数のマップが格納されている場合があるのでListで返します。</para></returns>
        public List<DemSet> ReadHeader(string[] fileNames)
        {
            List<DemSet> mapInfolist = new List<DemSet>();

            //System.Diagnostics.Stopwatch sw = System.Diagnostics.Stopwatch.StartNew();
            // ヘッダーの読み出し
            Info[] info = new Info[fileNames.Length];
            if (fileNames.Length == 1)                              // ファイルが単一であれば、Parallel処理はかえって重いので分ける
            {

                JpgisGmlReader reader = new JpgisGmlReader();
                info[0] = reader.GetHeader(fileNames[0]);
            }
            else
            {
                Parallel.For(0, fileNames.Length, i =>
                //for(int i = 0; i < fileNames.Length; i++)         // 66 ファイルあると、forよりも並列読み込みの方が若干早い。@2012/5/28
                {
                    //System.Diagnostics.Stopwatch sw2 = System.Diagnostics.Stopwatch.StartNew();
                    JpgisGmlReader reader = new JpgisGmlReader();
                    info[i] = reader.GetHeader(fileNames[i]);
                    //sw2.Stop();                                                     // ストップウォッチを止める
                    //Console.WriteLine("個々のヘッダー読み込み時間: " + sw2.Elapsed); // 結果を表示する
                });
            }
            //sw.Stop();                                                              // ストップウォッチを止める
            //Console.WriteLine("合計のヘッダー読み込み時間: " + sw.Elapsed);          // 結果を表示する
            for (int i = 0; i < fileNames.Length; i++)
            {
                if (info[i].Available == true)
                    mapInfolist.Add(new DemSet(fileNames[i], info[i]));
            }
            return mapInfolist;
        }
Example #3
0
        public NewBrowserWnd()
        {
            // This call is required by the Windows.Forms Form Designer.
            InitializeComponent();
            object param1=new object();
            Info objInfo = new Info();
            int temp;
            //			if((NetworkManager.thisInstance.profile.clientType==WebMeeting.Common.ClientType.ClientPresenter)||(NetworkManager.thisInstance.profile.clientType==WebMeeting.Common.ClientType.ClientHost))
            //                temp=1;
            //			else
            //				temp=0;

            if(WebMeeting.Client.ClientUI.getInstance().nclientType==1)
            {
                temp=1;
            }
            else
            {
                temp=0;
            }

            //string str = objInfo.WebsiteName + "/welcome/?mid=" + NetworkManager.getInstance().profile.ConferenceID +"&check="+temp ;

            string str = objInfo.WebsiteName + @"/welcome/?mid=" + WebMeeting.Client.ClientUI.getInstance().nmeeting_id+"&check="+temp ;
            //MessageBox.Show(str,"Main windows");
            //IDocHostUIHandler
            //////////////////////////////////
            ///mshtml.HTMLDocument doc;
            ////////////////////////////////////
            this.axWebBrowser1.Navigate(str,ref param1,ref param1,ref param1,ref param1);

            // TODO: Add any initialization after the InitializeComponent call
        }
Example #4
0
        public void LanguageSetsToUserValue()
        {
            var info = new Info();
            info.Language = "en-UK";

            Assert.Equal("en-UK", info.Language);
        }
Example #5
0
 public FRdialog(Info info, Console c, mainWindow m)
 {
     this.info = info;
     InitializeComponent();
     console = c;
     mainWindow = m;
 }
Example #6
0
 public int UpdateLoaiSP(Info.LoaiHHInfo info)
 {
     cn.ExecuteNonQuery("sp_UpdateLOAI_SP",
         new string[] { "@MA", "@TEN", "@MOTA" },
         new object[] { info.MA, info.TEN, info.MOTA });
     return 1;
 }
Example #7
0
 public int DeleteLoaiSP(Info.LoaiHHInfo info)
 {
     int id = cn.ExecuteNonQuery("sp_Deleteloaihh",
         new string[] { "@MA" },
         new object[] { info.MA });
     return id;
 }
Example #8
0
 public int InsertLoaiSP(Info.LoaiHHInfo info)
 {
     int id = cn.ExecuteInsert("sp_InsertLOAI_SP",
         new string[] { "@TEN", "@MOTA" },
         new object[] { info.TEN, info.MOTA });
     return id;
 }
Example #9
0
 public int UpdateKM(Info.KhuyenMaiInfo info)
 {
     int id = cn.ExecuteNonQuery("usp_UpdateKHUYENMAI",
         new string[] {"@MA", "@MaHH", "@SL", "@MaHHKM", "@SLKM", "@TrangThai", "@NgayKM" },
         new object[] {info.Ma, info.MaHH, info.SL, info.MaHHKM, info.SLKM, info.TrangThai, info.NgayKM });
     return id;
 }
Example #10
0
 public int InsertEmployee(Info.DonViInfo info)
 {
     //int id = _cn.ExecuteInsert("sp_InserttblMember",
     //    new string[] { "@UserName", "@Password", "@FullName", "@AuthenticationID", "@Email", "@Address", "@IdentityCardNumber", "@Phone", "@Birthday", "@Pic", "@Active" },
     //    new object[] { ey.UserName, ey.Password, ey.FullName, ey.AuthenticationID, ey.Email, ey.Address, ey.IdentityCardNumber, ey.Phone, ey.Birthday, ey.Pic, ey.Active });
     return 0;
 }
Example #11
0
 public int DeleteNhomKH(Info.NhomKHInfo info)
 {
     int id = cn.ExecuteNonQuery("sp_DeleteNhomKH",
         new string[] { "@MANHOMKH" },
         new object[] { info.Mannhomkh });
     return id;
 }
Example #12
0
 public objTree(Info i,mainWindow k)
 {
     info = i;
     owner = k;
     InitializeComponent();
     loadtree();
 }
Example #13
0
            public Info Clone()
            {
                var clone = new Info();
                clone.Copy(this);

                return clone;
            }
Example #14
0
 public static string GetMessage(Info info)
 {
     switch (info)
     {
         case Info.ChooseCity:
             return "Elige tu ciudad";
         case Info.AnyTime:
             return "Todas";
         case Info.Sheadules:
             return "Horarios";
         case Info.Loading:
             return "Cargando...";
         case Info.NoData:
             return "No hay datos";
         case Info.NoMoreShows:
             return "En {0} no hay mas funciones :(";
         case Info.FacebookIntegration:
             return "¿Quisieras integrar tu experiencia con Facebook?";
         case Info.FacebookIntegrationTitle:
             return "Integración con Facebook";
         case Info.GetDefaultShareMessage:
             return "¡Quiero ver esta película hoy!";
         default:
             return "Info No identificado";
     }
 }
Example #15
0
 public void Error(Exception exception)
 {
     var errorLog = new Error(exception);
     foreach (var logProvider in providers)
         logProvider.Log(errorLog);
     LastMessage = errorLog;
 }
Example #16
0
				public static Info Parse(CharStream stream, Info expected = null)
				{
					string output;
					int pos = stream.Position;

					if (!stream.ReadReg("(\'|\")", out output))
					{
						throw new Exceptions.ParseException(
							String.Format(
							"expected to read a <quote> (starting at {0}), but no characters were left",
							stream.ComputeDetailedPosition(pos)));
					}

					Info info;
					if (output[0] == '"')
					{
						info = new Info(Type.Double);
					} else 
					{
						info = new Info(Type.Single);
					}

					if (expected != null && expected.CompareTo(info) != 0)
					{
						throw new Exceptions.ParseException(
							String.Format(
							"expected to read {0} (starting at {1}), but found {2}",
							expected.ToString(),
							stream.ComputeDetailedPosition(pos),
							info.ToString()));
					}

					return info;
				}
Example #17
0
        public bool SqlUploadeInfo(string[] Column, Info InfoStruct)
        {
            string InsertStr = "insert into VehicleInfo (";
            for (int iLoop = 0; iLoop < Column.Length - 1; ++iLoop)
            {
                InsertStr += Column[iLoop] + ",";
            }
            InsertStr += "信息更新者姓名) values ('";
            InsertStr += InfoStruct.汽车ID + "','";
            InsertStr += InfoStruct.车型 + "','";
            InsertStr += InfoStruct.型号 + "','";
            InsertStr += InfoStruct.品牌 + "',";
            InsertStr += InfoStruct.年款 + ",'";
            InsertStr += InfoStruct.厂商 + "','";
            InsertStr += InfoStruct.级别 + "','";
            InsertStr += InfoStruct.车身结构 + "',";
            InsertStr += InfoStruct.长 + ",";
            InsertStr += InfoStruct.宽 + ",";
            InsertStr += InfoStruct.高 + ",";
            InsertStr += InfoStruct.最高车速 + ",";
            InsertStr += InfoStruct.百公里加速 + ",";
            InsertStr += InfoStruct.综合油耗 + ",";
            InsertStr += InfoStruct.最小离地间隙 + ",";
            InsertStr += InfoStruct.轴距 + ",";
            InsertStr += InfoStruct.前轮距 + ",";
            InsertStr += InfoStruct.后轮距 + ",";
            InsertStr += InfoStruct.整备质量 + ",";
            InsertStr += InfoStruct.车门数 + ",";
            InsertStr += InfoStruct.座位数 + ",";
            InsertStr += InfoStruct.行李厢容积 + ",";
            InsertStr += InfoStruct.排量 + ",";
            InsertStr += InfoStruct.最大马力 + ",";
            InsertStr += InfoStruct.最大功率 + ",'";
            InsertStr += InfoStruct.前轮胎规格 + "','";
            InsertStr += InfoStruct.后轮胎规格 + "','";
            InsertStr += InfoStruct.电动天窗 + "','";
            InsertStr += InfoStruct.全景天窗 + "','";
            InsertStr += InfoStruct.运动外观套件 + "','";
            InsertStr += InfoStruct.铝合金轮圈 + "','";
            InsertStr += InfoStruct.电动吸合门 + "','";
            InsertStr += InfoStruct.侧滑门 + "','";
            InsertStr += InfoStruct.电动后备厢 + "','";
            InsertStr += InfoStruct.感应后备厢 + "','";
            InsertStr += InfoStruct.车顶行李架 + "','";
            InsertStr += InfoStruct.外观颜色 + "','";
            InsertStr += InfoStruct.变速箱 + "','";
            InsertStr += InfoStruct.信息更新时间 + "','";
            InsertStr += InfoStruct.信息更新者工号 + "','";
            InsertStr += InfoStruct.信息更新者姓名 + "')";

            DatabaseCmd databasecmd = new DatabaseCmd();
            if (databasecmd.SqlExecuteNonQuery(InsertStr) == true)
            {
                return true;
            }
            else
            {
                return false;
            }
        }
Example #18
0
        /// <summary>
        /// Scans through a notechart and assigns the HOPO tag to notes that are of a
        /// different type than the previous note, and have a tick difference less than
        /// the specified HOPO tick threshold.
        /// </summary>
        /// <param name="inputNotechart">
        /// Any notechart (expected to not have hammeron information already filled out).
        /// </param>
        /// <param name="inputChartInfo">
        /// All information pertaining to the chart.
        /// </param>
        /// <returns>
        /// The same notechart with proper hammeron note settings.
        /// </returns>
        public static Notes AssignHOPOS(Notes inputNotechart, Info inputChartInfo)
        {
            Notes notechartToReturn = inputNotechart;
            int HOPOTickThreshold = (inputChartInfo.resolution * 4) / inputChartInfo.HOPOThreshold;

            Note currentNote = new Note();
            Note nextNote = new Note();

            // We stop at (count - 2) due to the currentNote/nextNote/thirdNote setup
            for (int i = 0; i < inputNotechart.notes.Count - 1; i++)
            {
                currentNote = inputNotechart.notes[i];
                nextNote = inputNotechart.notes[i + 1];

                if (i == 470)
                {
                    nextNote.ToString();
                }

                // If difference is 0, it is a chord and should not be a hammeron.
                // We need to check the third note in case the next note is the start
                // of a chord.
                if (((nextNote.tickValue - currentNote.tickValue) <= HOPOTickThreshold) &&
                    (!nextNote.noteType.isEqual(currentNote.noteType)) &&
                    (!nextNote.isChord))
                {
                    notechartToReturn.notes[i + 1].isHOPO = true;
                }
            }

            return notechartToReturn;
        }
Example #19
0
			public void AddProtection(Info info) {
				foreach (var comp in protections) {
					if (comp.Id == info.id)
						return;
				}
				protections.Add(new InfoComponent(info));
			}
Example #20
0
			public void AddPacker(Info info) {
				foreach (var comp in packers) {
					if (comp.Id == info.id)
						return;
				}
				packers.Add(new InfoComponent(info));
			}
Example #21
0
        public mainWindow()
        {
            InitializeComponent();
            info = new Info(this);
            tabControl1.DrawMode = TabDrawMode.OwnerDrawFixed;
            image_list.ColorDepth = ColorDepth.Depth32Bit;
            #if !MONO

            image_list.Images.Add(BlackFox.Win32.Icons.IconFromExtension("Directory", BlackFox.Win32.Icons.SystemIconSize.Small));
            image_list.Images.Add(BlackFox.Win32.Icons.IconFromExtension(".dm", BlackFox.Win32.Icons.SystemIconSize.Small));
            image_list.Images.Add(BlackFox.Win32.Icons.IconFromExtension(".dmf", BlackFox.Win32.Icons.SystemIconSize.Small));
            image_list.Images.Add(Image.FromFile("gui\\speaker.ico"));
            image_list.Images.Add(BlackFox.Win32.Icons.IconFromExtension(".dmi", BlackFox.Win32.Icons.SystemIconSize.Small));
            image_list.Images.Add(BlackFox.Win32.Icons.IconFromExtension(".dms", BlackFox.Win32.Icons.SystemIconSize.Small));
            image_list.Images.Add(BlackFox.Win32.Icons.IconFromExtension(".dmm", BlackFox.Win32.Icons.SystemIconSize.Small));
            #elif MONO
            image_list.Images.Add(Image.FromFile("gui//speaker.ico"));
            image_list.Images.Add(Image.FromFile("gui//speaker.ico"));
            image_list.Images.Add(Image.FromFile("gui//speaker.ico"));
            image_list.Images.Add(Image.FromFile("gui//speaker.ico"));
            image_list.Images.Add(Image.FromFile("gui//speaker.ico"));
            image_list.Images.Add(Image.FromFile("gui//speaker.ico"));
            image_list.Images.Add(Image.FromFile("gui//speaker.ico"));
            #endif
            file_list.ImageList = image_list;
            Recent.recent_list = Recent.getRecent();
            foreach (string path in Recent.recent_list)
            {
                ToolStripMenuItem item = new ToolStripMenuItem(path, null, recent_Click, Path.GetFileName(path));
                MenuFile.DropDownItems.Add(item);
                Recent.recent_list_menu.Add(item);

            }
        }
 public void Scan(Info path)
 {
     if (!worker.CancellationPending) {
         string[] dirs = Directory.GetDirectories(String.Format(@"{0}", path.Folder), "*");
         string[] files = Directory.GetFiles(String.Format(@"{0}", path.Folder), path.Filemask);
         if (dirs.Length == 0) {
             foreach (string s in files) {
                 Thread.Sleep(300);
                 worker.ReportProgress(0, s);
             }
         } else {
             foreach (string file in files) {
                 Thread.Sleep(300);
                 worker.ReportProgress(0, file);
             }
             foreach (string s in dirs) {
                 if (s.ToLower().Trim() != @"c:\WINDOWS".Trim().ToLower() &&
                     s.ToLower().Trim() != @"c:\System Volume Information".Trim().ToLower()) {
                     path.Folder = s;
                     Scan(path);
                 }
             }
         }
     }
 }
Example #23
0
 public int DeleteKH(Info.KhachHangInfo info)
 {
     int id = cn.ExecuteNonQuery("sp_DeleteKH",
         new string[] { "@MAKH" },
         new object[] { info.MAKH });
     return id;
 }
Example #24
0
 public int UpdateKH(Info.KhachHangInfo info)
 {
     cn.ExecuteNonQuery("SP_UPDATEKH",
         new string[] { "@MAKH", "@CODEKH", "@MANHOM", "@TEN", "@TUOI", "@GIOITINH", "@MATINH", "@DIACHI", "@DIENTHOAI", "@CAPDO","@MST","@HANNO" },
         new object[] { info.MAKH, info.CODEKH, info.MANHOM, info.TEN, info.TUOI, info.GIOITINH, info.MATINH, info.DIACHI, info.DIENTHOAI, info.CAPDO,info.MST,info.HanNo });
     return 1;
 }
Example #25
0
 public Alphabet(int[] orders)
 {
     var r = new Info[orders.Length];
     for (int i = 0; i < r.Length; i++)
         r[i] = new Info(orders[i]);
     this._letterInfo = r;
 }
Example #26
0
 public Info GetInfo()
 {
     Info info = new Info ();
     lock (_messagingStatistics) {
         info.MessagingStatistics = new List<EndPointInfo> (_messagingStatistics.Values).ToArray ();
     }
     info.TotalInquiries = _sock.NumberOfInquiries;
     info.TotalReceiveBytes = _sock.BaseSocket.ReceivedBytes;
     info.TotalReceivePackets = _sock.BaseSocket.ReceivedDatagrams;
     info.TotalSendBytes = _sock.BaseSocket.SentBytes;
     info.TotalSendPackets = _sock.BaseSocket.SentDatagrams;
     info.TotalTcpReceiveBytes = _tcp.ReceivedBytes;
     info.TotalTcpSendBytes = _tcp.SentBytes;
     info.AvgReceiveBytes = _udpRbA;
     info.AvgReceivePackets = _udpRpA;
     info.AvgSendBytes = _udpSbA;
     info.AvgSendPackets = _udpSpA;
     info.AvgTcpReceiveBytes = _tcpRA;
     info.AvgTcpSendBytes = _tcpSA;
     info.KBR_Success = _kbrSuccess;
     info.KBR_Failures = _kbrFailures;
     info.KBR_RTT = _kbrRTT;
     info.KBR_Hops = _kbrHops;
     info.MCR_Success = _mcrSuccess;
     info.MCR_Failures = _mcrFailures;
     info.MCR_LifeTime = _mcrLifeTime;
     info.AC_Success = _acSuccess;
     info.AC_Failures = _acFailures;
     info.MMLC_Success = _mmlcSuccess;
     info.MMLC_Failures = _mmlcFailures;
     return info;
 }
Example #27
0
 public int InsertKH(Info.KhachHangInfo info)
 {
     int id = cn.ExecuteInsert("SP_INSERTKH",
         new string[] { "@CODEKH", "@MANHOM", "@TEN", "@TUOI", "@GIOITINH", "@MATINH", "@DIACHI", "@DIENTHOAI", "@CAPDO","@MST","@HANNO" },
         new object[] { info.CODEKH, info.MANHOM, info.TEN, info.TUOI, info.GIOITINH, info.MATINH, info.DIACHI, info.DIENTHOAI, info.CAPDO, info.MST,info.HanNo });
     return id;
 }
        public void Run()
        {
            Console.WriteLine("Press 'Enter' to send a message. To exit, Ctrl + C");

            while (true)
            {
                var read = Console.ReadLine();
                LogMessage message = null;
                read = string.IsNullOrEmpty(read) ? "info Info Message" : read;

                if (read.IndexOf(" ") < 0)
                    read += " Log Message";

                var type = read.Substring(0, read.IndexOf(" "));
                var payload = read.Substring(read.IndexOf(" ") + 1);

                switch (type.ToLower())
                {
                    case "warn":
                        message = new Warn();
                        break;
                    case "error":
                        message = new Error();
                        break;
                    default:
                        message = new Info();
                        break;
                }

                message.Message = payload;
                Bus.Send(message);
            }
        }
Example #29
0
        private void button1_Click(object sender, EventArgs e)
        {
            Main.searchid = textBox1.Text;
            SqlConnection con = Main.connection;
            con.Open();
            string find = "SELECT شناسه from کالا where شناسه='" + textBox1.Text+ "'";
            SqlCommand command = new SqlCommand(find, con);
            SqlDataReader dr = command.ExecuteReader();
            dr.Read();
            string check = "0";
            if (dr.HasRows)
            {

                check = "1";
                con.Close();
               Info frm = new Info();

                frm.ShowDialog();
                this.Close();
            }
            else
            {
                MessageBox.Show("یافت نشد", "پیغام", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);

            }
        }
Example #30
0
 public int UpdateNhomKH(Info.NhomKHInfo info)
 {
     cn.ExecuteNonQuery("SP_UPDATENhomKH",
         new string[] { "@MA", "@TENNHOM", "@MOTA" },
         new object[] { info.Mannhomkh, info.Tennhom, info.Mota });
     return 1;
 }
        public virtual void WriteFieldUpdates(Directory dir, DocValuesFieldUpdates.Container dvUpdates)
        {
            lock (this)
            {
                //Debug.Assert(Thread.holdsLock(Writer));
                //System.out.println("rld.writeFieldUpdates: seg=" + info + " numericFieldUpdates=" + numericFieldUpdates);

                Debug.Assert(dvUpdates.Any());

                // Do this so we can delete any created files on
                // exception; this saves all codecs from having to do
                // it:
                TrackingDirectoryWrapper trackingDir = new TrackingDirectoryWrapper(dir);

                FieldInfos fieldInfos = null;
                bool       success    = false;
                try
                {
                    Codec codec = Info.Info.Codec;

                    // reader could be null e.g. for a just merged segment (from
                    // IndexWriter.commitMergedDeletes).
                    SegmentReader reader = this.reader == null ? new SegmentReader(Info, writer.Config.ReaderTermsIndexDivisor, IOContext.READ_ONCE) : this.reader;
                    try
                    {
                        // clone FieldInfos so that we can update their dvGen separately from
                        // the reader's infos and write them to a new fieldInfos_gen file
                        FieldInfos.Builder builder = new FieldInfos.Builder(writer.globalFieldNumberMap);
                        // cannot use builder.add(reader.getFieldInfos()) because it does not
                        // clone FI.attributes as well FI.dvGen
                        foreach (FieldInfo fi in reader.FieldInfos)
                        {
                            FieldInfo clone = builder.Add(fi);
                            // copy the stuff FieldInfos.Builder doesn't copy
                            if (fi.Attributes != null)
                            {
                                foreach (KeyValuePair <string, string> e in fi.Attributes)
                                {
                                    clone.PutAttribute(e.Key, e.Value);
                                }
                            }
                            clone.DocValuesGen = fi.DocValuesGen;
                        }
                        // create new fields or update existing ones to have NumericDV type
                        foreach (string f in dvUpdates.numericDVUpdates.Keys)
                        {
                            builder.AddOrUpdate(f, NumericDocValuesField.TYPE);
                        }
                        // create new fields or update existing ones to have BinaryDV type
                        foreach (string f in dvUpdates.binaryDVUpdates.Keys)
                        {
                            builder.AddOrUpdate(f, BinaryDocValuesField.fType);
                        }

                        fieldInfos = builder.Finish();
                        long              nextFieldInfosGen     = Info.NextFieldInfosGen;
                        string            segmentSuffix         = nextFieldInfosGen.ToString(CultureInfo.InvariantCulture);//Convert.ToString(nextFieldInfosGen, Character.MAX_RADIX));
                        SegmentWriteState state                 = new SegmentWriteState(null, trackingDir, Info.Info, fieldInfos, writer.Config.TermIndexInterval, null, IOContext.DEFAULT, segmentSuffix);
                        DocValuesFormat   docValuesFormat       = codec.DocValuesFormat;
                        DocValuesConsumer fieldsConsumer        = docValuesFormat.FieldsConsumer(state);
                        bool              fieldsConsumerSuccess = false;
                        try
                        {
                            //          System.out.println("[" + Thread.currentThread().getName() + "] RLD.writeFieldUpdates: applying numeric updates; seg=" + info + " updates=" + numericFieldUpdates);
                            foreach (KeyValuePair <string, NumericDocValuesFieldUpdates> e in dvUpdates.numericDVUpdates)
                            {
                                string field = e.Key;
                                NumericDocValuesFieldUpdates fieldUpdates = e.Value;
                                FieldInfo fieldInfo = fieldInfos.FieldInfo(field);
                                Debug.Assert(fieldInfo != null);

                                fieldInfo.DocValuesGen = nextFieldInfosGen;
                                // write the numeric updates to a new gen'd docvalues file
                                fieldsConsumer.AddNumericField(fieldInfo, GetInt64Enumerable(reader, field, fieldUpdates));
                            }

                            //        System.out.println("[" + Thread.currentThread().getName() + "] RAU.writeFieldUpdates: applying binary updates; seg=" + info + " updates=" + dvUpdates.binaryDVUpdates);
                            foreach (KeyValuePair <string, BinaryDocValuesFieldUpdates> e in dvUpdates.binaryDVUpdates)
                            {
                                string field = e.Key;
                                BinaryDocValuesFieldUpdates dvFieldUpdates = e.Value;
                                FieldInfo fieldInfo = fieldInfos.FieldInfo(field);
                                Debug.Assert(fieldInfo != null);

                                //          System.out.println("[" + Thread.currentThread().getName() + "] RAU.writeFieldUpdates: applying binary updates; seg=" + info + " f=" + dvFieldUpdates + ", updates=" + dvFieldUpdates);

                                fieldInfo.DocValuesGen = nextFieldInfosGen;
                                // write the numeric updates to a new gen'd docvalues file
                                fieldsConsumer.AddBinaryField(fieldInfo, GetBytesRefEnumerable(reader, field, dvFieldUpdates));
                            }

                            codec.FieldInfosFormat.FieldInfosWriter.Write(trackingDir, Info.Info.Name, segmentSuffix, fieldInfos, IOContext.DEFAULT);
                            fieldsConsumerSuccess = true;
                        }
                        finally
                        {
                            if (fieldsConsumerSuccess)
                            {
                                fieldsConsumer.Dispose();
                            }
                            else
                            {
                                IOUtils.DisposeWhileHandlingException(fieldsConsumer);
                            }
                        }
                    }
                    finally
                    {
                        if (reader != this.reader)
                        {
                            //          System.out.println("[" + Thread.currentThread().getName() + "] RLD.writeLiveDocs: closeReader " + reader);
                            reader.Dispose();
                        }
                    }

                    success = true;
                }
                finally
                {
                    if (!success)
                    {
                        // Advance only the nextWriteDocValuesGen so that a 2nd
                        // attempt to write will write to a new file
                        Info.AdvanceNextWriteFieldInfosGen();

                        // Delete any partially created file(s):
                        foreach (string fileName in trackingDir.CreatedFiles)
                        {
                            try
                            {
                                dir.DeleteFile(fileName);
                            }
                            catch (Exception)
                            {
                                // Ignore so we throw only the first exc
                            }
                        }
                    }
                }

                Info.AdvanceFieldInfosGen();
                // copy all the updates to mergingUpdates, so they can later be applied to the merged segment
                if (isMerging)
                {
                    foreach (KeyValuePair <string, NumericDocValuesFieldUpdates> e in dvUpdates.numericDVUpdates)
                    {
                        DocValuesFieldUpdates updates;
                        if (!mergingDVUpdates.TryGetValue(e.Key, out updates))
                        {
                            mergingDVUpdates[e.Key] = e.Value;
                        }
                        else
                        {
                            updates.Merge(e.Value);
                        }
                    }
                    foreach (KeyValuePair <string, BinaryDocValuesFieldUpdates> e in dvUpdates.binaryDVUpdates)
                    {
                        DocValuesFieldUpdates updates;
                        if (!mergingDVUpdates.TryGetValue(e.Key, out updates))
                        {
                            mergingDVUpdates[e.Key] = e.Value;
                        }
                        else
                        {
                            updates.Merge(e.Value);
                        }
                    }
                }

                // create a new map, keeping only the gens that are in use
                IDictionary <long, ISet <string> > genUpdatesFiles    = Info.UpdatesFiles;
                IDictionary <long, ISet <string> > newGenUpdatesFiles = new Dictionary <long, ISet <string> >();
                long fieldInfosGen = Info.FieldInfosGen;
                foreach (FieldInfo fi in fieldInfos)
                {
                    long dvGen = fi.DocValuesGen;
                    if (dvGen != -1 && !newGenUpdatesFiles.ContainsKey(dvGen))
                    {
                        if (dvGen == fieldInfosGen)
                        {
                            newGenUpdatesFiles[fieldInfosGen] = trackingDir.CreatedFiles;
                        }
                        else
                        {
                            newGenUpdatesFiles[dvGen] = genUpdatesFiles[dvGen];
                        }
                    }
                }

                Info.SetGenUpdatesFiles(newGenUpdatesFiles);

                // wrote new files, should checkpoint()
                writer.Checkpoint();

                // if there is a reader open, reopen it to reflect the updates
                if (reader != null)
                {
                    SegmentReader newReader = new SegmentReader(Info, reader, liveDocs, Info.Info.DocCount - Info.DelCount - pendingDeleteCount);
                    bool          reopened  = false;
                    try
                    {
                        reader.DecRef();
                        reader   = newReader;
                        reopened = true;
                    }
                    finally
                    {
                        if (!reopened)
                        {
                            newReader.DecRef();
                        }
                    }
                }
            }
        }
        public virtual bool WriteLiveDocs(Directory dir)
        {
            lock (this)
            {
                //Debug.Assert(Thread.holdsLock(Writer));
                //System.out.println("rld.writeLiveDocs seg=" + info + " pendingDelCount=" + pendingDeleteCount + " numericUpdates=" + numericUpdates);
                if (pendingDeleteCount == 0)
                {
                    return(false);
                }

                // We have new deletes
                Debug.Assert(liveDocs.Length == Info.Info.DocCount);

                // Do this so we can delete any created files on
                // exception; this saves all codecs from having to do
                // it:
                TrackingDirectoryWrapper trackingDir = new TrackingDirectoryWrapper(dir);

                // We can write directly to the actual name (vs to a
                // .tmp & renaming it) because the file is not live
                // until segments file is written:
                bool success = false;
                try
                {
                    Codec codec = Info.Info.Codec;
                    codec.LiveDocsFormat.WriteLiveDocs((IMutableBits)liveDocs, trackingDir, Info, pendingDeleteCount, IOContext.DEFAULT);
                    success = true;
                }
                finally
                {
                    if (!success)
                    {
                        // Advance only the nextWriteDelGen so that a 2nd
                        // attempt to write will write to a new file
                        Info.AdvanceNextWriteDelGen();

                        // Delete any partially created file(s):
                        foreach (string fileName in trackingDir.CreatedFiles)
                        {
                            try
                            {
                                dir.DeleteFile(fileName);
                            }
                            catch (Exception)
                            {
                                // Ignore so we throw only the first exc
                            }
                        }
                    }
                }

                // If we hit an exc in the line above (eg disk full)
                // then info's delGen remains pointing to the previous
                // (successfully written) del docs:
                Info.AdvanceDelGen();
                Info.DelCount      = Info.DelCount + pendingDeleteCount;
                pendingDeleteCount = 0;

                return(true);
            }
        }
Example #33
0
 public bool TryGetByTag(string tag, out Info info)
 {
     return(_infoDict.TryGetValue(tag, out info));
 }
Example #34
0
 private void AddToDict(Info info)
 {
     _infoDict.Add(info.tag, info);
 }
Example #35
0
 /// <summary>
 /// GrovePi constructor
 /// </summary>
 /// <param name="i2cDevice">The I2C device. Device address is 0x04</param>
 /// <param name="shouldDispose">True to dispose the I2C device when disposing GrovePi</param>
 public GrovePi(I2cDevice i2cDevice, bool shouldDispose = true)
 {
     _i2cDevice     = i2cDevice ?? throw new ArgumentNullException(nameof(i2cDevice));
     _shouldDispose = shouldDispose;
     GrovePiInfo    = new Info(GetFirmwareVerion());
 }
Example #36
0
 public void InitEx(Info Info, KeyProviderQueryContext ctx)
 {
     m_Info      = Info;
     m_kpContext = ctx;
 }
Example #37
0
 private void OnMouseInfoUp(MouseInfoEventArgs e)
 {
     Info?.Invoke(this, e);
 }
Example #38
0
 public override string  ToString()
 {
     return(Info.ToString());
 }
Example #39
0
 public bool Equals(AudioBuffer other)
 {
     return(true && Info.Equals(other.Info) && NSamples.Equals(other.NSamples) && NPlanes.Equals(other.NPlanes) && _planes.Equals(other._planes) && Buffer.Equals(other.Buffer) && _map_infos.Equals(other._map_infos));
 }
Example #40
0
        /// <summary>
        /// Start a transaction and invoke a function.
        /// </summary>
        /// <param name="fn">The function to invoke.</param>
        /// <returns>The value computed by the function.</returns>
        object Run(IFn fn)
        {
            // TODO: Define an overload called on ThreadStartDelegate or something equivalent.

            bool          done   = false;
            object        ret    = null;
            List <Ref>    locked = new List <Ref>();
            List <Notify> notify = new List <Notify>();

            for (int i = 0; !done && i < RetryLimit; i++)
            {
                try
                {
                    GetReadPoint();
                    if (i == 0)
                    {
                        _startPoint = _readPoint;
                        _startTime  = Environment.TickCount;
                    }

                    _info = new Info(RUNNING, _startPoint);
                    ret   = fn.invoke();

                    // make sure no one has killed us before this point,
                    // and can't from now on
                    if (_info.Status.compareAndSet(RUNNING, COMMITTING))
                    {
                        foreach (KeyValuePair <Ref, List <CFn> > pair in _commutes)
                        {
                            Ref r = pair.Key;
                            if (_sets.Contains(r))
                            {
                                continue;
                            }

                            bool wasEnsured = _ensures.Contains(r);
                            // can't upgrade read lock, so release
                            ReleaseIfEnsured(r);
                            TryWriteLock(r);
                            locked.Add(r);

                            if (wasEnsured && r.CurrentValPoint() > _readPoint)
                            {
                                throw _retryex;
                            }

                            Info refinfo = r.TInfo;
                            if (refinfo != null && refinfo != _info && refinfo.IsRunning)
                            {
                                if (!Barge(refinfo))
                                {
                                    throw _retryex;
                                }
                            }
                            object val = r.TryGetVal();
                            _vals[r] = val;
                            foreach (CFn f in pair.Value)
                            {
                                _vals[r] = f.Fn.applyTo(RT.cons(_vals[r], f.Args));
                            }
                        }
                        foreach (Ref r in _sets)
                        {
                            TryWriteLock(r);
                            locked.Add(r);
                        }
                        // validate and enqueue notifications
                        foreach (KeyValuePair <Ref, object> pair in _vals)
                        {
                            Ref r = pair.Key;
                            r.Validate(pair.Value);
                        }

                        // at this point, all values calced, all refs to be written locked
                        // no more client code to be called
                        long commitPoint = GetCommitPoint();
                        foreach (KeyValuePair <Ref, object> pair in _vals)
                        {
                            Ref    r      = pair.Key;
                            object oldval = r.TryGetVal();
                            object newval = pair.Value;

                            r.SetValue(newval, commitPoint);
                            if (r.getWatches().count() > 0)
                            {
                                notify.Add(new Notify(r, oldval, newval));
                            }
                        }

                        done = true;
                        _info.Status.set(COMMITTED);
                    }
                }
                catch (RetryEx)
                {
                    // eat this so we retry rather than fall out
                }
                catch (Exception ex)
                {
                    if (ContainsNestedRetryEx(ex))
                    {
                        // Wrapped exception, eat it.
                    }
                    else
                    {
                        throw;
                    }
                }
                finally
                {
                    for (int k = locked.Count - 1; k >= 0; --k)
                    {
                        locked[k].ExitWriteLock();
                    }
                    locked.Clear();
                    foreach (Ref r in _ensures)
                    {
                        r.ExitReadLock();
                    }
                    _ensures.Clear();
                    Stop(done ? COMMITTED : RETRY);
                    try
                    {
                        if (done) // re-dispatch out of transaction
                        {
                            foreach (Notify n in notify)
                            {
                                n._ref.NotifyWatches(n._oldval, n._newval);
                            }
                            foreach (Agent.Action action in _actions)
                            {
                                Agent.DispatchAction(action);
                            }
                        }
                    }
                    finally
                    {
                        notify.Clear();
                        _actions.Clear();
                    }
                }
            }
            if (!done)
            {
                throw new InvalidOperationException("Transaction failed after reaching retry limit");
            }
            return(ret);
        }
Example #41
0
        private DataTable GetTable(string library, string select, string[] _nParametros, object[] _vParametros)
        {
            Info.avance(select);

            DataTable dtTmp = new DataTable();

            using (OracleConnection conn = new OracleConnection(_Security.cadena))
            {
                Info.avance(SelectCommand.GetCommand(library, select, _nParametros, _vParametros));
#pragma warning disable CA2100 // Review SQL queries for security vulnerabilities
                OracleCommand cmd = new OracleCommand(SelectCommand.GetCommand(library, select, _nParametros, _vParametros), conn);
#pragma warning restore CA2100 // Review SQL queries for security vulnerabilities
                switch (select)
                {
                case "FDB_LEER_ANEXOS_DIAN":
                {
                    cmd.CommandType = CommandType.StoredProcedure;
                    break;
                }

                default:
                {
                    cmd.CommandType = CommandType.Text;
                    break;
                }
                }
                Info.avance("OracleParameter p_refcursor = new OracleParameter()");
                OracleParameter p_refcursor = new OracleParameter();
                p_refcursor.OracleDbType = OracleDbType.RefCursor;
                p_refcursor.Direction    = ParameterDirection.ReturnValue;
                cmd.Parameters.Add(p_refcursor);


                for (int i = 0; i < _nParametros.Length; i++)
                {
                    Info.avance("cmd.Parameters.Add(parametroInt(_nParametros[i], _vParametros[i]))");
                    cmd.Parameters.Add(parametroInt(_nParametros[i], _vParametros[i]));
                }

                OracleDataAdapter adapter = new OracleDataAdapter(cmd);
                try
                {
                    Info.avance("adapter.Fill(dtTmp)");
                    adapter.Fill(dtTmp);
                }
                catch (OracleException ex)
                {
                    Info.avance(ex.Message);
                    if (conn.State == ConnectionState.Open)
                    {
                        conn.Close();
                    }
                    PrcsOracleException(SelectCommand.GetCommand(library, select, _nParametros, _vParametros), ex);
                }
                catch (Exception ex)
                {
                    Info.avance(ex.Message);
                    if (conn.State == ConnectionState.Open)
                    {
                        conn.Close();
                    }
                    PrcsException(library, SelectCommand.GetCommand(library, select, _nParametros, _vParametros), ex, _nParametros, _vParametros);
                }
                finally
                {
                    Info.avance("finally");
                    if (conn.State == ConnectionState.Open)
                    {
                        conn.Close();
                    }
                }
            }
            return(dtTmp);
        }
Example #42
0
        //获取服务器端的消息
        private void DataFromServer()
        {
            Info?.Invoke("正在连接服务器");
            isListen = true;
            try
            {
                while (isListen)
                {
                    Byte[] bytesFrom = new Byte[4096];
                    Int32  len       = clientSocket.Receive(bytesFrom);

                    String dataFromClient = Encoding.UTF8.GetString(bytesFrom, 0, len);
                    if (!String.IsNullOrWhiteSpace(dataFromClient))
                    {
                        //如果收到服务器已经关闭的消息,那么就把客户端接口关了,免得出错,并在客户端界面上显示出来
                        if (dataFromClient.ToString().Length >= 17 && dataFromClient.ToString().Substring(0, 17).Equals("Server has closed"))
                        {
                            clientSocket.Close();
                            clientSocket = null;
                            isListen     = false;
                            Info?.Invoke("服务器已关闭");
                            thDataFromServer.Abort();   //这一句必须放在最后,不然这个进程都关了后面的就不会执行了

                            return;
                        }


                        if (dataFromClient.StartsWith("#") && dataFromClient.EndsWith("#"))
                        {
                            String userName = dataFromClient.Substring(1, dataFromClient.Length - 2);
                            FailureCaused?.Invoke("用户名:[" + userName + "]已经存在,请尝试其他用户名并重试");
                            isListen = false;
                            clientSocket.Send(Encoding.UTF8.GetBytes("$"));
                            clientSocket.Close();
                            clientSocket = null;
                        }
                        else
                        {
                            //txtName.Enabled = false;    //当用户名唯一时才禁止再次输入用户名
                            string[] vs = dataFromClient.Split('*');
                            foreach (string i in vs)
                            {
                                if (!string.IsNullOrWhiteSpace(i))
                                {
                                    MessageRecieved?.Invoke(i);
                                }
                            }
                        }
                    }
                }
            }
            catch (SocketException ex)
            {
                isListen = false;
                if (clientSocket != null && clientSocket.Connected)
                {
                    //没有在客户端关闭连接,而是给服务器发送一个消息,在服务器端关闭连接
                    //这样可以将异常的处理放到服务器。客户端关闭会让客户端和服务器都抛异常
                    clientSocket.Send(Encoding.UTF8.GetBytes("$"));
                    FailureCaused?.Invoke(ex.ToString());
                }
            }
        }
Example #43
0
        public static void UpdateHist(Server server, bool initiated)
        {
            try
            {
                Type            t              = Type.GetTypeFromProgID("Microsoft.Update.Session", server.Location); //wcswapp01.intellig.local     OH0KLT733D7S2.global.ds.honeywell.com     labengdemctl00.labmasoh.local  wcbuildapp02.intellig.local
                UpdateSession   session        = (UpdateSession)Activator.CreateInstance(t);
                IUpdateSearcher updateSearcher = session.CreateUpdateSearcher();

                int count = updateSearcher.GetTotalHistoryCount();
                IUpdateHistoryEntryCollection history = updateSearcher.QueryHistory(0, count);

                DateTime current = DateTime.Now;

                for (int i = 0; i < count; ++i)
                {
                    if (initiated == true)
                    {
                        int hecc = current.Day * (-1);
                        if (history[i].Date >= current.AddMonths(-1).AddDays(hecc))
                        {
                            Info                temp            = new Info();
                            IUpdateIdentity     ID              = history[i].UpdateIdentity;
                            OperationResultCode operationResult = history[i].ResultCode;
                            string              Result          = operationResult.ToString();

                            if (Result == "orcSucceeded")
                            {
                                temp.TestResults  = "Succeeded";
                                temp.UpdateStatus = "Succeeded";
                            }
                            else
                            {
                                temp.TestResults  = "Failed";
                                temp.UpdateStatus = "Failed";
                            }

                            temp.TestDate = history[i].Date;
                            temp.updateID = ID.UpdateID;
                            temp.Title    = history[i].Title;
                            temp.ICW      = server.ICW;
                            temp.Server   = server.ServerName;

                            temp.Active = "Yes";

                            InfoList.Add(temp);
                        }
                    }

                    else
                    {
                        Info                temp            = new Info();
                        IUpdateIdentity     ID              = history[i].UpdateIdentity;
                        OperationResultCode operationResult = history[i].ResultCode;
                        string              Result          = operationResult.ToString();

                        if (Result == "orcSucceeded")
                        {
                            temp.TestResults  = "Succeeded";
                            temp.UpdateStatus = "Succeeded";
                        }
                        else
                        {
                            temp.TestResults  = "Failed";
                            temp.UpdateStatus = "Failed";
                        }

                        temp.TestDate = history[i].Date;
                        temp.updateID = ID.UpdateID;
                        temp.Title    = history[i].Title;
                        temp.ICW      = server.ICW;
                        temp.Server   = server.ServerName;

                        temp.Active = "Yes";

                        //### Uncomment to ignore the updates older than 7 months
                        //if (temp.TestDate <= current.AddMonths(-7))
                        int      y    = current.Year;
                        DateTime year = new DateTime(y, 1, 1);
                        if (temp.TestDate <= year)
                        {
                            break;
                        }

                        InfoList.Add(temp);
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Example #44
0
        public static void c_Settings(string settings)
        {
            Char separator = ' ';

            string[] cmdargs = settings.Split(separator);

            if (cmdargs.Length == 2) //No arg
            {
                if (cmdargs[1].Equals("setcomputername"))
                {
                    //method computername
                    Info.AskComputerName();
                }

                else if (cmdargs[1].Equals("setlang"))
                {
                    L.Text.Display("availablelanguage");
                }

                else if (cmdargs[1].Equals("remuser"))
                {
                    L.Text.Display("remuser");
                }

                else if (cmdargs[1].Equals("adduser"))
                {
                    L.Text.Display("adduser");
                }

                else if (cmdargs[1].Equals("passuser"))
                {
                    L.Text.Display("_passuser");
                }
            }
            else if (cmdargs.Length == 3)  //One arg
            {
                if (cmdargs[1].Equals("remuser"))
                {
                    System.Users.Users users = new System.Users.Users();

                    users.Remove(cmdargs[2]);
                }

                else if (cmdargs[1].Equals("setlang"))
                {
                    if ((cmdargs[2].Equals("en_US")) || cmdargs[2].Equals("en-US"))
                    {
                        Kernel.langSelected = "en_US";
                        L.Keyboard.Init();
                        System.Utils.Settings.LoadValues();
                        System.Utils.Settings.EditValue("language", "en_US");
                        System.Utils.Settings.PushValues();
                    }
                    else if ((cmdargs[2].Equals("fr_FR")) || cmdargs[2].Equals("fr-FR"))
                    {
                        Kernel.langSelected = "fr_FR";
                        L.Keyboard.Init();
                        System.Utils.Settings.LoadValues();
                        System.Utils.Settings.EditValue("language", "fr_FR");
                        System.Utils.Settings.PushValues();
                    }
                    else if ((cmdargs[2].Equals("nl_NL")) || cmdargs[2].Equals("nl-NL"))
                    {
                        Kernel.langSelected = "nl_NL";
                        L.Keyboard.Init();
                        System.Utils.Settings.LoadValues();
                        System.Utils.Settings.EditValue("language", "nl_NL");
                        System.Utils.Settings.PushValues();
                    }
                    else
                    {
                        L.Text.Display("unknownlanguage");
                        L.Text.Display("availablelanguage");
                    }
                }

                else if (cmdargs[1].Equals("adduser"))
                {
                    L.Text.Display("adduser");
                }

                else if (cmdargs[1].Equals("passuser"))
                {
                    L.Text.Display("_passuser");
                }
            }
            else if (cmdargs.Length == 4) //Two args
            {
                if (cmdargs[1].Equals("adduser"))
                {
                    System.Users.Users users = new System.Users.Users();

                    users.Create(cmdargs[2], cmdargs[3]);
                }

                else if (cmdargs[1].Equals("passuser"))
                {
                    System.Users.Users users = new System.Users.Users();

                    users.ChangePassword(cmdargs[2], cmdargs[3]);
                }

                else if (cmdargs[1].Equals("setlang"))
                {
                    L.Text.Display("availablelanguage");
                }

                else if (cmdargs[1].Equals("remuser"))
                {
                    L.Text.Display("remuser");
                }
            }

            //else if (cmdargs[1].Equals("textcolor"))
            //{
            //    bool save = c_Console.TextColor.c_TextColor(cmdargs[2]);
            //    if (save)
            //    {
            //        System.Utils.Settings.LoadValues();
            //        System.Utils.Settings.EditValue("foregroundcolor", cmdargs[2]);
            //        System.Utils.Settings.PushValues();
            //    }
            //}
            //else if (cmdargs[1].Equals("backgroundcolor"))
            //{
            //    bool save = c_Console.BackGroundColor.c_BackGroundColor(cmdargs[2]);
            //    if (save)
            //    {
            //        System.Utils.Settings.LoadValues();
            //        System.Utils.Settings.EditValue("backgroundcolor", cmdargs[2]);
            //        System.Utils.Settings.PushValues();
            //    }
            //}

            else
            {
                Console.ForegroundColor = ConsoleColor.DarkRed;
                L.Text.Display("UnknownCommand");
                Console.ForegroundColor = ConsoleColor.White;
            }
        }
Example #45
0
        private void handle(Player p, Reader r)
        {
            Attack attack = new Attack(r, p, false);

            Console.WriteLine("Melee: " + attack.getSkill());

            if (attack.getSkill() > 0)
            {
                SkillWz skillWz = Library.getSkill(attack.getSkill());
                Skill s = p.getSkillsManager().getSkill(attack.getSkill());
                if (s == null)
                    return; // player doesn't have the skill
                if (s.getLevel() <= 0)
                    return; // trying to use a skill that isn't atleast level 1
                attack.setLevel(s.getLevel());
                Info i = skillWz.getLevel(s.getLevel());

                int hpCon = i.getInt("hpCon");
                int mpCon = i.getInt("mpCon");
                int x = i.getInt("x");
                int prop = i.getInt("prop");
                int time = i.getInt("time") * 1000; // Status effects for monsters
                int mobCount = i.getInt("mobCount");
                int attackCount = i.getInt("attackCount");
                int cooltime = i.getInt("cooltime");

                if (p.getCooldown(attack.getSkill()) != null)
                {
                    p.send(Packets.enableActions());
                    return;
                }

                if (i.contains("mobCount"))
                {
                    if (attack.getMonsterCount() > mobCount)
                    {
                        p.send(Packets.enableActions());
                        return; // the player hit more monsters than 6 for this skill
                    }
                }

                if (i.contains("attackCount"))
                {
                    if (attack.getAtacksPerMonster() > attackCount)
                    {
                        p.send(Packets.enableActions());
                        return; // the player hit more monsters than 6 for this skill
                    }
                }

                if (attack.getSkill() == 1311005)
                {
                    if (attack.getMonsterCount() == 1)
                    {
                        int damage = attack.getTotal(attack.getSingle());
                        double d = ((double)x) / 100.0;
                        hpCon = Convert.ToInt32(Math.Round(((double)p.getHp()) * d));
                        if (p.getHp() - hpCon <= 0)
                        {
                            p.send(Packets.enableActions());
                            return;
                        }
                    }
                    else
                    {
                        hpCon = -1;
                    }
                    p.unheal(hpCon, mpCon);
                }
                else if (attack.getSkill() == 1311006) // Dragon Roar
                {
                    double d = ((double)x) / 100.0;
                    hpCon = Convert.ToInt32(Math.Round(((double)p.getHp()) * d));
                    if (p.getHp() - hpCon < 0)
                    {
                        p.send(Packets.enableActions());
                        return;
                    }
                    if (p.getMp() - mpCon < 0)
                    {
                        p.send(Packets.enableActions());
                        return;
                    }
                    p.unheal(hpCon, mpCon);
                }
                else if (i.contains("mpCon") && i.contains("hpCon"))
                {
                    if (p.getHp() - hpCon < 0)
                    {
        private static Info TryGetInfo(INotifyCollectionChanged itemsSource)
        {
            Info info = infos.FirstOrDefault(i => i.itemsSource.Target == itemsSource);

            return(info);
        }
Example #47
0
        private void LoadContent(DirectoryTreeNode directoryNode)
        {
            Dictionary <string, string> list = SVNManager.Instance.List(directoryNode.Directory.Url);

            foreach (string name in list.Keys)
            {
                string url = string.Format("{0}/{1}", directoryNode.Directory.Url, name);

                Info info = SVNManager.Instance.Info(url);

                if (info == null)
                {
                    continue;
                }

                if (info.Entry.IsDirectory)
                {
                    Directory directory = this.PluginData.Content[name] as Directory;

                    bool contains = directory != null;

                    if (!contains)
                    {
                        directory = new Directory(name, directoryNode.FullPath, url);
                    }

                    directory.Url = url;

                    DirectoryTreeNode node = new DirectoryTreeNode(directory);
                    node.SelectedImageIndex = 0;
                    node.ImageIndex         = 0;
                    node.Checked            = contains;

                    directoryNode.Nodes.Add(node);
                }
                else
                {
                    File file = this.PluginData.Content[name] as File;

                    bool contains = file != null;

                    if (!contains)
                    {
                        file = new File(name, directoryNode.FullPath, url);
                    }

                    FileTreeNode node = new FileTreeNode(file);
                    node.SelectedImageIndex = 1;
                    node.ImageIndex         = 1;
                    node.Checked            = contains;

                    directoryNode.Nodes.Add(node);
                }
            }

            foreach (TreeNode node in directoryNode.Nodes)
            {
                if (node is DirectoryTreeNode)
                {
                    LoadContent(node as DirectoryTreeNode);
                }
            }

            directoryNode.Expand();
        }
Example #48
0
 /// <summary>
 /// Define one or more documents to be created by the Swagger generator
 /// </summary>
 /// <param name="name">A URI-friendly name that uniquely identifies the document</param>
 /// <param name="info">Global metadata to be included in the Swagger output</param>
 public void SwaggerDoc(string name, Info info)
 {
     _swaggerGeneratorSettings.SwaggerDocs.Add(name, info);
 }
Example #49
0
 public List <Info> searchInfo(Info Info, ESearchOption filterOperator)
 {
     return(_dataSet.searchInfo(Info, filterOperator));
 }
Example #50
0
 public async Task <List <Info> > searchInfoAsync(Info Infos, ESearchOption filterOperator)
 {
     checkServiceCommunication();
     return(await _gateWayReferential.searchInfoAsync(Infos, filterOperator));
 }
Example #51
0
 /// <summary>
 /// Resolve and return the instance
 /// </summary>
 /// <returns>An instance for this resolution.</returns>
 public override object Resolve()
 {
     return(_factory.Resolve(Info.CreateContext(Ioc.Container)));
 }
Example #52
0
 /// <summary>
 /// Resolve and return the instance
 /// </summary>
 /// <param name="args">A list of ordered constructor arguments.</param>
 /// <returns>An instance for this resolution.</returns>
 public override object Resolve(object[] args)
 {
     return(_factory.Resolve(Info.CreateContext(Ioc.Container).SetArguments(args)));
 }
    //Carregamento de progresso via formatador binario
    //o modelo eh o msm para todos os botões
    public void Load(int id)
    {
        switch (id)
        {
        case 1:
        {
            //verifica se o arquivo existe
            if (File.Exists(Application.persistentDataPath + "/playerDATA10.dat"))
            {
                //caso exista ele vai deserializar
                BinaryFormatter bf    = new BinaryFormatter();
                FileStream      file1 = File.Open(Application.persistentDataPath + "/playerDATA10.dat", FileMode.Open);
                Info            data1 = (Info)bf.Deserialize(file1);

                //e vai settar os valores serializados como os valores atuais
                //currentState = data1.currentState;
                IndexNome     = data1.IndexNome;
                IndexHistoria = data1.IndexHistoria;
                IndexData     = data1.IndexData;
                IndexBg       = data1.IndexBg;
                IndexImagens  = data1.IndexImagens;
                //IndexBg = data1.IndexBg;
                //IndexImagens = data1.IndexImagens;
                //vol = data1.vol;
                IndexMusica = data1.IndexMusica;

                //e fecha o arquivo
                file1.Close();
                LoadToStoryTelling();
            }
        }
        break;

        case 2:
        {
            if (File.Exists(Application.persistentDataPath + "/playerDATA20.dat"))
            {
                BinaryFormatter bf    = new BinaryFormatter();
                FileStream      file2 = File.Open(Application.persistentDataPath + "/playerDATA20.dat", FileMode.Open);
                Info            data1 = (Info)bf.Deserialize(file2);
                //currentState = data1.currentState;
                IndexNome     = data1.IndexNome;
                IndexHistoria = data1.IndexHistoria;
                IndexData     = data1.IndexData;
                IndexBg       = data1.IndexBg;
                IndexImagens  = data1.IndexImagens;
                //IndexBg = data1.IndexBg;
                //IndexImagens = data1.IndexImagens;
                //vol = data1.vol;
                IndexMusica = data1.IndexMusica;
                file2.Close();
                LoadToStoryTelling();
            }
        }
        break;

        case 3:
        {
            if (File.Exists(Application.persistentDataPath + "/playerDATA30.dat"))
            {
                BinaryFormatter bf    = new BinaryFormatter();
                FileStream      file3 = File.Open(Application.persistentDataPath + "/playerDATA30.dat", FileMode.Open);
                Info            data1 = (Info)bf.Deserialize(file3);

                //currentState = data1.currentState;
                IndexNome     = data1.IndexNome;
                IndexHistoria = data1.IndexHistoria;
                IndexData     = data1.IndexData;
                IndexBg       = data1.IndexBg;
                IndexImagens  = data1.IndexImagens;
                //IndexBg = data1.IndexBg;
                //IndexImagens = data1.IndexImagens;
                //vol = data1.vol;
                IndexMusica = data1.IndexMusica;
                file3.Close();
                LoadToStoryTelling();
            }
        }
        break;

        case 4:
        {
            if (File.Exists(Application.persistentDataPath + "/playerDATA40.dat"))
            {
                BinaryFormatter bf    = new BinaryFormatter();
                FileStream      file4 = File.Open(Application.persistentDataPath + "/playerDATA40.dat", FileMode.Open);
                Info            data1 = (Info)bf.Deserialize(file4);

                //currentState = data1.currentState;
                IndexNome     = data1.IndexNome;
                IndexHistoria = data1.IndexHistoria;
                IndexData     = data1.IndexData;
                IndexBg       = data1.IndexBg;
                IndexImagens  = data1.IndexImagens;
                //IndexBg = data1.IndexBg;
                //IndexImagens = data1.IndexImagens;
                //vol = data1.vol;
                IndexMusica = data1.IndexMusica;
                file4.Close();
                LoadToStoryTelling();
            }
        }
        break;

        case 5:
        {
            if (File.Exists(Application.persistentDataPath + "/playerDATA50.dat"))
            {
                BinaryFormatter bf    = new BinaryFormatter();
                FileStream      file5 = File.Open(Application.persistentDataPath + "/playerDATA50.dat", FileMode.Open);
                Info            data1 = (Info)bf.Deserialize(file5);
                //currentState = data1.currentState;
                IndexNome     = data1.IndexNome;
                IndexHistoria = data1.IndexHistoria;
                IndexData     = data1.IndexData;
                IndexBg       = data1.IndexBg;
                IndexImagens  = data1.IndexImagens;
                //IndexBg = data1.IndexBg;
                //IndexImagens = data1.IndexImagens;
                //vol = data1.vol;
                IndexMusica = data1.IndexMusica;
                file5.Close();
                LoadToStoryTelling();
            }
        }
        break;

        case 6:
        {
            if (File.Exists(Application.persistentDataPath + "/playerDATA60.dat"))
            {
                BinaryFormatter bf    = new BinaryFormatter();
                FileStream      file6 = File.Open(Application.persistentDataPath + "/playerDATA60.dat", FileMode.Open);
                Info            data1 = (Info)bf.Deserialize(file6);
                //currentState = data1.currentState;
                IndexNome     = data1.IndexNome;
                IndexHistoria = data1.IndexHistoria;
                IndexData     = data1.IndexData;
                IndexBg       = data1.IndexBg;
                IndexImagens  = data1.IndexImagens;
                //IndexBg = data1.IndexBg;
                //IndexImagens = data1.IndexImagens;
                //vol = data1.vol;
                IndexMusica = data1.IndexMusica;
                file6.Close();
                LoadToStoryTelling();
            }
        }
        break;

        case 7:
        {
            if (File.Exists(Application.persistentDataPath + "/playerDATA70.dat"))
            {
                BinaryFormatter bf    = new BinaryFormatter();
                FileStream      file7 = File.Open(Application.persistentDataPath + "/playerDATA70.dat", FileMode.Open);
                Info            data1 = (Info)bf.Deserialize(file7);

                //currentState = data1.currentState;
                IndexNome     = data1.IndexNome;
                IndexHistoria = data1.IndexHistoria;
                IndexData     = data1.IndexData;
                IndexBg       = data1.IndexBg;
                IndexImagens  = data1.IndexImagens;
                //IndexBg = data1.IndexBg;
                //IndexImagens = data1.IndexImagens;
                //vol = data1.vol;
                IndexMusica = data1.IndexMusica;
                file7.Close();
                LoadToStoryTelling();
            }
        }
        break;

        case 8:
        {
            if (File.Exists(Application.persistentDataPath + "/playerDATA80.dat"))
            {
                BinaryFormatter bf    = new BinaryFormatter();
                FileStream      file8 = File.Open(Application.persistentDataPath + "/playerDATA80.dat", FileMode.Open);
                Info            data1 = (Info)bf.Deserialize(file8);

                //currentState = data1.currentState;
                IndexNome     = data1.IndexNome;
                IndexHistoria = data1.IndexHistoria;
                IndexData     = data1.IndexData;
                IndexBg       = data1.IndexBg;
                IndexImagens  = data1.IndexImagens;
                //IndexBg = data1.IndexBg;
                //IndexImagens = data1.IndexImagens;
                //vol = data1.vol;
                IndexMusica = data1.IndexMusica;
                file8.Close();
                LoadToStoryTelling();
            }
        }
        break;

        case 9:
        {
            if (File.Exists(Application.persistentDataPath + "/playerDATA90.dat"))
            {
                BinaryFormatter bf    = new BinaryFormatter();
                FileStream      file9 = File.Open(Application.persistentDataPath + "/playerDATA90.dat", FileMode.Open);
                Info            data1 = (Info)bf.Deserialize(file9);

                //currentState = data1.currentState;
                IndexNome     = data1.IndexNome;
                IndexHistoria = data1.IndexHistoria;
                IndexData     = data1.IndexData;
                IndexBg       = data1.IndexBg;
                IndexImagens  = data1.IndexImagens;
                //IndexBg = data1.IndexBg;
                //IndexImagens = data1.IndexImagens;
                //vol = data1.vol;
                IndexMusica = data1.IndexMusica;
                file9.Close();
                LoadToStoryTelling();
            }
        }
        break;
        }
    }
    public void LoadOnStart()
    {
        //verifica se o arquivo de save existe
        if (File.Exists(Application.persistentDataPath + "/playerDATA10.dat"))
        {
            BinaryFormatter bf    = new BinaryFormatter();
            FileStream      file1 = File.Open(Application.persistentDataPath + "/playerDATA10.dat", FileMode.Open);
            Info            data1 = (Info)bf.Deserialize(file1);
            //caso exista ele seta as labels do botão de save/load correspondente
            //msm modelo para todos os botões
            if (data1.SaveLabel != null && data1.SaveLabel != null)
            {
                SaveLAbel1.GetComponent <Text> ().text = data1.SaveLabel;
                LoadLAbel1.GetComponent <Text> ().text = data1.SaveLabel;
            }
            file1.Close();
        }



        if (File.Exists(Application.persistentDataPath + "/playerDATA20.dat"))
        {
            BinaryFormatter bf    = new BinaryFormatter();
            FileStream      file2 = File.Open(Application.persistentDataPath + "/playerDATA20.dat", FileMode.Open);
            Info            data1 = (Info)bf.Deserialize(file2);
            if (data1.SaveLabel != null && data1.SaveLabel != null)
            {
                SaveLAbel2.GetComponent <Text> ().text = data1.SaveLabel;
                LoadLAbel2.GetComponent <Text> ().text = data1.LoadLabel;
            }
            file2.Close();
        }

        if (File.Exists(Application.persistentDataPath + "/playerDATA30.dat"))
        {
            BinaryFormatter bf    = new BinaryFormatter();
            FileStream      file3 = File.Open(Application.persistentDataPath + "/playerDATA30.dat", FileMode.Open);
            Info            data1 = (Info)bf.Deserialize(file3);
            if (data1.SaveLabel != null && data1.SaveLabel != null)
            {
                SaveLAbel3.GetComponent <Text> ().text = data1.SaveLabel;
                LoadLAbel3.GetComponent <Text> ().text = data1.LoadLabel;
            }
            file3.Close();
        }

        if (File.Exists(Application.persistentDataPath + "/playerDATA40.dat"))
        {
            BinaryFormatter bf    = new BinaryFormatter();
            FileStream      file4 = File.Open(Application.persistentDataPath + "/playerDATA40.dat", FileMode.Open);
            Info            data1 = (Info)bf.Deserialize(file4);

            if (data1.SaveLabel != null && data1.SaveLabel != null)
            {
                SaveLAbel4.GetComponent <Text> ().text = data1.SaveLabel;
                LoadLAbel4.GetComponent <Text> ().text = data1.LoadLabel;
            }
            file4.Close();
        }

        if (File.Exists(Application.persistentDataPath + "/playerDATA50.dat"))
        {
            BinaryFormatter bf    = new BinaryFormatter();
            FileStream      file5 = File.Open(Application.persistentDataPath + "/playerDATA50.dat", FileMode.Open);
            Info            data1 = (Info)bf.Deserialize(file5);
            if (data1.SaveLabel != null && data1.SaveLabel != null)
            {
                SaveLAbel5.GetComponent <Text> ().text = data1.SaveLabel;
                LoadLAbel5.GetComponent <Text> ().text = data1.LoadLabel;
            }
            file5.Close();
        }
        if (File.Exists(Application.persistentDataPath + "/playerDATA60.dat"))
        {
            BinaryFormatter bf    = new BinaryFormatter();
            FileStream      file6 = File.Open(Application.persistentDataPath + "/playerDATA60.dat", FileMode.Open);
            Info            data1 = (Info)bf.Deserialize(file6);
            if (data1.SaveLabel != null && data1.SaveLabel != null)
            {
                SaveLAbel6.GetComponent <Text> ().text = data1.SaveLabel;
                LoadLAbel6.GetComponent <Text> ().text = data1.LoadLabel;
            }
            file6.Close();
        }

        if (File.Exists(Application.persistentDataPath + "/playerDATA70.dat"))
        {
            BinaryFormatter bf    = new BinaryFormatter();
            FileStream      file7 = File.Open(Application.persistentDataPath + "/playerDATA70.dat", FileMode.Open);
            Info            data1 = (Info)bf.Deserialize(file7);
            if (data1.SaveLabel != null && data1.SaveLabel != null)
            {
                SaveLAbel7.GetComponent <Text> ().text = data1.SaveLabel;
                LoadLAbel7.GetComponent <Text> ().text = data1.LoadLabel;
            }
            file7.Close();
        }

        if (File.Exists(Application.persistentDataPath + "/playerDATA80.dat"))
        {
            BinaryFormatter bf    = new BinaryFormatter();
            FileStream      file8 = File.Open(Application.persistentDataPath + "/playerDATA80.dat", FileMode.Open);
            Info            data1 = (Info)bf.Deserialize(file8);
            if (data1.SaveLabel != null && data1.SaveLabel != null)
            {
                SaveLAbel8.GetComponent <Text> ().text = data1.SaveLabel;
                LoadLAbel8.GetComponent <Text> ().text = data1.LoadLabel;
            }
            file8.Close();
        }

        if (File.Exists(Application.persistentDataPath + "/playerDATA90.dat"))
        {
            BinaryFormatter bf    = new BinaryFormatter();
            FileStream      file9 = File.Open(Application.persistentDataPath + "/playerDATA90.dat", FileMode.Open);
            Info            data1 = (Info)bf.Deserialize(file9);
            if (data1.SaveLabel != null && data1.SaveLabel != null)
            {
                SaveLAbel9.GetComponent <Text> ().text = data1.SaveLabel;
                LoadLAbel9.GetComponent <Text> ().text = data1.LoadLabel;
            }
            file9.Close();
        }
    }
Example #55
0
 public override int GetHashCode()
 {
     return(this.GetType().FullName.GetHashCode() ^ Info.GetHashCode() ^ NSamples.GetHashCode() ^ NPlanes.GetHashCode() ^ _planes.GetHashCode() ^ Buffer.GetHashCode() ^ _map_infos.GetHashCode());
 }
//Manipulação dos arquivos do jogador
//=============================================================================================================================
//A manipulação eh feita via formatador binario
//q transforma os dados selecionados em uma stream de bytes q  n podem ser abertos pelo sistema operacional

    public void Save(int id)
    {
        switch (id)
        {
        //Botão de Save1
        //O modelo eh o msm para todos os botões
        case 1:
        {
            //criando formatador
            BinaryFormatter bf = new BinaryFormatter();
            //setando arquivos
            FileStream file1 = File.Create(Application.persistentDataPath + "/playerDATA10.dat");
            Info       data1 = new Info();

            //armazenando informações no arquivo
            //data1.currentState = currentState;
            data1.IndexNome     = IndexNome;
            data1.IndexHistoria = IndexHistoria;
            data1.IndexData     = IndexData;
            data1.IndexBg       = IndexBg;
            data1.IndexImagens  = IndexImagens;
            data1.IndexMusica   = IndexMusica;

            //data1.IndexBg = IndexBg;
            //data1.IndexImagens = IndexImagens;
            //data1.vol = vol;	//GameObject.Find ("TempoDeJogoSave1").GetComponent<Text>().text = currentLineVN;
            //data1.IndexMusica = IndexMusica;
            SaveLAbel1.GetComponent <Text>().text = currentLineData;
            data1.SaveLabel = SaveLAbel1.GetComponent <Text>().text;
            data1.LoadLabel = SaveLAbel1.GetComponent <Text>().text;
            SaveLAbel1.GetComponent <Text> ().text = data1.SaveLabel;
            LoadLAbel1.GetComponent <Text> ().text = data1.SaveLabel;

            //salvando informações
            bf.Serialize(file1, data1);
            file1.Close();
        }
        break;

        case 2:
        {
            BinaryFormatter bf    = new BinaryFormatter();
            FileStream      file2 = File.Create(Application.persistentDataPath + "/playerDATA20.dat");
            Info            data1 = new Info();

            data1.IndexMusica = IndexMusica;
            //data1.currentState = currentState;
            data1.IndexNome     = IndexNome;
            data1.IndexHistoria = IndexHistoria;
            data1.IndexData     = IndexData;
            data1.IndexBg       = IndexBg;
            data1.IndexImagens  = IndexImagens;
            //data1.IndexBg = IndexBg;
            //data1.IndexImagens = IndexImagens;
            //data1.vol = vol;
            //data1.IndexMusica = IndexMusica;

            SaveLAbel2.GetComponent <Text>().text = currentLineData;
            data1.SaveLabel = SaveLAbel2.GetComponent <Text>().text;
            data1.LoadLabel = SaveLAbel2.GetComponent <Text>().text;
            SaveLAbel2.GetComponent <Text> ().text = data1.SaveLabel;
            LoadLAbel2.GetComponent <Text> ().text = data1.SaveLabel;
            bf.Serialize(file2, data1);
            file2.Close();
        }
        break;

        case 3:
        {
            BinaryFormatter bf    = new BinaryFormatter();
            FileStream      file3 = File.Create(Application.persistentDataPath + "/playerDATA30.dat");
            Info            data1 = new Info();
            data1.IndexMusica = IndexMusica;
            //data1.currentState = currentState;
            data1.IndexNome     = IndexNome;
            data1.IndexHistoria = IndexHistoria;
            data1.IndexData     = IndexData;
            data1.IndexBg       = IndexBg;
            data1.IndexImagens  = IndexImagens;
            //data1.IndexBg = IndexBg;
            //data1.IndexImagens = IndexImagens;
            //data1.vol = vol;
            //data1.IndexMusica = IndexMusica;
            SaveLAbel3.GetComponent <Text>().text = currentLineData;
            data1.SaveLabel = SaveLAbel3.GetComponent <Text>().text;
            data1.LoadLabel = SaveLAbel3.GetComponent <Text>().text;
            SaveLAbel3.GetComponent <Text> ().text = data1.SaveLabel;
            LoadLAbel3.GetComponent <Text> ().text = data1.SaveLabel;
            bf.Serialize(file3, data1);
            file3.Close();
        }
        break;

        case 4:
        {
            BinaryFormatter bf    = new BinaryFormatter();
            FileStream      file4 = File.Create(Application.persistentDataPath + "/playerDATA40.dat");
            Info            data1 = new Info();
            data1.IndexMusica = IndexMusica;
            //data1.currentState = currentState;
            data1.IndexNome     = IndexNome;
            data1.IndexHistoria = IndexHistoria;
            data1.IndexData     = IndexData;
            data1.IndexBg       = IndexBg;
            data1.IndexImagens  = IndexImagens;
            //data1.IndexBg = IndexBg;
            //data1.IndexImagens = IndexImagens;
            //data1.vol = vol;
            //data1.IndexMusica = IndexMusica;

            SaveLAbel4.GetComponent <Text>().text = currentLineData;
            data1.SaveLabel = SaveLAbel4.GetComponent <Text>().text;
            data1.LoadLabel = SaveLAbel4.GetComponent <Text>().text;
            SaveLAbel4.GetComponent <Text> ().text = data1.SaveLabel;
            LoadLAbel4.GetComponent <Text> ().text = data1.SaveLabel;
            bf.Serialize(file4, data1);
            file4.Close();
        }
        break;

        case 5:
        {
            BinaryFormatter bf    = new BinaryFormatter();
            FileStream      file5 = File.Create(Application.persistentDataPath + "/playerDATA50.dat");
            Info            data1 = new Info();
            data1.IndexMusica = IndexMusica;
            //data1.currentState = currentState;
            data1.IndexNome     = IndexNome;
            data1.IndexHistoria = IndexHistoria;
            data1.IndexData     = IndexData;
            data1.IndexBg       = IndexBg;
            data1.IndexImagens  = IndexImagens;
            //data1.IndexBg = IndexBg;
            //data1.IndexImagens = IndexImagens;
            //data1.vol = vol;
            //data1.IndexMusica = IndexMusica;
            SaveLAbel5.GetComponent <Text>().text = currentLineData;
            data1.SaveLabel = SaveLAbel5.GetComponent <Text>().text;
            data1.LoadLabel = SaveLAbel5.GetComponent <Text>().text;
            SaveLAbel5.GetComponent <Text> ().text = data1.SaveLabel;
            LoadLAbel5.GetComponent <Text> ().text = data1.SaveLabel;
            bf.Serialize(file5, data1);
            file5.Close();
        }
        break;

        case 6:
        {
            BinaryFormatter bf    = new BinaryFormatter();
            FileStream      file6 = File.Create(Application.persistentDataPath + "/playerDATA60.dat");
            Info            data1 = new Info();
            data1.IndexMusica = IndexMusica;
            //data1.currentState = currentState;
            data1.IndexNome     = IndexNome;
            data1.IndexHistoria = IndexHistoria;
            data1.IndexData     = IndexData;
            data1.IndexBg       = IndexBg;
            data1.IndexImagens  = IndexImagens;
            //data1.IndexBg = IndexBg;
            //data1.IndexImagens = IndexImagens;
            //data1.vol = vol;
            //data1.IndexMusica = IndexMusica;
            SaveLAbel6.GetComponent <Text>().text = currentLineData;
            data1.SaveLabel = SaveLAbel6.GetComponent <Text>().text;
            data1.LoadLabel = SaveLAbel6.GetComponent <Text>().text;
            SaveLAbel6.GetComponent <Text> ().text = data1.SaveLabel;
            LoadLAbel6.GetComponent <Text> ().text = data1.SaveLabel;
            bf.Serialize(file6, data1);
            file6.Close();
        }
        break;

        case 7:
        {
            BinaryFormatter bf    = new BinaryFormatter();
            FileStream      file7 = File.Create(Application.persistentDataPath + "/playerDATA70.dat");
            Info            data1 = new Info();
            data1.IndexMusica = IndexMusica;
            //data1.currentState = currentState;
            data1.IndexNome     = IndexNome;
            data1.IndexHistoria = IndexHistoria;
            data1.IndexData     = IndexData;
            data1.IndexBg       = IndexBg;
            data1.IndexImagens  = IndexImagens;
            //data1.IndexBg = IndexBg;
            //data1.IndexImagens = IndexImagens;
            //data1.vol = vol;
            //data1.IndexMusica = IndexMusica;
            SaveLAbel7.GetComponent <Text>().text = currentLineData;
            data1.SaveLabel = SaveLAbel7.GetComponent <Text>().text;
            data1.LoadLabel = SaveLAbel7.GetComponent <Text>().text;
            SaveLAbel7.GetComponent <Text> ().text = data1.SaveLabel;
            LoadLAbel7.GetComponent <Text> ().text = data1.SaveLabel;
            bf.Serialize(file7, data1);
            file7.Close();
        }
        break;

        case 8:
        {
            BinaryFormatter bf    = new BinaryFormatter();
            FileStream      file8 = File.Create(Application.persistentDataPath + "/playerDATA80.dat");
            Info            data1 = new Info();
            data1.IndexMusica   = IndexMusica;
            data1.IndexNome     = IndexNome;
            data1.IndexHistoria = IndexHistoria;
            data1.IndexData     = IndexData;
            data1.IndexBg       = IndexBg;
            data1.IndexImagens  = IndexImagens;
            //data1.IndexBg = IndexBg;
            //data1.IndexImagens = IndexImagens;
            //data1.vol = vol;
            //data1.IndexMusica = IndexMusica;
            SaveLAbel8.GetComponent <Text>().text = currentLineData;
            data1.SaveLabel = SaveLAbel8.GetComponent <Text>().text;
            data1.LoadLabel = SaveLAbel8.GetComponent <Text>().text;
            SaveLAbel8.GetComponent <Text> ().text = data1.SaveLabel;
            LoadLAbel8.GetComponent <Text> ().text = data1.SaveLabel;
            bf.Serialize(file8, data1);
            file8.Close();
        }
        break;

        case 9:
        {
            BinaryFormatter bf    = new BinaryFormatter();
            FileStream      file9 = File.Create(Application.persistentDataPath + "/playerDATA90.dat");
            Info            data1 = new Info();
            data1.IndexMusica = IndexMusica;
            //data1.currentState = currentState;
            data1.IndexNome     = IndexNome;
            data1.IndexHistoria = IndexHistoria;
            data1.IndexData     = IndexData;
            data1.IndexBg       = IndexBg;
            data1.IndexImagens  = IndexImagens;
            //data1.IndexBg = IndexBg;
            //data1.IndexImagens = IndexImagens;
            //data1.vol = vol;
            //data1.IndexMusica = IndexMusica;
            SaveLAbel9.GetComponent <Text>().text = currentLineData;
            data1.SaveLabel = SaveLAbel9.GetComponent <Text>().text;
            data1.LoadLabel = SaveLAbel9.GetComponent <Text>().text;
            SaveLAbel9.GetComponent <Text> ().text = data1.SaveLabel;
            LoadLAbel9.GetComponent <Text> ().text = data1.SaveLabel;
            bf.Serialize(file9, data1);
            file9.Close();
        }
        break;
        }
    }
Example #57
0
        public TestResult ValidateTest(string url, string test_case)
        {
            XMLParser parser = new XMLParser();
            XmlReader reader = XmlReader.Create(url);

            parser.StartTest(reader, test_case, "dummy tester");
            var output = parser.output;

            Console.WriteLine("Start testing...\n");
            //Console.WriteLine(output);
            bool         overallPassed = parser.overallPassTest;
            var          table_result  = parser.table;
            var          log_result    = parser.log;
            var          fail_cnt      = parser.failCounter;
            var          success_cnt   = parser.successCounter;
            HtmlDocument document      = new HtmlDocument();

            document.LoadHtml(output);
            List <Test> tests = new List <Test>();

            if (document.DocumentNode != null)
            {
                HtmlNodeCollection testCases = document.DocumentNode.SelectNodes("//div[@id='testresult']");

                foreach (HtmlNode tc in testCases)
                {
                    HtmlNode           title          = tc.SelectSingleNode(".//h3");
                    HtmlNode           success_result = tc.SelectSingleNode(".//h4[@class='text-success']");
                    HtmlNode           error_result   = tc.SelectSingleNode(".//h4[@class='text-error']");
                    HtmlNode           warning_result = tc.SelectSingleNode(".//h4[@class='text-warning']");
                    HtmlNodeCollection info_nodes     = tc.SelectNodes(".//p[@class='text-info']");
                    string             title_str      = title.InnerText;
                    bool   isPassed = false;
                    string result   = "";
                    if (success_result != null)
                    {
                        isPassed = true;
                        result   = success_result.InnerText;
                    }
                    else if (warning_result != null)
                    {
                        isPassed = true;
                        result   = warning_result.InnerText;
                    }
                    else if (error_result != null)
                    {
                        result = error_result.InnerText;
                    }
                    Test        test  = new Test(title_str, isPassed, result);
                    List <Info> infos = new List <Info>();
                    if (info_nodes != null)
                    {
                        foreach (HtmlNode node in info_nodes)
                        {
                            HtmlNode key      = node.SelectSingleNode(".//a");
                            var      key_str  = "";
                            var      source   = "";
                            var      info_str = node.InnerText;
                            if (key != null && node.Attributes["source"] != null)
                            {
                                key_str = key.Attributes["class"].Value;
                                source  = node.Attributes["source"].Value;
                            }
                            if (key_str.Length > 0)
                            {
                                Info info = new Info(key_str, info_str, source);
                                Console.WriteLine(info.key + " : " + info.source);
                                infos.Add(info);
                            }
                        }
                        test.infos = infos.ToArray();
                    }

                    tests.Add(test);
                }
            }
            //Console.WriteLine(JsonConvert.SerializeObject(tests));
            Console.WriteLine("End of testing...\n");
            TestResult tr = new TestResult(overallPassed, fail_cnt, success_cnt, tests.ToArray(), output, table_result, log_result);

            //Console.WriteLine(JsonConvert.SerializeObject(tr));
            return(tr);
        }
Example #58
0
 /// <summary>
 /// 构造函数
 /// </summary>
 /// <param name="ifo"> 设备信息 Info </param>
 public InstDeviceStateM(TInfo ifo)
 {
     Info = ifo;
     Info.FreshFromSql2Info();
 }
Example #59
0
        private DataTable GetTableReader(string library, string select, string[] _nParametros, object[] _vParametros)
        {
            Info.avance(select);
            DataTable dtTmp = new DataTable();

            using (OracleConnection conn = new OracleConnection(_Security.cadena))
            {
                Info.avance(SelectCommand.GetCommand(library, select, _nParametros, _vParametros));
#pragma warning disable CA2100 // Review SQL queries for security vulnerabilities
                OracleCommand cmd = new OracleCommand(SelectCommand.GetCommand(library, select, _nParametros, _vParametros), conn);
#pragma warning restore CA2100 // Review SQL queries for security vulnerabilities
                switch (select)
                {
                case "FDB_LEER_ANEXOS_DIAN":
                {
                    cmd.CommandType = CommandType.StoredProcedure;
                    break;
                }

                default:
                {
                    cmd.CommandType = CommandType.Text;
                    break;
                }
                }

                //Debido a que el stored procedure recibe un parámetro de salida creamos un objeto de tipo OracleParameter y lo definimos que será de salida y de tipo RefCursor.

                Info.avance("OracleParameter p_refcursor = new OracleParameter()");
                OracleParameter p_refcursor = new OracleParameter();
                p_refcursor.OracleDbType = OracleDbType.RefCursor;
                p_refcursor.Direction    = ParameterDirection.ReturnValue;
                cmd.Parameters.Add(p_refcursor);


                for (int i = 0; i < _nParametros.Length; i++)
                {
                    Info.avance("cmd.Parameters.Add(parametroInt(_nParametros[i], _vParametros[i]))");
                    cmd.Parameters.Add(parametroInt(_nParametros[i], _vParametros[i]));
                }

                try
                {
                    Info.avance("cmd.ExecuteNonQuery()");
                    cmd.ExecuteNonQuery();//El método executeNonQuery ejecuta el stored procedure y éste nos devolverá el cursor ya abierto el cual tiene identificado el conjunto de filas a recuperar.

                    OracleRefCursor cursor = (OracleRefCursor)p_refcursor.Value;

                    OracleDataReader dr = cursor.GetDataReader();//Se crea el objeto DataReader mediante el valor obtenido por el cursor (OracleParameter) para recorrer la información y cargarla a nuestro arreglo.


                    /*  En muchas situaciones es recomendable aumentar el tamaño en ventaja de recoger la información más rápido siendo más eficientes. Esto se realiza con la siguiente línea de código:
                     *  dr.FetchSize = cmd.RowSize * 100;
                     *  En este caso esperamos recibir la información en bloques de 100 filas, por lo cual si una tabla tiene 1000 filas se harán 10 viajes de la capa de base de datos a la capa cliente para obtener la información completa de la tabla.
                     *  La vista V$SQL tiene los campos: executions, fetches y rows_processed los cuales nos pueden ayudar a definir la cantidad de filas hacer retornadas en un fetch de manera eficiente.
                     *  Por ejemplo: Si obtenemos el ratio de rows_processed/executions nos daría la cantidad de filas promedio obtenidas en una ejecución del query.
                     *  El ratio de fetches/executions nos entrega la cantidad de fetchs en cada ejecución.
                     *  Obteniendo ambos ratios tenemos la cantidad de filas y fetchs de cada ejecución del query los cuales podrían ser reducidos ampliando la cantidad de filas a traer en cada operación de fetch.
                     */

                    FieldInfo fi = dr.GetType().GetField("m_rowSize", BindingFlags.Instance | BindingFlags.NonPublic);
                    fi = dr.GetType().GetField("m_rowSize", BindingFlags.Instance);

                    //Existe un bug con el atributo RowSize del objeto Command ya que devuelve siempre el valor de 0. Para evitar el bug y conseguir el tamaño en bytes de una fila se ha implementado las siguientes líneas de código.
                    int rowsize = 0;
                    try
                    {
                        //int rowsize = Convert.ToInt32(fi.GetValue(dr));
                        rowsize = dr.FieldCount * 100;
                    }
                    catch (Exception ex)
                    {
                        rowsize = 1515;
                    }

                    //Un fetch es un conjunto de filas que recoge la capa de aplicación de la base de datos mientras recorre un cursor. Por default este valor es 64 KB, es decir en bloques de 64 KB se va obteniendo todas las filas de un cursor.
                    dr.FetchSize = rowsize * 100;
                    while (dr.Read())
                    {
                        /*EConsulta objConsulta = new EConsulta();
                         * objConsulta.ORCA_NUMERO_NB = double.Parse(dr["ORCA_NUMERO_NB"].ToString());*/
                    }
                    p_refcursor.Dispose();
                    cmd.Dispose();
                }
                catch (OracleException ex)
                {
                    if (conn.State == ConnectionState.Open)
                    {
                        conn.Close();
                    }
                    PrcsOracleException(SelectCommand.GetCommand(library, select, _nParametros, _vParametros), ex);
                }
                catch (Exception ex)
                {
                    if (conn.State == ConnectionState.Open)
                    {
                        conn.Close();
                    }
                    PrcsException(library, SelectCommand.GetCommand(library, select, _nParametros, _vParametros), ex, _nParametros, _vParametros);
                }
                finally
                {
                    if (conn.State == ConnectionState.Open)
                    {
                        conn.Close();
                    }
                }
            }
            return(dtTmp);
        }
Example #60
0
 public void Load(Info info)
 {
     this.position = info.position;
     this.scale    = info.scale;
     this.rotation = info.rotation;
 }