Beispiel #1
0
 public static void UploadAllCloudData()
 {
     foreach (string path in DuckFile.GetFilesNoCloud(DuckFile.profileDirectory, so: SearchOption.AllDirectories))
     {
         DuckFile.SaveCloudFile(path);
     }
     foreach (string path in DuckFile.GetFilesNoCloud(DuckFile.levelDirectory, so: SearchOption.AllDirectories))
     {
         DuckFile.SaveCloudFile(path);
     }
     foreach (string path in DuckFile.GetFilesNoCloud(DuckFile.optionsDirectory, so: SearchOption.AllDirectories))
     {
         DuckFile.SaveCloudFile(path);
     }
 }
Beispiel #2
0
        public static void SaveChunk(BinaryClassChunk doc, string path)
        {
            DuckFile.CreatePath(Path.GetDirectoryName(path));
            try
            {
                if (File.Exists(path))
                {
                    File.SetAttributes(path, FileAttributes.Normal);
                }
            }
            catch (Exception ex)
            {
            }
            BitBuffer  bitBuffer  = doc.Serialize();
            FileStream fileStream = File.Create(path);

            fileStream.Write(bitBuffer.buffer, 0, bitBuffer.lengthInBytes);
            fileStream.Close();
            DuckFile.SaveCloudFile(path);
        }
Beispiel #3
0
        public static void SaveXDocument(XDocument doc, string path)
        {
            DuckFile.CreatePath(Path.GetDirectoryName(path));
            try
            {
                if (File.Exists(path))
                {
                    File.SetAttributes(path, FileAttributes.Normal);
                }
            }
            catch (Exception ex)
            {
            }
            string contents = doc.ToString();

            if (string.IsNullOrWhiteSpace(contents))
            {
                throw new Exception("Blank XML (" + path + ")");
            }
            File.WriteAllText(path, contents);
            DuckFile.SaveCloudFile(path);
        }