public void SendMessage(CMD message) { _lastMessage = DateTime.Now; string cmd = Program._commands[(int)CMD.StartBit] + _addr + Program._commands[(int)message]; Program.commandqueue.Push(cmd); //_alarm = false; if (message == CMD.Open || message == CMD.Close) _alarm = false; }
public TEVStage(ColorEnv colEnv, AlphaEnv alphaEnv, CMD cmd, TevKColorSel kc, TevKAlphaSel ka, TexMapID id, TexCoordID coord, ColorSelChan col, bool useTex) { _colorEnv = colEnv; _alphaEnv = alphaEnv; _cmd = cmd; _kcSel = kc; _kaSel = ka; _texMapID = id; _texCoord = coord; _colorChan = col; _texEnabled = useTex; }
public void Dispose() { cmd = null; }
public static byte[] runCMDCommand(Command command) { return(Util.Conversion.stringToBytes(CMD.executeCommand(Util.Conversion.bytesToString(command.data)))); }
public void AddCommand(string cmd, CMD callback) { TaskQueue.QeueAsync(_threadName, () => { if (!CommandExists(cmd.ToLower())) { Commands.Add(cmd.ToLower(), callback); } }); }
public void Dispose() { cmd = null; db = null; bl = null; }
/// <summary> /// 获取随机区数据 /// </summary> public void SendGetRData() { if (IsOpen) { sp.Write(GetByteFormatR(), 0, 128 + 5); command = CMD.Read; //System.Diagnostics.Debug.WriteLine(DateTime.Now.ToLongTimeString() + ":" + Encoding.ASCII.GetString(GetByteFormat(k))); } }
/* ------------------------------------------------------------------------------------- * Name: ConvertOneOpsToCmdi * Goal: Create a .cmdi file with metadata for the indicated input file * Note: the .cmdi file will be placed in the same directory as FileIn * Parameters: sFileIn - File to be processed * bForce - Create result, even though it exists already * bIsDebug - Debugging mode on or off * History: * 1/feb/2016 ERK Created ------------------------------------------------------------------------------------- */ public bool ConvertOneOpsToCmdi(String sFileIn, ref osrMovie objMovie, bool bForce, bool bIsDebug) { try { // Validate if (!File.Exists(sFileIn)) return false; // Check if this is a symbolic link if (File.GetAttributes(sFileIn).HasFlag(FileAttributes.ReparsePoint) || !util.General.CanReadFile(sFileIn)) { // The input file is a symbolic link --> skip it, because it should already have been done return true; } // Get the output directory String sDirOut = Path.GetDirectoryName(sFileIn); // Determine file names String sFileInXml = sFileIn.Replace(".gz", ""); String sFileCmdi = sFileIn.Replace(".folia.xml.gz", ".cmdi.xml"); // Do we need to continue? if (!bForce && File.Exists(sFileCmdi)) { errHandle.Status("OpsToCmdi skips: " + sFileInXml); return true; } // Decompress input .gz file if (!util.General.DecompressFile(sFileIn, sFileInXml)) return false; // Read the input file's header as xml conv.XmlConv oConv = new conv.XmlConv(this.errHandle); XmlNode ndxHeader = null; XmlNamespaceManager nsFolia = null; if (!oConv.getFoliaHeader(sFileInXml, ref ndxHeader, ref nsFolia)) return false; if (ndxHeader != null) { // Get the subtitle id and the idmovie String sIdSubtitle = ndxHeader.SelectSingleNode("./child::f:meta[@id = 'idsubtitle']", nsFolia).InnerText; String sIdMovie = ndxHeader.SelectSingleNode("./child::f:meta[@id = 'idmovie']", nsFolia).InnerText; // Check if we already have information from this idmovie XmlNodeList ndxList = null; XmlNode ndxMovie = null; if (objMovie.getInformation(sIdMovie, ref ndxList, ref ndxMovie)) { bool bHaveInfo = false; XmlNode ndxSubtitle = null; // Walk the list to get the correct subtitle production for this movie for (int i=0;i<ndxList.Count;i++) { // Access this <subtitle> object XmlNode ndxSubThis = ndxList[i].SelectSingleNode("./child::IDSubtitle"); // Got any results? if (ndxSubThis != null) { // Is this the correct one? if (ndxSubThis.InnerText == sIdSubtitle) { // We have the correct one ndxSubtitle = ndxList[i]; // Mark this bHaveInfo = true; // Escape the for-loop break; } } } // ============= DEBUGGING === if (!bHaveInfo && sIdMovie == "36797") { int iDebug = 1; } // Validate if (bHaveInfo) { if (sIdMovie == "36797") { int iDebug = 1; } // Get the information we need String sUserId = oTools.getXmlChildValue(ref ndxSubtitle, "UserID"); String sUserNickName = oTools.getXmlChildValue(ref ndxSubtitle, "UserNickName"); String sUserClass = oTools.getXmlChildValue(ref ndxSubtitle, "UserClass"); String sMovieName = oTools.getXmlChildValue(ref ndxSubtitle, "MovieName"); String sMovieYear = oTools.getXmlChildValue(ref ndxSubtitle, "MovieYear"); String sMovieImdbId = oTools.getXmlChildValue(ref ndxSubtitle, "MovieImdbID"); String sMovieReleaseName = oTools.getXmlChildValue(ref ndxSubtitle, "MovieReleaseName"); String sLanguageName = oTools.getXmlChildValue(ref ndxSubtitle, "LanguageName"); String sSubDate = oTools.getXmlChildValue(ref ndxSubtitle, "SubDate"); String sSeriesSeason = oTools.getXmlChildValue(ref ndxSubtitle, "SeriesSeason"); String sSeriesEpisode = oTools.getXmlChildValue(ref ndxSubtitle, "SeriesEpisode"); String sSeriesImdbParent = oTools.getXmlChildValue(ref ndxSubtitle, "SeriesIMDBParent"); String sMovieKind = oTools.getXmlChildValue(ref ndxSubtitle, "MovieKind"); String sSubTranslator = oTools.getXmlChildValue(ref ndxSubtitle, "SubTranslator"); String sSubLanguage = oTools.getXmlChildValue(ref ndxSubtitle, "ISO639"); // Additional information from the MOVIE String sSeriesName = oTools.getXmlChildValue(ref ndxMovie, "SeriesName"); String sSeriesRootName = oTools.getXmlChildValue(ref ndxMovie, "SeriesRootName"); String sEpisodeName = oTools.getXmlChildValue(ref ndxMovie, "EpisodeName"); String sMoviePlot = oTools.getXmlChildValue(ref ndxMovie, "MoviePlot"); XmlNode ndxAKA = ndxMovie.SelectSingleNode("./descendant::MovieAKA"); // Possibly get information from other places if (sMovieYear == "") sMovieYear = oTools.getXmlChildValue(ref ndxMovie, "MovieYear"); if (sMovieKind == "") sMovieKind = oTools.getXmlChildValue(ref ndxMovie, "MovieKind"); if (sSeriesSeason == "") sSeriesSeason = oTools.getXmlChildValue(ref ndxMovie, "SeriesSeason"); if (sSeriesEpisode == "") sSeriesEpisode = oTools.getXmlChildValue(ref ndxMovie, "SeriesEpisode"); // Progress errHandle.Status("Processing movie " + sIdMovie + " subtitle " + sIdSubtitle); // Create the .cmdi information var oSubtiel = new CMD(); // Add header oSubtiel.Header = new CMDHeader(); oSubtiel.Resources = new CMDResources(); oSubtiel.Resources.JournalFileProxyList = new CMDResourcesJournalFileProxyList(); oSubtiel.Resources.ResourceProxyList = new CMDResourcesResourceProxyList(); oSubtiel.Resources.ResourceRelationList = new CMDResourcesResourceRelationList(); // Access the main component oSubtiel.Components = new CMDComponents(); // Add header oSubtiel.Components.SUBTIEL = new CMDComponentsSUBTIEL(); CMDComponentsSUBTIEL oSubt = oSubtiel.Components.SUBTIEL; // (2) add the information above to the correct parts // (2a) Populate the MOVIE part oSubtiel.Components.SUBTIEL.Movie = new CMDComponentsSUBTIELMovie(); oSubt.Movie.MovieId = sIdMovie; oSubt.Movie.Name = sMovieName; oSubt.Movie.Year = sMovieYear; oSubt.Movie.ImdbId = sMovieImdbId; oSubt.Movie.Kind = sMovieKind; oSubt.Movie.Plot = sMoviePlot; // (2a') add one or more alternative name parts oSubtiel.Components.SUBTIEL.Movie.AltNameList = new CMDComponentsSUBTIELMovieAltNameList(); if (ndxAKA != null) { // Find alternative names List<String> lstAlt = new List<string>(); while (ndxAKA != null) { lstAlt.Add(ndxAKA.InnerText); // Find next name ndxAKA = ndxAKA.SelectSingleNode("./following-sibling::MovieAKA"); } // Add this list of names oSubt.Movie.AltNameList.AltName = lstAlt.ToArray(); } // (2b) Should we add a Series part? if (sSeriesSeason != "" || sSeriesEpisode != "" || sSeriesImdbParent != "") { // Add a Series part oSubtiel.Components.SUBTIEL.Movie.Series = new CMDComponentsSUBTIELMovieSeries(); oSubt.Movie.Series.Name = sSeriesName; oSubt.Movie.Series.RootName = sSeriesRootName; oSubt.Movie.Series.Season = new CMDComponentsSUBTIELMovieSeriesSeason(); oSubt.Movie.Series.Season.Value = sSeriesSeason; oSubt.Movie.Series.Season.Name = ""; oSubt.Movie.Series.Episode = new CMDComponentsSUBTIELMovieSeriesEpisode(); oSubt.Movie.Series.Episode.Value = sSeriesEpisode; oSubt.Movie.Series.Episode.Name = sEpisodeName; oSubt.Movie.Series.ParentImdbId = sSeriesImdbParent; } // (2c) Add a Release part oSubtiel.Components.SUBTIEL.Release = new CMDComponentsSUBTIELRelease(); oSubt.Release.Name = sMovieReleaseName; oSubt.Release.countryCode = ""; // To be filled in later // (2d) Build the Subtitle part oSubtiel.Components.SUBTIEL.Subtitle = new CMDComponentsSUBTIELSubtitle(); oSubt.Subtitle.SubtitleId = sIdSubtitle; oSubt.Subtitle.languageCode = sSubLanguage; oSubt.Subtitle.targetCountry = ""; // To be determined later oSubt.Subtitle.Date = sSubDate; oSubt.Subtitle.textHash = ""; // similarity hash // (2e) Create a licence part oSubtiel.Components.SUBTIEL.Subtitle.License = new CMDComponentsSUBTIELSubtitleLicense(); oSubt.Subtitle.License.LicenseCode = ""; // To be determined oSubt.Subtitle.License.LicenseDate = ""; // To be determined oSubt.Subtitle.License.LicenseDetails = sSubTranslator; String sSubLicense = (sSubTranslator == "") ? "" : "subtranslator"; oSubt.Subtitle.License.LicenseType = sSubLicense; // (2f) Create a Subtitler/Author part oSubtiel.Components.SUBTIEL.Subtitle.Author = new CMDComponentsSUBTIELSubtitleAuthor(); oSubt.Subtitle.Author.Age = ""; oSubt.Subtitle.Author.Pseudonym = sUserNickName; oSubt.Subtitle.Author.Name = ""; oSubt.Subtitle.Author.UserClass = sUserClass; oSubt.Subtitle.Author.UserID = sUserId; // (2g) Create a residence place for the author oSubtiel.Components.SUBTIEL.Subtitle.Author.ResidencePlace = new CMDComponentsSUBTIELSubtitleAuthorResidencePlace(); oSubt.Subtitle.Author.ResidencePlace.countryCode = ""; oSubt.Subtitle.Author.ResidencePlace.Town = ""; // TODO: calculate hash and statistics... oSubtiel.Components.SUBTIEL.Subtitle.Statistics = new CMDComponentsSUBTIELSubtitleStatistics(); oSubt.Subtitle.Statistics.nSentences = 0; oSubt.Subtitle.Statistics.nWords = 0; oSubtiel.Components.SUBTIEL.Subtitle.StatusInfo = new CMDComponentsSUBTIELSubtitleStatusInfo(); oSubt.Subtitle.StatusInfo.link = "none"; // Serialize into output var serializer = new System.Xml.Serialization.XmlSerializer(typeof(CMD)); using (var stream = new StreamWriter(sFileCmdi)) serializer.Serialize(stream, oSubtiel); } else { errHandle.Status("OpsToCmdi no information for: " + sFileInXml); } } } // Remove the xml file again File.Delete(sFileInXml); return true; } catch (Exception ex) { errHandle.DoError("oprConv/ConvertOneOpsToCmdi", ex); return false; } }
private void b4_ValueChanged(object sender, EventArgs e) { t4.Text = Profile.var_cg_fovScale.ToString(); Profile.var_cg_fovScale = SliderOut2(b4.Value); CMD.ReadWrite(Profile.cg_fovScale, Profile.var_cg_fovScale); }
public void Reset(CMD cmd) { Data.Clear(); Data.AddField("cmd", (int)cmd); }
private void TelnetCmd(CMD cmd, byte option) { byte[] data = {(byte)CMD.IAC, (byte)cmd, option}; stream.Write(data, 0, data.Length); }
public void SendPublicData(CMD command) { Program.commandqueue.Push(Program._commands[(int)CMD.StartBit] + Program.publicAddress + Program._commands[(int)command]); }
private void sp_DataReceived(object sender, System.IO.Ports.SerialDataReceivedEventArgs e) { int n = sp.BytesToRead; byte[] buf = new byte[n]; received_count += n;//增加接收计数 if (n <= 0) return; sp.Read(buf, 0, n);//读取缓冲数据 /////////////////////////////////////////////////////////// StringBuilder builder = new StringBuilder(); //this.Invoke((EventHandler)(delegate builder.Append(Encoding.ASCII.GetString(buf)); //System.Diagnostics.Debug.WriteLine(DateTime.Now.ToLongTimeString() + ":" + builder.ToString()); //if(command == CMD.Write) // System.Diagnostics.Debug.WriteLine(DateTime.Now.ToLongTimeString() + " write :" + builder.ToString()); //else System.Diagnostics.Debug.WriteLine(DateTime.Now.ToLongTimeString() + " read :" + builder.ToString()); //if(buf[0]!=(byte) Header.C_pad) // System.Diagnostics.Debug.WriteLine(DateTime.Now.ToLongTimeString() + " read :" + builder.ToString()); ////////////////////////////////////////////////// switch (buf[0]) //if (builder.ToString() == "C") { case (byte)Header.C_pad://可以发送指令 //tsLabel.Text = "Connect Ready!"; if (command == CMD.Write && !bControl && bWaitC) { if(LW.Count>0) SendWriteData(); return; } if (command == CMD.NULL && xHs !=null && bControl) { if (xHs.Count > 0) { System.Threading.Thread th = new System.Threading.Thread(new System.Threading.ThreadStart(WriteRFIDData)); th.Start(); return; } } if (!bControl) { if (StateChange != null) { StateChange((int)State.CanSendControl); } } bControl = true; break; case (byte)Header.EOT://数据发送完毕 if (thread_C != null) thread_C.Abort(); SendControl(CovertControl((byte)Header.ACK)); if (bInRecieveData) { if (StateChange != null) { StateChange((int)State.RecDataEnd); command = CMD.NULL; } } bInRecieveData = false; if (cArrBuf.Count > 0) { System.Threading.Thread th = new System.Threading.Thread(new System.Threading.ThreadStart(ThreadDoData)); th.Start(); } break; case (byte)Header.NAK://重发 //tsLabel.Text = "ReSend!"; bControl = false; break; case (byte)Header.CAN://严重错误,等待c //tsLabel.Text = "Error!"; bControl = false; break; case (byte)Header.SOH: if (thread_C != null) thread_C.Abort(); bControl = false; //add 解析代码 if(!bInRecieveData) { if (StateChange != null) { StateChange((int)State.InRecData); } } bInRecieveData = true; if (SOHData(buf)) { SendControl(CovertControl((byte)Header.ACK)); } else { SendControl(CovertControl((byte)Header.NAK)); } /////////////////// break; case (byte)Nti.XModem.Header.ACK://ok switch (command) { case CMD.Read: { if (bSendGetData) { if (!bControl) { if (StateChange != null) { StateChange((int)State.WaitData); } } bControl = false; SendControl(CovertControl((byte)Header.EOT)); //System.Diagnostics.Debug.WriteLine(DateTime.Now.ToLongTimeString() + ":" + Encoding.ASCII.GetString(wb)); bSendGetData = false; } else { if (!bInRecieveData) { thread_C = new Thread(new ThreadStart(th_SendCPAD)); thread_C.Start(); } } } break; case CMD.Write: { if (LW.Count == 0) { SendControl(CovertControl((byte)Header.EOT)); command = CMD.NULL; bWaitC = false; } else { if (!bWaitC) { SendControl(CovertControl((byte)Header.EOT)); bWaitC = true; } } break; } case CMD.Update: case CMD.NULL: default: break; } break; default://直接按ASCII规则转换成字符串 //builder.Append(Encoding.ASCII.GetString(buf)); //追加的形式添加到文本框末端,并滚动到最后。 //textBox2.AppendText(builder.ToString()); break; } //修改接收计数 //labelGetCount.Text = "Get:" + received_count.ToString(); }
/// <summary> /// /// </summary> /// <param name="hs"> dt.Columns.Add("id"); //dt.Columns.Add("Zero"); //dt.Columns.Add("RFIDID"); //dt.Columns.Add("RFIDNO"); ///////////////////dt.Columns.Add("CheckDate"); //dt.Columns.Add("Birth");</param> /// <returns></returns> public void WriteRFIDData() { //throw new NotImplementedException(); foreach (DictionaryEntry de in xHs)//获取同一个分区中的数据 { //数据拆分出来,等待写入 //写数据 DataTable dt = (DataTable)de.Value; foreach (DataRow dr in dt.Rows) { if (LW.Count > 0) { if (((WriteData)LW[LW.Count - 1]).State <= 1) { ((WriteData)LW[LW.Count - 1]).Append(dr[0].ToString(), dr[2].ToString(), dr[3].ToString());//, DateTime.Parse(dr[4].ToString()), DateTime.Parse(dr[4].ToString())); continue; } } WriteData wd = new WriteData(); wd.Append(dr[0].ToString(), dr[2].ToString(), dr[3].ToString());//, DateTime.Parse(dr[4].ToString()), DateTime.Parse(dr[4].ToString())); LW.Add(wd); } xHs.Remove(de.Key); //发送指令 byte[] bb = WriteByteFormat(int.Parse(de.Key.ToString()) - 1); sp.Write(bb, 0, 128 + 5); command = CMD.Write; bControl = false; break; } }
public void SendWriteZone(int p) { //throw new NotImplementedException(); testTempWriteData(); byte[] bb = WriteByteFormat(p - 1); sp.Write(bb, 0, 128 + 5); command = CMD.Write; System.Diagnostics.Debug.WriteLine(DateTime.Now+": write "+p.ToString()); }
private void b0_ValueChanged(object sender, EventArgs e) { t0.Text = Profile.var_cg_gun_x.ToString(); Profile.var_cg_gun_x = SliderOut1(b0.Value); CMD.ReadWrite(Profile.cg_gun_x, Profile.var_cg_gun_x); }
private void b2_ValueChanged(object sender, EventArgs e) { t2.Text = Profile.var_cg_gun_z.ToString(); Profile.var_cg_gun_z = SliderOut1(b2.Value); CMD.ReadWrite(Profile.cg_gun_z, Profile.var_cg_gun_z); }
public void SendServer(CMD cmd, params object[] p) { string res = sendCommands.CallCommand(cmdNames[Convert.ToInt32(cmd)], p).ToString(); Send(res); }
public void MakeChoice(CMD choice) { activeNPC.MakeChoice(choice); }
public static string GetCMDString(CMD cmd) { return(cmd.ToString()); }
public static byte SendCommand(HW hw, CMD cmd) { return SendCommand(hw, (byte)cmd); }
public override void Read(BinaryReader br) { base.Read(br); mCMD = (CMD)br.ReadInt32(); }
public FrameKeyboard(CMD cmd, List <KeyCode> keys) { e.cmd_type = (Byte)cmd; this.keys = keys; }
private void comboBox_Cmd_SelectedIndexChanged(object sender, EventArgs e) { selectcmd = (CMD)this.comboBox_Cmd.SelectedIndex; }
public void Listen(CMD cmd, MessageDelegate listener) { listeners[cmd] = listener; }
public static List <string> GetFileInfo(IEnumerable <string> lFileHash, Bit9ReturnValues lBit9ReturnValues) { var lBit9Info = new List <string>(); var oBit9Return = new object[69]; var sAcekDecode = Object_Fido_Configs.GetAsString("fido.detectors.bit9.acek", null); sAcekDecode = Aes_Crypto.DecryptStringAES(sAcekDecode, "1"); var sUserID = Aes_Crypto.DecryptStringAES(Object_Fido_Configs.GetAsString("fido.detectors.bit9.userid", null), sAcekDecode); var sPwd = Aes_Crypto.DecryptStringAES(Object_Fido_Configs.GetAsString("fido.detectors.bit9.pwd", null), sAcekDecode); var sBit9Server = Object_Fido_Configs.GetAsString("fido.detectors.bit9.server", null); var sDb = Object_Fido_Configs.GetAsString("fido.detectors.bit9.db", null); try { //todo: take connection string and encrypt to put in XML config var vConnection = new SqlConnection("user id=" + sUserID + ";password="******";Server=" + sBit9Server + ",1433;Integrated Security=sspi;Database=" + sDb + ";connection timeout=60"); if (lFileHash != null) { //todo: SQL injection. Store query in database and fill variables when retrieving foreach (var CMD in lFileHash.Select(sFileHash => "SELECT * FROM [das].[dbo].[Fido_FileInstanceInfo] WHERE MD5 = '" + sFileHash + "'").Select(sQuery => new SqlCommand(sQuery, vConnection))) { CMD.CommandType = CommandType.Text; vConnection.Open(); using (var objReader = CMD.ExecuteReader()) { if (objReader.HasRows) { while (objReader.Read()) { var quant = objReader.GetSqlValues(oBit9Return); if (!oBit9Return.Any()) { continue; } lBit9Info.AddRange(oBit9Return.Select(item => item.ToString())); } } } vConnection.Close(); } } else if (lBit9ReturnValues != null) { //todo: SQL injection. Store query in database and fill values when retrieving var sQuery = "SELECT * FROM [das].[dbo].[Fido_FileInstanceInfo] WHERE FILE_NAME = '" + lBit9ReturnValues.FileName.ToLower() + "' AND Path_Name = '" + lBit9ReturnValues.FilePath.ToLower() + "' AND Computer_Name = '" + lBit9ReturnValues.HostName + "'"; var CMD = new SqlCommand(sQuery, vConnection) { CommandType = CommandType.Text }; vConnection.Open(); using (var objReader = CMD.ExecuteReader()) { if (objReader.HasRows) { while (objReader.Read()) { var quant = objReader.GetSqlValues(oBit9Return); if (!oBit9Return.Any()) { continue; } lBit9Info.AddRange(oBit9Return.Select(item => item.ToString())); } } } vConnection.Close(); } //if no count then no hash information exists if (lBit9Info.Count != 0) { } } catch (Exception e) { Fido_EventHandler.SendEmail("Fido Error", "Fido Failed: {0} Exception caught retrieving file information from Bit9:" + e); } return(lBit9Info); }
/// <summary> /// display record state /// </summary> public void DisplayStateOfRecord() { CMD.ShowApplicationMessageToUser($"record state : {RecordQueries.GetRecordState()}"); }
/// <summary> /// Parses Command line arguments into a Structure /// </summary> /// <param name="args">Arguments</param> /// <returns>Structure</returns> private static CMD ParseArgs(string[] args) { const APak.CompressionType INVALID = (APak.CompressionType) 255; var Ret = new CMD(); Ret.Compression = INVALID; Ret.Valid = true; foreach (var A in args) { switch (A.ToLower()) { case "/ca": if (Ret.Compression == INVALID) { Ret.Compression = APak.CompressionType.AllCompressionGZip; } else { Console.Error.WriteLine("Unable to process '/CA'. Compression type already specified"); Ret.Valid = false; } break; case "/cn": if (Ret.Compression == INVALID) { Ret.Compression = APak.CompressionType.NoCompression; } else { Console.Error.WriteLine("Unable to process '/CN'. Compression type already specified"); Ret.Valid = false; } break; case "/ci": if (Ret.Compression == INVALID) { Ret.Compression = APak.CompressionType.IndividualCompression; } else { Console.Error.WriteLine("Unable to process '/CI'. Compression type already specified"); Ret.Valid = false; } break; default: if (Ret.Source == null) { Ret.Source = A; } else if (Ret.Destination == null) { Ret.Destination = A; } else { Console.Error.WriteLine("Too many arguments when parsing {0}.", A); Ret.Valid = false; } break; } } if (Ret.Valid) { //Apply default if needed if (Ret.Compression == INVALID) { Ret.Compression = APak.CompressionType.AllCompressionGZip; } //Make sure that 'in' is specified if (string.IsNullOrWhiteSpace(Ret.Source)) { Console.Error.WriteLine("Parameter 'in' not specified."); Ret.Valid = false; } //Make sure that 'out' is specified else if (string.IsNullOrWhiteSpace(Ret.Destination)) { Console.Error.WriteLine("Parameter 'out' not specified."); Ret.Valid = false; } //Make sure that 'in' exists else if (!File.Exists(Ret.Source) && !Directory.Exists(Ret.Source)) { Console.Error.WriteLine("'in' Parameter is neither existing file nor existing directory"); Ret.Valid = false; } //Make sure that 'out' is not a file if 'in' is else if (File.Exists(Ret.Source)) { if (File.Exists(Ret.Destination)) { Console.Error.WriteLine("'out' can't be a file if 'in' is a file"); Ret.Valid = false; } } } //Print Help Hint on errors if (!Ret.Valid) { Console.Error.WriteLine("Error parsing Command line. Use /? for details"); } return(Ret); }
//•••••••••••••••••••••••••••••••••••••••••••••••••••••••• /// <summary>Accessor for array of commands;</summary> /// <param name="_cmd">Command enumerator;</param> /// <returns>String equivalent to the passed enumerator;</returns> private string the(CMD _cmd) { return(m_sCMD[(int)_cmd]); }
public Packet(CMD _cmd) { cmd = new Command(_cmd); packet_id = PacketManager.Allocate(); }
private void b3_ValueChanged(object sender, EventArgs e) { Profile.var_r_specularMap = b3.Value; CMD.ReadWrite(Profile.r_specularMap, Profile.var_r_specularMap); }
/// <summary> /// Task to loop the injection, also saves changes to XML Profile. /// </summary> /// <param name="Token">Token Cancellation</param> public static async void Init(CancellationToken Token) { while (!Token.IsCancellationRequested) { // Fullbright State if (Profile.var_r_fullbright) { CMD.Write(Profile.post_process, 1); CMD.Write(Profile.lighting, 4); CMD.Write(Profile.fx, 4); } else { CMD.Write(Profile.post_process, 3); CMD.Write(Profile.lighting, 7); CMD.Write(Profile.fx, 5); } // Allow Vision if (Profile.var_r_filmUseTweaks) { Profile.var_r_filmTweakEnable = true; } else { Profile.var_r_filmTweakEnable = false; } // Exec all command using Reflection foreach (string cmd in Profile.Commands) { FieldInfo cmd_a = typeof(Profile).GetField(cmd); FieldInfo cmd_v = typeof(Profile).GetField("var_" + cmd); object obj_a = cmd_a.GetValue(null); object obj_v = cmd_v.GetValue(null); switch (true) { case true when obj_v.GetType() == typeof(bool): CMD.ReadWrite((uint[])obj_a, (bool)obj_v); break; case true when obj_v.GetType() == typeof(float): CMD.ReadWrite((uint[])obj_a, (float)obj_v); break; case true when obj_v.GetType() == typeof(int): CMD.ReadWrite((uint[])obj_a, (int)obj_v); break; case true when obj_v.GetType() == typeof(bool[]): CMD.VectorReadWrite((uint[])obj_a, (bool[])obj_v); break; case true when obj_v.GetType() == typeof(float[]): CMD.VectorReadWrite((uint[])obj_a, (float[])obj_v); break; case true when obj_v.GetType() == typeof(int[]): CMD.VectorReadWrite((uint[])obj_a, (int[])obj_v); break; } } Xml.Save(); await Task.Delay(1000); } }
private void b1_ValueChanged(object sender, EventArgs e) { t1.Text = Profile.var_cg_gun_y.ToString(); Profile.var_cg_gun_y = SliderOut1(b1.Value); CMD.ReadWrite(Profile.cg_gun_y, Profile.var_cg_gun_y); }
// command is between 128 and 255. Integers below 128 correspond to system-reserved values. protected override void OnCustomCommand(int command) { CMD cmd = (CMD)command; int time = 10; if (cmd < CMD.Help) { cmd = (CMD)(command / 10); int val = command % 10; switch (cmd) { case CMD.AddFive: cmd = CMD.AddTime; time = val * 5; break; case CMD.RemoveFive: cmd = CMD.RemoveTime; time = val * 5; break; default: break; } } switch (cmd) { case CMD.Help: string info = string.Join("\r\n", Enum.GetValues(typeof(CMD)).Cast <CMD>().Select(c => $"{c}{new string(' ', 16 - c.ToString().Length)}\t{(int)c}").ToArray()); this.notification.Show("Info", info, 20); break; case CMD.QueryTime: int quota = IsWeekend(DateTime.Now) ? this.weekend : this.weekday; int used = this.usedSeconds / 60; int remaining = Math.Max(0, quota + this.bonus - used); var sb = new StringBuilder(1024); sb.AppendLine($"{DateTime.Now:yyyy-MM-dd}: Allowed:{quota} Bonus:{this.bonus} Used:{used} Remaining:{remaining}"); lock (this.activeTimes) { foreach (var tr in this.activeTimes) { DateTime start = new DateTime(tr.StartTicks, DateTimeKind.Local); DateTime end = new DateTime(tr.EndTicks, DateTimeKind.Local); sb.AppendFormat("{0:HH:mm:ss}-{1:HH:mm:ss} {2}\r\n", start, end, (int)(end - start).TotalMinutes); } } this.notification.Show("Info", sb.ToString(), 0); break; case CMD.AddTime: this.bonus += time; EventLog.WriteEntry(Name, $"Added {time} minutes.", EventLogEntryType.Information); break; case CMD.RemoveTime: this.bonus -= time; EventLog.WriteEntry(Name, $"Removed {time} minutes.", EventLogEntryType.Information); break; case CMD.EnableDebug: case CMD.DisableDebug: this.debug = cmd == CMD.EnableDebug; EventLog.WriteEntry(Name, $"Updated debug to {this.debug}.", EventLogEntryType.Information); break; case CMD.ChangeSession: this.notification.SessionId = (this.notification.SessionId + 1) % 5 + 1; EventLog.WriteEntry(Name, $"Session ID changed to {this.notification.SessionId}.", EventLogEntryType.Information); break; case CMD.SendEmail: this.Email(); break; default: EventLog.WriteEntry(Name, $"Unknown control code:{command}.", EventLogEntryType.Warning); break; } }
private void b3_ValueChanged(object sender, EventArgs e) { t3.Text = Profile.var_cg_fov.ToString(); Profile.var_cg_fov = SliderOut3(b3.Value); CMD.ReadWrite(Profile.cg_fov, Profile.var_cg_fov); }
public NodeScanModule(CMD cmd, ObjectManager objectManager, Skills skills) { CMD = cmd; ObjectManager = objectManager; Skills = skills; }
public ICommand GetCommand(CMD cmd) { return(commands[cmd]); }
public FrameTest(CMD cmd, FP arg1, FP arg2) { e.cmd_type = (Byte)cmd; fp_1 = arg1; fp_2 = arg2; }
private void TelnetCmd(CMD cmd, byte option) { byte[] data = {(byte) CMD.IAC, (byte) cmd, option}; this._RequestData(data); }
public FrameJoystick(CMD cmd, UINT16 typeId, FP angle) { e.cmd_type = (Byte)cmd; OperationType = typeId; Angle = angle; }
public BasicMessage() { _SYNC = sync; _ADR = ADR.BillValidator; _DATA = new List<byte>(); _CMD = CMD.NO_COMMAND; _LNG = 6; _CRC = GetMessageCRC16(null); _MSG = GetFormedMessage(); _MSG_RESPONSE = new List<byte>(); _TEXT_RESPONSE = new List<string>(); _responseType = RESPONSE_TYPE.DATA; _minResponseLength = 6; _maxResponseLength = _minResponseLength; _responseStatusString = string.Empty; }
public FrameUser(CMD cmd, FPVector p) { e.cmd_type = (Byte)cmd; movement = p; }
public void AddCommand(string cmd, CMD callback) { if (!CommandExists (cmd.ToLower())) { Commands.Add(cmd.ToLower(), callback); } }
public FrameMouse(CMD cmd, FPVector p) { e.cmd_type = (Byte)cmd; point = p; }