예제 #1
0
        internal PartAnimation(PartAnimation copyFromAnimation)
        {
            EventTrigger        = copyFromAnimation.EventTrigger;
            RotationSet         = copyFromAnimation.RotationSet;
            RotCenterSet        = copyFromAnimation.RotCenterSet;
            CurrentEmissivePart = copyFromAnimation.CurrentEmissivePart;
            AnimationId         = copyFromAnimation.AnimationId;
            ResetEmissives      = copyFromAnimation.ResetEmissives;
            EmissiveIds         = copyFromAnimation.EmissiveIds;

            //Unique Animation ID
            _uid = Guid.NewGuid();

            TypeSet          = copyFromAnimation.TypeSet;
            Muzzle           = copyFromAnimation.Muzzle;
            MoveToSetIndexer = copyFromAnimation.MoveToSetIndexer;
            NumberOfMoves    = copyFromAnimation.NumberOfMoves;
            System           = copyFromAnimation.System;
            SubpartId        = copyFromAnimation.SubpartId;
            MotionDelay      = copyFromAnimation.MotionDelay;
            DoesLoop         = copyFromAnimation.DoesLoop;
            DoesReverse      = copyFromAnimation.DoesReverse;
            TriggerOnce      = copyFromAnimation.TriggerOnce;
            _currentMove     = 0;
            MovesPivotPos    = copyFromAnimation.MovesPivotPos;
            FinalPos         = copyFromAnimation.FinalPos;
            HomePos          = copyFromAnimation.HomePos;
            HasMovement      = copyFromAnimation.HasMovement;
            EmissiveParts    = copyFromAnimation.EmissiveParts;
            EventIdLookup    = copyFromAnimation.EventIdLookup;
        }
예제 #2
0
 private void UpdateUiFormArgs()
 {
     if (tmpargs.AzField != null)
     {
         presentationBox1.Text = tmpargs.AzField.Description.Name;
         IImageInfoFactory imgSvc = CoreSystem.GetService <IImageInfoFactory>(tmpargs.AzField);
         presentationBox1.Image = imgSvc.GetImageInfo(tmpargs.AzField).TypeImage;
     }
     else
     {
         presentationBox1.Text  = "";
         presentationBox1.Image = null;
     }
     if (tmpargs.HeiField != null)
     {
         presentationBox2.Text = tmpargs.HeiField.Description.Name;
         IImageInfoFactory imgSvc = CoreSystem.GetService <IImageInfoFactory>(tmpargs.HeiField);
         presentationBox2.Image = imgSvc.GetImageInfo(tmpargs.HeiField).TypeImage;
     }
     else
     {
         presentationBox2.Text  = "";
         presentationBox2.Image = null;
     }
     btnOK.Enabled = !(tmpargs.AzField == null || tmpargs.HeiField == null);
 }
예제 #3
0
        static void Main(string[] args)
        {
            try
            {
                // Reading serialized files
                Stock.ReadComponents();
                Stock.ReadDevices();
                SerialsNumbers.ReadSerialsNumbers();

                // Login operator
                LoginOperators.Login.OperatorLog = new LoginOperators.Operator("Test", "Console", 9999, 9999);

                // Work order selection
                CoreSystem.SelectedOrder = new InternalOrder(9999, ECode.CNT_BioPanel_ACC, EType.PanelAccess, 3);

                // Device creation using your own creation method
                CoreSystem.LoadDevices(EType.PanelAccess, EValidation.Finger);
                CoreSystem.PreviewDevices.Add(CoreSystem.DeviceAssembly);

                // Manual addition of device
                CoreSystem.PreviewDevices.Add(new AccessControl(ECode.CNT_A60_ID, EType.AccessControl, EValidation.Finger));
                CoreSystem.PreviewDevices.Add(new AccessPanel(ECode.CNT_BioPanel_ACC, EType.PanelAccess, EValidation.Finger));
                CoreSystem.PreviewDevices.Add(new Attendance(ECode.CNT_E7_CR, EType.Attendance, EValidation.Finger));

                // All data in the list is printed
                Console.WriteLine(Device.Info(CoreSystem.PreviewDevices));
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
            Console.ReadLine();
        }
예제 #4
0
 /// <summary>
 /// Initialize a new instance of <see cref="SystemInfo"/>
 /// </summary>
 /// <param name="displayName">A <see cref="string"/> that specify how the system name is displayed</param>
 /// <param name="system">A <see cref="CoreSystem"/> that specify what core is used</param>
 /// <param name="maxControllers">Maximum controller allowed by this system</param>
 /// <param name="availableButtons">Which buttons are available (i.e. are actually on the controller) for this system</param>
 private SystemInfo(string displayName, CoreSystem system, int maxControllers, JoypadButton availableButtons)
 {
     _DisplayName      = displayName;
     _System           = system;
     _MaxControllers   = maxControllers;
     _AvailableButtons = availableButtons;
 }
예제 #5
0
 /// <summary>
 /// Initialize a new instance of <see cref="SystemInfo"/>
 /// </summary>
 /// <param name="displayName">A <see cref="string"/> that specify how the system name is displayed</param>
 /// <param name="system">A <see cref="CoreSystem"/> that specify what core is used</param>
 /// <param name="maxControllers">Maximum controller allowed by this system</param>
 /// <param name="availableButtons">Which buttons are available (i.e. are actually on the controller) for this system</param>
 private SystemInfo(string displayName, CoreSystem system, int maxControllers, JoypadButton availableButtons)
 {
     _DisplayName = displayName;
     _System = system;
     _MaxControllers = maxControllers;
     _AvailableButtons = availableButtons;
 }
예제 #6
0
        /// <summary>
        /// Initializes a new instance of the <see cref="SystemInfo"/> class
        /// </summary>
        /// <param name="displayName">A <see cref="string"/> that specify how the system name is displayed</param>
        /// <param name="system">A <see cref="CoreSystem"/> that specify what core is used</param>
        /// <param name="maxControllers">Maximum controller allowed by this system</param>
        /// <param name="availableButtons">Which buttons are available (i.e. are actually on the controller) for this system</param>
        private SystemInfo(string displayName, CoreSystem system, int maxControllers, JoypadButton availableButtons = 0)
        {
            DisplayName      = displayName;
            System           = system;
            MaxControllers   = maxControllers;
            AvailableButtons = availableButtons;

            _allSystemInfos.Add(this);
        }
예제 #7
0
 internal void Clean()
 {
     System        = null;
     HitPos        = Vector3D.Zero;
     Ai            = null;
     ConsumableDef = null;
     AttackerId    = 0;
     Damage        = 0;
     Hits          = 0;
 }
        private void InitSystem()
        {
            _system = FindObjectOfType <CoreSystem>();

            if (_system == null)
            {
                _system = new GameObject(nameof(ApplicationSystem)).AddComponent <ApplicationSystem>();
                Debug.Log("[CoreSystem] Created " + _system.name);
            }
        }
예제 #9
0
 /// <summary>
 /// Build a device.
 /// </summary>
 private void BuilderDevice()
 {
     try
     {
         CoreSystem.ListAssembly = null;
         CoreSystem.LoadListAssembly(eType, eValidation);
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "NO BUILDER DEVICES!", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
예제 #10
0
        public override void Execute(Slb.Ocean.Petrel.Contexts.Context context)
        {
            //TODO: Add command execution logic here

            /*
             * Template twtTemplate = PetrelProject.WellKnownTemplates.GeometricalGroup.TimeTwoWay;
             *
             * ITemplateSettingsInfoFactory factory = CoreSystem.GetService<ITemplateSettingsInfoFactory>(twtTemplate);
             * TemplateSettingsInfo info = factory.GetTemplateSettingsInfo(twtTemplate);
             * //arguments.Label = info.LegendLabel;
             * //arguments.DisplayUnit = info.Unit.Symbol;
             * //arguments.Precision = info.NumericPrecision.PrecisionValue;
             *
             * // create custom template with more detailed info
             * TemplateCollection parent = twtTemplate.TemplateCollection;
             * ITemplateService ts = PetrelSystem.TemplateService;
             * string newName = ts.GetUniqueName("My New Detailed Time");
             * Template newTWT = Template.NullObject;
             *
             * using (ITransaction txn = DataManager.NewTransaction())
             * {
             *  txn.Lock(parent);
             *  newTWT = parent.CreateTemplate(newName, info.DefaultColorTable, twtTemplate.UnitMeasurement);
             *  newTWT.Comments = "New two way time with more digits";
             *  newTWT.TemplateType = twtTemplate.TemplateType.;
             *  txn.Commit();
             * }
             * factory = CoreSystem.GetService<ITemplateSettingsInfoFactory>(newTWT);
             * TemplateSettingsInfo info2 = factory.GetTemplateSettingsInfo(newTWT);
             * info2.NumericPrecision = new NumericPrecision(6, WellKnownPrecisionTypes.DecimalPlaces);
             */

            PetrelLogger.InfoOutputWindow(string.Format("{0} clicked", @"GetTemplateIcon"));
            foreach (object obj in context.GetSelectedObjects())
            {
                Template         g     = obj as Template;
                string           gname = "D:\\test\\" + obj.GetHashCode() + ".bmp";
                ITemplateService imageFact;
                imageFact = CoreSystem.GetService <ITemplateService>();
                Bitmap imageInfo = imageFact.GetTemplateTypeImage(g.TemplateType);
                using (MemoryStream mem = new MemoryStream())
                {
                    //这句很重要,不然不能正确保存图片或出错(关键就这一句)
                    Bitmap bmp = new Bitmap(imageInfo);
                    //保存到磁盘文件
                    bmp.Save(gname, imageInfo.RawFormat);
                    bmp.Dispose();
                    MessageBox.Show("附件另存成功!", "注意", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    MessageBox.Show("附件另存成功a");
                }
            }
        }
예제 #11
0
 public SingleRom(CoreSystem system, string romHash)
 {
     if (system == CoreSystem.Null)
     {
         throw new ArgumentException("there are no roms for the NULL system", nameof(system));
     }
     if (!romHash.IsHex())
     {
         throw new ArgumentException("misformatted hash", nameof(romHash));
     }
     _system  = system;
     _romHash = romHash;
 }
예제 #12
0
        private static void UpdateWellPresenterFromWell(PresentationBox presenter, Borehole borehole)
        {
            var nameInfoFactory  = CoreSystem.GetService <INameInfoFactory>(borehole);
            var imageInfoFactory = CoreSystem.GetService <IImageInfoFactory>(borehole);
            //
            var nameInfo  = nameInfoFactory?.GetNameInfo(borehole);
            var imageInfo = imageInfoFactory?.GetImageInfo(borehole);

            //
            presenter.Text  = nameInfo?.Name;
            presenter.Image = imageInfo?.GetDisplayImage(new ImageInfoContext());
            presenter.Tag   = borehole;
        }
예제 #13
0
 public RomWhitelist(CoreSystem system, params string[] romHashes)
 {
     if (system == CoreSystem.Null)
     {
         throw new ArgumentException("there are no roms for the NULL system", nameof(system));
     }
     if (!romHashes.All(NumericStringExtensions.IsHex))
     {
         throw new ArgumentException("misformatted hash", nameof(romHashes));
     }
     _system    = system;
     _romHashes = romHashes.ToList();
 }
예제 #14
0
        public override void Enter()
        {
            InitUI();

            // You can load pretty much any popular audio format.
            // I'd recommend .ogg for music, tho.
            _sound         = CoreSystem.LoadStreamedSound("test.mp3");
            _sound.Looping = true;
            //sound.LowPass = 0.1f;
            //sound.Volume = 2;
            //sound.Pitch = 2;

            _channel = _sound.Play();
        }
예제 #15
0
        private void seismicCubeToolStripMenuItem_Click(object sender, EventArgs e)
        {
            /*
             * Send object code is o
             * Object Type for Seismic Cube is 0
             */
            /*tryclass o1 = new tryclass(1, 'a');
             * tryclass o2 = new tryclass(2, 'b');
             * tryclass o3 = new tryclass(3, 'c');
             * List<string> ObjList = new List<string>();
             * List<tryclass> obj = new List<tryclass>();
             * ObjList.Add("1");
             * ObjList.Add("2");
             * ObjList.Add("3");
             * obj.Add(o1);
             * obj.Add(o2);
             * obj.Add(o3);*/
            List <SeismicCube> col      = Discuss.getAllSeismicCubes();
            List <string>      colNames = new List <string>();

            foreach (SeismicCube cube in col)
            {
                colNames.Add(cube.Name);
            }
            objSelect selector = new objSelect("Select an object", colNames);

            if (selector.ShowDialog() == DialogResult.OK && objSelect.SelectedIndex >= 0)
            {
                try
                {
                    String name = colNames[objSelect.SelectedIndex];
                    ClientForm.sendObject = col[objSelect.SelectedIndex];
                    string      fileName = Path.GetTempFileName().Split('.')[0] + ".segy";
                    ISegyFormat segyFormat;
                    segyFormat = CoreSystem.GetService <ISegyFormat>();
                    segyFormat.ExportSeismic3D(fileName, col[objSelect.SelectedIndex]);
                    FileInfo f = new FileInfo(fileName);
                    swSender.WriteLine(add + "\"4\"" + myIp + "\"1987\"" + fileName + "\"" + f.Length + "\"1");
                    //swSender.WriteLine(add + "\"o\"0\"" + myIp + "\"1987\"" + name);     // address"o"1"myIp"1987"objname
                    swSender.Flush();
                    this.UpdateLog("Request has been sent for Seismic Cube transfer");
                    messageBox.Lines = null;
                }
                catch
                {
                    MessageBox.Show("Error Sending Seismic cube!", "File Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
예제 #16
0
            internal void LoadMainForm()
            {
                m_mainForm       = new JBGameMainForm();
                m_mainForm.Load += m_mainForm_Load;
                //initialize the main form

                try
                {
                    CoreSystem.Init();
                    Application.Run(m_mainForm);
                }
                catch (Exception ex) {
                    JBGameExceptionDialog.ShowException(ex, "MainForm");
                }
            }
예제 #17
0
        /// <summary>
        /// Initialize a new instance of <see cref="BizHawkExternalToolUsageAttribute"/>
        /// </summary>
        /// <param name="usage"><see cref="BizHawkExternalToolUsage"/> i.e. what your external tool is for</param>
        /// <param name="system"><see cref="CoreSystem"/> that your external tool is used for</param>
        /// <param name="gameHash">The game hash, unique game ID (see in the game database)</param>
        public BizHawkExternalToolUsageAttribute(BizHawkExternalToolUsage usage, CoreSystem system, string gameHash)
        {
            if (usage == BizHawkExternalToolUsage.EmulatorSpecific && system == CoreSystem.Null)
            {
                throw new InvalidOperationException("A system must be set");
            }
            if (usage == BizHawkExternalToolUsage.GameSpecific && gameHash.Trim() == string.Empty)
            {
                throw new InvalidOperationException("A game hash must be set");
            }

            _ToolUsage = usage;
            _System = system;
            _GameHash = gameHash;
        }
        /// <summary>
        /// Initialize a new instance of <see cref="BizHawkExternalToolUsageAttribute"/>
        /// </summary>
        /// <param name="usage"><see cref="BizHawkExternalToolUsage"/> i.e. what your external tool is for</param>
        /// <param name="system"><see cref="CoreSystem"/> that your external tool is used for</param>
        /// <param name="gameHash">The game hash, unique game ID (see in the game database)</param>
        public BizHawkExternalToolUsageAttribute(BizHawkExternalToolUsage usage, CoreSystem system, string gameHash)
        {
            if (usage == BizHawkExternalToolUsage.EmulatorSpecific && system == CoreSystem.Null)
            {
                throw new InvalidOperationException("A system must be set");
            }
            if (usage == BizHawkExternalToolUsage.GameSpecific && gameHash.Trim() == string.Empty)
            {
                throw new InvalidOperationException("A game hash must be set");
            }

            _ToolUsage = usage;
            _System    = system;
            _GameHash  = gameHash;
        }
예제 #19
0
        public void convertToSeismic(string fileName)
        {
            // Check if parent collection contains any 2D data
            SeismicCollection coll = (SeismicCollection)FTReciever.parent;

            while (coll.MemberType == typeof(SeismicLine2DCollection))
            {
                MessageBox.Show("The Seismic Collection you selected was of SeismicLine2DCollection");
                List <SeismicCollection> cols  = Discuss.getAllSeismicCollections();
                List <string>            names = new List <string>();
                foreach (SeismicCollection col in cols)
                {
                    names.Add(col.Name);
                }
                objSelect selector = new objSelect("Select a Seismic collection to add the cube to", names);
                if (selector.ShowDialog() == DialogResult.Cancel)
                {
                    return;
                }
                coll = cols[objSelect.SelectedIndex];
            }
            // Get Service

            ISegyFormat segyFormat = CoreSystem.GetService <ISegyFormat>();
            // Find property version
            IPropertyVersionService pvService = PetrelSystem.PropertyVersionService;
            ITemplate       seisTemplate      = PetrelUnitSystem.TemplateGroupSeismicColor.SeismicDefault;
            PropertyVersion pv   = pvService.FindOrCreate(PetrelSystem.GetGlobalPropertyVersionContainer(), seisTemplate);
            SeismicCube     cube = SeismicCube.NullObject;

            // Lock the parent
            using (ITransaction txn = DataManager.NewTransaction())
            {
                try
                {
                    txn.Lock(coll);
                    cube = segyFormat.ImportSeismic3D(fileName, (SeismicCollection)FTReciever.parent, "", Domain.ELEVATION_DEPTH, pv);
                }
                catch (InvalidOperationException e)
                {
                    MessageBox.Show(e.Message);
                }
                finally
                {
                    txn.Commit();
                }
            }
        }
            public override void ExecuteSimple()
            {
                CoreLogger.Debug("Hello World from CoreLogger!");
                PetrelLogger.InfoOutputWindow("Hello World from PetrelLogger!");
                //
                //
                var unitServiceSettings = CoreSystem.GetService <IUnitServiceSettings>();
                // even if we do not already set a coordinate reference system, this method call will pop up the window so we could select one
                var coordinateReferenceSystemName        = PetrelProject.PrimaryProject.GetCoordinateReferenceSystem().Name;
                var coordinateReferenceSystemDescription = PetrelProject.PrimaryProject.GetCoordinateReferenceSystem().Description;

                //
                PetrelLogger.InfoOutputWindow(unitServiceSettings.CurrentUISystem.Name);
                PetrelLogger.InfoOutputWindow(coordinateReferenceSystemName);
                PetrelLogger.InfoOutputWindow(coordinateReferenceSystemDescription);
            }
 private void UpdateUIFormArgs()
 {
     boxWellLog.Text  = "";
     boxWellLog.Image = null;
     boxGrid.Text     = "";
     boxGrid.Image    = null;
     btnApply.Enabled = false;
     btnOK.Enabled    = false;
     btnShow.Enabled  = false;
     ka               = false;
     k                = false;
     boxProp.Text     = "";
     boxProp.Image    = null;
     lblNumCells.Text = "";
     if (tmpargs.NovozhentsevWellLog != null)
     {
         INameInfoFactory nameSvc = CoreSystem.GetService <INameInfoFactory>(tmpargs.NovozhentsevWellLog);
         boxWellLog.Text = string.Format("{0} ({1})", nameSvc.GetNameInfo(tmpargs.NovozhentsevWellLog).Name, tmpargs.NovozhentsevWellLog.Borehole.Description.Name);
         IImageInfoFactory imgSvc = CoreSystem.GetService <IImageInfoFactory>(tmpargs.NovozhentsevWellLog.Borehole);
         boxWellLog.Image = imgSvc.GetImageInfo(tmpargs.NovozhentsevWellLog).TypeImage;
     }
     if (tmpargs.NovozhentsevGrid != null)
     {
         INameInfoFactory nameSvc = CoreSystem.GetService <INameInfoFactory>(tmpargs.NovozhentsevGrid);
         boxGrid.Text = string.Format("{0} - {1}", nameSvc.GetNameInfo(tmpargs.NovozhentsevGrid).Name, Math.Round(tmpargs.NovozhentsevGrid.BoundingBox.Width * tmpargs.NovozhentsevGrid.BoundingBox.Length));
         IImageInfoFactory imgSvc = CoreSystem.GetService <IImageInfoFactory>(tmpargs.NovozhentsevGrid);
         boxGrid.Image = imgSvc.GetImageInfo(tmpargs.NovozhentsevGrid).TypeImage;
     }
     if (tmpargs.NovozhentsevWellLog != null && tmpargs.NovozhentsevGrid != null)
     {
         btnApply.Enabled = true;
         btnOK.Enabled    = true;
     }
     if (tmpargs.NovozhentsevResultProperty != null)
     {
         btnShow.Enabled = true;
         boxProp.Text    = tmpargs.NovozhentsevResultProperty.Description.Name;
         IImageInfoFactory imgSvc = CoreSystem.GetService <IImageInfoFactory>(tmpargs.NovozhentsevResultProperty);
         boxProp.Image = imgSvc.GetImageInfo(tmpargs.NovozhentsevResultProperty).TypeImage;
     }
     if (tmpargs.NovozhentsevNumCells != 0)
     {
         lblNumCells.Text      = tmpargs.NovozhentsevNumCells.ToString();
         lblNumCells.TextAlign = ContentAlignment.MiddleCenter;
     }
 }
예제 #22
0
        private void InitSystem()
        {
            _system = FindObjectOfType(typeof(CoreSystem)) as CoreSystem;

            if (_system == null)
            {
#if UNITY_EDITOR
                var appSystem = Resources.Load <ApplicationSystem>(DEBUG_APPSYS_PREFAB_PATH);
                Instantiate(appSystem.gameObject);
                _system = appSystem;
                Debug.Log("[CoreSystem] Created " + appSystem.name);
#else
                Debug.LogError("Can't find ApplicationSystem on this scene, please add it and start again!");
                throw new Exception("Can't find ApplicationSystem on this scene, please add it and start again!");
#endif
            }
        }
예제 #23
0
        public MainViewModel(Action bringToFront)
        {
            _bringToFront = bringToFront;
            _core         = new CoreSystem();

            _running = false;

            StartCommand       = new RelayCommand(Start, CanStart);
            StopCommand        = new RelayCommand(Stop, CanStop);
            CloseWindowCommand = new RelayCommand(Close);

            _core.Time
            .Select(state => new
            {
                RemainingTime   = state.RemainingTime.ToString(),
                ProgressPercent = ComputerPercentage(state.InitialDuration, state.RemainingTime)
            })
            .ObserveOnDispatcher()
            .Subscribe(state =>
            {
                Progress        = state.RemainingTime;
                ProgressPercent = state.ProgressPercent;
            });

            _core.Cycle
            .Select(cycle => new
            {
                CycleNumber   = cycle.CycleNumber,
                CycleName     = GetCycleName(cycle.Type),
                ProgressState = GetProgressState(cycle.Type),
                Type          = cycle.Type
            })
            .ObserveOnDispatcher()
            .Subscribe(cycle =>
            {
                CycleName     = cycle.CycleName;
                CycleNumber   = cycle.CycleNumber;
                ProgressState = cycle.ProgressState;
                _running      = cycle.Type != CycleTypes.NotWorking;

                _bringToFront();
                System.Media.SystemSounds.Beep.Play();
            });
        }
예제 #24
0
        private void ClickCallBackSearch(object sender, EventArgs e)
        {
            //PetrelLogger.InfoBox("Inside  ClickCallBackSearch");
            var dockManager = CoreSystem.GetService <IDockManager>();



            if (dockManager != null)
            {
                if (usercontrol != null)
                {
                    var isPanelVisible = dockManager.IsContentVisible(usercontrol.Key);
                    dockManager.SetContentVisible(usercontrol.Key, !isPanelVisible);
                }
                else
                {
                    usercontrol = new UserControl1();

                    ContentDescription   cdpdescrption        = new ContentDescription(usercontrol.Key, usercontrol.Title);
                    ControlFactoryMethod filterControlFactory = delegate
                    {
                        var view = usercontrol;

                        // Avoid exception on application exit. Sergey is going to fix it:
                        if (view.Parent != null)
                        {
                            return(new System.Windows.Forms.UserControl());
                        }

                        return(new ElementHost()
                        {
                            Child = view,
                            Text = usercontrol.Title
                        });
                    };
                    dockManager.InstallContent(filterControlFactory, cdpdescrption,
                                               DockedLocation.Floating, new System.Drawing.Size(300, 300));
                    var isPanelVisible = dockManager.IsContentVisible(usercontrol.Key);
                    dockManager.SetContentVisible(usercontrol.Key, !isPanelVisible);
                }
            }
        }
            public override void ExecuteSimple()
            {
                // extract data from arguments
                var templateName        = arguments.Name;
                var templatePrecision   = arguments.Precision;
                var templateDisplayUnit = arguments.DisplayUnit;
                var templateLabel       = arguments.Label;
                //
                // find an appropriate measurment
                var timeMeasurement = PetrelUnitSystem.GetUnitMeasurement("Time");
                //
                // find an appropriate template collection
                var timeTwoWayTemplate            = PetrelProject.WellKnownTemplates.GeometricalGroup.TimeTwoWay;
                var geometricalTemplateCollection = timeTwoWayTemplate.TemplateCollection;
                //
                // find an appropriate color table
                var colorTableRoot = ColorTableRoot.Get(PetrelProject.PrimaryProject);
                var generalContinuousColorTable = colorTableRoot.WellKnownColorTables.Other.GeneralContinuous;
                //
                // find appropriate unit
                var unitServiceSettingsService = CoreSystem.GetService <IUnitServiceSettings>();
                var templateUnit = unitServiceSettingsService?.CurrentCatalog.GetUnit(templateDisplayUnit);

                //
                using (var transaction = DataManager.NewTransaction())
                {
                    transaction.Lock(geometricalTemplateCollection);
                    //
                    var uniqueTemplateName = PetrelSystem.TemplateService.GetUniqueName(templateName);
                    var canCreateTemplate  = geometricalTemplateCollection.CanCreateTemplate(timeTwoWayTemplate);
                    if (canCreateTemplate)
                    {
                        var newTemplate = geometricalTemplateCollection.CreateTemplate(uniqueTemplateName, generalContinuousColorTable, timeMeasurement, templateUnit);
                        if (newTemplate != null)
                        {
                            PetrelLogger.InfoOutputWindow("Create a new template with name " + uniqueTemplateName);
                        }
                    }
                    //
                    transaction.Commit();
                }
            }
예제 #26
0
        public override void Modify(Resource resource, Context context)
        {
            // find the current item
            Borehole borehole = context.GetParameter <Borehole>(CommandParameterIds.Option);

            //
            if (borehole == Borehole.NullObject)
            {
                return;
            }
            //
            // set attributes
            PetrelSystem.ResourceManager.SetAttributeValue(resource, WellKnownResourceAttributes.OptionText, borehole.Name);
            //
            var imageInfoFactory = CoreSystem.GetService <IImageInfoFactory>(borehole);
            var boreholeImage    = ImageData.FromImage(imageInfoFactory.GetImageInfo(borehole).GetDisplayImage(new ImageInfoContext()));

            PetrelSystem.ResourceManager.SetAttributeValue(resource, WellKnownResourceAttributes.OptionImage16, boreholeImage);
            PetrelSystem.ResourceManager.SetAttributeValue(resource, WellKnownResourceAttributes.OptionImage32, boreholeImage);
        }
예제 #27
0
 internal void InitVirtual(Weapon weapon, ConsumableDef ammodef, MyEntity primeEntity, MyEntity triggerEntity, Weapon.Muzzle muzzle, double maxTrajectory, float shotFade)
 {
     IsVirtual         = true;
     System            = weapon.System;
     Ai                = weapon.Comp.Ai;
     MyPlanet          = weapon.Comp.Ai.MyPlanet;
     MyShield          = weapon.Comp.Ai.MyShield;
     InPlanetGravity   = weapon.Comp.Ai.InPlanetGravity;
     ConsumableDef     = ammodef;
     PrimeEntity       = primeEntity;
     TriggerEntity     = triggerEntity;
     Target.Entity     = weapon.Target.Entity;
     Target.Projectile = weapon.Target.Projectile;
     Target.FiringCube = weapon.Target.FiringCube;
     WeaponId          = weapon.WeaponId;
     MuzzleId          = muzzle.MuzzleId;
     UniqueMuzzleId    = muzzle.UniqueId;
     Direction         = muzzle.DeviatedDir;
     Origin            = muzzle.Position;
     MaxTrajectory     = maxTrajectory;
     ShotFade          = shotFade;
 }
예제 #28
0
 /// <summary>
 /// Add a device.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void btnAddDevice_Click(object sender, EventArgs e)
 {
     try
     {
         if (CoreSystem.SelectedOrder.ETypeDevice == eType && !(CoreSystem.ListAssembly is null) && this.pressButton == true)
         {
             if (CoreSystem.PreviewDevices.Count < CoreSystem.SelectedOrder.CountDevice || MessageBox.Show($"The quantity requested in the order has already been reached. Do you want to assemble the device anyway?", "LIMIT DEVICES", MessageBoxButtons.YesNo, MessageBoxIcon.Error) == DialogResult.Yes)
             {
                 if (Stock.ThereIsStock(CoreSystem.ListAssembly, out string component))
                 {
                     CoreSystem.LoadDevices(eType, eValidation);
                     CoreSystem.PreviewDevices.Add(CoreSystem.DeviceAssembly);
                     this.pgbStatusOrder.Value = (int)((float)CoreSystem.PreviewDevices.Count / CoreSystem.SelectedOrder.CountDevice * 100);
                     Device.SaveLogDevices(CoreSystem.DeviceAssembly, "Assembly");
                     CoreSystem.DeviceAssembly = null;
                     SerialsNumbers.SaveSerialsNumbers();
                     DAO.ModifyListComponents(Stock.ComponentsStock);
                     PressButton();
                     LoadListAssembly();
                     TrasparentButtonsSubPanel();
                     HideSubMenu();
                     this.lblSerialNumber.Text = "--";
                 }
                 else
                 {
                     MessageBox.Show($"The missing materials are:\n\n{component}", "NO STOCK COMPONENTS!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                 }
             }
         }
         else
         {
             MessageBox.Show("The device to be assembled must be of the same type as the order", "TYPE ERROR!", MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "NO ADD DEVICE!", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
            public override void ExecuteSimple()
            {
                PetrelLogger.InfoOutputWindow($"Executing {typeof(ParentInfoFinderWorkstep).Name}");
                //
                object petrelObject        = arguments.PetrelTreeObject;
                var    parentSourceFactory = CoreSystem.GetService <IParentSourceFactory>(petrelObject);

                //
                if (parentSourceFactory != null)
                {
                    var parentSource = parentSourceFactory.GetParentSource(petrelObject);
                    var parentObject = parentSource.Parent;
                    //
                    var nameInfoFactory = CoreSystem.GetService <INameInfoFactory>(parentObject);
                    //
                    if (nameInfoFactory != null)
                    {
                        var parentNameInfo = nameInfoFactory.GetNameInfo(parentObject);
                        PetrelLogger.InfoOutputWindow($"Parent Info are: Name = {parentNameInfo.Name}; DisplayName = {parentNameInfo.DisplayName}; TypeName = {parentNameInfo.TypeName}");
                    }
                }
            }
예제 #30
0
        public override void OnRegister()
        {
            if (InvokeRequired)
            {
                Invoke((MethodInvoker) delegate() { OnRegister(); });
                return;
            }
            CoreSystem.CheckForIllegalCrossThreadCalls  = false;
            LoginDialog.CheckForIllegalCrossThreadCalls = false;
            loginForm = new LoginDialog();
            mainForm  = new CoreSystem();

            Core.RegisterMediator(loginForm);
            Core.RegisterMediator(mainForm);


            Core.RegisterCommand(DO_LOGIN, new DoLogin());
            Core.RegisterCommand(DO_REGISTER, new DoRegister());
            Core.RegisterCommand(DO_UPDATE_SITES, new DoUpdateSites());
            Core.RegisterCommand(ASK_4_NEW_URL, new DoAskNextUrl());
            Core.SendNotification(SHOW_LOGIN);

            NetworkManager.Start();
        }
예제 #31
0
 /// <summary>
 /// Convert a <see cref="CoreSystem"/> value to BizHawk SystemId <see cref="string"/>
 /// </summary>
 /// <param name="value"><see cref="CoreSystem"/> you want to convert</param>
 /// <returns>A <see cref="string"/> that is used by BizHawk SystemId</returns>
 /// <exception cref="IndexOutOfRangeException">Thrown when <see cref="CoreSystem"/> hasn't been found</exception>
 public string ConvertBack(CoreSystem value)
 {
     return((string)ConvertBack(value, null, null, CultureInfo.CurrentCulture));
 }
예제 #32
0
        //TODO: In order to fix SphereShapes collisions with grids, this needs to be adjusted to take into account the Beam of the projectile
        internal static void GetAndSortBlocksInSphere(WeaponDefinition.ConsumableDef consumableDef, CoreSystem system, MyCubeGrid grid, BoundingSphereD sphere, bool fatOnly, List <IMySlimBlock> blocks)
        {
            var      matrixNormalizedInv = grid.PositionComp.WorldMatrixNormalizedInv;
            Vector3D result;

            Vector3D.Transform(ref sphere.Center, ref matrixNormalizedInv, out result);
            var localSphere = new BoundingSphere(result, (float)sphere.Radius);
            var fieldType   = consumableDef.AreaEffect.AreaEffect;
            var hitPos      = sphere.Center;

            if (fatOnly)
            {
                foreach (var cube in system.Session.GridToInfoMap[grid].MyCubeBocks)
                {
                    if (!(cube is IMyTerminalBlock))
                    {
                        continue;
                    }
                    switch (fieldType)
                    {
                    case JumpNullField:
                        if (!(cube is MyJumpDrive))
                        {
                            continue;
                        }
                        break;

                    case EnergySinkField:
                        if (!(cube is IMyPowerProducer))
                        {
                            continue;
                        }
                        break;

                    case AnchorField:
                        if (!(cube is MyThrust))
                        {
                            continue;
                        }
                        break;

                    case NavField:
                        if (!(cube is MyGyro))
                        {
                            continue;
                        }
                        break;

                    case OffenseField:
                        if (!(cube is IMyGunBaseUser))
                        {
                            continue;
                        }
                        break;

                    case EmpField:
                    case DotField:
                        break;

                    default: continue;
                    }
                    var block = cube.SlimBlock as IMySlimBlock;
                    if (!new BoundingBox(block.Min * grid.GridSize - grid.GridSizeHalf, block.Max * grid.GridSize + grid.GridSizeHalf).Intersects(localSphere))
                    {
                        continue;
                    }
                    blocks.Add(block);
                }
            }
            else
            {
                //usage:
                //var dict = (Dictionary<Vector3I, IMySlimBlock>)GetHackDict((IMySlimBlock) null);
                var tmpList = system.Session.SlimPool.Get();
                Session.GetBlocksInsideSphereFast(grid, ref sphere, true, tmpList);

                for (int i = 0; i < tmpList.Count; i++)
                {
                    blocks.Add(tmpList[i]);
                }

                system.Session.SlimPool.Return(tmpList);
            }

            blocks.Sort((a, b) =>
            {
                var aPos = grid.GridIntegerToWorld(a.Position);
                var bPos = grid.GridIntegerToWorld(b.Position);
                return(Vector3D.DistanceSquared(aPos, hitPos).CompareTo(Vector3D.DistanceSquared(bPos, hitPos)));
            });
        }
예제 #33
0
 /// <summary>
 /// Initialize a new instance of <see cref="BizHawkExternalToolUsageAttribute"/>
 /// </summary>
 /// <param name="usage"><see cref="BizHawkExternalToolUsage"/> i.e. what your external tool is for</param>
 /// <param name="system"><see cref="CoreSystem"/> that your external tool is used for</param>		
 public BizHawkExternalToolUsageAttribute(BizHawkExternalToolUsage usage, CoreSystem system)
     : this(usage, system, string.Empty)
 {
 }
예제 #34
0
 /// <summary>
 /// Get a <see cref="SystemInfo"/> by its <see cref="CoreSystem"/>
 /// </summary>
 /// <param name="system"><see cref="CoreSystem"/> you're looking for</param>
 /// <returns>Mathing <see cref="SystemInfo"/></returns>
 public static SystemInfo FindByCoreSystem(CoreSystem system)
 {
     return allSystemInfos.Find(s => s._System == system);
 }
예제 #35
0
 /// <summary>
 /// Initialize a new instance of <see cref="SystemInfo"/>
 /// </summary>
 /// <param name="displayName">A <see cref="string"/> that specify how the system name is displayed</param>
 /// <param name="system">A <see cref="CoreSystem"/> that specify what core is used</param>
 /// <param name="maxControllers">Maximum controller allowed by this system</param>
 private SystemInfo(string displayName, CoreSystem system, int maxControllers)
     : this(displayName, system, maxControllers, 0)
 {
 }
예제 #36
0
 /// <summary>
 /// Convert a <see cref="CoreSystem"/> value to BizHawk SystemId <see cref="string"/>
 /// </summary>
 /// <param name="value"><see cref="CoreSystem"/> you want to convert</param>
 /// <returns>A <see cref="string"/> that is used by BizHawk SystemId</returns>
 /// <exception cref="IndexOutOfRangeException">Thrown when <see cref="CoreSystem"/> hasn't been found</exception>
 public string ConvertBack(CoreSystem value)
 {
     return (string)ConvertBack(value, null, null, CultureInfo.CurrentCulture);
 }
예제 #37
0
파일: CoreSystem.cs 프로젝트: Meith/Sense3
 void Awake()
 {
     coolDownTimeInSeconds = coolDownTime;
     instance = this;
     coolDownFlag = false;
 }