Inheritance: MonoBehaviour
Example #1
0
 public void SetUp()
 {
     _stub = new Stub { Int = 10, Str = "Str", Collection = new List<int> { 1, 2, 3 }, Array = new byte[10] };
     _newStub = new Stub { Collection = new List<int> { 11, 12, 13 } };
     _meta = new Meta { Int = 10, Str = "Str", Collection = new List<int> { 1, 2, 3 }, Array = new byte[10] };
     _helper = new EditorHelper();
 }
Example #2
0
 public void ItemTest()
 {
     var i = new Meta();
     i["Key"] = "Value";
     i["Key2"] = "Value2";
     Assert.AreEqual("Value", i["Key"]);
     Assert.AreEqual("Value2", i["Key2"]);
 }
Example #3
0
 public void ChessGameFromFEN()
 {
     const string fenString = "rnbqkbnr/pppppppp/8/8/8/3P4/PPP1PPPP/RNBQKBNR w KQkq - 0 1";
     var i = new Meta();
     i["FEN"] = fenString;
     var g = new ChessGame(i);
     Assert.AreEqual(fenString, g.State.ToString());
 }
 public void HandleCommand(IStore store, Meta.BSon.BSonDoc command)
 {
     if (command.HasProperty(CommandKeyword.Collection))
       {
     var cc = store.GetCollection((command[CommandKeyword.Collection] ?? string.Empty).ToString());
     if (cc != null)
       cc.Flush();
       }
 }
Example #5
0
        public ChessGame(Meta metainfo)
        {
            Info = metainfo;

            Players.Add(new Player(1));
            Players.Add(new Player(2));

            State = new FENParser().Parse(
                (Info["FEN"] == null) || (Info["FEN"].Equals("")) ? FENParser.DefaultFEN : Info["FEN"],
                 Players);
        }
Example #6
0
        private bool AccionGuardar()
        {
            if (!this.Validar())
                return false;

            Cargando.Mostrar();
            int iSucursalID = Util.Entero(this.cmbSucursal.SelectedValue);

            // Se guardan las metas específicas
            Meta oMeta;
            foreach (DataGridViewRow oFila in this.dgvEspecificas.Rows)
            {
                if (oFila.IsNewRow) continue;

                int iMetaID = Util.Entero(oFila.Cells["mesMetaID"].Value);
                int iCambio = Util.Entero(oFila.Cells["mesCambio"].Value);
                switch (iCambio)
                {
                    case Cat.TiposDeAfectacion.Agregar:
                    case Cat.TiposDeAfectacion.Modificar:
                        if (iCambio == Cat.TiposDeAfectacion.Agregar)
                            oMeta = new Meta() { SucursalID = iSucursalID };
                        else
                            oMeta = Datos.GetEntity<Meta>(c => c.MetaID == iMetaID);
                        oMeta.VendedorID = (Util.Entero(oFila.Cells["mesUsuarioID"].Value) > 0 ?
                            (int?)Util.Entero(oFila.Cells["mesUsuarioID"].Value) : null);
                        oMeta.MarcaParteID = (Util.Entero(oFila.Cells["mesMarcaID"].Value) > 0 ?
                            (int?)Util.Entero(oFila.Cells["mesMarcaID"].Value): null);
                        oMeta.LineaID = (Util.Entero(oFila.Cells["mesLineaID"].Value) > 0 ?
                            (int?)Util.Entero(oFila.Cells["mesLineaID"].Value) : null);
                        oMeta.ParteID = (Util.Entero(oFila.Cells["mesParteID"].Value) > 0 ?
                            (int?)Util.Entero(oFila.Cells["mesParteID"].Value) : null);
                        oMeta.NombreMeta = Util.Cadena(oFila.Cells["mesNombre"].Value);
                        oMeta.Cantidad = Util.Decimal(oFila.Cells["mesCantidad"].Value);
                        oMeta.RutaImagen = Util.Cadena(oFila.Cells["mesRutaImagen"].Value);
                        Datos.Guardar<Meta>(oMeta);
                        break;
                    case Cat.TiposDeAfectacion.Borrar:
                        oMeta = Datos.GetEntity<Meta>(c => c.MetaID == iMetaID);
                        Datos.Eliminar<Meta>(oMeta);
                        break;
                }
            }

            Cargando.Cerrar();
            this.CargarDatos();
            return true;
        }
        /// <summary>
        /// Create parametter grid from meta.ParameterDefaultValues
        /// </summary>
        /// <param name="meta"></param>
        protected void SetPara(Meta meta)
        {
            this.ShowMessage("");

            this.myMeta = meta;
            paramGrid.Rows.Clear();
            string[] keys = meta.ParameterList.Keys;
            object[] values = meta.ParameterList.Values;
            for (int idx = 0; idx < keys.Length; idx++)
            {
                paramGrid.Rows.Add(keys[idx],values[idx]);
            }
            valueColumn.DefaultCellStyle.Format = "N" + meta.ParameterPrecision.ToString();
            paraDescEd.Text = common.system.ToString(meta.ParameterDescriptions);
            hintTextEd.Text = meta.Description + common.Consts.constCRLF + meta.URL;
        }
        public void HandleCommand(IStore store, Meta.BSon.BSonDoc command)
        {
            BSonDoc value = null;
              var collection = string.Empty;

              if (command.HasProperty(CommandKeyword.Value))
              {
            value = command[CommandKeyword.Value] as BSonDoc;
              }
              if (command.HasProperty(CommandKeyword.Collection))
              {
            collection = (command[CommandKeyword.Collection] ?? string.Empty).ToString();
              }

              OnHandle(store, collection, command, value);
        }
Example #9
0
            public void AlternateViewStartPath()
            {
                // Given
                Engine engine = new Engine();
                engine.RootFolder = TestContext.CurrentContext.TestDirectory;
                engine.InputFolder = @"TestFiles\Input\";
                ReadFiles readFiles = new ReadFiles(@"AlternateViewStartPath\Test.cshtml");
                Razor razor = new Razor().WithViewStart(@"AlternateViewStart\_ViewStart.cshtml");
                Meta meta = new Meta("Content", (x, y) => x.Content);
                engine.Pipelines.Add("Pipeline", readFiles, razor, meta);

                // When
                engine.Execute();

                // Then
                Assert.AreEqual(1, engine.Documents.FromPipeline("Pipeline").Count());
                Assert.AreEqual("LAYOUT\r\n<p>This is a test</p>", engine.Documents.FromPipeline("Pipeline").First().String("Content"));
            }
        public static void RunWithSqlServer(IEnumerable<RecordBlueprint> recordDescriptors, Action<ISessionFactory> action)
        {
            var temporaryPath = Path.GetTempFileName();
            if (File.Exists(temporaryPath))
                File.Delete(temporaryPath);
            Directory.CreateDirectory(temporaryPath);
            var databasePath = Path.Combine(temporaryPath, "Coevery.mdf");
            var databaseName = Path.GetFileNameWithoutExtension(databasePath);
            try {
                // create database
                if (!TryCreateSqlServerDatabase(databasePath, databaseName))
                    return;

                var meta = new Meta<CreateDataServicesProvider>((dataFolder, connectionString) =>
                    new SqlServerDataServicesProvider(dataFolder, connectionString),
                    new Dictionary<string, object> { { "ProviderName", "SqlServer" } });

                var manager = (IDataServicesProviderFactory)new DataServicesProviderFactory(new[] { meta });

                var parameters = new SessionFactoryParameters {
                    Provider = "SqlServer",
                    DataFolder = temporaryPath,
                    ConnectionString = "Data Source=.\\SQLEXPRESS;AttachDbFileName=" + databasePath + ";Integrated Security=True;User Instance=True;",
                    RecordDescriptors = recordDescriptors,
                };

                var configuration = manager
                    .CreateProvider(parameters)
                    .BuildConfiguration(parameters);

                new SchemaExport(configuration).Execute(false, true, false);

                using (var sessionFactory = configuration.BuildSessionFactory()) {
                    action(sessionFactory);
                }
            }
            finally {
                try {
                    Directory.Delete(temporaryPath, true);
                }
                catch (IOException) { }
            }
        }
Example #11
0
 public string MetaEmString(Meta meta)
 {
     if (meta == Meta.GANHAR_2KG)
         return "Ganhar 2kg/semana";
     else if (meta == Meta.GANHAR_1_5KG)
         return "Ganhar 1.5kg/semana";
     else if (meta == Meta.GANHAR_1KG)
         return "Ganhar 1kg/semana";
     else if (meta == Meta.GANHAR_0_5KG)
         return "Ganhar 0.5kg/semana";
     else if (meta == Meta.MANTER)
         return "Manter peso";
     else if (meta == Meta.PERDER_0_5KG)
         return "Perder 0.5kg/semana";
     else if (meta == Meta.PERDER_1KG)
         return "Perder 1kg/semana";
     else if (meta == Meta.PERDER_1_5KG)
         return "Perder 1.5kg/semana";
     else if (meta == Meta.PERDER_2KG)
         return "Perder 2.0kg/semana";
     else
         throw new NotImplementedException();
 }
Example #12
0
 public double MetaEmDouble(Meta meta)
 {
     if (meta == Meta.GANHAR_2KG)
         return 2;
     else if (meta == Meta.GANHAR_1_5KG)
         return 1.5;
     else if (meta == Meta.GANHAR_1KG)
         return 1;
     else if (meta == Meta.GANHAR_0_5KG)
         return 0.5;
     else if (meta == Meta.MANTER)
         return 0;
     else if (meta == Meta.PERDER_0_5KG)
         return -0.5;
     else if (meta == Meta.PERDER_1KG)
         return 1;
     else if (meta == Meta.PERDER_1_5KG)
         return -1.5;
     else if (meta == Meta.PERDER_2KG)
         return -2;
     else
         throw new NotImplementedException();
 }
Example #13
0
        public Buffer(Meta.File _file, UndoStack _undo, UndoStack _redo)
            : base(tags)
        {
            /**
             * Prepare for undo/redo.
             */
            UndoStack = _undo;
            RedoStack = _redo;
            UndoStack.Applied.Add(e => RedoStack.Push(e.Invert()));
            RedoStack.Applied.Add(e => UndoStack.Push(e.Invert()));

            /**
             * Read the file.
             */
            File = _file;
            var input = File.Info.OpenText();
            IgnoreChanges(() => InsertAtCursor(input.ReadToEnd()));
            input.Close();
            PlaceCursor(GetIterAtOffset(0));
            Changed += (o, a) =>
            {
                HasUnsavedChanges.Value = true;
            };
        }
 public void Callback(object value, Meta.TypeModel.CallbackType callbackType, SerializationContext context){}
Example #15
0
        public bool Equals([AllowNull] TreeMap other)
        {
            if (other == null)
            {
                return(false);
            }

            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return((Type == other.Type && Type != null && other.Type != null && Type.Equals(other.Type)) &&
                   (Visible == other.Visible && Visible != null && other.Visible != null && Visible.Equals(other.Visible)) &&
                   (Opacity == other.Opacity && Opacity != null && other.Opacity != null && Opacity.Equals(other.Opacity)) &&
                   (Name == other.Name && Name != null && other.Name != null && Name.Equals(other.Name)) &&
                   (UId == other.UId && UId != null && other.UId != null && UId.Equals(other.UId)) &&
                   (Equals(Ids, other.Ids) || Ids != null && other.Ids != null && Ids.SequenceEqual(other.Ids)) &&
                   (Equals(CustomData, other.CustomData) || CustomData != null && other.CustomData != null && CustomData.SequenceEqual(other.CustomData)) &&
                   (Meta == other.Meta && Meta != null && other.Meta != null && Meta.Equals(other.Meta)) &&
                   (Equals(MetaArray, other.MetaArray) || MetaArray != null && other.MetaArray != null && MetaArray.SequenceEqual(other.MetaArray)) &&
                   (HoverLabel == other.HoverLabel && HoverLabel != null && other.HoverLabel != null && HoverLabel.Equals(other.HoverLabel)) &&
                   (Stream == other.Stream && Stream != null && other.Stream != null && Stream.Equals(other.Stream)) &&
                   (Equals(Transforms, other.Transforms) || Transforms != null && other.Transforms != null && Transforms.SequenceEqual(other.Transforms)) &&
                   (UiRevision == other.UiRevision && UiRevision != null && other.UiRevision != null && UiRevision.Equals(other.UiRevision)) &&
                   (Equals(Labels, other.Labels) || Labels != null && other.Labels != null && Labels.SequenceEqual(other.Labels)) &&
                   (Equals(Parents, other.Parents) || Parents != null && other.Parents != null && Parents.SequenceEqual(other.Parents)) &&
                   (Equals(Values, other.Values) || Values != null && other.Values != null && Values.SequenceEqual(other.Values)) &&
                   (BranchValues == other.BranchValues && BranchValues != null && other.BranchValues != null && BranchValues.Equals(other.BranchValues)) &&
                   (Count == other.Count && Count != null && other.Count != null && Count.Equals(other.Count)) &&
                   (Level == other.Level && Level != null && other.Level != null && Level.Equals(other.Level)) &&
                   (MaxDepth == other.MaxDepth && MaxDepth != null && other.MaxDepth != null && MaxDepth.Equals(other.MaxDepth)) &&
                   (Tiling == other.Tiling && Tiling != null && other.Tiling != null && Tiling.Equals(other.Tiling)) &&
                   (Marker == other.Marker && Marker != null && other.Marker != null && Marker.Equals(other.Marker)) &&
                   (PathBar == other.PathBar && PathBar != null && other.PathBar != null && PathBar.Equals(other.PathBar)) &&
                   (Equals(Text, other.Text) || Text != null && other.Text != null && Text.SequenceEqual(other.Text)) &&
                   (TextInfo == other.TextInfo && TextInfo != null && other.TextInfo != null && TextInfo.Equals(other.TextInfo)) &&
                   (TextTemplate == other.TextTemplate && TextTemplate != null && other.TextTemplate != null && TextTemplate.Equals(other.TextTemplate)) &&
                   (Equals(TextTemplateArray, other.TextTemplateArray) || TextTemplateArray != null && other.TextTemplateArray != null && TextTemplateArray.SequenceEqual(other.TextTemplateArray)) &&
                   (HoverText == other.HoverText && HoverText != null && other.HoverText != null && HoverText.Equals(other.HoverText)) &&
                   (Equals(HoverTextArray, other.HoverTextArray) || HoverTextArray != null && other.HoverTextArray != null && HoverTextArray.SequenceEqual(other.HoverTextArray)) &&
                   (HoverInfo == other.HoverInfo && HoverInfo != null && other.HoverInfo != null && HoverInfo.Equals(other.HoverInfo)) &&
                   (Equals(HoverInfoArray, other.HoverInfoArray) || HoverInfoArray != null && other.HoverInfoArray != null && HoverInfoArray.SequenceEqual(other.HoverInfoArray)) &&
                   (HoverTemplate == other.HoverTemplate && HoverTemplate != null && other.HoverTemplate != null && HoverTemplate.Equals(other.HoverTemplate)) &&
                   (Equals(HoverTemplateArray, other.HoverTemplateArray) ||
                    HoverTemplateArray != null && other.HoverTemplateArray != null && HoverTemplateArray.SequenceEqual(other.HoverTemplateArray)) &&
                   (TextFont == other.TextFont && TextFont != null && other.TextFont != null && TextFont.Equals(other.TextFont)) &&
                   (InsideTextFont == other.InsideTextFont && InsideTextFont != null && other.InsideTextFont != null && InsideTextFont.Equals(other.InsideTextFont)) &&
                   (OutsideTextFont == other.OutsideTextFont && OutsideTextFont != null && other.OutsideTextFont != null && OutsideTextFont.Equals(other.OutsideTextFont)) &&
                   (TextPosition == other.TextPosition && TextPosition != null && other.TextPosition != null && TextPosition.Equals(other.TextPosition)) &&
                   (Domain == other.Domain && Domain != null && other.Domain != null && Domain.Equals(other.Domain)) &&
                   (IdsSrc == other.IdsSrc && IdsSrc != null && other.IdsSrc != null && IdsSrc.Equals(other.IdsSrc)) &&
                   (CustomDataSrc == other.CustomDataSrc && CustomDataSrc != null && other.CustomDataSrc != null && CustomDataSrc.Equals(other.CustomDataSrc)) &&
                   (MetaSrc == other.MetaSrc && MetaSrc != null && other.MetaSrc != null && MetaSrc.Equals(other.MetaSrc)) &&
                   (LabelsSrc == other.LabelsSrc && LabelsSrc != null && other.LabelsSrc != null && LabelsSrc.Equals(other.LabelsSrc)) &&
                   (ParentsSrc == other.ParentsSrc && ParentsSrc != null && other.ParentsSrc != null && ParentsSrc.Equals(other.ParentsSrc)) &&
                   (ValuesSrc == other.ValuesSrc && ValuesSrc != null && other.ValuesSrc != null && ValuesSrc.Equals(other.ValuesSrc)) &&
                   (TextSrc == other.TextSrc && TextSrc != null && other.TextSrc != null && TextSrc.Equals(other.TextSrc)) &&
                   (TextTemplateSrc == other.TextTemplateSrc && TextTemplateSrc != null && other.TextTemplateSrc != null && TextTemplateSrc.Equals(other.TextTemplateSrc)) &&
                   (HoverTextSrc == other.HoverTextSrc && HoverTextSrc != null && other.HoverTextSrc != null && HoverTextSrc.Equals(other.HoverTextSrc)) &&
                   (HoverInfoSrc == other.HoverInfoSrc && HoverInfoSrc != null && other.HoverInfoSrc != null && HoverInfoSrc.Equals(other.HoverInfoSrc)) &&
                   (HoverTemplateSrc == other.HoverTemplateSrc && HoverTemplateSrc != null && other.HoverTemplateSrc != null && HoverTemplateSrc.Equals(other.HoverTemplateSrc)));
        }
Example #16
0
        public override int GetHashCode()
        {
            unchecked // Overflow is fine, just wrap
            {
                int hashCode = 41;

                if (Type != null)
                {
                    hashCode = hashCode * 59 + Type.GetHashCode();
                }

                if (Visible != null)
                {
                    hashCode = hashCode * 59 + Visible.GetHashCode();
                }

                if (ShowLegend != null)
                {
                    hashCode = hashCode * 59 + ShowLegend.GetHashCode();
                }

                if (LegendGroup != null)
                {
                    hashCode = hashCode * 59 + LegendGroup.GetHashCode();
                }

                if (Opacity != null)
                {
                    hashCode = hashCode * 59 + Opacity.GetHashCode();
                }

                if (Name != null)
                {
                    hashCode = hashCode * 59 + Name.GetHashCode();
                }

                if (UId != null)
                {
                    hashCode = hashCode * 59 + UId.GetHashCode();
                }

                if (Ids != null)
                {
                    hashCode = hashCode * 59 + Ids.GetHashCode();
                }

                if (CustomData != null)
                {
                    hashCode = hashCode * 59 + CustomData.GetHashCode();
                }

                if (Meta != null)
                {
                    hashCode = hashCode * 59 + Meta.GetHashCode();
                }

                if (MetaArray != null)
                {
                    hashCode = hashCode * 59 + MetaArray.GetHashCode();
                }

                if (SelectedPoints != null)
                {
                    hashCode = hashCode * 59 + SelectedPoints.GetHashCode();
                }

                if (HoverInfo != null)
                {
                    hashCode = hashCode * 59 + HoverInfo.GetHashCode();
                }

                if (HoverInfoArray != null)
                {
                    hashCode = hashCode * 59 + HoverInfoArray.GetHashCode();
                }

                if (HoverLabel != null)
                {
                    hashCode = hashCode * 59 + HoverLabel.GetHashCode();
                }

                if (Stream != null)
                {
                    hashCode = hashCode * 59 + Stream.GetHashCode();
                }

                if (Transforms != null)
                {
                    hashCode = hashCode * 59 + Transforms.GetHashCode();
                }

                if (UiRevision != null)
                {
                    hashCode = hashCode * 59 + UiRevision.GetHashCode();
                }

                if (X != null)
                {
                    hashCode = hashCode * 59 + X.GetHashCode();
                }

                if (Y != null)
                {
                    hashCode = hashCode * 59 + Y.GetHashCode();
                }

                if (Text != null)
                {
                    hashCode = hashCode * 59 + Text.GetHashCode();
                }

                if (TextArray != null)
                {
                    hashCode = hashCode * 59 + TextArray.GetHashCode();
                }

                if (HoverText != null)
                {
                    hashCode = hashCode * 59 + HoverText.GetHashCode();
                }

                if (HoverTextArray != null)
                {
                    hashCode = hashCode * 59 + HoverTextArray.GetHashCode();
                }

                if (Orientation != null)
                {
                    hashCode = hashCode * 59 + Orientation.GetHashCode();
                }

                if (HistFunc != null)
                {
                    hashCode = hashCode * 59 + HistFunc.GetHashCode();
                }

                if (HistNorm != null)
                {
                    hashCode = hashCode * 59 + HistNorm.GetHashCode();
                }

                if (Cumulative != null)
                {
                    hashCode = hashCode * 59 + Cumulative.GetHashCode();
                }

                if (NBinsX != null)
                {
                    hashCode = hashCode * 59 + NBinsX.GetHashCode();
                }

                if (XBins != null)
                {
                    hashCode = hashCode * 59 + XBins.GetHashCode();
                }

                if (NBinsY != null)
                {
                    hashCode = hashCode * 59 + NBinsY.GetHashCode();
                }

                if (YBins != null)
                {
                    hashCode = hashCode * 59 + YBins.GetHashCode();
                }

                if (AutoBinX != null)
                {
                    hashCode = hashCode * 59 + AutoBinX.GetHashCode();
                }

                if (AutoBinY != null)
                {
                    hashCode = hashCode * 59 + AutoBinY.GetHashCode();
                }

                if (BinGroup != null)
                {
                    hashCode = hashCode * 59 + BinGroup.GetHashCode();
                }

                if (HoverTemplate != null)
                {
                    hashCode = hashCode * 59 + HoverTemplate.GetHashCode();
                }

                if (HoverTemplateArray != null)
                {
                    hashCode = hashCode * 59 + HoverTemplateArray.GetHashCode();
                }

                if (Marker != null)
                {
                    hashCode = hashCode * 59 + Marker.GetHashCode();
                }

                if (OffsetGroup != null)
                {
                    hashCode = hashCode * 59 + OffsetGroup.GetHashCode();
                }

                if (AlignmentGroup != null)
                {
                    hashCode = hashCode * 59 + AlignmentGroup.GetHashCode();
                }

                if (Selected != null)
                {
                    hashCode = hashCode * 59 + Selected.GetHashCode();
                }

                if (Unselected != null)
                {
                    hashCode = hashCode * 59 + Unselected.GetHashCode();
                }

                if (ErrorX != null)
                {
                    hashCode = hashCode * 59 + ErrorX.GetHashCode();
                }

                if (ErrorY != null)
                {
                    hashCode = hashCode * 59 + ErrorY.GetHashCode();
                }

                if (XCalendar != null)
                {
                    hashCode = hashCode * 59 + XCalendar.GetHashCode();
                }

                if (YCalendar != null)
                {
                    hashCode = hashCode * 59 + YCalendar.GetHashCode();
                }

                if (XAxis != null)
                {
                    hashCode = hashCode * 59 + XAxis.GetHashCode();
                }

                if (YAxis != null)
                {
                    hashCode = hashCode * 59 + YAxis.GetHashCode();
                }

                if (IdsSrc != null)
                {
                    hashCode = hashCode * 59 + IdsSrc.GetHashCode();
                }

                if (CustomDataSrc != null)
                {
                    hashCode = hashCode * 59 + CustomDataSrc.GetHashCode();
                }

                if (MetaSrc != null)
                {
                    hashCode = hashCode * 59 + MetaSrc.GetHashCode();
                }

                if (HoverInfoSrc != null)
                {
                    hashCode = hashCode * 59 + HoverInfoSrc.GetHashCode();
                }

                if (XSrc != null)
                {
                    hashCode = hashCode * 59 + XSrc.GetHashCode();
                }

                if (YSrc != null)
                {
                    hashCode = hashCode * 59 + YSrc.GetHashCode();
                }

                if (TextSrc != null)
                {
                    hashCode = hashCode * 59 + TextSrc.GetHashCode();
                }

                if (HoverTextSrc != null)
                {
                    hashCode = hashCode * 59 + HoverTextSrc.GetHashCode();
                }

                if (HoverTemplateSrc != null)
                {
                    hashCode = hashCode * 59 + HoverTemplateSrc.GetHashCode();
                }

                return(hashCode);
            }
        }
Example #17
0
 public static Ice.DispatchStatus newServer___(Meta obj__, IceInternal.Incoming inS__, Ice.Current current__)
 {
     checkMode__(Ice.OperationMode.Normal, current__.mode);
     inS__.istr().skipEmptyEncaps();
     AMD_Meta_newServer cb__ = new _AMD_Meta_newServer(inS__);
     try
     {
         obj__.newServer_async(cb__, current__);
     }
     catch(_System.Exception ex__)
     {
         cb__.ice_exception(ex__);
     }
     return Ice.DispatchStatus.DispatchAsync;
 }
Example #18
0
        protected override void ConfigMeta()
        {
            Meta.MapTable().MapAllProperties();

            Meta.EnableClientCache();
        }
Example #19
0
 public GetListDTO(IEnumerable <T> data)
 {
     Meta = new Meta();
     Data = data;
 }
Example #20
0
 /// <summary>
 /// 取得一个值的Sql值。
 /// 当这个值是字符串类型时,会在该值前后加单引号;
 /// </summary>
 /// <param name="name">字段</param>
 /// <param name="value">对象</param>
 /// <returns>Sql值的字符串形式</returns>
 public virtual String FormatValue(String name, Object value)
 {
     return(Meta.FormatValue(name, value));
 }
Example #21
0
        /// <summary>
        /// The save raw to file.
        /// </summary>
        /// <param name="outputFilePath">The output file path.</param>
        /// <param name="meta">The meta.</param>
        /// <remarks></remarks>
        public void SaveRawToFile(string outputFilePath, Meta.Meta meta)
        {
            int x = outputFilePath.LastIndexOf('.');
            string temp = outputFilePath.Substring(0, x + 1) + meta.type + "raw";

            if (meta.type == "snd!" &&
                (meta.Map.HaloVersion == HaloVersionEnum.Halo2 ||
                 meta.Map.HaloVersion == HaloVersionEnum.Halo2Vista))
            {
                Stream s = File.Open(temp + "layout", FileMode.Create);
                BinaryFormatter b = new BinaryFormatter();
                Sound temps = (Sound)meta.raw;
                b.Serialize(s, temps.Permutations);
                s.Flush();
                s.Close();
            }

            XmlTextWriter xtw = new XmlTextWriter(temp + ".xml", Encoding.Default);
            xtw.Formatting = Formatting.Indented;
            xtw.WriteStartElement("RawData");
            xtw.WriteAttributeString("TagType", meta.type);
            xtw.WriteAttributeString("TagName", meta.name);
            xtw.WriteAttributeString("RawType", meta.raw.containerType.ToString());
            xtw.WriteAttributeString("RawChunkCount", this.rawChunks.Count.ToString());
            xtw.WriteAttributeString("Date", DateTime.Today.ToShortDateString());
            xtw.WriteAttributeString("Time", DateTime.Now.ToShortTimeString());
            xtw.WriteAttributeString("EntityVersion", "0.1");

            BinaryWriter BW = new BinaryWriter(new FileStream(temp, FileMode.Create));
            int loc = 0;
            for (x = 0; x < this.rawChunks.Count; x++)
            {
                RawDataChunk r = this.rawChunks[x];
                if (r.offset == -1)
                {
                    continue;
                }

                xtw.WriteStartElement("RawChunk");
                xtw.WriteAttributeString("RawDataType", r.rawDataType.ToString());
                xtw.WriteAttributeString("PointerMetaOffset", r.pointerMetaOffset.ToString());
                xtw.WriteAttributeString("ChunkSize", r.size.ToString());
                xtw.WriteAttributeString("RawDataOffset", loc.ToString());
                xtw.WriteAttributeString("PointsToOffset", r.offset.ToString());
                xtw.WriteAttributeString("RawLocation", r.rawLocation.ToString());
                xtw.WriteEndElement();
                BW.BaseStream.Write(r.MS.ToArray(), 0, r.size);
                loc += r.size;
            }

            BW.Flush();
            BW.Close();
            xtw.WriteEndElement();
            xtw.Flush();
            xtw.Close();
        }
Example #22
0
 /// <inheritdoc />
 public override int GetHashCode()
 {
     unchecked // Overflow is fine, just wrap
     {
         var hashCode = 41;
         if (Type != null)
         {
             hashCode = hashCode * 59 + Type.GetHashCode();
         }
         if (Visible != null)
         {
             hashCode = hashCode * 59 + Visible.GetHashCode();
         }
         if (LegendGroup != null)
         {
             hashCode = hashCode * 59 + LegendGroup.GetHashCode();
         }
         if (Opacity != null)
         {
             hashCode = hashCode * 59 + Opacity.GetHashCode();
         }
         if (Name != null)
         {
             hashCode = hashCode * 59 + Name.GetHashCode();
         }
         if (UId != null)
         {
             hashCode = hashCode * 59 + UId.GetHashCode();
         }
         if (Ids != null)
         {
             hashCode = hashCode * 59 + Ids.GetHashCode();
         }
         if (CustomData != null)
         {
             hashCode = hashCode * 59 + CustomData.GetHashCode();
         }
         if (Meta != null)
         {
             hashCode = hashCode * 59 + Meta.GetHashCode();
         }
         if (MetaArray != null)
         {
             hashCode = hashCode * 59 + MetaArray.GetHashCode();
         }
         if (HoverLabel != null)
         {
             hashCode = hashCode * 59 + HoverLabel.GetHashCode();
         }
         if (Stream != null)
         {
             hashCode = hashCode * 59 + Stream.GetHashCode();
         }
         if (Transforms != null)
         {
             hashCode = hashCode * 59 + Transforms.GetHashCode();
         }
         if (UiRevision != null)
         {
             hashCode = hashCode * 59 + UiRevision.GetHashCode();
         }
         if (Lon != null)
         {
             hashCode = hashCode * 59 + Lon.GetHashCode();
         }
         if (Lat != null)
         {
             hashCode = hashCode * 59 + Lat.GetHashCode();
         }
         if (Z != null)
         {
             hashCode = hashCode * 59 + Z.GetHashCode();
         }
         if (Radius != null)
         {
             hashCode = hashCode * 59 + Radius.GetHashCode();
         }
         if (RadiusArray != null)
         {
             hashCode = hashCode * 59 + RadiusArray.GetHashCode();
         }
         if (Below != null)
         {
             hashCode = hashCode * 59 + Below.GetHashCode();
         }
         if (Text != null)
         {
             hashCode = hashCode * 59 + Text.GetHashCode();
         }
         if (TextArray != null)
         {
             hashCode = hashCode * 59 + TextArray.GetHashCode();
         }
         if (HoverText != null)
         {
             hashCode = hashCode * 59 + HoverText.GetHashCode();
         }
         if (HoverTextArray != null)
         {
             hashCode = hashCode * 59 + HoverTextArray.GetHashCode();
         }
         if (HoverInfo != null)
         {
             hashCode = hashCode * 59 + HoverInfo.GetHashCode();
         }
         if (HoverInfoArray != null)
         {
             hashCode = hashCode * 59 + HoverInfoArray.GetHashCode();
         }
         if (HoverTemplate != null)
         {
             hashCode = hashCode * 59 + HoverTemplate.GetHashCode();
         }
         if (HoverTemplateArray != null)
         {
             hashCode = hashCode * 59 + HoverTemplateArray.GetHashCode();
         }
         if (ShowLegend != null)
         {
             hashCode = hashCode * 59 + ShowLegend.GetHashCode();
         }
         if (ZAuto != null)
         {
             hashCode = hashCode * 59 + ZAuto.GetHashCode();
         }
         if (ZMin != null)
         {
             hashCode = hashCode * 59 + ZMin.GetHashCode();
         }
         if (ZMax != null)
         {
             hashCode = hashCode * 59 + ZMax.GetHashCode();
         }
         if (ZMid != null)
         {
             hashCode = hashCode * 59 + ZMid.GetHashCode();
         }
         if (ColorScale != null)
         {
             hashCode = hashCode * 59 + ColorScale.GetHashCode();
         }
         if (AutoColorScale != null)
         {
             hashCode = hashCode * 59 + AutoColorScale.GetHashCode();
         }
         if (ReverseScale != null)
         {
             hashCode = hashCode * 59 + ReverseScale.GetHashCode();
         }
         if (ShowScale != null)
         {
             hashCode = hashCode * 59 + ShowScale.GetHashCode();
         }
         if (ColorBar != null)
         {
             hashCode = hashCode * 59 + ColorBar.GetHashCode();
         }
         if (ColorAxis != null)
         {
             hashCode = hashCode * 59 + ColorAxis.GetHashCode();
         }
         if (Subplot != null)
         {
             hashCode = hashCode * 59 + Subplot.GetHashCode();
         }
         if (IdsSrc != null)
         {
             hashCode = hashCode * 59 + IdsSrc.GetHashCode();
         }
         if (CustomDataSrc != null)
         {
             hashCode = hashCode * 59 + CustomDataSrc.GetHashCode();
         }
         if (MetaSrc != null)
         {
             hashCode = hashCode * 59 + MetaSrc.GetHashCode();
         }
         if (LonSrc != null)
         {
             hashCode = hashCode * 59 + LonSrc.GetHashCode();
         }
         if (LatSrc != null)
         {
             hashCode = hashCode * 59 + LatSrc.GetHashCode();
         }
         if (ZSrc != null)
         {
             hashCode = hashCode * 59 + ZSrc.GetHashCode();
         }
         if (RadiusSrc != null)
         {
             hashCode = hashCode * 59 + RadiusSrc.GetHashCode();
         }
         if (TextSrc != null)
         {
             hashCode = hashCode * 59 + TextSrc.GetHashCode();
         }
         if (HoverTextSrc != null)
         {
             hashCode = hashCode * 59 + HoverTextSrc.GetHashCode();
         }
         if (HoverInfoSrc != null)
         {
             hashCode = hashCode * 59 + HoverInfoSrc.GetHashCode();
         }
         if (HoverTemplateSrc != null)
         {
             hashCode = hashCode * 59 + HoverTemplateSrc.GetHashCode();
         }
         return(hashCode);
     }
 }
Example #23
0
 /// <summary>格式化关键字</summary>
 /// <param name="name">名称</param>
 /// <returns></returns>
 public virtual String FormatName(String name)
 {
     return(Meta.FormatName(name));
 }
Example #24
0
        public void IniciarInicio()
        {
            SelecionarTipoRela.Items[0] = "Despesas";
            SelecionarTipoRela.Items[1] = "Ganhos";
            userLogado     = Usuario.RetornarDados(id);
            carteiraLogada = Carteira.InstanciarCarteira(userLogado.id);

            bem_vindo.Content = $"Bem Vindo(a), {userLogado.nome}";
            string dataAtual = $"{c.ToString("yyyy")}-{c.ToString("MM")}";

            ValorCarteira.Content = carteiraLogada.ConsultarSaldo().ToString();

            int d = int.Parse(c.ToString("MM"));

            MesCanvaDespesa.Content = $"{meses[d - 1]} / {c.ToString("yyyy")}";
            MesCanvaGanhos.Content  = $"{meses[d - 1]} / {c.ToString("yyyy")}";
            DespesaMes.Content      = Despesa.ValorTotalMes(c.ToString("yyyy"), c.ToString("MM"), carteiraLogada.id);
            GanhoMes.Content        = Receita.ValorTotalMes(c.ToString("yyyy"), c.ToString("MM"), carteiraLogada.id);

            ComboMesMeta.Items[0] = c.ToString("MM");
            string mes          = "";
            string mesAnterior  = "";
            string mesAnterior2 = "";
            string mesAtual     = "";

            if (c.Month <= 12 && c.Month > 0)
            {
                if (c.Month < 9)
                {
                    mesAtual = $"0{c.Month}";
                    mes      = $"0{c.Month + 1}";
                }
                else if (c.Month == 12)
                {
                    mes      = "01";
                    mesAtual = "12";
                }
                else
                {
                    mesAtual = $"{c.Month}";
                }

                if (c.Month > 2 && c.Month < 9)
                {
                    mesAnterior  = $"0{c.Month - 1}";
                    mesAnterior2 = $"0{c.Month - 2}";
                }
                else if (c.Month > 1 && c.Month < 9)
                {
                    mesAnterior  = $"0{c.Month - 1}";
                    mesAnterior2 = "12";
                }
                else if (c.Month == 1)
                {
                    mesAnterior  = "12";
                    mesAnterior2 = "11";
                }
                else if (c.Month == 10)
                {
                    mesAnterior  = $"0{c.Month - 1}";
                    mesAnterior2 = "08";
                }
                else if (c.Month == 11)
                {
                    mesAnterior  = $"0{c.Month - 1}";
                    mesAnterior2 = "09";
                }
                else
                {
                    mesAnterior  = $"{c.Month - 1}";
                    mesAnterior2 = $"{c.Month - 2}";
                }
            }

            metaAtual   = Meta.RetornarMeta(dataAtual, carteiraLogada.id);
            metaProximo = Meta.RetornarMeta($"{c.ToString("yyyy")}-{mes}", carteiraLogada.id);

            ComboMesMeta.Items[1] = mes;
            MesRela.Items[0]      = $"{mesAnterior2}";
            MesRela.Items[1]      = $"{mesAnterior}";
            MesRela.Items[2]      = $"{mesAtual}";

            //Atual
            DescricaoMeta1.Content = metaAtual.Descricao;
            lblAtual.Content       = $"{ metaAtual.ValorCumprido} R$/ { metaAtual.ValorDaMeta} R$";
            ProgressoAtual.Maximum = metaAtual.ValorDaMeta;
            ProgressoBarra(ProgressoAtual, metaAtual, PorcentagemAtual);
            MesMeta.Content = $"Meta de: {metaAtual.Data}";
            //Proxima
            DescricaoMeta2.Content   = metaProximo.Descricao;
            MetaMesProximo.Content   = $"{ metaProximo.ValorCumprido} R$/ { metaProximo.ValorDaMeta} R$";
            ProgressoProximo.Maximum = metaProximo.ValorDaMeta;
            ProgressoBarra(ProgressoProximo, metaProximo, PorcentagemProximo);
            lblProximo.Content = $"Meta de: {metaProximo.Data}";
        }
Example #25
0
 public static Parameters DeleteMeta(this FhirClient client, string location, Meta meta)
 {
     return(DeleteMeta(client, new Uri(location, UriKind.RelativeOrAbsolute), meta));
 }
Example #26
0
        public static Parameters DeleteMeta(this FhirClient client, Uri location, Meta meta)
        {
            var par = new Parameters().Add("meta", meta);

            return(expect <Parameters>(client.InstanceOperation(location, Operation.META_DELETE, par)));
        }
Example #27
0
 // PUBLIC METHODS ///////////////////////////////////////////////////
 #region IRelationshipsBuilder<TParentBuilder, TResource> Implementation
 public IRelationshipBuilder <TParentBuilder> SetMeta(Meta meta)
 {
     return(this);
 }
Example #28
0
 /// <summary>格式化数据为SQL数据</summary>
 /// <param name="field">字段</param>
 /// <param name="value">数值</param>
 /// <returns></returns>
 public virtual String FormatValue(FieldItem field, Object value)
 {
     return(Meta.FormatValue(field, value));
 }
Example #29
0
        //--- Class Contstructor ---
        static EncodingEx()
        {
            byte[] testBuf = new byte[0x7F];
            for(int i = 0; i < 0x7F; i++) {
                if(IsAsciiSupersetnessSensitive(i)) {
                    testBuf[i] = (byte)i;
                } else {
                    testBuf[i] = 0x20;
                }
            }

            foreach(var info in Encoding.GetEncodings()) {
                var encoding = info.GetEncoding();
                String name = NormalizeName(encoding.WebName);
                String canonicalName = encoding.WebName.ToLowerInvariant();
                if(!IsBanned(name)) {
                    var asciiSuperset = AsciiMapsToBasicLatin(testBuf, encoding);
                    var meta = new Meta {
                        CanonicalName = canonicalName,
                        Encoding = encoding,
                        AsciiSuperset = asciiSuperset,
                        IsObscure = IsObscure(name),
                        IsShouldNot = IsShouldNot(name),
                        IsLikelyEbcdic = IsLikelyEbcdic(name, asciiSuperset)
                    };
                    _encodingMeta.Add(info.CodePage, meta);
                }
            }

            // Overwrite possible overlapping aliases with the real things--just in case
            foreach(var meta in _encodingMeta.Values) {
                _encodingByCanonicalName[NormalizeName(meta.CanonicalName)] = meta;
            }
            try {
                Find("iso-8859-1").ActualHtmlEncoding = Find("windows-1252");
            } catch { }
            try {
                Find("iso-8859-9").ActualHtmlEncoding = Find("windows-1254");
            } catch { }
            try {
                Find("iso-8859-11").ActualHtmlEncoding = Find("windows-874");
            } catch { }
            try {
                Find("x-iso-8859-11").ActualHtmlEncoding = Find("windows-874");
            } catch { }
            try {
                Find("tis-620").ActualHtmlEncoding = Find("windows-874");
            } catch { }
            try {
                Find("gb_2312-80").ActualHtmlEncoding = Find("gbk");
            } catch { }
            try {
                Find("gb2312").ActualHtmlEncoding = Find("gbk");
            } catch { }
            try {
                _encodingByCanonicalName[NormalizeName("x-x-big5")] = Find("big5");
            } catch { }
            try {
                _encodingByCanonicalName[NormalizeName("euc-kr")] = Find("windows-949");
            } catch { }
            try {
                _encodingByCanonicalName[NormalizeName("ks_c_5601-1987")] = Find("windows-949");
            } catch { }
        }
Example #30
0
 public override string GetName(int ordinal)
 {
     return(Meta.getColumnName(ConvertOrdnal(ordinal)));
 }
Example #31
0
            public void RenderLayoutSectionOnMultipleExecution()
            {
                // Given
                Engine engine = new Engine();
                engine.RootFolder = TestContext.CurrentContext.TestDirectory;
                engine.InputFolder = @"TestFiles\Input\";
                ReadFiles readFiles = new ReadFiles(@"LayoutWithSection\Test.cshtml");
                Razor razor = new Razor();
                Meta meta = new Meta("Content", (x, y) => x.Content);
                engine.Pipelines.Add("Pipeline", readFiles, razor, meta);

                // When
                engine.Execute();
                engine.Execute();

                // Then
                Assert.AreEqual(1, engine.Documents.FromPipeline("Pipeline").Count());
                Assert.AreEqual("LAYOUT\r\n\r\n<p>Section Content</p>\r\n\r\n\r\n<p>This is a test</p>", engine.Documents.FromPipeline("Pipeline").First().String("Content"));
            }
 protected string DecompileMeta()
 {
     return(Meta != null?Meta.Decompile() : String.Empty);
 }
Example #33
0
 protected override void ConfigMeta()
 {
     Meta.MapTable().MapAllProperties();
 }
Example #34
0
        internal bool ReadTableEntryCollection(Typeface typeface, RestoreTicket ticket, TableEntryCollection tables, BinaryReader input)
        {
            if (ticket != null)
            {
                return(ReadTableEntryCollectionOnRestoreMode(typeface, ticket, tables, input));
            }

            typeface.SetTableEntryCollection(tables.CloneTableHeaders());

            var rd = new EntriesReaderHelper(tables, input);
            //PART 1: basic information
            OS2Table          os2Table          = rd.Read(new OS2Table());
            Meta              meta              = rd.Read(new Meta());
            NameEntry         nameEntry         = rd.Read(new NameEntry());
            Head              head              = rd.Read(new Head());
            MaxProfile        maxProfile        = rd.Read(new MaxProfile());
            HorizontalHeader  horizontalHeader  = rd.Read(new HorizontalHeader());
            HorizontalMetrics horizontalMetrics = rd.Read(new HorizontalMetrics(horizontalHeader.NumberOfHMetrics, maxProfile.GlyphCount));
            VerticalHeader    vhea              = rd.Read(new VerticalHeader());

            if (vhea != null)
            {
                VerticalMetrics vmtx = rd.Read(new VerticalMetrics(vhea.NumOfLongVerMetrics));
            }

            Cmap cmaps = rd.Read(new Cmap());
            VerticalDeviceMetrics vdmx = rd.Read(new VerticalDeviceMetrics());
            Kern kern = rd.Read(new Kern());
            //------------------------------------
            //PART 2: glyphs detail
            //2.1 True type font

            GlyphLocations glyphLocations = rd.Read(new GlyphLocations(maxProfile.GlyphCount, head.WideGlyphLocations));
            Glyf           glyf           = rd.Read(new Glyf(glyphLocations));
            Gasp           gaspTable      = rd.Read(new Gasp());
            COLR           colr           = rd.Read(new COLR());
            CPAL           cpal           = rd.Read(new CPAL());

            //2.2 Cff font
            PostTable postTable = rd.Read(new PostTable());
            CFFTable  cff       = rd.Read(new CFFTable());

            //additional math table (if available)
            MathTable mathtable = rd.Read(new MathTable());
            //------------------------------------

            //PART 3: advanced typography
            GDEF gdef      = rd.Read(new GDEF());
            GSUB gsub      = rd.Read(new GSUB());
            GPOS gpos      = rd.Read(new GPOS());
            BASE baseTable = rd.Read(new BASE());
            JSTF jstf      = rd.Read(new JSTF());

            STAT stat = rd.Read(new STAT());

            if (stat != null)
            {
                //variable font
                FVar fvar = rd.Read(new FVar());
                if (fvar != null)
                {
                    GVar gvar = rd.Read(new GVar());
                    CVar cvar = rd.Read(new CVar());
                    HVar hvar = rd.Read(new HVar());
                    MVar mvar = rd.Read(new MVar());
                    AVar avar = rd.Read(new AVar());
                }
            }

            bool isPostScriptOutline = false;
            bool isBitmapFont        = false;

            typeface.SetBasicTypefaceTables(os2Table, nameEntry, head, horizontalMetrics);
            if (glyf == null)
            {
                //check if this is cff table ?
                if (cff == null)
                {
                    //check  cbdt/cblc ?
                    CBLC cblcTable = rd.Read(new CBLC());
                    if (cblcTable != null)
                    {
                        CBDT cbdtTable = rd.Read(new CBDT());
                        //read cbdt
                        //bitmap font

                        BitmapFontGlyphSource bmpFontGlyphSrc = new BitmapFontGlyphSource(cblcTable);
                        bmpFontGlyphSrc.LoadCBDT(cbdtTable);
                        Glyph[] glyphs = bmpFontGlyphSrc.BuildGlyphList();
                        typeface.SetBitmapGlyphs(glyphs, bmpFontGlyphSrc);
                        isBitmapFont = true;
                    }
                    else
                    {
                        //TODO:
                        EBLC fontBmpTable = rd.Read(new EBLC());
                        throw new NotSupportedException();
                    }
                }
                else
                {
                    isPostScriptOutline = true;
                    typeface.SetCffFontSet(cff.Cff1FontSet);
                }
            }
            else
            {
                typeface.SetTtfGlyphs(glyf.Glyphs);
            }

            //----------------------------
            typeface.CmapTable  = cmaps;
            typeface.KernTable  = kern;
            typeface.MaxProfile = maxProfile;
            typeface.HheaTable  = horizontalHeader;
            //----------------------------
            typeface.GaspTable = gaspTable;

            if (!isPostScriptOutline && !isBitmapFont)
            {
                //for true-type font outline
                FpgmTable fpgmTable = rd.Read(new FpgmTable());
                //control values table
                CvtTable  cvtTable         = rd.Read(new CvtTable());
                PrepTable propProgramTable = rd.Read(new PrepTable());

                typeface.ControlValues     = cvtTable?._controlValues;
                typeface.FpgmProgramBuffer = fpgmTable?._programBuffer;
                typeface.PrepProgramBuffer = propProgramTable?._programBuffer;
            }

            //-------------------------
            typeface.LoadOpenFontLayoutInfo(
                gdef,
                gsub,
                gpos,
                baseTable,
                colr,
                cpal);
            //------------

            typeface.SetSvgTable(rd.Read(new SvgTable()));
            typeface.PostTable = postTable;

            if (mathtable != null)
            {
                MathGlyphLoader.LoadMathGlyph(typeface, mathtable);
            }
#if DEBUG
            //test
            //int found = typeface.GetGlyphIndexByName("Uacute");
            if (typeface.IsCffFont)
            {
                //optional
                typeface.UpdateAllCffGlyphBounds();
            }
#endif
            typeface.UpdateLangs(meta);
            typeface.UpdateFrequentlyUsedValues();
            return(true);
        }
Example #35
0
 /// <summary>
 /// 配置实体的元数据
 /// </summary>
 protected override void ConfigMeta()
 {
     //配置实体的所有属性都映射到数据表中。
     Meta.MapTable().MapAllProperties();
 }
Example #36
0
        /// <summary>
        /// Upgrade an installed module
        /// </summary>
        /// <param name="ksp">Game instance from which to remove</param>
        /// <param name="raw_options">Command line options object</param>
        /// <returns>
        /// Exit code for shell environment
        /// </returns>
        public int RunCommand(CKAN.KSP ksp, object raw_options)
        {
            UpgradeOptions options = (UpgradeOptions)raw_options;

            if (options.ckan_file != null)
            {
                options.modules.Add(MainClass.LoadCkanFromFile(ksp, options.ckan_file).identifier);
            }

            if (options.modules.Count == 0 && !options.upgrade_all)
            {
                // What? No files specified?
                User.RaiseMessage("Usage: ckan upgrade Mod [Mod2, ...]");
                User.RaiseMessage("  or   ckan upgrade --all");
                if (AutoUpdate.CanUpdate)
                {
                    User.RaiseMessage("  or   ckan upgrade ckan");
                }
                return(Exit.BADOPT);
            }

            if (!options.upgrade_all && options.modules[0] == "ckan" && AutoUpdate.CanUpdate)
            {
                User.RaiseMessage("Querying the latest CKAN version");
                AutoUpdate.Instance.FetchLatestReleaseInfo();
                var latestVersion  = AutoUpdate.Instance.latestUpdate.Version;
                var currentVersion = new ModuleVersion(Meta.GetVersion(VersionFormat.Short));

                if (latestVersion.IsGreaterThan(currentVersion))
                {
                    User.RaiseMessage("New CKAN version available - " + latestVersion);
                    var releaseNotes = AutoUpdate.Instance.latestUpdate.ReleaseNotes;
                    User.RaiseMessage(releaseNotes);
                    User.RaiseMessage("\r\n");

                    if (User.RaiseYesNoDialog("Proceed with install?"))
                    {
                        User.RaiseMessage("Upgrading CKAN, please wait..");
                        AutoUpdate.Instance.StartUpdateProcess(false);
                    }
                }
                else
                {
                    User.RaiseMessage("You already have the latest version.");
                }

                return(Exit.OK);
            }

            User.RaiseMessage("\r\nUpgrading modules...\r\n");

            try
            {
                HashSet <string> possibleConfigOnlyDirs = null;
                var regMgr   = RegistryManager.Instance(ksp);
                var registry = regMgr.registry;
                if (options.upgrade_all)
                {
                    var installed  = new Dictionary <string, ModuleVersion>(registry.Installed());
                    var to_upgrade = new List <CkanModule>();

                    foreach (KeyValuePair <string, ModuleVersion> mod in installed)
                    {
                        ModuleVersion current_version = mod.Value;

                        if ((current_version is ProvidesModuleVersion) || (current_version is UnmanagedModuleVersion))
                        {
                            continue;
                        }
                        else
                        {
                            try
                            {
                                // Check if upgrades are available
                                var latest = registry.LatestAvailable(mod.Key, ksp.VersionCriteria());

                                // This may be an unindexed mod. If so,
                                // skip rather than crash. See KSP-CKAN/CKAN#841.
                                if (latest == null || latest.IsDLC)
                                {
                                    continue;
                                }

                                if (latest.version.IsGreaterThan(mod.Value))
                                {
                                    // Upgradable
                                    log.InfoFormat("New version {0} found for {1}",
                                                   latest.version, latest.identifier);
                                    to_upgrade.Add(latest);
                                }
                            }
                            catch (ModuleNotFoundKraken)
                            {
                                log.InfoFormat("{0} is installed, but no longer in the registry",
                                               mod.Key);
                            }
                        }
                    }

                    ModuleInstaller.GetInstance(ksp, manager.Cache, User).Upgrade(to_upgrade, new NetAsyncModulesDownloader(User, manager.Cache), ref possibleConfigOnlyDirs, regMgr);
                }
                else
                {
                    // TODO: These instances all need to go.
                    Search.AdjustModulesCase(ksp, options.modules);
                    ModuleInstaller.GetInstance(ksp, manager.Cache, User).Upgrade(options.modules, new NetAsyncModulesDownloader(User, manager.Cache), ref possibleConfigOnlyDirs, regMgr);
                }
            }
            catch (ModuleNotFoundKraken kraken)
            {
                User.RaiseMessage("Module {0} not found", kraken.module);
                return(Exit.ERROR);
            }
            catch (InconsistentKraken kraken)
            {
                User.RaiseMessage(kraken.ToString());
                return(Exit.ERROR);
            }
            catch (ModuleIsDLCKraken kraken)
            {
                User.RaiseMessage($"CKAN can't upgrade expansion '{kraken.module.name}' for you.");
                var res           = kraken?.module?.resources;
                var storePagesMsg = new Uri[] { res?.store, res?.steamstore }
                .Where(u => u != null)
                .Aggregate("", (a, b) => $"{a}\r\n- {b}");
                if (!string.IsNullOrEmpty(storePagesMsg))
                {
                    User.RaiseMessage($"To upgrade this expansion, download any updates from the store page from which you purchased it:\r\n{storePagesMsg}");
                }
                return(Exit.ERROR);
            }
            User.RaiseMessage("\r\nDone!\r\n");

            return(Exit.OK);
        }
Example #37
0
        public bool Equals([AllowNull] Histogram other)
        {
            if (other == null)
            {
                return(false);
            }

            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return((Type == other.Type && Type != null && other.Type != null && Type.Equals(other.Type)) &&
                   (Visible == other.Visible && Visible != null && other.Visible != null && Visible.Equals(other.Visible)) &&
                   (ShowLegend == other.ShowLegend && ShowLegend != null && other.ShowLegend != null && ShowLegend.Equals(other.ShowLegend)) &&
                   (LegendGroup == other.LegendGroup && LegendGroup != null && other.LegendGroup != null && LegendGroup.Equals(other.LegendGroup)) &&
                   (Opacity == other.Opacity && Opacity != null && other.Opacity != null && Opacity.Equals(other.Opacity)) &&
                   (Name == other.Name && Name != null && other.Name != null && Name.Equals(other.Name)) &&
                   (UId == other.UId && UId != null && other.UId != null && UId.Equals(other.UId)) &&
                   (Equals(Ids, other.Ids) || Ids != null && other.Ids != null && Ids.SequenceEqual(other.Ids)) &&
                   (Equals(CustomData, other.CustomData) || CustomData != null && other.CustomData != null && CustomData.SequenceEqual(other.CustomData)) &&
                   (Meta == other.Meta && Meta != null && other.Meta != null && Meta.Equals(other.Meta)) &&
                   (Equals(MetaArray, other.MetaArray) || MetaArray != null && other.MetaArray != null && MetaArray.SequenceEqual(other.MetaArray)) &&
                   (SelectedPoints == other.SelectedPoints && SelectedPoints != null && other.SelectedPoints != null && SelectedPoints.Equals(other.SelectedPoints)) &&
                   (HoverInfo == other.HoverInfo && HoverInfo != null && other.HoverInfo != null && HoverInfo.Equals(other.HoverInfo)) &&
                   (Equals(HoverInfoArray, other.HoverInfoArray) || HoverInfoArray != null && other.HoverInfoArray != null && HoverInfoArray.SequenceEqual(other.HoverInfoArray)) &&
                   (HoverLabel == other.HoverLabel && HoverLabel != null && other.HoverLabel != null && HoverLabel.Equals(other.HoverLabel)) &&
                   (Stream == other.Stream && Stream != null && other.Stream != null && Stream.Equals(other.Stream)) &&
                   (Equals(Transforms, other.Transforms) || Transforms != null && other.Transforms != null && Transforms.SequenceEqual(other.Transforms)) &&
                   (UiRevision == other.UiRevision && UiRevision != null && other.UiRevision != null && UiRevision.Equals(other.UiRevision)) &&
                   (Equals(X, other.X) || X != null && other.X != null && X.SequenceEqual(other.X)) &&
                   (Equals(Y, other.Y) || Y != null && other.Y != null && Y.SequenceEqual(other.Y)) &&
                   (Text == other.Text && Text != null && other.Text != null && Text.Equals(other.Text)) &&
                   (Equals(TextArray, other.TextArray) || TextArray != null && other.TextArray != null && TextArray.SequenceEqual(other.TextArray)) &&
                   (HoverText == other.HoverText && HoverText != null && other.HoverText != null && HoverText.Equals(other.HoverText)) &&
                   (Equals(HoverTextArray, other.HoverTextArray) || HoverTextArray != null && other.HoverTextArray != null && HoverTextArray.SequenceEqual(other.HoverTextArray)) &&
                   (Orientation == other.Orientation && Orientation != null && other.Orientation != null && Orientation.Equals(other.Orientation)) &&
                   (HistFunc == other.HistFunc && HistFunc != null && other.HistFunc != null && HistFunc.Equals(other.HistFunc)) &&
                   (HistNorm == other.HistNorm && HistNorm != null && other.HistNorm != null && HistNorm.Equals(other.HistNorm)) &&
                   (Cumulative == other.Cumulative && Cumulative != null && other.Cumulative != null && Cumulative.Equals(other.Cumulative)) &&
                   (NBinsX == other.NBinsX && NBinsX != null && other.NBinsX != null && NBinsX.Equals(other.NBinsX)) &&
                   (XBins == other.XBins && XBins != null && other.XBins != null && XBins.Equals(other.XBins)) &&
                   (NBinsY == other.NBinsY && NBinsY != null && other.NBinsY != null && NBinsY.Equals(other.NBinsY)) &&
                   (YBins == other.YBins && YBins != null && other.YBins != null && YBins.Equals(other.YBins)) &&
                   (AutoBinX == other.AutoBinX && AutoBinX != null && other.AutoBinX != null && AutoBinX.Equals(other.AutoBinX)) &&
                   (AutoBinY == other.AutoBinY && AutoBinY != null && other.AutoBinY != null && AutoBinY.Equals(other.AutoBinY)) &&
                   (BinGroup == other.BinGroup && BinGroup != null && other.BinGroup != null && BinGroup.Equals(other.BinGroup)) &&
                   (HoverTemplate == other.HoverTemplate && HoverTemplate != null && other.HoverTemplate != null && HoverTemplate.Equals(other.HoverTemplate)) &&
                   (Equals(HoverTemplateArray, other.HoverTemplateArray) ||
                    HoverTemplateArray != null && other.HoverTemplateArray != null && HoverTemplateArray.SequenceEqual(other.HoverTemplateArray)) &&
                   (Marker == other.Marker && Marker != null && other.Marker != null && Marker.Equals(other.Marker)) &&
                   (OffsetGroup == other.OffsetGroup && OffsetGroup != null && other.OffsetGroup != null && OffsetGroup.Equals(other.OffsetGroup)) &&
                   (AlignmentGroup == other.AlignmentGroup && AlignmentGroup != null && other.AlignmentGroup != null && AlignmentGroup.Equals(other.AlignmentGroup)) &&
                   (Selected == other.Selected && Selected != null && other.Selected != null && Selected.Equals(other.Selected)) &&
                   (Unselected == other.Unselected && Unselected != null && other.Unselected != null && Unselected.Equals(other.Unselected)) &&
                   (ErrorX == other.ErrorX && ErrorX != null && other.ErrorX != null && ErrorX.Equals(other.ErrorX)) &&
                   (ErrorY == other.ErrorY && ErrorY != null && other.ErrorY != null && ErrorY.Equals(other.ErrorY)) &&
                   (XCalendar == other.XCalendar && XCalendar != null && other.XCalendar != null && XCalendar.Equals(other.XCalendar)) &&
                   (YCalendar == other.YCalendar && YCalendar != null && other.YCalendar != null && YCalendar.Equals(other.YCalendar)) &&
                   (XAxis == other.XAxis && XAxis != null && other.XAxis != null && XAxis.Equals(other.XAxis)) &&
                   (YAxis == other.YAxis && YAxis != null && other.YAxis != null && YAxis.Equals(other.YAxis)) &&
                   (IdsSrc == other.IdsSrc && IdsSrc != null && other.IdsSrc != null && IdsSrc.Equals(other.IdsSrc)) &&
                   (CustomDataSrc == other.CustomDataSrc && CustomDataSrc != null && other.CustomDataSrc != null && CustomDataSrc.Equals(other.CustomDataSrc)) &&
                   (MetaSrc == other.MetaSrc && MetaSrc != null && other.MetaSrc != null && MetaSrc.Equals(other.MetaSrc)) &&
                   (HoverInfoSrc == other.HoverInfoSrc && HoverInfoSrc != null && other.HoverInfoSrc != null && HoverInfoSrc.Equals(other.HoverInfoSrc)) &&
                   (XSrc == other.XSrc && XSrc != null && other.XSrc != null && XSrc.Equals(other.XSrc)) &&
                   (YSrc == other.YSrc && YSrc != null && other.YSrc != null && YSrc.Equals(other.YSrc)) &&
                   (TextSrc == other.TextSrc && TextSrc != null && other.TextSrc != null && TextSrc.Equals(other.TextSrc)) &&
                   (HoverTextSrc == other.HoverTextSrc && HoverTextSrc != null && other.HoverTextSrc != null && HoverTextSrc.Equals(other.HoverTextSrc)) &&
                   (HoverTemplateSrc == other.HoverTemplateSrc && HoverTemplateSrc != null && other.HoverTemplateSrc != null && HoverTemplateSrc.Equals(other.HoverTemplateSrc)));
        }
        bool FilterMatchesMetadata(Meta<Lazy<IAutofacAuthorizationFilter>> filter)
        {
            var metadata = filter.Metadata.ContainsKey(MetadataKey)
                ? filter.Metadata[MetadataKey] as FilterMetadata : null;

            return metadata != null
                && metadata.ControllerType == _filterMetadata.ControllerType
                && metadata.FilterScope == _filterMetadata.FilterScope
                && metadata.MethodInfo == _filterMetadata.MethodInfo;
        }
Example #39
0
 public static Ice.DispatchStatus removeCallback___(Meta obj__, IceInternal.Incoming inS__, Ice.Current current__)
 {
     checkMode__(Ice.OperationMode.Normal, current__.mode);
     IceInternal.BasicStream is__ = inS__.istr();
     is__.startReadEncaps();
     Murmur.MetaCallbackPrx cb;
     cb = Murmur.MetaCallbackPrxHelper.read__(is__);
     is__.endReadEncaps();
     AMD_Meta_removeCallback cb__ = new _AMD_Meta_removeCallback(inS__);
     try
     {
         obj__.removeCallback_async(cb__, cb, current__);
     }
     catch(_System.Exception ex__)
     {
         cb__.ice_exception(ex__);
     }
     return Ice.DispatchStatus.DispatchAsync;
 }
        protected override void OnLoad(EventArgs onloadEvent)
        {
            base.OnLoad(onloadEvent);

            ModuleInfo moduleInfo = ModuleControl.ModuleContext.Configuration;

            if (moduleInfo.IsDeleted)
                return;

            string metaPath = Server.MapPath(moduleInfo.ContainerPath) + "StyleWizard\\meta.json",
                metaJson;

            try
            {
                metaJson = File.ReadAllText(metaPath, Encoding.UTF8);
            }
            catch (Exception e)
            {
                if (e is DirectoryNotFoundException || e is FileNotFoundException)
                    return;

                throw new Exception("The container meta file can't be read.", e);
            }

            Meta meta = new Meta();

            try
            {
                meta = JsonConvert.DeserializeObject<Meta>(metaJson);
            }
            catch (Exception e)
            {
                throw new Exception("The container meta file contains invalid JSON.", e);
            }

            string containerFilename = moduleInfo.ContainerSrc.Substring(moduleInfo.ContainerSrc.LastIndexOf('/') + 1),
                containerTheme = moduleInfo.ContainerPath.Remove(moduleInfo.ContainerPath.Length - 1),
                containerPortalId = containerTheme.Remove(containerTheme.LastIndexOf('/'));

            containerPortalId = containerPortalId.Remove(containerPortalId.LastIndexOf('/'));
            containerPortalId = containerPortalId.Substring(containerPortalId.LastIndexOf('/') + 1);

            containerTheme = containerTheme.Substring(containerTheme.LastIndexOf('/') + 1);

            containerFilename = containerFilename.Remove(containerFilename.IndexOf('.'));

            ActiveStyle activeStyle = new ActiveStyle();

            try
            {
                activeStyle = meta.activeStyles[containerFilename];
            }
            catch
            {
                activeStyle.id = "default";
                activeStyle.type = "predefined";
            }

            if (String.IsNullOrEmpty(templateGroup))
                templateGroup = "default";

            containerClass.Text = String.Concat(
                "eds_containers_", containerTheme,
                " eds_templateGroup_", templateGroup,
                " eds_template_", containerFilename,
                (activeStyle.type != "predefined" || activeStyle.id != "default" ? " eds_style_" + activeStyle.type + "_" + activeStyle.id : "")
            );

            string containersCssPath = Server.MapPath(moduleInfo.ContainerPath) + "container.css";

            if (File.Exists(containersCssPath))
                return;

            new ContainerController(containerTheme, containerPortalId, PortalSettings.HomeDirectoryMapPath, PortalSettings.HomeDirectory).rebuildCss();

            Control cssPageControl = Page.FindControl("CSS");

            if (cssPageControl == null)
                return;

            if (Page.Header.FindControl(ID) != null)
                return;

            var linkTag = new HtmlLink();
            linkTag.ID = Globals.CreateValidID(containerPortalId + "_" + containerTheme + "_containers");
            linkTag.Attributes["rel"] = "stylesheet";
            linkTag.Attributes["type"] = "text/css";
            linkTag.Href = moduleInfo.ContainerPath + "container.css";

            cssPageControl.Controls.Add(linkTag);
        }
Example #41
0
        public override int GetHashCode()
        {
            unchecked // Overflow is fine, just wrap
            {
                int hashCode = 41;

                if (Type != null)
                {
                    hashCode = hashCode * 59 + Type.GetHashCode();
                }

                if (Visible != null)
                {
                    hashCode = hashCode * 59 + Visible.GetHashCode();
                }

                if (Opacity != null)
                {
                    hashCode = hashCode * 59 + Opacity.GetHashCode();
                }

                if (Name != null)
                {
                    hashCode = hashCode * 59 + Name.GetHashCode();
                }

                if (UId != null)
                {
                    hashCode = hashCode * 59 + UId.GetHashCode();
                }

                if (Ids != null)
                {
                    hashCode = hashCode * 59 + Ids.GetHashCode();
                }

                if (CustomData != null)
                {
                    hashCode = hashCode * 59 + CustomData.GetHashCode();
                }

                if (Meta != null)
                {
                    hashCode = hashCode * 59 + Meta.GetHashCode();
                }

                if (MetaArray != null)
                {
                    hashCode = hashCode * 59 + MetaArray.GetHashCode();
                }

                if (HoverLabel != null)
                {
                    hashCode = hashCode * 59 + HoverLabel.GetHashCode();
                }

                if (Stream != null)
                {
                    hashCode = hashCode * 59 + Stream.GetHashCode();
                }

                if (Transforms != null)
                {
                    hashCode = hashCode * 59 + Transforms.GetHashCode();
                }

                if (UiRevision != null)
                {
                    hashCode = hashCode * 59 + UiRevision.GetHashCode();
                }

                if (Labels != null)
                {
                    hashCode = hashCode * 59 + Labels.GetHashCode();
                }

                if (Parents != null)
                {
                    hashCode = hashCode * 59 + Parents.GetHashCode();
                }

                if (Values != null)
                {
                    hashCode = hashCode * 59 + Values.GetHashCode();
                }

                if (BranchValues != null)
                {
                    hashCode = hashCode * 59 + BranchValues.GetHashCode();
                }

                if (Count != null)
                {
                    hashCode = hashCode * 59 + Count.GetHashCode();
                }

                if (Level != null)
                {
                    hashCode = hashCode * 59 + Level.GetHashCode();
                }

                if (MaxDepth != null)
                {
                    hashCode = hashCode * 59 + MaxDepth.GetHashCode();
                }

                if (Tiling != null)
                {
                    hashCode = hashCode * 59 + Tiling.GetHashCode();
                }

                if (Marker != null)
                {
                    hashCode = hashCode * 59 + Marker.GetHashCode();
                }

                if (PathBar != null)
                {
                    hashCode = hashCode * 59 + PathBar.GetHashCode();
                }

                if (Text != null)
                {
                    hashCode = hashCode * 59 + Text.GetHashCode();
                }

                if (TextInfo != null)
                {
                    hashCode = hashCode * 59 + TextInfo.GetHashCode();
                }

                if (TextTemplate != null)
                {
                    hashCode = hashCode * 59 + TextTemplate.GetHashCode();
                }

                if (TextTemplateArray != null)
                {
                    hashCode = hashCode * 59 + TextTemplateArray.GetHashCode();
                }

                if (HoverText != null)
                {
                    hashCode = hashCode * 59 + HoverText.GetHashCode();
                }

                if (HoverTextArray != null)
                {
                    hashCode = hashCode * 59 + HoverTextArray.GetHashCode();
                }

                if (HoverInfo != null)
                {
                    hashCode = hashCode * 59 + HoverInfo.GetHashCode();
                }

                if (HoverInfoArray != null)
                {
                    hashCode = hashCode * 59 + HoverInfoArray.GetHashCode();
                }

                if (HoverTemplate != null)
                {
                    hashCode = hashCode * 59 + HoverTemplate.GetHashCode();
                }

                if (HoverTemplateArray != null)
                {
                    hashCode = hashCode * 59 + HoverTemplateArray.GetHashCode();
                }

                if (TextFont != null)
                {
                    hashCode = hashCode * 59 + TextFont.GetHashCode();
                }

                if (InsideTextFont != null)
                {
                    hashCode = hashCode * 59 + InsideTextFont.GetHashCode();
                }

                if (OutsideTextFont != null)
                {
                    hashCode = hashCode * 59 + OutsideTextFont.GetHashCode();
                }

                if (TextPosition != null)
                {
                    hashCode = hashCode * 59 + TextPosition.GetHashCode();
                }

                if (Domain != null)
                {
                    hashCode = hashCode * 59 + Domain.GetHashCode();
                }

                if (IdsSrc != null)
                {
                    hashCode = hashCode * 59 + IdsSrc.GetHashCode();
                }

                if (CustomDataSrc != null)
                {
                    hashCode = hashCode * 59 + CustomDataSrc.GetHashCode();
                }

                if (MetaSrc != null)
                {
                    hashCode = hashCode * 59 + MetaSrc.GetHashCode();
                }

                if (LabelsSrc != null)
                {
                    hashCode = hashCode * 59 + LabelsSrc.GetHashCode();
                }

                if (ParentsSrc != null)
                {
                    hashCode = hashCode * 59 + ParentsSrc.GetHashCode();
                }

                if (ValuesSrc != null)
                {
                    hashCode = hashCode * 59 + ValuesSrc.GetHashCode();
                }

                if (TextSrc != null)
                {
                    hashCode = hashCode * 59 + TextSrc.GetHashCode();
                }

                if (TextTemplateSrc != null)
                {
                    hashCode = hashCode * 59 + TextTemplateSrc.GetHashCode();
                }

                if (HoverTextSrc != null)
                {
                    hashCode = hashCode * 59 + HoverTextSrc.GetHashCode();
                }

                if (HoverInfoSrc != null)
                {
                    hashCode = hashCode * 59 + HoverInfoSrc.GetHashCode();
                }

                if (HoverTemplateSrc != null)
                {
                    hashCode = hashCode * 59 + HoverTemplateSrc.GetHashCode();
                }

                return(hashCode);
            }
        }
Example #42
0
        public override void Open()
        {
            if (IsOpened)
                return;

            // make table
            if (Table == null)
            {
                if (Adapter == null)
                {
                    if (string.IsNullOrEmpty(_XmlFile)) throw new RuntimeException("Table, adapter, or file is not defined.");

                    // dataset
                    var ds = new DataSet();
                    ds.Locale = CultureInfo.CurrentCulture; // CA

                    // read schema
                    if (!string.IsNullOrEmpty(XmlSchema))
                        ds.ReadXmlSchema(XmlSchema);

                    // read data
                    ds.ReadXml(_XmlFile, XmlReadMode);
                    _XmlFileTime = _XmlFileTime = File.GetLastWriteTime(_XmlFile);

                    // accept data
                    ds.AcceptChanges();

                    // table
                    Table = GetTable(ds, TableName);
                }
                else
                {
                    if (Adapter.SelectCommand == null) throw new RuntimeException("Adapter select command is null.");

                    Table = new DataTable();
                    Table.Locale = CultureInfo.CurrentCulture; // CA
                }
            }

            // fill and drop the flag avoiding 2nd call on opening
            Fill();
            NeedsNewFiles = false;

            // pass 1: collect the columns
            IList<Meta> metas;
            if (Columns == null)
            {
                // collect/filter table columns to be shown
                int Count = Math.Min(Table.Columns.Count, Settings.Default.MaximumPanelColumnCount);
                metas = new List<Meta>(Count);
                int nCollected = 0;
                foreach (DataColumn column in Table.Columns)
                {
                    // skip hidden not calculated columns
                    if (column.ColumnMapping == MappingType.Hidden && column.Expression.Length == 0)
                        continue;

                    // skip not linear data
                    if (!Converter.IsLinearType(column.DataType))
                        continue;

                    // infer column meta data
                    Meta meta = new Meta(column.ColumnName);
                    meta.Kind = FarColumn.DefaultColumnKinds[nCollected];
                    metas.Add(meta);
                    ++nCollected;
                    if (nCollected >= Count)
                        break;
                }
            }
            else
            {
                // setup user defined columns
                metas = Format.SetupColumns(Columns);
            }

            // at least one column
            if (metas.Count == 0)
                throw new InvalidOperationException("There is no column to display.");

            // pass 2: mapping
            foreach (Meta meta in metas)
            {
                DataColumn column = Table.Columns[meta.Property];

                switch (meta.Kind[0])
                {
                    case 'N':
                        Map.Name = column.Ordinal;
                        break;
                    case 'O':
                        Map.Owner = column.Ordinal;
                        break;
                    case 'Z':
                        Map.Description = column.Ordinal;
                        break;
                    case 'C':
                        Map.Columns.Add(column.Ordinal);
                        break;
                    case 'S':
                        {
                            if (Map.Length >= 0)
                                throw new InvalidOperationException("Column 'S' is used twice.");
                            Map.Length = column.Ordinal;
                        }
                        break;
                    case 'D':
                        {
                            if (meta.Kind.Length < 2)
                                throw new InvalidOperationException(Res.InvalidColumnKind + "D");

                            switch (meta.Kind[1])
                            {
                                case 'C':
                                    {
                                        if (Map.CreationTime >= 0)
                                            throw new InvalidOperationException("Column 'DC' is used twice.");

                                        Map.CreationTime = column.Ordinal;
                                    }
                                    break;
                                case 'M':
                                    {
                                        if (Map.LastWriteTime >= 0)
                                            throw new InvalidOperationException("Column 'DM' is used twice.");

                                        Map.LastWriteTime = column.Ordinal;
                                    }
                                    break;
                                case 'A':
                                    {
                                        if (Map.LastAccessTime >= 0)
                                            throw new InvalidOperationException("Column 'DA' is used twice.");

                                        Map.LastAccessTime = column.Ordinal;
                                    }
                                    break;
                                default:
                                    throw new InvalidOperationException(Res.InvalidColumnKind + meta.Kind);
                            }
                        }
                        break;
                    default:
                        throw new InvalidOperationException(Res.InvalidColumnKind + meta.Kind);
                }
            }

            // pass 3: set plan
            SetPlan(PanelViewMode.AlternativeFull, Format.SetupPanelMode(metas));

            base.Open();
        }
Example #43
0
 [Test] public void Constructor_nullLogTrace()
 => Assert.Throws <System.Exception>(
     () => { var z = new Meta(null, null, null); });
        /// <summary>
        /// Returns true if RecipeObjectItems instances are equal
        /// </summary>
        /// <param name="other">Instance of RecipeObjectItems to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(RecipeObjectItems other)
        {
            if (ReferenceEquals(null, other))
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     Id == other.Id ||
                     Id != null &&
                     Id.Equals(other.Id)
                     ) &&
                 (
                     Title == other.Title ||
                     Title != null &&
                     Title.Equals(other.Title)
                 ) &&
                 (
                     Meta == other.Meta ||
                     Meta != null &&
                     Meta.Equals(other.Meta)
                 ) &&
                 (
                     Categories == other.Categories ||
                     Categories != null &&
                     Categories.SequenceEqual(other.Categories)
                 ) &&
                 (
                     Author == other.Author ||
                     Author != null &&
                     Author.Equals(other.Author)
                 ) &&
                 (
                     Keywords == other.Keywords ||
                     Keywords != null &&
                     Keywords.SequenceEqual(other.Keywords)
                 ) &&
                 (
                     Topics == other.Topics ||
                     Topics != null &&
                     Topics.SequenceEqual(other.Topics)
                 ) &&
                 (
                     Attributes == other.Attributes ||
                     Attributes != null &&
                     Attributes.Equals(other.Attributes)
                 ) &&
                 (
                     Ingredients == other.Ingredients ||
                     Ingredients != null &&
                     Ingredients.SequenceEqual(other.Ingredients)
                 ) &&
                 (
                     BaseIngredients == other.BaseIngredients ||
                     BaseIngredients != null &&
                     BaseIngredients.SequenceEqual(other.BaseIngredients)
                 ) &&
                 (
                     Nutrients == other.Nutrients ||
                     Nutrients != null &&
                     Nutrients.Equals(other.Nutrients)
                 ) &&
                 (
                     DiabeticExchanges == other.DiabeticExchanges ||
                     DiabeticExchanges != null &&
                     DiabeticExchanges.SequenceEqual(other.DiabeticExchanges)
                 ));
        }
Example #45
0
        private Meta ParseTags(IEnumerator<String> lines)
        {
            var metainfo = new Meta();
            while (lines.MoveNext())
            {
                try
                {
                    var pair = ParseTag(lines.Current);
                    metainfo[pair.Key] = pair.Value;
                }
                catch
                {
                    break;
                }
            }

            return metainfo;
        }
Example #46
0
        public void ManipulateMeta()
        {
            FhirClient client = new FhirClient(testEndpoint);

            var pat = new Patient();

            pat.Meta = new Meta();
            var key = new Random().Next();

            pat.Meta.ProfileElement.Add(new FhirUri("http://someserver.org/fhir/StructureDefinition/XYZ1-" + key));
            pat.Meta.Security.Add(new Coding("http://mysystem.com/sec", "1234-" + key));
            pat.Meta.Tag.Add(new Coding("http://mysystem.com/tag", "sometag1-" + key));

            //Before we begin, ensure that our new tags are not actually used when doing System Meta()
            var wsm = client.Meta();

            Assert.IsNotNull(wsm);

            Assert.IsFalse(wsm.Profile.Contains("http://someserver.org/fhir/StructureDefinition/XYZ1-" + key));
            Assert.IsFalse(wsm.Security.Select(c => c.Code + "@" + c.System).Contains("1234-" + key + "@http://mysystem.com/sec"));
            Assert.IsFalse(wsm.Tag.Select(c => c.Code + "@" + c.System).Contains("sometag1-" + key + "@http://mysystem.com/tag"));

            Assert.IsFalse(wsm.Profile.Contains("http://someserver.org/fhir/StructureDefinition/XYZ2-" + key));
            Assert.IsFalse(wsm.Security.Select(c => c.Code + "@" + c.System).Contains("5678-" + key + "@http://mysystem.com/sec"));
            Assert.IsFalse(wsm.Tag.Select(c => c.Code + "@" + c.System).Contains("sometag2-" + key + "@http://mysystem.com/tag"));


            // First, create a patient with the first set of meta
            var pat2 = client.Create(pat);
            var loc  = pat2.ResourceIdentity(testEndpoint);

            // Meta should be present on created patient
            verifyMeta(pat2.Meta, false, key);

            // Should be present when doing instance Meta()
            var par = client.Meta(loc);

            verifyMeta(par, false, key);

            // Should be present when doing type Meta()
            par = client.Meta(ResourceType.Patient);
            verifyMeta(par, false, key);

            // Should be present when doing System Meta()
            par = client.Meta();
            verifyMeta(par, false, key);

            // Now add some additional meta to the patient

            var newMeta = new Meta();

            newMeta.ProfileElement.Add(new FhirUri("http://someserver.org/fhir/StructureDefinition/XYZ2-" + key));
            newMeta.Security.Add(new Coding("http://mysystem.com/sec", "5678-" + key));
            newMeta.Tag.Add(new Coding("http://mysystem.com/tag", "sometag2-" + key));


            client.AddMeta(loc, newMeta);
            var pat3 = client.Read <Patient>(loc);

            // New and old meta should be present on instance
            verifyMeta(pat3.Meta, true, key);

            // New and old meta should be present on Meta()
            par = client.Meta(loc);
            verifyMeta(par, true, key);

            // New and old meta should be present when doing type Meta()
            par = client.Meta(ResourceType.Patient);
            verifyMeta(par, true, key);

            // New and old meta should be present when doing system Meta()
            par = client.Meta();
            verifyMeta(par, true, key);

            // Now, remove those new meta tags
            client.DeleteMeta(loc, newMeta);

            // Should no longer be present on instance
            var pat4 = client.Read <Patient>(loc);

            verifyMeta(pat4.Meta, false, key);

            // Should no longer be present when doing instance Meta()
            par = client.Meta(loc);
            verifyMeta(par, false, key);

            // Should no longer be present when doing type Meta()
            par = client.Meta(ResourceType.Patient);
            verifyMeta(par, false, key);

            // clear out the client that we created, no point keeping it around
            client.Delete(pat4);

            // Should no longer be present when doing System Meta()
            par = client.Meta();
            verifyMeta(par, false, key);
        }
    public static TimelineItemDataMeta GetListFromJson(string json)
    {
        var N = JSONNode.Parse(json);
        List<TimelineItemData> items = new List<TimelineItemData>();

        foreach (JSONNode item in N["sign"]["items"].AsArray)
        {
            items.Add(Deserialize(item));
        }

        Meta m = new Meta()
        {
            DateOfCreation = DateTime.Parse(N["sign"]["metadata"]["dateOfCreation"]),
            Name = N["sign"]["metadata"]["name"],
            Author = N["sign"]["metadata"]["author"]
        };

        foreach (JSONNode tag in N["sign"]["metadata"]["tags"].AsArray)
        {
            m.Tags.Add(tag.Value);
        }

        return new TimelineItemDataMeta(items, m);
    }
Example #48
0
 public bool HasCallbacks(Meta.TypeModel.CallbackType callbackType)
 {
     return false;
 }
Example #49
0
 void IProtoTypeSerializer.Callback(object value, Meta.TypeModel.CallbackType callbackType, SerializationContext context) { }
Example #50
0
        /// <inheritdoc />
        public bool Equals([AllowNull] DensityMapBox other)
        {
            if (other == null)
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     Type == other.Type ||
                     Type != null &&
                     Type.Equals(other.Type)
                     ) &&
                 (
                     Visible == other.Visible ||
                     Visible != null &&
                     Visible.Equals(other.Visible)
                 ) &&
                 (
                     LegendGroup == other.LegendGroup ||
                     LegendGroup != null &&
                     LegendGroup.Equals(other.LegendGroup)
                 ) &&
                 (
                     Opacity == other.Opacity ||
                     Opacity != null &&
                     Opacity.Equals(other.Opacity)
                 ) &&
                 (
                     Name == other.Name ||
                     Name != null &&
                     Name.Equals(other.Name)
                 ) &&
                 (
                     UId == other.UId ||
                     UId != null &&
                     UId.Equals(other.UId)
                 ) &&
                 (
                     Equals(Ids, other.Ids) ||
                     Ids != null && other.Ids != null &&
                     Ids.SequenceEqual(other.Ids)
                 ) &&
                 (
                     Equals(CustomData, other.CustomData) ||
                     CustomData != null && other.CustomData != null &&
                     CustomData.SequenceEqual(other.CustomData)
                 ) &&
                 (
                     Meta == other.Meta ||
                     Meta != null &&
                     Meta.Equals(other.Meta)
                 ) &&
                 (
                     Equals(MetaArray, other.MetaArray) ||
                     MetaArray != null && other.MetaArray != null &&
                     MetaArray.SequenceEqual(other.MetaArray)
                 ) &&
                 (
                     HoverLabel == other.HoverLabel ||
                     HoverLabel != null &&
                     HoverLabel.Equals(other.HoverLabel)
                 ) &&
                 (
                     Stream == other.Stream ||
                     Stream != null &&
                     Stream.Equals(other.Stream)
                 ) &&
                 (
                     Equals(Transforms, other.Transforms) ||
                     Transforms != null && other.Transforms != null &&
                     Transforms.SequenceEqual(other.Transforms)
                 ) &&
                 (
                     UiRevision == other.UiRevision ||
                     UiRevision != null &&
                     UiRevision.Equals(other.UiRevision)
                 ) &&
                 (
                     Equals(Lon, other.Lon) ||
                     Lon != null && other.Lon != null &&
                     Lon.SequenceEqual(other.Lon)
                 ) &&
                 (
                     Equals(Lat, other.Lat) ||
                     Lat != null && other.Lat != null &&
                     Lat.SequenceEqual(other.Lat)
                 ) &&
                 (
                     Equals(Z, other.Z) ||
                     Z != null && other.Z != null &&
                     Z.SequenceEqual(other.Z)
                 ) &&
                 (
                     Radius == other.Radius ||
                     Radius != null &&
                     Radius.Equals(other.Radius)
                 ) &&
                 (
                     Equals(RadiusArray, other.RadiusArray) ||
                     RadiusArray != null && other.RadiusArray != null &&
                     RadiusArray.SequenceEqual(other.RadiusArray)
                 ) &&
                 (
                     Below == other.Below ||
                     Below != null &&
                     Below.Equals(other.Below)
                 ) &&
                 (
                     Text == other.Text ||
                     Text != null &&
                     Text.Equals(other.Text)
                 ) &&
                 (
                     Equals(TextArray, other.TextArray) ||
                     TextArray != null && other.TextArray != null &&
                     TextArray.SequenceEqual(other.TextArray)
                 ) &&
                 (
                     HoverText == other.HoverText ||
                     HoverText != null &&
                     HoverText.Equals(other.HoverText)
                 ) &&
                 (
                     Equals(HoverTextArray, other.HoverTextArray) ||
                     HoverTextArray != null && other.HoverTextArray != null &&
                     HoverTextArray.SequenceEqual(other.HoverTextArray)
                 ) &&
                 (
                     HoverInfo == other.HoverInfo ||
                     HoverInfo != null &&
                     HoverInfo.Equals(other.HoverInfo)
                 ) &&
                 (
                     Equals(HoverInfoArray, other.HoverInfoArray) ||
                     HoverInfoArray != null && other.HoverInfoArray != null &&
                     HoverInfoArray.SequenceEqual(other.HoverInfoArray)
                 ) &&
                 (
                     HoverTemplate == other.HoverTemplate ||
                     HoverTemplate != null &&
                     HoverTemplate.Equals(other.HoverTemplate)
                 ) &&
                 (
                     Equals(HoverTemplateArray, other.HoverTemplateArray) ||
                     HoverTemplateArray != null && other.HoverTemplateArray != null &&
                     HoverTemplateArray.SequenceEqual(other.HoverTemplateArray)
                 ) &&
                 (
                     ShowLegend == other.ShowLegend ||
                     ShowLegend != null &&
                     ShowLegend.Equals(other.ShowLegend)
                 ) &&
                 (
                     ZAuto == other.ZAuto ||
                     ZAuto != null &&
                     ZAuto.Equals(other.ZAuto)
                 ) &&
                 (
                     ZMin == other.ZMin ||
                     ZMin != null &&
                     ZMin.Equals(other.ZMin)
                 ) &&
                 (
                     ZMax == other.ZMax ||
                     ZMax != null &&
                     ZMax.Equals(other.ZMax)
                 ) &&
                 (
                     ZMid == other.ZMid ||
                     ZMid != null &&
                     ZMid.Equals(other.ZMid)
                 ) &&
                 (
                     ColorScale == other.ColorScale ||
                     ColorScale != null &&
                     ColorScale.Equals(other.ColorScale)
                 ) &&
                 (
                     AutoColorScale == other.AutoColorScale ||
                     AutoColorScale != null &&
                     AutoColorScale.Equals(other.AutoColorScale)
                 ) &&
                 (
                     ReverseScale == other.ReverseScale ||
                     ReverseScale != null &&
                     ReverseScale.Equals(other.ReverseScale)
                 ) &&
                 (
                     ShowScale == other.ShowScale ||
                     ShowScale != null &&
                     ShowScale.Equals(other.ShowScale)
                 ) &&
                 (
                     ColorBar == other.ColorBar ||
                     ColorBar != null &&
                     ColorBar.Equals(other.ColorBar)
                 ) &&
                 (
                     ColorAxis == other.ColorAxis ||
                     ColorAxis != null &&
                     ColorAxis.Equals(other.ColorAxis)
                 ) &&
                 (
                     Subplot == other.Subplot ||
                     Subplot != null &&
                     Subplot.Equals(other.Subplot)
                 ) &&
                 (
                     IdsSrc == other.IdsSrc ||
                     IdsSrc != null &&
                     IdsSrc.Equals(other.IdsSrc)
                 ) &&
                 (
                     CustomDataSrc == other.CustomDataSrc ||
                     CustomDataSrc != null &&
                     CustomDataSrc.Equals(other.CustomDataSrc)
                 ) &&
                 (
                     MetaSrc == other.MetaSrc ||
                     MetaSrc != null &&
                     MetaSrc.Equals(other.MetaSrc)
                 ) &&
                 (
                     LonSrc == other.LonSrc ||
                     LonSrc != null &&
                     LonSrc.Equals(other.LonSrc)
                 ) &&
                 (
                     LatSrc == other.LatSrc ||
                     LatSrc != null &&
                     LatSrc.Equals(other.LatSrc)
                 ) &&
                 (
                     ZSrc == other.ZSrc ||
                     ZSrc != null &&
                     ZSrc.Equals(other.ZSrc)
                 ) &&
                 (
                     RadiusSrc == other.RadiusSrc ||
                     RadiusSrc != null &&
                     RadiusSrc.Equals(other.RadiusSrc)
                 ) &&
                 (
                     TextSrc == other.TextSrc ||
                     TextSrc != null &&
                     TextSrc.Equals(other.TextSrc)
                 ) &&
                 (
                     HoverTextSrc == other.HoverTextSrc ||
                     HoverTextSrc != null &&
                     HoverTextSrc.Equals(other.HoverTextSrc)
                 ) &&
                 (
                     HoverInfoSrc == other.HoverInfoSrc ||
                     HoverInfoSrc != null &&
                     HoverInfoSrc.Equals(other.HoverInfoSrc)
                 ) &&
                 (
                     HoverTemplateSrc == other.HoverTemplateSrc ||
                     HoverTemplateSrc != null &&
                     HoverTemplateSrc.Equals(other.HoverTemplateSrc)
                 ));
        }
Example #51
0
        /// <summary>
        /// The load raw from file.
        /// </summary>
        /// <param name="inputFilePath">The input file path.</param>
        /// <param name="meta">The meta.</param>
        /// <returns></returns>
        /// <remarks></remarks>
        public RawDataContainer LoadRawFromFile(string inputFilePath, Meta.Meta meta)
        {
            RawDataContainer raw = new RawDataContainer();
            int x = inputFilePath.LastIndexOf('.');
            string temp = inputFilePath.Substring(0, x + 1) + meta.type + "raw";

            XmlTextReader xtr = new XmlTextReader(temp + ".xml");
            xtr.WhitespaceHandling = WhitespaceHandling.None;

            FileStream FS = new FileStream(temp, FileMode.Open);
            BinaryReader BR = new BinaryReader(FS);

            while (xtr.Read())
            {
                switch (xtr.NodeType)
                {
                    case XmlNodeType.Element:
                        if (xtr.Name == "RawData")
                        {
                            string oi = xtr.GetAttribute("RawType");

                            switch (oi)
                            {
                                case "Model":
                                    raw = new Model();
                                    break;
                                case "Bitmap":
                                    raw = new BitmapRaw();
                                    break;
                                case "Animation":
                                    raw = new Animation();
                                    break;
                                case "DECR":
                                    raw = new DECR();
                                    break;
                                case "PRTM":
                                    raw = new PRTM();
                                    break;
                                case "Weather":
                                    raw = new Weather();
                                    break;
                                case "Sound":
                                    raw = new Sound();
                                    break;
                                case "BSP":
                                    raw = new BSPRaw();
                                    break;
                            }
                        }
                        else if (xtr.Name == "RawChunk")
                        {
                            RawDataChunk r = new RawDataChunk();
                            string temps = xtr.GetAttribute("RawDataType");
                            switch (temps)
                            {
                                case "bitm":
                                    r.rawDataType = RawDataType.bitm;
                                    break;
                                case "bsp1":
                                    r.rawDataType = RawDataType.bsp1;
                                    break;
                                case "bsp2":
                                    r.rawDataType = RawDataType.bsp2;
                                    break;
                                case "bsp3":
                                    r.rawDataType = RawDataType.bsp3;
                                    break;
                                case "bsp4":
                                    r.rawDataType = RawDataType.bsp4;
                                    break;
                                case "DECR":
                                    r.rawDataType = RawDataType.DECR;
                                    break;
                                case "jmad":
                                    r.rawDataType = RawDataType.jmad;
                                    break;
                                case "ltmp":
                                    r.rawDataType = RawDataType.ltmp;
                                    break;
                                case "mode1":
                                    r.rawDataType = RawDataType.mode1;
                                    break;
                                case "mode2":
                                    r.rawDataType = RawDataType.mode2;
                                    break;
                                case "PRTM":
                                    r.rawDataType = RawDataType.PRTM;
                                    break;
                                case "snd1":
                                    r.rawDataType = RawDataType.snd1;
                                    break;
                                case "snd2":
                                    r.rawDataType = RawDataType.snd2;
                                    break;
                            }

                            r.offset = Convert.ToInt32(xtr.GetAttribute("PointsToOffset"));
                            r.pointerMetaOffset = Convert.ToInt32(xtr.GetAttribute("PointerMetaOffset"));
                            r.size = Convert.ToInt32(xtr.GetAttribute("ChunkSize"));
                            int rawdataspot = Convert.ToInt32(xtr.GetAttribute("RawDataOffset"));
                            BR.BaseStream.Position = rawdataspot;
                            r.MS = new MemoryStream(r.size);
                            r.MS.Write(BR.ReadBytes(r.size), 0, r.size);

                            raw.rawChunks.Add(r);
                        }

                        break;
                }
            }

            BR.Close();
            FS.Close();
            xtr.Close();

            if (meta.type == "snd!")
            {
                Stream s = File.Open(temp + "layout", FileMode.Open);

                #region attempt to convert v1.0.0.0 files to v1.1.0.0 format
                {
                    StreamReader sr = new StreamReader(s);
                    string convertOldVersion = sr.ReadToEnd();
                    if (convertOldVersion.Contains("Version=1.0.0.0"))
                    {
                        int xx = -1;
                        while ((xx = convertOldVersion.IndexOf("entity.MetaContainers")) > -1)
                        {
                            if (convertOldVersion[xx] == '[')
                                convertOldVersion = convertOldVersion.Substring(0, xx) +
                                                "HaloMap.H2MetaContainers" +
                                                convertOldVersion.Substring(xx + "entity.MetaContainers".Length);
                            else
                                convertOldVersion = convertOldVersion.Substring(0, xx - 1) +
                                                (char)((byte)convertOldVersion[xx - 1] + 3) +   // string is 3 bytes longer
                                                "HaloMap.H2MetaContainers" +
                                                convertOldVersion.Substring(xx + "entity.MetaContainers".Length);
                        }
                        while ((xx = convertOldVersion.IndexOf("entity.MapTypes")) > -1)
                        {
                            convertOldVersion = convertOldVersion.Substring(0, xx - 1) +
                                                (char)((byte)convertOldVersion[xx - 1] + 5) +  // string is 5 bytes longer
                                                "HaloMap.Map.MapTypes" +
                                                convertOldVersion.Substring(xx + "entity.MapTypes".Length);
                        }

                        // Convert the modified string into a stream
                        StreamWriter sw = new StreamWriter(s);
                        sw.BaseStream.Position = 0;
                        char[] ca = convertOldVersion.ToCharArray();
                        byte[] ba = Encoding.Default.GetBytes(ca);
                        sw.BaseStream.Write(ba, 0, ba.Length);

            #if DEBUG
                        // Write an output file for testing
                        Stream s2 = File.Create(temp + "layout_test");
                        sw = new StreamWriter(s2);
                        sw.BaseStream.Write(ba, 0, ba.Length);
                        s2.Close();
            #endif
                    }

                    s.Position = 0;
                }
                #endregion
                BinaryFormatter b = new BinaryFormatter();
                Sound temps = (Sound)raw;
                temps.Permutations = (ugh_.SoundPermutationChunk[])b.Deserialize(s);
                meta.raw = temps;
                s.Close();
            }

            return raw;
        }
Example #52
0
 public void On(IGetMeta getMeta) => Meta.Execute(getMeta);
Example #53
0
            public void LoadSimpleTemplateFile()
            {
                // Given
                Engine engine = new Engine();
                engine.RootFolder = TestContext.CurrentContext.TestDirectory;
                engine.InputFolder = @"TestFiles\Input\";
                ReadFiles readFiles = new ReadFiles(@"SimpleTemplate\Test.cshtml");
                Razor razor = new Razor();
                Meta meta = new Meta("Content", (x, y) => x.Content);
                engine.Pipelines.Add("Pipeline", readFiles, razor, meta);

                // When
                engine.Execute();

                // Then
                Assert.AreEqual(1, engine.Documents.FromPipeline("Pipeline").Count());
                Assert.AreEqual(@"<p>This is a test</p>", engine.Documents.FromPipeline("Pipeline").First().String("Content"));
            }
Example #54
0
        public int RunCommand(CKAN.KSP ksp, object raw_options)
        {
            UpgradeOptions options = (UpgradeOptions)raw_options;

            if (options.ckan_file != null)
            {
                options.modules.Add(LoadCkanFromFile(ksp, options.ckan_file).identifier);
            }

            if (options.modules.Count == 0 && !options.upgrade_all)
            {
                // What? No files specified?
                User.RaiseMessage("Usage: ckan upgrade Mod [Mod2, ...]");
                User.RaiseMessage("  or   ckan upgrade --all");
                User.RaiseMessage("  or   ckan upgrade ckan");
                return(Exit.BADOPT);
            }

            if (!options.upgrade_all && options.modules[0] == "ckan")
            {
                User.RaiseMessage("Querying the latest CKAN version");
                AutoUpdate.Instance.FetchLatestReleaseInfo();
                var latestVersion  = AutoUpdate.Instance.LatestVersion;
                var currentVersion = new Version(Meta.Version());

                if (latestVersion.IsGreaterThan(currentVersion))
                {
                    User.RaiseMessage("New CKAN version available - " + latestVersion);
                    var releaseNotes = AutoUpdate.Instance.ReleaseNotes;
                    User.RaiseMessage(releaseNotes);
                    User.RaiseMessage("\n");

                    if (User.RaiseYesNoDialog("Proceed with install?"))
                    {
                        User.RaiseMessage("Upgrading CKAN, please wait..");
                        AutoUpdate.Instance.StartUpdateProcess(false);
                    }
                }
                else
                {
                    User.RaiseMessage("You already have the latest version.");
                }

                return(Exit.OK);
            }

            User.RaiseMessage("\nUpgrading modules...\n");

            try
            {
                if (options.upgrade_all)
                {
                    var installed  = new Dictionary <string, Version>(ksp.Registry.Installed());
                    var to_upgrade = new List <CkanModule>();

                    foreach (KeyValuePair <string, Version> mod in installed)
                    {
                        Version current_version = mod.Value;

                        if ((current_version is ProvidesVersion) || (current_version is DllVersion))
                        {
                            continue;
                        }
                        else
                        {
                            try
                            {
                                // Check if upgrades are available
                                CkanModule latest = ksp.Registry.LatestAvailable(mod.Key, ksp.Version());

                                // This may be an unindexed mod. If so,
                                // skip rather than crash. See KSP-CKAN/CKAN#841.
                                if (latest == null)
                                {
                                    continue;
                                }

                                if (latest.version.IsGreaterThan(mod.Value))
                                {
                                    // Upgradable
                                    log.InfoFormat("New version {0} found for {1}",
                                                   latest.version, latest.identifier);
                                    to_upgrade.Add(latest);
                                }
                            }
                            catch (ModuleNotFoundKraken)
                            {
                                log.InfoFormat("{0} is installed, but no longer in the registry",
                                               mod.Key);
                            }
                        }
                    }

                    ModuleInstaller.GetInstance(ksp, User).Upgrade(to_upgrade, new NetAsyncDownloader(User));
                }
                else
                {
                    // TODO: These instances all need to go.
                    ModuleInstaller.GetInstance(ksp, User).Upgrade(options.modules, new NetAsyncDownloader(User));
                }
            }
            catch (ModuleNotFoundKraken kraken)
            {
                User.RaiseMessage("Module {0} not found", kraken.module);
                return(Exit.ERROR);
            }
            User.RaiseMessage("\nDone!\n");

            return(Exit.OK);
        }
Example #55
0
        /// <summary>申请任务分片</summary>
        /// <param name="server">申请任务的服务端</param>
        /// <param name="ip">申请任务的IP</param>
        /// <param name="pid">申请任务的服务端进程ID</param>
        /// <param name="count">要申请的任务个数</param>
        /// <returns></returns>
        public IList <JobTask> Acquire(String server, String ip, Int32 pid, Int32 count)
        {
            var list = new List <JobTask>();

            if (!Enable)
            {
                return(list);
            }

            var step = Step;

            if (step <= 0)
            {
                step = 30;
            }

            lock (this)
            {
                using (var ts = Meta.CreateTrans())
                {
                    var start = Start;
                    for (var i = 0; i < count; i++)
                    {
                        if (!TrySplit(start, step, out var end))
                        {
                            break;
                        }

                        // 创建新的分片
                        var ti = new JobTask
                        {
                            AppID     = AppID,
                            JobID     = ID,
                            Start     = start,
                            End       = end,
                            BatchSize = BatchSize,
                        };

                        ti.Server     = server;
                        ti.ProcessID  = pid;
                        ti.Client     = $"{ip}@{pid}";
                        ti.Status     = JobStatus.就绪;
                        ti.CreateTime = DateTime.Now;
                        ti.UpdateTime = DateTime.Now;

                        //// 如果有模板,则进行计算替换
                        //if (!Data.IsNullOrEmpty()) ti.Data = TemplateHelper.Build(Data, ti.Start, ti.End);

                        ti.Insert();

                        // 更新任务
                        Start = end;
                        start = end;

                        list.Add(ti);
                    }

                    if (list.Count > 0)
                    {
                        // 任务需要ID,不能批量插入优化
                        //list.Insert(null);

                        UpdateTime = DateTime.Now;
                        Save();
                        ts.Commit();
                    }

                    return(list);
                }
            }
        }
Example #56
0
        private bool AccionGuardar()
        {
            if (!this.Validar())
            {
                return(false);
            }

            Cargando.Mostrar();
            int iSucursalID = Util.Entero(this.cmbSucursal.SelectedValue);

            // Se guardan las metas específicas
            Meta oMeta;

            foreach (DataGridViewRow oFila in this.dgvEspecificas.Rows)
            {
                if (oFila.IsNewRow)
                {
                    continue;
                }

                int iMetaID = Util.Entero(oFila.Cells["mesMetaID"].Value);
                int iCambio = Util.Entero(oFila.Cells["mesCambio"].Value);
                switch (iCambio)
                {
                case Cat.TiposDeAfectacion.Agregar:
                case Cat.TiposDeAfectacion.Modificar:
                    if (iCambio == Cat.TiposDeAfectacion.Agregar)
                    {
                        oMeta = new Meta()
                        {
                            SucursalID = iSucursalID
                        }
                    }
                    ;
                    else
                    {
                        oMeta = Datos.GetEntity <Meta>(c => c.MetaID == iMetaID);
                    }
                    oMeta.VendedorID = (Util.Entero(oFila.Cells["mesUsuarioID"].Value) > 0 ?
                                        (int?)Util.Entero(oFila.Cells["mesUsuarioID"].Value) : null);
                    oMeta.MarcaParteID = (Util.Entero(oFila.Cells["mesMarcaID"].Value) > 0 ?
                                          (int?)Util.Entero(oFila.Cells["mesMarcaID"].Value): null);
                    oMeta.LineaID = (Util.Entero(oFila.Cells["mesLineaID"].Value) > 0 ?
                                     (int?)Util.Entero(oFila.Cells["mesLineaID"].Value) : null);
                    oMeta.ParteID = (Util.Entero(oFila.Cells["mesParteID"].Value) > 0 ?
                                     (int?)Util.Entero(oFila.Cells["mesParteID"].Value) : null);
                    oMeta.NombreMeta = Util.Cadena(oFila.Cells["mesNombre"].Value);
                    oMeta.Cantidad   = Util.Decimal(oFila.Cells["mesCantidad"].Value);
                    oMeta.RutaImagen = Util.Cadena(oFila.Cells["mesRutaImagen"].Value);
                    Datos.Guardar <Meta>(oMeta);
                    break;

                case Cat.TiposDeAfectacion.Borrar:
                    oMeta = Datos.GetEntity <Meta>(c => c.MetaID == iMetaID);
                    Datos.Eliminar <Meta>(oMeta);
                    break;
                }
            }

            Cargando.Cerrar();
            this.CargarDatos();
            return(true);
        }
Example #57
0
 public void EmitCallback(Compiler.CompilerContext ctx, Compiler.Local valueFrom, Meta.TypeModel.CallbackType callbackType) { }
Example #58
0
        /// <summary>申请任务分片</summary>
        /// <param name="topic">主题</param>
        /// <param name="server">申请任务的服务端</param>
        /// <param name="ip">申请任务的IP</param>
        /// <param name="pid">申请任务的服务端进程ID</param>
        /// <param name="count">要申请的任务个数</param>
        /// <returns></returns>
        public IList <JobTask> AcquireMessage(String topic, String server, String ip, Int32 pid, Int32 count)
        {
            // 消费消息时,保存主题
            if (Topic != topic)
            {
                Topic = topic;
                SaveAsync();
            }

            var list = new List <JobTask>();

            if (!Enable)
            {
                return(list);
            }

            // 验证消息数
            var now = DateTime.Now;

            if (MessageCount == 0 && UpdateTime.AddMinutes(2) > now)
            {
                return(list);
            }

            lock (this)
            {
                using (var ts = Meta.CreateTrans())
                {
                    var size = BatchSize;
                    if (size == 0)
                    {
                        size = 1;
                    }

                    // 消费消息。请求任务数量=空闲线程*批大小
                    var msgs = AppMessage.GetTopic(AppID, topic, now, count * size);
                    if (msgs.Count > 0)
                    {
                        for (var i = 0; i < msgs.Count;)
                        {
                            var msgList = msgs.Skip(i).Take(size).ToList();
                            if (msgList.Count == 0)
                            {
                                break;
                            }

                            i += msgList.Count;

                            // 创建新的分片
                            var ti = new JobTask
                            {
                                AppID    = AppID,
                                JobID    = ID,
                                Data     = msgList.Select(e => e.Data).ToJson(),
                                MsgCount = msgList.Count,

                                BatchSize = size,
                            };

                            ti.Server     = server;
                            ti.ProcessID  = pid;
                            ti.Client     = $"{ip}@{pid}";
                            ti.Status     = JobStatus.就绪;
                            ti.CreateTime = DateTime.Now;
                            ti.UpdateTime = DateTime.Now;

                            ti.Insert();

                            list.Add(ti);
                        }

                        // 批量删除消息
                        msgs.Delete();
                    }

                    // 更新作业下的消息数
                    MessageCount = AppMessage.FindCountByAppIDAndTopic(AppID, topic);
                    UpdateTime   = now;
                    Save();

                    // 消费完成后,更新应用的消息数
                    if (MessageCount == 0)
                    {
                        var app = App;
                        if (app != null)
                        {
                            app.MessageCount = AppMessage.FindCountByAppID(ID);
                            app.SaveAsync();
                        }
                    }

                    ts.Commit();

                    return(list);
                }
            }
        }
Example #59
0
        internal static Meta ExpectedMetadataProperties(ThemeData data)
        {
            var newMeta = new Meta
            {
                Path=null, 
                Type = MetadataType.Undefined,
                Format= MetadataFormat.Undefined
            };

            if (data == null)
                return newMeta;

            newMeta.Type = MetadataType.FilePath;
            newMeta.Format = MetadataFormat.Xml;

            //general file based metadata
            if (data.Path != null && File.Exists(data.Path + ".xml"))
            {
                newMeta.Path = data.Path + ".xml";
                return newMeta;
            }

            if (data.DataSource != null && File.Exists(data.DataSource + ".xml"))
            {
                newMeta.Path = data.DataSource + ".xml";
                return newMeta;
            }

            //grids & tins
            if (data.DataSource != null
                //&& data.WorkspacePath != null
                && Directory.Exists(data.DataSource))
            {
                string metapath = System.IO.Path.Combine(data.DataSource, "metadata.xml");
                if (File.Exists(metapath))
                {
                    newMeta.Path = metapath;
                    return newMeta;
                }
            }

            //shapefile 
            if (data.IsShapefile)
            {
                string metapath = data.DataSource + ".shp.xml";
                if (File.Exists(metapath))
                {
                    newMeta.Path = metapath;
                    return newMeta;
                }
            }

            //coverages
            if (data.IsCoverage && data.WorkspacePath != null && data.Container != null)
            {
                string coverageDir = System.IO.Path.Combine(data.WorkspacePath, data.Container);
                if (Directory.Exists(coverageDir))
                {
                    string metapath = System.IO.Path.Combine(coverageDir, "metadata.xml");
                    if (File.Exists(metapath))
                    {
                        newMeta.Path = metapath;
                        return newMeta;
                    }
                }
            }

            //CAD
            if (data.IsCad && data.WorkspacePath != null && data.Container != null)
            {
                string cadFile = System.IO.Path.Combine(data.WorkspacePath, data.Container);
                if (File.Exists(cadFile))
                {
                    string metapath = cadFile + ".xml";
                    if (File.Exists(metapath))
                    {
                        newMeta.Path = metapath;
                        return newMeta;
                    }
                }
            }

            newMeta.Type = MetadataType.EsriDataPath;

            if (data.IsInGeodatabase && !data.IsLayerFile)
            {
                newMeta.Path = data.DataSource;
                return newMeta;
            }
            if (data.IsLayerFile && !data.IsGroupLayerFile)
            {
                newMeta.Path = data.DataSource;
                return newMeta;
            }

            //FIXME - does not work for web services ???
            newMeta.Type = MetadataType.Undefined;
            newMeta.Format = MetadataFormat.Undefined;
            return newMeta;
        }
Example #60
0
 public OperationUser(Meta <Func <IOperation <T> >, string> getOperation)
 {
     GetOperation = getOperation;
 }