示例#1
0
        public void Main(string argument, UpdateType updateSource)
        {
            // Echo some information aboue 'me' and why we were run
            Echo("Source=" + updateSource.ToString());
            Echo("Me=" + Me.EntityId.ToString("X"));
            Echo(Me.CubeGrid.CustomName);

            if (!bInit)
            {
                InitMessageHandlers();
                bInit = true;
            }

            // use if not setting callbacks for any of the desired channels
            //            if (bInit) wicoIGC.ProcessIGCMessages();

            if ((updateSource & UpdateType.IGC) > 0)
            {
                // we got a callback for an IGC message.
                // There might be multiple incoming IGC messages
                wicoIGC.ProcessIGCMessages();
            }
            else if ((updateSource & utTriggers) > 0)
            {
                // if we got a 'trigger' source, send out the received argument
                IGC.SendBroadcastMessage(sBroadCastTag, argument);
            }
            else if ((updateSource & utUpdates) > 0)
            {
                // it was an automatic update
            }
        }
示例#2
0
        public static string GetLastVersion(UpdateType ut)
        {
            MySqlParameter[] param = new MySqlParameter[1];

            param[0] = new MySqlParameter("_updDescription", ut.ToString());

            DbAccessLayer.MySqlDbAccess db = new DbAccessLayer.MySqlDbAccess(ConnectionString(), DbAccessLayer.ConnectionStringSourceType.MySetting);

            System.Data.IDataReader reader = db.GetDataReaderFromProcedure("stpDad_updateSelLastVersion", param);

            string result = string.Empty;

            if (db.HasError)
            {
                throw db.ErrorException;
            }

            if (reader.Read())
            {
                result = DbAccessLayer.MySqlDataHelper.GetString(reader, "updVersionName");
            }

            reader.Close();

            return(result);
        }
示例#3
0
文件: Add.cs 项目: waqashaneef/NosDB
 public void Print(System.IO.TextWriter output)
 {
     output.Write("Add:{");
     output.Write("TargetField=");
     if (_targetField != null)
     {
         _targetField.Print(output);
     }
     else
     {
         output.Write("null");
     }
     output.Write(",Evaluations=");
     if (_evaluator != null)
     {
         output.Write("[");
         for (int i = 0; i < _evaluator.Length; i++)
         {
             _evaluator[i].Print(output);
             if (i != _evaluator.Length - 1)
             {
                 output.Write(",");
             }
         }
         output.Write("]");
     }
     else
     {
         output.Write("null");
     }
     output.Write(",Type=" + _type.ToString());
     output.Write("}");
 }
示例#4
0
        public static async Task <IReadOnlyCollection <IContainerGroup> > StartFleet(ILogger log, Cfg cfg, UpdateType optionUpdateType)
        {
            var sheets        = (await ChannelSheets.MainChannels(cfg.App.Sheets, log)).ToList();
            var evenBatchSize = (int)Math.Ceiling(sheets.Count / Math.Ceiling(sheets.Count / (double)cfg.App.ChannelsPerContainer));

            var batches = sheets.Randomize().Batch(evenBatchSize).Select((b, i) => (batch: b.ToList(), name: $"{cfg.App.Container.Name}-fleet-{i}", i)).ToList();

            var azure = GetAzure(cfg);

            // before starting feel. Ensure they are all not already running
            await batches.BlockAction(async b => await EnsureNotRunning(b.name, azure, cfg.App.ResourceGroup), cfg.App.DefaultParallel);

            var fleet = await batches.BlockTransform(async b => {
                var(batch, fleetName, i) = b;
                var region = Regions[i % Regions.Length];
                var args   = new[] {
                    "update",
                    "-t", optionUpdateType.ToString(),
                    "-c", batch.Join("|", c => c.Id)
                };
                var group = await ContainerGroup(cfg, azure, fleetName, region, args.ToArray());
                return(await group.CreateAsync());
            }, cfg.App.DefaultParallel);

            log.Information("Started fleet containers: {Containers}", fleet.Join(", ", f => f.Name));
            return(fleet);
        }
示例#5
0
        public static Nullable <int> GetLastVersionDownloaded(UpdateType ut)
        {
            MySqlParameter[] param = new MySqlParameter[1];

            param[0] = new MySqlParameter("_updDescription", ut.ToString());

            DbAccessLayer.MySqlDbAccess db = new DbAccessLayer.MySqlDbAccess(ConnectionString(), DbAccessLayer.ConnectionStringSourceType.MySetting);

            System.Data.IDataReader reader = db.GetDataReaderFromProcedure("stpDadupdateSelLastVerDownloaded", param);

            Nullable <int> result = null;

            if (db.HasError)
            {
                throw db.ErrorException;
            }

            if (reader.Read())
            {
                result = DbAccessLayer.MySqlDataHelper.GetNullableInt(reader, "updVersion");
            }

            reader.Close();

            return(result);
        }
示例#6
0
        public void Main(string argument, UpdateType updateSource)
        {
            // Echo some information about 'me' and why we were run
            Echo("Source=" + updateSource.ToString());
            Echo("Me=" + Me.EntityId.ToString("X"));
            Echo(Me.CubeGrid.CustomName);

            if (!_areWeInited)
            {
                InitMessageHandlers();
                _areWeInited = true;
            }

            // always check for IGC messages in case some aren't using callbacks
            _wicoIGC.ProcessIGCMessages();
            if ((updateSource & UpdateType.IGC) > 0)
            {
                // we got a callback for an IGC message.
                // but we already processed them.
            }
            else if ((updateSource & _utTriggers) > 0)
            {
                // if we got a 'trigger' source, send out the received argument
                IGC.SendBroadcastMessage(_broadCastTag, argument);
                Echo("Sending Message:\n" + argument);
            }
            else if ((updateSource & _utUpdates) > 0)
            {
                // it was an automatic update

                // this script doesn't have anything to do in this section
            }
        }
示例#7
0
        public void Main(string argument, UpdateType updateSource)
        {
            _counter++;

            Echo(updateSource.ToString());
            Echo(_counter.ToString());

            // Check if run from Terminal.
            if ((updateSource & UpdateType.Terminal) != 0)
            {
                Setup();
            }

            if ((updateSource & UpdateType.Update100) != 0)
            {
                foreach (LandingPadGroup group in _groupList)
                {
                    group.CheckBlocks();
                }
            }

            // Display information on main LCD panel.
            if (_mainPanels.Any())
            {
                //ShowDataOnScreen(_mainPanels, _groupList);
                foreach (DisplayPanel panel in _mainPanels)
                {
                    panel.UpdatePanel();
                }
            }
        }
        public void Main(string argument, UpdateType updateSource)
        {
            try {
                Warnings.Clear();
                ResolveOperation();
                HandleArgs(argument);
                Governor();
                CheckUpdateFrequency();

                OperationGraphic.Selection = (UInt16)Operations.ToArrayIndex(Operation);
                StatusLCDs.WriteText(OperationGraphic.Render(), true);
                StatusLCDs.WriteText(RenderMaxImpulseAxis(), true);
                ConsoleLCDs.WriteText(RenderMaxImpulseAxis(), true);
                ConsoleLCDs.WriteText("Argument: " + (argument ?? "Null") + '\n', true);
                ConsoleLCDs.WriteText("UpdateType: " + updateSource.ToString() + '\n', true);
            } catch (BlockNullReferenceException BlockNull) {
                string ErrorMessageFormatted = "CRITICAL ERROR:\n" + BlockNull.Message;
                ConsoleLCDs.WriteText(ErrorMessageFormatted, false);
                StatusLCDs.WriteText(ErrorMessageFormatted, false);

                StatusLCDs.FlushText();
                ConsoleLCDs.FlushText();
                throw;
            } catch (KlangSafetyException KlangSafety) {
                Piston.Enabled = false;
                OutRiggerRelease();
                Lock.Enabled  = false;
                Foot.Enabled  = true;
                Foot.AutoLock = true;
                Foot.Lock();
                Runtime.UpdateFrequency = UpdateFrequency.None;

                string ErrorMessageFormatted = "CRITICAL ERROR:\n" + KlangSafety.Message;
                ConsoleLCDs.WriteText(ErrorMessageFormatted, false);
                StatusLCDs.WriteText(ErrorMessageFormatted, false);

                StatusLCDs.FlushText();
                ConsoleLCDs.FlushText();
                throw;
            } catch (Exception) {
                throw;
            }

            if (Warnings.Count > 0)
            {
                string WarningMessageFormatted = "|| WARNINGS ||:\n";
                foreach (string Warning in Warnings)
                {
                    WarningMessageFormatted += Warning + "\n";
                }
                WarningMessageFormatted += "|| END OF WARNINGS ||\n\n";
                ConsoleLCDs.WriteText(WarningMessageFormatted + ConsoleLCDs.GetText(), false);
                StatusLCDs.WriteText(WarningMessageFormatted + StatusLCDs.GetText(), false);
            }
            Echo(ConsoleLCDs.GetText());
            StatusLCDs.FlushText();
            ConsoleLCDs.FlushText();
        }
示例#9
0
        public static string GetUpdateType(UpdateType updateType)
        {
            var type         = typeof(UpdateType);
            var fieldInfoArr = type.GetFields();
            var fieldInfo    = fieldInfoArr.First(i => i.Name == updateType.ToString());
            var attribute    = (UpdateAttribute)fieldInfo.GetCustomAttribute(typeof(UpdateAttribute));

            return(attribute.UpdateType);
        }
示例#10
0
        public void Main(string argument, UpdateType updateSource)
        {
            Echo("Source=" + updateSource.ToString());
            Echo("Me=" + Me.EntityId.ToString());
            Echo(Me.CubeGrid.CustomName);
            //Echo($"{DateTime.Now.ToString()}");

            drone.HandleCallback(argument);
            drone.Perform();
        }
        public void Main(string argument, UpdateType updateSource)
        {
            IMyTerminalBlock block = GridTerminalSystem.GetBlockWithName(nameLight);

            if (block is IMyInteriorLight)
            {
                blockLight = (IMyInteriorLight)block;
            }

            blockLight.Enabled = !blockLight.Enabled;
            Echo(updateSource.ToString());
        }
示例#12
0
 private void RunUpdate(UpdateBase _runobj)
 {
     try
     {
         _runobj.RunDelgete();
     }
     catch (System.Exception _erro)
     {
         DLog.LogError(string.Format("[{0}] [{1}]{2}", mUpdateType.ToString(), _runobj.Key, _erro.ToString()));
         _runobj.UnRegToOwner();
     }
 }
示例#13
0
        /// <summary>
        /// 转译为对应数据库的查询语句
        /// </summary>
        public static string ToQueryString(this UpdateType updateType)
        {
            switch (updateType)
            {
            case UpdateType.SetValue:
                return("=");

            case UpdateType.IncreaseByValue:
                return("+=");

            default:
                throw new NotImplementedException("未支持该类型的操作符" + updateType.ToString());
            }
        }
示例#14
0
        public void Main(string argument, UpdateType updateSource)
        {
            // The main entry point of the script, invoked every time
            // one of the programmable block's Run actions are invoked,
            // or the script updates itself. The updateSource argument
            // describes where the update came from. Be aware that the
            // updateSource is a  bitfield  and might contain more than
            // one update type.
            //
            // The method itself is required, but the arguments above
            // can be removed if not needed.

            Echo(updateSource.ToString());
        }
示例#15
0
        public void Main(string argument, UpdateType updateSource)
        {
            Echo(String.Format("UPDATE CALLED FROM {0}", updateSource.ToString()));

            // Get message from listener
            MyIGCMessage message = listener.AcceptMessage();
            Dictionary <string, object> messageData = DecodeMessage((string)message.Data);
            long requestSource = message.Source;

            Echo(messageData["shipID"].ToString());
            long   shipID  = (long)messageData["shipID"];
            string request = messageData["request"].ToString().Trim();

            Echo(string.Format("ID: {0}, request: {1}", shipID.ToString(), request));

            Log(shipID, request);
            Hangar dock;
            bool   accepted = false;

            switch (request)
            {
            case "DOCK":
                Echo(string.Format("DOCK REQUEST RECEIVED FROM SHIP: {0}", shipID.ToString("X")));
                dock = GetAvailableDock();

                if (dock != null)
                {
                    dock.RunProgram("DOCK");
                    accepted = true;
                }
                TransmitMessage(requestSource, shipID, dock, "DOCK", accepted);
                break;

            case "UNDOCK":
                Echo(string.Format("UNDOCK REQUEST RECEIVED FROM SHIP: {0}", shipID.ToString("X")));
                dock = GetDockOfShip(shipID);

                if (dock != null)
                {
                    dock.RunProgram("UNDOCK");
                    accepted = true;
                }
                TransmitMessage(requestSource, shipID, dock, "UNDOCK", accepted);
                break;

            default:
                return;
            }
        }
示例#16
0
 public void Main(string argument, UpdateType updateSource)
 {
     Echo(updateSource.ToString() + " arg:" + argument);
     if ((updateSource & UpdateType.IGC) > 0)
     {
         if (listener.HasPendingMessage)
         {
             MyIGCMessage message = listener.AcceptMessage();
             if (message.Data is string)
             {
                 Echo(message.Data.ToString());
             }
         }
     }
 }
    private static IEnumerator ConnectToServer(UpdateType type, Money field, int value = 0)
    {
        WWWForm form = new WWWForm();

        form.AddField("dbname", dbname);
        form.AddField("table", table);
        form.AddField("uid", uid);
        form.AddField("field", field.moneyType.ToString());
        form.AddField("type", type.ToString());
        form.AddField("value", value);

        using (UnityWebRequest www = UnityWebRequest.Post(URL_SaveLoadManagerPHP, form))
        {
            yield return(www.SendWebRequest());

            if (www.isNetworkError || www.isHttpError)
            {
                Debug.Log("ERROR: " + www.error);
            }
            else
            {
                if (type == UpdateType.Load)
                {
                    if (www.downloadHandler.text != "")
                    {
                        //Debug.Log(www.downloadHandler.text);
                        foreach (var item in MoneyManager.money)
                        {
                            if (item.moneyType == field.moneyType)
                            {
                                value      = Convert.ToInt32(www.downloadHandler.text);
                                item.Value = value;
                                //slm.StartCoroutine(ConnectToServer(UpdateType.Save, field, value));
                            }
                        }
                    }
                    else
                    {
                        //Debug.Log("NULL");
                    }
                }
                else
                {
                    //Debug.Log(www.downloadHandler.text);
                }
            }
        }
    }
示例#18
0
        public void Main(string argument, UpdateType updateSource)
        {
            // Calculate and Output for informational purposes
            _runcount++;
            Echo(_runcount.ToString() + ":" + updateSource.ToString());

            if (
                (updateSource & (UpdateType.Trigger | UpdateType.Terminal)) > 0 || // run by a terminal action
                (updateSource & (UpdateType.Mod)) > 0 || // script run by a mod
                (updateSource & (UpdateType.Script)) > 0 // this pb run by another script (PB)
                )
            {                                            // script was run because of an action
                if (argument != "")
                {
                    // if we are given an argument, send it out over our broadcast channel
                    IGC.SendBroadcastMessage(_broadCastTag, argument);
                    Echo("Sending message:\n" + argument);
                }
            }

            if ((updateSource & UpdateType.IGC) > 0)
            { // script was run because of incoming IGC message
                while (_myBroadcastListener.HasPendingMessage)
                {
                    MyIGCMessage myIGCMessage = _myBroadcastListener.AcceptMessage();
                    if (myIGCMessage.Tag == _broadCastTag)
                    { // This is our tag
                        if (myIGCMessage.Data is string)
                        {
                            string str = myIGCMessage.Data.ToString();
                            Echo("Received IGC Public Message");
                            Echo("Tag=" + myIGCMessage.Tag);
                            Echo("Data=" + myIGCMessage.Data.ToString());
                            Echo("Source=" + myIGCMessage.Source.ToString("X"));
                        }
                        else // if(msg.Data is XXX)
                        {
                            // handle other data types here...
                        }
                    }
                    else
                    {
                        // handle other tags here
                    }
                }
            }
        }
示例#19
0
 public void Main(string argument, UpdateType updateSource)
 {
     Echo(updateSource.ToString() + " arg:" + argument);
     if ((updateSource & UpdateType.IGC) > 0)
     {
         if (listener.HasPendingMessage)
         {
             MyIGCMessage message = listener.AcceptMessage();
             if (message.Data is string)
             {
                 Echo(message.Data.ToString());
                 // отправляем ответное сообщение
                 IGC.SendUnicastMessage <string>(message.Source, TAG, "result message");
             }
         }
     }
 }
示例#20
0
    // 取文件路径
    static public string GetResPath(UpdateType ut, string rn, string suf = "")
    {
        string resPath;
        var    rns = rn.Split(new char[] { '/', '\\' });
        var    rrn = rns[rns.Length - 1];

        CommonStringBuilder.Append(EZFunTools.CachePath, true);
        CommonStringBuilder.Append("/", false);
        CommonStringBuilder.Append(ut.ToString(), false);
        CommonStringBuilder.Append("/", false);
        CommonStringBuilder.Append(rrn, false);
        CommonStringBuilder.Append(".", false);
        CommonStringBuilder.Append(suf.Equals("") ? X2UpdateSys.UpdateFileSuffix[(int)ut] : suf, false);
        var ap = CommonStringBuilder.GetString();

        if (File.Exists(ap))
        {
            Debug.LogWarning("get res path:" + ap);
            resPath = ap;
        }
        else
        {
            if (ut == UpdateType.DLL)
            {
                CommonStringBuilder.Append(EZFunTools.StreamPath, true);
                CommonStringBuilder.Append(Path.DirectorySeparatorChar, false);
                CommonStringBuilder.Append(rrn, false);
                CommonStringBuilder.Append(".", false);
                CommonStringBuilder.Append(X2UpdateSys.UpdateFileSuffix[(int)ut], false);
                resPath = CommonStringBuilder.GetString();
            }
            else if (ut == UpdateType.MapFile)
            {
                string mapFilePath = EZFunTools.StreamPath + "/MapFile/";
                resPath = mapFilePath + rn + ".mapFile";
            }
            else
            {
                Debug.Log("get res path:" + rn);
                resPath = rn;
            }
        }
        //        Debug.LogError("load res " + resPath);
        return(resPath);
    }
示例#21
0
        public string GetBasicAPICall(string endpoint, UpdateType type, string httpBody = "")
        {
            DisableCertificateSecurity();

            //Create URL to REST endpoint for tickets
            string url = Path.Combine(_currentConn.BaseUrl + _repositoryAPIPortAndAddress + endpoint);

            //Create the HTTP Request and add required headers and content in Xrfkey
            string         Xrfkey  = "0123456789xbcdef";
            HttpWebRequest Request = (HttpWebRequest)WebRequest.Create(url + "?xrfkey=" + Xrfkey);

            // Add the method to authentication the user
            Request.ClientCertificates.Add(_currentConn.Cert);
            Request.Method = type.ToString();
            Request.Accept = "application/json";
            Request.Headers.Add("X-Qlik-Xrfkey", Xrfkey);
            Request.Headers.Add("X-Qlik-User", "UserDirectory=INTERNAL; UserId=SA_ENGINE");



            if (!string.IsNullOrEmpty(httpBody))
            {
                ASCIIEncoding encoder = new ASCIIEncoding();
                byte[]        data    = encoder.GetBytes(httpBody);
                encoder = null;

                Request.ContentType   = "application/json";
                Request.Expect        = "application/json";
                Request.ContentLength = data.Length;

                Request.GetRequestStream().Write(data, 0, data.Length);
            }

            // make the web request and return the content
            HttpWebResponse Response = Response = (HttpWebResponse)Request.GetResponse();

            Stream Stream = Response.GetResponseStream();
            string json   = new StreamReader(Stream).ReadToEnd();

            var jsonObj = JsonConvert.DeserializeObject(json);

            return(JsonConvert.SerializeObject(jsonObj, Formatting.Indented));
        }
示例#22
0
        public static string CheckFileHasDownloaded(UpdateType ut, int curversion)
        {
            MySqlParameter[] param = new MySqlParameter[2];

            param[0] = new MySqlParameter("_updDescription", ut.ToString());
            param[1] = new MySqlParameter("_curVersion", curversion);


            DbAccessLayer.MySqlDbAccess db = new DbAccessLayer.MySqlDbAccess(ConnectionString(), DbAccessLayer.ConnectionStringSourceType.MySetting);

            //db.ExecuteProcedure("stpDad_updateHasDownloadedBefore", param);
            string result = db.GetScalarFromProcedure("stpDad_updateHasDownloadedBefore", param).ToString();

            if (db.HasError)
            {
                throw db.ErrorException;
            }

            return(result);
        }
        public void Main(string argument, UpdateType updateSource)
        {
            Echo("updateSource:" + updateSource.ToString());
            Echo("argument:" + argument);
            if (pb != null && lcd != null)
            {
                if ((updateSource & UpdateType.Trigger) > 0)
                {
                    // выполнение из кнопки
                    if (CMD_START.Equals(argument))
                    {
                        Runtime.UpdateFrequency = UpdateFrequency.Update100; // каждые 10 тиков
                        counter = 0;
                    }
                    else if (CMD_STOP.Equals(argument))
                    {
                        Runtime.UpdateFrequency = UpdateFrequency.None;
                        Echo("status STOPPED");
                    }
                }
                else
                {
                    // выполнение из терминала
                    lcd.WriteText("count: " + counter);
                    counter++;

                    if ((updateSource & UpdateType.Terminal) > 0)
                    {
                        Echo("status TERMINAL");
                    }
                    else
                    {
                        Echo("status WORKING");
                    }
                }
            }
            else
            {
                Echo("status ERROR");
            }
        }
        public void Main(string argument, UpdateType updateSource)
        {
            Echo(string.Format("UPDATE CALLED FROM: {0}", updateSource.ToString()));
            if (argument == "DOCK_MESSAGE")
            {
                //script ran by anntenna receiving broadcast, with matching ID ensuring the broadcast is for this ship

                bool isAccepted = true;

                MyIGCMessage message = listener.AcceptMessage();
                Echo("RECEIVED FOLLOWING TRANSMISSION: " + message.Data.ToString());
                Dictionary <string, object> messageData = DecodeMessage((string)message.Data);
                Echo(string.Format("Is Accepted: {0}", messageData["accepted"].ToString()));
                isAccepted = (bool)messageData["accepted"];
                SetPanel(messageData["action"].ToString(), isAccepted, messageData["message"].ToString());

                return;
            }

            Echo("REQUESTING " + argument);
            SendMessage(argument);
        }
示例#25
0
        public void Main(string argument, UpdateType updateSource)
        {
            Me.GetSurface(0).WriteText(string.Join("\n",
                                                   new Random().NextDouble().ToString(),
                                                   updateSource.ToString(),
                                                   argument
                                                   ));

            switch (updateSource)
            {
            case UpdateType.IGC:
                HandleMessage(); break;

            case UpdateType.Terminal:
            case UpdateType.Trigger:
                switch (argument)
                {
                case "init":
                    Initalize(); break;
                }
                break;
            }
        }
示例#26
0
 public void WriteToXml(XmlTextWriter xml)
 {
     xml.WriteStartElement("controller");
     xml.WriteAttributeString("name", Name);
     xml.WriteAttributeString("index", Index.ToString());
     xml.WriteAttributeString("id", Id.ToString());
     xml.WriteAttributeString("alias", Alias);
     xml.WriteAttributeString("update", UpdateType.ToString());
     xml.WriteAttributeString("updateInterval", ReadingStateInterval.ToString());
     xml.WriteStartElement("buttons");
     if (Variables != null)
     {
         // posortowanie zmiennych
         Array.Sort(Variables);
         foreach (InputVariable iv in Variables)
         {
             if (iv.InputType == InputType.Button || iv.InputType == InputType.HATSwitch)
             {
                 iv.WriteToXml(xml);
             }
         }
     }
     xml.WriteEndElement();
     xml.WriteStartElement("axes");
     if (Variables != null)
     {
         foreach (InputVariable iv in Variables)
         {
             if (iv.InputType == InputType.Axis)
             {
                 iv.WriteToXml(xml);
             }
         }
     }
     xml.WriteEndElement();
     xml.WriteEndElement();
 }
示例#27
0
        public void Main(string argumentText, UpdateType updateSource)
        {
            Echo(new Random().NextDouble().ToString());
            Echo(updateSource.ToString());
            Echo(argumentText);

            if (updateSource.HasFlag(UpdateType.Update10))
            {
                Tick();
            }
            if (updateSource.HasFlag(UpdateType.Update100))
            {
                Tick100();
            }
            if (updateSource.HasFlag(UpdateType.IGC))
            {
                IGCTick();
            }

            var arguments = argumentText.Split(' ');

            if (arguments.Length < 1)
            {
                return;
            }
            switch (arguments[0])
            {
            case "init":
                Initalize(); break;

            case "save":
                Save(); break;

            case "command":
                commander.HandleCommands(arguments.Skip(1).ToArray()); break;
            }
        }
示例#28
0
        public static bool IsNewVersionAccesible(UpdateType versionType, int curversion, String connection)
        {
            MySqlParameter[] param = new MySqlParameter[2];

            param[0] = new MySqlParameter("_updVersion", curversion);

            param[1] = new MySqlParameter("_updDescription", versionType.ToString());

            DbAccessLayer.MySqlDbAccess db = new MySqlDbAccess(connection, ConnectionStringSourceType.MySetting);

            long version = (long)db.GetScalarFromProcedure("stpDad_updateUtiIsExistNewVer", param);

            if (db.HasError)
            {
                throw db.ErrorException;
            }

            if (version > 0)
            {
                return(true);
            }

            return(false);
        }
示例#29
0
        int runcount = 0; // used to show running multiple times

        public void Main(string argument, UpdateType updateSource)
        {
            // Echo some information aboue 'me' and why we were run
            Echo(updateSource.ToString());
            Echo("Me=" + Me.EntityId.ToString());
            Echo(Me.CubeGrid.CustomName);
            runcount++;
            Echo("Runs=" + runcount.ToString());

            // if there is a message pending, process it
            if (_bListener.HasPendingMessage || _uListener.HasPendingMessage)
            {
                if (!HandleMessages())
                {
                    return;
                }
            }
            else
            {
                // if we were run when there's not a pending message, send out a broadcast message
                Echo("Sending Broadcast Message");
                IGC.SendBroadcastMessage <string>(BroadcastTag, "Me=" + Me.EntityId.ToString() + ":" + Me.CubeGrid.CustomName + "\n" + argument, TransmissionDistance.AntennaRelay);
            }
        }
示例#30
0
 private void SendUpdateClientStatusResponse(Guid clientID, UpdateType type, string response)
 {
     ServiceResponse serviceResponse = new ServiceResponse();
     serviceResponse.Type = "UPDATECLIENTSTATUS-" + type.ToString().ToUpper();
     serviceResponse.Message = response;
     SendResponse(clientID, serviceResponse);
 }
示例#31
0
 public UpdateTypeButton(UpdateType updateType)
 {
     UpdateType     = updateType;
     UpdateTypeName = UpdateType.ToString();
 }
示例#32
0
        private void SendUpdateClientStatusResponse(Guid clientID, UpdateType type, string responseMessage, bool telnetMessage = false)
        {
            if (string.IsNullOrEmpty(responseMessage) || (clientID == m_remoteCommandClientID && !telnetMessage))
                return;

            ServiceResponse response = new ServiceResponse();
            response.Type = "UPDATECLIENTSTATUS-" + type.ToString().ToUpper();
            response.Message = CurtailMessageLength(responseMessage);
            SendResponse(clientID, response);

            OnUpdatedStatus(clientID, response.Message, type);
        }