private void Given_Platform(IPlatform platform)
 {
     this.oe       = mr.Stub <OperatingEnvironment>();
     this.platform = platform;
     this.cfgSvc.Stub(c => c.GetEnvironment("testOS")).Return(oe);
     oe.Stub(e => e.Load(sc, null)).IgnoreArguments().Return(platform);
 }
Exemple #2
0
 private void Given_Platform(IPlatform platform)
 {
     this.oe = mr.Stub<OperatingEnvironment>();
     this.platform = platform;
     this.cfgSvc.Stub(c => c.GetEnvironment("testOS")).Return(oe);
     oe.Stub(e => e.Load(sc, null)).IgnoreArguments().Return(platform);
 }
Exemple #3
0
        public IHttpActionResult GetEnvironment()
        {
            try
            {
                String showEnvironment = System.Configuration.ConfigurationManager.AppSettings["showEnvironment"];
                String environmentName = System.Configuration.ConfigurationManager.AppSettings["environmentName"];
                String cssClass        = System.Configuration.ConfigurationManager.AppSettings["cssClass"];

                DateTime buildDate = File.GetCreationTime(Assembly.GetExecutingAssembly().Location);
                Version  version   = Assembly.GetExecutingAssembly().GetName().Version;

                OperatingEnvironment model = new OperatingEnvironment()
                {
                    ShowEnvironment = showEnvironment,
                    EnvironmentName = environmentName,
                    CssClass        = cssClass,
                    BuildDate       = buildDate,
                    Version         = "v" + version.ToString(4)
                };

                return(Ok(model));
            }
            catch (Exception exception)
            {
                return(InternalServerError(exception));
            }
        }
Exemple #4
0
 private void Given_TestOS()
 {
     this.oe = mr.Stub<OperatingEnvironment>();
     this.platform = mr.Stub<IPlatform>();
     this.cfgSvc.Stub(c => c.GetEnvironment("testOS")).Return(oe);
     oe.Stub(e => e.Load(sc, null)).IgnoreArguments().Return(platform);
     this.platform.Stub(p => p.CreateMetadata()).Return(new TypeLibrary());
 }
 private void Given_TestOS()
 {
     this.oe       = mr.Stub <OperatingEnvironment>();
     this.platform = mr.Stub <IPlatform>();
     this.cfgSvc.Stub(c => c.GetEnvironment("testOS")).Return(oe);
     oe.Stub(e => e.Load(sc, null)).IgnoreArguments().Return(platform);
     this.platform.Stub(p => p.CreateMetadata()).Return(new TypeLibrary());
 }
Exemple #6
0
 public void Setup()
 {
     repository = new MockRepository();
     sc         = new ServiceContainer();
     arch       = new IntelArchitecture(ProcessorMode.Protected32);
     dcSvc      = repository.StrictMock <IConfigurationService>();
     opEnv      = repository.StrictMock <OperatingEnvironment>();
 }
 public void Setup()
 {
     repository = new MockRepository();
     sc = new ServiceContainer();
     arch = new IntelArchitecture(ProcessorMode.Protected32);
     dcSvc = repository.StrictMock<IConfigurationService>();
     opEnv = repository.StrictMock<OperatingEnvironment>();
 }
 public void SetOperatingEnvironment(OperatingEnvironment operatingEnvironment)
 {
     this.operatingEnvironment = operatingEnvironment;
 }
Exemple #9
0
        public bool OpenBinaryAs()
        {
            IOpenAsDialog          dlg  = null;
            IProcessorArchitecture arch = null;

            try
            {
                dlg                     = dlgFactory.CreateOpenAsDialog();
                dlg.Services            = sc;
                dlg.ArchitectureOptions = new Dictionary <string, object>();
                if (uiSvc.ShowModalDialog(dlg) != DialogResult.OK)
                {
                    return(true);
                }

                var               rawFileOption = (ListOption)dlg.RawFileTypes.SelectedValue;
                string            archName      = null;
                string            envName       = null;
                string            sAddr         = null;
                string            loader        = null;
                EntryPointElement entry         = null;
                if (rawFileOption != null && rawFileOption.Value != null)
                {
                    var raw = (RawFileElement)rawFileOption.Value;
                    loader   = raw.Loader;
                    archName = raw.Architecture;
                    envName  = raw.Environment;
                    sAddr    = raw.BaseAddress;
                    entry    = raw.EntryPoint;
                }
                Architecture         archOption = dlg.GetSelectedArchitecture();
                OperatingEnvironment envOption  = dlg.GetSelectedEnvironment();
                archName = archName ?? archOption?.Name;
                envName  = envName ?? envOption?.Name;
                sAddr    = sAddr ?? dlg.AddressTextBox.Text.Trim();
                arch     = config.GetArchitecture(archName);
                if (arch == null)
                {
                    throw new InvalidOperationException(string.Format("Unable to load {0} architecture.", archName));
                }
                arch.LoadUserOptions(dlg.ArchitectureOptions);
                if (!arch.TryParseAddress(sAddr, out var addrBase))
                {
                    throw new ApplicationException(string.Format("'{0}' doesn't appear to be a valid address.", sAddr));
                }

                var details = new LoadDetails
                {
                    LoaderName          = loader,
                    ArchitectureName    = archName,
                    ArchitectureOptions = dlg.ArchitectureOptions,
                    PlatformName        = envName,
                    LoadAddress         = sAddr,
                    EntryPoint          = entry,
                };

                OpenBinary(dlg.FileName.Text, (f) =>
                           pageInitial.OpenBinaryAs(
                               f,
                               details));
            }
            catch (Exception ex)
            {
                uiSvc.ShowError(
                    ex,
                    string.Format("An error occurred when opening the binary file {0}.", dlg.FileName.Text));
            }
            return(true);
        }