Ejemplo n.º 1
0
        public static void LoadResources(Language language)
        {
            if (language == Language.SystemDefault)
            {
                switch (System.Globalization.CultureInfo.CurrentUICulture.TwoLetterISOLanguageName)
                {
                default:
                case "en": language = Language.English; break;

                case "fr": language = Language.French; break;

                case "ja": language = Language.Japanese; break;

                case "ru": language = Language.Russian; break;

                case "es": language = Language.Spanish; break;

                case "uk": language = Language.Ukrainian; break;

                case "pt": language = Language.Portuguese; break;

                case "zh": language = Language.Chinese; break;
                }
            }

            string filename;
            string enFilename = "resources.en.xml";

            switch (language)
            {
            default:
            case Language.English: filename = enFilename; break;

            case Language.French: filename = "resources.fr.xml"; break;

            case Language.Japanese: filename = "resources.ja.xml"; break;

            case Language.Russian: filename = "resources.ru.xml"; break;

            case Language.Spanish: filename = "resources.es.xml"; break;

            case Language.Ukrainian: filename = "resources.uk.xml"; break;

            case Language.Portuguese: filename = "resources.pt.xml"; break;

            case Language.Catalan: filename = "resources.ca.xml"; break;

            case Language.Chinese: filename = "resources.zh.xml"; break;
            }

            _language = language;

            using (Stream stream = ResourceExtractor.GetZippedResource(filename)) {
                _resources.Load(stream);
            }

            using (Stream stream = ResourceExtractor.GetZippedResource(enFilename)) {
                _enResources.Load(stream);
            }
        }
        public void BuildRule_GeneratesExpectedMarkdown()
        {
            var tests = new Dictionary <string, SarifValidationSkimmerBase>
            {
                { "MarkdownFullDescription.md", new TestRule4() },
                { "MarkdownShortDescription.md", new TestRule5() },
                { "NoDescription.md", new TestRule3() },
                { "NonStandardMessageStringKey.md", new TestRule6() },
                { "StandardMessageStringKey.md", new TestRule1() },
                { "TextShortDescription.md", new TestRule2() },
            };

            var resourceExtractor = new ResourceExtractor(this.GetType());

            foreach (KeyValuePair <string, SarifValidationSkimmerBase> test in tests)
            {
                var sb      = new StringBuilder();
                var command = new ExportValidationRulesMetadataCommand();
                command.BuildRule(test.Value, sb);

                string expectedMarkdown = resourceExtractor.GetResourceText(test.Key);

                sb.ToString().Should().Be(expectedMarkdown);
            }
        }
Ejemplo n.º 3
0
        protected override void OnShown(EventArgs e)
        {
            base.OnShown(e);

            _cheatDb = new CheatDatabase();
            try {
                XmlSerializer xmlSerializer = new XmlSerializer(typeof(CheatDatabase));
                using (TextReader textReader = new StreamReader(ResourceExtractor.GetZippedResource("CheatDb.xml"))) {
                    _cheatDb = (CheatDatabase)xmlSerializer.Deserialize(textReader);
                }
            } catch { }

            lblCheatCount.Text = ResourceHelper.GetMessage("CheatsFound", _cheatDb.Games.Count.ToString());

            txtSearch.Focus();
            UpdateList();

            string sha1 = EmuApi.GetRomInfo().Sha1;

            for (int i = 0, len = lstGames.Items.Count; i < len; i++)
            {
                if (((CheatDbGameEntry)lstGames.Items[i]).Sha1 == sha1)
                {
                    lstGames.TopIndex      = Math.Max(0, i - 10);
                    lstGames.SelectedIndex = i;
                    break;
                }
            }
        }
        public static void UninstallBuiltInDrivers()
        {
            LogWriter.Write("Uninstalling Built-in drivers");
            try
            {
                var    path = ResourceExtractor.ExtractResource(Assembly.GetExecutingAssembly(), "KeyboardSplitter.Lib.keyboard_driver.exe");
                string msg1 = InterceptionDriver.Uninstall(path);
                string msg2 = VirtualXboxBus.Uninstall();
                LogWriter.Write(msg1);
                LogWriter.Write(msg2);

                Controls.MessageBox.Show(
                    "Uninstallation finished. You must reboot the system to completely remove the drivers.\r\n\r\n Application will now close.",
                    ApplicationInfo.AppName,
                    MessageBoxButton.OK,
                    MessageBoxImage.Information);

                Environment.Exit(0);
            }
            catch (Exception ex)
            {
                LogWriter.Write("Uninstalling Built-in drivers FAILED:\r\n" + ex.ToString());

                Controls.MessageBox.Show(
                    "Uninstall failed: " + ex.Message,
                    "Uninstall failed",
                    MessageBoxButton.OK,
                    MessageBoxImage.Error);
            }
        }
Ejemplo n.º 5
0
        private static void LoadAssemblies()
        {
            if (!App.assembliesLoaded)
            {
                // Setting the native dll search path
                LogWriter.Write("Setting environment");
                Environment.SetEnvironmentVariable(
                    "PATH",
                    ApplicationInfo.AppTempDirectory,
                    EnvironmentVariableTarget.Process);

                LogWriter.Write("Extracting native resources");
                var assembly = Assembly.GetExecutingAssembly();
                ResourceExtractor.ExtractResource(assembly, "KeyboardSplitter.Lib.interception.dll", ApplicationInfo.AppTempDirectory);
                ResourceExtractor.ExtractResource(assembly, "KeyboardSplitter.Lib.VirtualXboxNative.dll", ApplicationInfo.AppTempDirectory);

                ManagedAssemblyLoader.Load(
                    "KeyboardSplitter.Lib.Interceptor.dll",
                    "Interceptor.dll");

                ManagedAssemblyLoader.Load(
                    "KeyboardSplitter.Lib.SplitterCore.dll",
                    "SplitterCore.dll");

                ManagedAssemblyLoader.Load(
                    "KeyboardSplitter.Lib.VirtualXbox.dll",
                    "VirtualXbox.dll");

                ManagedAssemblyLoader.Load(
                    "KeyboardSplitter.Lib.XinputWrapper.dll",
                    "XinputWrapper.dll");

                App.assembliesLoaded = true;
            }
        }
Ejemplo n.º 6
0
    public void resourceCollecting()
    {
        if (assignedBuilding.GetComponent <ResourceExtractor>().extractedResourceType == ResourceBase.ResourceType.Free)
        {
            return;
        }
        // Debug.Log("rc");
        switch (minionState)
        {
        case MinionState.Out:
            if (targetresource != null)
            {
                WalkTowardDestination(targetresource);
            }

            if (Vector3.Distance(transform.position, normalPos) < 1f || targetresource == null)
            {
                minionState         = MinionState.Working;
                extractionBeginTime = Time.time;
            }
            break;

        case MinionState.Working:

            if (extractionBeginTime + extractionDuration <= Time.time)
            {
                minionState = MinionState.In;
                targetInstanceController.removeIfEmpty();
            }

            break;

        case MinionState.In:
            WalkTowardDestination(assignedBuilding);

            if (Vector3.Distance(transform.position, normalPos) < 1f)
            {
                minionState = MinionState.NotAssigned;
                ResourceExtractor re        = assignedBuilding.GetComponent <ResourceExtractor>();
                GameObject        newtarget = re.findNearbyResource();
                re.addResourceToContainer(pack);
                pack = 0;
                if (newtarget != null)
                {
                    setTargetResource(newtarget);

                    minionState = MinionState.Out;
                }
                else
                {
                    minionState = MinionState.NotAssigned;
                }
            }
            break;

        default:
            break;
        }
    }
        private void updateSource()
        {
            BitmapImage imgSrc = new BitmapImage(ResourceExtractor.GetRelativeUri(AssociatedExtractor, ExtractedFilePath));

            Source = imgSrc;

            InvalidateVisual();
        }
Ejemplo n.º 8
0
    private void AddCurrentBuildingToMap()
    {
        if (currentBuilding)
        {
            Vector3    position = currentBuilding.transform.position - Vector3.up * preViewOffset;
            GameObject building = Instantiate(currentBuildingPrefab, position, Quaternion.identity, buildingsTransform);

            if (isCurrentBuildResourceExtractor)
            {
                ResourceDeposit resourceDeposit = worldMap.GetResourceDeposit(position);
                Debug.Assert(resourceDeposit, "Resource Deposit is null");

                ResourceExtractor resourceExtractor = building.GetComponent <ResourceExtractor>();
                resourceExtractor.SetDeposit(resourceDeposit);
            }

            bool isRoad = building.TryGetComponent(out RoadUpdater roadUpdater);

            if (isRoad)
            {
                worldMap.AddRoadToHexCell(position, building);
            }
            else
            {
                worldMap.AddBuildingToHexCell(position, building);
            }

            WorldMap.DoubleCircleOfHexCellsAround doubleCircleOfHexCellsAround =
                worldMap.GetDoubleCircleOfHexCellsAround(position);

            if (isRoad)
            {
                roadUpdater.UpdateRoad(doubleCircleOfHexCellsAround.firstCircle);
            }
            for (int i = 0; i < WorldMap.cellNeighbourAmount; ++i)
            {
                WorldMap.HexCellsAround hexCellsAround = doubleCircleOfHexCellsAround.secondCircles[i];
                if ((hexCellsAround.centerCell.hexType & WorldMap.HexType.Road) == WorldMap.HexType.Road)
                {
                    if (hexCellsAround.centerCell.road)
                    {
                        if (hexCellsAround.centerCell.road.TryGetComponent(out RoadUpdater currentRoadUpdater))
                        {
                            currentRoadUpdater.UpdateRoad(hexCellsAround);
                        }
                        else
                        {
                            Debug.LogError("Game object doesn't contain road updater");
                        }
                    }
                    else
                    {
                        Debug.LogError("Road game object is empty");
                    }
                }
            }
        }
    }
        public static tk2dSpriteCollectionData ENV_Tileset_Belly(GameObject TargetObject, AssetBundle sharedAssets)
        {
            tk2dSpriteCollectionData m_NewDungeonCollection = TargetObject.AddComponent <tk2dSpriteCollectionData>();

            Material m_LitCutout = new Material(sharedAssets.LoadAsset <Shader>("BraveLitTk2dCustomFalloffCutout"));

            m_LitCutout.mainTexture = ExpandPrefabs.ENV_Tileset_Belly_Texture;
            m_LitCutout.SetFloat("_Cutoff", 0.5f);
            m_LitCutout.SetFloat("_MaxValue", 1);
            m_LitCutout.SetFloat("_Perpendicular", 1);

            Material m_LitBlend = new Material(sharedAssets.LoadAsset <Shader>("BraveLitTK2dCustomFalloff"));

            m_LitBlend.mainTexture = ExpandPrefabs.ENV_Tileset_Belly_Texture;
            m_LitBlend.SetFloat("_Cutoff", 0.5f);
            m_LitBlend.SetFloat("_Perpendicular", 1);

            Material m_UnlitCutout = new Material(sharedAssets.LoadAsset <Shader>("BraveUnlitCutout"));

            m_UnlitCutout.mainTexture = ExpandPrefabs.ENV_Tileset_Belly_Texture;
            m_UnlitCutout.SetFloat("_Cutoff", 0.5f);
            m_UnlitCutout.SetFloat("_Perpendicular", 1);

            JsonUtility.FromJsonOverwrite(ResourceExtractor.BuildStringFromEmbeddedResource("SerializedData/BellyAssets/ENV_Tileset_Belly.txt"), m_NewDungeonCollection);

            string[] m_BellyMaterialTable = ResourceExtractor.GetLinesFromEmbeddedResource("SerializedData/BellyAssets/ENV_Tileset_Belly_MaterialTable.txt");


            for (int i = 0; i < m_NewDungeonCollection.spriteDefinitions.Length; i++)
            {
                if (m_BellyMaterialTable[i].Contains("lit cutout"))
                {
                    m_NewDungeonCollection.spriteDefinitions[i].material = m_LitCutout;
                }
                else if (m_BellyMaterialTable[i].Contains("lit blend"))
                {
                    m_NewDungeonCollection.spriteDefinitions[i].material = m_LitBlend;
                }
                else if (m_BellyMaterialTable[i].Contains("unlit cutout"))
                {
                    m_NewDungeonCollection.spriteDefinitions[i].material = m_UnlitCutout;
                }
                else
                {
                    Debug.Log("[ExpandTheGungeon] ERROR: sprite id " + i + " did not have a matching material name in lookup table!");
                    m_NewDungeonCollection.spriteDefinitions[i].material = m_LitCutout;
                }
            }

            m_NewDungeonCollection.materials = new Material[] { m_LitCutout, m_LitBlend, m_UnlitCutout };
            m_NewDungeonCollection.textures  = new Texture[] { ExpandPrefabs.ENV_Tileset_Belly_Texture };

            sharedAssets = null;

            return(m_NewDungeonCollection);
        }
        protected override void OnPropertyChanged(DependencyPropertyChangedEventArgs e)
        {
            base.OnPropertyChanged(e);

            if (e.Property == ResourceNameProperty)
            {
                AssociatedExtractor = new ResourceExtractor(ResourceName);
                AssociatedExtractor.Execute();
            }
        }
Ejemplo n.º 11
0
        public Form1()
        {
            InitializeComponent();

            ResourceExtractor.ExtractResourceToFile("Gw2BagOpener.AutoItX3.dll", "AutoItX3.dll");
            ResourceExtractor.ExtractResourceToFile("Gw2BagOpener.AutoItX3.Assembly.dll", "AutoItX3.Assembly.dll");

            worker.DoWork += DoBackgroundWork;
            worker.RunWorkerAsync();
        }
Ejemplo n.º 12
0
 private void InitializeOnRunStarted(DateTime startDateTime)
 {
     Action.Safe(() =>
     {
         RunRepository.OnRunStarted(ReporterSettings, startDateTime);
         TestRunsRepository.OnRunStarted();
         ResourceExtractor.ExtractReportBase(ReporterSettings.OutputPath);
         DataService.SaveReportSettings(ReportSettings);
     });
 }
Ejemplo n.º 13
0
        public static void InitShotgunKinCollection()
        {
            string basePath = Path.Combine(ETGMod.ResourcesDirectory, "PlayableShotgunMan");

            if (!File.Exists(basePath + "/" + "Playable_Shotgun_Man_Swap.png") |
                !File.Exists(basePath + "/" + "ShotgunManSpriteCollection.txt") |
                !File.Exists(basePath + "/" + "ShotgunManAnimationData.txt"))
            {
                return;
            }

            AssetBundle expandSharedAssets1 = ResourceManager.LoadAssetBundle("ExpandSharedAuto");

            ShotgunReskinObject = expandSharedAssets1.LoadAsset <GameObject>("Playable_Shotgun_Man_Swap_Rebuild");

            string TexturePath          = basePath + "/" + "Playable_Shotgun_Man_Swap.png";
            string SpriteCollectionPath = File.ReadAllText(basePath + "/" + "ShotgunManSpriteCollection.txt");
            string SpriteAnimationPath  = File.ReadAllText(basePath + "/" + "ShotgunManAnimationData.txt");


            Texture2D ShotgunManTexture = ResourceExtractor.GetTextureFromFile(basePath, "Playable_Shotgun_Man_Swap.png");

            Material PlayerMaterial = new Material(Shader.Find("Brave/PlayerShader"));

            PlayerMaterial.mainTexture = ShotgunManTexture;

            tk2dSpriteCollectionData ShotgunSpriteCollection = ShotgunReskinObject.AddComponent <tk2dSpriteCollectionData>();
            tk2dSpriteAnimation      ShotgunSpriteAnimation  = ShotgunReskinObject.AddComponent <tk2dSpriteAnimation>();

            JsonUtility.FromJsonOverwrite(SpriteCollectionPath, ShotgunSpriteCollection);
            JsonUtility.FromJsonOverwrite(SpriteAnimationPath, ShotgunSpriteAnimation);

            ShotgunSpriteCollection.textures[0]  = ShotgunManTexture;
            ShotgunSpriteCollection.materials[0] = PlayerMaterial;

            foreach (tk2dSpriteDefinition spriteDefinition in ShotgunSpriteCollection.spriteDefinitions)
            {
                if (spriteDefinition.material != null)
                {
                    spriteDefinition.material = PlayerMaterial;
                }
            }

            foreach (tk2dSpriteAnimationClip clip in ShotgunSpriteAnimation.clips)
            {
                foreach (tk2dSpriteAnimationFrame frame in clip.frames)
                {
                    frame.spriteCollection = ShotgunSpriteCollection;
                }
            }

            expandSharedAssets1 = null;
            // DontDestroyOnLoad(ShotgunReskinObject);
        }
Ejemplo n.º 14
0
        public static void Init(AIActor sourceActor = null)
        {
            if (sourceActor == null)
            {
                sourceActor = EnemyDatabase.GetOrLoadByGuid("14ea47ff46b54bb4a98f91ffcffb656d");
            }

            RatGrenadeTextures = new List <Texture2D>()
            {
                ResourceExtractor.GetTextureFromResource("Textures\\Rat_Grenade\\rat_candle_move_front_001.png"),
                ResourceExtractor.GetTextureFromResource("Textures\\Rat_Grenade\\rat_candle_move_front_002.png"),
                ResourceExtractor.GetTextureFromResource("Textures\\Rat_Grenade\\rat_candle_move_front_003.png"),
                ResourceExtractor.GetTextureFromResource("Textures\\Rat_Grenade\\rat_candle_move_front_004.png"),
                ResourceExtractor.GetTextureFromResource("Textures\\Rat_Grenade\\rat_candle_move_front_005.png"),
                ResourceExtractor.GetTextureFromResource("Textures\\Rat_Grenade\\rat_candle_move_front_006.png"),
                ResourceExtractor.GetTextureFromResource("Textures\\Rat_Grenade\\rat_candle_move_left_001.png"),
                ResourceExtractor.GetTextureFromResource("Textures\\Rat_Grenade\\rat_candle_move_left_002.png"),
                ResourceExtractor.GetTextureFromResource("Textures\\Rat_Grenade\\rat_candle_move_left_003.png"),
                ResourceExtractor.GetTextureFromResource("Textures\\Rat_Grenade\\rat_candle_move_left_004.png"),
                ResourceExtractor.GetTextureFromResource("Textures\\Rat_Grenade\\rat_candle_move_left_005.png"),
                ResourceExtractor.GetTextureFromResource("Textures\\Rat_Grenade\\rat_candle_move_left_006.png"),
                ResourceExtractor.GetTextureFromResource("Textures\\Rat_Grenade\\rat_candle_move_right_001.png"),
                ResourceExtractor.GetTextureFromResource("Textures\\Rat_Grenade\\rat_candle_move_right_002.png"),
                ResourceExtractor.GetTextureFromResource("Textures\\Rat_Grenade\\rat_candle_move_right_003.png"),
                ResourceExtractor.GetTextureFromResource("Textures\\Rat_Grenade\\rat_candle_move_right_004.png"),
                ResourceExtractor.GetTextureFromResource("Textures\\Rat_Grenade\\rat_candle_move_right_005.png"),
                ResourceExtractor.GetTextureFromResource("Textures\\Rat_Grenade\\rat_candle_move_right_006.png"),
                ResourceExtractor.GetTextureFromResource("Textures\\Rat_Grenade\\rat_candle_idle_back_001.png"),
                ResourceExtractor.GetTextureFromResource("Textures\\Rat_Grenade\\rat_candle_idle_back_002.png"),
                ResourceExtractor.GetTextureFromResource("Textures\\Rat_Grenade\\rat_candle_idle_back_003.png"),
                ResourceExtractor.GetTextureFromResource("Textures\\Rat_Grenade\\rat_candle_idle_back_004.png"),
                ResourceExtractor.GetTextureFromResource("Textures\\Rat_Grenade\\rat_candle_idle_front_001.png"),
                ResourceExtractor.GetTextureFromResource("Textures\\Rat_Grenade\\rat_candle_idle_front_002.png"),
                ResourceExtractor.GetTextureFromResource("Textures\\Rat_Grenade\\rat_candle_idle_front_003.png"),
                ResourceExtractor.GetTextureFromResource("Textures\\Rat_Grenade\\rat_candle_idle_front_004.png"),
                ResourceExtractor.GetTextureFromResource("Textures\\Rat_Grenade\\rat_candle_idle_left_001.png"),
                ResourceExtractor.GetTextureFromResource("Textures\\Rat_Grenade\\rat_candle_idle_left_002.png"),
                ResourceExtractor.GetTextureFromResource("Textures\\Rat_Grenade\\rat_candle_idle_left_003.png"),
                ResourceExtractor.GetTextureFromResource("Textures\\Rat_Grenade\\rat_candle_idle_left_004.png"),
                ResourceExtractor.GetTextureFromResource("Textures\\Rat_Grenade\\rat_candle_idle_right_001.png"),
                ResourceExtractor.GetTextureFromResource("Textures\\Rat_Grenade\\rat_candle_idle_right_002.png"),
                ResourceExtractor.GetTextureFromResource("Textures\\Rat_Grenade\\rat_candle_idle_right_003.png"),
                ResourceExtractor.GetTextureFromResource("Textures\\Rat_Grenade\\rat_candle_idle_right_004.png"),
                ResourceExtractor.GetTextureFromResource("Textures\\Rat_Grenade\\rat_candle_move_back_001.png"),
                ResourceExtractor.GetTextureFromResource("Textures\\Rat_Grenade\\rat_candle_move_back_002.png"),
                ResourceExtractor.GetTextureFromResource("Textures\\Rat_Grenade\\rat_candle_move_back_003.png"),
                ResourceExtractor.GetTextureFromResource("Textures\\Rat_Grenade\\rat_candle_move_back_004.png"),
                ResourceExtractor.GetTextureFromResource("Textures\\Rat_Grenade\\rat_candle_move_back_005.png"),
                ResourceExtractor.GetTextureFromResource("Textures\\Rat_Grenade\\rat_candle_move_back_006.png")
            };

            RatGrenadeCollection = ChaosUtility.BuildSpriteCollection(sourceActor.sprite.Collection, null, RatGrenadeTextures, null, true);
            DontDestroyOnLoad(RatGrenadeCollection);
        }
Ejemplo n.º 15
0
        public Reporter(IReporterSettings settings)
        {
            OutputPath = settings.OutputPath;
            TakeScreenshotAfterFail = settings.TakeScreenshotAfterFail;
            Sprint             = settings.Sprint;
            RunName            = settings.RunName;
            RunGuid            = settings.RunGuid;
            RealTimeGeneration = settings.RealTimeGeneration;

            _actionHelper = new ActionHelper(OutputPath);
            _extractor    = new ResourceExtractor(_actionHelper, OutputPath);
        }
Ejemplo n.º 16
0
        private void InitializeReporter(IReporterSettings settings)
        {
            if (settings.OutputPath == null)
            {
                throw new ArgumentNullException(nameof(settings.OutputPath),
                                                "Reporter Output must be specified! Fix your settings.");
            }
            Settings = settings;

            _action    = new ActionHelper(settings.OutputPath);
            _extractor = new ResourceExtractor(_action, settings.OutputPath);
        }
Ejemplo n.º 17
0
        private void LoadBuiltInScript(string name)
        {
            if (!SavePrompt())
            {
                return;
            }

            this.Text             = $"{name} - Script Window";
            txtScriptContent.Text = ResourceExtractor.ReadZippedResource(name);
            _originalText         = txtScriptContent.Text;
            txtScriptContent.ClearUndo();
        }
Ejemplo n.º 18
0
        protected override byte [] GenerateCode(string inputFileName, string inputFileContent)
        {
            ThreadHelper.ThrowIfNotOnUIThread( );

            var fileBased               = ProjectItem.Properties.Item("ItemType").Value?.ToString( ) != "EmbeddedResource";
            var hasLinguist             = Project.HasReference("Linguist");
            var hasLinguistWPF          = Project.HasReference("Linguist.WPF");
            var hasLinguistXamarinForms = Project.HasReference("Linguist.Xamarin.Forms");

            hasLinguist = hasLinguist || hasLinguistWPF || hasLinguistXamarinForms;

            var resourceSet  = ResourceExtractor.ExtractResources(inputFileName, inputFileContent);
            var settings     = new ResourceTypeSettings( );
            var baseName     = Path.GetFileNameWithoutExtension(inputFileName);
            var manifestPath = GetDefaultNamespace( );
            var relativePath = Path.Combine(Project.Name, Path.Combine(manifestPath.Substring(Project.Name.Length).Split('.')));

            settings.ClassName       = baseName;
            settings.Namespace       = FileNamespace ?? manifestPath;
            settings.AccessModifiers = AccessModifier;
            settings.CustomToolType  = GetType( );
            settings.Extension       = hasLinguistWPF          ? ResourceTypeExtension.WPF          :
                                       hasLinguistXamarinForms ? ResourceTypeExtension.XamarinForms :
                                       ResourceTypeExtension.None;

            if (fileBased)
            {
                settings.ConfigureFileBasedResourceManager(baseName, Path.Combine(relativePath, Path.GetFileName(inputFileName)));
            }
            else if (hasLinguist)
            {
                settings.ConfigureResourceManager(manifestPath + '.' + baseName);
            }
            else
            {
                settings.ConfigureWithoutLocalizer(manifestPath + '.' + baseName);
            }

            var builder   = new ResourceTypeBuilder(CodeDomProvider, resourceSet, settings);
            var code      = builder.Build( );
            var errors    = builder.GetErrors( );
            var source    = new StringBuilder( );
            var generator = new ExtendedCodeGenerator(CodeDomProvider);

            using (var writer = new StringWriter(source))
                generator.GenerateCodeFromCompileUnit(code, writer, null);

            if (errors != null)
            {
                foreach (var error in errors)
                {
                    GeneratorErrorCallback(error.IsWarning, default, error.ErrorText, error.Line, error.Column);
Ejemplo n.º 19
0
 private void InitializeReporter(IReporterSettings settings)
 {
     if (settings.OutputPath == null)
     {
         throw new ArgumentNullException(nameof(settings.OutputPath),
                                         "Reporter Output path must be specified. Please fix your .json settings file.");
     }
     Settings       = settings;
     ReportSettings = new ReportSettings(settings.RunsToDisplay, settings.TestsToDisplay);
     _action        = new ActionHelper(settings.OutputPath);
     _extractor     = new ResourceExtractor(_action, settings.OutputPath);
     TestRunStarted = false;
 }
Ejemplo n.º 20
0
    void Assign(GameObject minion, GameObject target)
    {
        MinionAI mai = minion.GetComponent <MinionAI>();

        mai.setBusy(true);
        mai.setAssignedBuilding(target);
        mai.working = false;

        ResourceExtractor re = target.GetComponent <ResourceExtractor>();

        re.workers.Add(minion);
        minion.GetComponent <MinionAI>().setTargetResource(re.findNearbyResource());
    }
Ejemplo n.º 21
0
 private void InitializeOnRunStarted(DateTime startDateTime)
 {
     Action.Safe(() =>
     {
         Logger.Debug("Reporter is initializing on run start...");
         RunRepository.OnRunStarted(ReporterSettings, startDateTime);
         TestRunsRepository.OnRunStarted();
         ResourceExtractor.ExtractReportBase(ReporterSettings.OutputPath);
         DataWriterService.SaveReportSettings(ReportSettings);
         Logger.Debug($"Reporter initializing done. Output folder is '{ReporterSettings.OutputPath}'. " +
                      $"Data service file: '{ReporterSettings.DataServiceFile}', Logger file: '{ReporterSettings.LoggerFile}'");
     });
 }
        private void CopyXinputDlls(string dir)
        {
            var resourceFile = ResourceExtractor.ExtractResource(Assembly.GetExecutingAssembly(), "KeyboardSplitter.Lib.xinput.dll", dir);

            var xinput13  = System.IO.Path.Combine(dir, "xinput1_3.dll");
            var xinput14  = System.IO.Path.Combine(dir, "xinput1_4.dll");
            var xinput910 = System.IO.Path.Combine(dir, "XINPUT9_1_0.DLL");

            System.IO.File.Copy(resourceFile, xinput13, true);
            System.IO.File.Copy(resourceFile, xinput14, true);
            System.IO.File.Copy(resourceFile, xinput910, true);
            System.IO.File.Delete(resourceFile);
        }
Ejemplo n.º 23
0
        private static ResourceTypeBuilder GenerateBuilder(CodeDomProvider provider, string file, string fileNamespace, string resourceNamespace, MemberAttributes accessModifiers, Type customToolType)
        {
            var resourceSet = ResourceExtractor.ExtractResources(GetFullPath(file), ReadFile(file));
            var settings    = new ResourceTypeSettings( );
            var baseName    = Path.GetFileNameWithoutExtension(file);

            settings.ClassName       = baseName;
            settings.Namespace       = fileNamespace ?? resourceNamespace;
            settings.AccessModifiers = accessModifiers;
            settings.CustomToolType  = customToolType;

            return(new ResourceTypeBuilder(provider, resourceSet, settings));
        }
        public void BuildRule_GeneratesExpectedMarkdown()
        {
            var resourceExtractor = new ResourceExtractor(this.GetType());
            var sb       = new StringBuilder();
            var testRule = new TestRule();
            var command  = new ExportRuleDocumentationCommand();

            command.BuildRule(testRule, sb);

            string expectedMarkdown = resourceExtractor.GetResourceText("Test.md");

            sb.ToString().Should().Be(expectedMarkdown);
        }
Ejemplo n.º 25
0
        static void Main(string[] args)
        {
            ResourceExtractor.ExtractResource("MapEditor.SomeC++Stuffs.dll", "SomeC++Stuffs.dll", 3);

            WZ.File.InitializeKey();

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new MapEditor());

            ResourceExtractor.DeleteResource("SomeC++Stuffs.dll");

            //GarbageCollector.StopGC();
        }
        public static tk2dSpriteCollectionData ENV_Tileset_West(GameObject TargetObject, AssetBundle sharedAssets)
        {
            tk2dSpriteCollectionData m_NewDungeonCollection = TargetObject.AddComponent <tk2dSpriteCollectionData>();

            JsonUtility.FromJsonOverwrite(ResourceExtractor.BuildStringFromEmbeddedResource("SerializedData/WestAssets/ENV_Tileset_West.txt"), m_NewDungeonCollection);

            Material m_LitCutout = new Material(sharedAssets.LoadAsset <Material>("lit cutout"));

            m_LitCutout.mainTexture = ExpandPrefabs.ENV_Tileset_West_Texture;

            Material m_LitBlend = new Material(sharedAssets.LoadAsset <Material>("lit blend"));

            m_LitBlend.mainTexture = ExpandPrefabs.ENV_Tileset_West_Texture;

            Material m_UnlitTransparent = new Material(sharedAssets.LoadAsset <Material>("unlit transparent"));

            m_UnlitTransparent.mainTexture = ExpandPrefabs.ENV_Tileset_West_Texture;

            string[] m_WestMaterialTable = ResourceExtractor.GetLinesFromEmbeddedResource("SerializedData/WestAssets/ENV_Tileset_West_MaterialTable.txt");

            for (int i = 0; i < m_NewDungeonCollection.spriteDefinitions.Length; i++)
            {
                if (m_WestMaterialTable[i].Contains("lit cutout"))
                {
                    m_NewDungeonCollection.spriteDefinitions[i].material = m_LitCutout;
                }
                else if (m_WestMaterialTable[i].Contains("lit blend"))
                {
                    m_NewDungeonCollection.spriteDefinitions[i].material = m_LitBlend;
                }
                else if (m_WestMaterialTable[i].Contains("unlit transparent"))
                {
                    m_NewDungeonCollection.spriteDefinitions[i].material = m_UnlitTransparent;
                }
                else
                {
                    Debug.Log("[ExpandTheGungeon] ERROR: sprite id " + i + " did not have a matching material name in lookup table!");
                    m_NewDungeonCollection.spriteDefinitions[i].material = m_LitCutout;
                }
            }

            m_NewDungeonCollection.materials = new Material[] { m_LitCutout, m_LitBlend, m_UnlitTransparent };

            m_NewDungeonCollection.textures = new Texture[] { ExpandPrefabs.ENV_Tileset_West_Texture };

            sharedAssets = null;

            return(m_NewDungeonCollection);
        }
Ejemplo n.º 27
0
        private void VenomPool(Projectile projectile)
        {
            GoopDefinition goopDefinition;

            goopDefinition = new GoopDefinition();
            goopDefinition.CanBeIgnited          = false;
            goopDefinition.damagesEnemies        = false;
            goopDefinition.damagesPlayers        = false;
            goopDefinition.baseColor32           = new Color32(78, 5, 120, 200);
            goopDefinition.goopTexture           = ResourceExtractor.GetTextureFromResource("Items/Resources/goop_standard_base_001.png");
            goopDefinition.AppliesDamageOverTime = true;
            goopDefinition.HealthModifierEffect  = venom;
            var ddgm = DeadlyDeadlyGoopManager.GetGoopManagerForGoopType(goopDefinition);

            ddgm.TimedAddGoopCircle(projectile.sprite.WorldCenter, 2.5f, .1f);
        }
Ejemplo n.º 28
0
        public static void Init()
        {
            goopDefinition = new GoopDefinition();

            goopDefinition.CanBeIgnited   = false;
            goopDefinition.damagesEnemies = false;
            goopDefinition.damagesPlayers = false;
            goopDefinition.baseColor32    = new Color32(237, 93, 239, 200);
            goopDefinition.CanBeFrozen    = false;


            goopDefinition.goopTexture = ResourceExtractor.GetTextureFromResource("LostItems/NuclearThrone/NuclearThroneSprite/water_standard_base_001.png");

            goopDefinition.SpeedModifierEffect              = item.SpeedModifierEffect;
            goopDefinition.AppliesSpeedModifier             = true;
            goopDefinition.AppliesSpeedModifierContinuously = true;
        }
Ejemplo n.º 29
0
        private void btnUpdate_Click(object sender, EventArgs e)
        {
#if DISABLEAUTOUPDATE
            MesenMsgBox.Show("AutoUpdateDisabledMessage", MessageBoxButtons.OK, MessageBoxIcon.Information);
            this.DialogResult = DialogResult.Cancel;
            this.Close();
#else
            string destFilePath   = System.Reflection.Assembly.GetEntryAssembly().Location;
            string srcFilePath    = Path.Combine(ConfigManager.DownloadFolder, "Mesen-S." + lblLatestVersionString.Text + ".exe");
            string backupFilePath = Path.Combine(ConfigManager.BackupFolder, "Mesen-S." + lblCurrentVersionString.Text + ".exe");
            string updateHelper   = Path.Combine(ConfigManager.HomeFolder, "Resources", "MesenUpdater.exe");

            if (!File.Exists(updateHelper))
            {
                MesenMsgBox.Show("UpdaterNotFound", MessageBoxButtons.OK, MessageBoxIcon.Error);
                DialogResult = DialogResult.Cancel;
            }
            else if (!string.IsNullOrWhiteSpace(srcFilePath))
            {
                using (frmDownloadProgress frmDownload = new frmDownloadProgress("https://www.mesen.ca/snes/Services/GetLatestVersion.php?a=download&p=win&v=" + EmuApi.GetMesenVersion().ToString(3), srcFilePath)) {
                    if (frmDownload.ShowDialog() == DialogResult.OK)
                    {
                        FileInfo fileInfo = new FileInfo(srcFilePath);
                        if (fileInfo.Length > 0 && ResourceExtractor.GetSha1Hash(File.ReadAllBytes(srcFilePath)) == _fileHash)
                        {
                            if (Program.IsMono)
                            {
                                Process.Start("mono", string.Format("\"{0}\" \"{1}\" \"{2}\" \"{3}\"", updateHelper, srcFilePath, destFilePath, backupFilePath));
                            }
                            else
                            {
                                Process.Start(updateHelper, string.Format("\"{0}\" \"{1}\" \"{2}\"", srcFilePath, destFilePath, backupFilePath));
                            }
                        }
                        else
                        {
                            //Download failed, mismatching hashes
                            MesenMsgBox.Show("UpdateDownloadFailed", MessageBoxButtons.OK, MessageBoxIcon.Error);
                            DialogResult = DialogResult.Cancel;
                        }
                    }
                }
            }
#endif
        }
Ejemplo n.º 30
0
        public frmAbout()
        {
            InitializeComponent();

            lblMesenVersion.Text = EmuApi.GetMesenVersion().ToString(3);

            Version  ver       = Assembly.GetEntryAssembly().GetName().Version;
            DateTime buildTime = new DateTime(2000, 1, 1, 0, 0, 0, DateTimeKind.Utc).AddDays(ver.Build).AddSeconds(ver.Revision * 2);

            lblBuildDate.Text = buildTime.ToShortDateString() + " " + buildTime.ToShortTimeString();

#if AUTOBUILD
            string devVersion = ResourceExtractor.ReadZippedResource("DevBuild.txt");
            if (devVersion != null)
            {
                lblMesenVersion.Text = devVersion;
            }
#endif
        }