示例#1
0
        private void CompleteWorking()
        {
            var strArray = FileEncrypter.DecryptString(targetFile.data, password);

            if (!destFilename.Contains("[NUMBER]"))
            {
                destFilename += "[NUMBER]";
            }
            var str1 = destFilename.Replace("[NUMBER]", "");
            var str2 = strArray[3] == null?str1.Replace("[EXT]", ".txt") : str1.Replace("[EXT]", strArray[3]);

            if (destFolder.containsFile(str2))
            {
                var num = 1;
                do
                {
                    str2 = destFilename.Replace("[NUMBER]", "(" + num + ")");
                    ++num;
                } while (destFolder.containsFile(str2));
            }
            var fileEntry = new FileEntry(strArray[2], str2);

            writtenFilename = str2;
            destFolder.files.Add(fileEntry);
            os.write("Decryption complete - file " + targetFilename + " decrypted to target file " + targetFilename);
            os.write("Encryption Header    : \"" + strArray[0] + "\"");
            os.write("Encryption Source IP: \"" + strArray[1] + "\"");
            displayHeader = strArray[0];
            displayIP     = strArray[1];
        }
示例#2
0
        public static void setThemeOnComputer(object computerObject, OSTheme theme)
        {
            Folder folder = ((Computer)computerObject).files.root.searchForFolder("sys");

            if (folder.containsFile("x-server.sys"))
            {
                folder.searchForFile("x-server.sys").data = ThemeManager.getThemeDataString(theme);
            }
            else
            {
                FileEntry fileEntry = new FileEntry(ThemeManager.getThemeDataString(theme), "x-server.sys");
                folder.files.Add(fileEntry);
            }
        }
示例#3
0
        public static void setThemeOnComputer(object computerObject, string customThemePath)
        {
            Folder folder = ((Computer)computerObject).files.root.searchForFolder("sys");
            string stringForCustomTheme = ThemeManager.getThemeDataStringForCustomTheme(customThemePath);

            if (folder.containsFile("x-server.sys"))
            {
                folder.searchForFile("x-server.sys").data = stringForCustomTheme;
            }
            else
            {
                FileEntry fileEntry = new FileEntry(stringForCustomTheme, "x-server.sys");
                folder.files.Add(fileEntry);
            }
        }
示例#4
0
 public static Condition FileDeleted(Folder f, string filename)
 {
     return x => !f.containsFile(filename);
 }
示例#5
0
 public static Condition FileDeleted(Folder f, string filename)
 {
     return(x => !f.containsFile(filename));
 }
示例#6
0
 public static ActionDelayer.Condition FileDeleted(Folder f, string filename)
 {
     return((ActionDelayer.Condition)(x => !f.containsFile(filename)));
 }
示例#7
0
        public string checkOSBootFiles(string bootString)
        {
            this.BootLoadErrors = "";
            Folder folder    = this.os.thisComputer.files.root.searchForFolder("sys");
            bool   flag      = true;
            string newValue1 = "ERROR: " + LocaleTerms.Loc("Unable to Load System file os-config.sys") + "\n";

            if (folder.containsFile("os-config.sys"))
            {
                newValue1 = "Loaded os-config.sys : System Config Initialized";
            }
            else
            {
                this.os.failBoot();
                flag = false;
                CrashModule crashModule = this;
                string      str         = crashModule.BootLoadErrors + newValue1 + " \n";
                crashModule.BootLoadErrors = str;
            }
            bootString = bootString.Replace("[OSBoot1]", newValue1);
            string newValue2 = "ERROR: " + LocaleTerms.Loc("Unable to Load System file bootcfg.dll") + "\n";

            if (folder.containsFile("bootcfg.dll"))
            {
                newValue2 = "Loaded bootcfg.dll : Boot Config Module Loaded";
            }
            else
            {
                this.os.failBoot();
                flag = false;
                CrashModule crashModule = this;
                string      str         = crashModule.BootLoadErrors + newValue2 + " \n";
                crashModule.BootLoadErrors = str;
            }
            bootString = bootString.Replace("[OSBoot2]", newValue2);
            string newValue3 = "ERROR: " + LocaleTerms.Loc("Unable to Load System file netcfgx.dll") + "\n";

            if (folder.containsFile("netcfgx.dll"))
            {
                newValue3 = "Loaded netcfgx.dll : Network Config Module Loaded";
            }
            else
            {
                this.os.failBoot();
                flag = false;
                CrashModule crashModule = this;
                string      str         = crashModule.BootLoadErrors + newValue3 + " \n";
                crashModule.BootLoadErrors = str;
            }
            bootString = bootString.Replace("[OSBoot3]", newValue3);
            string newValue4 = "ERROR: " + LocaleTerms.Loc("Unable to Load System file x-server.sys") + "\nERROR: " + LocaleTerms.Loc("Locate and restore a valid x-server file in ~/sys/ folder to restore UX functionality") + "\nERROR: " + LocaleTerms.Loc("Consider examining reports in ~/log/ for problem cause and source") + "\nERROR: " + LocaleTerms.Loc("System UX resources unavailable -- defaulting to terminal mode") + "\n .\n .\n .\n";

            if (folder.containsFile("x-server.sys"))
            {
                newValue4 = "Loaded x-server.sys : UX Graphics Module Loaded";
                ThemeManager.switchTheme((object)this.os, ThemeManager.getThemeForDataString(folder.searchForFile("x-server.sys").data));
                this.graphicsErrorsDetected = false;
            }
            else
            {
                this.os.graphicsFailBoot();
                flag = false;
                this.graphicsErrorsDetected = true;
                CrashModule crashModule = this;
                string      str         = crashModule.BootLoadErrors + newValue4 + " \n";
                crashModule.BootLoadErrors = str;
            }
            bootString = bootString.Replace("[OSBootTheme]", newValue4);
            if (flag)
            {
                if (this.os.Flags.HasFlag("BootFailure") && !this.os.Flags.HasFlag("BootFailureThemeSongChange") && ThemeManager.currentTheme != OSTheme.HacknetBlue)
                {
                    this.os.Flags.AddFlag("BootFailureThemeSongChange");
                    if (MusicManager.isPlaying)
                    {
                        MusicManager.stop();
                    }
                    MusicManager.loadAsCurrentSong("Music\\The_Quickening");
                }
                this.os.sucsesfulBoot();
            }
            else
            {
                this.os.Flags.AddFlag("BootFailure");
            }
            return(bootString);
        }