Пример #1
0
    public static void WriteTextToFile(string strFilePath, string strText, FileMode fileMode)
    {
        StreamWriter SW = File.AppendText(strFilePath);
        FileStream   FS;

        char[] arrChar = strText.ToCharArray();

        try
        {
            if (FileExists(strFilePath))
            {
                SW.WriteLine(strText);
            }
            else
            {
                FS = File.Open(strFilePath, fileMode);

                for (int i = 0; i < strText.Length; i++)
                {
                    FS.WriteByte(Convert.ToByte(arrChar[i]));
                }
                FS.Flush();
                FS.Close();
            }
        }
        catch
        {
        }
        finally
        {
            SW.Flush();
            SW.Close();
        }
    }
Пример #2
0
        private void btnSaveVmd_Click(object sender, EventArgs e)
        {
            if (lbLoadedVmdList.SelectedIndex == -1)
            {
                return;
            }

            string VmdName          = lbLoadedVmdList.SelectedItem.ToString();
            VirtualMemoryDomain VMD = (VirtualMemoryDomain)RTC_MemoryDomains.VmdPool[VmdName];

            SaveFileDialog saveFileDialog1 = new SaveFileDialog();

            saveFileDialog1.DefaultExt       = "xml";
            saveFileDialog1.Title            = "Save VMD to File";
            saveFileDialog1.Filter           = "XML VMD file|*.xml";
            saveFileDialog1.RestoreDirectory = true;

            if (saveFileDialog1.ShowDialog() == DialogResult.OK)
            {
                string Filename = saveFileDialog1.FileName;

                FileStream    FS;
                XmlSerializer xs = new XmlSerializer(typeof(VmdPrototype));

                //creater stockpile.xml to temp folder from stockpile object
                FS = File.Open(Filename, FileMode.OpenOrCreate);
                xs.Serialize(FS, VMD.proto);
                FS.Close();
            }
            else
            {
                return;
            }
        }
Пример #3
0
        /// <summary>
        /// 释放资源
        /// </summary>
        public void Dispose()
        {
            if (tcpClient != null)
            {
                if (tcpClient.IsConnected)
                {
                    tcpClient.Disconnect();
                }
                tcpClient.Dispose();
            }

            if (sockUDP != null && sockUDP.Listened)
            {
                sockUDP.CloseSock();
                sockUDP = null;
            }

            if (timer1 != null)
            {
                this.timer1.Enabled = false;
            }
            this.timer1 = null;

            if (FS != null)
            {
                FS.Close(); FS.Dispose(); FS = null;
            }

            this.TFileInfo = null;
            this.fileBlock = null;
        }
        public static void LoadActiveTable()
        {
            GlobalWin.Sound.StopSound();

            OpenFileDialog OpenFileDialog1 = new OpenFileDialog();

            OpenFileDialog1.DefaultExt       = "act";
            OpenFileDialog1.Title            = "Open ActiveTable File";
            OpenFileDialog1.Filter           = "ACT files|*.act";
            OpenFileDialog1.RestoreDirectory = true;
            if (OpenFileDialog1.ShowDialog() == DialogResult.OK)
            {
                currentFilename = OpenFileDialog1.FileName.ToString();
            }
            else
            {
                GlobalWin.Sound.StartSound();
                return;
            }

            FileStream      FS;
            BinaryFormatter bformatter = new BinaryFormatter();

            FS = File.Open(currentFilename, FileMode.OpenOrCreate);
            ActiveTableObject act = (ActiveTableObject)bformatter.Deserialize(FS);

            FS.Close();

            SetActiveTable(act);


            GlobalWin.Sound.StartSound();
        }
Пример #5
0
        //*class constructor
        public ForwardPropLogit(string fp)
            : base(fp)
        {
            StreamReader ReadW = new StreamReader(FS);

            CSVtoMAT(ref ReadW, ref W1);
            FS.Close();
        }
Пример #6
0
        public static void LoadTimeStack()
        {
            FileStream      FS;
            BinaryFormatter bformatter = new BinaryFormatter();

            FS = File.Open(RTC_Core.rtcDir + "\\SESSION\\TimeStack.dat", FileMode.OpenOrCreate);
            ts = (TimeStack)bformatter.Deserialize(FS);
            FS.Close();

            Jump();
        }
Пример #7
0
        public static void SaveTimeStack()
        {
            DeleteTimeStack();

            FileStream      FS;
            BinaryFormatter bformatter = new BinaryFormatter();

            FS = File.Open(RTC_Core.rtcDir + "\\SESSION\\TimeStack.dat", FileMode.OpenOrCreate);
            bformatter.Serialize(FS, ts);
            FS.Close();
        }
Пример #8
0
        //UDPFileMsg RequestSendFilePakMsg = new UDPFileMsg();

        #region 私有方法

        #region sockUDP_DataArrival
        private void sockUDP_DataArrival(object sender, SockEventArgs e)
        {
            if (e.Data.Length < 21)
            {
                return;
            }
            UDPPacket fileMsg = new UDPPacket(e.Data);

            if (fileMsg.type == (byte)TransmitType.getFilePackage) //收到文件数据包
            {
                if (IsSend)                                        //如果是文件发送者,则按指定位置发送文件
                {
                    sendFile(fileMsg.LastPos);
                }
                else//如果是文件接收者,处理接收文件数据包
                {
                    ReceivedFileBlock(fileMsg);
                }
            }
            else if (fileMsg.type == (byte)TransmitType.Penetrate)//收到另一客户端请求打洞
            {
                toEP = e.RemoteIPEndPoint;
                if (fileMsg.Block.Length > mtu)//确定MTU值
                {
                    mtu = fileMsg.Block.Length;
                }

                if (TFileInfo.connectedType == ConnectedType.None) //如果还未连接,继续打洞
                {
                    sockUDP.Send(toEP, fileMsg.BaseData);          //告之对方收到打洞包并向对方打洞
                }
            }
            else if (fileMsg.type == (byte)TransmitType.getRemoteEP)//收到自己的远程主机信息
            {
                if (myRemoteEP == null)
                {
                    myRemoteEP = new IPEndPoint(fileMsg.RemoteIP, fileMsg.Port);//设置自己的远程主机信息
                }
            }
            else if (fileMsg.type == (byte)TransmitType.over)
            {
                if (IsConnected == false) //如果文件传输结束标识为false
                {
                    IsConnected = true;   //文件传输结束标识为真
                    if (FS != null)
                    {
                        FS.Close(); FS.Dispose(); FS = null;
                    }
                    OnFileTransmitted();//触发文件传输完成
                }
            }
        }
        public static BlastLayer CloudLoad(string CorruptCloudCode)
        {
            GlobalWin.Sound.StopSound();
            //string obj = SerializeObject(bl);
            //string Code = "";


            string remoteUri = CorruptCloudServer + "/FILES/";
            string ccc       = CorruptCloudCode;

            WebClient myWebClient = new WebClient();

            try
            {
                GlobalWin.Sound.StopSound();
                myWebClient.DownloadFile(remoteUri + ccc, RTC_Core.rtcDir + "\\CORRUPTCLOUD\\" + ccc);
            }
            catch (Exception ex)
            {
                GlobalWin.Sound.StopSound();
                MessageBox.Show("Error: Couldn't get requested BlastLayer\n\n\n" + ex.ToString());
                GlobalWin.Sound.StartSound();
                return(null);
            }

            BlastLayer bl;

            FileStream      FS;
            BinaryFormatter bformatter = new BinaryFormatter();

            try
            {
                GlobalWin.Sound.StopSound();
                FS = File.Open(RTC_Core.rtcDir + "\\CORRUPTCLOUD\\" + ccc, FileMode.OpenOrCreate);
                bl = (BlastLayer)bformatter.Deserialize(FS);
                FS.Close();
            }
            catch (Exception ex)
            {
                GlobalWin.Sound.StopSound();
                MessageBox.Show("The BlastLayer file could not be loaded\n\n\n" + ex.ToString());
                GlobalWin.Sound.StartSound();
                return(null);
            }

            GlobalWin.Sound.StartSound();

            return(bl);
        }
Пример #10
0
        public static string CloudSave(BlastLayer bl)
        {
            FileStream      FS;
            BinaryFormatter bformatter = new BinaryFormatter();

            string tempfile = RTC_Core.rtcDir + "\\CORRUPTCLOUD\\temp.bl";

            GlobalWin.Sound.StopSound();

            if (File.Exists(tempfile))
            {
                File.Delete(tempfile);
            }

            FS = File.Open(tempfile, FileMode.OpenOrCreate);
            bformatter.Serialize(FS, bl);
            FS.Close();


            string remoteUri = CorruptCloudServer + "/post.php?submit=true&action=upload";

            byte[] responseBinary;
            try{
                WebClient client = new WebClient();
                responseBinary = client.UploadFile(remoteUri, "POST", tempfile);
            }
            catch (Exception ex)
            {
                GlobalWin.Sound.StopSound();
                MessageBox.Show("Something went wrong with the upload. Try again. \n\n\n" + ex.ToString());
                GlobalWin.Sound.StartSound();
                return("");
            }

            string response = Encoding.UTF8.GetString(responseBinary);

            GlobalWin.Sound.StartSound();

            if (response == "ERROR")
            {
                return("");
            }
            else
            {
                return(response);
            }
        }
Пример #11
0
        public static string LoadFile(string FileName)
        {
            string MapData;

            char[]        ch;
            FileStream    FS;
            BinaryReader  BR;
            StringBuilder SB;

            if (string.IsNullOrEmpty(FileName) == true)
            {
                return(null);
            }

            FS = System.IO.File.OpenRead(FileName);

            if (FS == null)
            {
                return(null);
            }

            BR = new BinaryReader(FS);
            ch = BR.ReadChars((int)FS.Length);

            BR.Close();
            BR = null;

            FS.Close();
            FS.Dispose();
            FS = null;

            SB = new StringBuilder(ch.Length);
            SB.Append(ch);

            MapData = SB.ToString();

            if (string.IsNullOrEmpty(MapData) == true)
            {
                return(null);
            }

            // fix line ends
            MapData = MapData.Replace("\r", "").Replace("\n", "\r\n");

            return(MapData);
        }
Пример #12
0
 /// <summary>
 /// 二进制转换成文件
 /// </summary>
 /// <param name="CreateFileFullPath">创建的文件路径</param>
 /// <param name="StreamByte">二进制流</param>
 /// <returns></returns>
 public static bool ByteStreamToFile(string CreateFileFullPath, byte[] StreamByte)
 {
     try
     {
         if (File.Exists(CreateFileFullPath))
         {
             DeleteFile(CreateFileFullPath);
         }
         FileStream FS;
         FS = File.Create(CreateFileFullPath);
         FS.Write(StreamByte, 0, StreamByte.Length);
         FS.Close();
         return(true);
     }
     catch
     {
         return(false);
     }
 }
Пример #13
0
        public static void SaveActiveTable(bool IsQuickSave)
        {
            GlobalWin.Sound.StopSound();

            GC.Collect();
            GC.WaitForPendingFinalizers();

            if (!IsQuickSave)
            {
                SaveFileDialog saveFileDialog1 = new SaveFileDialog();
                saveFileDialog1.DefaultExt       = "act";
                saveFileDialog1.Title            = "Save ActiveTable File";
                saveFileDialog1.Filter           = "ACT files|*.act";
                saveFileDialog1.RestoreDirectory = true;

                if (saveFileDialog1.ShowDialog() == DialogResult.OK)
                {
                    currentFilename = saveFileDialog1.FileName;
                    //sks.ShortFilename = sks.Filename.Substring(sks.Filename.LastIndexOf("\\") + 1, sks.Filename.Length - (sks.Filename.LastIndexOf("\\") + 1));
                }
                else
                {
                    GlobalWin.Sound.StartSound();
                    return;
                }
            }

            ActiveTableObject act = new ActiveTableObject(ActiveTableGenerated);

            FileStream      FS;
            BinaryFormatter bformatter = new BinaryFormatter();

            FS = File.Open(currentFilename, FileMode.OpenOrCreate);
            bformatter.Serialize(FS, act);
            FS.Close();

            GC.Collect();
            GC.WaitForPendingFinalizers();

            GlobalWin.Sound.StartSound();
        }
Пример #14
0
        public long Kaydet(byte[] Data, string FileName)
        {
            MemoryStream MS   = new MemoryStream(Data);
            string       path = Server.MapPath(".") + @"\documents\images\" + FileName;
            FileStream   FS;

            if (File.Exists(path))
            {
                FS = new FileStream(path, FileMode.Append);
            }
            else
            {
                FS = new FileStream(path, FileMode.Create);
            }
            MS.WriteTo(FS);
            long DataLength = FS.Length;

            MS.Close();
            FS.Close();
            FS.Dispose();
            return(DataLength);
        }
Пример #15
0
 public static void SaveData(string ToWrFile, string Currdata, Boolean bAppend)
 {
     System.IO.FileStream   FS = null;
     System.IO.StreamWriter SW = null;
     if (System.IO.File.Exists(ToWrFile))
     {
         System.IO.FileInfo fi = new System.IO.FileInfo(ToWrFile);
         fi.Attributes = fi.Attributes & ~System.IO.FileAttributes.ReadOnly;
     }
     try
     {
         if (bAppend)
         {
             FS = new System.IO.FileStream(ToWrFile, System.IO.FileMode.OpenOrCreate, System.IO.FileAccess.Write);
         }
         else
         {
             FS = new System.IO.FileStream(ToWrFile, System.IO.FileMode.Create, System.IO.FileAccess.Write);
         }
         SW = new System.IO.StreamWriter(FS, System.Text.Encoding.Default);
         if (bAppend)
         {
             FS.Seek(0, SeekOrigin.End);
         }
         SW.Write(Currdata);
     }
     finally
     {
         if (SW != null)
         {
             SW.Close();
         }
         if (FS != null)
         {
             FS.Close();
         }
     }
 }
Пример #16
0
 private void LoadFile(string FilePath)
 {
     try
     {
         if (SR != null)
         {
             SR.Close();
         }
         if (FS != null)
         {
             FS.Close();
         }
         FS = new FileStream(FilePath, FileMode.Open);
         SR = new StreamReader(FS);
         sliderVideo.Maximum = FS.Length;
         PlayFile();
     }
     catch
     {
         MessageBox.Show("There was an error loading the file.", "Loading Error", MessageBoxButton.OK, MessageBoxImage.Error);
         return;
     }
 }
Пример #17
0
        public static bool WriteFile(string FilePath, string FileData)
        {
            FileStream   FS;
            BinaryWriter BW;

            if (string.IsNullOrEmpty(FilePath) == true)
            {
                return(false);
            }

            if (string.IsNullOrEmpty(FileData) == true)
            {
                return(false);
            }

            FS = System.IO.File.Open(FilePath, FileMode.Create, FileAccess.Write);

            if (FS == null)
            {
                return(false);
            }

            BW = new BinaryWriter(FS);
            for (int i = 0; i < FileData.Length; i++)
            {
                BW.Write(FileData[i]);
            }

            BW.Close();
            BW = null;

            FS.Close();
            FS.Dispose();
            FS = null;

            return(true);
        }
Пример #18
0
        private void btnLoadVmd_Click(object sender, EventArgs e)
        {
            OpenFileDialog ofd = new OpenFileDialog();

            ofd.DefaultExt       = "xml";
            ofd.Multiselect      = true;
            ofd.Title            = "Open VMD File";
            ofd.Filter           = "VMD xml files|*.xml";
            ofd.RestoreDirectory = true;
            if (ofd.ShowDialog() == DialogResult.OK)
            {
                //string Filename = ofd.FileName.ToString();
                foreach (string Filename in ofd.FileNames)
                {
                    try
                    {
                        FileStream    FS;
                        XmlSerializer xs = new XmlSerializer(typeof(VmdPrototype));
                        FS = File.Open(Filename, FileMode.OpenOrCreate);
                        var proto = (VmdPrototype)xs.Deserialize(FS);
                        FS.Close();

                        RTC_MemoryDomains.AddVMD(proto);
                    }
                    catch
                    {
                        MessageBox.Show($"The VMD xml file {Filename} could not be loaded.");
                    }
                }

                RefreshVMDs();
            }
            else
            {
                return;
            }
        }
Пример #19
0
        public static void Import(string Filename, bool CorruptCloud)
        {
            //clean temp folder
            foreach (string file in Directory.GetFiles(RTC_Core.rtcDir + "\\TEMP3"))
            {
                File.Delete(file);
            }

            if (Filename == null)
            {
                OpenFileDialog OpenFileDialog1 = new OpenFileDialog();
                OpenFileDialog1.DefaultExt       = "sks";
                OpenFileDialog1.Title            = "Open Stockpile File";
                OpenFileDialog1.Filter           = "SKS files|*.sks";
                OpenFileDialog1.RestoreDirectory = true;
                if (OpenFileDialog1.ShowDialog() == DialogResult.OK)
                {
                    Filename = OpenFileDialog1.FileName.ToString();
                }
                else
                {
                    return;
                }
            }

            if (!File.Exists(Filename))
            {
                MessageBox.Show("The Stockpile file wasn't found");
                return;
            }

            //7z extract part

            string[] stringargs = { "-x", Filename, RTC_Core.rtcDir + "\\TEMP3\\" };

            FastZipProgram.Exec(stringargs);

            if (!File.Exists(RTC_Core.rtcDir + "\\TEMP3\\master.sk"))
            {
                MessageBox.Show("The file could not be read properly");
                return;
            }



            //stockpile part
            FileStream      FS;
            BinaryFormatter bformatter = new BinaryFormatter();

            Stockpile sks;

            bformatter = new BinaryFormatter();

            try
            {
                FS  = File.Open(RTC_Core.rtcDir + "\\TEMP3\\master.sk", FileMode.OpenOrCreate);
                sks = (Stockpile)bformatter.Deserialize(FS);
                FS.Close();
            }
            catch
            {
                MessageBox.Show("The Stockpile file could not be loaded");
                return;
            }


            // repopulating savestates out of temp folder
            foreach (StashKey key in sks.stashkeys)
            {
                string statefilename = key.GameName + "." + key.ParentKey + ".timejump.State"; // get savestate name

                if (!File.Exists(RTC_Core.bizhawkDir + "\\" + key.GameSystem + "\\State\\" + statefilename))
                {
                    File.Copy(RTC_Core.rtcDir + "\\TEMP3\\" + statefilename, RTC_Core.bizhawkDir + "\\" + key.GameSystem + "\\State\\" + statefilename); // copy savestates to temp folder
                }
            }

            for (int i = 0; i < sks.stashkeys.Count; i++)
            {
                sks.stashkeys[i].RomFile = RTC_Core.rtcDir + "\\TEMP\\" + sks.stashkeys[i].RomFile;
            }

            foreach (string file in Directory.GetFiles(RTC_Core.rtcDir + "\\TEMP3\\"))
            {
                if (!file.Contains(".sk") && !file.Contains(".timejump.State"))
                {
                    try
                    {
                        File.Copy(file, RTC_Core.rtcDir + "\\TEMP\\" + file.Substring(file.LastIndexOf('\\'), file.Length - file.LastIndexOf('\\'))); // copy roms to temp
                    }
                    catch {}
                }
            }

            //fill list controls

            foreach (StashKey key in sks.stashkeys)
            {
                RTC_Core.ghForm.lbStockpile.Items.Add(key);
            }
        }
Пример #20
0
        public static void Load(string Filename, bool CorruptCloud)
        {
            if (Filename == null)
            {
                OpenFileDialog OpenFileDialog1 = new OpenFileDialog();
                OpenFileDialog1.DefaultExt       = "sks";
                OpenFileDialog1.Title            = "Open Stockpile File";
                OpenFileDialog1.Filter           = "SKS files|*.sks";
                OpenFileDialog1.RestoreDirectory = true;
                if (OpenFileDialog1.ShowDialog() == DialogResult.OK)
                {
                    Filename = OpenFileDialog1.FileName.ToString();
                }
                else
                {
                    return;
                }
            }

            if (!File.Exists(Filename))
            {
                MessageBox.Show("The Stockpile file wasn't found");
                return;
            }


            //clean temp folder
            foreach (string file in Directory.GetFiles(RTC_Core.rtcDir + "\\TEMP"))
            {
                File.Delete(file);
            }


            //7z extract part

            string[] stringargs = { "-x", Filename, RTC_Core.rtcDir + "\\TEMP\\" };

            FastZipProgram.Exec(stringargs);

            if (!File.Exists(RTC_Core.rtcDir + "\\TEMP\\master.sk"))
            {
                MessageBox.Show("The file could not be read properly");
                return;
            }



            //stockpile part
            FileStream      FS;
            BinaryFormatter bformatter = new BinaryFormatter();

            Stockpile sks;

            bformatter = new BinaryFormatter();

            try
            {
                FS  = File.Open(RTC_Core.rtcDir + "\\TEMP\\master.sk", FileMode.OpenOrCreate);
                sks = (Stockpile)bformatter.Deserialize(FS);
                FS.Close();
            }
            catch
            {
                MessageBox.Show("The Stockpile file could not be loaded");
                return;
            }

            RTC_Core.currentStockpile = sks;

            // repopulating savestates out of temp folder
            foreach (StashKey key in sks.stashkeys)
            {
                string statefilename = key.GameName + "." + key.ParentKey + ".timejump.State";                 // get savestate name

                if (!File.Exists(RTC_Core.bizhawkDir + "\\" + key.GameSystem + "\\State\\" + statefilename))
                {
                    File.Copy(RTC_Core.rtcDir + "\\TEMP\\" + statefilename, RTC_Core.bizhawkDir + "\\" + key.GameSystem + "\\State\\" + statefilename);                     // copy savestates to temp folder
                }
            }


            for (int i = 0; i < sks.stashkeys.Count; i++)
            {
                sks.stashkeys[i].RomFile = RTC_Core.rtcDir + "\\TEMP\\" + sks.stashkeys[i].RomFile;
            }


            //fill list controls
            RTC_Core.ghForm.lbStockpile.Items.Clear();
            RTC_Core.spForm.lbStockpile.Items.Clear();

            foreach (StashKey key in sks.stashkeys)
            {
                RTC_Core.ghForm.lbStockpile.Items.Add(key);
                RTC_Core.spForm.lbStockpile.Items.Add(key);
            }


            RTC_Core.ghForm.btnSaveStockpile.Enabled   = true;
            RTC_Core.ghForm.btnSaveStockpile.BackColor = Color.Tomato;
            sks.Filename = Filename;

            if (sks.RtcVersion != RTC_Core.RtcVersion)
            {
                if (sks.RtcVersion == null)
                {
                    MessageBox.Show("WARNING: You have loaded a pre-0.77 stockpile using RTC " + RTC_Core.RtcVersion + "\n Items might not appear identical to how they when they were created.");
                }
                else
                {
                    MessageBox.Show("WARNING: You have loaded a stockpile created with RTC " + sks.RtcVersion + " using RTC " + RTC_Core.RtcVersion + "\n Items might not appear identical to how they when they were created.");
                }
            }
        }
Пример #21
0
        public static void Save(Stockpile sks, bool IsQuickSave)
        {
            if (sks.stashkeys.Count == 0)
            {
                MessageBox.Show("Can't save because the Current Stockpile is empty");
                return;
            }

            if (!IsQuickSave)
            {
                SaveFileDialog saveFileDialog1 = new SaveFileDialog();
                saveFileDialog1.DefaultExt       = "sks";
                saveFileDialog1.Title            = "Save Stockpile File";
                saveFileDialog1.Filter           = "SKS files|*.sks";
                saveFileDialog1.RestoreDirectory = true;

                if (saveFileDialog1.ShowDialog() == DialogResult.OK)
                {
                    sks.Filename      = saveFileDialog1.FileName;
                    sks.ShortFilename = sks.Filename.Substring(sks.Filename.LastIndexOf("\\") + 1, sks.Filename.Length - (sks.Filename.LastIndexOf("\\") + 1));
                }
                else
                {
                    return;
                }
            }
            else
            {
                sks.Filename      = RTC_Core.currentStockpile.Filename;
                sks.ShortFilename = RTC_Core.currentStockpile.ShortFilename;
            }

            //Watermarking RTC Version
            sks.RtcVersion = RTC_Core.RtcVersion;

            FileStream      FS;
            BinaryFormatter bformatter = new BinaryFormatter();

            List <string> AllRoms = new List <string>();

            //populating Allroms array
            foreach (StashKey key in sks.stashkeys)
            {
                if (!AllRoms.Contains(key.RomFile))
                {
                    AllRoms.Add(key.RomFile);

                    if (key.RomFile.ToUpper().Contains(".CUE"))
                    {
                        AllRoms.Add(key.RomFile.Substring(0, key.RomFile.Length - 4) + ".bin");
                    }
                }
            }

            //clean temp2 folder
            foreach (string file in Directory.GetFiles(RTC_Core.rtcDir + "\\TEMP2"))
            {
                File.Delete(file);
            }


            //populating temp2 folder with roms
            for (int i = 0; i < AllRoms.Count; i++)
            {
                string rom             = AllRoms[i];
                string romTempfilename = RTC_Core.rtcDir + "\\TEMP2\\" + (rom.Substring(rom.LastIndexOf("\\") + 1, rom.Length - (rom.LastIndexOf("\\") + 1)));


                if (File.Exists(romTempfilename))
                {
                    File.Delete(romTempfilename);
                    File.Copy(rom, romTempfilename);
                }
                else
                {
                    File.Copy(rom, romTempfilename);
                }
            }

            //clean temp folder
            foreach (string file in Directory.GetFiles(RTC_Core.rtcDir + "\\TEMP"))
            {
                File.Delete(file);
            }

            //sending back filtered files from temp2 folder to temp
            foreach (string file in Directory.GetFiles(RTC_Core.rtcDir + "\\TEMP2"))
            {
                File.Move(file, RTC_Core.rtcDir + "\\TEMP\\" + (file.Substring(file.LastIndexOf("\\") + 1, file.Length - (file.LastIndexOf("\\") + 1))));
            }

            //clean temp2 folder again
            foreach (string file in Directory.GetFiles(RTC_Core.rtcDir + "\\TEMP2"))
            {
                File.Delete(file);
            }

            foreach (StashKey key in sks.stashkeys)
            {
                string statefilename = key.GameName + "." + key.ParentKey + ".timejump.State"; // get savestate name

                if (!File.Exists(RTC_Core.rtcDir + "\\TEMP\\" + statefilename))
                {
                    File.Copy(RTC_Core.bizhawkDir + "\\" + key.GameSystem + "\\State\\" + statefilename, RTC_Core.rtcDir + "\\TEMP\\" + statefilename); // copy savestates to temp folder
                }
            }


            for (int i = 0; i < sks.stashkeys.Count; i++) //changes RomFile to short filename
            {
                sks.stashkeys[i].RomFile = sks.stashkeys[i].RomFile.Substring(sks.stashkeys[i].RomFile.LastIndexOf("\\") + 1, sks.stashkeys[i].RomFile.Length - (sks.stashkeys[i].RomFile.LastIndexOf("\\") + 1));
            }


            //creater master.sk to temp folder from stockpile object
            FS = File.Open(RTC_Core.rtcDir + "\\TEMP\\master.sk", FileMode.OpenOrCreate);
            bformatter.Serialize(FS, sks);
            FS.Close();


            //7z the temp folder to destination filename
            string[] stringargs = { "-c", sks.Filename, RTC_Core.rtcDir + "\\TEMP\\" };
            FastZipProgram.Exec(stringargs);


            //Imagine how long would it be with isos in that shit
            //Load(sks.Filename, true); //Reload file after for test and clean
        }
Пример #22
0
        public static void SubstractActiveTable()
        {
            GlobalWin.Sound.StopSound();

            string tempFilename;

            OpenFileDialog OpenFileDialog1 = new OpenFileDialog();

            OpenFileDialog1.DefaultExt       = "act";
            OpenFileDialog1.Title            = "Open ActiveTable File";
            OpenFileDialog1.Filter           = "ACT files|*.act";
            OpenFileDialog1.RestoreDirectory = true;
            if (OpenFileDialog1.ShowDialog() == DialogResult.OK)
            {
                tempFilename = OpenFileDialog1.FileName.ToString();
            }
            else
            {
                return;
            }

            FileStream      FS;
            BinaryFormatter bformatter = new BinaryFormatter();

            FS = File.Open(tempFilename, FileMode.OpenOrCreate);
            ActiveTableObject act = (ActiveTableObject)bformatter.Deserialize(FS);

            FS.Close();

            long[] substractiveActiveTable = act.data;

            List <long> newActiveTable = new List <long>();

            GC.Collect();
            GC.WaitForPendingFinalizers();

            foreach (long item in ActiveTableGenerated)
            {
                bool found = false;

                foreach (long testItem in substractiveActiveTable)
                {
                    if (item == testItem)
                    {
                        found = true;
                        break;
                    }
                }

                if (!found)
                {
                    newActiveTable.Add(item);
                }
            }

            ActiveTableGenerated = newActiveTable.ToArray();
            RTC_Core.coreForm.lbFreezeEngineActiveTableSize.Text = "Active table size: " + ActiveTableGenerated.Length.ToString();

            GC.Collect();
            GC.WaitForPendingFinalizers();

            GlobalWin.Sound.StartSound();
        }
Пример #23
0
        public static void SaveRestore()
        {
            if (!RTC_Restore.IsEnabled)
            {
                return;
            }


            try
            {
                #region RTC_Core

                //Default Values
                RTC_Status.SelectedEngine      = RTC_Core.SelectedEngine;
                RTC_Status.IteratorSteps       = RTC_Core.IteratorSteps;
                RTC_Status.Radius              = RTC_Core.Radius;
                RTC_Status.Intensity           = RTC_Core.Intensity;
                RTC_Status.ClearCheatsOnRewind = RTC_Core.ClearCheatsOnRewind;

                //Flags
                RTC_Status.AutoCorrupt       = RTC_Core.AutoCorrupt;
                RTC_Status.ExtractBlastLayer = RTC_Core.ExtractBlastLayer;

                RTC_Status.lastOpenRom = RTC_Core.lastOpenRom;

                //General Values

                //Memory object references
                RTC_Status.currentStockpile = RTC_Core.currentStockpile;

                #endregion

                #region RTC_MemoryZones

                RTC_Status.SelectedDomains = RTC_MemoryZones.getSelectedDomains();

                #endregion

                #region RTC_NightmareEngine

                RTC_Status.Algo = RTC_NightmareEngine.Algo;

                #endregion

                #region RTC_HellgenieEngine

                RTC_Status.MaxCheats = RTC_HellgenieEngine.MaxCheats;

                #endregion

                #region RTC_FreezeEngine

                RTC_Status.MaxFreezes = RTC_FreezeEngine.MaxFreezes;

                #endregion

                #region RTC_DistortionEngine

                RTC_Status.MaxAge             = RTC_DistortionEngine.MaxAge;
                RTC_Status.CurrentAge         = RTC_DistortionEngine.CurrentAge;
                RTC_Status.AllDistortionBytes = RTC_DistortionEngine.AllDistortionBytes;

                #endregion

                #region RTC_ExternalRomPlugin

                RTC_Status.SelectedPlugin = RTC_ExternalRomPlugin.SelectedPlugin;

                #endregion

                #region RTC_coreForm

                RTC_WindowStatus.RTC_coreFormLocation    = RTC_Core.coreForm.Location;
                RTC_WindowStatus.RTC_coreFormWindowState = RTC_Core.coreForm.WindowState;

                #endregion

                #region RTC_GH_Form

                RTC_Status.currentSelectedState = RTC_Core.ghForm.currentSelectedState;
                RTC_Status.btnParentKeys        = RTC_Core.ghForm.btnParentKeys;
                RTC_Status.btnAttachedRom       = RTC_Core.ghForm.btnAttachedRom;

                RTC_Status.DontLoadSelectedStash     = RTC_Core.ghForm.DontLoadSelectedStash;
                RTC_Status.DontLoadSelectedStockpile = RTC_Core.ghForm.DontLoadSelectedStockpile;

                if (RTC_Core.ghForm.rbCorrupt.Checked)
                {
                    RTC_Status.ghMode = "CORRUPT";
                }
                else if (RTC_Core.ghForm.rbInject.Checked)
                {
                    RTC_Status.ghMode = "INJECT";
                }
                else
                {
                    RTC_Status.ghMode = "ORIGINAL";
                }

                RTC_Status.AutoLoadState        = RTC_Core.ghForm.cbAutoLoadState.Checked;
                RTC_Status.LoadOnSelect         = RTC_Core.ghForm.cbLoadOnSelect.Checked;
                RTC_Status.StashCorrupted       = RTC_Core.ghForm.cbStashCorrupted.Checked;
                RTC_Status.StashInjected        = RTC_Core.ghForm.cbStashInjected.Checked;
                RTC_Status.RenderAtLoad         = RTC_Core.ghForm.cbRenderAtLoad.Checked;
                RTC_Status.RenderAtCorrupt      = RTC_Core.ghForm.cbRenderAtCorrupt.Checked;
                RTC_Status.SavestateLoadOnClick = RTC_Core.ghForm.cbSavestateLoadOnClick.Checked;

                if (RTC_Core.ghForm.rbRenderNone.Checked)
                {
                    RTC_Status.ExportFormat = "NONE";
                }
                else if (RTC_Core.ghForm.rbRenderMPEG.Checked)
                {
                    RTC_Status.ExportFormat = "MPEG";
                }
                else if (RTC_Core.ghForm.rbRenderWAV.Checked)
                {
                    RTC_Status.ExportFormat = "WAV";
                }
                else if (RTC_Core.ghForm.rbRenderAVI.Checked)
                {
                    RTC_Status.ExportFormat = "AVI";
                }

                RTC_Status.StockpileListboxItems = new List <object>();

                foreach (object item in RTC_Core.ghForm.lbStockpile.Items)
                {
                    RTC_Status.StockpileListboxItems.Add(item);
                }

                RTC_Status.StashHistoryListboxItems = new List <object>();

                RTC_Status.BackupHistory = RTC_Core.ghForm.cbBackupHistory.Checked;

                if (RTC_Status.BackupHistory)
                {
                    foreach (object item in RTC_Core.ghForm.lbStashHistory.Items)
                    {
                        RTC_Status.StashHistoryListboxItems.Add(item);
                    }
                }



                RTC_WindowStatus.RTC_ghFormLocation    = RTC_Core.ghForm.Location;
                RTC_WindowStatus.IsRTC_ghFormOpen      = RTC_Core.ghForm.Visible;
                RTC_WindowStatus.RTC_tfFormWindowState = RTC_Core.ghForm.WindowState;

                #endregion

                #region RTC_TimeStack & RTC_TimeFlow

                RTC_Status.TimeStack      = RTC_Core.coreForm.cbUseTimeStack.Checked;
                RTC_Status.TimeStackDelay = RTC_TimeStack.TimeStackDelay;
                RTC_Status.TimeMap        = RTC_TimeFlow.Running;

                RTC_WindowStatus.RTC_tfFormLocation    = RTC_Core.tfForm.Location;
                RTC_WindowStatus.IsRTC_tfFormOpen      = RTC_Core.tfForm.Visible;
                RTC_WindowStatus.RTC_tfFormWindowState = RTC_Core.tfForm.WindowState;

                #endregion

                #region Bizhawk

                RTC_WindowStatus.MainFormLocation = GlobalWin.MainForm.Location;
                RTC_WindowStatus.MainFormSize     = GlobalWin.MainForm.Size;

                #endregion

                #region Saving the Restore Files

                lock (restoreLock)
                {
                    FileStream      FS;
                    BinaryFormatter bformatter = new BinaryFormatter();
                    FS = File.Open(RTC_Core.rtcDir + "\\SESSION\\Restore.dat", FileMode.OpenOrCreate);
                    bformatter.Serialize(FS, RTC_Status);
                    FS.Close();

                    bformatter = new BinaryFormatter();
                    FS         = File.Open(RTC_Core.rtcDir + "\\SESSION\\WindowRestore.dat", FileMode.OpenOrCreate);
                    bformatter.Serialize(FS, RTC_WindowStatus);
                    FS.Close();
                }

                GlobalWin.MainForm.SaveConfig();

                #endregion
            }
            catch (Exception ex)
            {
                MessageBox.Show("Something wrong happenned in RTC_Restore -> SaveRestore() \n\n" + ex.ToString());
            }
        }
Пример #24
0
        public static void LoadWindowRestore()
        {
            try
            {
                #region Loading the WindowRestore.dat File

                FileStream      FS;
                BinaryFormatter bformatter = new BinaryFormatter();
                FS = File.Open(RTC_Core.rtcDir + "\\SESSION\\WindowRestore.dat", FileMode.OpenOrCreate);
                RTC_WindowStatus = (WindowRestoreFile)bformatter.Deserialize(FS);
                FS.Close();

                #endregion

                #region RTC_coreForm

                if (RTC_WindowStatus.RTC_coreFormLocation.X > -32000 && RTC_WindowStatus.RTC_coreFormLocation.Y > -32000)
                {
                    RTC_Core.coreForm.Location = RTC_WindowStatus.RTC_coreFormLocation;
                }

                RTC_Core.coreForm.WindowState = RTC_WindowStatus.RTC_coreFormWindowState;

                #endregion

                #region RTC_GH_Form

                RTC_Core.ghForm.Visible = RTC_WindowStatus.IsRTC_ghFormOpen;

                if (RTC_WindowStatus.RTC_ghFormLocation.X > -32000 && RTC_WindowStatus.RTC_ghFormLocation.Y > -32000)
                {
                    RTC_Core.ghForm.Location = RTC_WindowStatus.RTC_ghFormLocation;
                }

                if (RTC_WindowStatus.IsRTC_ghFormOpen)
                {
                    RTC_Core.ghForm.WindowState = RTC_WindowStatus.RTC_ghFormWindowState;
                }

                #endregion

                #region RTC_TF_Form

                RTC_Core.tfForm.Visible = RTC_WindowStatus.IsRTC_tfFormOpen;

                if (RTC_WindowStatus.RTC_tfFormLocation.X > -32000 && RTC_WindowStatus.RTC_tfFormLocation.Y > -32000)
                {
                    RTC_Core.tfForm.Location = RTC_WindowStatus.RTC_tfFormLocation;
                }

                if (RTC_WindowStatus.IsRTC_tfFormOpen)
                {
                    RTC_Core.tfForm.Show();
                    RTC_Core.tfForm.WindowState = RTC_WindowStatus.RTC_tfFormWindowState;
                }

                #endregion

                #region Bizhawk

                if (RTC_WindowStatus.MainFormLocation.X > -32000 && RTC_WindowStatus.MainFormLocation.Y > -32000)
                {
                    GlobalWin.MainForm.Location = RTC_WindowStatus.MainFormLocation;
                }

                if (RTC_WindowStatus.MainFormSize.Width > 320 && RTC_WindowStatus.MainFormSize.Height > 240)
                {
                    GlobalWin.MainForm.Size = RTC_WindowStatus.MainFormSize;
                }

                #endregion
            }
            catch (Exception ex)
            {
                MessageBox.Show("Something wrong happenned in RTC_Restore -> LoadWindowRestore() \n\n" + ex.ToString());
            }
        }
Пример #25
0
        public static void LoadRestore()
        {
            try
            {
                #region Loading the Restore.dat File

                lock (restoreLock)
                {
                    FileStream      FS;
                    BinaryFormatter bformatter = new BinaryFormatter();
                    FS         = File.Open(RTC_Core.rtcDir + "\\SESSION\\Restore.dat", FileMode.OpenOrCreate);
                    RTC_Status = (RestoreFile)bformatter.Deserialize(FS);
                    FS.Close();
                }

                #endregion

                #region Replacing Form Values

                switch (RTC_Status.SelectedEngine)
                {
                case CorruptionEngine.NIGHTMARE:
                    RTC_Core.SetEngineByName("Nightmare Engine");
                    break;

                case CorruptionEngine.HELLGENIE:
                    RTC_Core.SetEngineByName("Hellgenie Engine");
                    break;

                case CorruptionEngine.DISTORTION:
                    RTC_Core.SetEngineByName("Distortion Engine");
                    break;

                case CorruptionEngine.NONE:
                    break;
                }

                RTC_Core.coreForm.nmIteratorSteps.Value = Convert.ToDecimal(RTC_Status.IteratorSteps);
                RTC_Core.coreForm.nmIntensity.Value     = Convert.ToDecimal(RTC_Status.Intensity);

                RTC_Core.coreForm.cbClearCheatsOnRewind.Checked = RTC_Status.ClearCheatsOnRewind;

                string cbBlastRadius = RTC_Status.Radius.ToString();
                for (int i = 0; i < RTC_Core.coreForm.cbBlastRadius.Items.Count; i++)
                {
                    if (RTC_Core.coreForm.cbBlastRadius.Items[i].ToString() == cbBlastRadius)
                    {
                        RTC_Core.coreForm.cbBlastRadius.SelectedIndex = i;
                    }
                }

                string cbBlastType = RTC_Status.Algo.ToString();
                for (int i = 0; i < RTC_Core.coreForm.cbBlastRadius.Items.Count; i++)
                {
                    if (RTC_Core.coreForm.cbBlastType.Items[i].ToString() == cbBlastType)
                    {
                        RTC_Core.coreForm.cbBlastType.SelectedIndex = i;
                    }
                }



                RTC_Core.coreForm.nmMaxCheats.Value       = Convert.ToDecimal(RTC_Status.MaxCheats);
                RTC_Core.coreForm.nmMaxFreezes.Value      = Convert.ToDecimal(RTC_Status.MaxFreezes);
                RTC_Core.coreForm.nmDistortionDelay.Value = Convert.ToDecimal(RTC_Status.MaxAge);

                if (RTC_Status.AutoCorrupt)
                {
                    RTC_Core.coreForm.btnAutoCorrupt.Text = "Stop Auto-Corrupt";
                }
                else
                {
                    RTC_Core.coreForm.btnAutoCorrupt.Text = "Start Auto-Corrupt";
                }

                //Set Up the Memory Domains Here

                #endregion

                #region RTC_NightmareEngine

                RTC_NightmareEngine.Algo = RTC_Status.Algo;

                #endregion

                #region RTC_HellgenieEngine

                RTC_HellgenieEngine.MaxCheats = RTC_Status.MaxCheats;

                #endregion

                #region RTC_HellgenieEngine

                RTC_FreezeEngine.MaxFreezes = RTC_Status.MaxFreezes;

                #endregion

                #region RTC_DistortionEngine

                RTC_DistortionEngine.MaxAge             = RTC_Status.MaxAge;
                RTC_DistortionEngine.CurrentAge         = RTC_Status.CurrentAge;
                RTC_DistortionEngine.AllDistortionBytes = RTC_Status.AllDistortionBytes;

                #endregion

                #region RTC_ExternalRomPlugin
                RTC_ExternalRomPlugin.SelectedPlugin = RTC_Status.SelectedPlugin;

                for (int i = 0; i < RTC_Core.coreForm.cbExternalSelectedPlugin.Items.Count; i++)
                {
                    if (RTC_ExternalRomPlugin.SelectedPlugin == RTC_Core.coreForm.cbExternalSelectedPlugin.Items[i].ToString())
                    {
                        RTC_Core.coreForm.cbExternalSelectedPlugin.SelectedIndex = i;
                        break;
                    }
                }


                #endregion

                #region RTC_coreForm

                switch (RTC_Status.SelectedEngine)
                {
                case CorruptionEngine.NIGHTMARE:
                    RTC_Core.SetEngineByName("Nightmare Engine");
                    break;

                case CorruptionEngine.HELLGENIE:
                    RTC_Core.SetEngineByName("Hellgenie Engine");
                    break;

                case CorruptionEngine.DISTORTION:
                    RTC_Core.SetEngineByName("Distortion Engine");
                    break;

                case CorruptionEngine.FREEZE:
                    RTC_Core.SetEngineByName("Freeze Engine");
                    break;

                case CorruptionEngine.EXTERNALROM:
                    RTC_Core.SetEngineByName("External ROM Plugin");
                    break;
                }

                #endregion

                #region RTC_GH_Form

                RTC_Core.ghForm.currentSelectedState = RTC_Status.currentSelectedState;

                switch (RTC_Core.ghForm.currentSelectedState)
                {
                case "01":
                    RTC_Core.ghForm.btnSavestate_Click(RTC_Core.ghForm.btnSavestate01, new EventArgs());
                    break;

                case "02":
                    RTC_Core.ghForm.btnSavestate_Click(RTC_Core.ghForm.btnSavestate02, new EventArgs());
                    break;

                case "03":
                    RTC_Core.ghForm.btnSavestate_Click(RTC_Core.ghForm.btnSavestate03, new EventArgs());
                    break;

                case "04":
                    RTC_Core.ghForm.btnSavestate_Click(RTC_Core.ghForm.btnSavestate04, new EventArgs());
                    break;

                case "05":
                    RTC_Core.ghForm.btnSavestate_Click(RTC_Core.ghForm.btnSavestate05, new EventArgs());
                    break;

                case "06":
                    RTC_Core.ghForm.btnSavestate_Click(RTC_Core.ghForm.btnSavestate06, new EventArgs());
                    break;

                case "07":
                    RTC_Core.ghForm.btnSavestate_Click(RTC_Core.ghForm.btnSavestate07, new EventArgs());
                    break;

                case "08":
                    RTC_Core.ghForm.btnSavestate_Click(RTC_Core.ghForm.btnSavestate08, new EventArgs());
                    break;

                case "09":
                    RTC_Core.ghForm.btnSavestate_Click(RTC_Core.ghForm.btnSavestate09, new EventArgs());
                    break;

                case "10":
                    RTC_Core.ghForm.btnSavestate_Click(RTC_Core.ghForm.btnSavestate10, new EventArgs());
                    break;

                case "11":
                    RTC_Core.ghForm.btnSavestate_Click(RTC_Core.ghForm.btnSavestate11, new EventArgs());
                    break;

                case "12":
                    RTC_Core.ghForm.btnSavestate_Click(RTC_Core.ghForm.btnSavestate12, new EventArgs());
                    break;

                case "13":
                    RTC_Core.ghForm.btnSavestate_Click(RTC_Core.ghForm.btnSavestate13, new EventArgs());
                    break;

                case "14":
                    RTC_Core.ghForm.btnSavestate_Click(RTC_Core.ghForm.btnSavestate14, new EventArgs());
                    break;

                case "15":
                    RTC_Core.ghForm.btnSavestate_Click(RTC_Core.ghForm.btnSavestate15, new EventArgs());
                    break;

                case "16":
                    RTC_Core.ghForm.btnSavestate_Click(RTC_Core.ghForm.btnSavestate16, new EventArgs());
                    break;

                case "17":
                    RTC_Core.ghForm.btnSavestate_Click(RTC_Core.ghForm.btnSavestate17, new EventArgs());
                    break;

                case "18":
                    RTC_Core.ghForm.btnSavestate_Click(RTC_Core.ghForm.btnSavestate18, new EventArgs());
                    break;

                case "19":
                    RTC_Core.ghForm.btnSavestate_Click(RTC_Core.ghForm.btnSavestate19, new EventArgs());
                    break;

                case "20":
                    RTC_Core.ghForm.btnSavestate_Click(RTC_Core.ghForm.btnSavestate20, new EventArgs());
                    break;
                }


                RTC_Core.ghForm.btnParentKeys  = RTC_Status.btnParentKeys;
                RTC_Core.ghForm.btnAttachedRom = RTC_Status.btnAttachedRom;

                RTC_Core.ghForm.DontLoadSelectedStash     = RTC_Status.DontLoadSelectedStash;
                RTC_Core.ghForm.DontLoadSelectedStockpile = RTC_Status.DontLoadSelectedStockpile;


                if (RTC_Status.ghMode == "CORRUPT")
                {
                    RTC_Core.ghForm.rbCorrupt.Checked = true;
                }
                else if (RTC_Status.ghMode == "INJECT")
                {
                    RTC_Core.ghForm.rbInject.Checked = true;
                }
                else
                {
                    RTC_Core.ghForm.rbOriginal.Checked = true;
                }


                RTC_Core.ghForm.cbAutoLoadState.Checked        = RTC_Status.AutoLoadState;
                RTC_Core.ghForm.cbLoadOnSelect.Checked         = RTC_Status.LoadOnSelect;
                RTC_Core.ghForm.cbStashCorrupted.Checked       = RTC_Status.StashCorrupted;
                RTC_Core.ghForm.cbStashInjected.Checked        = RTC_Status.StashInjected;
                RTC_Core.ghForm.cbRenderAtLoad.Checked         = RTC_Status.RenderAtLoad;
                RTC_Core.ghForm.cbRenderAtCorrupt.Checked      = RTC_Status.RenderAtCorrupt;
                RTC_Core.ghForm.cbSavestateLoadOnClick.Checked = RTC_Status.SavestateLoadOnClick;

                if (RTC_Status.ExportFormat == "NONE")
                {
                    RTC_Core.ghForm.rbRenderNone.Checked = true;
                }
                else if (RTC_Status.ExportFormat == "MPEG")
                {
                    RTC_Core.ghForm.rbRenderMPEG.Checked = true;
                }
                else if (RTC_Status.ExportFormat == "WAV")
                {
                    RTC_Core.ghForm.rbRenderWAV.Checked = true;
                }
                else if (RTC_Status.ExportFormat == "AVI")
                {
                    RTC_Core.ghForm.rbRenderAVI.Checked = true;
                }

                RTC_Core.ghForm.lbStockpile.Items.AddRange(RTC_Status.StockpileListboxItems.ToArray());

                RTC_Core.ghForm.cbBackupHistory.Checked = RTC_Status.BackupHistory;

                if (RTC_Status.BackupHistory)
                {
                    RTC_Core.ghForm.lbStashHistory.Items.AddRange(RTC_Status.StashHistoryListboxItems.ToArray());
                }


                #endregion

                #region RTC_Core

                //Default Values
                RTC_Core.SelectedEngine      = RTC_Status.SelectedEngine;
                RTC_Core.IteratorSteps       = RTC_Status.IteratorSteps;
                RTC_Core.Radius              = RTC_Status.Radius;
                RTC_Core.Intensity           = RTC_Status.Intensity;
                RTC_Core.ClearCheatsOnRewind = RTC_Status.ClearCheatsOnRewind;

                //Flags
                RTC_Core.AutoCorrupt       = RTC_Status.AutoCorrupt;
                RTC_Core.ExtractBlastLayer = RTC_Status.ExtractBlastLayer;

                RTC_Core.lastOpenRom = RTC_Status.lastOpenRom;

                if (RTC_Core.lastOpenRom != null)
                {
                    RTC_Core.LoadRom(RTC_Core.lastOpenRom);
                    RTC_MemoryZones.pendingSelectedDomains = RTC_Status.SelectedDomains;
                }
                else
                {
                    RTC_Core.AutoCorrupt = false;
                    RTC_Core.LoadDefaultRom();
                }

                //General Values

                //Memory object references
                RTC_Core.currentStockpile = RTC_Status.currentStockpile;

                if (RTC_Core.currentStockpile != null && RTC_Core.currentStockpile.Filename != null)
                {
                    RTC_Core.ghForm.btnSaveStockpile.Enabled   = true;
                    RTC_Core.ghForm.btnSaveStockpile.BackColor = Color.Tomato;
                }

                #endregion

                #region RTC_TimeStack & RTC_TimeFlow

                RTC_Core.coreForm.cbUseTimeStack.Checked = RTC_Status.TimeStack;
                RTC_Core.coreForm.nmTimeStackDelay.Value = Convert.ToDecimal(RTC_Status.TimeStackDelay);

                if (RTC_Status.TimeStack)
                {
                    RTC_TimeStack.LoadTimeStack();
                }

                if (RTC_Status.TimeMap)
                {
                    RTC_TimeFlow.Start();
                }

                #endregion

                GlobalWin.MainForm.Activate();
            }
            catch (Exception ex)
            {
                MessageBox.Show("Something wrong happenned in RTC_Restore -> LoadRestore() \n\n" + ex.ToString());
            }
        }