Пример #1
0
        public string GetMelderInfo()
        {
            // If the user copied the whole forum attachment URL, extract the attachment number from it.
            string _MI_DLURL_P = _MI_DLURL;

            if (_MI_Provider == AddonProviderType.FirefallForums && _MI_DLURL.StartsWith("http"))
            {
                Regex r = new Regex(@"https?:\/\/.+\/attachments\/.+\.(\d+)");
                foreach (Match c in r.Matches(_MI_DLURL))
                {
                    if (c.Groups.Count == 2)
                    {
                        _MI_DLURL_P = c.Groups[1].Value;
                    }
                }
            }

            string info = "[center][url={0}?id={1}][img]{2}[/img][/url][size=1][color=#161C1C][melder_info]version={3};patch={4};dlurl={1};providertype={5}[/melder_info][/color][/size][/center]";

            info = string.Format(info,
                                 Properties.Settings.Default.MI_HostURL,    // host
                                 _MI_DLURL_P,                               // Download url
                                 Properties.Settings.Default.MI_HostImgURL, // img
                                 _MI_AddonVersion,                          // addon version
                                 _MI_FirefallPatch,                         // Firefall Version
                                 _MI_Provider.ToString());                  // Provider
            return(info);
        }
Пример #2
0
        public void WriteToIni(string path)
        {
            using (TextWriter ini = new StreamWriter(File.OpenWrite(path)))
            {
                ini.WriteLine(string.Format("; Meldii generated installation info for {0}.\n", Name));

                ini.WriteLine(string.Format("title={0}", Name));
                ini.WriteLine(string.Format("author={0}", Author));
                ini.WriteLine(string.Format("version={0}", Version));
                ini.WriteLine(string.Format("patch={0}", Patch));
                ini.WriteLine(string.Format("url={0}", AddonPage));
                ini.WriteLine(string.Format("destination={0}", Destination));
                ini.WriteLine(string.Format("description={0}", Description));
                ini.WriteLine(string.Format("providertype={0}", ProviderType.ToString()));

                if (!String.IsNullOrEmpty(Source))
                {
                    ini.WriteLine(string.Format("source={0}", Source));
                }

                if (!String.IsNullOrEmpty(_UpdateURL))
                {
                    ini.WriteLine(string.Format("updateurl={0}", _UpdateURL));
                }

                foreach (string str in InstalledFilesList)
                {
                    ini.WriteLine(string.Format("installed={0}", str));
                }

                foreach (string str in RemoveFilesList)
                {
                    ini.WriteLine(string.Format("remove={0}", str));
                }

                foreach (string str in IngoreFileList)
                {
                    ini.WriteLine(string.Format("ignore={0}", str));
                }
            }
        }