예제 #1
0
        public static string ToReadableString(this AddonType eType)
        {
            switch (eType)
            {
            case AddonType.eErrorAddon:
                return("错误插件");

            case AddonType.eVectorReader:
                return("矢量读插件");

            case AddonType.eVectorWriter:
                return("矢量写插件");

            case AddonType.eRasterReader:
                return("栅格读插件");

            case AddonType.eRasterWriter:
                return("栅格写插件");

            case AddonType.eVectorOperator:
                return("矢量操作插件");

            case AddonType.eRasterOperator:
                return("栅格操作插件");

            default:
                break;
            }
            return("");
        }
예제 #2
0
        void OpenStorage(TextBox box, bool bImport, bool bVector)
        {
            using (FormConnectStorage c = new FormConnectStorage())
            {
                AddonType type = AddonType.eErrorAddon;
                if (bImport && bVector)
                {
                    type = AddonType.eVectorReader;
                }
                if (!bImport && bVector)
                {
                    type = AddonType.eVectorWriter;
                }

                if (bImport && !bVector)
                {
                    type = AddonType.eRasterReader;
                }
                if (!bImport && !bVector)
                {
                    type = AddonType.eRasterWriter;
                }

                KeyValuePair <StorageInformation, Addon> ret = c.ConnectToStorage(FormMain.m_AddonManager, type);
                if (ret.Key == null)
                {
                    return;
                }
                m_Storage = ret;
                box.Text  = m_Storage.Key.Server;
            }
        }
예제 #3
0
        public static IHtmlContent Build(string text, AddonType type)
        {
            TagBuilder addon = new TagBuilder("div");

            addon.AddCssClass($"input-group-{type.GetEnumInfo().Name}");
            addon.InnerHtml.AppendHtml($"<span class=\"input-group-text\">{text}</span>");

            return(addon);
        }
예제 #4
0
 /// <summary>
 /// call when addon(attached on item) has been discarded. instantiate dropped addon object
 /// </summary>
 /// <param name="itemIndex"></param>
 /// <param name="addonType"></param>
 public void DiscardAddon(int itemIndex, AddonType addonType)
 {
     if (itemList[itemIndex].addons[(int)addonType] != null)
     {
         AddonInstantiate(itemList[itemIndex].addons[(int)addonType], player.transform.position, 1f);
         itemList[itemIndex].addons[(int)addonType] = null;
     }
     ui.SetOnPosition(itemList, addonList);
 }
예제 #5
0
        private void AddNewAddonButtonClick(object sender, EventArgs e)
        {
            // create empty instance of specified type
            if (SelectNewAddonTypeComboBox.SelectedIndex == -1)
            {
                return;
            }

            try
            {
                D3dVisibleAddon newAddon     = null;
                Control         controlToAdd = null;
                AddonType       addonType    = (AddonType)Enum.Parse(typeof(AddonType), SelectNewAddonTypeComboBox.SelectedItem.ToString());

                switch (addonType)
                {
                case AddonType.D3dImage:
                    newAddon     = new ImageD3dVisibleAddon(GetNextAvailableAddonId(), AddonType.D3dImage, new VisibleLayout());
                    controlToAdd = _imageAddonPropertiesControl;
                    break;

                case AddonType.D3dText:
                    //check if already a text exists. only 1 allowed
                    foreach (object item in AddonsListBox.Items)
                    {
                        if (item.ToString().Contains(AddonType.D3dText.ToString()))
                        {
                            throw new GeneralException("Cannot add more than one text addond");
                        }
                    }

                    newAddon     = new TextD3dVisibleAddon(GetNextAvailableAddonId(), AddonType.D3dText, new VisibleLayout());
                    controlToAdd = _textAddonPropertiesControl;
                    break;

                default:
                    break;
                }

                // set correct properties panel
                SetAddonPropertiesControl(newAddon);

                // add control to lists
                _addons.Add(newAddon);
                AddonsListBox.Items.Add(newAddon.Id.ToString() + ". " + addonType.ToString());

                // throw event for new addon created
                if (AddonSetEvent != null)
                {
                    AddonSetEvent(newAddon);
                }
            }
            catch (System.Exception)
            {
            }
        }
예제 #6
0
 public virtual void Declare()
 {
     id            = 0; name = "itemname";
     quality       = ItemQuality.Study;
     type          = AddonType.Prop;
     sprite        = null;
     highlight     = null;
     sizeInventory = new Vector2(0, 0);
     addonInfo     = null;
 }
예제 #7
0
 /// <summary>
 /// dettach addon from item
 /// </summary>
 /// <param name="itemIndex"></param>
 /// <param name="addonType"></param>
 public void DetachAddon(int itemIndex, AddonType addonType)
 {
     if (addonList.Count < 9 && itemList[itemIndex].addons[(int)addonType] != null)
     {
         addonList.Add(itemList[itemIndex].addons[(int)addonType]);
         itemList[itemIndex].addons[(int)addonType] = null;
     }
     ui.SetOnPosition(itemList, addonList);
     PlayInventorySound(1);
 }
예제 #8
0
        public virtual string Addon(AddonType addonType)
        {
            switch (addonType)
            {
            case AddonType.Start:
            case AddonType.End:
                return("control");

            default:
                return("control is-expanded");
            }
        }
예제 #9
0
    /* return a new object*/
    public ICharacterAddon CreateAddon(ICharacterAddon addons,AddonType addonType)
    {
        switch (addonType)
        {
        case AddonType.Bomb:
            return new BombAddon(addons);
        case AddonType.Speed:
            return new StatAddon(addons,"Speed",0.3f);
        default:
            return new BombAddon(addons);

        }
    }
        public override string Addon(AddonType addonType)
        {
            switch (addonType)
            {
            case AddonType.Start:
                return("input-group-prepend");

            case AddonType.End:
                return("input-group-append");

            default:
                return(null);
            }
        }
예제 #11
0
        public static string GetAddonPackageExtension(AddonType type)
        {
            switch (type)
            {
            case AddonType.GameLibrary:
            case AddonType.MetadataProvider:
            case AddonType.Generic:
                return(PlaynitePaths.PackedExtensionFileExtention);

            case AddonType.ThemeDesktop:
            case AddonType.ThemeFullscreen:
                return(PlaynitePaths.PackedThemeFileExtention);

            default:
                throw new Exception($"Uknown addon type {type}");
            }
        }
예제 #12
0
파일: Addon.cs 프로젝트: Needix/CFU
        public Addon(String name, String dirName, String firstUploaded, String lastUpdated, String version, AddonType aType, DownloadType dlType, List<FAF> fafList)
        {
            Name = name;
            DirectoryName = dirName;
            FirstUploaded = firstUploaded;
            LastUpdated = lastUpdated;
            Version = version;
            AType = aType;
            DLType = dlType;
            FAFList = fafList;

            if("".Equals(name))
                throw new ArgumentException("Addon name is not allowed to be empty!");

            if(!DirectoryName.Equals("Serialized Directory Name") && !Regex.IsMatch(DirectoryName, @"^[a-z0-9_]*$"))
                throw new ArgumentException("Directory name has some invalid characters!");
        }
예제 #13
0
        private static Version GetApiVersion(AddonType type)
        {
            switch (type)
            {
            case AddonType.GameLibrary:
            case AddonType.MetadataProvider:
            case AddonType.Generic:
                return(SdkVersions.SDKVersion);

            case AddonType.ThemeDesktop:
                return(ThemeManager.DesktopApiVersion);

            case AddonType.ThemeFullscreen:
                return(ThemeManager.FullscreenApiVersion);
            }

            return(new Version(999, 0));
        }
예제 #14
0
            internal CompileResult(Project project, bool buildSuccessful, string logFile)
            {
                Project         = project;
                BuildSuccessful = buildSuccessful;
                LogFile         = File.ReadAllBytes(logFile);
                Type            = Project.GetPropertyValue("OutputType").ToLower() == "library" ? AddonType.Library : AddonType.Executable;

                if (BuildSuccessful)
                {
                    var filePath = GetOutputFilePath();
                    OutputFile = File.ReadAllBytes(filePath);

                    var pdbPath = Directory.GetFiles(Path.GetDirectoryName(filePath), "*.pdb", SearchOption.TopDirectoryOnly).FirstOrDefault();

                    if (File.Exists(pdbPath))
                    {
                        PdbFile     = File.ReadAllBytes(pdbPath);
                        PdbFileName = Path.GetFileName(pdbPath);
                    }
                }
            }
예제 #15
0
        /// <summary>
        /// Loads an addon type definition from the given XML node.
        /// </summary>
        /// <param name="addonTypeElem">The XML node to load from.</param>
        /// <param name="metadata">The metadata object being constructed.</param>
        private static void LoadAddonType(XElement addonTypeElem, ScenarioMetadata metadata)
        {
            XAttribute nameAttr = addonTypeElem.Attribute(XmlMetadataConstants.TYPE_NAME_ATTR);

            if (nameAttr == null)
            {
                throw new SimulatorException("Addon type name not defined!");
            }

            AddonType addonType = new AddonType(nameAttr.Value, metadata);

            LoadScenarioElementType(addonTypeElem, addonType, metadata);

            XElement mainBuildingElem = addonTypeElem.Element(XmlMetadataConstants.MAINBUILDING_ELEM);

            if (mainBuildingElem == null)
            {
                throw new SimulatorException("Main building not found for addon type!");
            }
            addonType.SetMainBuilding(mainBuildingElem.Value);

            metadata.AddAddonType(addonType);
        }
        private string AddonTypeToString(AddonType type)
        {
            switch (type)
            {
            case AddonType.GameLibrary:
                return(ResourceProvider.GetString("LOC_QS_LibraryIntegration"));

            case AddonType.MetadataProvider:
                return(ResourceProvider.GetString("LOC_QS_MetadataProvider"));

            case AddonType.Generic:
                return(ResourceProvider.GetString("LOC_QS_GenericExtension"));

            case AddonType.ThemeDesktop:
                return(ResourceProvider.GetString("LOC_QS_DesktopTheme"));

            case AddonType.ThemeFullscreen:
                return(ResourceProvider.GetString("LOC_QS_FullscreenTheme"));

            default:
                return(null);
            }
        }
예제 #17
0
 public WrapAddonType(AddonType t)
 {
     Type = t;
 }
예제 #18
0
 public override string Addon(AddonType addonType) => "e-control-helper";
예제 #19
0
        public KeyValuePair <StorageInformation, Addon> ConnectToStorage(AddonManager mgr, AddonType type)
        {
            foreach (var item in mgr.Addons)
            {
                if (item.Type != type)
                {
                    continue;
                }
                comboBoxType.Items.Add(item);
            }
            if (comboBoxType.Items.Count > 0)
            {
                comboBoxType.SelectedIndex = 0;
            }
            if (this.ShowDialog() != System.Windows.Forms.DialogResult.OK)
            {
                return(new KeyValuePair <StorageInformation, Addon>(null, null));
            }
            if (comboBoxType.SelectedIndex < 0)
            {
                return(new KeyValuePair <StorageInformation, Addon>(null, null));
            }

            Addon addon             = comboBoxType.SelectedItem as Addon;
            StorageInformation info = new StorageInformation(addon.StorageType);

            info.Server   = textBoxServer.Text;
            info.Database = textBoxDatabase.Text;
            info.User     = textBoxUser.Text;
            info.Password = textBoxPassword.Text;
            info.Port     = Convert.ToInt32(numericUpDownPort.Value);

            return(new KeyValuePair <StorageInformation, Addon>(info, addon));
        }
예제 #20
0
 public abstract string Addon(AddonType addonType);
예제 #21
0
 public List <AddonManifest> GetAllAddons(AddonType type, string searchTerm)
 {
     return(ExecuteGetRequest <List <AddonManifest> >($"/addons?type={type}&searchTerm={searchTerm}".UrlEncode()));
 }
예제 #22
0
 public AAddon(uint id, AddonType type)
 {
     _id   = id;
     _type = type;
 }
예제 #23
0
 public AVisibleAddon(uint id, AddonType type, VisibleLayout layout) : base(id, type)
 {
     _layout = layout;
 }
 /// <summary>
 /// Converts the <see cref="sourceValue" /> parameter to the <see cref="destinationType" /> parameter using <see cref="formatProvider"
 /// /> and <see cref="ignoreCase" />
 /// </summary>
 /// <param name="sourceValue">the <see cref="System.Object"/> to convert from</param>
 /// <param name="destinationType">the <see cref="System.Type" /> to convert to</param>
 /// <param name="formatProvider">not used by this TypeConverter.</param>
 /// <param name="ignoreCase">when set to <c>true</c>, will ignore the case when converting.</param>
 /// <returns>
 /// an instance of <see cref="AddonType" />, or <c>null</c> if there is no suitable conversion.
 /// </returns>
 public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => AddonType.CreateFrom(sourceValue);
예제 #25
0
 public D3dVisibleAddon(uint id, AddonType type, VisibleLayout layout) : base(id, type, layout)
 {
 }
예제 #26
0
 public string Addon(AddonType addonType) => null;
예제 #27
0
 public virtual string Addon(AddonType addonType) => "e-control-helper";