SparkleShare.SparkleController.CreateSparkleShareFolder C# (CSharp) Method

CreateSparkleShareFolder() public method

public CreateSparkleShareFolder ( ) : bool
return bool
        public override bool CreateSparkleShareFolder()
        {
            if (Directory.Exists (FoldersPath))
                return false;

            Directory.CreateDirectory (FoldersPath);

            File.SetAttributes (FoldersPath, File.GetAttributes (FoldersPath) | FileAttributes.System);
            SparkleLogger.LogInfo ("Config", "Created '" + FoldersPath + "'");

            string app_path       = Path.GetDirectoryName (Forms.Application.ExecutablePath);
            string icon_file_path = Path.Combine (app_path, "Images", "sparkleshare-folder.ico");

            if (!File.Exists (icon_file_path)) {
                string ini_file_path  = Path.Combine (FoldersPath, "desktop.ini");
                string n = Environment.NewLine;

                string ini_file = "[.ShellClassInfo]" + n +
                    "IconFile=" + icon_file_path + n +
                    "IconIndex=0" + n +
                    "InfoTip=SparkleShare";

                try {
                    File.Create (ini_file_path).Close ();
                    File.WriteAllText (ini_file_path, ini_file);

                    File.SetAttributes (ini_file_path,
                        File.GetAttributes (ini_file_path) | FileAttributes.Hidden | FileAttributes.System);

                } catch (IOException e) {
                    SparkleLogger.LogInfo ("Config", "Failed setting icon for '" + FoldersPath + "': " + e.Message);
                }

                return true;
            }

            return false;
        }