当前位置: 首页>>代码示例>>C#>>正文


C# IStorage.ReadString方法代码示例

本文整理汇总了C#中IStorage.ReadString方法的典型用法代码示例。如果您正苦于以下问题:C# IStorage.ReadString方法的具体用法?C# IStorage.ReadString怎么用?C# IStorage.ReadString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IStorage的用法示例。


在下文中一共展示了IStorage.ReadString方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Deserialize

        public override bool Deserialize(IStorage storage)
        {
            if (storage == null)
                throw new ArgumentNullException("storage");

            try
            {
                base.Deserialize(storage);
                this.Assembly = storage.ReadString(FieldCode.Assembly);
                this.QualifiedName = storage.ReadString(FieldCode.QualifiedName);
                this.ArgumentTypes = storage.ReadString(FieldCode.ArgumentTypes);
                this.UpdateReturnTypeAndMemberType();
                return true;
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message + "\n Identifier node deserialization failed.");
                return false;
            }
        }
开发者ID:samuto,项目名称:designscript,代码行数:20,代码来源:PropertyNode.cs

示例2: ReadVariableSlotInfo

 private VariableSlotInfo ReadVariableSlotInfo(IStorage storage)
 {
     string variable = storage.ReadString(FieldCode.VariableSlotInfoVar);
     int line = storage.ReadInteger(FieldCode.VariableSlotInfoLine);
     uint slotId = storage.ReadUnsignedInteger(FieldCode.VariableSlotInfoSlotId);
     return new VariableSlotInfo(variable, line, slotId);
 }
开发者ID:samuto,项目名称:designscript,代码行数:7,代码来源:Statement.cs

示例3: Deserialize

        public virtual bool Deserialize(IStorage storage)
        {
            if (storage == null)
                throw new ArgumentNullException("storage (58D0A328653F)"); // @TODO(done): GUID?
            if (storage.ReadUnsignedInteger(FieldCode.StatementSignature) != Configurations.StatementSignature)
                throw new InvalidOperationException("Invalid input data (8404892D29B6)"); // @TODO(done): GUID?

            this.flags = (Flags)storage.ReadInteger(FieldCode.StatementFlag);
            this.definedVariable = storage.ReadString(FieldCode.DefinedVariable);
            this.outputExpression = ReadVariableSlotInfo(storage);

            this.references.Clear();
            int referenceCount = storage.ReadInteger(FieldCode.ReferencesCount);
            for (int i = 0; i < referenceCount; i++)
                this.references.Add(ReadVariableSlotInfo(storage));

            // @TODO(Sean): Write Serialize/Deserialize test cases with and without children.
            this.children.Clear();
            int childrenCount = storage.ReadInteger(FieldCode.ChildrenCount);
            for (int i = 0; i < childrenCount; i++)
                this.children.Add(new Statement(storage));

            return true;
        }
开发者ID:samuto,项目名称:designscript,代码行数:24,代码来源:Statement.cs

示例4: Deserialize

        public bool Deserialize(IStorage storage)
        {
            if (storage == null)
                throw new ArgumentNullException("storage");

            uint signature = storage.ReadUnsignedInteger(FieldCode.RuntimeStatesSignature);
            if (signature != Configurations.RuntimeStatesSignature)
                throw new InvalidOperationException("Invalid input data");

            try
            {
                // Here we attempt to take a snapshot of what variables are currently
                // defined in the system, and which is the node defining it.
                //
                Dictionary<string, uint> oldDefinitions = null;
                if (null != this.undefinedVarsTracker)
                {
                    oldDefinitions = new Dictionary<string, uint>();
                    foreach (KeyValuePair<string, List<uint>> kvp in variableNodesMap)
                    {
                        List<uint> definingNodes = kvp.Value;
                        if (null != definingNodes && (definingNodes.Count > 0))
                            oldDefinitions.Add(kvp.Key, definingNodes[0]);
                    }
                }

                this.version = (RuntimeStates.Version)storage.ReadInteger(FieldCode.RuntimeStatesVersion);
                this.IsModified = storage.ReadBoolean(FieldCode.IsModified);

                int variableNodesMapCount = storage.ReadInteger(FieldCode.VariableNodesMapCount);
                this.variableNodesMap.Clear();
                for (int i = 0; i < variableNodesMapCount; i++)
                {
                    string key = storage.ReadString(FieldCode.VariableNodesMapKey);
                    List<uint> value = new List<uint>();
                    int valueCount = storage.ReadInteger(FieldCode.VariableNodesMapValueCount);
                    for (int j = 0; j < valueCount; j++)
                        value.Add(storage.ReadUnsignedInteger(FieldCode.VariableNodesMapValue));
                    this.variableNodesMap.Add(key, value);
                }

                // After deserialization is done, we'll move all the previously defined variables
                // into the "undefinedVarsTracker". Note that we copy ALL of them into the tracker,
                // but some of them may still be defined after the "variableNodesMap" got updated.
                // This is because eventually these variables which are still in the system will
                // be removed in the final pass in "EndDefinitionMonitor" call.
                //
                if (null != oldDefinitions && (oldDefinitions.Count > 0))
                {
                    foreach (KeyValuePair<string, uint> oldDefinition in oldDefinitions)
                    {
                        string name = oldDefinition.Key;
                        uint nodeId = oldDefinition.Value;
                        if (!undefinedVarsTracker.ContainsKey(nodeId))
                            undefinedVarsTracker[nodeId] = new List<string>();

                        List<string> variables = undefinedVarsTracker[nodeId];
                        if (!variables.Contains(name))
                            variables.Add(name);
                    }
                }

                return true;
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message + "\n RuntimeStates deserialization failed.");
                return false;
            }
        }
开发者ID:samuto,项目名称:designscript,代码行数:70,代码来源:RuntimeStates.cs

示例5: Deserialize

        public virtual bool Deserialize(IStorage storage)
        {
            if (storage == null)
                throw new ArgumentNullException("storage");

            if (storage.ReadUnsignedInteger(FieldCode.NodeSignature) != Configurations.NodeSignature)
                throw new InvalidOperationException("Invalid input data");

            try
            {
                this.nodeType = (NodeType)storage.ReadInteger(FieldCode.NodeType);
                this.version = (VisualNode.Version)storage.ReadInteger(FieldCode.NodeVersion);
                this.nodeId = storage.ReadUnsignedInteger(FieldCode.NodeId);
                this.nodeState = (States)storage.ReadInteger(FieldCode.NodeState);
                this.Text = storage.ReadString(FieldCode.Text);
                this.Caption = storage.ReadString(FieldCode.Caption);
                this.nodePosition.X = storage.ReadDouble(FieldCode.NodePositionX);
                this.nodePosition.Y = storage.ReadDouble(FieldCode.NodePositionY);

                int inputSlotsCount = storage.ReadInteger(FieldCode.InputSlotsCount);
                this.inputSlots.Clear();
                for (int i = 0; i < inputSlotsCount; i++)
                    this.inputSlots.Add(storage.ReadUnsignedInteger(FieldCode.InputSlots));

                int outputSlotsCount = storage.ReadInteger(FieldCode.OutputSlotsCount);
                this.outputSlots.Clear();
                for (int j = 0; j < outputSlotsCount; j++)
                    this.outputSlots.Add(storage.ReadUnsignedInteger(FieldCode.OutputSlots));

                this.Dirty = true; // Mark as dirty for painting.
                return true;
            }
            catch (Exception e)
            {
                //@TODO(Zx): Move this to error handler
                Console.WriteLine(e.Message + "\n Visual node deserialization failed.");
                return false;
            }
        }
开发者ID:samuto,项目名称:designscript,代码行数:39,代码来源:VisualNode.cs

示例6: Deserialize

        public bool Deserialize(IStorage storage)
        {
            if (storage == null)
                throw new ArgumentNullException("storage");

            if (storage.ReadUnsignedInteger(FieldCode.GraphPropertiesSignature) != Configurations.GraphPropertiesSignature)
                throw new InvalidOperationException("Invalid input data");

            int value = storage.ReadInteger(FieldCode.GraphPropertiesVersion);
            string appVersion = storage.ReadString(FieldCode.ApplicationVersion, "0.1.0.0");

            GraphProperties.Version loadedVersion = ((GraphProperties.Version)value);
            if (loadedVersion > GraphProperties.Version.Current)
                throw new FileVersionException(appVersion);

            // There are three scenarios when it comes to the value of "appVersion":
            //
            //   1. It was not stored in the file, in which case it is an ancient file.
            //   2. It was stored, but different from the current DLL version.
            //   3. It was stored, and it is the same as the current DLL version.
            //
            // In any of the above cases, there's no need to set "ApplicationVersion"
            // locally since appVersion's sole purpose is to be displayed when the
            // "FileVersionException" is thrown (for use on the dialog). When we
            // store "GraphProperties", it is always written with the current DLL
            // version (set in the constructor of "GraphProperties" object).
            //
            // this.ApplicationVersion = appVersion;

            this.version = loadedVersion;
            this.AuthorName = storage.ReadString(FieldCode.AuthorName);
            this.CompanyName = storage.ReadString(FieldCode.CompanyName);
            this.ImportedScripts.Clear();

            // We optionally store the number of imported scripts in the BIN file.
            int importedSciptsCount = storage.ReadInteger(FieldCode.ImportedScriptsCount, 0);
            for (int i = 0; i < importedSciptsCount; i++)
                this.ImportedScripts.Add(storage.ReadString(FieldCode.ImportedScript));

            this.RuntimeStates.Deserialize(storage);
            return true;
        }
开发者ID:samuto,项目名称:designscript,代码行数:42,代码来源:GraphProperties.cs

示例7: Deserialize

        public override bool Deserialize(IStorage storage)
        {
            if (storage == null)
                throw new ArgumentNullException("storage");

            try
            {
                base.Deserialize(storage);
                this.Assembly = storage.ReadString(FieldCode.Assembly);
                this.QualifiedName = storage.ReadString(FieldCode.QualifiedName);
                this.ArgumentTypes = storage.ReadString(FieldCode.ArgumentTypes);
                this.argumentNames = CoreComponent.Instance.GetArgumentNames(this.Assembly, this.QualifiedName, this.ArgumentTypes);
                this.UpdateReturnTypeAndMemberType();

                replicationGuides.Clear();

                if (storage.PeekUnsignedLong() == FieldCode.ReplicationGuides)
                    this.LoadLegacyReplicationGuide(storage);
                else
                {
                    int replicationArgumentCount = storage.ReadInteger(FieldCode.ReplicationArgumentCount);
                    for (int i = 0; i < replicationArgumentCount; i++)
                    {
                        List<int> repGuidesForThisArgument = new List<int>();
                        int replicationIndexCount = storage.ReadInteger(FieldCode.ReplicationIndexCount);
                        for (int j = 0; j < replicationIndexCount; j++)
                            repGuidesForThisArgument.Add(storage.ReadInteger(FieldCode.ReplicationIndex));

                        replicationGuides.Add(repGuidesForThisArgument);
                    }
                }

                UpdateReplicationGuideStrings();
                return true;
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message + "\n Function node deserialization failed.");
                return false;
            }
        }
开发者ID:samuto,项目名称:designscript,代码行数:41,代码来源:FunctionNode.cs

示例8: Deserialize

        public override bool Deserialize(IStorage storage)
        {
            if (storage == null)
                throw new ArgumentNullException("storage");

            try
            {
                base.Deserialize(storage);
                this.compilableText = storage.ReadString(FieldCode.CompilableText);

                int inputLinesCount = storage.ReadInteger(FieldCode.InputLinesCount);
                this.inputLines.Clear();
                for (int i = 0; i < inputLinesCount; i++)
                {
                    int statementIndex = storage.ReadInteger(FieldCode.StatmentIndex);
                    int variableLineCount = storage.ReadInteger(FieldCode.VariableLineCount);
                    List<VariableLine> variableLines = new List<VariableLine>();
                    for (int j = 0; j < variableLineCount; j++)
                    {
                        string variable = storage.ReadString(FieldCode.Variable);
                        int line = storage.ReadInteger(FieldCode.Line);
                        variableLines.Add(new VariableLine(variable, line));
                    }
                    this.inputLines.Add(statementIndex, variableLines);
                }

                int outputLinesCount = storage.ReadInteger(FieldCode.OutputLinesCount);
                this.outputLines.Clear();
                for (int i = 0; i < outputLinesCount; i++)
                {
                    string variable = storage.ReadString(FieldCode.Variable);
                    int line = storage.ReadInteger(FieldCode.Line);
                    this.outputLines.Add(new VariableLine(variable, line));
                }

                return true;
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message + "\n Code block node deserialization failed.");
                return false;
            }
        }
开发者ID:samuto,项目名称:designscript,代码行数:43,代码来源:CodeBlockNode.cs


注:本文中的IStorage.ReadString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。