public void GetFilesReturnsAllFilesInFolder()
 {
     var sut = new SystemFileDescriptorProvider();
     var descriptor = new FileDescriptor(TestResources.ResourcesPath);
     var files = sut.GetFiles(descriptor);
     Assert.That(files.Select(x => x.Path), Is.EquivalentTo(new [] { TestResources.EinsteinJpegPath, TestResources.TextFilePath}));
 }
 public void SameFileIsNotDuplicate()
 {
     var sut = new StatDuplicateComparer();
     var descriptor = new FileDescriptor(TestResources.TextFilePath) { StatHash = new byte[] { 1, 2, 3 } };
     var actual = sut.Equals(descriptor, descriptor);
     Assert.That(actual, Is.False);
 }
 public void UpdateFileSignature(FileDescriptor descriptor)
 {
     using (var stream = File.OpenRead(descriptor.Path))
     {
         descriptor.ContentHash = hashGenerator.Generate(stream);
     }
 }
Example #4
0
        public NewFilePublish(string fileName, FileDescriptor descriptor, IList<PieceHash> hashes)
        {
            this.fileName = fileName;
            this.descriptor = descriptor;

            this.hashes = hashes;
        }
 public void GetDirectoriesReturnsAllFoldersInFolder()
 {
     var sut = new SystemFileDescriptorProvider();
     var descriptor = new FileDescriptor(TestResources.ResourcesPath) { IsFolder = true};
     var folders = sut.GetDirectories(descriptor);
     Assert.That(folders.Select(x => x.Path), Is.EquivalentTo(new[] { TestResources.SubPath }));
 }
Example #6
0
    public void SelectFileDescriptor(FileDescriptor fd)
    {
        SelectedFiledescriptor = fd;

        actionGroup.blocksRaycasts = true;
        actionGroup.interactable = true;
    }
Example #7
0
 internal MethodDescriptor(MethodDescriptorProto proto, FileDescriptor file,
                           ServiceDescriptor parent, int index)
     : base(file, parent.FullName + "." + proto.Name, index)
 {
     this.proto = proto;
     service = parent;
     file.DescriptorPool.AddSymbol(this);
 }
 public void SameStatHashAreDuplicates()
 {
     var sut = new StatDuplicateComparer();
     var descriptorA = new FileDescriptor(TestResources.TextFilePath) { StatHash = new byte[] { 1, 1, 1 } };
     var descriptorB = new FileDescriptor(TestResources.SubTextFilePath) { StatHash = new byte[] { 1, 1, 1 } };
     var actual = sut.Equals(descriptorA, descriptorB);
     Assert.That(actual, Is.True);
 }
Example #9
0
        internal ServiceDescriptor(ServiceDescriptorProto proto, FileDescriptor file, int index)
            : base(file, file.ComputeFullName(null, proto.Name), index)
        {
            this.proto = proto;
            methods = DescriptorUtil.ConvertAndMakeReadOnly(proto.Method,
                                                            (method, i) => new MethodDescriptor(method, file, this, i));

            file.DescriptorPool.AddSymbol(this);
        }
Example #10
0
 internal EnumValueDescriptor(EnumValueDescriptorProto proto, FileDescriptor file,
                              EnumDescriptor parent, int index)
     : base(file, parent.FullName + "." + proto.Name, index)
 {
     this.proto = proto;
     enumDescriptor = parent;
     file.DescriptorPool.AddSymbol(this);
     file.DescriptorPool.AddEnumValueByNumber(this);
 }
Example #11
0
        internal OneofDescriptor(OneofDescriptorProto proto, FileDescriptor file, MessageDescriptor parent, int index, string clrName)
            : base(file, file.ComputeFullName(parent, proto.Name), index)
        {
            this.proto = proto;
            containingType = parent;

            file.DescriptorPool.AddSymbol(this);
            accessor = CreateAccessor(clrName);
        }
Example #12
0
        internal OneofDescriptor(OneofDescriptorProto proto, FileDescriptor file,
                                 MessageDescriptor parent, int index)
        {
            this.proto = proto;
            this.file = file;
            this.index = index;

            containingType = parent;
            fieldCount = 0;
        }
Example #13
0
 static Item()
 {
     byte[] numArray = Convert.FromBase64String("Cg9ydXN0L2l0ZW0ucHJvdG8SCVJ1c3RQcm90bxoTcnVzdC9pdGVtX21vZC5wcm90byKaAQoESXRlbRIKCgJpZBgBIAIoBRIMCgRuYW1lGAIgASgJEgwKBHNsb3QYAyABKAUSDQoFY291bnQYBCABKAUSEAoIc3Vic2xvdHMYBiABKAUSEQoJY29uZGl0aW9uGAcgASgCEhQKDG1heGNvbmRpdGlvbhgIIAEoAhIgCgdzdWJpdGVtGAUgAygLMg8uUnVzdFByb3RvLkl0ZW1CAkgB");
     FileDescriptor.InternalDescriptorAssigner internalDescriptorAssigner = (FileDescriptor root) => {
         RustProto.Proto.Item.descriptor = root;
         RustProto.Proto.Item.internal__static_RustProto_Item__Descriptor = RustProto.Proto.Item.Descriptor.MessageTypes[0];
         RustProto.Proto.Item.internal__static_RustProto_Item__FieldAccessorTable = new FieldAccessorTable<RustProto.Item, RustProto.Item.Builder>(RustProto.Proto.Item.internal__static_RustProto_Item__Descriptor, new string[] { "Id", "Name", "Slot", "Count", "Subslots", "Condition", "Maxcondition", "Subitem" });
         return null;
     };
     FileDescriptor.InternalBuildGeneratedFileFrom(numArray, new FileDescriptor[] { RustProto.Proto.ItemMod.Descriptor }, internalDescriptorAssigner);
 }
 public void FileDescriptorsHaveCorrectStats()
 {
     TestResources.Initialize();
     var sut = new SystemFileDescriptorProvider();
     var descriptor = new FileDescriptor(TestResources.ResourcesPath);
     var file = sut.GetFiles(descriptor).First(x => x.Path == TestResources.EinsteinJpegPath );
     Assert.That(file.Size, Is.EqualTo(52439));
     Assert.That(file.CreateTime, Is.EqualTo(TestResources.EinsteinJpegCreateTime));
     Assert.That(file.ModifyTime, Is.EqualTo(TestResources.EinsteinJpegModifyTime));
     Assert.That(file.IsFolder, Is.False);
 }
Example #15
0
 static Blueprint()
 {
     byte[] numArray = Convert.FromBase64String("ChRydXN0L2JsdWVwcmludC5wcm90bxIJUnVzdFByb3RvIhcKCUJsdWVwcmludBIKCgJpZBgBIAIoBUICSAE=");
     FileDescriptor.InternalDescriptorAssigner internalDescriptorAssigner = (FileDescriptor root) => {
         RustProto.Proto.Blueprint.descriptor = root;
         RustProto.Proto.Blueprint.internal__static_RustProto_Blueprint__Descriptor = RustProto.Proto.Blueprint.Descriptor.MessageTypes[0];
         RustProto.Proto.Blueprint.internal__static_RustProto_Blueprint__FieldAccessorTable = new FieldAccessorTable<RustProto.Blueprint, RustProto.Blueprint.Builder>(RustProto.Proto.Blueprint.internal__static_RustProto_Blueprint__Descriptor, new string[] { "Id" });
         return null;
     };
     FileDescriptor.InternalBuildGeneratedFileFrom(numArray, new FileDescriptor[0], internalDescriptorAssigner);
 }
Example #16
0
 static Vitals()
 {
     byte[] numArray = Convert.FromBase64String("ChFydXN0L3ZpdGFscy5wcm90bxIJUnVzdFByb3RvIu8BCgZWaXRhbHMSEwoGaGVhbHRoGAEgASgCOgMxMDASFQoJaHlkcmF0aW9uGAIgASgCOgIzMBIWCghjYWxvcmllcxgDIAEoAjoEMTAwMBIUCglyYWRpYXRpb24YBCABKAI6ATASGQoOcmFkaWF0aW9uX2FudGkYBSABKAI6ATASFgoLYmxlZWRfc3BlZWQYBiABKAI6ATASFAoJYmxlZWRfbWF4GAcgASgCOgEwEhUKCmhlYWxfc3BlZWQYCCABKAI6ATASEwoIaGVhbF9tYXgYCSABKAI6ATASFgoLdGVtcGVyYXR1cmUYCiABKAI6ATBCAkgB");
     FileDescriptor.InternalDescriptorAssigner internalDescriptorAssigner = (FileDescriptor root) => {
         RustProto.Proto.Vitals.descriptor = root;
         RustProto.Proto.Vitals.internal__static_RustProto_Vitals__Descriptor = RustProto.Proto.Vitals.Descriptor.MessageTypes[0];
         RustProto.Proto.Vitals.internal__static_RustProto_Vitals__FieldAccessorTable = new FieldAccessorTable<RustProto.Vitals, RustProto.Vitals.Builder>(RustProto.Proto.Vitals.internal__static_RustProto_Vitals__Descriptor, new string[] { "Health", "Hydration", "Calories", "Radiation", "RadiationAnti", "BleedSpeed", "BleedMax", "HealSpeed", "HealMax", "Temperature" });
         return null;
     };
     FileDescriptor.InternalBuildGeneratedFileFrom(numArray, new FileDescriptor[0], internalDescriptorAssigner);
 }
        public void GeneratesFileSignatureFromNameModifyAndSize()
        {
            var descriptor = new FileDescriptor("myfile.txt");
            descriptor.ModifyTime = new DateTime(2013, 12, 24, 0, 0, 0, DateTimeKind.Utc);
            descriptor.Size = 1024;

            var sut = new StatSignatureGenerator(new SHA1HashGenerator());
            sut.UpdateFileSignature(descriptor);
            var b64Signature = Convert.ToBase64String(descriptor.StatHash);
            Assert.That(b64Signature, Is.EqualTo("bnx6xtNphTyaIB5Cz4Yw7X6nsVk="));
        }
Example #18
0
 static ItemMod()
 {
     byte[] numArray = Convert.FromBase64String("ChNydXN0L2l0ZW1fbW9kLnByb3RvEglSdXN0UHJvdG8iIwoHSXRlbU1vZBIKCgJpZBgBIAIoBRIMCgRuYW1lGAIgASgJQgJIAQ==");
     FileDescriptor.InternalDescriptorAssigner internalDescriptorAssigner = (FileDescriptor root) => {
         RustProto.Proto.ItemMod.descriptor = root;
         RustProto.Proto.ItemMod.internal__static_RustProto_ItemMod__Descriptor = RustProto.Proto.ItemMod.Descriptor.MessageTypes[0];
         RustProto.Proto.ItemMod.internal__static_RustProto_ItemMod__FieldAccessorTable = new FieldAccessorTable<RustProto.ItemMod, RustProto.ItemMod.Builder>(RustProto.Proto.ItemMod.internal__static_RustProto_ItemMod__Descriptor, new string[] { "Id", "Name" });
         return null;
     };
     FileDescriptor.InternalBuildGeneratedFileFrom(numArray, new FileDescriptor[0], internalDescriptorAssigner);
 }
 public void FolderDescriptorsHaveCorrectStats()
 {
     TestResources.Initialize();
     var sut = new SystemFileDescriptorProvider();
     var descriptor = new FileDescriptor(TestResources.ResourcesPath);
     var file = sut.GetDirectories(descriptor).First(x => x.Path == TestResources.SubPath);
     Assert.That(file.Size, Is.EqualTo(0));
     Assert.That(file.CreateTime, Is.EqualTo(TestResources.SubFolderCreateTime));
     Assert.That(file.ModifyTime, Is.EqualTo(TestResources.SubFolderModifyTime));
     Assert.That(file.IsFolder, Is.True);
 }
        public void GeneratesFileSignatureFromFileContent()
        {
            var descriptor = new FileDescriptor(TestResources.TextFilePath);
            // Set modify time and size to random values to prove that these are ignored
            descriptor.ModifyTime = DateTime.Now;
            descriptor.Size = descriptor.ModifyTime.Millisecond;

            var sut = new ContentSignatureGenerator(new SHA1HashGenerator());
            sut.UpdateFileSignature(descriptor);
            var b64Signature = Convert.ToBase64String(descriptor.ContentHash);
            Assert.That(b64Signature, Is.EqualTo("OkwbOzKOydWv3BCGQt/udXjMlx8="));
        }
 public IEnumerable<FileDescriptor> GetDeep(FileDescriptor descriptor)
 {
     yield return descriptor;
     foreach (var child in descriptor.Children)
     {
         var childDescriptors = GetDeep(child);
         foreach (var childDescriptor in childDescriptors)
         {
             yield return childDescriptor;
         }
     }
 }
Example #22
0
 static Avatar()
 {
     byte[] numArray = Convert.FromBase64String("ChFydXN0L2F2YXRhci5wcm90bxIJUnVzdFByb3RvGhRydXN0L2JsdWVwcmludC5wcm90bxoPcnVzdC9pdGVtLnByb3RvGhFydXN0L2NvbW1vbi5wcm90bxoRcnVzdC92aXRhbHMucHJvdG8iqAIKBkF2YXRhchIeCgNwb3MYASABKAsyES5SdXN0UHJvdG8uVmVjdG9yEiIKA2FuZxgCIAEoCzIVLlJ1c3RQcm90by5RdWF0ZXJuaW9uEiEKBnZpdGFscxgDIAEoCzIRLlJ1c3RQcm90by5WaXRhbHMSKAoKYmx1ZXByaW50cxgEIAMoCzIULlJ1c3RQcm90by5CbHVlcHJpbnQSIgoJaW52ZW50b3J5GAUgAygLMg8uUnVzdFByb3RvLkl0ZW0SIQoId2VhcmFibGUYBiADKAsyDy5SdXN0UHJvdG8uSXRlbRIdCgRiZWx0GAcgAygLMg8uUnVzdFByb3RvLkl0ZW0SJwoJYXdheUV2ZW50GAggASgLMhQuUnVzdFByb3RvLkF3YXlFdmVudCKZAQoJQXdheUV2ZW50EjAKBHR5cGUYASACKA4yIi5SdXN0UHJvdG8uQXdheUV2ZW50LkF3YXlFdmVudFR5cGUSEQoJdGltZXN0YW1wGAIgAigFEhIKCmluc3RpZ2F0b3IYAyABKAQiMwoNQXdheUV2ZW50VHlwZRILCgdVTktOT1dOEAASCwoHU0xVTUJFUhABEggKBERJRUQQAkICSAE=");
     FileDescriptor.InternalDescriptorAssigner internalDescriptorAssigner = (FileDescriptor root) => {
         RustProto.Proto.Avatar.descriptor = root;
         RustProto.Proto.Avatar.internal__static_RustProto_Avatar__Descriptor = RustProto.Proto.Avatar.Descriptor.MessageTypes[0];
         RustProto.Proto.Avatar.internal__static_RustProto_Avatar__FieldAccessorTable = new FieldAccessorTable<RustProto.Avatar, RustProto.Avatar.Builder>(RustProto.Proto.Avatar.internal__static_RustProto_Avatar__Descriptor, new string[] { "Pos", "Ang", "Vitals", "Blueprints", "Inventory", "Wearable", "Belt", "AwayEvent" });
         RustProto.Proto.Avatar.internal__static_RustProto_AwayEvent__Descriptor = RustProto.Proto.Avatar.Descriptor.MessageTypes[1];
         RustProto.Proto.Avatar.internal__static_RustProto_AwayEvent__FieldAccessorTable = new FieldAccessorTable<AwayEvent, AwayEvent.Builder>(RustProto.Proto.Avatar.internal__static_RustProto_AwayEvent__Descriptor, new string[] { "Type", "Timestamp", "Instigator" });
         return null;
     };
     FileDescriptor.InternalBuildGeneratedFileFrom(numArray, new FileDescriptor[] { RustProto.Proto.Blueprint.Descriptor, RustProto.Proto.Item.Descriptor, Common.Descriptor, RustProto.Proto.Vitals.Descriptor }, internalDescriptorAssigner);
 }
Example #23
0
 static Common()
 {
     byte[] numArray = Convert.FromBase64String("ChFydXN0L2NvbW1vbi5wcm90bxIJUnVzdFByb3RvIjIKBlZlY3RvchIMCgF4GAEgASgCOgEwEgwKAXkYAiABKAI6ATASDAoBehgDIAEoAjoBMCJECgpRdWF0ZXJuaW9uEgwKAXgYASABKAI6ATASDAoBeRgCIAEoAjoBMBIMCgF6GAMgASgCOgEwEgwKAXcYBCABKAI6ATBCAkgB");
     FileDescriptor.InternalDescriptorAssigner internalDescriptorAssigner = (FileDescriptor root) => {
         Common.descriptor = root;
         Common.internal__static_RustProto_Vector__Descriptor = Common.Descriptor.MessageTypes[0];
         Common.internal__static_RustProto_Vector__FieldAccessorTable = new FieldAccessorTable<Vector, Vector.Builder>(Common.internal__static_RustProto_Vector__Descriptor, new string[] { "X", "Y", "Z" });
         Common.internal__static_RustProto_Quaternion__Descriptor = Common.Descriptor.MessageTypes[1];
         Common.internal__static_RustProto_Quaternion__FieldAccessorTable = new FieldAccessorTable<Quaternion, Quaternion.Builder>(Common.internal__static_RustProto_Quaternion__Descriptor, new string[] { "X", "Y", "Z", "W" });
         return null;
     };
     FileDescriptor.InternalBuildGeneratedFileFrom(numArray, new FileDescriptor[0], internalDescriptorAssigner);
 }
Example #24
0
		/// <summary>
		/// 	processing of execution - main method of action
		/// </summary>
		/// <returns> </returns>
		protected override object MainProcess() {
			var file = WikiSource.LoadBinary(Code, WithData);
			if (null == file) {
				throw new Exception("file not found");
			}
			var filedesc = new FileDescriptor();
			filedesc.NeedDisposition = AsFile;
			filedesc.LastWriteTime = file.LastWriteTime;
			filedesc.MimeType = file.MimeType;
			filedesc.Data = file.Data;
			filedesc.Length = (int)file.Size;
			return filedesc;
		}
Example #25
0
 static Error()
 {
     byte[] numArray = Convert.FromBase64String("ChBydXN0L2Vycm9yLnByb3RvEglSdXN0UHJvdG8iKAoFRXJyb3ISDgoGc3RhdHVzGAEgAigJEg8KB21lc3NhZ2UYAiACKAkiKQoJR2FtZUVycm9yEg0KBWVycm9yGAEgAigJEg0KBXRyYWNlGAIgAigJQgJIAQ==");
     FileDescriptor.InternalDescriptorAssigner internalDescriptorAssigner = (FileDescriptor root) => {
         RustProto.Proto.Error.descriptor = root;
         RustProto.Proto.Error.internal__static_RustProto_Error__Descriptor = RustProto.Proto.Error.Descriptor.MessageTypes[0];
         RustProto.Proto.Error.internal__static_RustProto_Error__FieldAccessorTable = new FieldAccessorTable<RustProto.Error, RustProto.Error.Builder>(RustProto.Proto.Error.internal__static_RustProto_Error__Descriptor, new string[] { "Status", "Message" });
         RustProto.Proto.Error.internal__static_RustProto_GameError__Descriptor = RustProto.Proto.Error.Descriptor.MessageTypes[1];
         RustProto.Proto.Error.internal__static_RustProto_GameError__FieldAccessorTable = new FieldAccessorTable<GameError, GameError.Builder>(RustProto.Proto.Error.internal__static_RustProto_GameError__Descriptor, new string[] { "Error", "Trace" });
         return null;
     };
     FileDescriptor.InternalBuildGeneratedFileFrom(numArray, new FileDescriptor[0], internalDescriptorAssigner);
 }
 public void UpdateFolderSignature(FileDescriptor descriptor)
 {
     var allChildBytes = new List<byte>();
     if (descriptor.Children == null) return;
     foreach (var childDescriptor in descriptor.Children)
     {
         // TODO: Log warning if ContentHash is null. The hash may be null if access to the file/folder was denied.
         if (childDescriptor.ContentHash != null)
         {
             allChildBytes.AddRange(childDescriptor.ContentHash);
         }
     }
     descriptor.ContentHash = hashGenerator.Generate(allChildBytes.ToArray());
 }
        public InstallShieldCABCompression(Stream header, Dictionary<int, Stream> volumes)
        {
            this.volumes = volumes;

            if (header.ReadUInt32() != 0x28635349)
                throw new InvalidDataException("Not an Installshield CAB package");

            header.Position += 8;
            var cabDescriptorOffset = header.ReadUInt32();
            header.Position = cabDescriptorOffset + 12;
            var cabDescriptor = new CabDescriptor(header);
            header.Position += 14;

            var fileGroupOffsets = new uint[MaxFileGroupCount];
            for (var i = 0; i < MaxFileGroupCount; i++)
                fileGroupOffsets[i] = header.ReadUInt32();

            header.Position = cabDescriptorOffset + cabDescriptor.FileTableOffset;
            var directories = new DirectoryDescriptor[cabDescriptor.DirectoryCount];
            for (var i = 0; i < directories.Length; i++)
                directories[i] = new DirectoryDescriptor(header, cabDescriptorOffset + cabDescriptor.FileTableOffset);

            var fileGroups = new List<FileGroup>();
            foreach (var offset in fileGroupOffsets)
            {
                var nextOffset = offset;
                while (nextOffset != 0)
                {
                    header.Position = cabDescriptorOffset + (long)nextOffset + 4;
                    var descriptorOffset = header.ReadUInt32();
                    nextOffset = header.ReadUInt32();
                    header.Position = cabDescriptorOffset + descriptorOffset;

                    fileGroups.Add(new FileGroup(header, cabDescriptorOffset));
                }
            }

            header.Position = cabDescriptorOffset + cabDescriptor.FileTableOffset + cabDescriptor.FileTableOffset2;
            foreach (var fileGroup in fileGroups)
            {
                for (var i = fileGroup.FirstFile; i <= fileGroup.LastFile; i++)
                {
                    header.Position = cabDescriptorOffset +	cabDescriptor.FileTableOffset + cabDescriptor.FileTableOffset2 + i * 0x57;
                    var file = new FileDescriptor(header, i, cabDescriptorOffset + cabDescriptor.FileTableOffset);
                    var path = "{0}\\{1}\\{2}".F(fileGroup.Name, directories[file.DirectoryIndex].Name, file.Filename);
                    index[path] = file;
                }
            }
        }
        public void GeneratesFolderSignatureFromChildren()
        {
            var descriptor = new FileDescriptor("Folder")
                {
                    IsFolder = true,
                    Children = new[]
                        {
                            new FileDescriptor("MyFileA.txt") {StatHash = new byte[] {1, 2, 3}},
                            new FileDescriptor("MyFileB.txt") {StatHash = new byte[] {10, 20, 30}}
                        }
                };

            var sut = new StatSignatureGenerator(new SHA1HashGenerator());
            sut.UpdateFolderSignature(descriptor);
            var b64Signature = Convert.ToBase64String(descriptor.StatHash);
            Assert.That(b64Signature, Is.EqualTo("+mspp0y7kWMAMkFZoR7anf2B5AU="));
        }
        public void GeneratesFolderSignatureFromChildren()
        {
            var descriptor = new FileDescriptor("Folder")
                {
                    IsFolder = true,
                    Children = new[]
                        {
                            new FileDescriptor("MyFileA.txt") {ContentHash = new byte[] {1, 2, 3}},
                            new FileDescriptor("MyFileB.txt") {ContentHash = new byte[] {10, 20, 30}}
                        }
                };

            var sut = new ContentSignatureGenerator(new SHA1HashGenerator());
            sut.UpdateFolderSignature(descriptor);
            var b64Signature = Convert.ToBase64String(descriptor.ContentHash);
            Assert.That(b64Signature, Is.EqualTo("6UeAJmWx6C9gYXXVROOHSNcoN8U="));
        }
Example #30
0
        private List<FileDescriptor> ScanFiles(FileDescriptor directoryDescriptor)
        {
            var descriptors = descriptorProvider.GetFiles(directoryDescriptor).ToList();

            foreach (var descriptor in descriptors)
            {
                if (!File.Exists(descriptor.FullPath))
                {
                    Console.WriteLine("Could not open {0}", descriptor.FullPath);
                    continue;
                }
                signatureGenerator.UpdateFileSignature(descriptor);
                fileDatabase.UpdateDescriptor(descriptor);
                progressTracker.Increment(descriptor.FullPath);
            }
            return descriptors;
        }
 static MstQuestGroupReflection()
 {
     byte[] descriptorData = Convert.FromBase64String(string.Concat(new string[]
     {
         "ChVtc3RfcXVlc3RfZ3JvdXAucHJvdG8SCnVGcmFtZXdvcmsiQwoPTVNUX1FV",
         "RVNUX0dST1VQEhAKCHF1ZXN0X2lkGAEgASgFEgwKBHR5cGUYAiABKAUSEAoI",
         "Z3JvdXBfaWQYAyABKAUiQwoVTVNUX1FVRVNUX0dST1VQX0FSUkFZEioKBWl0",
         "ZW1zGAEgAygLMhsudUZyYW1ld29yay5NU1RfUVVFU1RfR1JPVVBiBnByb3Rv",
         "Mw=="
     }));
     MstQuestGroupReflection.descriptor = FileDescriptor.FromGeneratedCode(descriptorData, new FileDescriptor[0], new GeneratedClrTypeInfo(null, new GeneratedClrTypeInfo[]
     {
         new GeneratedClrTypeInfo(typeof(MST_QUEST_GROUP), MST_QUEST_GROUP.Parser, new string[]
         {
             "QuestId",
             "Type",
             "GroupId"
         }, null, null, null),
         new GeneratedClrTypeInfo(typeof(MST_QUEST_GROUP_ARRAY), MST_QUEST_GROUP_ARRAY.Parser, new string[]
         {
             "Items"
         }, null, null, null)
     }));
 }
        public void PlayAudio(AlarmTone alarmTone, bool isLooping, int volume)
        {
            StopAudio();

            if (alarmTone.IsCustomTone)
            {
                FileInputStream fis = new FileInputStream(alarmTone.Path);
                FileDescriptor  fd  = fis.FD;
                _mediaPlayer.SetDataSource(fd);
            }
            else
            {
                _assetFileDescriptor = Application.Context.Assets.OpenFd(alarmTone.Path);
                _mediaPlayer.SetDataSource(_assetFileDescriptor.FileDescriptor, _assetFileDescriptor.StartOffset, _assetFileDescriptor.Length);
            }

            if (Build.VERSION.SdkInt >= BuildVersionCodes.Lollipop)
            {
                _mediaPlayer.SetAudioAttributes(new AudioAttributes.Builder()
                                                .SetUsage(AudioUsageKind.Alarm)
                                                .SetContentType(AudioContentType.Sonification)
                                                .Build());
            }
            else
            {
                _mediaPlayer.SetAudioStreamType(Stream.Alarm);
            }

            var   maxVolume = 10;
            float log1      = (float)(Math.Log(maxVolume - volume) / Math.Log(maxVolume));

            _mediaPlayer.SetVolume(1 - log1, 1 - log1);
            _mediaPlayer.Looping = isLooping;
            _mediaPlayer.Prepare();
            _mediaPlayer.Start();
        }
Example #33
0
        private static void Build(BuildTargetGroup group, BuildTarget target)
        {
            string bundleOutputPath = $"{AssetBundlePath}{target.ToString()}";

            AssetBundleBuildDescriptor buildDescriptor = new AssetBundleBuildDescriptor
            {
                Group      = group,
                Options    = BuildAssetBundleOptions.ChunkBasedCompression,
                Target     = target,
                OutputPath = bundleOutputPath
            };

            FileDescriptor fileDescriptor = new FileDescriptor
            {
                Path = bundleOutputPath,
                Name = ResourceManifestFileName
            };

            AssetBundleManifest manifest = BuildAssetBubdle(buildDescriptor);
            string resourceInfo          = BuildAssetsManifest(manifest, fileDescriptor);

            Debug.Log(resourceInfo);
            FileHelper.WriteBytes(fileDescriptor.Path, fileDescriptor.Name, Encoding.UTF8.GetBytes(resourceInfo));
        }
 static MstClassRelationReflection()
 {
     byte[] descriptorData = Convert.FromBase64String(string.Concat(new string[]
     {
         "Chhtc3RfY2xhc3NfcmVsYXRpb24ucHJvdG8SCnVGcmFtZXdvcmsiTwoSTVNU",
         "X0NMQVNTX1JFTEFUSU9OEhEKCWF0a19jbGFzcxgBIAEoBRIRCglkZWZfY2xh",
         "c3MYAiABKAUSEwoLYXR0YWNrX3JhdGUYAyABKAUiSQoYTVNUX0NMQVNTX1JF",
         "TEFUSU9OX0FSUkFZEi0KBWl0ZW1zGAEgAygLMh4udUZyYW1ld29yay5NU1Rf",
         "Q0xBU1NfUkVMQVRJT05iBnByb3RvMw=="
     }));
     MstClassRelationReflection.descriptor = FileDescriptor.FromGeneratedCode(descriptorData, new FileDescriptor[0], new GeneratedClrTypeInfo(null, new GeneratedClrTypeInfo[]
     {
         new GeneratedClrTypeInfo(typeof(MST_CLASS_RELATION), MST_CLASS_RELATION.Parser, new string[]
         {
             "AtkClass",
             "DefClass",
             "AttackRate"
         }, null, null, null),
         new GeneratedClrTypeInfo(typeof(MST_CLASS_RELATION_ARRAY), MST_CLASS_RELATION_ARRAY.Parser, new string[]
         {
             "Items"
         }, null, null, null)
     }));
 }
Example #35
0
 static MstSvtVoiceRelationReflection()
 {
     byte[] descriptorData = Convert.FromBase64String(string.Concat(new string[]
     {
         "Chxtc3Rfc3Z0X3ZvaWNlX3JlbGF0aW9uLnByb3RvEgp1RnJhbWV3b3JrIlcK",
         "Fk1TVF9TVlRfVk9JQ0VfUkVMQVRJT04SDgoGc3Z0X2lkGAEgASgFEhcKD3Jl",
         "bGF0aW9uX3N2dF9pZBgCIAEoBRIUCgxhc2NlbmRfb3JkZXIYAyABKAUiUQoc",
         "TVNUX1NWVF9WT0lDRV9SRUxBVElPTl9BUlJBWRIxCgVpdGVtcxgBIAMoCzIi",
         "LnVGcmFtZXdvcmsuTVNUX1NWVF9WT0lDRV9SRUxBVElPTmIGcHJvdG8z"
     }));
     MstSvtVoiceRelationReflection.descriptor = FileDescriptor.FromGeneratedCode(descriptorData, new FileDescriptor[0], new GeneratedClrTypeInfo(null, new GeneratedClrTypeInfo[]
     {
         new GeneratedClrTypeInfo(typeof(MST_SVT_VOICE_RELATION), MST_SVT_VOICE_RELATION.Parser, new string[]
         {
             "SvtId",
             "RelationSvtId",
             "AscendOrder"
         }, null, null, null),
         new GeneratedClrTypeInfo(typeof(MST_SVT_VOICE_RELATION_ARRAY), MST_SVT_VOICE_RELATION_ARRAY.Parser, new string[]
         {
             "Items"
         }, null, null, null)
     }));
 }
Example #36
0
        private static FileDescriptor GetFileDescriptorIfAvail(InputStream @in)
        {
            FileDescriptor fd = null;

            try
            {
                if (@in is HasFileDescriptor)
                {
                    fd = ((HasFileDescriptor)@in).GetFileDescriptor();
                }
                else
                {
                    if (@in is FileInputStream)
                    {
                        fd = ((FileInputStream)@in).GetFD();
                    }
                }
            }
            catch (IOException e)
            {
                Log.Info("Unable to determine FileDescriptor", e);
            }
            return(fd);
        }
Example #37
0
 static MstVoiceReleaseReflection()
 {
     byte[] descriptorData = Convert.FromBase64String(string.Concat(new string[]
     {
         "Chdtc3Rfdm9pY2VfcmVsZWFzZS5wcm90bxIKdUZyYW1ld29yayJMChFNU1Rf",
         "Vk9JQ0VfUkVMRUFTRRIQCgh2b2ljZV9pZBgBIAEoDBIRCgljb25kX3R5cGUY",
         "AiABKAUSEgoKY29uZF92YWx1ZRgDIAEoBSJHChdNU1RfVk9JQ0VfUkVMRUFT",
         "RV9BUlJBWRIsCgVpdGVtcxgBIAMoCzIdLnVGcmFtZXdvcmsuTVNUX1ZPSUNF",
         "X1JFTEVBU0ViBnByb3RvMw=="
     }));
     MstVoiceReleaseReflection.descriptor = FileDescriptor.FromGeneratedCode(descriptorData, new FileDescriptor[0], new GeneratedClrTypeInfo(null, new GeneratedClrTypeInfo[]
     {
         new GeneratedClrTypeInfo(typeof(MST_VOICE_RELEASE), MST_VOICE_RELEASE.Parser, new string[]
         {
             "VoiceId",
             "CondType",
             "CondValue"
         }, null, null, null),
         new GeneratedClrTypeInfo(typeof(MST_VOICE_RELEASE_ARRAY), MST_VOICE_RELEASE_ARRAY.Parser, new string[]
         {
             "Items"
         }, null, null, null)
     }));
 }
Example #38
0
        private string GetOutputFile(FileDescriptor descriptor, bool duplicates)
        {
            CSharpFileOptions fileOptions = descriptor.CSharpOptions;

            string filename = descriptor.CSharpOptions.UmbrellaClassname + descriptor.CSharpOptions.FileExtension;

            if (duplicates)
            {
                string namepart;
                if (String.IsNullOrEmpty(descriptor.Name) || String.IsNullOrEmpty(namepart = Path.GetFileNameWithoutExtension(descriptor.Name)))
                {
                    throw new ApplicationException("Duplicate UmbrellaClassname options created a file name collision.");
                }

                filename = namepart + descriptor.CSharpOptions.FileExtension;
            }

            string outputDirectory = descriptor.CSharpOptions.OutputDirectory;

            if (fileOptions.ExpandNamespaceDirectories)
            {
                string package = fileOptions.Namespace;
                if (!string.IsNullOrEmpty(package))
                {
                    string[] bits = package.Split('.');
                    foreach (string bit in bits)
                    {
                        outputDirectory = Path.Combine(outputDirectory, bit);
                    }
                }
            }

            // As the directory can be explicitly specified in options, we need to make sure it exists
            Directory.CreateDirectory(outputDirectory);
            return(Path.Combine(outputDirectory, filename));
        }
Example #39
0
 static MstCommandSpellReflection()
 {
     byte[] descriptorData = Convert.FromBase64String(string.Concat(new string[]
     {
         "Chdtc3RfY29tbWFuZF9zcGVsbC5wcm90bxIKdUZyYW1ld29yayLVAQoRTVNU",
         "X0NPTU1BTkRfU1BFTEwSCgoCaWQYASABKAUSDAoEbmFtZRgCIAEoDBIMCgR0",
         "eXBlGAMgASgFEg8KB2NvbnN1bWUYBCABKAUSDgoGZGV0YWlsGAUgASgMEg8K",
         "B2Z1bmNfaWQYBiADKAUSDAoEdmFscxgHIAMoDBIOCgZtb3Rpb24YCCABKAUS",
         "DgoGc2NyaXB0GAkgASgMEhAKCHByaW9yaXR5GAogASgFEhIKCnVwZGF0ZWRf",
         "YXQYCyABKAQSEgoKY3JlYXRlZF9hdBgMIAEoBCJHChdNU1RfQ09NTUFORF9T",
         "UEVMTF9BUlJBWRIsCgVpdGVtcxgBIAMoCzIdLnVGcmFtZXdvcmsuTVNUX0NP",
         "TU1BTkRfU1BFTExiBnByb3RvMw=="
     }));
     MstCommandSpellReflection.descriptor = FileDescriptor.FromGeneratedCode(descriptorData, new FileDescriptor[0], new GeneratedClrTypeInfo(null, new GeneratedClrTypeInfo[]
     {
         new GeneratedClrTypeInfo(typeof(MST_COMMAND_SPELL), MST_COMMAND_SPELL.Parser, new string[]
         {
             "Id",
             "Name",
             "Type",
             "Consume",
             "Detail",
             "FuncId",
             "Vals",
             "Motion",
             "Script",
             "Priority",
             "UpdatedAt",
             "CreatedAt"
         }, null, null, null),
         new GeneratedClrTypeInfo(typeof(MST_COMMAND_SPELL_ARRAY), MST_COMMAND_SPELL_ARRAY.Parser, new string[]
         {
             "Items"
         }, null, null, null)
     }));
 }
 static MstFuncReflection()
 {
     byte[] descriptorData = Convert.FromBase64String(string.Concat(new string[]
     {
         "Cg5tc3RfZnVuYy5wcm90bxIKdUZyYW1ld29yayLuAQoITVNUX0ZVTkMSCgoC",
         "aWQYASABKAUSDAoEY29uZBgCIAEoBRIRCglmdW5jX3R5cGUYAyABKAUSDAoE",
         "dmFscxgEIAMoBRITCgt0YXJnZXRfdHlwZRgFIAEoBRINCgV0dmFscxgGIAMo",
         "BRITCgtxdWVzdF90dmFscxgHIAMoBRITCgtlZmZlY3RfbGlzdBgIIAMoBRIU",
         "CgxhcHBseV90YXJnZXQYCSABKAUSFQoNcG9wdXBfaWNvbl9pZBgKIAEoBRIS",
         "Cgpwb3B1cF90ZXh0GAsgASgMEhgKEHBvcHVwX3RleHRfY29sb3IYDCABKAUi",
         "NQoOTVNUX0ZVTkNfQVJSQVkSIwoFaXRlbXMYASADKAsyFC51RnJhbWV3b3Jr",
         "Lk1TVF9GVU5DYgZwcm90bzM="
     }));
     MstFuncReflection.descriptor = FileDescriptor.FromGeneratedCode(descriptorData, new FileDescriptor[0], new GeneratedClrTypeInfo(null, new GeneratedClrTypeInfo[]
     {
         new GeneratedClrTypeInfo(typeof(MST_FUNC), MST_FUNC.Parser, new string[]
         {
             "Id",
             "Cond",
             "FuncType",
             "Vals",
             "TargetType",
             "Tvals",
             "QuestTvals",
             "EffectList",
             "ApplyTarget",
             "PopupIconId",
             "PopupText",
             "PopupTextColor"
         }, null, null, null),
         new GeneratedClrTypeInfo(typeof(MST_FUNC_ARRAY), MST_FUNC_ARRAY.Parser, new string[]
         {
             "Items"
         }, null, null, null)
     }));
 }
 static TemporaryExposureKeyExportReflection()
 {
     byte[] descriptorData = global::System.Convert.FromBase64String(
         string.Concat(
             "CiBUZW1wb3JhcnlFeHBvc3VyZUtleUV4cG9ydC5wcm90byL+AQoaVGVtcG9y",
             "YXJ5RXhwb3N1cmVLZXlFeHBvcnQSFwoPc3RhcnRfdGltZXN0YW1wGAEgASgG",
             "EhUKDWVuZF90aW1lc3RhbXAYAiABKAYSDgoGcmVnaW9uGAMgASgJEhEKCWJh",
             "dGNoX251bRgEIAEoBRISCgpiYXRjaF9zaXplGAUgASgFEicKD3NpZ25hdHVy",
             "ZV9pbmZvcxgGIAMoCzIOLlNpZ25hdHVyZUluZm8SIwoEa2V5cxgHIAMoCzIV",
             "LlRlbXBvcmFyeUV4cG9zdXJlS2V5EisKDHJldmlzZWRfa2V5cxgIIAMoCzIV",
             "LlRlbXBvcmFyeUV4cG9zdXJlS2V5IpcBCg1TaWduYXR1cmVJbmZvEiAKGHZl",
             "cmlmaWNhdGlvbl9rZXlfdmVyc2lvbhgDIAEoCRIbChN2ZXJpZmljYXRpb25f",
             "a2V5X2lkGAQgASgJEhsKE3NpZ25hdHVyZV9hbGdvcml0aG0YBSABKAlKBAgB",
             "EAJKBAgCEANSDWFwcF9idW5kbGVfaWRSD2FuZHJvaWRfcGFja2FnZSLsAgoU",
             "VGVtcG9yYXJ5RXhwb3N1cmVLZXkSEAoIa2V5X2RhdGEYASABKAwSIwoXdHJh",
             "bnNtaXNzaW9uX3Jpc2tfbGV2ZWwYAiABKAVCAhgBEiUKHXJvbGxpbmdfc3Rh",
             "cnRfaW50ZXJ2YWxfbnVtYmVyGAMgASgFEhsKDnJvbGxpbmdfcGVyaW9kGAQg",
             "ASgFOgMxNDQSNQoLcmVwb3J0X3R5cGUYBSABKA4yIC5UZW1wb3JhcnlFeHBv",
             "c3VyZUtleS5SZXBvcnRUeXBlEiQKHGRheXNfc2luY2Vfb25zZXRfb2Zfc3lt",
             "cHRvbXMYBiABKBEifAoKUmVwb3J0VHlwZRILCgdVTktOT1dOEAASEgoOQ09O",
             "RklSTUVEX1RFU1QQARIgChxDT05GSVJNRURfQ0xJTklDQUxfRElBR05PU0lT",
             "EAISDwoLU0VMRl9SRVBPUlQQAxINCglSRUNVUlNJVkUQBBILCgdSRVZPS0VE",
             "EAUiNQoQVEVLU2lnbmF0dXJlTGlzdBIhCgpzaWduYXR1cmVzGAEgAygLMg0u",
             "VEVLU2lnbmF0dXJlInAKDFRFS1NpZ25hdHVyZRImCg5zaWduYXR1cmVfaW5m",
             "bxgBIAEoCzIOLlNpZ25hdHVyZUluZm8SEQoJYmF0Y2hfbnVtGAIgASgFEhIK",
             "CmJhdGNoX3NpemUYAyABKAUSEQoJc2lnbmF0dXJlGAQgASgM"));
     descriptor = FileDescriptor.FromGeneratedCode(descriptorData,
                                                   new FileDescriptor[] { },
                                                   new GeneratedClrTypeInfo(null, null, new GeneratedClrTypeInfo[] {
         new GeneratedClrTypeInfo(typeof(global::TemporaryExposureKeyExport), global::TemporaryExposureKeyExport.Parser, new[] { "StartTimestamp", "EndTimestamp", "Region", "BatchNum", "BatchSize", "SignatureInfos", "Keys", "RevisedKeys" }, null, null, null, null),
         new GeneratedClrTypeInfo(typeof(global::NL.Rijksoverheid.ExposureNotification.BackEnd.GeneratedGaenFormat.SignatureInfo), global::NL.Rijksoverheid.ExposureNotification.BackEnd.GeneratedGaenFormat.SignatureInfo.Parser, new[] { "VerificationKeyVersion", "VerificationKeyId", "SignatureAlgorithm" }, null, null, null, null),
         new GeneratedClrTypeInfo(typeof(global::NL.Rijksoverheid.ExposureNotification.BackEnd.GeneratedGaenFormat.TemporaryExposureKey), global::NL.Rijksoverheid.ExposureNotification.BackEnd.GeneratedGaenFormat.TemporaryExposureKey.Parser, new[] { "KeyData", "TransmissionRiskLevel", "RollingStartIntervalNumber", "RollingPeriod", "ReportType", "DaysSinceOnsetOfSymptoms" }, null, new[] { typeof(global::NL.Rijksoverheid.ExposureNotification.BackEnd.GeneratedGaenFormat.TemporaryExposureKey.Types.ReportType) }, null, null),
         new GeneratedClrTypeInfo(typeof(global::NL.Rijksoverheid.ExposureNotification.BackEnd.GeneratedGaenFormat.TEKSignatureList), global::NL.Rijksoverheid.ExposureNotification.BackEnd.GeneratedGaenFormat.TEKSignatureList.Parser, new[] { "Signatures" }, null, null, null, null),
         new GeneratedClrTypeInfo(typeof(global::NL.Rijksoverheid.ExposureNotification.BackEnd.GeneratedGaenFormat.TEKSignature), global::NL.Rijksoverheid.ExposureNotification.BackEnd.GeneratedGaenFormat.TEKSignature.Parser, new[] { "SignatureInfo", "BatchNum", "BatchSize", "Signature" }, null, null, null, null)
     }));
 }
Example #42
0
        private static void UnpackWatchFace(string inputFileName)
        {
            var outputDirectory = CreateOutputDirectory(inputFileName);
            var baseName        = Path.GetFileNameWithoutExtension(inputFileName);

            SetupLogger(Path.Combine(outputDirectory, $"{baseName}.log"));

            var reader = ReadWatchFace(inputFileName);

            if (reader == null)
            {
                return;
            }

            Logger.Debug("Exporting resources to '{0}'", outputDirectory);
            var reDescriptor = new FileDescriptor {
                Resources = reader.Resources
            };

            new Extractor(reDescriptor).Extract(outputDirectory);

            var watchFace = ParseResources(reader);

            if (watchFace == null)
            {
                return;
            }

            //GeneratePreviews(reader.Parameters, reader.Images, outputDirectory, baseName);

            //Logger.Debug("Exporting resources to '{0}'", outputDirectory);
            //var reDescriptor = new FileDescriptor {Resources = reader.Resources};
            //new Extractor(reDescriptor).Extract(outputDirectory);
            ExportWatchFaceConfig(watchFace, Path.Combine(outputDirectory, $"{baseName}.json"));
            GeneratePreviews(reader.Parameters, reader.Images, outputDirectory, baseName);
        }
Example #43
0
        public void SendFile(string path)
        {
            var fileName      = Path.GetFileNameWithoutExtension(path);
            var fileExtension = Path.GetExtension(path);
            var data          = File.ReadAllBytes(path);
            var splitted      = splitter.Split(data, 3);

            foreach (var span in splitted)
            {
                var fileDescriptor = new FileDescriptor()
                {
                    Content   = span.ToArray(),
                    Extension = fileExtension,
                    Name      = fileName,
                    Part      = counter
                };
                var bytes = Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(fileDescriptor));
                Send(bytes);

                counter++;
            }

            counter = 0;
        }
 static MstShopDetailReflection()
 {
     byte[] descriptorData = Convert.FromBase64String(string.Concat(new string[]
     {
         "ChVtc3Rfc2hvcF9kZXRhaWwucHJvdG8SCnVGcmFtZXdvcmsiSwoPTVNUX1NI",
         "T1BfREVUQUlMEg8KB3Nob3BfaWQYASABKAUSDwoHbWVzc2FnZRgCIAEoDBIW",
         "Cg5mcmVxdWVuY3lfdHlwZRgDIAEoBSJDChVNU1RfU0hPUF9ERVRBSUxfQVJS",
         "QVkSKgoFaXRlbXMYASADKAsyGy51RnJhbWV3b3JrLk1TVF9TSE9QX0RFVEFJ",
         "TGIGcHJvdG8z"
     }));
     MstShopDetailReflection.descriptor = FileDescriptor.FromGeneratedCode(descriptorData, new FileDescriptor[0], new GeneratedClrTypeInfo(null, new GeneratedClrTypeInfo[]
     {
         new GeneratedClrTypeInfo(typeof(MST_SHOP_DETAIL), MST_SHOP_DETAIL.Parser, new string[]
         {
             "ShopId",
             "Message",
             "FrequencyType"
         }, null, null, null),
         new GeneratedClrTypeInfo(typeof(MST_SHOP_DETAIL_ARRAY), MST_SHOP_DETAIL_ARRAY.Parser, new string[]
         {
             "Items"
         }, null, null, null)
     }));
 }
Example #45
0
 // Token: 0x06001622 RID: 5666 RVA: 0x00049E60 File Offset: 0x00048060
 static Vitals()
 {
     byte[] array = Convert.FromBase64String("ChFydXN0L3ZpdGFscy5wcm90bxIJUnVzdFByb3RvIu8BCgZWaXRhbHMSEwoGaGVhbHRoGAEgASgCOgMxMDASFQoJaHlkcmF0aW9uGAIgASgCOgIzMBIWCghjYWxvcmllcxgDIAEoAjoEMTAwMBIUCglyYWRpYXRpb24YBCABKAI6ATASGQoOcmFkaWF0aW9uX2FudGkYBSABKAI6ATASFgoLYmxlZWRfc3BlZWQYBiABKAI6ATASFAoJYmxlZWRfbWF4GAcgASgCOgEwEhUKCmhlYWxfc3BlZWQYCCABKAI6ATASEwoIaGVhbF9tYXgYCSABKAI6ATASFgoLdGVtcGVyYXR1cmUYCiABKAI6ATBCAkgB");
     FileDescriptor.InternalDescriptorAssigner internalDescriptorAssigner = delegate(FileDescriptor root)
     {
         Vitals.descriptor = root;
         Vitals.internal__static_RustProto_Vitals__Descriptor         = Vitals.Descriptor.MessageTypes[0];
         Vitals.internal__static_RustProto_Vitals__FieldAccessorTable = new FieldAccessorTable <Vitals, Vitals.Builder>(Vitals.internal__static_RustProto_Vitals__Descriptor, new string[]
         {
             "Health",
             "Hydration",
             "Calories",
             "Radiation",
             "RadiationAnti",
             "BleedSpeed",
             "BleedMax",
             "HealSpeed",
             "HealMax",
             "Temperature"
         });
         return(null);
     };
     FileDescriptor.InternalBuildGeneratedFileFrom(array, new FileDescriptor[0], internalDescriptorAssigner);
 }
Example #46
0
 static MstQuestResetReflection()
 {
     byte[] descriptorData = Convert.FromBase64String(string.Concat(new string[]
     {
         "ChVtc3RfcXVlc3RfcmVzZXQucHJvdG8SCnVGcmFtZXdvcmsiUwoPTVNUX1FV",
         "RVNUX1JFU0VUEhAKCHF1ZXN0X2lkGAEgASgFEhcKD3Jlc2V0X3F1ZXN0X2lk",
         "cxgCIAMoBRIVCg1zdGFydF9tZXNzYWdlGAMgASgMIkMKFU1TVF9RVUVTVF9S",
         "RVNFVF9BUlJBWRIqCgVpdGVtcxgBIAMoCzIbLnVGcmFtZXdvcmsuTVNUX1FV",
         "RVNUX1JFU0VUYgZwcm90bzM="
     }));
     MstQuestResetReflection.descriptor = FileDescriptor.FromGeneratedCode(descriptorData, new FileDescriptor[0], new GeneratedClrTypeInfo(null, new GeneratedClrTypeInfo[]
     {
         new GeneratedClrTypeInfo(typeof(MST_QUEST_RESET), MST_QUEST_RESET.Parser, new string[]
         {
             "QuestId",
             "ResetQuestIds",
             "StartMessage"
         }, null, null, null),
         new GeneratedClrTypeInfo(typeof(MST_QUEST_RESET_ARRAY), MST_QUEST_RESET_ARRAY.Parser, new string[]
         {
             "Items"
         }, null, null, null)
     }));
 }
Example #47
0
 static SingleBatchItem()
 {
     FileDescriptor descriptor = GtReq.Descriptor;
 }
 public override void Dump(FileDescriptor fd, PrintWriter writer, string[] args)
 {
     base.Dump(fd, writer, args);
 }
 public FileContainer Generate(FileDescriptor result, List <FileContainer> files, ReportExtendedInfo reportExtendedInfo)
 {
     throw new NotImplementedException();
 }
Example #50
0
 public static string BaseFileName(this FileDescriptor fileDescr)
 {
     return(ImportedFileUtils.RemoveSurveyedUtcFromName(fileDescr.FileName));
 }
        protected override async Task <IEnumerable <DocumentControllerDescription> > GetSupportedControllersAsync(FileDescriptor file)
        {
            var list = ImmutableList <DocumentControllerDescription> .Empty;

            if (file.FilePath.IsNullOrEmpty || !(file.Owner is DotNetProject))
            {
                return(list);
            }

            if (!IdeApp.Workspace.IsOpen)
            {
                return(list);
            }

            if (GetWindow(file.FilePath, (DotNetProject)file.Owner) == null)
            {
                return(list);
            }

            list = list.Add(
                new DocumentControllerDescription {
                CanUseAsDefault = true,
                Role            = DocumentControllerRole.VisualDesign,
                Name            = MonoDevelop.Core.GettextCatalog.GetString("Window Designer")
            });

            return(list);
        }
Example #52
0
 public FileWriter(FileDescriptor prm1) : base(default(OutputStream), default(global::java.nio.charset.CharsetEncoder))
 {
 }
Example #53
0
 public Extractor(FileDescriptor descriptor)
 {
     _descriptor = descriptor;
 }
Example #54
0
        public void UploadFileToSiteAsync(string siteId, bool isTemplate, string relativePath, string fileName, byte[] fileContents, string fileContentType, object userState = null)
        {
            Uri            uri = CreateRestRequest("Files/Upload", string.Format("siteId={0}&isTemplate={1}&relativePath={2}&filename={3}", siteId, isTemplate, relativePath, fileName));
            HttpWebRequest req = (HttpWebRequest)System.Net.WebRequest.Create(uri);

            req.Method = "POST";
            req.BeginGetRequestStream(new AsyncCallback(delegate(IAsyncResult asynchronousResult)
            {
                HttpWebRequest request = (HttpWebRequest)asynchronousResult.AsyncState;
                using (Stream postStream = request.EndGetRequestStream(asynchronousResult))
                {
                    try
                    {
                        postStream.Write(fileContents, 0, fileContents.Length);
                        postStream.Flush();
                        postStream.Close();
                    }
                    catch (Exception err)
                    {
                        postStream.Close();
                        if (UploadFileToSiteCompleted != null)
                        {
                            UploadFileToSiteCompleted(this, new UploadFileToSiteCompletedEventArgs()
                            {
                                UserState = userState, Error = err
                            });
                        }
                        return;
                    }
                }
                request.BeginGetResponse(new AsyncCallback(delegate(IAsyncResult asynchronousResult2)
                {
                    HttpWebRequest req2  = (HttpWebRequest)asynchronousResult2.AsyncState;
                    HttpWebResponse resp = null;
                    try
                    {
                        resp = (HttpWebResponse)req2.EndGetResponse(asynchronousResult2);
                    }
                    catch (System.Exception err)
                    {
                        if (UploadFileToSiteCompleted != null)
                        {
                            UploadFileToSiteCompleted(this, new UploadFileToSiteCompletedEventArgs()
                            {
                                UserState = userState, Error = err
                            });
                        }
                        return;
                    }

                    string response       = null;
                    Stream streamResponse = resp.GetResponseStream();
                    using (StreamReader streamRead = new StreamReader(streamResponse))
                    {
                        response = streamRead.ReadToEnd();
                    }

                    if (UploadFileToSiteCompleted != null)
                    {
                        FileDescriptor file = null;
                        Exception error     = GetErrorIfAny(response);
                        if (error == null)
                        {
                            XDocument xDoc    = XDocument.Parse(response);
                            XElement fileElem = xDoc.Root;
                            file = new FileDescriptor()
                            {
                                DisplayName  = fileElem.Element("DisplayName") != null ? fileElem.Element("DisplayName").Value : null,
                                FileName     = fileElem.Element("FileName") != null ? fileElem.Element("FileName").Value : null,
                                IsFolder     = fileElem.Element("IsFolder") != null ? bool.Parse(fileElem.Element("IsFolder").Value) : false,
                                RelativePath = fileElem.Element("RelativePath") != null ? fileElem.Element("RelativePath").Value : null,
                            };
                        }

                        Deployment.Current.Dispatcher.BeginInvoke(() =>
                        {
                            UploadFileToSiteCompleted(this, new UploadFileToSiteCompletedEventArgs()
                            {
                                File      = file,
                                UserState = userState,
                                Error     = error,
                            });
                        });
                    }
                }), request);
            }), req);
        }
        public async Task <IActionResult> Upload()
        {
            if (!MultipartRequestHelper.IsMultipartContentType(Request.ContentType))
            {
                return(BadRequest($"Expected a multipart request, but got {Request.ContentType}"));
            }

            // Used to accumulate all the form url encoded key value pairs in the request.
            var boundary = MultipartRequestHelper.GetBoundary(
                MediaTypeHeaderValue.Parse(Request.ContentType),
                DefaultFormOptions.MultipartBoundaryLengthLimit);


            var reader         = new MultipartReader(boundary, HttpContext.Request.Body);
            var targetFilePath = Path.GetTempFileName();  //Change to a know network share

            var formAccumulator = await SaveStream(reader, targetFilePath);



            // Bind form data to a model
            var formValueProvider = new FormValueProvider(
                BindingSource.Form,
                new FormCollection(formAccumulator.GetResults()),
                CultureInfo.CurrentCulture);

            var user = new User();
            var bindingSuccessful = await TryUpdateModelAsync(user, prefix : "", valueProvider : formValueProvider);

            if (!bindingSuccessful)
            {
                if (!ModelState.IsValid)
                {
                    return(BadRequest(ModelState));
                }
            }

            //Prepare the file info to send to the queue for processing
            var fileDescriptor = new FileDescriptor {
                FilePath = targetFilePath
            };

            var queueMessage = CreateMessageForQueuing(fileDescriptor);

            using (var connection = ConnectToMessageBroker().CreateConnection())
            {
                using (var channel = connection.CreateModel())
                {
                    SetupChannel(channel);
                    SendMessage(channel, queueMessage);
                }
            }

            var uploadedData = new
            {
                Name     = user.Name,
                Age      = user.Age,
                Zipcode  = user.Zipcode,
                FilePath = targetFilePath
            };

            return(new JsonResult(uploadedData));
        }
Example #56
0
        public override void Execute()
        {
            LoadInput();
            Project project = inputPins[0].Data as Project;

            string extension;

            switch (project.AssemblyType)
            {
            case OutputAssemblyType.Console:
            case OutputAssemblyType.Executable:
                extension = "exe";
                break;

            default:
                extension = "dll";
                break;
            }

            FileDescriptor outputAssembly = new FileDescriptor(Application.GetDeploymentPath(project.Location), "{0}.{1}", project.AssemblyName, extension);
            Compiler       compiler       = new Compiler();

            compiler.Options.OutputType = project.AssemblyType;
            compiler.Options.TargetFile = outputAssembly;

            if (Application.GenerateDebugInfo)
            {
                compiler.Options.Debug = true;
            }

            foreach (ReferenceNode node in project.Files.Nodes)
            {
                compiler.Options.Sources.Add(node.File.GetAbsolutePath());
            }

            compiler.Options.Dependencies.Add("System.dll");
            compiler.Options.Dependencies.Add("System.Core.dll");
            compiler.Options.Dependencies.Add("Microsoft.CSharp.dll");

            HashSet <Project> references = new HashSet <Project>();

            foreach (Project reference in project.References)
            {
                AddReference(compiler, project, reference, references);
            }

            foreach (FileDescriptor assembly in project.Externals)
            {
                if (!compiler.Options.Dependencies.Contains(assembly.GetAbsolutePath()))
                {
                    compiler.Options.Dependencies.Add(assembly.GetAbsolutePath());
                }
            }

            try
            {
                Application.Log(SeverityFlags.Minimal, "Compiling {0} project {1}", ToolDisplayName, project.Name);
                compiler.Execute();
            }
            finally
            {
                using (new Scope(builtStateCompleteLock))
                    builtStateComplete.Add(project);
            }
        }
 // Token: 0x06000316 RID: 790 RVA: 0x00006C08 File Offset: 0x00004E08
 static Transparent()
 {
     FileDescriptor descriptor = GtReq.Descriptor;
 }
Example #58
0
 static ServerNotify()
 {
     FileDescriptor descriptor = GtReq.Descriptor;
 }
 static UserManagerServiceReflection()
 {
     UserManagerServiceReflection.descriptor = FileDescriptor.FromGeneratedCode(UserManagerServiceReflection.smethod_1(UserManagerServiceReflection.smethod_0(new string[]
     {
         Module.smethod_35 <string>(2957993024u),
         Module.smethod_37 <string>(2221935492u),
         Module.smethod_37 <string>(3770457908u),
         Module.smethod_37 <string>(3419857956u),
         Module.smethod_34 <string>(3162883371u),
         Module.smethod_36 <string>(2042795248u),
         Module.smethod_35 <string>(1642951136u),
         Module.smethod_36 <string>(3593929232u),
         Module.smethod_35 <string>(1992792768u),
         Module.smethod_34 <string>(538258235u),
         Module.smethod_34 <string>(913204683u),
         Module.smethod_36 <string>(1255488720u),
         Module.smethod_34 <string>(163311787u),
         Module.smethod_36 <string>(2424708976u),
         Module.smethod_33 <string>(1366057401u),
         Module.smethod_33 <string>(1696343689u),
         Module.smethod_34 <string>(2682272363u),
         Module.smethod_37 <string>(2453468292u),
         Module.smethod_34 <string>(1932379467u),
         Module.smethod_37 <string>(3651390756u),
         Module.smethod_34 <string>(1182486571u),
         Module.smethod_37 <string>(554345924u),
         Module.smethod_33 <string>(2616592953u),
         Module.smethod_34 <string>(3602721627u),
         Module.smethod_34 <string>(3977668075u),
         Module.smethod_37 <string>(1956745732u),
         Module.smethod_34 <string>(3227775179u),
         Module.smethod_36 <string>(3434309072u),
         Module.smethod_35 <string>(952334080u),
         Module.smethod_36 <string>(308562032u),
         Module.smethod_34 <string>(1727989387u),
         Module.smethod_35 <string>(3274738544u),
         Module.smethod_35 <string>(2617217600u),
         Module.smethod_36 <string>(3028916272u),
         Module.smethod_37 <string>(700468532u),
         Module.smethod_37 <string>(349868580u),
         Module.smethod_33 <string>(3843121241u),
         Module.smethod_36 <string>(690475760u),
         Module.smethod_34 <string>(3023385099u),
         Module.smethod_36 <string>(2241609744u),
         Module.smethod_36 <string>(678736224u),
         Module.smethod_34 <string>(1148652859u),
         Module.smethod_34 <string>(1523599307u),
         Module.smethod_34 <string>(398759963u),
         Module.smethod_37 <string>(1401668436u),
         Module.smethod_34 <string>(3943834363u),
         Module.smethod_36 <string>(3804483264u),
         Module.smethod_36 <string>(3863180944u),
         Module.smethod_33 <string>(3640347417u),
         Module.smethod_35 <string>(1791047376u),
         Module.smethod_35 <string>(1133526432u),
         Module.smethod_34 <string>(4215891867u),
         Module.smethod_35 <string>(1483368064u),
         Module.smethod_34 <string>(3465998971u),
         Module.smethod_37 <string>(115978100u),
         Module.smethod_35 <string>(3805772528u),
         Module.smethod_33 <string>(367722393u),
         Module.smethod_37 <string>(4264822788u),
         Module.smethod_33 <string>(1185878649u),
         Module.smethod_34 <string>(1216320283u),
         Module.smethod_35 <string>(518167808u),
         Module.smethod_33 <string>(2106127913u),
         Module.smethod_37 <string>(3914222836u),
         Module.smethod_35 <string>(2840572272u),
         Module.smethod_35 <string>(2183051328u),
         Module.smethod_34 <string>(3261608891u),
         Module.smethod_35 <string>(3498093216u),
         Module.smethod_36 <string>(2288567888u),
         Module.smethod_37 <string>(4206468052u),
         Module.smethod_34 <string>(1761823099u)
     })), new FileDescriptor[]
     {
         UserManagerTypesReflection.Descriptor,
         EntityTypesReflection.Descriptor,
         RoleTypesReflection.Descriptor,
         RpcTypesReflection.Descriptor
     }, new GeneratedCodeInfo(null, new GeneratedCodeInfo[]
     {
         new GeneratedCodeInfo(UserManagerServiceReflection.smethod_2(typeof(SubscribeRequest).TypeHandle), SubscribeRequest.Parser, new string[]
         {
             Module.smethod_33 <string>(2714350708u),
             Module.smethod_33 <string>(3239342614u)
         }, null, null, null),
         new GeneratedCodeInfo(UserManagerServiceReflection.smethod_2(typeof(SubscribeResponse).TypeHandle), SubscribeResponse.Parser, new string[]
         {
             Module.smethod_36 <string>(2091741256u),
             Module.smethod_37 <string>(2891688761u),
             Module.smethod_36 <string>(1553402902u)
         }, null, null, null),
         new GeneratedCodeInfo(UserManagerServiceReflection.smethod_2(typeof(UnsubscribeRequest).TypeHandle), UnsubscribeRequest.Parser, new string[]
         {
             Module.smethod_34 <string>(1899727192u),
             Module.smethod_36 <string>(3782294397u)
         }, null, null, null),
         new GeneratedCodeInfo(UserManagerServiceReflection.smethod_2(typeof(AddRecentPlayersRequest).TypeHandle), AddRecentPlayersRequest.Parser, new string[]
         {
             Module.smethod_35 <string>(2434891972u),
             Module.smethod_35 <string>(1797074111u),
             Module.smethod_33 <string>(1332460824u)
         }, null, null, null),
         new GeneratedCodeInfo(UserManagerServiceReflection.smethod_2(typeof(AddRecentPlayersResponse).TypeHandle), AddRecentPlayersResponse.Parser, new string[]
         {
             Module.smethod_36 <string>(187356014u),
             Module.smethod_36 <string>(3984386962u)
         }, null, null, null),
         new GeneratedCodeInfo(UserManagerServiceReflection.smethod_2(typeof(ClearRecentPlayersRequest).TypeHandle), ClearRecentPlayersRequest.Parser, new string[]
         {
             Module.smethod_33 <string>(2714350708u),
             Module.smethod_36 <string>(2505595523u)
         }, null, null, null),
         new GeneratedCodeInfo(UserManagerServiceReflection.smethod_2(typeof(ClearRecentPlayersResponse).TypeHandle), ClearRecentPlayersResponse.Parser, new string[]
         {
             Module.smethod_34 <string>(3206282157u)
         }, null, null, null),
         new GeneratedCodeInfo(UserManagerServiceReflection.smethod_2(typeof(BlockPlayerRequest).TypeHandle), BlockPlayerRequest.Parser, new string[]
         {
             Module.smethod_34 <string>(1899727192u),
             Module.smethod_36 <string>(1978914170u),
             Module.smethod_37 <string>(1839859434u)
         }, null, null, null),
         new GeneratedCodeInfo(UserManagerServiceReflection.smethod_2(typeof(UnblockPlayerRequest).TypeHandle), UnblockPlayerRequest.Parser, new string[]
         {
             Module.smethod_35 <string>(1797074111u),
             Module.smethod_33 <string>(3091348247u)
         }, null, null, null),
         new GeneratedCodeInfo(UserManagerServiceReflection.smethod_2(typeof(BlockedPlayerAddedNotification).TypeHandle), BlockedPlayerAddedNotification.Parser, new string[]
         {
             Module.smethod_34 <string>(2390316016u),
             Module.smethod_33 <string>(1846560140u),
             Module.smethod_34 <string>(750206468u)
         }, null, null, null),
         new GeneratedCodeInfo(UserManagerServiceReflection.smethod_2(typeof(BlockedPlayerRemovedNotification).TypeHandle), BlockedPlayerRemovedNotification.Parser, new string[]
         {
             Module.smethod_37 <string>(2190429915u),
             Module.smethod_37 <string>(965451995u),
             Module.smethod_35 <string>(915065219u)
         }, null, null, null),
         new GeneratedCodeInfo(UserManagerServiceReflection.smethod_2(typeof(RecentPlayersAddedNotification).TypeHandle), RecentPlayersAddedNotification.Parser, new string[]
         {
             Module.smethod_37 <string>(2190429915u)
         }, null, null, null),
         new GeneratedCodeInfo(UserManagerServiceReflection.smethod_2(typeof(RecentPlayersRemovedNotification).TypeHandle), RecentPlayersRemovedNotification.Parser, new string[]
         {
             Module.smethod_33 <string>(1869155212u)
         }, null, null, null)
     }));
 }
Example #60
0
        protected override bool TouchFile(string path)
        {
            // Node für Unterverzeichnis
            TreeNode tNode = new TreeNode();

            //string dirName = path.Substring(path.LastIndexOf('\\'));
            tNode.Text = System.IO.Path.GetFileName(path);

            FileDescriptor descriptor = new FileDescriptor();

            descriptor.Path = path;

            TestStringFunctor IsImageType = new TestStringFunctor(System.IO.Path.GetExtension(path).ToLower());

            //if (Array.Exists<string>(bilddateitypen, IsImageType.Test))
            if (bilddateitypen.Any(r => r == System.IO.Path.GetExtension(path).ToLower()))
            {
                descriptor.IsImage = true;
                System.Drawing.Image bmp = System.Drawing.Bitmap.FromFile(path);

                // Auslesen der Metadaten
                foreach (System.Drawing.Imaging.PropertyItem item in bmp.PropertyItems)
                {
                    switch ((DMS.EXIF.IFD_TAGS)item.Id)
                    {
                    case DMS.EXIF.IFD_TAGS.ImageHeigth:
                        descriptor.ImageHeight = DMS.EXIF.GetImageHeight(item);
                        break;

                    case DMS.EXIF.IFD_TAGS.ImageWidth:
                        descriptor.ImageWidth = DMS.EXIF.GetImageWidth(item);
                        break;

                    case DMS.EXIF.IFD_TAGS.RecordingTime:
                        descriptor.RecordingTime = DMS.EXIF.GetRecordingTime(item);
                        break;

                    case DMS.EXIF.IFD_TAGS.FocalLength:
                        descriptor.FocalLength = DMS.EXIF.GetFocalLength(item);
                        break;

                    case EXIF.IFD_TAGS.FocalLength35:
                        descriptor.FocalLength35 = DMS.EXIF.GetFocalLength35(item);
                        break;

                    case DMS.EXIF.IFD_TAGS.Flash:
                        descriptor.Flash = DMS.EXIF.GetFlash(item);
                        break;

                    default:;
                        break;
                    }
                }
            }

            tNode.Tag = descriptor;
            // Elternknoten bestimmen
            TreeNode ParentNode = Stapel.Peek();

            // Verknüpfen mit dem Elternknoten
            ParentNode.Nodes.Add(tNode);

            return(true);
        }