示例#1
0
 public void changeiOSto(iOS newiOS, bool backItUp, bool archive)
 {
     if (File.Exists(path + "/Info.plist"))
     {
         if (backItUp)
         {
             File.Copy(path + "/Info.plist", path + "/Info - " + DateTime.Now.ToString().Replace(":", "-") + ".plist");
         }
         if (archive)
         {
             DirectoryInfo dir     = new DirectoryInfo(path);
             string        newPath = dir.FullName.Replace("\\" + dir.Name, "") + "/" + dir.Name + " - " + DateTime.Now.ToString().Replace(":", "-");
             Directory.Move(path, newPath);
             path = newPath;
         }
         string text = File.ReadAllText(path + "/Info.plist");
         text = text.Replace(ios.version, newiOS.version);
         text = text.Replace(ios.buildNumber, newiOS.buildNumber);
         File.WriteAllText(path + "/Info.plist", text);
     }
     else
     {
         throw new ArgumentException("File \"" + path + "/Info.plist" + "\" not found");
     }
 }
示例#2
0
 public Backup(string path)
 {
     if (File.Exists(path + "/Info.plist"))
     {
         PList backup = new PList(path + "/Info.plist");
         ios                  = new iOS();
         device               = new Device();
         name                 = new DirectoryInfo(path).Name;
         this.path            = path;
         date                 = backup.First(s => s.Key == "Last Backup Date").Value;
         ios.buildNumber      = backup.First(s => s.Key == "Build Version").Value;
         ios.version          = backup.First(s => s.Key == "Product Version").Value;
         ios.name             = MainForm.iOSVersionsList.First(s => s.version == ios.version).name;
         device.deviceName    = backup.First(s => s.Key == "Device Name").Value;
         device.deviceType    = backup.First(s => s.Key == "Product Name").Value;
         device.deviceVersion = backup.First(s => s.Key == "Product Type").Value;
     }
     else
     {
         throw new ArgumentException("\"Info.plist\" not found");
     }
 }
示例#3
0
        private void loadiOSDatabase()
        {
            HttpWebRequest  request  = (HttpWebRequest)WebRequest.Create(databaseUrl);
            HttpWebResponse response = (HttpWebResponse)request.GetResponse();

            if (response.StatusCode == HttpStatusCode.OK)
            {
                Stream       receiveStream = response.GetResponseStream();
                StreamReader readStream    = null;

                if (response.CharacterSet == null)
                {
                    readStream = new StreamReader(receiveStream);
                }
                else
                {
                    readStream = new StreamReader(receiveStream, Encoding.GetEncoding(response.CharacterSet));
                }

                string html = readStream.ReadToEnd();

                response.Close();
                readStream.Close();

                MatchCollection rawData = Regex.Matches(html, "<tr valign=\"top\"(.+?)</td>", RegexOptions.Singleline);
                foreach (Match m in rawData)
                {
                    iOS    ios   = new iOS();
                    string raw   = "";
                    int    index = 0;
                    try
                    {
                        raw = Regex.Matches(m.ToString(), "<th style=(.+?)</th>", RegexOptions.Singleline)[0].ToString();
                    }
                    catch
                    {
                        raw = Regex.Matches(m.ToString(), "style=(.+?)</th>", RegexOptions.Singleline)[0].ToString();
                    }
                    while (true)
                    {
                        raw = raw.Replace("</th>", "").Replace("\n", "").Replace("<sup", "");
                        if (raw[0] != '>')
                        {
                            raw = raw.Remove(0, 1);
                        }
                        else
                        {
                            raw   = raw.Remove(0, 1);
                            index = raw.IndexOf("id=");
                            if (index > 0)
                            {
                                raw = raw.Substring(0, index);
                            }
                            ios.name = raw;
                            index    = raw.IndexOf(" ");
                            if (index > 0)
                            {
                                raw = raw.Substring(0, index);
                            }
                            ios.version = raw;
                            break;
                        }
                    }
                    raw = Regex.Matches(m.ToString(), "<td>(.+?)</td>", RegexOptions.Singleline)[0].ToString();

                    index = raw.IndexOf(">");
                    if (index > 0)
                    {
                        raw   = raw.Substring(index + 1, raw.Length - index - 1);
                        index = 0;
                        foreach (char c in raw)
                        {
                            if (c == ' ' || c == '\n' || c == '<')
                            {
                                raw = raw.Substring(0, index);
                                break;
                            }
                            index++;
                        }
                    }
                    ios.buildNumber = raw;
                    iOSVersionsList.Add(ios);
                }
            }
        }