Beispiel #1
0
        internal void CopyToDevice(String srcFile, String destPath)
        {
            FileInfo thisFile = new FileInfo(srcFile);

            Console.WriteLine(thisFile.Attributes.ToString());
            if ((thisFile.Attributes & FileAttributes.Directory) == FileAttributes.Directory)
            {
                String[] files = Directory.GetFileSystemEntries(thisFile.FullName);
                for (Int32 i = 0; i < files.Length; i++)
                {
                    String newDirectory = destPath + "/" + thisFile.Name;
                    myPhone.CreateDirectory(newDirectory);
                    CopyToDevice(files[i], newDirectory);
                }
            }
            else
            {
                Byte[] fileBuffer = new Byte[1024];
                Int32  length;
                labelStatus.Text = "Copying " + thisFile.FullName;

                using (Stream inStream = File.OpenRead(thisFile.FullName)) {
                    using (Stream outStream =
                               iPhoneFile.OpenWrite(myPhone, destPath + "/" + Path.GetFileName(thisFile.FullName))) {
                        while ((length = inStream.Read(fileBuffer, 0, fileBuffer.Length)) > 0)
                        {
                            outStream.Write(fileBuffer, 0, length);
                        }
                    }
                }
                Application.DoEvents();
            }
        }
        private void btnInstall_Click(object sender, EventArgs e)
        {
            // In this version user must respring by him/herself
            // Later I will add respring via OpenSSH feature.
            string appName    = listView.SelectedItems[0].Text;
            string iconName   = Data.dictIcon[appName][0];
            string bundleName = Data.dictIcon[appName][1];

            if (iDevice.Exists("/Library/Themes/Jaku Essentials.theme/Bundles"))
            {
                iDevice.CreateDirectory("/Library/Themes/Jaku Essentials.theme/Bundles/" + bundleName);
                sendFile("tmp\\icon.png", "/Library/Themes/Jaku Essentials.theme/Bundles/" + bundleName + "/" + iconName);
                // Delete cache, sometimes only respringing is not the solution.
                foreach (var item in iDevice.GetFiles("/var/mobile/Library/Caches/com.apple.IconsCache"))
                {
                    if (item.StartsWith(bundleName))
                    {
                        iDevice.DeleteFile("/var/mobile/Library/Caches/com.apple.IconsCache/" + item);
                    }
                }
                MessageBox.Show("The icon has been installed!\r\nYou have to respring your iDevice in order to see changes!", "Success!", MessageBoxButtons.OK, MessageBoxIcon.Information);
                this.Close();
            }
            else
            {
                MessageBox.Show(@"Make sure you have installed Jaku Theme!\r\n""Jaku Essentials.theme"" not found!", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
 public override NT_STATUS CreateDirectory(UserContext UserContext, string Path, FileAttributes Attributes)
 {
     if (Path.IndexOf("\\") == -1)
     {
         return(NT_STATUS.OBJECT_PATH_NOT_FOUND); // Dir not found as no dir is there
     }
     if (phone.Exists(root + Path))
     {
         return(NT_STATUS.OBJECT_NAME_COLLISION);  // File/Directory already exists
     }
     phone.CreateDirectory(root + Path);
     // FIXME: We have no way of dealing with directory or file attributes
     //if (Attributes != FileAttributes.Normal)
     //{
     //    DirectoryInfo DI = new DirectoryInfo(root + Path);
     //    DI.Attributes = Attributes;
     //}
     return(NT_STATUS.OK);
 }
Beispiel #4
0
 public static void CreateRemoteDirectory(iPhone iPhone, string directory)
 {
     iPhone.CreateDirectory(directory);
 }