Beispiel #1
0
 public IType Replace(Unique unique, IType type)
 {
     return new TApp(
         mType1.Replace(unique, type),
         mType2.Replace(unique, type)
     );
 }
Beispiel #2
0
 public IType Rename()
 {
     Unique newUnique = new Unique();
     return new TAbs(
         newUnique,
         mType.Replace(mUnique, new TVar(newUnique)).Rename()
     );
 }
Beispiel #3
0
 public IType Eval(ITypeEnv typeEnv)
 {
     Unique unique = new Unique();
     typeEnv = typeEnv.MakeChild();
     typeEnv.Add(mTypeVarName, new TVar(unique));
     IType type = mTypeExpr.Eval(typeEnv);
     return new TAbs(unique, type);
 }
Beispiel #4
0
 public IType Replace(Unique unique, IType type)
 {
     if (mUnique == unique)
     {
         return type;
     }
     else
     {
         return this;
     }
 }
Beispiel #5
0
 public IType Eval(Unique unique, IType type)
 {
     if (mUnique == unique)
     {
         return type;
     }
     else
     {
         return this;
     }
 }
Beispiel #6
0
 public IType Eval(Unique unique, IType type)
 {
     IType type1 = mType1.Eval(unique, type);
     IType type2 = mType2.Eval(unique, type);
     if (type1 is ITypeFunc)
     {
         return ((ITypeFunc)type1).Apply(type2);
     }
     else
     {
         return new TApp(type1, type2);
     }
 }
Beispiel #7
0
 public IType Check(
     ITypeCtxt typeCtxt,
     ITypeEnv typeEnv,
     IValueCtxt valueCtxt
 )
 {
     Unique unique = new Unique();
     typeCtxt = typeCtxt.MakeChild();
     typeEnv = typeEnv.MakeChild();
     typeCtxt.Add(mTypeVarName, mKind);
     typeEnv.Add(mTypeVarName, new TVar(unique));
     IType type = mValueExpr.Check(typeCtxt, typeEnv, valueCtxt);
     return MakePolymorphicType(unique, mKind, type);
 }
Beispiel #8
0
        public override bool Draw()
        {
            //Child Window
            var size = ImGui.GetWindowSize();

            ImGui.BeginChild("##utfchild", new Vector2(size.X - 15, size.Y - 50), false, 0);
            //Layout
            if (selectedNode != null)
            {
                ImGui.Columns(2, "NodeColumns", true);
            }
            //Headers
            ImGui.Separator();
            ImGui.Text("Nodes");
            if (selectedNode != null)
            {
                ImGui.NextColumn();
                ImGui.Text("Node Information");
                ImGui.NextColumn();
            }
            ImGui.Separator();
            //Tree
            ImGui.BeginChild("##scroll", false, 0);
            var flags  = selectedNode == Utf.Root ? TreeNodeFlags.Selected | tflags : tflags;
            var isOpen = ImGui.TreeNodeEx("/", flags);

            if (ImGuiNative.igIsItemClicked(0))
            {
                selectedNode = Utf.Root;
            }
            ImGui.PushID("/##ROOT");
            DoNodeMenu("/##ROOT", Utf.Root, null);
            ImGui.PopID();
            if (isOpen)
            {
                for (int i = 0; i < Utf.Root.Children.Count; i++)
                {
                    DoNode(Utf.Root.Children[i], Utf.Root, i);
                }
                ImGui.TreePop();
            }
            ImGui.EndChild();
            //End Tree
            if (selectedNode != null)
            {
                //Node preview
                ImGui.NextColumn();
                NodeInformation();
            }
            //Action Bar
            ImGui.EndChild();
            ImGui.Separator();
            if (ImGui.Button("Actions"))
            {
                ImGui.OpenPopup("actions");
            }
            if (ImGui.BeginPopup("actions"))
            {
                if (ImGui.MenuItem("View Model"))
                {
                    IDrawable drawable = null;
                    try
                    {
                        drawable = LibreLancer.Utf.UtfLoader.GetDrawable(Utf.Export(), main.Resources);
                        drawable.Initialize(main.Resources);
                    }
                    catch (Exception) { ErrorPopup("Could not open as model"); drawable = null; }
                    if (drawable != null)
                    {
                        main.AddTab(new ModelViewer("Model Viewer (" + DocumentName + ")", DocumentName, drawable, main, this));
                    }
                }
                if (ImGui.MenuItem("Dump Model"))
                {
                    LibreLancer.Utf.Cmp.ModelFile model = null;
                    LibreLancer.Utf.Cmp.CmpFile   cmp   = null;
                    try
                    {
                        var drawable = LibreLancer.Utf.UtfLoader.GetDrawable(Utf.Export(), main.Resources);
                        model = (drawable as LibreLancer.Utf.Cmp.ModelFile);
                        cmp   = (drawable as LibreLancer.Utf.Cmp.CmpFile);
                    }
                    catch (Exception) { ErrorPopup("Could not open as model"); model = null; }
                    if (model != null)
                    {
                        var output = FileDialog.Save();
                        if (output != null)
                        {
                            DumpStatus(DumpObject.DumpObj(model, output));
                        }
                    }
                    if (cmp != null)
                    {
                        dumpcmp = cmp;
                        DoPickObject();
                    }
                }
                if (ImGui.MenuItem("View Ale"))
                {
                    AleFile ale = null;
                    try
                    {
                        ale = new AleFile(Utf.Export());
                    }
                    catch (Exception)
                    {
                        ErrorPopup("Could not open as ale");
                        ale = null;
                    }
                    if (ale != null)
                    {
                        main.AddTab(new AleViewer("Ale Viewer (" + Title + ")", Title, ale, main));
                    }
                }
                if (ImGui.MenuItem("Refresh Resources"))
                {
                    main.Resources.RemoveResourcesForId(Unique.ToString());
                    main.Resources.AddResources(Utf.Export(), Unique.ToString());
                }
                ImGui.EndPopup();
            }
            Popups();
            return(open);
        }
        public VertexTypePredefinition ToVertexTypePredefinition()
        {
            VertexTypePredefinition VertexTypePreDef = new VertexTypePredefinition(this.VertexTypeName);

            if (this.IsAbstract)
            {
                VertexTypePreDef.MarkAsAbstract();
            }
            if (this.IsSealed)
            {
                VertexTypePreDef.MarkAsSealed();
            }

            VertexTypePreDef.SetComment(this.Comment);
            VertexTypePreDef.SetSuperTypeName(this.SuperVertexTypeName);

            if (this.Properties != null)
            {
                foreach (var Property in this.Properties)
                {
                    VertexTypePreDef.AddProperty(Property.ToPropertyPredefinition());
                }
            }

            if (this.BinaryProperties != null)
            {
                foreach (var BinaryProperty in this.BinaryProperties)
                {
                    VertexTypePreDef.AddBinaryProperty(BinaryProperty.ToBinaryPropertyPredefinition());
                }
            }

            if (this.Uniques != null)
            {
                foreach (var Unique in this.Uniques)
                {
                    VertexTypePreDef.AddUnique(Unique.ToUniquePredefinition());
                }
            }

            if (this.IncomingEdges != null)
            {
                foreach (var IncomingEdge in this.IncomingEdges)
                {
                    VertexTypePreDef.AddIncomingEdge(IncomingEdge.ToIncomingEdgePredefinition());
                }
            }

            if (this.OutgoingEdges != null)
            {
                foreach (var OutgoingEdge in this.OutgoingEdges)
                {
                    VertexTypePreDef.AddOutgoingEdge(OutgoingEdge.ToOutgoingEdgePredefinition());
                }
            }

            if (this.Indices != null)
            {
                foreach (var Index in this.Indices)
                {
                    VertexTypePreDef.AddIndex(Index.ToIndexPredefinition());
                }
            }
            return(VertexTypePreDef);
        }
Beispiel #10
0
        public override void Process(TagHelperContext context, TagHelperOutput output)
        {
            base.Process(context, output);
            RenderFieldHeader(context, output);

            var id   = GetDomId();
            var type = (Type ?? "text").ToLower().Trim();

            if (Ajax != null)
            {
                output.Attributes.Add($"data-aiplugs-input-ajax-url", Ajax.Url ?? "");
                if (Ajax.Headers != null)
                {
                    foreach (var kv in Ajax.Headers)
                    {
                        output.Attributes.Add($"data-aiplugs-input-ajax-headers-{kv.Key}", kv.Value);
                    }
                }
                output.Attributes.Add("data-aiplugs-input-ajax-label", Ajax.Label ?? "label");
                output.Attributes.Add("data-aiplugs-input-ajax-value", Ajax.Value ?? "value");
            }

            output.Attributes.Add("data-aiplugs-input-unique", Unique.ToString().ToLower());
            output.Attributes.Add("data-aiplugs-input-ignore-case", IgnoreCase.ToString().ToLower());

            output.Html("<div class=\"aiplugs-input__field\">");

            output.Tag("input", () => {
                output.Attr("type", type);
                output.Attr("data-target", "aiplugs-input.input");
                output.Attr("data-action", "input->aiplugs-input#onInput blur->aiplugs-input#onBlur");
                output.Attr("data-val", "true");

                if (id != null)
                {
                    output.Attr("id", id);
                    output.Attr("list", $"suggestion-{id}");
                }

                if (Name != null)
                {
                    output.Attr("name", Name);
                }

                if (Value != null)
                {
                    output.Attr("value", Value);
                }

                if (ValueFrom != null)
                {
                    output.Attributes.Add("data-aiplugs-input-value-from", ValueFrom);
                }

                if (type == "email")
                {
                    output.Attr("data-val-email", Localizer.MsgValEmail(Label));
                }

                if (Readonly)
                {
                    output.Html(" readonly");
                }

                if (Required)
                {
                    output.Html(" required");
                    output.Attr("data-val-required", Localizer.MsgValRequired(Label));
                }

                if (!string.IsNullOrEmpty(Placeholder))
                {
                    output.Attr("placeholder", Placeholder);
                }

                if (!string.IsNullOrEmpty(Pattern))
                {
                    var message = !string.IsNullOrEmpty(PatternErrorMessage) ? PatternErrorMessage : Localizer.MsgValPattern(Label, Pattern);
                    output.Attr("data-val-regex", message);
                    output.Attr("data-val-regex-pattern", Pattern);
                }

                if (MaxLength.HasValue)
                {
                    output.Attr("data-val-maxlength", Localizer.MsgValMaxLengthForString(Label, MaxLength.Value));
                    output.Attr("data-val-maxlength-max", MaxLength.ToString());
                }

                if (MinLength.HasValue)
                {
                    output.Attr("data-val-minlength", Localizer.MsgValMinLengthForString(Label, MinLength.Value));
                    output.Attr("data-val-minlength-min", MinLength.ToString());
                }

                if (type == "number")
                {
                    output.Attr("data-val-number", Localizer.MsgValNumber(Label));

                    if (Max.HasValue || Min.HasValue)
                    {
                        var message = Max.HasValue && Min.HasValue ? Localizer.MsgValRange(Label, Min.Value, Max.Value)
                                    : Max.HasValue ? Localizer.MsgValMaxValue(Label, Max.Value)
                                    : Localizer.MsgValMinValue(Label, Min.Value);

                        output.Attr($"data-val-range", message);
                    }

                    if (Step.HasValue)
                    {
                        output.Html($"step=\"{Step}\"");
                    }

                    if (Max.HasValue)
                    {
                        output.Html($"max=\"{Max}\" data-val-range-max=\"{Max}\"");
                    }

                    if (Min.HasValue)
                    {
                        output.Html($"min=\"{Min}\" data-val-range-min=\"{Min}\"");
                    }
                }
            });

            output.Html("</div>");

            if (id != null)
            {
                output.Tag("datalist", () => {
                    output.Attr("id", $"suggestion-{id}");
                    output.Attr("data-target", "aiplugs-input.suggestion");
                });
            }

            RenderFieldFooter(context, output, Name);
        }
 public static string GetGetByUniqueRepositoryMethodName(this ITable dbObject, Unique unique)
 => string.Format("Get{0}By{1}Async", dbObject.GetEntityName(), string.Join("And", unique.Key.Select(item => namingConvention.GetPropertyName(item))));
Beispiel #12
0
 public static IType MakePolymorphicType(
     Unique unique, IKind kind, IType type
 )
 {
     return new TApp(new TCPoly(kind), new TAbs(unique, type));
 }
Beispiel #13
0
        public override void Draw()
        {
            //Child Window
            var size = ImGui.GetWindowSize();

            ImGui.BeginChild("##utfchild", new Vector2(size.X - 15, size.Y - 50), false, 0);
            //Layout
            if (selectedNode != null)
            {
                ImGui.Columns(2, "NodeColumns", true);
            }
            //Headers
            ImGui.Separator();
            ImGui.Text("Nodes");
            if (selectedNode != null)
            {
                ImGui.NextColumn();
                ImGui.Text("Node Information");
                ImGui.NextColumn();
            }
            ImGui.Separator();
            //Tree
            ImGui.BeginChild("##scroll");
            var flags  = selectedNode == Utf.Root ? ImGuiTreeNodeFlags.Selected | tflags : tflags;
            var isOpen = ImGui.TreeNodeEx("/", flags);

            if (ImGui.IsItemClicked(0))
            {
                selectedNode = Utf.Root;
            }
            ImGui.PushID("/##ROOT");
            DoNodeMenu("/##ROOT", Utf.Root, null);
            ImGui.PopID();
            if (isOpen)
            {
                for (int i = 0; i < Utf.Root.Children.Count; i++)
                {
                    DoNode(Utf.Root.Children[i], Utf.Root, i);
                }
                ImGui.TreePop();
            }
            ImGui.EndChild();
            //End Tree
            if (selectedNode != null)
            {
                //Node preview
                ImGui.NextColumn();
                NodeInformation();
            }
            //Action Bar
            ImGui.EndChild();
            ImGui.Separator();
            if (ImGui.Button("Actions"))
            {
                ImGui.OpenPopup("actions");
            }
            if (ImGui.BeginPopup("actions"))
            {
                if (ImGui.MenuItem("View Model"))
                {
                    IDrawable  drawable = null;
                    ModelNodes hpn      = new ModelNodes();
                    try
                    {
                        drawable = LibreLancer.Utf.UtfLoader.GetDrawable(Utf.Export(), main.Resources);
                        drawable.Initialize(main.Resources);
                        if (Utf.Root.Children.Any((x) => x.Name.Equals("cmpnd", StringComparison.OrdinalIgnoreCase)))
                        {
                            foreach (var child in Utf.Root.Children.Where((x) => x.Name.EndsWith(".3db", StringComparison.OrdinalIgnoreCase)))
                            {
                                var n = new ModelNode();
                                n.Name           = child.Name;
                                n.Node           = child;
                                n.HardpointsNode = child.Children.FirstOrDefault((x) => x.Name.Equals("hardpoints", StringComparison.OrdinalIgnoreCase));
                                hpn.Nodes.Add(n);
                            }
                            var cmpnd = Utf.Root.Children.First((x) => x.Name.Equals("cmpnd", StringComparison.OrdinalIgnoreCase));
                            hpn.Cons = cmpnd.Children.FirstOrDefault((x) => x.Name.Equals("cons", StringComparison.OrdinalIgnoreCase));
                        }
                        else
                        {
                            var n = new ModelNode();
                            n.Name           = "ROOT";
                            n.Node           = Utf.Root;
                            n.HardpointsNode = Utf.Root.Children.FirstOrDefault((x) => x.Name.Equals("hardpoints", StringComparison.OrdinalIgnoreCase));
                            hpn.Nodes.Add(n);
                        }
                    }
                    catch (Exception ex) { ErrorPopup("Could not open as model\n" + ex.Message + "\n" + ex.StackTrace); drawable = null; }
                    if (drawable != null)
                    {
                        main.AddTab(new ModelViewer(DocumentName, drawable, main, this, hpn));
                    }
                }
                if (ImGui.MenuItem("Export Collada"))
                {
                    LibreLancer.Utf.Cmp.ModelFile model = null;
                    LibreLancer.Utf.Cmp.CmpFile   cmp   = null;
                    try
                    {
                        var drawable = LibreLancer.Utf.UtfLoader.GetDrawable(Utf.Export(), main.Resources);
                        model = (drawable as LibreLancer.Utf.Cmp.ModelFile);
                        cmp   = (drawable as LibreLancer.Utf.Cmp.CmpFile);
                    }
                    catch (Exception) { ErrorPopup("Could not open as model"); model = null; }
                    if (model != null)
                    {
                        var output = FileDialog.Save();
                        if (output != null)
                        {
                            model.Path = DocumentName;
                            try
                            {
                                ColladaExport.ExportCollada(model, main.Resources, output);
                            }
                            catch (Exception ex)
                            {
                                ErrorPopup("Error\n" + ex.Message + "\n" + ex.StackTrace);
                            }
                        }
                    }
                    if (cmp != null)
                    {
                        var output = FileDialog.Save();
                        if (output != null)
                        {
                            cmp.Path = DocumentName;
                            try
                            {
                                ColladaExport.ExportCollada(cmp, main.Resources, output);
                            }
                            catch (Exception ex)
                            {
                                ErrorPopup("Error\n" + ex.Message + "\n" + ex.StackTrace);
                            }
                        }
                    }
                }
                if (ImGui.MenuItem("View Ale"))
                {
                    AleFile ale = null;
                    try
                    {
                        ale = new AleFile(Utf.Export());
                    }
                    catch (Exception)
                    {
                        ErrorPopup("Could not open as ale");
                        ale = null;
                    }
                    if (ale != null)
                    {
                        main.AddTab(new AleViewer(Title, ale, main));
                    }
                }

                if (ImGui.MenuItem("Resolve Audio Hashes"))
                {
                    var folder = FileDialog.ChooseFolder();
                    if (folder != null)
                    {
                        var idtable = new IDTable(folder);
                        foreach (var n in Utf.Root.IterateAll())
                        {
                            if (n.Name.StartsWith("0x"))
                            {
                                uint v;
                                if (uint.TryParse(n.Name.Substring(2), NumberStyles.HexNumber, CultureInfo.InvariantCulture, out v))
                                {
                                    idtable.UtfNicknameTable.TryGetValue(v, out n.ResolvedName);
                                }
                            }
                            else
                            {
                                n.ResolvedName = null;
                            }
                        }
                    }
                }
                ImGui.EndPopup();
            }
            ImGui.SameLine();
            if (ImGui.Button("Reload Resources"))
            {
                main.Resources.RemoveResourcesForId(Unique.ToString());
                main.Resources.AddResources(Utf.Export(), Unique.ToString());
            }
            Popups();
        }
Beispiel #14
0
	public static byte[] Serialize(Unique unique)
	{
		return Serialize((Item)unique);
	}
Beispiel #15
0
        protected override void OnCreate()
        {
            stopwatch = new System.Diagnostics.Stopwatch();
            stopwatch.Restart();
            stopwatch.Start();

            int i_len = 10000;

            NativeMultiHashMap <int, int> dic  = new NativeMultiHashMap <int, int> (i_len, Allocator.Temp);
            NativeMultiHashMap <int, int> dic2 = new NativeMultiHashMap <int, int> (i_len, Allocator.TempJob);

            NativeHashMap <int, int> dic3 = new NativeHashMap <int, int> (i_len, Allocator.Temp);

            for (int i = 0; i < i_len; i++)
            {
                var v2 = new Vector2Int(Random.Range(10, -10), Random.Range(-1000, 1000));
                dic.Add(v2.x, v2.y);
                dic2.Add(v2.x, v2.y);
                dic3.TryAdd(v2.x, v2.y);
                // Debug.Log ( "v2: " + v2 ) ;
            }

            Debug.Log("populate hashmaps " + stopwatch.ElapsedMilliseconds + "ms");
            stopwatch.Restart();
            // NativeMultiHashMap <int,int> dic = nmhm_newBornEntitiesPerTile ;

            var withDuplicates = dic.GetKeyArray(Allocator.Temp);

            Debug.Log("multi hashmap get keys " + stopwatch.ElapsedMilliseconds + "ms");
            stopwatch.Restart();

            NativeArray <int> withDuplicates2 = new NativeArray <int> (dic2.Count(), Allocator.TempJob, NativeArrayOptions.UninitializedMemory);

            Dependency = new GetArray( )
            {
                dic            = dic2,
                withDuplicates = withDuplicates2
            }.Schedule(Dependency);
            Dependency.Complete();

            Debug.Log("multi hashmap get keys job burst B " + stopwatch.ElapsedMilliseconds + "ms");
            stopwatch.Restart();

            var noDuplicates = dic3.GetKeyArray(Allocator.Temp);

            Debug.Log("hashmap get keys " + stopwatch.ElapsedMilliseconds + "ms");


            /*
             * for ( int i = 0; i < noDuplicates.Length; i ++ )
             * {
             *  Debug.Log ( "no duplicates: " + noDuplicates [i] ) ;
             * }
             */


            stopwatch.Restart();


            withDuplicates.Sort();
            Debug.Log("sort A " + stopwatch.ElapsedMilliseconds + "ms");
            stopwatch.Restart();

            int uniqueCount = withDuplicates.Unique();

            Debug.Log("multi hashmap unique A " + stopwatch.ElapsedMilliseconds + "ms");
            Debug.Log("uniqueCount " + uniqueCount);
            stopwatch.Restart();
            Dependency = new Sort( )
            {
                withDuplicates = withDuplicates2
            }.Schedule(Dependency);
            Dependency.Complete();

            Debug.Log("sort job burst B " + stopwatch.ElapsedMilliseconds + "ms");
            stopwatch.Restart();

            NativeArray <int> na_i = new NativeArray <int> (3, Allocator.TempJob);

            Dependency = new Unique( )
            {
                i = na_i,
                withDuplicates = withDuplicates2
            }.Schedule(Dependency);
            Dependency.Complete();

            uniqueCount = na_i [0];

            Debug.Log("multi hashmap unique job burst B " + stopwatch.ElapsedMilliseconds + "ms");
            Debug.Log("uniqueCount " + uniqueCount);
            stopwatch.Restart();


            Debug.Log("uniqueCount hashmap " + noDuplicates.Length);

            /*
             *  for ( int i = 0; i < i_len; i ++ )
             *  {
             *      Debug.Log ( "B: " + withDuplicates [i] ) ;
             *  }
             */
            withDuplicates2.Dispose();
            dic2.Dispose();
            withDuplicates.Dispose();
            noDuplicates.Dispose();
            dic.Dispose();

            Debug.LogError("Stop");
        }
Beispiel #16
0
 public bool Equals(Nuid other)
 {
     return(Origin.Equals(other.Origin) && Unique.Equals(other.Unique));
 }
Beispiel #17
0
 public bool IsHidden(Unique unique)
 {
     return(false);
 }
Beispiel #18
0
 public bool IsHidden(Unique unique)
 {
     throw new NotImplementedException();
 }
        public void Given_A_String_That_Does_Not_Have_Unique_Characters_IsUnique_Returns_False(string s)
        {
            var actual = Unique.IsUnique(s);

            Assert.False(actual);
        }
        public void Given_A_String_That_Has_Unique_Characters_IsUnique_Returns_True(string s)
        {
            var actual = Unique.IsUnique(s);

            Assert.True(actual);
        }
Beispiel #21
0
        // Module defining this command


        // Optional custom code for this activity


        /// <summary>
        /// Returns a configured instance of System.Management.Automation.PowerShell, pre-populated with the command to run.
        /// </summary>
        /// <param name="context">The NativeActivityContext for the currently running activity.</param>
        /// <returns>A populated instance of Sytem.Management.Automation.PowerShell</returns>
        /// <remarks>The infrastructure takes responsibility for closing and disposing the PowerShell instance returned.</remarks>
        protected override ActivityImplementationContext GetPowerShell(NativeActivityContext context)
        {
            System.Management.Automation.PowerShell invoker       = global::System.Management.Automation.PowerShell.Create();
            System.Management.Automation.PowerShell targetCommand = invoker.AddCommand(PSCommandName);

            // Initialize the arguments

            if (InputObject.Expression != null)
            {
                targetCommand.AddParameter("InputObject", InputObject.Get(context));
            }

            if (Property.Expression != null)
            {
                targetCommand.AddParameter("Property", Property.Get(context));
            }

            if (ExcludeProperty.Expression != null)
            {
                targetCommand.AddParameter("ExcludeProperty", ExcludeProperty.Get(context));
            }

            if (ExpandProperty.Expression != null)
            {
                targetCommand.AddParameter("ExpandProperty", ExpandProperty.Get(context));
            }

            if (Unique.Expression != null)
            {
                targetCommand.AddParameter("Unique", Unique.Get(context));
            }

            if (Last.Expression != null)
            {
                targetCommand.AddParameter("Last", Last.Get(context));
            }

            if (First.Expression != null)
            {
                targetCommand.AddParameter("First", First.Get(context));
            }

            if (Skip.Expression != null)
            {
                targetCommand.AddParameter("Skip", Skip.Get(context));
            }

            if (SkipLast.Expression != null)
            {
                targetCommand.AddParameter("SkipLast", SkipLast.Get(context));
            }

            if (Wait.Expression != null)
            {
                targetCommand.AddParameter("Wait", Wait.Get(context));
            }

            if (Index.Expression != null)
            {
                targetCommand.AddParameter("Index", Index.Get(context));
            }


            return(new ActivityImplementationContext()
            {
                PowerShellInstance = invoker
            });
        }
Beispiel #22
0
        private static MethodDefinition GetGetByUniqueMethods(ProjectFeature <EntityFrameworkCoreProjectSettings> projectFeature, ITable table, Unique unique)
        {
            var project = projectFeature.GetEntityFrameworkCoreProject();

            var selection = project.GetSelection(table);

            var expression = string.Format("item => {0}", string.Join(" && ", unique.Key.Select(item => string.Format("item.{0} == entity.{0}", project.CodeNamingConvention.GetPropertyName(item)))));

            var existingViews = project.Database.Views.Count(item => item.Name == table.Name);

            var genericTypeName = existingViews == 0 ? project.GetEntityName(table) : project.GetFullEntityName(table);
            var dbSetName       = existingViews == 0 ? project.GetDbSetPropertyName(table, selection.Settings.PluralizeDbSetPropertyNames) : project.GetFullDbSetPropertyName(table);

            return(new MethodDefinition
            {
                AccessModifier = AccessModifier.Public,
                IsAsync = true,
                Type = string.Format("Task<{0}>", project.GetEntityName(table)),
                Name = project.GetGetByUniqueRepositoryMethodName(table, unique),
                Parameters =
                {
                    new ParameterDefinition(project.GetEntityName(table), "entity")
                },
                Lines =
                {
                    new CodeLine("return await DbContext.{0}.FirstOrDefaultAsync({1});", dbSetName, expression)
                }
            });
        }
Beispiel #23
0
        void printtest()
        {
            var obj = Unique <MyUniqueTest> .Get();

            Debug.Log($"unique: {obj.name}");
        }
Beispiel #24
0
 public static string GetGetByUniqueRepositoryMethodName(this EntityFrameworkCoreProject project, ITable table, Unique unique)
 => string.Format("Get{0}By{1}Async", project.GetEntityName(table), string.Join("And", unique.Key.Select(item => project.CodeNamingConvention.GetPropertyName(item))));
Beispiel #25
0
		protected virtual Unique.Response OnMessageReceived (int command, Unique.MessageData message_data, uint time_)
		{
			GLib.Value ret = new GLib.Value (Unique.ResponseGType.GType);
			GLib.ValueArray inst_and_params = new GLib.ValueArray (4);
			GLib.Value[] vals = new GLib.Value [4];
			vals [0] = new GLib.Value (this);
			inst_and_params.Append (vals [0]);
			vals [1] = new GLib.Value (command);
			inst_and_params.Append (vals [1]);
			vals [2] = new GLib.Value (message_data);
			inst_and_params.Append (vals [2]);
			vals [3] = new GLib.Value (time_);
			inst_and_params.Append (vals [3]);
			g_signal_chain_from_overridden (inst_and_params.ArrayPtr, ref ret);
			foreach (GLib.Value v in vals)
				v.Dispose ();
			Unique.Response result = (Unique.Response) (Enum) ret;
			ret.Dispose ();
			return result;
		}
Beispiel #26
0
 void Awake()
 {
     instance = this;
 }
Beispiel #27
0
 public IType Eval(Unique unique, IType type)
 {
     return this;
 }
Beispiel #28
0
	public static void Deserialize(byte[] serialized, out Unique unique)
	{
		Item item;
		Deserialize(serialized, out item);
		unique = (Unique)item;
	}
Beispiel #29
0
 public TAbs(Unique unique, IType type)
 {
     mUnique = unique;
     mType = type;
 }
Beispiel #30
0
        private static MethodDefinition GetGetByUniqueMethods(ProjectFeature projectFeature, ITable table, Unique unique)
        {
            var entityFrameworkCoreProject = projectFeature.GetEntityFrameworkCoreProject();

            var expression = string.Format("item => {0}", string.Join(" && ", unique.Key.Select(item => string.Format("item.{0} == entity.{0}", NamingExtensions.namingConvention.GetPropertyName(item)))));

            return(new MethodDefinition(string.Format("Task<{0}>", table.GetSingularName()), table.GetGetByUniqueRepositoryMethodName(unique), new ParameterDefinition(table.GetSingularName(), "entity"))
            {
                IsAsync = true,
                Lines = new List <ILine>
                {
                    new CodeLine("return await DbContext.{0}.FirstOrDefaultAsync({1});", entityFrameworkCoreProject.Settings.DeclareDbSetPropertiesInDbContext ? table.GetPluralName() : string.Format("Set<{0}>()", table.GetSingularName()), expression)
                }
            });
        }
Beispiel #31
0
 public TVar(Unique unique)
 {
     mUnique = unique;
 }
Beispiel #32
0
 public override string ToString()
 {
     return(string.Format("{0}:{1}", Origin.ToString(), Unique.ToString()));
 }
Beispiel #33
0
 private void Awake()
 {
     Debug.Log($"{gameObject.name}");
     Unique <MyUniqueTest> .Generate(this);
 }
Beispiel #34
0
 public override int GetHashCode()
 {
     return(Unique.GetHashCode());
 }
Beispiel #35
0
        public override string ToString()
        {
            if (boolCompleteCode)
            {
                string contenu = "\nCREATE TABLE " + this.nom + "\n(";
                for (int i = 0; i < arrayAttributs.Count; i++)
                {
                    contenu += "\n\t";
                    Attribut att = (Attribut)arrayAttributs[i];
                    contenu += att.ToString();
                    contenu += ", ";
                }

                if (!pk.propCode.Equals(""))
                {
                    contenu += "\n\t";

                    contenu += pk.propCode;
                    contenu += ", ";
                }


                for (int i = 0; i < arrayFK.Count; i++)
                {
                    contenu += "\n\t";
                    ForeignKey fktemp = (ForeignKey)arrayFK[i];
                    contenu += fktemp.propCode;
                    contenu += ", ";
                }

                for (int i = 0; i < arrayCK.Count; i++)
                {
                    contenu += "\n\t";
                    Check cktemp = (Check)arrayCK[i];
                    contenu += cktemp.propCode;
                    contenu += ", ";
                }

                for (int i = 0; i < arrayUQ.Count; i++)
                {
                    contenu += "\n\t";
                    Unique uqtemp = (Unique)arrayUQ[i];
                    contenu += uqtemp.propCode;
                    contenu += ", ";
                }

                contenu  = contenu.Substring(0, contenu.Length - 2);
                contenu += "\n);";
                return(contenu);
//
//			if (pk.nom == null && arrayFK.Count == 0 && arrayCK.Count == 0 && arrayUQ.Count == 0) {
//				for (int i = 0; i < arrayAttributs.Count; i++) {
//					contenu += "\n\t";
//					Attribut att = (Attribut) arrayAttributs[i];
//					contenu += att.ToString();
//					contenu += ",";
//				}
//				contenu += "\n);";
//				return contenu;
//			} else {
//				for (int i = 0; i < arrayAttributs.Count; i++) {
//					contenu += "\n\t";
//					Attribut att = (Attribut) arrayAttributs[i];
//					contenu += att.ToString();
//					contenu += ",";
//				}
//
//				if (pk.nom != null) {
//					contenu += code
//				}
//
//				contenu += "\n);";
//				return contenu;
//			}

//			return "listing okay";
            }
            else
            {
                string contenu = "\nCREATE TABLE " + this.nom + "\n(";
                contenu += autoCode;
                return(contenu + ";");
            }
        }
Beispiel #36
0
		public Unique.Response SendMessage(Unique.Command command_id, Unique.MessageData message_data) {
			int raw_ret = unique_app_send_message(Handle, (int) command_id, message_data == null ? IntPtr.Zero : message_data.Handle);
			Unique.Response ret = (Unique.Response) raw_ret;
			return ret;
		}
        private static MethodDefinition GetGetByUniqueMethods(ProjectFeature <EntityFrameworkCoreProjectSettings> projectFeature, ITable table, Unique unique)
        {
            var project = projectFeature.GetEntityFrameworkCoreProject();

            var selection = project.GetSelection(table);

            var expression = string.Format("item => {0}", string.Join(" && ", unique.Key.Select(item => string.Format("item.{0} == entity.{0}", project.CodeNamingConvention.GetPropertyName(item)))));

            return(new MethodDefinition(AccessModifier.Public, string.Format("Task<{0}>", project.GetEntityName(table)), project.GetGetByUniqueRepositoryMethodName(table, unique), new ParameterDefinition(project.GetEntityName(table), "entity"))
            {
                IsAsync = true,
                Lines =
                {
                    new CodeLine("return await DbContext.{0}.FirstOrDefaultAsync({1});", project.GetDbSetPropertyName(table), expression)
                }
            });
        }
Beispiel #38
0
 public IType Replace(Unique unique, IType type)
 {
     return this;
 }
Beispiel #39
0
        private static void PrintField(Field field)
        {
            //Get the SystemMandatory of each Field
            Console.WriteLine("Field SystemMandatory: " + field.SystemMandatory);

            //Get the Webhook of each Field
            Console.WriteLine("Field Webhook: " + field.Webhook);

            //Get the JsonType of each Field
            Console.WriteLine("Field JsonType: " + field.JsonType);

            //Get the Object obtained Crypt instance
            Crypt crypt = field.Crypt;

            //Check if crypt is not null
            if (crypt != null)
            {
                //Get the Mode of the Crypt
                Console.WriteLine("Field Crypt Mode: " + crypt.Mode);

                //Get the Column of the Crypt
                Console.WriteLine("Field Crypt Column: " + crypt.Column);

                //Get the Table of the Crypt
                Console.WriteLine("Field Crypt Table: " + crypt.Table);

                //Get the Status of the Crypt
                Console.WriteLine("Field Crypt Status: " + crypt.Status);
            }

            //Get the FieldLabel of each Field
            Console.WriteLine("Field FieldLabel: " + field.FieldLabel);

            //Get the Object obtained ToolTip instance
            ToolTip tooltip = field.Tooltip;

            //Check if tooltip is not null
            if (tooltip != null)
            {
                //Get the Name of the ToolTip
                Console.WriteLine("Field ToolTip Name: " + tooltip.Name);

                //Get the Value of the ToolTip
                Console.WriteLine("Field ToolTip Value: " + tooltip.Value);
            }

            //Get the CreatedSource of each Field
            Console.WriteLine("Field CreatedSource: " + field.CreatedSource);

            //Get the FieldReadOnly of each Field
            Console.WriteLine("Field FieldReadOnly: " + field.FieldReadOnly);

            //Get the DisplayLabel of each Field
            Console.WriteLine("Field DisplayLabel: " + field.DisplayLabel);

            //Get the ReadOnly of each Field
            Console.WriteLine("Field ReadOnly: " + field.ReadOnly);

            //Get the Object obtained AssociationDetails instance
            AssociationDetails associationDetails = field.AssociationDetails;

            //Check if associationDetails is not null
            if (associationDetails != null)
            {
                //Get the Object obtained LookupField instance
                LookupField lookupField = associationDetails.LookupField;

                //Check if lookupField is not null
                if (lookupField != null)
                {
                    //Get the ID of the LookupField
                    Console.WriteLine("Field AssociationDetails LookupField ID: " + lookupField.Id);

                    //Get the Name of the LookupField
                    Console.WriteLine("Field AssociationDetails LookupField Name: " + lookupField.Name);
                }

                //Get the Object obtained LookupField instance
                LookupField relatedField = associationDetails.RelatedField;

                //Check if relatedField is not null
                if (relatedField != null)
                {
                    //Get the ID of the LookupField
                    Console.WriteLine("Field AssociationDetails RelatedField ID: " + relatedField.Id);

                    //Get the Name of the LookupField
                    Console.WriteLine("Field AssociationDetails RelatedField Name: " + relatedField.Name);
                }
            }

            if (field.QuickSequenceNumber != null)
            {
                //Get the QuickSequenceNumber of each Field
                Console.WriteLine("Field QuickSequenceNumber: " + field.QuickSequenceNumber);
            }

            if (field.BusinesscardSupported != null)
            {
                //Get the BusinesscardSupported of each Field
                Console.WriteLine("Field BusinesscardSupported: " + field.BusinesscardSupported);
            }

            //Check if MultiModuleLookup is not null
            if (field.MultiModuleLookup != null)
            {
                //Get the MultiModuleLookup map
                foreach (KeyValuePair <string, object> entry in field.MultiModuleLookup)
                {
                    //Get each value in the map
                    Console.WriteLine(entry.Key + ": " + JsonConvert.SerializeObject(entry.Value));
                }
            }

            //Get the Object obtained Currency instance
            Currency currency = field.Currency;

            //Check if currency is not null
            if (currency != null)
            {
                //Get the RoundingOption of the Currency
                Console.WriteLine("Field Currency RoundingOption: " + currency.RoundingOption);

                if (currency.Precision != null)
                {
                    //Get the Precision of the Currency
                    Console.WriteLine("Field Currency Precision: " + currency.Precision);
                }
            }

            //Get the ID of each Field
            Console.WriteLine("Field ID: " + field.Id);

            if (field.CustomField != null)
            {
                //Get the CustomField of each Field
                Console.WriteLine("Field CustomField: " + field.CustomField);
            }

            //Get the Object obtained Module instance
            Module lookup = field.Lookup;

            //Check if lookup is not null
            if (lookup != null)
            {
                //Get the Object obtained Layout instance
                Com.Zoho.Crm.API.Layouts.Layout layout = lookup.Layout;

                //Check if layout is not null
                if (layout != null)
                {
                    //Get the ID of the Layout
                    Console.WriteLine("Field ModuleLookup Layout ID: " + layout.Id);

                    //Get the Name of the Layout
                    Console.WriteLine("Field ModuleLookup Layout Name: " + layout.Name);
                }

                //Get the DisplayLabel of the Module
                Console.WriteLine("Field ModuleLookup DisplayLabel: " + lookup.DisplayLabel);

                //Get the APIName of the Module
                Console.WriteLine("Field ModuleLookup APIName: " + lookup.APIName);

                //Get the Module of the Module
                Console.WriteLine("Field ModuleLookup Module: " + lookup.Module_1);

                if (lookup.Id != null)
                {
                    //Get the ID of the Module
                    Console.WriteLine("Field ModuleLookup ID: " + lookup.Id);
                }
            }

            if (field.Visible != null)
            {
                //Get the Visible of each Field
                Console.WriteLine("Field Visible: " + field.Visible);
            }

            if (field.Length != null)
            {
                //Get the Length of each Field
                Console.WriteLine("Field Length: " + field.Length);
            }

            //Get the Object obtained ViewType instance
            ViewType viewType = field.ViewType;

            //Check if viewType is not null
            if (viewType != null)
            {
                //Get the View of the ViewType
                Console.WriteLine("Field ViewType View: " + viewType.View);

                //Get the Edit of the ViewType
                Console.WriteLine("Field ViewType Edit: " + viewType.Edit);

                //Get the Create of the ViewType
                Console.WriteLine("Field ViewType Create: " + viewType.Create);

                //Get the View of the ViewType
                Console.WriteLine("Field ViewType QuickCreate: " + viewType.QuickCreate);
            }

            //Get the Object obtained Module instance
            Module subform = field.Subform;

            //Check if subform is not null
            if (subform != null)
            {
                //Get the Object obtained Layout instance
                Com.Zoho.Crm.API.Layouts.Layout layout = subform.Layout;

                //Check if layout is not null
                if (layout != null)
                {
                    //Get the ID of the Layout
                    Console.WriteLine("Field Subform Layout ID: " + layout.Id);

                    //Get the Name of the Layout
                    Console.WriteLine("Field Subform Layout Name: " + layout.Name);
                }

                //Get the DisplayLabel of the Module
                Console.WriteLine("Field Subform DisplayLabel: " + subform.DisplayLabel);

                //Get the APIName of the Module
                Console.WriteLine("Field Subform APIName: " + subform.APIName);

                //Get the Module of the Module
                Console.WriteLine("Field Subform Module: " + subform.Module_1);

                if (subform.Id != null)
                {
                    //Get the ID of the Module
                    Console.WriteLine("Field Subform ID: " + subform.Id);
                }
            }

            //Get the APIName of each Field
            Console.WriteLine("Field APIName: " + field.APIName);

            //Get the Object obtained Unique instance
            Unique unique = field.Unique;

            //Check if unique is not null
            if (unique != null)
            {
                //Get the Casesensitive of the Unique
                Console.WriteLine("Field Unique Casesensitive in " + unique.Casesensitive);
            }

            if (field.HistoryTracking != null)
            {
                //Get the HistoryTracking of each Field
                Console.WriteLine("Field HistoryTracking: " + field.HistoryTracking);
            }

            //Get the DataType of each Field
            Console.WriteLine("Field DataType: " + field.DataType);

            //Get the Object obtained Formula instance
            Formula formula = field.Formula;

            //Check if formula is not null
            if (formula != null)
            {
                //Get the ReturnType of the Formula
                Console.WriteLine("Field Formula ReturnType:" + formula.ReturnType);

                if (formula.Expression != null)
                {
                    //Get the Expression of the Formula
                    Console.WriteLine("Field Formula Expression:" + formula.Expression);
                }
            }

            if (field.DecimalPlace != null)
            {
                //Get the DecimalPlace of each Field
                Console.WriteLine("Field DecimalPlace: " + field.DecimalPlace);
            }

            if (field.MassUpdate != null)
            {
                //Get the MassUpdate of each Field
                Console.WriteLine("Field MassUpdate: " + field.MassUpdate);
            }

            if (field.BlueprintSupported != null)
            {
                //Get the BlueprintSupported of each Field
                Console.WriteLine("Field BlueprintSupported: " + field.BlueprintSupported);
            }

            //Get all entries from the MultiSelectLookup instance
            MultiSelectLookup multiSelectLookup = field.Multiselectlookup;

            //Check if formula is not null
            if (multiSelectLookup != null)
            {
                //Get the DisplayValue of the MultiSelectLookup
                Console.WriteLine("Field MultiSelectLookup DisplayLabel: " + multiSelectLookup.DisplayLabel);

                //Get the LinkingModule of the MultiSelectLookup
                Console.WriteLine("Field MultiSelectLookup LinkingModule: " + multiSelectLookup.LinkingModule);

                //Get the LookupApiname of the MultiSelectLookup
                Console.WriteLine("Field MultiSelectLookup LookupApiname: " + multiSelectLookup.LookupApiname);

                //Get the APIName of the MultiSelectLookup
                Console.WriteLine("Field MultiSelectLookup APIName: " + multiSelectLookup.APIName);

                //Get the ConnectedlookupApiname of the MultiSelectLookup
                Console.WriteLine("Field MultiSelectLookup ConnectedlookupApiname: " + multiSelectLookup.ConnectedlookupApiname);

                //Get the ID of the MultiSelectLookup
                Console.WriteLine("Field MultiSelectLookup ID: " + multiSelectLookup.Id);
            }

            //Get the PickListValue of each Field
            List <PickListValue> pickListValues = field.PickListValues;

            //Check if formula is not null
            if (pickListValues != null)
            {
                foreach (PickListValue pickListValue in pickListValues)
                {
                    //Get the DisplayValue of each PickListValues
                    Console.WriteLine("Field PickListValue DisplayValue: " + pickListValue.DisplayValue);

                    if (pickListValue.SequenceNumber != null)
                    {
                        //Get the SequenceNumber of each PickListValues
                        Console.WriteLine(" Field PickListValue SequenceNumber: " + pickListValue.SequenceNumber);
                    }

                    //Get the ExpectedDataType of each PickListValues
                    Console.WriteLine("Field PickListValue ExpectedDataType: " + pickListValue.ExpectedDataType);

                    //Get the ActualValue of each PickListValues
                    Console.WriteLine("Field PickListValue ActualValue: " + pickListValue.ActualValue);

                    if (pickListValue.Maps != null)
                    {
                        foreach (Object map in pickListValue.Maps)
                        {
                            //Get each value from the map
                            Console.WriteLine(map);
                        }
                    }

                    //Get the SysRefName of each PickListValues
                    Console.WriteLine("Field PickListValue SysRefName: " + pickListValue.SysRefName);

                    //Get the Type of each PickListValues
                    Console.WriteLine("Field PickListValue Type: " + pickListValue.Type);
                }
            }

            //Get the AutoNumber of each Field
            AutoNumber autoNumber = field.AutoNumber;

            //Check if formula is not null
            if (autoNumber != null)
            {
                //Get the Prefix of the AutoNumber
                Console.WriteLine("Field AutoNumber Prefix: " + autoNumber.Prefix);

                //Get the Suffix of the AutoNumber
                Console.WriteLine("Field AutoNumber Suffix: " + autoNumber.Suffix);

                if (autoNumber.StartNumber != null)
                {
                    //Get the StartNumber of the AutoNumber
                    Console.WriteLine("Field AutoNumber StartNumber: " + autoNumber.StartNumber);
                }
            }

            if (field.DefaultValue != null)
            {
                //Get the DefaultValue of each Field
                Console.WriteLine("Field DefaultValue: " + field.DefaultValue);
            }

            if (field.SectionId != null)
            {
                //Get the SectionId of each Field
                Console.WriteLine("Field SectionId: " + field.SectionId);
            }

            //Check if ValidationRule is not null
            if (field.ValidationRule != null)
            {
                //Get the details map
                foreach (KeyValuePair <string, object> entry in field.ValidationRule)
                {
                    //Get each value in the map
                    Console.WriteLine(entry.Key + ": " + JsonConvert.SerializeObject(entry.Value));
                }
            }

            //Check if ConvertMapping is not null
            if (field.ConvertMapping != null)
            {
                //Get the details map
                foreach (KeyValuePair <string, object> entry in field.ConvertMapping)
                {
                    //Get each value in the map
                    Console.WriteLine(entry.Key + ": " + JsonConvert.SerializeObject(entry.Value));
                }
            }
        }
Beispiel #40
0
 public IType Eval(Unique unique, IType type)
 {
     return new TAbs(mUnique, mType.Eval(unique, type));
 }
Beispiel #41
0
 public override void Dispose()
 {
     text.Dispose();
     main.Resources.RemoveResourcesForId(Unique.ToString());
 }
Beispiel #42
0
 public IType Replace(Unique unique, IType type)
 {
     return new TAbs(mUnique, mType.Replace(unique, type));
 }
Beispiel #43
0
 public static string GetUniqueName(string baseType)
 {
     return(string.Format("{0}-{1}", baseType, Unique.String()));
 }