void Start()
 {
     version.GetComponent <UILabel>().text        = Localization.Localize(StringKey.CurrentVersion) + ": " + MultiPlatform.GetAppVersion();
     wifiLimitState.GetComponent <UILabel>().text = Localization.Localize(AppSetting.getInstance().wifiLimit ? StringKey.On : StringKey.Off);
     cacheSpace.GetComponent <UILabel>().text     = GetCacheSpace();
 }
Exemple #2
0
        public static int Process(string NameSrc, Formats FormatSrc, string NameDst, Formats FormatDst,
                                  Sites Site, bool Browse)
        {
            var binSrc = new byte[0];
            var txtSrc = "";

            if (FormatSrc == Formats.TT7)
            {
                try
                {
                    binSrc = File.ReadAllBytes(NameSrc);
                    binSrc = Converter.FromTT7(binSrc);
                }
                catch
                {
                    return(Program.PrintError("Inputfile " + NameSrc + " could not be opened."));
                }
            }
            else if (FormatSrc == Formats.TT8)
            {
                try
                {
                    binSrc = File.ReadAllBytes(NameSrc);
                }
                catch
                {
                    return(Program.PrintError("Inputfile " + NameSrc + " could not be opened."));
                }
            }
            else // FormatSrc == Formats.TTU
            {
                try
                {
                    txtSrc = File.ReadAllText(NameSrc);
                    binSrc = Converter.FromTTU(txtSrc);
                }
                catch
                {
                    return(Program.PrintError("Inputfile " + NameSrc + " could not be opened."));
                }
            }
            if (!(binSrc.Length == 960 || binSrc.Length == 1000))
            {
                return(Program.PrintError("Inputfile " + NameSrc + " is the wrong length."));
            }
            byte[] binDst = new byte[0];
            string txtDst = "";

            if (FormatDst == Formats.TT7)
            {
                try
                {
                    binDst = Converter.ToTT7(binSrc);
                }
                catch
                {
                    return(Program.PrintError("Inputfile " + NameSrc + " could not be converted to TT7 format."));
                }
            }
            else if (FormatDst == Formats.TT8)
            {
                binDst = binSrc;
            }
            else // FormatDst == Formats.TTU
            {
                txtDst = Converter.ToTTU(binSrc, Site.GetURL());
            }
            try
            {
                if (!string.IsNullOrWhiteSpace(NameDst))
                {
                    if (FormatDst == Formats.TTU)
                    {
                        File.WriteAllText(NameDst, txtDst);
                        Program.PrintMessage("Created " + NameDst + " in "
                                             + Site.GetDescription() + " URL format.");
                    }
                    else
                    {
                        File.WriteAllBytes(NameDst, binDst);
                        Program.PrintMessage("Created " + NameDst + " in "
                                             + FormatDst.GetDescription() + " format.");
                    }
                }
                if (Browse && FormatDst != Formats.TTU)
                {
                    txtDst = Converter.ToTTU(binSrc, Site.GetURL());
                }
                if (Browse)
                {
                    var mp = new MultiPlatform();
                    if (!mp.OpenURL(txtDst))
                    {
                        return(Program.PrintError("Could not send page data to "
                                                  + Site.GetURL().Replace("#", "").Replace("<Data>", "").Replace("<NewID>", "").TrimEnd('/') + "."));
                    }
                    Program.PrintMessage("Sent page data to "
                                         + Site.GetURL().Replace("#", "").Replace("<Data>", "").Replace("<NewID>", "").TrimEnd('/')
                                         + " in " + Site.GetDescription() + " format.");
                }
                return(0);
            }
            catch
            {
                return(Program.PrintError("Outputfile " + NameDst + " could not be created."));
            }
        }
 public LocationStatusChangedEventArgs(MultiPlatform.Domain.Interfaces.LocationStatus status)
 {
     Status = status;
 }