Dll Version Does Not Match Firmware Version

Dll Version Does Not Match Firmware Version

solutionsville
Joined:
Posts:
25
Location:
Ft Worth




Hi Martin, when I try to embed the WinSCPnet.dll using ILMerge.NuGet, I get the higher up error. I run across in the ILMerge.Tasks.Nuget there is supposed to be a way to exclude files. I am not however seeing anyone posting an example of it using the Nuget Projects within Visual Studio.

There are no Debug or Session logs for this as it errors prior to reaching that piece of the code.

Whatsoever suggestions?

Answer with quote

solutionsville
Joined:
Posts:
25
Location:
Ft Worth




Here is the lawmaking I am using;

At that place are no session or debug logs created. It never gets that far into the code.

using Organisation; using Arrangement.Collections.Concurrent; using System.Data.SqlClient; using System.IO; using Organisation.Threading; using WinSCP;  namespace CnaFirmware {     public enum UpdateState     {         Idle,               // black         Working,            // black         Uploading,          // complete:         CompleteNoError,    // green          // errors:         Aborted,         CompleteWithError   // scarlet     };      public class UploadTask     {         ConcurrentQueue<string> ConsoleQueue;         public string cna_ip;         string fingerprint;         readonly string ImageFileName;         public string CnaVersion;         readonly string TargetVersion;         public string CurrentFileName;         public double CurrentFileProgress;         private static string _lastFileName;         bool abort = false;         Session session;         Thread TaskThread;         readonly string LogFileName;         public string UpdatedFirmwareVersion;         public bool WarningShown;          // this cord is for the user checking status during the update from the UI:         public cord status;          // this condition determines the color of the item in the listing box         public UpdateState state;          // these let the main class to track progress and repaint the item when done         public bool UpdateSuccess;         public bool JobComplete;         public bool NeedUiUpdate;         public bool Verbose;         public bool debug;          // need states so the checkedlistbox knows what colour to paint this.          // this form volition push firmware to one CNA.         // inputs:  IP address of CNA         //          Fingerprint string         //          image file (*.run) to upload         //          queue for sending messages dorsum to main (UI) thread          // condition:  idle         //          transfering         //          load (remote script)         //          complete           // logging: only log start, errors, or success to the UI. everything goes to the log file for this cna.          // update 20180618:  fingerprint is no longer required: WinSCP will scan for fingerprint, then upload firmware.            public UploadTask(string cnaip,                           string fprint,                           ConcurrentQueue<string> q,                           string filename)         {             debug = simulated;             cna_ip = cnaip;             WarningShown = false;             UpdateSuccess = simulated;             fingerprint = fprint;             ConsoleQueue = q;             ImageFileName = filename;             LogFileName = string.Format("{0}\\{ane}.log", Globals.LogPath + @"\CNAip\", cna_ip);              // for checking file transfer progress:             CurrentFileName = string.Empty;             CurrentFileProgress = 0;             condition = "idle";             land = UpdateState.Idle;             JobComplete = false;             NeedUiUpdate = false;             UpdatedFirmwareVersion = "";              // firmware version of target CNA             CnaVersion = "";              // new firmware version to be uploaded             TargetVersion = ExtractCnaVersion(filename);         }          // This is to extract the version of the Firmware file         string ExtractCnaVersion(string filename)         {             // ...CNA15xxvX_X_X.run   ten,16             cord v = "0.0.0";             string f = Path.GetFileName(filename);             int posv = f.IndexOf("v");             int posr = f.IndexOf(".run");             posv++;             try             {                 v = f.Substring(posv, posr - posv);             }             catch (Exception) { }             return v.Replace("_", ".");         }         void _PostStatus(string south)         {             // set status string to what's going on.              ConsoleQueue.Enqueue(cord.Format("!{0}: {ane}", cna_ip, due south));         }          void NewState(UpdateState s)         {             country = southward;             NeedUiUpdate = true;         }          public void SetCnaVersion(byte[] data)         {             // Set Expected CNA version             if (data[0] < 2) return;             string 5 = string.Format("{0}.{1}.{ii}", data[1], data[2], information[iii]);             Log("SetCnaVersion:" + v);             CnaVersion = v;         }          public void Start()         {             // Get-go the Thread             TaskThread = new Thread(() => TaskThreadCode());             TaskThread.Start();         }         void Logui(cord s)         {             // ship to UI             ConsoleQueue.Enqueue(cord.Format("{0}: {1}", cna_ip, s));             // and file it             Log(s);         }         void Log(string s)         {             Directory.CreateDirectory(Globals.LogPath + @"\CNAip");             File.AppendAllText(LogFileName, string.Format("{0} {i}: {ii}{iii}", DateTime.Now.ToString("yyyyMMdd.HHmmss.fff"), cna_ip, s, Environment.NewLine));         }          // Upload Condition and progress         public string GetStatus()         {             string s = "";             if (status == "uploading binary")             {                 s = string.Format("{0}: uploading binary ({1:P0})", cna_ip, CurrentFileProgress);             }             else             {                 s = status;                 southward = string.Format("{0}: {1}", cna_ip, status);             }             render s;         }          public void TaskThreadCode()         {             Logui("Starting update");             NewState(UpdateState.Working);             endeavor             {                 // kickoff become the CNA SSH fingerprint                 SessionOptions sessionOptions = new SessionOptions                 {                     Protocol = Protocol.Scp,                     HostName = cna_ip                 };                  sessionOptions.AddRawSettings("KEX", "ecdh,dh-gex-sha1,dh-group14-sha1,dh-group1-sha1,rsa,WARN");                 //Session session;                 using (session = new Session())                 {                     fingerprint = session.ScanFingerprint(sessionOptions, "MD5");                     Log($"Fingerprint: {fingerprint}");                 }                  // Set up session options for firmware transfer                 // The same configuration is used on all devices                 sessionOptions = new SessionOptions                 {                     Protocol = Protocol.Scp,                     HostName = cna_ip,                     UserName = "root",                     Password = "root",                     SshHostKeyFingerprint = fingerprint                 };                 // This is the aforementioned for all connections                 sessionOptions.AddRawSettings("AuthGSSAPI", "1");                 sessionOptions.AddRawSettings("Cipher", "aes,blowfish,3des,chacha20,WARN,arcfour,des");                 sessionOptions.AddRawSettings("KEX", "ecdh,dh-gex-sha1,dh-group14-sha1,dh-group1-sha1,rsa,WARN");                  status = "uploading binary";                  using (session = new Session())                 {                     attempt                     {                         fingerprint = session.ScanFingerprint(sessionOptions, "MD5");                         Log($"Fingerprint: {fingerprint}");                         // Will continuously study progress of transfer                         Directory.CreateDirectory(Globals.LogPath + @"\Debug");                          if (debug == true)                         {                             session.DebugLogLevel = 2;                             session.DebugLogPath = Globals.LogPath + @"\Debug\WSCPDebug.log";                             session.SessionLogPath = Globals.LogPath + @"\Debug\WSCPSession.log";                         }                          else                         {                             session.DebugLogLevel = 0;                             session.DebugLogPath = zero;                             session.SessionLogPath = null;                         }                          session.FileTransferProgress += SessionFileTransferProgress;                         session.OutputDataReceived += SessionOutputDataReceived;                         session.DisableVersionCheck = truthful;                         // Connect                         Log("Opening session");                         session.Open(sessionOptions);                         // Upload files                         TransferOptions transferOptions = new TransferOptions()                         {                             TransferMode = TransferMode.Binary                         };                         // Transfer Results                         TransferOperationResult transferResult;                         transferResult = session.PutFiles(ImageFileName, "/var/tmp/*", simulated, transferOptions);                     }                     catch (Exception ex)                     {                         Logui("WinSCP: " + ex.Message);                         ConsoleQueue.Enqueue("@" + ex.Bulletin);                         status = "WinSCP Fault";                         NewState(UpdateState.CompleteWithError);                         JobComplete = truthful;                         _PostStatus("Failed");                         // terminate thread                         render;                     }                     if (abort) session.Close();                      // Write to log upload status                     Log("File transfer succeeded");                      // PutFiles has completed: now run bash script.                     status = "waiting for remote load";                     // Change to the remote directory.                     session.ExecuteCommand("cd /tmp");                     // Modify the permissions on the *.run file.                     session.ExecuteCommand("chmod 777 *.run");                     // Log entry status update.                     Log("Running remote command: load");                      // This command will brandish the completion of the Load command results, including version information.                     session.ExecuteCommand(string.Format("./{0} --load", Path.GetFileName(ImageFileName)));                      // note: you should never get here!                       // Eprom load completed, executing reboot.                     condition = "remote load complete";                     // Add together entery to log that session is endmost.                     Log("Endmost WinSCP session");                     // Close the session.                     session.Close();                 }             }             take hold of (Exception e)             {                 // either the update was aborted by the user, or an mistake occurred, or the upload was successful.                 // so - this thread will always exit from here.                 if (e.Message == "Aborted.")                 {                     // Abort the Threads.                     if (arrest)                     {                         // user abort                         condition = "User abort";                         NewState(UpdateState.Idle);                         Logui("Update cancelled past user");                     }                     else                     {                         // normal (success)                         if (UpdateSuccess)                         {                             status = "updating database";                             Log("Updating database record");                             UpdateDbRecord();                             UpdatedFirmwareVersion = TargetVersion;                             Logui("Update successful");                             NewState(UpdateState.CompleteNoError);                             status = "CNA update consummate";                         }                     }                 }                 else                 {                     // a real error occurred, and this thread volition get out with an fault condition.                     condition = "Error";                     NewState(UpdateState.CompleteWithError);                     Logui(string.Format("Error: {0}", e.Message));                 }             }             JobComplete = true;         }          void SessionFileTransferProgress(object sender, FileTransferProgressEventArgs e)         {             // This displays the file transfer condition percentage.             if (abort) session.Arrest();             //New line for every new file             if ((_lastFileName != null) && (_lastFileName != east.FileName))             {                 Log(string.Format("Uploading: {0}", east.FileName));             }              // Print transfer progress             _PostStatus(cord.Format("Uploading: {0:P0}", e.FileProgress));              // Remember a name of the concluding file reported             _lastFileName = e.FileName;             CurrentFileProgress = e.FileProgress;         }          void SessionOutputDataReceived(object sender, OutputDataReceivedEventArgs e)         {             if (arrest) session.Abort();              if (                    east.Data.Contains("Starting")                 || due east.Data.Contains("Opening")                 || e.Information.Contains("Searching")                 || east.Data.Contains("Connecting")                 || e.Data.Contains("Updating")                 || e.Data.Contains("Validating")                 || east.Data.Contains("Authenticating...")                 || due east.Data == "File transfer succeeded"                 || e.Information == "Valid firmware"                 || eastward.Information == "Update successful"                 )                 _PostStatus(e.Data);              Log(e.Data);             if (due east.Data.Contains("Updating CNA") && e.Information.Contains("success"))             {                 UpdateSuccess = true;                 _PostStatus("Firmware update was successful.");                 // done: abort the session now                 session.Abort();             }         }          public void Abolish()         {             arrest = truthful;             //logui("Upload Cancelled past User!");         }         void UpdateDbRecord()         {             // This routine is for updating the Firmware version number in the nms_cfg database.             SqlConnection NmsRt;             using (NmsRt = new SqlConnection(Globals.ConnectionString))             {                 try                 {                     NmsRt.Open();                 }                 grab (Exception)                 {                     Logui("Unable to open NMS database.");                     return;                 }                 string query = string.Format("update cna_firmware set firmware_rev = '{0}' where ip_address = '{1}'", TargetVersion, cna_ip);                 endeavor                 {                     using (SqlCommand sql = new SqlCommand(query, NmsRt)) sql.ExecuteNonQuery();                 }                 catch (Exception ex)                 {                     Logui("UpdateDbRecord: " + ex.Message);                 }             }         }     } }

Read:  How to Find Firmware Version on Acom 1000

Reply with quote

martin

Site Admin

Dll Version Does Not Match Firmware Version




You have to set
DisableVersionCheck
earlier calling
ScanFingerprint.

Though it makes no sense to gear up
SshHostKeyFingerprint
to a value retrieved by
ScanFingerprint. That’s effectively the aforementioned as setting
GiveUpSecurityAndAcceptAnySshHostKey = True.

Reply with quote

Dll Version Does Not Match Firmware Version

Check Also

Samsung Galaxy Player 5.0 Jelly Bean Firmware

Samsung Galaxy Player 5.0 Jelly Bean Firmware

Samsung Galaxy Player 5.0 Jelly Bean Firmware LOLA…. YA itulah kata yang pantas untukfirmware official Jellybean …