Esempio n. 1
0
 static MyToolbarItemFactory()
 {
     m_objectFactory = new MyObjectFactory <MyToolbarItemDescriptor, MyToolbarItem>();
     m_objectFactory.RegisterFromAssembly(Assembly.GetAssembly(typeof(MyToolbarItem)));
     m_objectFactory.RegisterFromAssembly(MyPlugins.GameAssembly);
     m_objectFactory.RegisterFromAssembly(MyPlugins.UserAssembly);
 }
 static MyToolbarItemFactory()
 {
     m_objectFactory = new MyObjectFactory<MyToolbarItemDescriptor, MyToolbarItem>();
     m_objectFactory.RegisterFromAssembly(Assembly.GetAssembly(typeof(MyToolbarItem)));
     m_objectFactory.RegisterFromAssembly(MyPlugins.GameAssembly);
     m_objectFactory.RegisterFromAssembly(MyPlugins.UserAssembly);
 }
 static StartingStateFactory()
 {
     m_objectFactory = new MyObjectFactory<StartingStateTypeAttribute, MyWorldGeneratorStartingStateBase>();
     m_objectFactory.RegisterFromCreatedObjectAssembly();
     m_objectFactory.RegisterFromAssembly(MyPlugins.GameAssembly);
     m_objectFactory.RegisterFromAssembly(MyPlugins.UserAssembly);
 }
Esempio n. 4
0
#pragma warning restore 649

        internal static void ForceRegisterAssemblies()
        {
            // static MyEntities() called by MySandboxGame.ForceStaticCtor
            RuntimeHelpers.RunClassConstructor(typeof(MyEntities).TypeHandle);
            {
                MyObjectFactory <MyEntityTypeAttribute, MyEntity> factory = _entityFactoryObjectFactory();
                ObjectFactory_RegisterFromAssemblySafe(factory, typeof(MySandboxGame).Assembly); // calling assembly
                ObjectFactory_RegisterFromAssemblySafe(factory, MyPlugins.GameAssembly);
                ObjectFactory_RegisterFromAssemblySafe(factory, MyPlugins.SandboxAssembly);
                ObjectFactory_RegisterFromAssemblySafe(factory, MyPlugins.UserAssembly);
            }

            // static MyGuiManager():
            // MyGuiControlsFactory.RegisterDescriptorsFromAssembly();

            // static MyComponentTypeFactory() called by MyComponentContainer.Add
            RuntimeHelpers.RunClassConstructor(typeof(MyComponentTypeFactory).TypeHandle);
            {
                ComponentTypeFactory_RegisterFromAssemblySafe(typeof(MyComponentContainer).Assembly); // calling assembly
                ComponentTypeFactory_RegisterFromAssemblySafe(MyPlugins.SandboxAssembly);
                ComponentTypeFactory_RegisterFromAssemblySafe(MyPlugins.GameAssembly);
                ComponentTypeFactory_RegisterFromAssemblySafe(MyPlugins.SandboxGameAssembly);
                ComponentTypeFactory_RegisterFromAssemblySafe(MyPlugins.UserAssembly);
            }

            // static MyObjectPoolManager()
            // Render, so should be fine.
        }
 static OperationFactory()
 {
     m_objectFactory = new MyObjectFactory<OperationTypeAttribute, MyWorldGeneratorOperationBase>();
     m_objectFactory.RegisterFromCreatedObjectAssembly();
     m_objectFactory.RegisterFromAssembly(MyPlugins.GameAssembly);
     m_objectFactory.RegisterFromAssembly(MyPlugins.UserAssembly);
 }
 static StartingStateFactory()
 {
     m_objectFactory = new MyObjectFactory <StartingStateTypeAttribute, MyWorldGeneratorStartingStateBase>();
     m_objectFactory.RegisterFromCreatedObjectAssembly();
     m_objectFactory.RegisterFromAssembly(MyPlugins.GameAssembly);
     m_objectFactory.RegisterFromAssembly(MyPlugins.UserAssembly);
 }
Esempio n. 7
0
 static OperationFactory()
 {
     m_objectFactory = new MyObjectFactory <OperationTypeAttribute, MyWorldGeneratorOperationBase>();
     m_objectFactory.RegisterFromCreatedObjectAssembly();
     m_objectFactory.RegisterFromAssembly(MyPlugins.GameAssembly);
     m_objectFactory.RegisterFromAssembly(MyPlugins.UserAssembly);
 }
 static MyComponentFactory()
 {
     m_objectFactory = new MyObjectFactory<MyComponentBuilderAttribute, MyComponentBase>();
     m_objectFactory.RegisterFromAssembly(MyPlugins.GameAssembly);
     m_objectFactory.RegisterFromAssembly(MyPlugins.SandboxGameAssembly);
     m_objectFactory.RegisterFromAssembly(MyPlugins.UserAssembly);
 }
Esempio n. 9
0
 static MyComponentFactory()
 {
     m_objectFactory = new MyObjectFactory <MyComponentBuilderAttribute, MyComponentBase>();
     m_objectFactory.RegisterFromAssembly(MyPlugins.GameAssembly);
     m_objectFactory.RegisterFromAssembly(MyPlugins.SandboxGameAssembly);
     m_objectFactory.RegisterFromAssembly(MyPlugins.UserAssembly);
 }
Esempio n. 10
0
 static TriggerFactory()
 {
     m_objectFactory = new MyObjectFactory <TriggerTypeAttribute, MyTrigger>();
     m_objectFactory.RegisterFromCreatedObjectAssembly();
     //m_objectFactory.RegisterFromAssembly(MyPlugins.GameAssembly);
     //m_objectFactory.RegisterFromAssembly(MyPlugins.UserAssembly);
 }
Esempio n. 11
0
        public static void Main(string[] args)
        {
            /*
             * Create an instance of the LogicContoller class,
             * give it a new instance of the MyObject class,
             * then call the RunLogic method on the instance of
             * the LogicController class
             */
            var myObject        = MyObjectFactory.GenerateMyObject();
            var logicController = new LogicController(myObject);

            logicController.RunLogic();

            /*
             * Create an instance of the FileReader class;
             * Parse the contents of the medicationAttempt1.json;
             * Create a new instance of the LogicController and pass
             * it the parsed medication object;
             * Call the RunLogic method of the LogicController
             */
            var fileReader  = new MyFileReader();
            var fileContent = string.Empty;

            // Only run the logic if we could read the file
            if (fileReader.TryParseFile("medicationAttempt1.json", out fileContent))
            {
                var parsedMedication    = JsonConvert.DeserializeObject <Medication>(fileContent);
                var medsLogicController = new LogicController(parsedMedication);
                medsLogicController.RunLogic();
            }
        }
Esempio n. 12
0
        static MyCubeBlockFactory()
        {
            m_objectFactory = new MyObjectFactory <MyCubeBlockTypeAttribute, object>();
            m_objectFactory.RegisterFromAssembly(Assembly.GetAssembly(typeof(MyCubeBlock)));

            m_objectFactory.RegisterFromAssembly(MyPlugins.GameAssembly);
            m_objectFactory.RegisterFromAssembly(MyPlugins.UserAssembly);
        }
        static MyBehaviorTreeNodeMemoryFactory()
        {
            m_objectFactory = new MyObjectFactory <MyBehaviorTreeNodeMemoryTypeAttribute, MyBehaviorTreeNodeMemory>();
            m_objectFactory.RegisterFromAssembly(Assembly.GetAssembly(typeof(MyBehaviorTreeNodeMemory)));

            m_objectFactory.RegisterFromAssembly(MyPlugins.GameAssembly);
            m_objectFactory.RegisterFromAssembly(MyPlugins.UserAssembly);
        }
        static MyCubeBlockFactory()
        {
            m_objectFactory = new MyObjectFactory<MyCubeBlockTypeAttribute, object>();
            m_objectFactory.RegisterFromAssembly(Assembly.GetAssembly(typeof(MyCubeBlock)));

            m_objectFactory.RegisterFromAssembly(MyPlugins.GameAssembly);
            m_objectFactory.RegisterFromAssembly(MyPlugins.UserAssembly);
        }
        static MyBehaviorTreeNodeFactory()
        {
            m_objectFactory = new MyObjectFactory<MyBehaviorTreeNodeTypeAttribute, MyBehaviorTreeNode>();
            m_objectFactory.RegisterFromAssembly(Assembly.GetAssembly(typeof(MyBehaviorTreeNode)));

            m_objectFactory.RegisterFromAssembly(MyPlugins.GameAssembly);
            m_objectFactory.RegisterFromAssembly(MyPlugins.UserAssembly);
        }
		static MyEntityStatEffectFactory()
		{
			m_objectFactory = new MyObjectFactory<MyEntityStatEffectTypeAttribute, MyEntityStatRegenEffect>();
#if XB1 // XB1_ALLINONEASSEMBLY
            m_objectFactory.RegisterFromAssembly(MyAssembly.AllInOneAssembly);
#else // !XB1
			m_objectFactory.RegisterFromAssembly(Assembly.GetAssembly(typeof(MyEntityStatRegenEffect)));
#endif // !XB1
		}
        static MyBehaviorTreeNodeMemoryFactory()
        {
            m_objectFactory = new MyObjectFactory<MyBehaviorTreeNodeMemoryTypeAttribute, MyBehaviorTreeNodeMemory>();
            m_objectFactory.RegisterFromAssembly(Assembly.GetAssembly(typeof(MyBehaviorTreeNodeMemory)));

            m_objectFactory.RegisterFromAssembly(MyPlugins.GameAssembly);
            m_objectFactory.RegisterFromAssembly(MyPlugins.SandboxAssembly); //TODO: Will be removed 
            m_objectFactory.RegisterFromAssembly(MyPlugins.UserAssembly);
        }
Esempio n. 18
0
        static MyBehaviorTreeNodeFactory()
        {
            m_objectFactory = new MyObjectFactory <MyBehaviorTreeNodeTypeAttribute, MyBehaviorTreeNode>();
            m_objectFactory.RegisterFromAssembly(Assembly.GetAssembly(typeof(MyBehaviorTreeNode)));

            m_objectFactory.RegisterFromAssembly(MyPlugins.GameAssembly);
            m_objectFactory.RegisterFromAssembly(MyPlugins.SandboxAssembly); //TODO: Will be removed
            m_objectFactory.RegisterFromAssembly(MyPlugins.UserAssembly);
        }
        static MyGlobalEventFactory()
        {
            m_typesToHandlers    = new Dictionary <MyDefinitionId, GlobalEventHandler>();
            m_globalEventFactory = new MyObjectFactory <MyEventTypeAttribute, MyGlobalEventBase>();

            RegisterEventTypesAndHandlers(Assembly.GetAssembly(typeof(MyGlobalEventBase)));
            RegisterEventTypesAndHandlers(MyPlugins.GameAssembly);
            RegisterEventTypesAndHandlers(MyPlugins.SandboxAssembly);
        }
        static MyEnvironmentalParticleLogicFactory()
        {
            m_objectFactory = new MyObjectFactory <MyEnvironmentalParticleLogicTypeAttribute, MyEnvironmentalParticleLogic>();
            m_objectFactory.RegisterFromAssembly(Assembly.GetAssembly(typeof(MyEnvironmentalParticleLogic)));

            m_objectFactory.RegisterFromAssembly(MyPlugins.GameAssembly);
            //     m_objectFactory.RegisterFromAssembly(MyPlugins.SandboxAssembly); //TODO: Will be removed
            m_objectFactory.RegisterFromAssembly(MyPlugins.UserAssembly);
        }
		static MyEnvironmentalParticleLogicFactory()
        {
            m_objectFactory = new MyObjectFactory<MyEnvironmentalParticleLogicTypeAttribute, MyEnvironmentalParticleLogic>();
            m_objectFactory.RegisterFromAssembly(Assembly.GetAssembly(typeof(MyEnvironmentalParticleLogic)));

            m_objectFactory.RegisterFromAssembly(MyPlugins.GameAssembly);
            m_objectFactory.RegisterFromAssembly(MyPlugins.SandboxAssembly); //TODO: Will be removed 
            m_objectFactory.RegisterFromAssembly(MyPlugins.UserAssembly);
        }
        static MyEntityStatEffectFactory()
        {
            m_objectFactory = new MyObjectFactory <MyEntityStatEffectTypeAttribute, MyEntityStatRegenEffect>();
#if XB1 // XB1_ALLINONEASSEMBLY
            m_objectFactory.RegisterFromAssembly(MyAssembly.AllInOneAssembly);
#else // !XB1
            m_objectFactory.RegisterFromAssembly(Assembly.GetAssembly(typeof(MyEntityStatRegenEffect)));
#endif // !XB1
        }
        static MyBotFactoryBase()
        {
            m_objectFactory = new MyObjectFactory<MyBotTypeAttribute, IMyBot>();

            var baseAssembly = Assembly.GetAssembly(typeof(MyAgentBot));
            m_objectFactory.RegisterFromAssembly(baseAssembly);
            m_objectFactory.RegisterFromAssembly(VRage.Plugins.MyPlugins.GameAssembly);

            foreach (var plugin in VRage.Plugins.MyPlugins.Plugins)
                m_objectFactory.RegisterFromAssembly(plugin.GetType().Assembly);
        }
Esempio n. 24
0
 public static MyObjectFactory <MyDefinitionTypeAttribute, MyDefinitionBase> GetObjectFactory()
 {
     if (m_definitionFactory == null)
     {
         m_definitionFactory = new MyObjectFactory <MyDefinitionTypeAttribute, MyDefinitionBase>();
         m_definitionFactory.RegisterFromCreatedObjectAssembly();
         m_definitionFactory.RegisterFromAssembly(MyPlugins.GameAssembly);
         m_definitionFactory.RegisterFromAssembly(MyPlugins.UserAssembly);
     }
     return(m_definitionFactory);
 }
        static MyToolbarItemFactory()
        {
            m_objectFactory = new MyObjectFactory <MyToolbarItemDescriptor, MyToolbarItem>();
#if XB1 // XB1_ALLINONEASSEMBLY
            m_objectFactory.RegisterFromAssembly(MyAssembly.AllInOneAssembly);
#else // !XB1
            m_objectFactory.RegisterFromAssembly(Assembly.GetAssembly(typeof(MyToolbarItem)));
            m_objectFactory.RegisterFromAssembly(MyPlugins.GameAssembly);
            m_objectFactory.RegisterFromAssembly(MyPlugins.SandboxAssembly); //TODO: Will be removed
            m_objectFactory.RegisterFromAssembly(MyPlugins.UserAssembly);
#endif // !XB1
        }
            static OperationFactory()
            {
                m_objectFactory = new MyObjectFactory<OperationTypeAttribute, MyWorldGeneratorOperationBase>();
#if XB1 // XB1_ALLINONEASSEMBLY
                m_objectFactory.RegisterFromAssembly(MyAssembly.AllInOneAssembly);
#else // !XB1
                m_objectFactory.RegisterFromCreatedObjectAssembly();
                m_objectFactory.RegisterFromAssembly(MyPlugins.GameAssembly);
                m_objectFactory.RegisterFromAssembly(MyPlugins.SandboxAssembly); //TODO: Will be removed 
                m_objectFactory.RegisterFromAssembly(MyPlugins.UserAssembly);
#endif // !XB1
            }
Esempio n. 27
0
            static StartingStateFactory()
            {
                m_objectFactory = new MyObjectFactory <StartingStateTypeAttribute, MyWorldGeneratorStartingStateBase>();
#if XB1 // XB1_ALLINONEASSEMBLY
                m_objectFactory.RegisterFromAssembly(MyAssembly.AllInOneAssembly);
#else // !XB1
                m_objectFactory.RegisterFromCreatedObjectAssembly();
                m_objectFactory.RegisterFromAssembly(MyPlugins.GameAssembly);
                m_objectFactory.RegisterFromAssembly(MyPlugins.SandboxAssembly); //TODO: Will be removed
                m_objectFactory.RegisterFromAssembly(MyPlugins.UserAssembly);
#endif // !XB1
            }
Esempio n. 28
0
        static MyComponentFactory()
        {
            m_objectFactory = new MyObjectFactory <MyComponentBuilderAttribute, MyComponentBase>();
#if XB1 // XB1_ALLINONEASSEMBLY
            m_objectFactory.RegisterFromAssembly(MyAssembly.AllInOneAssembly);
#else // !XB1
            m_objectFactory.RegisterFromAssembly(Assembly.GetExecutingAssembly());
            m_objectFactory.RegisterFromAssembly(MyPlugins.GameAssembly);
            m_objectFactory.RegisterFromAssembly(MyPlugins.SandboxGameAssembly);
            m_objectFactory.RegisterFromAssembly(MyPlugins.UserAssembly);
#endif // !XB1
        }
        static MyToolbarItemFactory()
        {
            m_objectFactory = new MyObjectFactory<MyToolbarItemDescriptor, MyToolbarItem>();
#if XB1 // XB1_ALLINONEASSEMBLY
            m_objectFactory.RegisterFromAssembly(MyAssembly.AllInOneAssembly);
#else // !XB1
            m_objectFactory.RegisterFromAssembly(Assembly.GetAssembly(typeof(MyToolbarItem)));
            m_objectFactory.RegisterFromAssembly(MyPlugins.GameAssembly);
            m_objectFactory.RegisterFromAssembly(MyPlugins.SandboxAssembly); //TODO: Will be removed 
            m_objectFactory.RegisterFromAssembly(MyPlugins.UserAssembly);
#endif // !XB1
        }
Esempio n. 30
0
        static MyComponentFactory()
        {
            m_objectFactory = new MyObjectFactory<MyComponentBuilderAttribute, MyComponentBase>();
#if XB1 // XB1_ALLINONEASSEMBLY
            m_objectFactory.RegisterFromAssembly(MyAssembly.AllInOneAssembly);
#else // !XB1
            m_objectFactory.RegisterFromAssembly(Assembly.GetExecutingAssembly());
            m_objectFactory.RegisterFromAssembly(MyPlugins.GameAssembly);
            m_objectFactory.RegisterFromAssembly(MyPlugins.SandboxGameAssembly);
            m_objectFactory.RegisterFromAssembly(MyPlugins.UserAssembly);
#endif // !XB1
        }
Esempio n. 31
0
        static MyEnvironmentalParticleLogicFactory()
        {
            m_objectFactory = new MyObjectFactory <MyEnvironmentalParticleLogicTypeAttribute, MyEnvironmentalParticleLogic>();
#if XB1 // XB1_ALLINONEASSEMBLY
            m_objectFactory.RegisterFromAssembly(MyAssembly.AllInOneAssembly);
#else // !XB1
            m_objectFactory.RegisterFromAssembly(Assembly.GetAssembly(typeof(MyEnvironmentalParticleLogic)));

            m_objectFactory.RegisterFromAssembly(MyPlugins.GameAssembly);
            m_objectFactory.RegisterFromAssembly(MyPlugins.SandboxAssembly); //TODO: Will be removed
            m_objectFactory.RegisterFromAssembly(MyPlugins.UserAssembly);
#endif // !XB1
        }
Esempio n. 32
0
        static MyBehaviorTreeNodeFactory()
        {
            m_objectFactory = new MyObjectFactory <MyBehaviorTreeNodeTypeAttribute, MyBehaviorTreeNode>();
#if XB1 // XB1_ALLINONEASSEMBLY
            m_objectFactory.RegisterFromAssembly(MyAssembly.AllInOneAssembly);
#else // !XB1
            m_objectFactory.RegisterFromAssembly(Assembly.GetAssembly(typeof(MyBehaviorTreeNode)));

            m_objectFactory.RegisterFromAssembly(MyPlugins.GameAssembly);
            m_objectFactory.RegisterFromAssembly(MyPlugins.SandboxAssembly); //TODO: Will be removed
            m_objectFactory.RegisterFromAssembly(MyPlugins.UserAssembly);
#endif // !XB1
        }
Esempio n. 33
0
        static MyDefinitionManagerBase()
        {
            m_definitionFactory = new MyObjectFactory <MyDefinitionTypeAttribute, MyDefinitionBase>();
            RegisterTypesFromAssembly(m_definitionFactory.GetType().Assembly);
            RegisterTypesFromAssembly(MyPlugins.GameAssembly);
            RegisterTypesFromAssembly(MyPlugins.SandboxAssembly);
            RegisterTypesFromAssembly(MyPlugins.UserAssembly);

            foreach (var plugin in MyPlugins.Plugins)
            {
                RegisterTypesFromAssembly(plugin.GetType().Assembly);
            }
        }
        static MyBehaviorTreeNodeMemoryFactory()
        {
            m_objectFactory = new MyObjectFactory<MyBehaviorTreeNodeMemoryTypeAttribute, MyBehaviorTreeNodeMemory>();
#if XB1 // XB1_ALLINONEASSEMBLY
            m_objectFactory.RegisterFromAssembly(MyAssembly.AllInOneAssembly);
#else // !XB1
            m_objectFactory.RegisterFromAssembly(Assembly.GetAssembly(typeof(MyBehaviorTreeNodeMemory)));

            m_objectFactory.RegisterFromAssembly(MyPlugins.GameAssembly);
            m_objectFactory.RegisterFromAssembly(MyPlugins.SandboxAssembly); //TODO: Will be removed 
            m_objectFactory.RegisterFromAssembly(MyPlugins.UserAssembly);
#endif // !XB1
        }
		static MyEnvironmentalParticleLogicFactory()
        {
            m_objectFactory = new MyObjectFactory<MyEnvironmentalParticleLogicTypeAttribute, MyEnvironmentalParticleLogic>();
#if XB1 // XB1_ALLINONEASSEMBLY
            m_objectFactory.RegisterFromAssembly(MyAssembly.AllInOneAssembly);
#else // !XB1
            m_objectFactory.RegisterFromAssembly(Assembly.GetAssembly(typeof(MyEnvironmentalParticleLogic)));

            m_objectFactory.RegisterFromAssembly(MyPlugins.GameAssembly);
            m_objectFactory.RegisterFromAssembly(MyPlugins.SandboxAssembly); //TODO: Will be removed 
            m_objectFactory.RegisterFromAssembly(MyPlugins.UserAssembly);
#endif // !XB1
        }
        static MyGlobalEventFactory()
        {
            m_typesToHandlers    = new Dictionary <MyDefinitionId, MethodInfo>();
            m_globalEventFactory = new MyObjectFactory <MyEventTypeAttribute, MyGlobalEventBase>();

#if XB1 // XB1_ALLINONEASSEMBLY
            RegisterEventTypesAndHandlers(MyAssembly.AllInOneAssembly);
#else // !XB1
            RegisterEventTypesAndHandlers(Assembly.GetAssembly(typeof(MyGlobalEventBase)));
            RegisterEventTypesAndHandlers(MyPlugins.GameAssembly);
            RegisterEventTypesAndHandlers(MyPlugins.SandboxAssembly);
#endif // !XB1
        }
Esempio n. 37
0
        static MyBotFactoryBase()
        {
            m_objectFactory = new MyObjectFactory <MyBotTypeAttribute, IMyBot>();

            var baseAssembly = Assembly.GetAssembly(typeof(MyAgentBot));

            m_objectFactory.RegisterFromAssembly(baseAssembly);
            m_objectFactory.RegisterFromAssembly(VRage.Plugins.MyPlugins.GameAssembly);

            foreach (var plugin in VRage.Plugins.MyPlugins.Plugins)
            {
                m_objectFactory.RegisterFromAssembly(plugin.GetType().Assembly);
            }
        }
        static MyObjectBuilderSerializer()
        {
            Serializer = TypeModel.Create();
            Serializer.AutoAddMissingTypes     = true;
            Serializer.UseImplicitZeroDefaults = false;

            m_objectFactory = new MyObjectFactory <MyObjectBuilderDefinitionAttribute, MyObjectBuilder_Base>();

            m_objectFactory.RegisterFromAssembly(Assembly.GetExecutingAssembly());
            m_objectFactory.RegisterFromAssembly(MyPlugins.GameAssembly);
            m_objectFactory.RegisterFromAssembly(MyPlugins.UserAssembly);

            LoadSerializers();
        }
Esempio n. 39
0
        static MyBotFactoryBase()
        {
            m_objectFactory = new MyObjectFactory<MyBotTypeAttribute, IMyBot>();

#if XB1 // XB1_ALLINONEASSEMBLY
            m_objectFactory.RegisterFromAssembly(MyAssembly.AllInOneAssembly);
#else // !XB1
            var baseAssembly = Assembly.GetAssembly(typeof(MyAgentBot));
            m_objectFactory.RegisterFromAssembly(baseAssembly);
            m_objectFactory.RegisterFromAssembly(VRage.Plugins.MyPlugins.GameAssembly);

            foreach (var plugin in VRage.Plugins.MyPlugins.Plugins)
                m_objectFactory.RegisterFromAssembly(plugin.GetType().Assembly);
#endif // !XB1
        }
Esempio n. 40
0
    private static int run(string[] args, Ice.Communicator communicator)
    {
        Ice.ObjectFactory factory = new MyObjectFactory();
        communicator.addObjectFactory(factory, "::Test::B");
        communicator.addObjectFactory(factory, "::Test::C");
        communicator.addObjectFactory(factory, "::Test::D");
        communicator.addObjectFactory(factory, "::Test::E");
        communicator.addObjectFactory(factory, "::Test::F");
        communicator.addObjectFactory(factory, "::Test::I");
        communicator.addObjectFactory(factory, "::Test::J");
        communicator.addObjectFactory(factory, "::Test::H");

        InitialPrx initial = AllTests.allTests(communicator, false);
        initial.shutdown();
        return 0;
    }
Esempio n. 41
0
    private static int run(string[] args, Ice.Communicator communicator)
    {
        Ice.ObjectFactory factory = new MyObjectFactory();
        communicator.addObjectFactory(factory, "::Test::I");
        communicator.addObjectFactory(factory, "::Test::J");
        communicator.addObjectFactory(factory, "::Test::H");

        communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010");
        Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
        Ice.Object @object = new InitialI(adapter);
        adapter.add(@object, communicator.stringToIdentity("initial"));
        @object = new UnexpectedObjectExceptionTestI();
        adapter.add(@object, communicator.stringToIdentity("uoet"));
        adapter.activate();
        communicator.waitForShutdown();
        return 0;
    }
Esempio n. 42
0
        static MyBotFactoryBase()
        {
            m_objectFactory = new MyObjectFactory <MyBotTypeAttribute, IMyBot>();

#if XB1 // XB1_ALLINONEASSEMBLY
            m_objectFactory.RegisterFromAssembly(MyAssembly.AllInOneAssembly);
#else // !XB1
            var baseAssembly = Assembly.GetAssembly(typeof(MyAgentBot));
            m_objectFactory.RegisterFromAssembly(baseAssembly);
            m_objectFactory.RegisterFromAssembly(VRage.Plugins.MyPlugins.GameAssembly);

            foreach (var plugin in VRage.Plugins.MyPlugins.Plugins)
            {
                m_objectFactory.RegisterFromAssembly(plugin.GetType().Assembly);
            }
#endif // !XB1
        }
Esempio n. 43
0
    private static int run(string[] args, Ice.Communicator communicator)
    {
        Ice.ObjectFactory factory = new MyObjectFactory();
        communicator.addObjectFactory(factory, "::Test::I");
        communicator.addObjectFactory(factory, "::Test::J");
        communicator.addObjectFactory(factory, "::Test::H");

        communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010");
        Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
        Ice.Object        @object = new InitialI(adapter);
        adapter.add(@object, communicator.stringToIdentity("initial"));
        @object = new UnexpectedObjectExceptionTestI();
        adapter.add(@object, communicator.stringToIdentity("uoet"));
        adapter.activate();
        communicator.waitForShutdown();
        return(0);
    }
Esempio n. 44
0
 private static void ObjectFactory_RegisterDescriptorSafe <TAttribute, TCreatedObjectBase>(
     MyObjectFactory <TAttribute, TCreatedObjectBase> factory, TAttribute descriptor, Type type) where TAttribute : MyFactoryTagAttribute where TCreatedObjectBase : class
 {
     if (factory.Attributes.TryGetValue(type, out _))
     {
         return;
     }
     if (descriptor.ObjectBuilderType != null && factory.TryGetProducedType(descriptor.ObjectBuilderType) != null)
     {
         return;
     }
     if (typeof(MyObjectBuilder_Base).IsAssignableFrom(descriptor.ProducedType) &&
         factory.TryGetProducedType(descriptor.ProducedType) != null)
     {
         return;
     }
     factory.RegisterDescriptor(descriptor, type);
 }
 public static MyObjectFactory<MyDefinitionTypeAttribute, MyDefinitionBase> GetObjectFactory()
 {
     if (m_definitionFactory == null)
     {
         m_definitionFactory = new MyObjectFactory<MyDefinitionTypeAttribute, MyDefinitionBase>();
         m_definitionFactory.RegisterFromCreatedObjectAssembly();
         m_definitionFactory.RegisterFromAssembly(MyPlugins.GameAssembly);
         m_definitionFactory.RegisterFromAssembly(MyPlugins.UserAssembly);
     }
     return m_definitionFactory;
 }
		static MyEntityStatEffectFactory()
		{
			m_objectFactory = new MyObjectFactory<MyEntityStatEffectTypeAttribute, MyEntityStatRegenEffect>();
			m_objectFactory.RegisterFromAssembly(Assembly.GetAssembly(typeof(MyEntityStatRegenEffect)));
		}
 static MyEntityStatEffectFactory()
 {
     m_objectFactory = new MyObjectFactory <MyEntityStatEffectTypeAttribute, MyEntityStatRegenEffect>();
     m_objectFactory.RegisterFromAssembly(Assembly.GetAssembly(typeof(MyEntityStatRegenEffect)));
 }
Esempio n. 48
0
    public static InitialPrx allTests(Ice.Communicator communicator)
#endif
    {
        Ice.ObjectFactory factory = new MyObjectFactory();
        communicator.addObjectFactory(factory, "::Test::B");
        communicator.addObjectFactory(factory, "::Test::C");
        communicator.addObjectFactory(factory, "::Test::D");
        communicator.addObjectFactory(factory, "::Test::E");
        communicator.addObjectFactory(factory, "::Test::F");
        communicator.addObjectFactory(factory, "::Test::I");
        communicator.addObjectFactory(factory, "::Test::J");
        communicator.addObjectFactory(factory, "::Test::H");

        Write("testing stringToProxy... ");
        Flush();
        String @ref = "initial:default -p 12010";
        Ice.ObjectPrx @base = communicator.stringToProxy(@ref);
        test(@base != null);
        WriteLine("ok");
        
        Write("testing checked cast... ");
        Flush();
        InitialPrx initial = InitialPrxHelper.checkedCast(@base);
        test(initial != null);
        test(initial.Equals(@base));
        WriteLine("ok");
        
        Write("getting B1... ");
        Flush();
        B b1 = initial.getB1();
        test(b1 != null);
        WriteLine("ok");
        
        Write("getting B2... ");
        Flush();
        B b2 = initial.getB2();
        test(b2 != null);
        WriteLine("ok");
        
        Write("getting C... ");
        Flush();
        C c = initial.getC();
        test(c != null);
        WriteLine("ok");
        
        Write("getting D... ");
        Flush();
        D d = initial.getD();
        test(d != null);
        WriteLine("ok");
        
        Write("checking consistency... ");
        Flush();
        test(b1 != b2);
        //test(b1 != c);
        //test(b1 != d);
        //test(b2 != c);
        //test(b2 != d);
        //test(c != d);
        test(b1.theB == b1);
        test(b1.theC == null);
        test(b1.theA is B);
        test(((B) b1.theA).theA == b1.theA);
        test(((B) b1.theA).theB == b1);
        //test(((B)b1.theA).theC is C); // Redundant -- theC is always of type C
        test(((C) (((B) b1.theA).theC)).theB == b1.theA);
        test(b1.preMarshalInvoked);
        test(b1.postUnmarshalInvoked());
        test(b1.theA.preMarshalInvoked);
        test(b1.theA.postUnmarshalInvoked());
        test(((B)b1.theA).theC.preMarshalInvoked);
        test(((B)b1.theA).theC.postUnmarshalInvoked());

        // More tests possible for b2 and d, but I think this is already
        // sufficient.
        test(b2.theA == b2);
        test(d.theC == null);
        WriteLine("ok");
        
        Write("getting B1, B2, C, and D all at once... ");
        Flush();
        B b1out;
        B b2out;
        C cout;
        D dout;
        initial.getAll(out b1out, out b2out, out cout, out dout);
        test(b1out != null);
        test(b2out != null);
        test(cout != null);
        test(dout != null);
        WriteLine("ok");
        
        Write("checking consistency... ");
        Flush();
        test(b1out != b2out);
        test(b1out.theA == b2out);
        test(b1out.theB == b1out);
        test(b1out.theC == null);
        test(b2out.theA == b2out);
        test(b2out.theB == b1out);
        test(b2out.theC == cout);
        test(cout.theB == b2out);
        test(dout.theA == b1out);
        test(dout.theB == b2out);
        test(dout.theC == null);
        test(dout.preMarshalInvoked);
        test(dout.postUnmarshalInvoked());
        test(dout.theA.preMarshalInvoked);
        test(dout.theA.postUnmarshalInvoked()); 
        test(dout.theB.preMarshalInvoked);
        test(dout.theB.postUnmarshalInvoked());
        test(dout.theB.theC.preMarshalInvoked);
        test(dout.theB.theC.postUnmarshalInvoked());

        WriteLine("ok");

        Write("testing protected members... ");
        Flush();
        E e = initial.getE();
        test(e.checkValues());
        System.Reflection.BindingFlags flags = System.Reflection.BindingFlags.NonPublic |
                                               System.Reflection.BindingFlags.Public |
                                               System.Reflection.BindingFlags.Instance;
        test(!typeof(E).GetField("i", flags).IsPublic && !typeof(E).GetField("i", flags).IsPrivate);
        test(!typeof(E).GetField("s", flags).IsPublic && !typeof(E).GetField("s", flags).IsPrivate);
        F f = initial.getF();
        test(f.checkValues());
        test(f.e2.checkValues());
        test(!typeof(F).GetField("e1", flags).IsPublic && !typeof(F).GetField("e1", flags).IsPrivate);
        test(typeof(F).GetField("e2", flags).IsPublic && !typeof(F).GetField("e2", flags).IsPrivate);
        WriteLine("ok");

        Write("getting I, J and H... ");
        Flush();
        I i = initial.getI();
        test(i != null);
        I j = initial.getJ();
        test(j != null && ((J)j) != null);
        I h = initial.getH();
        test(h != null && ((H)h) != null);
        WriteLine("ok");
        
        Write("getting D1... ");
        Flush();
        D1 d1 = new D1(new A1("a1"), new A1("a2"), new A1("a3"), new A1("a4"));
        d1 = initial.getD1(d1);
        test(d1.a1.name.Equals("a1"));
        test(d1.a2.name.Equals("a2"));
        test(d1.a3.name.Equals("a3"));
        test(d1.a4.name.Equals("a4"));
        WriteLine("ok");
        
        Write("throw EDerived... ");
        Flush();
        try
        {
            initial.throwEDerived();
            test(false);
        }
        catch(EDerived ederived)
        {
            test(ederived.a1.name.Equals("a1"));
            test(ederived.a2.name.Equals("a2"));
            test(ederived.a3.name.Equals("a3"));
            test(ederived.a4.name.Equals("a4"));
        }
        WriteLine("ok");

        Write("setting I... ");
        Flush();
        initial.setI(i);
        initial.setI(j);
        initial.setI(h);
        WriteLine("ok");

        Write("testing sequences...");
        Flush();
        try
        {
            Base[] inS = new Base[0];
            Base[] outS;
            Base[] retS;
            retS = initial.opBaseSeq(inS, out outS);
            
            inS = new Base[1];
            inS[0] = new Base(new S(), "");
            retS = initial.opBaseSeq(inS, out outS);
            test(retS.Length == 1 && outS.Length == 1);
        }
        catch(Ice.OperationNotExistException)
        {
        }
        WriteLine("ok");

        Write("testing compact ID...");
        Flush();
        try
        {
            test(initial.getCompact() != null);
        }
        catch(Ice.OperationNotExistException)
        {
        }
        WriteLine("ok");

        Write("testing UnexpectedObjectException...");
        Flush();
        @ref = "uoet:default -p 12010";
        @base = communicator.stringToProxy(@ref);
        test(@base != null);
        UnexpectedObjectExceptionTestPrx uoet = UnexpectedObjectExceptionTestPrxHelper.uncheckedCast(@base);
        test(uoet != null);
        try
        {
            uoet.op();
            test(false);
        }
        catch(Ice.UnexpectedObjectException ex)
        {
            test(ex.type.Equals("::Test::AlsoEmpty"));
            test(ex.expectedType.Equals("::Test::Empty"));
        }
        catch(System.Exception ex)
        {
            WriteLine(ex.ToString());
            test(false);
        }
        WriteLine("ok");
#if SILVERLIGHT
        initial.shutdown();
#else
        return initial;
#endif
    }
Esempio n. 49
0
 static MyAutopilotFactory()
 {
     m_objectFactory = new MyObjectFactory<MyAutopilotTypeAttribute, MyAutopilotBase>();
     m_objectFactory.RegisterFromCreatedObjectAssembly();
 }
Esempio n. 50
0
    public static InitialPrx allTests(Ice.Communicator communicator)
#endif
    {
        Ice.ObjectFactory factory = new MyObjectFactory();
        communicator.addObjectFactory(factory, "::Test::B");
        communicator.addObjectFactory(factory, "::Test::C");
        communicator.addObjectFactory(factory, "::Test::D");
        communicator.addObjectFactory(factory, "::Test::E");
        communicator.addObjectFactory(factory, "::Test::F");
        communicator.addObjectFactory(factory, "::Test::I");
        communicator.addObjectFactory(factory, "::Test::J");
        communicator.addObjectFactory(factory, "::Test::H");

        Write("testing stringToProxy... ");
        Flush();
        String @ref = "initial:default -p 12010";

        Ice.ObjectPrx @base = communicator.stringToProxy(@ref);
        test(@base != null);
        WriteLine("ok");

        Write("testing checked cast... ");
        Flush();
        InitialPrx initial = InitialPrxHelper.checkedCast(@base);

        test(initial != null);
        test(initial.Equals(@base));
        WriteLine("ok");

        Write("getting B1... ");
        Flush();
        B b1 = initial.getB1();

        test(b1 != null);
        WriteLine("ok");

        Write("getting B2... ");
        Flush();
        B b2 = initial.getB2();

        test(b2 != null);
        WriteLine("ok");

        Write("getting C... ");
        Flush();
        C c = initial.getC();

        test(c != null);
        WriteLine("ok");

        Write("getting D... ");
        Flush();
        D d = initial.getD();

        test(d != null);
        WriteLine("ok");

        Write("checking consistency... ");
        Flush();
        test(b1 != b2);
        //test(b1 != c);
        //test(b1 != d);
        //test(b2 != c);
        //test(b2 != d);
        //test(c != d);
        test(b1.theB == b1);
        test(b1.theC == null);
        test(b1.theA is B);
        test(((B)b1.theA).theA == b1.theA);
        test(((B)b1.theA).theB == b1);
        //test(((B)b1.theA).theC is C); // Redundant -- theC is always of type C
        test(((C)(((B)b1.theA).theC)).theB == b1.theA);
        test(b1.preMarshalInvoked);
        test(b1.postUnmarshalInvoked());
        test(b1.theA.preMarshalInvoked);
        test(b1.theA.postUnmarshalInvoked());
        test(((B)b1.theA).theC.preMarshalInvoked);
        test(((B)b1.theA).theC.postUnmarshalInvoked());

        // More tests possible for b2 and d, but I think this is already
        // sufficient.
        test(b2.theA == b2);
        test(d.theC == null);
        WriteLine("ok");

        Write("getting B1, B2, C, and D all at once... ");
        Flush();
        B b1out;
        B b2out;
        C cout;
        D dout;

        initial.getAll(out b1out, out b2out, out cout, out dout);
        test(b1out != null);
        test(b2out != null);
        test(cout != null);
        test(dout != null);
        WriteLine("ok");

        Write("checking consistency... ");
        Flush();
        test(b1out != b2out);
        test(b1out.theA == b2out);
        test(b1out.theB == b1out);
        test(b1out.theC == null);
        test(b2out.theA == b2out);
        test(b2out.theB == b1out);
        test(b2out.theC == cout);
        test(cout.theB == b2out);
        test(dout.theA == b1out);
        test(dout.theB == b2out);
        test(dout.theC == null);
        test(dout.preMarshalInvoked);
        test(dout.postUnmarshalInvoked());
        test(dout.theA.preMarshalInvoked);
        test(dout.theA.postUnmarshalInvoked());
        test(dout.theB.preMarshalInvoked);
        test(dout.theB.postUnmarshalInvoked());
        test(dout.theB.theC.preMarshalInvoked);
        test(dout.theB.theC.postUnmarshalInvoked());

        WriteLine("ok");

        Write("testing protected members... ");
        Flush();
        E e = initial.getE();

        test(e.checkValues());
        System.Reflection.BindingFlags flags = System.Reflection.BindingFlags.NonPublic |
                                               System.Reflection.BindingFlags.Public |
                                               System.Reflection.BindingFlags.Instance;
        test(!typeof(E).GetField("i", flags).IsPublic&& !typeof(E).GetField("i", flags).IsPrivate);
        test(!typeof(E).GetField("s", flags).IsPublic&& !typeof(E).GetField("s", flags).IsPrivate);
        F f = initial.getF();

        test(f.checkValues());
        test(f.e2.checkValues());
        test(!typeof(F).GetField("e1", flags).IsPublic&& !typeof(F).GetField("e1", flags).IsPrivate);
        test(typeof(F).GetField("e2", flags).IsPublic&& !typeof(F).GetField("e2", flags).IsPrivate);
        WriteLine("ok");

        Write("getting I, J and H... ");
        Flush();
        I i = initial.getI();

        test(i != null);
        I j = initial.getJ();

        test(j != null && ((J)j) != null);
        I h = initial.getH();

        test(h != null && ((H)h) != null);
        WriteLine("ok");

        Write("setting I... ");
        Flush();
        initial.setI(i);
        initial.setI(j);
        initial.setI(h);
        WriteLine("ok");

        Write("testing sequences...");
        Flush();
        try
        {
            Base[] inS = new Base[0];
            Base[] outS;
            Base[] retS;
            retS = initial.opBaseSeq(inS, out outS);

            inS    = new Base[1];
            inS[0] = new Base(new S(), "");
            retS   = initial.opBaseSeq(inS, out outS);
            test(retS.Length == 1 && outS.Length == 1);
        }
        catch (Ice.OperationNotExistException)
        {
        }
        WriteLine("ok");

        Write("testing compact ID...");
        Flush();
        try
        {
            test(initial.getCompact() != null);
        }
        catch (Ice.OperationNotExistException)
        {
        }
        WriteLine("ok");

        Write("testing UnexpectedObjectException...");
        Flush();
        @ref  = "uoet:default -p 12010";
        @base = communicator.stringToProxy(@ref);
        test(@base != null);
        UnexpectedObjectExceptionTestPrx uoet = UnexpectedObjectExceptionTestPrxHelper.uncheckedCast(@base);

        test(uoet != null);
        try
        {
            uoet.op();
            test(false);
        }
        catch (Ice.UnexpectedObjectException ex)
        {
            test(ex.type.Equals("::Test::AlsoEmpty"));
            test(ex.expectedType.Equals("::Test::Empty"));
        }
        catch (System.Exception ex)
        {
            WriteLine(ex.ToString());
            test(false);
        }
        WriteLine("ok");
#if SILVERLIGHT
        initial.shutdown();
#else
        return(initial);
#endif
    }
Esempio n. 51
0
 static TriggerFactory()
 {
     m_objectFactory = new MyObjectFactory<TriggerTypeAttribute, MyTrigger>();
     m_objectFactory.RegisterFromCreatedObjectAssembly();
     //m_objectFactory.RegisterFromAssembly(MyPlugins.GameAssembly);
     //m_objectFactory.RegisterFromAssembly(MyPlugins.UserAssembly);
 }
Esempio n. 52
0
 static MyAutopilotFactory()
 {
     m_objectFactory = new MyObjectFactory <MyAutopilotTypeAttribute, MyAutopilotBase>();
     m_objectFactory.RegisterFromCreatedObjectAssembly();
 }
Esempio n. 53
0
 private static void ObjectFactory_RegisterFromAssemblySafe <TAttribute, TCreatedObjectBase>(MyObjectFactory <TAttribute, TCreatedObjectBase> factory, Assembly assembly) where TAttribute : MyFactoryTagAttribute where TCreatedObjectBase : class
 {
     if (assembly == null)
     {
         return;
     }
     foreach (Type type in assembly.GetTypes())
     {
         foreach (TAttribute descriptor in type.GetCustomAttributes <TAttribute>())
         {
             ObjectFactory_RegisterDescriptorSafe(factory, descriptor, type);
         }
     }
 }