void ReadPackageHead(out int dataLength, out ObjectModel model)
        {
            var head = new byte[2];
            var readBytes = Stream.Read(head, 0, 2);
            if (readBytes > 0)
            {
                // Check Magic bytes
                if (!(head[0] == MagicBytes[0] && head[1] == MagicBytes[1]))
                    throw new InvalidDataException("Corrupted data received. Magic header bytes did not match.");

                // Check version number
                Stream.Read(head, 0, 2);
                if (!(head[0] == VersionNumber[0] && head[1] == VersionNumber[1]))
                    throw new InvalidDataException("Received package from incompatible protocol version.");

                // Get the type id
                Stream.Read(head, 0, 2);
                UInt16 typeId = BitConverter.ToUInt16(head, 0);

                model = Sync.FindModelFromTypeId(typeId);

                var lengthBytes = new byte[4];
                Stream.Read(lengthBytes, 0, 4);

                dataLength = BitConverter.ToInt32(lengthBytes, 0);
            }
            else
            {
                dataLength = -1;
                model = null;
            }
        }
        protected override void SaveInternal(ObjectModel objectModel)
        {
            TextureFontObjectModel font = (objectModel as TextureFontObjectModel);
            if (font == null) throw new ObjectModelNotSupportedException();

            Writer writer = base.Accessor.Writer;
            base.Accessor.DefaultEncoding = Encoding.UTF8;

            writer.WriteFixedLengthString("GLTEXFNT");
            writer.WriteSingle (mvarFormatVersion);
            writer.WriteInt32 (font.GlyphWidth);
            writer.WriteInt32 (font.GlyphHeight);
            writer.WriteNullTerminatedString (font.TextureFileName);

            writer.WriteInt32 (font.Characters.Count);
            foreach (TextureFontCharacter charpos in font.Characters)
            {
                writer.WriteChar (charpos.Character);
            }
            foreach (TextureFontCharacter charpos in font.Characters)
            {
                writer.WriteInt32 ((int)charpos.Index);
            }

            writer.Flush ();
        }
        public void AddAllTypes(ObjectModel model, HashSet<Type> hash, Type type)
        {
            if (type == null)
                return;
            if (hash.Contains(type))
                return;
            
            hash.Add(type);
            
            AddAllTypes(model, hash, type.ParentType);
            foreach (var iface in type.InterfaceTypes)
            {
                AddAllTypes(model, hash, iface);
            }

            foreach (var field in type.Fields)
            {
                AddAllTypes(model, hash, FindType(field.Type));
            }
            
            foreach (var method in type.Methods)
            {
                AddAllTypes(model, hash, method.ReturnType ?? FindType(method.Return));
                foreach (var par in method.Parameters)
                    AddAllTypes(model, hash, FindType(par));
            }
        }
 void SendPackageHeader(ObjectModel model, Int32 length)
 {
     Stream.Write(MagicBytes, 0, MagicBytes.Length);
     Stream.Write(VersionNumber, 0, VersionNumber.Length);
     Stream.Write(BitConverter.GetBytes(model.TypeId), 0, 2);
     Stream.Write(BitConverter.GetBytes(length), 0, 4);
 }
 public override void CopyTo(ObjectModel where)
 {
     TextureFontObjectModel clone = (where as TextureFontObjectModel);
     clone.GlyphHeight = mvarGlyphHeight;
     clone.GlyphWidth = mvarGlyphWidth;
     clone.TextureFileName = (mvarTextureFileName.Clone () as string);
 }
        public override void CopyTo(ObjectModel where)
        {
            ThemeObjectModel clone = (where as ThemeObjectModel);
            if (clone == null) throw new ObjectModelNotSupportedException();

            foreach (Theme theme in mvarThemes)
            {
                clone.Themes.Add(theme.Clone() as Theme);
            }
        }
Exemple #7
0
    public static int Main(string[] args)
    {
        int result = 0;

        try
        {
            foreach (string arg in args)
                DoProcessArg(arg);

            if (!m_exiting)
                DoValidateArgs();

            if (!m_exiting)
            {
                XmlReader reader = XmlReader.Create(ms_xml);
                XmlDocument xml = new XmlDocument();
                xml.Load(reader);

                ObjectModel objects = new ObjectModel();
                foreach (XmlNode child in xml.ChildNodes)
                {
                    if (child.Name == "Generate")
                    {
                        foreach (XmlNode gchild in child.ChildNodes)
                        {
                            if (gchild.Name == "TypeResults")
                            {
                                DoAddResultType(objects, gchild);
                            }
                        }
                    }
                }

                foreach (XmlNode child in xml.ChildNodes)
                {
                    if (child.Name == "Generate")
                    {
                        foreach (XmlNode gchild in child.ChildNodes)
                        {
                            if (gchild.Name == "Framework")
                                DoGenerateFromXML(objects, gchild);
                        }
                    }
                }
            }
        }
        catch (ParserException e)
        {
            Console.Error.WriteLine(e.Message);
            result = 1;
        }

        return result;
    }
Exemple #8
0
        internal void AddContent(ObjectModel.DocObject dobj)
        {
            m_content.Add(dobj);
            if (dobj is Change)
            {
                Change ch = dobj as Change;
                if (m_changes.Contains(ch))
                    return;
            }
            m_bSeenContentSinceChange = true;

        }
        protected override void LoadInternal(ref ObjectModel objectModel)
        {
            BinaryReader br = base.Stream.BinaryReader;
            string XplatShd = br.ReadFixedLengthString(8);
            short versionMajor = br.ReadInt16();
            short versionMinor = br.ReadInt16();

            int definitionCount = br.ReadInt32();
            for (int i = 0; i < definitionCount; i++)
            {

            }
        }
        public override void CopyTo(ObjectModel where)
        {
            LightingObjectModel clone = (where as LightingObjectModel);
            if (clone == null) throw new ObjectModelNotSupportedException();

            foreach (Manufacturer item in mvarManufacturers)
            {
                clone.Manufacturers.Add(item.Clone() as Manufacturer);
            }
            foreach (Fixture item in mvarFixtures)
            {
                clone.Fixtures.Add(item.Clone() as Fixture);
            }
        }
        public override void CopyTo(ObjectModel where)
        {
            GLVMExecutableObjectModel clone = (where as GLVMExecutableObjectModel);
            if (clone == null) return;

            foreach (GLVMExecutableCommandSet set in mvarCommandSets)
            {
                clone.CommandSets.Add(set.Clone() as GLVMExecutableCommandSet);
            }
            foreach (GLVMExecutableResourceSet set in mvarResourceSets)
            {
                clone.ResourceSets.Add(set.Clone() as GLVMExecutableResourceSet);
            }
        }
        public TestResult GetFeatureResult(ObjectModel.Feature feature)
        {
            if (this.specRunFeatures == null)
            {
                return TestResult.Inconclusive;
            }

            var specRunFeature = this.FindSpecRunFeature(feature);

            if (specRunFeature == null)
            {
                return TestResult.Inconclusive;
            }

            TestResult result =
                specRunFeature.Scenarios.Select(specRunScenario => StringToTestResult(specRunScenario.Result)).Merge();

            return result;
        }
Exemple #13
0
 private string ColorizeMethod(ObjectModel.CodeExplorer.CodeElementMethod method)
 {
     StringBuilder result = new StringBuilder();
     //if(!string.IsNullOrEmpty(method.Result)) result.Append("======================" + "<br>" + Environment.NewLine);
     if (method.ElementClassName.Length>2) result.Append("<span class='CodeElementNamespace'>" + method.ElementNamespaceName + "</span>&gt; <span class='CodeElementClass'>" + method.ElementClassName + "</span> <span class='CodeElementMethod'>" + method.ElementName + "</span><br>" + Environment.NewLine);
     string parameters = string.Empty;
     if (method.Parameters != null)
     foreach (string[] parameter in method.Parameters)
     {
          parameters += ", <span class='CodeElementParameter'>" + parameter[0] + "</span> = " + "<span class='CodeElementValue'>" + parameter[1] + "</span>";
     }
     if (parameters.Length > 2) { result.Append("<span class='specialChaer'>(" + parameters.Substring(2) + ")" + "<br>"); }
     string res = method.Result;
     string colorRes = method.Result;
     bool beforePunctuation = false;
     if (!string.IsNullOrEmpty(res))
     for(int i = 0; i<res.Length; i++)
     {
         char c = res[i];
             
         if (!char.IsLetterOrDigit(res[i]))
         {
             if (!beforePunctuation)
             {
                 res = res.Substring(0, i) + "<span class='punctuation'>" + res.Substring(i); i = i + 26;
             }
             beforePunctuation = true;
         }
         else 
         {
             if (beforePunctuation)
             {
                 res = res.Substring(0, i) + "</span>" + res.Substring(i); i = i + 7;
             }
             beforePunctuation = false;
         }
     }
     res += "</span>";
     if (!string.IsNullOrEmpty(res)) result.Append("<span class='value'>" + res + "</span><br>" + Environment.NewLine);
     return result.ToString();
 }
Exemple #14
0
        internal bool CanAddChange(ObjectModel.Change change)
        {
            if (m_bSeenContentSinceChange)
                return false;

            if (!ChangeTypesCompatible(change.Type))
                return false;

            // do not append an inserted para to an existing change group
            if (change.Type == ChangeType.Insertion && Changes.Count>0 &&  CompositeChangeType != ChangeType.Insertion &&  change.Content.Count == 1 && change.Content[0] is ParaMarker)
            {
                foreach (Change ch in Changes)
                {
                    foreach (DocObject dobj in ch.Descendants())
                    {
                        if (dobj is TextRun)
                            return false;
        }
                }
            }

            return true;
        }
        protected override void LoadInternal(ref ObjectModel objectModel)
        {
            TextureFontObjectModel font = (objectModel as TextureFontObjectModel);
            if (font == null) throw new ObjectModelNotSupportedException();

            Reader reader = base.Accessor.Reader;
            base.Accessor.DefaultEncoding = Encoding.UTF8;

            string signature = reader.ReadFixedLengthString (8);
            if (signature != "GLTEXFNT") throw new InvalidDataFormatException("File does not begin with 'GLTEXFNT'");

            mvarFormatVersion = reader.ReadSingle ();

            font.GlyphWidth = reader.ReadInt32 ();
            font.GlyphHeight = reader.ReadInt32 ();
            font.TextureFileName = reader.ReadNullTerminatedString ();

            int charCount = reader.ReadInt32 ();

            char[] chars = new char[charCount];
            int[] poses = new int[charCount];

            for (int i = 0; i < charCount; i++)
            {
                chars[i] = reader.ReadChar ();
            }
            for (int i = 0; i < charCount; i++)
            {
                int index = reader.ReadInt32 ();
                poses[i] = index;
            }
            for (int i = 0; i < charCount; i++)
            {
                font.Characters.Add(new TextureFontCharacter(chars[i], poses[i]));
            }
        }
 public FileModel(BucketModel bucket, string key, int size, ObjectModel parent = null)
     : base(bucket, key, parent)
 {
     Size = size;
 }
 public override Color AssembleValue(ObjectModel value, AssemblyContext context)
 {
     return(new Color(value.GetValue <float>("Red"), value.GetValue <float>("Green"), value.GetValue <float>("Blue"), value.GetValue <float>("Alpha")));
 }
Exemple #18
0
 internal void AddChange(ObjectModel.Change change)
 {
     m_changes.Add(change);
     ToolTipText = BuildToolTipText();
 }
Exemple #19
0
 public Generate(ObjectModel objects)
 {
     m_objects = objects;
 }
Exemple #20
0
 public ObjectModel Execute(ObjectModel model)
 {
     Environment.Exit(0);
     return(new ObjectModel());
 }
Exemple #21
0
 public static void AddObjectModel(ObjectModel om)
 {
     objectModels.Add(om);
 }
        public MainViewModel(IMainModel model, ICttObjectTrackingService cttObjectTrackingService, INavigationService navigationService, ISystemTrayService systemTrayService, IMessageBoxService messageBoxService, IClipboardService clipboardService, IEmailComposeService emailComposeService, ISmsComposeService smsComposeService)
        {
            _model = model;
            _cttObjectTrackingService = cttObjectTrackingService;
            _navigationService        = navigationService;
            _systemTrayService        = systemTrayService;
            _messageBoxService        = messageBoxService;
            _clipboardService         = clipboardService;
            _emailComposeService      = emailComposeService;
            _smsComposeService        = smsComposeService;

            TrackedObjects = _model.TrackedObjects
                             .Select(x => new ObjectDetailsViewModel(x))
                             .ToObservableCollection();

            ShowObjectDetailsCommand = new RelayCommand <ObjectDetailsViewModel>(item =>
            {
                var objectId = item.Model.ObjectId;

                _navigationService.NavigateTo(new Uri("/View/ObjectDetailsPage.xaml?" + objectId, UriKind.Relative));
            });

            NewObjectCommand = new RelayCommand(() =>
            {
                _navigationService.NavigateTo(new Uri("/View/NewObjectPage.xaml", UriKind.Relative));
            }, () => !IsBusy);

            EnableSelectionCommand = new RelayCommand(() =>
            {
                IsSelectionEnabled = true;
            }, () => !IsTrackedObjectsEmpty && !IsBusy);

            RefreshCommand = new RelayCommand(() =>
            {
                var enumerator = TrackedObjects.GetEnumerator();

                RefreshNext(enumerator);
            }, () => !IsTrackedObjectsEmpty && !IsBusy);

            DeleteObjectsCommand = new RelayCommand <IList>(items =>
            {
                if (items == null || items.Count == 0)
                {
                    return;
                }

                _messageBoxService.Show("Está prestes a apagar os objectos seleccionados", "Tem a certeza?", new string[] { "eliminar", "cancelar" }, button =>
                {
                    if (button != 0)
                    {
                        return;
                    }

                    var itemsToRemove = items
                                        .Cast <ObjectDetailsViewModel>()
                                        .ToArray();

                    foreach (var item in itemsToRemove)
                    {
                        _model.TrackedObjects.Remove(item.Model);

                        TrackedObjects.Remove(item);
                    }

                    IsTrackedObjectsEmpty = (TrackedObjects.Count == 0);

                    _model.Save();
                });
            }, items => !IsBusy);

            ShowAboutCommand = new RelayCommand(() =>
            {
                _navigationService.NavigateTo(new Uri("/View/AboutPage.xaml", UriKind.Relative));
            });

            BackKeyPressCommand = new RelayCommand <CancelEventArgs>(e =>
            {
                if (IsSelectionEnabled)
                {
                    IsSelectionEnabled = false;

                    e.Cancel = true;
                }
            });

            CopyCodeCommand = new RelayCommand <ObjectDetailsViewModel>(item =>
            {
                _clipboardService.SetText(item.Model.ObjectId);
            });

            MailCodeCommand = new RelayCommand <ObjectDetailsViewModel>(item =>
            {
                _emailComposeService.Show("CTT Objectos", string.Format("\nO seu código de tracking: {0}\n\nPode consultar o estado entrando em http://www.ctt.pt e utilizando a opção \"Pesquisa de Objectos\".\n\nEnviado por CTT Objectos (http://bit.ly/cttobjectos)", item.Model.ObjectId));
            });

            TextCodeCommand = new RelayCommand <ObjectDetailsViewModel>(item =>
            {
                _smsComposeService.Show(string.Empty, item.Model.ObjectId);
            });

            MessengerInstance.Register <AddObjectMessage>(this, message =>
            {
                var objectViewModel = TrackedObjects.FirstOrDefault(x => x.Model.ObjectId == message.Model.ObjectId);

                if (objectViewModel == null)
                {
                    var objectModel = new ObjectModel(message.Description, message.ETag, message.Model);

                    _model.TrackedObjects.Add(objectModel);

                    TrackedObjects.Add(new ObjectDetailsViewModel(objectModel));

                    IsTrackedObjectsEmpty = false;
                }
                else
                {
                    objectViewModel.Model.Description = message.Description;
                    objectViewModel.Model.State       = message.Model;
                }

                _model.Save();
            });

            IsTrackedObjectsEmpty = (TrackedObjects.Count == 0);
        }
Exemple #23
0
        protected static string MapType(ObjectModel objects, string type)
        {
            type = objects.MapType(type);				// note that this is word to word with no spaces in the words

            switch (type)
            {
                case "BOOL":
                case "Boolean":
                    return "bool";

                case "unsigned char":
                case "uint8_t":
                    return "byte";

                case "unichar":
                    return "char";

                case "CFTimeInterval":
                case "double":
                    return "double";

                case "CGFloat":
                case "float":
                    return "float";

                case "AEReturnID":
                case "AESendPriority":
                case "OSErr":
                case "short":
                    return "Int16";

                case "AESendMode":
                case "AETransactionID":
                case "GLint":
                case "GLsizei":
                case "int":
                case "int32_t":
                case "long":
                case "NSComparisonResult":
                case "NSInteger":
                case "OSStatus":
                case "pid_t":
                case "ptrdiff_t":				// TODO: some of these types are not 64-bit safe (but mono isn't either...)
                case "SInt32":
                case "SRefCon":
                    return "Int32";

                case "int64_t":
                case "long long":
                    return "Int64";

                case "CFAllocatorRef":
                case "CFArrayRef":
                case "CFAttributedStringRef":
                case "CFBagRef":
                case "CFBinaryHeapRef":
                case "CFBitVectorRef":
                case "CFBooleanRef":
                case "CFBundleRef":
                case "CFCalendarRef":
                case "CFCharacterSetRef":
                case "CFDataRef":
                case "CFDateFormatterRef":
                case "CFDateRef":
                case "CFDictionaryRef":
                case "CFErrorRef":
                case "CFFileDescriptorRef":
                case "CFLocaleRef":
                case "CFMachPortRef":
                case "CFMessagePortRef":
                case "CFMutableAttributedStringRef":
                case "CFMutableBagRef":
                case "CFMutableBitVectorRef":
                case "CFMutableCharacterSetRef":
                case "CFMutableDataRef":
                case "CFMutableDictionaryRef":
                case "CFMutableSetRef":
                case "CFNotificationCenterRef":
                case "CFNumberFormatterRef":
                case "CFNumberRef":
                case "CFPlugInRef":
                case "CFReadStreamRef":
                case "CFRunLoopObserverRef":
                case "CFRunLoopRef":
                case "CFRunLoopSourceRef":
                case "CFRunLoopTimerRef":
                case "CFSetRef":
                case "CFSocketRef":
                case "CFStringTokenizerRef":
                case "CFTreeRef":
                case "CFURLRef":
                case "CFUserNotificationRef":
                case "CFWriteStreamRef":
                case "CFXMLNodeRef":
                case "CFXMLParserRef":
                case "CFXMLTreeRef":
                case "CGColorRef":
                case "CGColorSpaceRef":
                case "CGContextRef":
                case "CGEventRef":
                case "CGImageRef":
                case "CGLayerRef":
                case "CGLContextObj":
                case "CGLPBufferObj":
                case "CGLPixelFormatObj":
                case "CGLRendererInfoObj":
                case "CVBufferRef":
                case "CVImageBufferRef":
                case "char *":
                case "const NSGlyph *":
                case "const void *":
                case "id *":
                case "IconRef":
                case "NSAppleEventManagerSuspensionID":
                case "NSComparator":
                case "NSDistantObject *":
                case "NSGlyph *":
                case "NSModalSession":
                case "NSPointArray":
                case "NSPointPointer":
                case "NSRangePointer":
                case "NSRectArray":
                case "NSRectPointer":
                case "NSSizeArray":
                case "NSZone *":
                case "unichar *":
                case "va_list":
                case "void *":
                    return "IntPtr";

                case "CIColor *":
                case "CIImage *":
                case "id":
                case "NSEntityDescription *":
                case "NSFetchRequest *":
                case "NSManagedObjectContext *":
                    return "NSObject";

                case "CGPoint":
                    return "NSPoint";

                case "CGRect":
                    return "NSRect";

                case "CGSize":
                    return "NSSize";

                case "AEArrayType":
                case "signed char":
                    return "sbyte";

                case "SEL":
                    return "Selector";

                case "const char *":
                case "const unichar *":
                    return "string";

                case "uint16_t":
                case "unsigned short":
                    return "UInt16";

                case "AEEventClass":
                case "AEEventID":
                case "AEKeyword":
                case "DescType":
                case "FourCharCode":
                case "GLbitfield":
                case "GLenum":
                case "NSAttributeType":
                case "NSGlyph":
                case "NSUInteger":
                case "NSSortOptions":
                case "OSType":
                case "ResType":
                case "size_t":
                case "uint32_t":
                case "unsigned":
                case "unsigned int":
                case "UTF32Char":
                    return "UInt32";

                case "CFIndex":
                case "CFOptionFlags":
                case "CFTypeID":
                case "LSLaunchFlags":
                case "OptionBits":
                case "unsigned long":
                case "unsigned long long":
                case "uint64_t":
                    return "UInt64";

                default:
                    if (type.StartsWith("const "))
                        type = type.Substring("const ".Length, type.Length - "const ".Length).Trim();

                    if (type.EndsWith("**") || type.StartsWith("inout ") || type.Contains("["))
                    {
                        return "IntPtr";
                    }
                    else if (type.Contains("<") && type.Contains(">"))
                    {
                        return "NSObject";		// TODO: should probably add interfaces for protocols
                    }
                    else if (type.EndsWith("*"))
                    {
                        type = type.Substring(0, type.Length - 1).Trim();
                        type = objects.MapType(type);

                        if (objects.KnownType(type))
                        {
                            return type;
                        }
                        else
                        {
                            return "IntPtr";
                        }
                    }
                    else
                    {
                        type = objects.MapType(type);
                        return type;
                    }
            }
        }
 public override Vector3Int AssembleValue(ObjectModel value, AssemblyContext context)
 {
     return new Vector3Int(value.GetValue<int>("X"), value.GetValue<int>("Y"), value.GetValue<int>("Z"));
 }
Exemple #25
0
 public void OnPointerDown(PointerEventData eventData)
 {
     ObjectModel.Select(null);
     gameManager.HideDeleteButton();
 }
 public override Vector2 AssembleValue(ObjectModel value, AssemblyContext context)
 {
     return new Vector2(value.GetValue<float>("X"), value.GetValue<float>("Y"));
 }
Exemple #27
0
        public async Task ExcelObject([FromBody] ObjectModel objModel)
        {
            // authenticate with Forge Must have data read scope
            dynamic oauth = await OAuthController.GetInternalAsync();

            // get the user selected object
            ObjectsApi objects = new ObjectsApi();

            objects.Configuration.AccessToken = oauth.access_token;
            dynamic selectedObject = await objects.GetObjectDetailsAsync(objModel.bucketKey, objModel.objectName);

            string objectId  = selectedObject.objectId;
            string objectKey = selectedObject.objectKey;


            string xlsFileName = objectKey.Replace(".rvt", ".xls");
            var    xlsPath     = Path.Combine(HttpContext.Current.Server.MapPath("~/App_Data"), objModel.bucketKey, xlsFileName);//.guid, xlsFileName);
            ///////////if (File.Exists(xlsPath))
            ///////////    return SendFile(xlsPath);// if the Excel file was already generated

            DerivativesApi derivative = new DerivativesApi();

            derivative.Configuration.AccessToken = oauth.access_token;

            // get the derivative metadata
            dynamic metadata = await derivative.GetMetadataAsync(objectId.Base64Encode());

            foreach (KeyValuePair <string, dynamic> metadataItem in new DynamicDictionaryItems(metadata.data.metadata))
            {
                dynamic hierarchy = await derivative.GetModelviewMetadataAsync(objectId.Base64Encode(), metadataItem.Value.guid);

                dynamic properties = await derivative.GetModelviewPropertiesAsync(objectId.Base64Encode(), metadataItem.Value.guid);

                Workbook xls = new Workbook();
                foreach (KeyValuePair <string, dynamic> categoryOfElements in new DynamicDictionaryItems(hierarchy.data.objects[0].objects))
                {
                    string    name  = categoryOfElements.Value.name;
                    Worksheet sheet = new Worksheet(name);
                    for (int i = 0; i < 100; i++)
                    {
                        sheet.Cells[i, 0] = new Cell("");                           // unless we have at least 100 cells filled, Excel understand this file as corrupted
                    }
                    List <long> ids = GetAllElements(categoryOfElements.Value.objects);
                    int         row = 1;
                    foreach (long id in ids)
                    {
                        Dictionary <string, object> props = GetProperties(id, properties);
                        int collumn = 0;
                        foreach (KeyValuePair <string, object> prop in props)
                        {
                            sheet.Cells[0, collumn]   = new Cell(prop.Key.ToString());
                            sheet.Cells[row, collumn] = new Cell(prop.Value.ToString());
                            collumn++;
                        }

                        row++;
                    }

                    xls.Worksheets.Add(sheet);
                }


                //Where to save the excel file
                string pathUser     = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile);
                string pathDownload = Path.Combine(pathUser, "Downloads", xlsFileName);

                //try catch save the file to the relevant place
                try
                {
                    var fstream = new System.IO.FileStream(pathDownload, FileMode.CreateNew);
                    xls.SaveToStream(fstream);
                }
                catch (Exception e)
                {
                    Debug.Print("Exception when calling ObjectsApi.DownloadObject: " + e.Message);
                }
            }
            //No need to return anything
            //return SendFile(xlsPath);
        }
Exemple #28
0
 public static BodyPartModel AsBodyPart(this ObjectModel _o)
 {
     return((BodyPartModel)_o);
 }
Exemple #29
0
 public override void Construct(ObjectModel model, ObjectRegistry registry)
 {
     base.Construct(model, registry);
 }
 public void SetReportObjectModel(ObjectModel reportObjectModel)
 {
     this.m_reportObjectModel = reportObjectModel;
 }
Exemple #31
0
 public void BUTTON_ACTION_DeleteSelectedObject()
 {
     ObjectModel.DeleteSelected();
 }
Exemple #32
0
 /// <summary>
 /// Calculating settings for PI Controller Gain (Kc) and Integral Time (Ti) using the Integral of the absolute error multiplied by time tuning rules.
 /// Kc = A * Math.Pow(oM.Dt / oM.Tau1, B) / oM.Gp; Ti = oM.Tau1 * Math.Pow(oM.Dt / oM.Tau1, D) / C; Td = oM.Tau1 * E * Math.Pow(oM.Dt / oM.Tau1, F).
 /// A, B, C, D, E, F = 0.859, -0.977, 0.674, 0.680, 0, 0.
 /// </summary>
 /// <param name="oM">Contains model's parameters. Ones describe the control object through the transfer function.</param>
 /// <param name="cPID">Contains a controller's tunning parameters.</param>
 public static void ITAEtuningPI(ObjectModel oM, ControllerModel cPID)
 {
     TuningIE(ref oM, ref cPID, 4);
 }
Exemple #33
0
        public MethodInfo(ObjectModel objects, NativeInterface ni, NativeMethod method)
        {
            Name = method.Name;
            ResultType = new TypeInfo(objects, ni, method);

            var argNames = new List<NameInfo>();
            var argTypes = new List<ArgTypeInfo>();

            for (int i = 0; i < method.ArgNames.Length; ++i)
            {
                argNames.Add(new NameInfo(method.ArgNames[i]));
                argTypes.Add(new ArgTypeInfo(objects, method.ArgTypes[i]));

                if (argTypes[argTypes.Count - 1].ManagedOut.Length > 0)
                    HasOutArgs = true;
            }

            ArgNames = argNames.ToArray();
            ArgTypes = argTypes.ToArray();
        }
Exemple #34
0
 /// <summary>
 /// Returns a <see cref="T:System.String"/> that represents the current <see cref="T:System.Object"/>.
 /// </summary>
 /// <returns>
 /// A <see cref="T:System.String"/> that represents the current <see cref="T:System.Object"/>.
 /// </returns>
 public override string ToString()
 {
     return(string.Format("ServiceProvider: {0}, Statement: {1}, ObjectModel: {2}", ServiceProvider, Statement, ObjectModel.ToEPL()));
 }
Exemple #35
0
 public ObjectModel()
 {
     ObjectModel.AddObjectModel(this);
     this._name = "object " + objectModels.Count;
 }
Exemple #36
0
        /// <summary>
        /// Method triggered by the TreeListViewDragDropBehavior Class. Takes care of moving on item in the tree, which can be from
        /// any level to any level
        /// </summary>
        /// <param name="destination"></param>
        public void MoveSelection(TreeListViewRow destination) // Collection<ObjectModel> selectedItems, ObjectModel destination )
        {
            if (destination != null)
            {
                ObjectModel destinationItem = (destination.DataContext) as ObjectModel;
                try
                {
                    // Setup a private collection with the selected items only. This is because the SelectedItems that are part of the view model collection
                    // will change as soon as we start removing and adding objects
                    TD.ObservableItemCollection <ObjectModel> selectedItems = new TD.ObservableItemCollection <ObjectModel>();
                    foreach (ObjectModel item in SelectedItems)
                    {
                        selectedItems.Add(item);
                    }

                    foreach (ObjectModel item in selectedItems)
                    {
                        // find the original parent of the object that's moved
                        ObjectModel parentSourceItem = GetObject(item.Parent_ID);

                        // If the parent is in the root level
                        if (parentSourceItem == null)
                        {
                            // Remove the item in the root level
                            Objects.Remove(item);
                        }
                        else
                        {
                            // Otherwise remove the item from the child collection
                            parentSourceItem.ChildObjects.Remove(item);
                        }

                        TreeListViewDropPosition relativeDropPosition = (TreeListViewDropPosition)destination.GetValue(RadTreeListView.DropPositionProperty);
                        destination.UpdateLayout();
                        // If put on top of destination
                        if (relativeDropPosition == TreeListViewDropPosition.Inside)
                        {
                            // the Parent_ID of the item will become the ID of the destination
                            item.Parent_ID = destinationItem.ID;
                            destinationItem.ChildObjects.Add(item);
                        }
                        // If put before or after the destination
                        else
                        {
                            // if the desitination is in the root collection
                            if (destinationItem.Parent_ID == null)
                            {
                                // The parent_ID of the item will also be null
                                item.Parent_ID = null;
                                Objects.Insert(Objects.IndexOf(destinationItem), item);
                            }
                            else
                            {
                                // otherwise the Parent_ID of the item will be the same as that of the destination item
                                item.Parent_ID = destinationItem.Parent_ID;
                                // find the Parent of the destination item
                                parentSourceItem = GetObject(destinationItem.Parent_ID);
                                // Insert the item before or after the destination item in the ChildObject collection of the parent of the destination
                                if (relativeDropPosition == TreeListViewDropPosition.Before)
                                {
                                    parentSourceItem.ChildObjects.Insert(parentSourceItem.ChildObjects.IndexOf(destinationItem), item);
                                }
                                else
                                {
                                    parentSourceItem.ChildObjects.Insert(parentSourceItem.ChildObjects.IndexOf(destinationItem) + 1, item);
                                }
                            }
                        }
                    }
                }
                catch (Exception ex)
                {
                    RadWindow.Alert(new DialogParameters()
                    {
                        Header  = "Error",
                        Content = "Error while moving object\n" + ex.Message
                    });
                }
            }
        }
Exemple #37
0
 public TaskStartEvent(ObjectModel _obj, TaskStartEventType _type)
 {
     type = _type;
     obj  = _obj;
 }
        protected override void Prepare(ObjectModel model)
        {
            myModel = model;

            var androidTypes = from type in myModel.Types where (type.Name.StartsWith("android.") || type.Name.StartsWith("java.")) && (!type.Name.StartsWith("android.test.")) select type;
            foreach (var type in androidTypes)
            {
                AddAllTypes(myModel, myTypesOfInterest, type);
            }

            foreach (var type in model.Types)
            {
                type.Name = EscapeName(type.Name);
                foreach (var method in type.Methods)
                {
                    method.Name = EscapeName(method.Name);
                    for (int i = 0; i < method.Parameters.Count; i++)
                    {
                        method.Parameters[i] = EscapeName(method.Parameters[i], false);
                    }
                    if (method.Return != null)
                    {
                        method.Return = EscapeName(method.Return, false);
                    }
                }
                if (type.Parent != null)
                    type.Parent = EscapeName(type.Parent);
                for (int i = 0; i < type.Interfaces.Count; i++)
                {
                    type.Interfaces[i] = EscapeName(type.Interfaces[i]);
                }
                for (int i = 0; i < type.Fields.Count; i++)
                {
                    type.Fields[i].Name = EscapeName(type.Fields[i].Name);
                    type.Fields[i].Type = EscapeName(type.Fields[i].Type, false);
                }
            }
        }
 //public void SetColliderSize(float x, float y, float z) {
 //    gameObject.AddComponent<BoxCollider>();
 //    gameObject.GetComponent<BoxCollider>().size = new Vector3(x, y, z);
 //}
 public void SetObject(ObjectModel e)
 {
     eObject = e;
 }
 private FeatureAndBackground GetCucumberFeature(ObjectModel.Feature feature)
 {
     var cucumberFeature = this.resultsDocument.FirstOrDefault(f => f.name == feature.Name);
     var background = cucumberFeature?.elements?.FirstOrDefault(e => e.type == "background");
     return new FeatureAndBackground(cucumberFeature, background);
 }
Exemple #41
0
 public AnalyzeHeader(ObjectModel objects)
 {
     m_objects = objects;
 }
Exemple #42
0
 public ControlSystem(PIDBlock pid, double dt)
 {
     this._dt = dt;
     _obj     = new ObjectModel(1, 20, 25, 1, 1, dt);
     _pid     = pid;
 }
Exemple #43
0
 public void SetModel(ObjectModel objectModel)
 {
     this._objectModel = objectModel;
     simpleDragObject.SetObjectModel(objectModel);
 }
 public ObjectModelBuilder(string defaultObjectModelId)
 {
     this.defaultObjectModelId = defaultObjectModelId;
     result = new ObjectModel();
 }
Exemple #45
0
 /// <summary>
 ///     Creates a <see cref="Pickup" />.
 /// </summary>
 /// <param name="model">The model of the pickup.</param>
 /// <param name="type">The pickup spawn type.</param>
 /// <param name="position">The position where the pickup should be spawned.</param>
 /// <param name="virtualWorld">The virtual world ID of the pickup. Use -1 for all worlds.</param>
 /// <returns>The created pickup or null if it cannot be created.</returns>
 public static Pickup Create(ObjectModel model, PickupType type, Vector3 position, int virtualWorld = -1)
 {
     return(Create((int)model, (int)type, position, virtualWorld));
 }
Exemple #46
0
        private static string DoMapArgType(ObjectModel objects, string inType)
        {
            string type = objects.MapType(inType);				// note that this is word to word with no spaces in the words

            switch (type)
            {
                case "BOOL *":
                case "Boolean *":
                    return "out bool";

                case "unsigned char *":
                case "uint8_t *":
                    return "out byte";

                case "unichar *":
                    return "out char";

                case "double *":
                    return "out double";

                case "CGFloat *":
                case "float *":
                    return "out float";

                case "short *":
                    return "out Int16";

                case "GLint *":
                case "GLsizei *":
                case "int *":
                case "int32_t *":
                case "long *":
                case "NSInteger *":
                case "SInt32 *":
                    return "out Int32";

                case "int64_t *":
                case "long long *":
                    return "out Int64";

                case "NSRange *":
                case "NSRangePointer":
                    return "out NSRange";

                case "NSError **":
                    return "out NSError";

                case "NSString **":
                    return "out NSString";

                case "NSStringEncoding *":
                    return "out UInt32";

                case "signed char *":
                    return "out sbyte";

                case "uint16_t *":
                case "unsigned short *":
                    return "out UInt16";

                case "uint32_t *":
                case "unsigned *":
                case "unsigned int *":
                case "UTF32Char *":
                    return "out UInt32";

                case "unsigned long *":
                case "unsigned long long *":
                    return "out UInt64";

                case "SEL":
                    return "string";

                default:
                    return MapType(objects, inType);
            }
        }
Exemple #47
0
        public void Assemble(ValueModel source, AssemblyContext context)
        {
            ObjectModel obj = source as ObjectModel;

            _translations = obj.GetProperties().ToDictionary(x => x.Name, y => (y.Model as PrimitiveModel).Value);
        }
 IInterceptor <ServiceInterceptionContext> IInterceptionConfiguration.GetServiceInterceptor(ObjectModel objectModel, OperationModel operationModel) => new ChainInterceptor <ServiceInterceptionContext>(ServiceInterceptors.Get(new OperationWithObjectModel(objectModel, operationModel)));
        public override TestResult GetFeatureResult(ObjectModel.Feature feature)
        {
            var cucumberFeature = this.GetCucumberFeature(feature);

            return this.GetResultFromFeature(cucumberFeature.Feature, cucumberFeature.Background);
        }
 protected override void SaveInternal(ObjectModel objectModel)
 {
     throw new NotImplementedException();
 }
Exemple #51
0
        public Task <object> GetObjectJson()
        {
            var obj = new ObjectModel();

            return(Task.FromResult <object>(Ok(JsonUtil.SerializeObject(obj))));
        }
Exemple #52
0
 public abstract T AssembleValue(ObjectModel value, AssemblyContext context);
Exemple #53
0
        public void OnElementEnd(ElementId elementId)
        {
            var    elem = doc.GetElement(elementId);
            string uuid = elem.UniqueId;

            if (isrvt)
            {
                if (elem.Category == null || !Utils.HasSolid(elem) || elem is ElementType)
                {
                    return;
                }
            }
            else
            {
                if (elem.Category != null &&
                    (elem.Category.Id.IntegerValue == (int)BuiltInCategory.OST_Cameras ||
                     elem.Category.Id.IntegerValue == (int)BuiltInCategory.OST_Lines))
                {
                    return;
                }
            }
            var children = new List <ObjectModel>();

            foreach (var elem_per_material in XYZs.Keys)
            {
                var positionarray = new List <double>();
                var xyzlist       = XYZs[elem_per_material];
                foreach (var xyz in xyzlist)
                {
                    var p = new PointInt(xyz, switch_coordinates);
                    positionarray.Add(scale_vertex * p.X);
                    positionarray.Add(scale_vertex * p.Y);
                    positionarray.Add(scale_vertex * p.Z);
                }
                var indexlist = Indexs[elem_per_material];

                var currentgeometry = new GeometryModel()
                {
                    uuid = elem_per_material,
                    type = "BufferGeometry",
                };
                var geometrydata = new GeometryDataModel()
                {
                    attributes = new AttributeModel()
                    {
                        position = new GeometryBasicModel()
                        {
                            itemSize   = 3,
                            type       = "Float32Array",
                            array      = positionarray,
                            normalized = false,
                        },
                    },
                    index = new IndexModel()
                    {
                        array = indexlist,
                        type  = "Uint16Array",
                    },
                };

                currentgeometry.data = geometrydata;
                if (!geometries.ContainsKey(elem_per_material))
                {
                    geometries.Add(elem_per_material, currentgeometry);
                }

                var objectmodel = new ObjectModel()
                {
                    uuid     = elem_per_material,
                    name     = Utils.GetDescription4Element(elem, isrvt),
                    type     = "Mesh",
                    matrix   = new double[] { 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 },
                    geometry = elem_per_material,
                    material = materials.Values.Select(x => x.uuid).FirstOrDefault(x => elem_per_material.Contains(x))
                };
                children.Add(objectmodel);
            }
            if (currentobject != null)
            {
                currentobject.children = children;
                if (!objects.ContainsKey(uuid))
                {
                    objects.Add(uuid, currentobject);
                }
            }
        }
 public TestResult GetFeatureResult(ObjectModel.Feature feature)
 {
     var cucumberFeature = this.GetFeatureElement(feature);
     return this.GetResultFromFeature(cucumberFeature);
 }
        protected override void Prepare (ObjectModel model)
        {
            myModel = model;

            var androidTypes = from type in myModel.Types where type.Name.StartsWith("android.") && !type.Name.StartsWith("android.test.") select type;
            //var androidTypes = from type in myModel.Types where type.Name == "java.lang.Object" select type;
            foreach (var type in androidTypes)
            {
                AddAllTypes(myModel, myTypesOfInterest, type);
            }
            
            foreach (var type in model.Types)
            {
                type.Name = EscapeName(type.Name);
                foreach (var method in type.Methods)
                {
                    method.Name = EscapeName(method.Name);
                    for (int i = 0; i < method.Parameters.Count; i++)
                    {
                        method.Parameters[i] = EscapeName(method.Parameters[i], false);
                    }
                    if (method.Return != null)
                    {
                        method.Return = EscapeName(method.Return, false);
                    }
                    // jni4net exposes java.util.List.listIterator with a return type of Iterator, and not ListIterator...
                    // massage this so it works.
                    //if ((type.Name == "java.util.AbstractList" || type.Name == "java.util.concurrent.CopyOnWriteArrayList") && method.Name == "listIterator")
                    //    method.Return = "java.util.Iterator";
                }
                if (type.Parent != null)
                    type.Parent = EscapeName(type.Parent);
                for (int i = 0; i < type.Interfaces.Count; i++)
                {
                    type.Interfaces[i] = EscapeName(type.Interfaces[i]);
                }
                for (int i = 0; i < type.Fields.Count; i++)
                {
                    type.Fields[i].Name = EscapeName(type.Fields[i].Name);
                    type.Fields[i].Type = EscapeName(type.Fields[i].Type, false);
                }
            }
        }
 private Feature GetFeatureElement(ObjectModel.Feature feature)
 {
     return this.resultsDocument.FirstOrDefault(x => x.name == feature.Name);
 }
Exemple #57
0
 public object Assemble(ObjectModel value, AssemblyContext context)
 {
     return(AssembleValue(value, context));
 }
Exemple #58
0
        public TypeInfo(ObjectModel objects, NativeInterface ni, NativeMethod method)
        {
            Native = method.ReturnType;

            string type = objects.MapResult(ni.Name, method.Name, method.ReturnType);
            Managed = MapType(objects, type);
            if (Managed == "IBAction")
                Managed = "void";
        }
 bool IServiceConfiguration.GetAllowGet(ObjectModel objectModel, OperationModel operationModel) => AllowGet.Get(new OperationWithObjectModel(objectModel, operationModel));
 public static void LoadModel(ObjectModel model)
 {
     XYCoroutineEngine.Execute(AsyncLoadModel(model));
 }