// Decompiled with JetBrains decompiler // Type: PinnacleSys.MediaServer.MainForm // Assembly: PMSInstallInit, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null // MVID: 1143B458-69F7-4F72-9059-A13F9AB730BC // Assembly location: C:\Users\Administrateur\Downloads\Virusshare.00004-msil\Virus.Win32.Sality.sil-66a8bf80b7d1c03c218a77899ddc10c75b21c3784127eb96343f22ad5b31b4d6.exe using PinnacleSys.FirewallConfig; using System; using System.Collections; using System.ComponentModel; using System.Drawing; using System.IO; using System.Text; using System.Windows.Forms; namespace PinnacleSys.MediaServer { public class MainForm : Form { private IPMediaServerProxy m_MediaServerProxy = (IPMediaServerProxy) null; private DateTime m_FailTime; private Timer m_Timer = new Timer(); private bool m_ScanSubfolder = false; private bool m_Relative = false; private string m_RelativRoot = (string) null; private ArrayList m_ImportFolders = new ArrayList(); private FolderImporter m_Importer = (FolderImporter) null; private bool m_Done = false; private int m_FolderIndex = 0; private bool m_Quiet = false; private ArrayList m_FWAddFiles = new ArrayList(); private GroupBox groupBox; private System.Windows.Forms.Label label; private Container components = (Container) null; public MainForm(string[] args) { this.InitializeComponent(); if (args.Length == 0) { StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append("Commandline:\n"); stringBuilder.Append("\n /fw AppPath1 AppPath2\t- unblock firewall for these programs ( local scope )"); stringBuilder.Append("\n /q\t\t\t- quiet media import"); stringBuilder.Append("\n /r RootPath\t\t- import folders are realtiv to this root path"); stringBuilder.Append("\n /f Folder1 Folder2\t\t- import folders (absolut or relativ(/r) )"); stringBuilder.Append("\n /l FilePath\t\t- textfile which contains import folder list (absolut or relativ(/r)"); stringBuilder.Append("\n /s\t\t\t- scan also subfolder"); int num = (int) MessageBox.Show(stringBuilder.ToString(), "PMS Install Init", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); throw new Exception(); } this.ParseArgs(args); try { WinXPFirewall winXpFirewall = new WinXPFirewall(); string executablePath = Application.ExecutablePath; winXpFirewall.AddApp(Path.GetFileName(executablePath), executablePath, true, NET_FW_SCOPE_.NET_FW_SCOPE_LOCAL_SUBNET); for (int index = 0; index < this.m_FWAddFiles.Count; ++index) winXpFirewall.AddApp(Path.GetFileName((string) this.m_FWAddFiles[index]), (string) this.m_FWAddFiles[index], true, NET_FW_SCOPE_.NET_FW_SCOPE_LOCAL_SUBNET); } catch { } if (this.m_ImportFolders.Count == 0) throw new Exception(); if (this.m_Quiet) this.Hide(); else this.Show(); this.m_Timer.Tick += new EventHandler(this.TimerEvent); this.m_Timer.Interval = 1000; this.m_Timer.Start(); } protected override void Dispose(bool disposing) { if (disposing && this.components != null) this.components.Dispose(); base.Dispose(disposing); } private void TimerEvent(object myObject, EventArgs myEventArgs) { if (this.m_MediaServerProxy == null) { this.m_MediaServerProxy = MediaServerProxy.CreateProxy(); if (this.m_MediaServerProxy == null) { this.m_Timer.Stop(); } else { this.m_FailTime = DateTime.Now.AddMinutes(1.0); this.Box("Waiting for MediaServer connection ..."); } } else if (!this.m_MediaServerProxy.IsConnected) { if (DateTime.Now > this.m_FailTime) { this.m_Timer.Stop(); Application.Exit(); } else { try { this.m_MediaServerProxy.Connect(); } catch (MediaServerException ex) { } } } else { if (this.m_Done) return; if (this.m_FolderIndex >= this.m_ImportFolders.Count) { this.m_Timer.Stop(); Application.Exit(); } else { if (this.m_Importer == null) { this.m_Importer = new FolderImporter(((IPMediaServer) this.m_MediaServerProxy).GetMediaContext((string) null)); this.m_Importer.IncludeSubdirectories = this.m_ScanSubfolder; // ISSUE: method pointer this.m_Importer.FileDetected += new FolderImporter.PathFileEventHandler2((object) this, __methodptr(Import_FileDetected)); // ISSUE: method pointer this.m_Importer.Done += new FolderImporter.PathFileEventHandler((object) this, __methodptr(Import_Done)); } this.Box("Importing ... "); this.m_Importer.Path = (string) this.m_ImportFolders[this.m_FolderIndex++]; this.m_Importer.Run(); this.m_Done = false; } } } private bool Import_FileDetected(IPMediaItem item) { this.Label(((IPPropertiesBase) item).StoragePath); return true; } private bool Import_Done(string fullpath) { this.Label(""); this.m_Done = true; return true; } private void Box(string text) { this.groupBox.Text = text; this.groupBox.Update(); } private void Label(string text) { this.label.Text = text; this.label.Update(); } private bool ParseArgs(string[] args) { int index1 = 0; label_33: while (index1 < args.Length) { string lower = args[index1++].ToLower(); if (lower == "/s") this.m_ScanSubfolder = true; else if (lower == "/q") this.m_Quiet = true; else if (lower == "/r") { if (index1 >= args.Length || args[index1].IndexOf("/", 0, 1) >= 0) return false; this.m_RelativRoot = args[index1++]; this.m_Relative = true; } else if (lower == "/f") { if (index1 >= args.Length || args[index1].IndexOf("/", 0, 1) >= 0) return false; while (true) { if (index1 < args.Length && args[index1].IndexOf("/", 0, 1) < 0) this.m_ImportFolders.Add((object) args[index1++]); else goto label_33; } } else if (lower == "/l") { if (index1 >= args.Length || args[index1].IndexOf("/", 0, 1) >= 0) return false; string path = args[index1++]; if (!File.Exists(path)) return false; StreamReader streamReader = (StreamReader) null; try { streamReader = File.OpenText(path); string str; while ((str = streamReader.ReadLine()) != null) { if (str.Length != 0) this.m_ImportFolders.Add((object) str); } } catch { return false; } finally { streamReader?.Close(); } } else if (lower == "/fw") { if (index1 >= args.Length || args[index1].IndexOf("/", 0, 1) >= 0) return false; while (true) { if (index1 < args.Length && args[index1].IndexOf("/", 0, 1) < 0) this.m_FWAddFiles.Add((object) args[index1++]); else goto label_33; } } } if (this.m_Relative) { for (int index2 = 0; index2 < this.m_ImportFolders.Count; ++index2) this.m_ImportFolders[index2] = (object) (this.m_RelativRoot + "\\" + this.m_ImportFolders[index2]); } return true; } private void InitializeComponent() { this.groupBox = new GroupBox(); this.label = new System.Windows.Forms.Label(); this.groupBox.SuspendLayout(); this.SuspendLayout(); this.groupBox.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right; this.groupBox.Controls.Add((Control) this.label); this.groupBox.Location = new Point(8, 16); this.groupBox.Name = "groupBox"; this.groupBox.Size = new Size(432, 72); this.groupBox.TabIndex = 1; this.groupBox.TabStop = false; this.label.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right; this.label.Location = new Point(8, 24); this.label.Name = "label"; this.label.Size = new Size(416, 40); this.label.TabIndex = 0; this.AutoScaleBaseSize = new Size(5, 13); this.ClientSize = new Size(448, 110); this.Controls.Add((Control) this.groupBox); this.MaximizeBox = false; this.MinimizeBox = false; this.Name = nameof (MainForm); this.ShowInTaskbar = false; this.Text = "Pinnacle Install Init"; this.groupBox.ResumeLayout(false); this.ResumeLayout(false); } [STAThread] private static void Main(string[] args) { try { Application.Run((ApplicationContext) new MyApplicationContext(args)); } catch { } } } }