Beispiel #1
0
        public ServerExplorer(string clusterName)
        {
            InitializeComponent();
            CheckForIllegalCrossThreadCalls = false;
            cluster_name     = clusterName;
            UpdateTree       = UpdateTreeImpl;
            conexion.Destino = new Destino();

            IPHostEntry he = null;
            string      imei;

            try
            {
                while (he == null)
                {
                    he = Dns.GetHostEntry(Config.GetConfigurationString(cluster_name, "server_ip_address", "localhost"));
                    Marshall.Debug(String.Format("CONSOLE: Esperando que resuelva {0}", ConfigurationManager.AppSettings["ip_address"]));
                    Thread.Sleep(1000);
                }
                imei = ConfigurationManager.AppSettings[cluster_name + ".client_identifier"];
            }
            catch (Exception)
            {
                Marshall.Error("ERROR FATAL: La configuracion no es valida, revisar.");
                return;
            }
            conexion.Destino.UDP   = new IPEndPoint(he.AddressList[0], 2357);
            conexion.IMEI          = imei;
            conexion.Password      = "******";
            conexion.StateChange  += conexion_StateChange;
            conexion.DeviceUpdate += conexion_DeviceUpdate;
            conexion.Init(7532, 8192);
        }
Beispiel #2
0
        private static void TesterUT_SystemReport(object sender, SystemReport pdu)
        {
            Marshall.User("        GPS_FixedSeconds: {0}", pdu.GPS_FixedSeconds);
            Marshall.User("        GPS_BlindSeconds: {0}", pdu.GPS_BlindSeconds);
            Marshall.User("        GPS_Resets: {0}", pdu.GPS_Resets);
            Marshall.User("        MODEM_Resets: {0}", pdu.MODEM_Resets);
            Marshall.User("        NETWORK_UDP_ReceivedBytes: {0}", pdu.NETWORK_UDP_ReceivedBytes);
            Marshall.User("        NETWORK_UDP_SentBytes: {0}", pdu.NETWORK_UDP_SentBytes);
            Marshall.User("        NETWORK_UDP_ReceivedDgrams: {0}", pdu.NETWORK_UDP_ReceivedDgrams);
            Marshall.User("        NETWORK_UDP_SentDgrams: {0}", pdu.NETWORK_UDP_SentDgrams);
            Marshall.User("        NETWORK_Resets: {0}", pdu.NETWORK_Resets);
            Marshall.User("        WatchDogResets: {0}", pdu.WatchDogResets);
            Marshall.User("        SystemResets: {0}", pdu.SystemResets);
            Marshall.User("System Report: ");
            if (fs == null)
            {
                return;
            }
            var report = String.Format("{0:yyyyMMddhhmmss},{1},{2},{3},{4},{5}\r\n",
                                       DateTime.Now, pdu.IdDispositivo, pdu.NETWORK_UDP_ReceivedBytes,
                                       pdu.NETWORK_UDP_ReceivedDgrams, pdu.NETWORK_UDP_SentBytes,
                                       pdu.NETWORK_UDP_SentDgrams);
            var buff = Encoding.ASCII.GetBytes(report);

            fs.BeginWrite(buff, 0, buff.GetLength(0), TesterUT_SystemReport_Commit, null);
        }
Beispiel #3
0
    private void ReadSharedMem_Click(object sender, EventArgs e)
    {
        IntPtr ptr;

        try
        {
            ptr = Marshall.AllocHGlobal(Marshall.SizeOf(typeof(SYSTEM_OUTPUT)));
            int ret = getStatus(ptr);

            if (ret == 0)
            {
                output = (SYSTEM_OUTPUT)Marshal.PtrToStructure(ptr, typeof(SYSTEM_OUTPUT));
            }

            //do something with output

            label1.Text = ret;
        }
        catch (AccessViolationException ave)
        {
            label1.Text = ave.Message;
        }
        finally
        {
            Marshal.FreeHGlobal(ptr);              //make sure to free the memory
        }
    }
Beispiel #4
0
        public override void Sync(SyncContext ctx)
        {
            base.Sync(ctx);

            Marshall.Sync(ctx, ref inherits);
            Marshall.Sync(ctx, ref members);
        }
Beispiel #5
0
            void WriteImportsCache(string file, FileImports imports)
            {
                //Console.WriteLine("IMPORTS MISS " + file);
                var cache_imports_file = GetImportsCacheFile(cache_dir, file);

                Marshall.Obj2File(imports, cache_imports_file);
            }
Beispiel #6
0
    public static Character CreateCharacter(int id)
    {
        Character c = null;

        switch (id)
        {   //有没有bug看单位表和各个类
        case 1:  c = new MvpTemp();    break;

        case 2:  c = new TankTemp();   break;

        case 3:  c = new WarriorTemp(); break;

        case 4:  c = new Taunter();    break;     // 嘲讽盾

        case 5:  c = new Paladin();    break;     // 奶骑

        case 6:                        break;     // 反甲

        case 7:  c = new Explosive();  break;     // 自爆卡车

        case 8:  c = new Linkage();    break;     // 联动

        case 9:  c = new TaiChi();     break;     // 打太极

        case 10: c = new Silence();    break;     // 沉默

        case 11: c = new GroupHealer(); break;    // 群体治疗

        case 12:                       break;     // 单体治疗

        case 13:                       break;     // 操控怒气

        case 14: c = new Calmer();     break;     // 频繁减怒

        case 15: c = new Buffer();     break;     // 加buff

        case 16: c = new Pierce();     break;     // 单体输出

        case 17: c = new Sputter();    break;     // 溅射

        case 18: c = new Volition();   break;     // 越打越痛

        case 19: c = new Transformer(); break;    // 变身

        case 20: c = new DoubleAgent(); break;    // 内鬼

        case 21: c = new Lazer();      break;     // 激光豆

        case 22: c = new Darius();     break;     // 人头狗

        case 23:                       break;     // 投石机

        case 24: c = new Marshall();   break;     // 黑胡子

        default: Debug.Log("输入了错误的id,找不到对应单位"); break;
        }

        return(c);
    }
Beispiel #7
0
 public void Sync(SyncContext ctx)
 {
     Marshall.Sync(ctx, items);
     if (ctx.is_read)
     {
         Update();
     }
 }
Beispiel #8
0
 internal void TesterUT_AutoReport(object sender, Posicion pdu)
 {
     foreach (string s in pdu.TraceFull())
     {
         Marshall.User(s);
     }
     Marshall.User("**** Autoreporte recibido:");
 }
Beispiel #9
0
 internal void TesterUT_RFIDDetected(object sender, RFIDDetectado pdu)
 {
     foreach (string s in pdu.TraceFull())
     {
         Marshall.User(s);
     }
     Marshall.User("**** RFID recibido:");
 }
Beispiel #10
0
 public override void AddPieceTypes()
 {
     base.AddPieceTypes();
     Cardinal.Enabled = false;
     Marshall.Name    = "Chancellor";
     Marshall.SetNotation("C");
     AddPieceType(Unicorn = new Unicorn("Unicorn", "U", 1050, 1125));
     AddPieceType(Lion    = new Lion("Lion", "L", 450, 450));
 }
Beispiel #11
0
        public override void Sync(SyncContext ctx)
        {
            Marshall.Sync(ctx, ref item_type);

            if (ctx.is_read)
            {
                name = "[]" + item_type.name;
            }
        }
Beispiel #12
0
 public void Sync(SyncContext ctx)
 {
     Marshall.Sync(ctx, ref ret_type);
     Marshall.Sync(ctx, arg_types);
     if (ctx.is_read)
     {
         Update();
     }
 }
Beispiel #13
0
        private void flashIt_Click_1(object sender, EventArgs e)
        {
            var d = Devices.i().Find(Convert.ToInt16(flashIt.Tag));

            if (d != null)
            {
                ut.FlashOverTheAir(d.Id, firmwareBinaryFilename, Convert.ToInt32(nud_pagina.Value));
                flashIt.Text = String.Format("Flashar Dispositivo id={0}", (object[])flashIt.Tag);
                return;
            }
            Marshall.User("No se encontro el dispositivo seleccionado para Flashear: {0}", flashIt.Tag.ToString());
        }
Beispiel #14
0
 private void TesterUT_ExcesoVelocidad(object sender, ExcesoVelocidad pdu)
 {
     if (pdu.CL == 0x01)
     {
         Marshall.User("El dispositivo {0} exedio la velocida maxima velocidad={1}", pdu.IdDispositivo,
                       pdu.VelocidadMaximaAlcanzada);
     }
     else
     {
         Marshall.User("El dispositivo {0} vuelve a velocidad normal. la velocida maxima velocidad alcanzada={1}", pdu.IdDispositivo, pdu.VelocidadMaximaAlcanzada);
     }
 }
Beispiel #15
0
        public void Sync(SyncContext ctx)
        {
            if (ctx.is_read)
            {
                types = ((SymbolFactory)ctx.factory).types;
            }
            else if (string.IsNullOrEmpty(_name))
            {
                throw new Exception("TypeProxy name is empty");
            }

            Marshall.Sync(ctx, ref _name);

            IMarshallableGeneric mg = null;

            if (ctx.is_read)
            {
                Marshall.SyncGeneric(ctx, ref mg);
                type = (IType)mg;
            }
            else
            {
                var resolved = Get();
                //TODO: make this check more robust
                bool defined_in_scope =
                    resolved is Symbol symb &&
                    (symb.scope is ModuleScope ||
                     symb is BuiltInSymbol ||
                     symb is ClassSymbolNative ||
                     symb is InterfaceSymbolNative ||
                     symb is EnumSymbol ||
                     (symb is ArrayTypeSymbol && !(symb is GenericArrayTypeSymbol))
                    );

                //NOTE: we want to marshall only those types which are not
                //      defined elsewhere otherwise we just want to keep
                //      string reference at them
                if (!defined_in_scope)
                {
                    mg = resolved as IMarshallableGeneric;
                    if (mg == null)
                    {
                        throw new Exception("Type is not marshallable: " + (resolved != null ? resolved.GetType().Name + " " : "<null> ") + _name);
                    }
                }
                Marshall.SyncGeneric(ctx, ref mg);
            }
        }
Beispiel #16
0
 public override void AddPieceTypes()
 {
     base.AddPieceTypes();
     AddPieceType(Wizard = new Wizard("Wizard", "W", 460, 460));
     AddPieceType(Lion   = new Lion("Lion", "L", 475, 475));
     //	Add the Wazir-move to the Knight
     Wazir.AddMoves(Knight);
     Knight.MidgameValue   = 475;
     Knight.EndgameValue   = 475;
     Knight.PreferredImage = "Knight Wazir";
     //	Set the name for the Chancellor (called Marshall in Grand Chess)
     Marshall.Name = "Chancellor";
     Marshall.SetNotation("C");
     //	Set the name for the Archbishop (called a Cardinal in Grand Chess)
     Cardinal.Name = "Archbishop";
     Cardinal.SetNotation("A");
 }
Beispiel #17
0
 private void listBox1_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (listBox1.SelectedItem != null)
     {
         var d = listBox1.SelectedItem as Device;
         if (d != null)
         {
             Marshall.User("Dispositivo Seleccionado para Flashear: {0}", d.ToString());
             flashIt.Tag     = d.Id;
             flashIt.Text    = String.Format("Flashar Dispositivo id={0}", d.Id);
             flashIt.Enabled = true;
             return;
         }
     }
     flashIt.Text    = "Debe seleccionar un Dispositivo";
     flashIt.Enabled = false;
 }
Beispiel #18
0
 public TesterUT()
 {
     try
     {
         string filename = String.Format("{0}\\systemreport.csv", Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase));
         filename = filename.Substring(6);
         Marshall.User(filename);
         fs            = File.Open(filename, FileMode.Append, FileAccess.Write, FileShare.Read);
         SystemReport += TesterUT_SystemReport;
     }
     catch (Exception e)
     {
         Marshall.Error(String.Format("SYSTEM REPORT DESHABILITADO!!! ERROR={0}", e));
     }
     AutoReport      += TesterUT_AutoReport;
     RFIDDetected    += TesterUT_RFIDDetected;
     ExcesoVelocidad += TesterUT_ExcesoVelocidad;
 }
Beispiel #19
0
            FileImports TryReadImportsCache(string file)
            {
                var cache_imports_file = GetImportsCacheFile(cache_dir, file);

                if (BuildUtil.NeedToRegen(cache_imports_file, file))
                {
                    return(null);
                }

                try
                {
                    return(Marshall.File2Obj <FileImports>(cache_imports_file));
                }
                catch
                {
                    return(null);
                }
            }
Beispiel #20
0
 public void Sync(SyncContext ctx)
 {
     Marshall.Sync(ctx, files);
 }
Beispiel #21
0
 private void devicesTree_AfterSelect(object sender, TreeViewEventArgs e)
 {
     Marshall.User("Nodo Seleccionado: {0}{1}", e.Node.Name, "");
     selected_device = devices_by_imei[e.Node.Name];
     UpdatePanel(selected_device);
 }
Beispiel #22
0
 public void Sync(SyncContext ctx)
 {
     Marshall.Sync(ctx, ref subj);
 }
Beispiel #23
0
 public override void Sync(SyncContext ctx)
 {
     base.Sync(ctx);
     Marshall.Sync(ctx, ref _scope_idx);
 }
Beispiel #24
0
 public virtual void Sync(SyncContext ctx)
 {
     Marshall.Sync(ctx, ref name);
     Marshall.Sync(ctx, ref type);
 }
Beispiel #25
0
 internal static void TesterUT_SystemReport_Commit(IAsyncResult state)
 {
     Marshall.User("System Report Commited!");
     fs.EndWrite(state);
     fs.Flush();
 }
Beispiel #26
0
 public void Sync(SyncContext ctx)
 {
     Marshall.Sync(ctx, ref module_name);
     Marshall.Sync(ctx, ref members);
 }
Beispiel #27
0
 // new players for every new test ..
 public Part4()
 {
     _marshall = new Marshall("Wyatt Earp");
     _cowboy   = new Cowboy("Curly Bill Brocius");
     _gambler  = new Gambler("Doc Holliday");
 }
Beispiel #28
0
 private void MainMDI_FormClosed(object sender, FormClosedEventArgs e)
 {
     Marshall.Info("CORE: cerrando...");
     Marshall.Shutdown();
 }